@contember/binding 1.1.0-rc.4 → 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.
- package/dist/development/accessorPropagation/AccessorProvider.js +7 -14
- package/dist/development/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsProvider.js +3 -7
- package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +1 -1
- package/dist/development/accessorPropagation/EntityKeyProvider.js +3 -7
- package/dist/development/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/development/accessorPropagation/EnvironmentContext.js +39 -56
- package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/development/accessorPropagation/TreeRootIdProvider.js +3 -7
- package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +104 -89
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/development/accessorSorting/errors.js.map +1 -1
- package/dist/development/accessorSorting/useSortedEntities.js +15 -18
- package/dist/development/accessorSorting/useSortedEntities.js.map +1 -1
- package/dist/development/accessorTree/AccessorTree.js +20 -39
- package/dist/development/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/accessorTree/RuntimeId.js +1 -1
- package/dist/development/accessorTree/RuntimeId.js.map +1 -1
- package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/development/core/AccessorErrorManager.js +6 -6
- package/dist/development/core/AccessorErrorManager.js.map +1 -1
- package/dist/development/core/Config.js.map +1 -1
- package/dist/development/core/DataBinding.js +16 -16
- package/dist/development/core/DataBinding.js.map +1 -1
- package/dist/development/core/DirtinessTracker.js.map +1 -1
- package/dist/development/core/EventManager.js +11 -11
- package/dist/development/core/EventManager.js.map +1 -1
- package/dist/development/core/IncrementalMarkerBuilder.js +5 -5
- package/dist/development/core/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/development/core/MarkerTreeGenerator.js +6 -6
- package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/development/core/MutationGenerator.js +18 -12
- package/dist/development/core/MutationGenerator.js.map +1 -1
- package/dist/development/core/RealmKeyGenerator.js +2 -2
- package/dist/development/core/RealmKeyGenerator.js.map +1 -1
- package/dist/development/core/StateInitializer.js +8 -8
- package/dist/development/core/StateInitializer.js.map +1 -1
- package/dist/development/core/TreeAugmenter.js.map +1 -1
- package/dist/development/core/TreeStore.js +7 -7
- package/dist/development/core/TreeStore.js.map +1 -1
- package/dist/development/core/exceptions/ErrorLocator.js +3 -3
- package/dist/development/core/exceptions/ErrorLocator.js.map +1 -1
- package/dist/development/core/schema/SchemaLoader.js +2 -2
- package/dist/development/core/schema/SchemaLoader.js.map +1 -1
- package/dist/development/core/state/StateIterator.js.map +1 -1
- package/dist/development/coreComponents/Component.js.map +1 -1
- package/dist/development/coreComponents/DataBindingProvider.js +11 -11
- package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/development/coreComponents/Entity.js +11 -15
- package/dist/development/coreComponents/Entity.js.map +1 -1
- package/dist/development/coreComponents/EntityList.js +35 -31
- package/dist/development/coreComponents/EntityList.js.map +1 -1
- package/dist/development/coreComponents/EntityListSubTree.js +41 -41
- package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/development/coreComponents/EntitySubTree.js +63 -51
- package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/development/coreComponents/Field.js +28 -20
- package/dist/development/coreComponents/Field.js.map +1 -1
- package/dist/development/coreComponents/HasMany.js +30 -33
- package/dist/development/coreComponents/HasMany.js.map +1 -1
- package/dist/development/coreComponents/HasOne.js +30 -33
- package/dist/development/coreComponents/HasOne.js.map +1 -1
- package/dist/development/coreComponents/ParentEntity.js +12 -6
- package/dist/development/coreComponents/ParentEntity.js.map +1 -1
- package/dist/development/fieldHelpers/helpers/FieldHelper.js +1 -1
- package/dist/development/fieldHelpers/helpers/FieldHelper.js.map +1 -1
- package/dist/development/helperComponents/DeferredSubTrees.js +83 -86
- package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/development/helperComponents/EntityView.js +5 -3
- package/dist/development/helperComponents/EntityView.js.map +1 -1
- package/dist/development/helperComponents/FieldView.js +50 -36
- package/dist/development/helperComponents/FieldView.js.map +1 -1
- package/dist/development/helperComponents/If.js +70 -63
- package/dist/development/helperComponents/If.js.map +1 -1
- package/dist/development/helperComponents/StaticRender.js +9 -5
- package/dist/development/helperComponents/StaticRender.js.map +1 -1
- package/dist/development/helperComponents/SugaredField.js +6 -13
- package/dist/development/helperComponents/SugaredField.js.map +1 -1
- package/dist/development/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/development/markers/EntityListSubTreeMarker.js +2 -2
- package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/development/markers/EntitySubTreeMarker.js +2 -2
- package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/development/markers/FieldMarker.js +2 -2
- package/dist/development/markers/FieldMarker.js.map +1 -1
- package/dist/development/markers/HasManyRelationMarker.js +3 -3
- package/dist/development/markers/HasManyRelationMarker.js.map +1 -1
- package/dist/development/markers/HasOneRelationMarker.js +2 -2
- package/dist/development/markers/HasOneRelationMarker.js.map +1 -1
- package/dist/development/queryLanguage/CacheStore.js +1 -1
- package/dist/development/queryLanguage/CacheStore.js.map +1 -1
- package/dist/development/queryLanguage/Parser.js +7 -7
- package/dist/development/queryLanguage/Parser.js.map +1 -1
- package/dist/development/queryLanguage/QueryLanguage.js +6 -6
- package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/development/structures/BijectiveIndexedMap.js +1 -1
- package/dist/development/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/development/structures/LRUCache.js +1 -1
- package/dist/development/structures/LRUCache.js.map +1 -1
- package/dist/development/structures/WeakIdCache.js.map +1 -1
- package/dist/production/accessorPropagation/AccessorProvider.js +2 -8
- package/dist/production/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsProvider.js +2 -5
- package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +1 -1
- package/dist/production/accessorPropagation/EntityKeyProvider.js +2 -5
- package/dist/production/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/production/accessorPropagation/EnvironmentContext.js +23 -43
- package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/production/accessorPropagation/TreeRootIdProvider.js +2 -5
- package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/production/accessorSorting/SetOrderFieldOnCreate.js +62 -62
- package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/production/accessorSorting/errors.js.map +1 -1
- package/dist/production/accessorSorting/useSortedEntities.js +15 -18
- package/dist/production/accessorSorting/useSortedEntities.js.map +1 -1
- package/dist/production/accessorTree/AccessorTree.js +3 -21
- package/dist/production/accessorTree/AccessorTree.js.map +1 -1
- package/dist/production/accessorTree/RuntimeId.js +1 -1
- package/dist/production/accessorTree/RuntimeId.js.map +1 -1
- package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
- package/dist/production/core/AccessorErrorManager.js +6 -6
- package/dist/production/core/AccessorErrorManager.js.map +1 -1
- package/dist/production/core/Config.js.map +1 -1
- package/dist/production/core/DataBinding.js +16 -16
- package/dist/production/core/DataBinding.js.map +1 -1
- package/dist/production/core/DirtinessTracker.js.map +1 -1
- package/dist/production/core/EventManager.js +11 -11
- package/dist/production/core/EventManager.js.map +1 -1
- package/dist/production/core/IncrementalMarkerBuilder.js +5 -5
- package/dist/production/core/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/production/core/MarkerTreeGenerator.js +6 -6
- package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
- package/dist/production/core/MutationGenerator.js +18 -12
- package/dist/production/core/MutationGenerator.js.map +1 -1
- package/dist/production/core/RealmKeyGenerator.js +2 -2
- package/dist/production/core/RealmKeyGenerator.js.map +1 -1
- package/dist/production/core/StateInitializer.js +8 -8
- package/dist/production/core/StateInitializer.js.map +1 -1
- package/dist/production/core/TreeAugmenter.js.map +1 -1
- package/dist/production/core/TreeStore.js +7 -7
- package/dist/production/core/TreeStore.js.map +1 -1
- package/dist/production/core/exceptions/ErrorLocator.js +3 -3
- package/dist/production/core/exceptions/ErrorLocator.js.map +1 -1
- package/dist/production/core/schema/SchemaLoader.js +2 -2
- package/dist/production/core/schema/SchemaLoader.js.map +1 -1
- package/dist/production/core/state/StateIterator.js.map +1 -1
- package/dist/production/coreComponents/Component.js.map +1 -1
- package/dist/production/coreComponents/DataBindingProvider.js +10 -9
- package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/production/coreComponents/Entity.js +7 -10
- package/dist/production/coreComponents/Entity.js.map +1 -1
- package/dist/production/coreComponents/EntityList.js +25 -28
- package/dist/production/coreComponents/EntityList.js.map +1 -1
- package/dist/production/coreComponents/EntityListSubTree.js +29 -28
- package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/production/coreComponents/EntitySubTree.js +39 -34
- package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/production/coreComponents/Field.js +20 -20
- package/dist/production/coreComponents/Field.js.map +1 -1
- package/dist/production/coreComponents/HasMany.js +18 -20
- package/dist/production/coreComponents/HasMany.js.map +1 -1
- package/dist/production/coreComponents/HasOne.js +18 -20
- package/dist/production/coreComponents/HasOne.js.map +1 -1
- package/dist/production/coreComponents/ParentEntity.js +8 -6
- package/dist/production/coreComponents/ParentEntity.js.map +1 -1
- package/dist/production/fieldHelpers/helpers/FieldHelper.js +1 -1
- package/dist/production/fieldHelpers/helpers/FieldHelper.js.map +1 -1
- package/dist/production/helperComponents/DeferredSubTrees.js +67 -77
- package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/production/helperComponents/EntityView.js +1 -3
- package/dist/production/helperComponents/EntityView.js.map +1 -1
- package/dist/production/helperComponents/FieldView.js +38 -31
- package/dist/production/helperComponents/FieldView.js.map +1 -1
- package/dist/production/helperComponents/If.js +40 -52
- package/dist/production/helperComponents/If.js.map +1 -1
- package/dist/production/helperComponents/StaticRender.js +5 -5
- package/dist/production/helperComponents/StaticRender.js.map +1 -1
- package/dist/production/helperComponents/SugaredField.js +2 -8
- package/dist/production/helperComponents/SugaredField.js.map +1 -1
- package/dist/production/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/production/markers/EntityListSubTreeMarker.js +2 -2
- package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
- package/dist/production/markers/EntitySubTreeMarker.js +2 -2
- package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
- package/dist/production/markers/FieldMarker.js +2 -2
- package/dist/production/markers/FieldMarker.js.map +1 -1
- package/dist/production/markers/HasManyRelationMarker.js +2 -2
- package/dist/production/markers/HasManyRelationMarker.js.map +1 -1
- package/dist/production/markers/HasOneRelationMarker.js +2 -2
- package/dist/production/markers/HasOneRelationMarker.js.map +1 -1
- package/dist/production/queryLanguage/CacheStore.js +1 -1
- package/dist/production/queryLanguage/CacheStore.js.map +1 -1
- package/dist/production/queryLanguage/Parser.js +7 -7
- package/dist/production/queryLanguage/Parser.js.map +1 -1
- package/dist/production/queryLanguage/QueryLanguage.js +6 -6
- package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
- package/dist/production/structures/BijectiveIndexedMap.js +1 -1
- package/dist/production/structures/BijectiveIndexedMap.js.map +1 -1
- package/dist/production/structures/LRUCache.js +1 -1
- package/dist/production/structures/LRUCache.js.map +1 -1
- package/dist/production/structures/WeakIdCache.js.map +1 -1
- package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts +1 -1
- package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts.map +1 -1
- package/dist/types/accessorSorting/SortedEntities.d.ts +1 -1
- package/dist/types/accessorSorting/SortedEntities.d.ts.map +1 -1
- package/dist/types/accessorSorting/errors.d.ts +0 -3
- package/dist/types/accessorSorting/errors.d.ts.map +1 -1
- package/dist/types/accessorSorting/useSortedEntities.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeState.d.ts +1 -1
- package/dist/types/accessorTree/AccessorTreeState.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeStateAction.d.ts +1 -1
- package/dist/types/accessorTree/AccessorTreeStateAction.d.ts.map +1 -1
- package/dist/types/accessorTree/MutationRequestResponse.d.ts +3 -3
- package/dist/types/accessorTree/MutationRequestResponse.d.ts.map +1 -1
- package/dist/types/accessorTree/NormalizedPersistedData.d.ts +5 -5
- package/dist/types/accessorTree/NormalizedPersistedData.d.ts.map +1 -1
- package/dist/types/accessorTree/PersistResult.d.ts +2 -2
- package/dist/types/accessorTree/PersistResult.d.ts.map +1 -1
- package/dist/types/accessorTree/QueryRequestResponse.d.ts +3 -3
- package/dist/types/accessorTree/QueryRequestResponse.d.ts.map +1 -1
- package/dist/types/accessorTree/RequestError.d.ts +1 -1
- package/dist/types/accessorTree/RequestError.d.ts.map +1 -1
- package/dist/types/accessorTree/RuntimeId.d.ts +2 -2
- package/dist/types/accessorTree/RuntimeId.d.ts.map +1 -1
- package/dist/types/accessors/ExtendTree.d.ts +1 -1
- package/dist/types/accessors/ExtendTree.d.ts.map +1 -1
- package/dist/types/accessors/GetEntityByKey.d.ts +1 -1
- package/dist/types/accessors/GetEntityByKey.d.ts.map +1 -1
- package/dist/types/accessors/GetEntityListSubTree.d.ts +1 -1
- package/dist/types/accessors/GetEntityListSubTree.d.ts.map +1 -1
- package/dist/types/accessors/GetEntitySubTree.d.ts +1 -1
- package/dist/types/accessors/GetEntitySubTree.d.ts.map +1 -1
- package/dist/types/accessors/Persist.d.ts +1 -1
- package/dist/types/accessors/Persist.d.ts.map +1 -1
- package/dist/types/accessors/PersistErrorOptions.d.ts +1 -1
- package/dist/types/accessors/PersistErrorOptions.d.ts.map +1 -1
- package/dist/types/core/MutationGenerator.d.ts +3 -2
- package/dist/types/core/MutationGenerator.d.ts.map +1 -1
- package/dist/types/core/QueryGenerator.d.ts +1 -1
- package/dist/types/core/QueryGenerator.d.ts.map +1 -1
- package/dist/types/core/exceptions/RawMarkerPath.d.ts +1 -1
- package/dist/types/core/exceptions/RawMarkerPath.d.ts.map +1 -1
- package/dist/types/core/schema/RawSchemaEntity.d.ts +1 -1
- package/dist/types/core/schema/RawSchemaEntity.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaColumnType.d.ts +2 -2
- package/dist/types/core/schema/SchemaColumnType.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaEntities.d.ts +1 -1
- package/dist/types/core/schema/SchemaEntities.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaEnums.d.ts +3 -3
- package/dist/types/core/schema/SchemaEnums.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaField.d.ts +1 -1
- package/dist/types/core/schema/SchemaField.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaFields.d.ts +1 -1
- package/dist/types/core/schema/SchemaFields.d.ts.map +1 -1
- package/dist/types/core/schema/SchemaRelation.d.ts +1 -1
- package/dist/types/core/schema/SchemaRelation.d.ts.map +1 -1
- package/dist/types/core/state/EntityListState.d.ts +1 -1
- package/dist/types/core/state/EntityListState.d.ts.map +1 -1
- package/dist/types/core/state/EntityRealmState.d.ts +1 -1
- package/dist/types/core/state/EntityRealmState.d.ts.map +1 -1
- package/dist/types/core/state/StateNode.d.ts +3 -3
- package/dist/types/core/state/StateNode.d.ts.map +1 -1
- package/dist/types/coreComponents/DataBindingProvider.d.ts +2 -2
- package/dist/types/coreComponents/DataBindingProvider.d.ts.map +1 -1
- package/dist/types/coreComponents/Entity.d.ts +1 -1
- package/dist/types/coreComponents/Entity.d.ts.map +1 -1
- package/dist/types/coreComponents/EntityList.d.ts +1 -1
- package/dist/types/coreComponents/EntityList.d.ts.map +1 -1
- package/dist/types/coreComponents/EntityListSubTree.d.ts +1 -1
- package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
- package/dist/types/coreComponents/EntitySubTree.d.ts +2 -2
- package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -1
- package/dist/types/coreComponents/HasMany.d.ts +1 -1
- package/dist/types/coreComponents/HasMany.d.ts.map +1 -1
- package/dist/types/coreComponents/HasOne.d.ts +1 -1
- package/dist/types/coreComponents/HasOne.d.ts.map +1 -1
- package/dist/types/coreComponents/MarkerProvider.d.ts +3 -3
- package/dist/types/coreComponents/MarkerProvider.d.ts.map +1 -1
- package/dist/types/helperComponents/FieldView.d.ts +5 -5
- package/dist/types/helperComponents/FieldView.d.ts.map +1 -1
- package/dist/types/helperComponents/If.d.ts +1 -1
- package/dist/types/helperComponents/If.d.ts.map +1 -1
- package/dist/types/markers/EntityFieldMarkers.d.ts +2 -2
- package/dist/types/markers/EntityFieldMarkers.d.ts.map +1 -1
- package/dist/types/markers/EntityFieldPlaceholders.d.ts +1 -1
- package/dist/types/markers/EntityFieldPlaceholders.d.ts.map +1 -1
- package/dist/types/markers/MeaningfulMarker.d.ts +1 -1
- package/dist/types/markers/MeaningfulMarker.d.ts.map +1 -1
- package/dist/types/markers/SubTreeMarkers.d.ts +1 -1
- package/dist/types/markers/SubTreeMarkers.d.ts.map +1 -1
- package/dist/types/queryLanguage/QueryLanguage.d.ts +2 -3
- package/dist/types/queryLanguage/QueryLanguage.d.ts.map +1 -1
- package/dist/types/treeParameters/EntityListEventListeners.d.ts +4 -4
- package/dist/types/treeParameters/EntityListEventListeners.d.ts.map +1 -1
- package/dist/types/treeParameters/EventListenersStore.d.ts +1 -1
- package/dist/types/treeParameters/EventListenersStore.d.ts.map +1 -1
- package/dist/types/treeParameters/FieldEventListeners.d.ts +3 -3
- package/dist/types/treeParameters/FieldEventListeners.d.ts.map +1 -1
- package/dist/types/treeParameters/SetOnCreate.d.ts +2 -2
- package/dist/types/treeParameters/SetOnCreate.d.ts.map +1 -1
- package/dist/types/treeParameters/SingleEntityEventListeners.d.ts +3 -3
- package/dist/types/treeParameters/SingleEntityEventListeners.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/Alias.d.ts +1 -1
- package/dist/types/treeParameters/primitives/Alias.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/EntityId.d.ts +1 -1
- package/dist/types/treeParameters/primitives/EntityId.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/EntityName.d.ts +1 -1
- package/dist/types/treeParameters/primitives/EntityName.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/EntityRealmKey.d.ts +1 -1
- package/dist/types/treeParameters/primitives/EntityRealmKey.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/ExpectedEntityCount.d.ts +1 -1
- package/dist/types/treeParameters/primitives/ExpectedEntityCount.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/ExpectedQualifiedEntityMutation.d.ts +1 -1
- package/dist/types/treeParameters/primitives/ExpectedQualifiedEntityMutation.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/ExpectedRelationMutation.d.ts +1 -1
- package/dist/types/treeParameters/primitives/ExpectedRelationMutation.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/FieldName.d.ts +1 -1
- package/dist/types/treeParameters/primitives/FieldName.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/FieldValue.d.ts +2 -2
- package/dist/types/treeParameters/primitives/FieldValue.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/Filter.d.ts +2 -2
- package/dist/types/treeParameters/primitives/Filter.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/Json.d.ts +1 -1
- package/dist/types/treeParameters/primitives/Json.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/Limit.d.ts +1 -1
- package/dist/types/treeParameters/primitives/Limit.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/Offset.d.ts +1 -1
- package/dist/types/treeParameters/primitives/Offset.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/OrderBy.d.ts +2 -2
- package/dist/types/treeParameters/primitives/OrderBy.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/PlaceholderName.d.ts +1 -1
- package/dist/types/treeParameters/primitives/PlaceholderName.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/RemovalType.d.ts +1 -1
- package/dist/types/treeParameters/primitives/RemovalType.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/Scalar.d.ts +1 -1
- package/dist/types/treeParameters/primitives/Scalar.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/TreeRootId.d.ts +1 -1
- package/dist/types/treeParameters/primitives/TreeRootId.d.ts.map +1 -1
- package/dist/types/treeParameters/primitives/UniqueWhere.d.ts +2 -2
- package/dist/types/treeParameters/primitives/UniqueWhere.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -13
- package/src/accessorSorting/SortedEntities.ts +1 -1
- package/src/accessorSorting/errors.ts +0 -7
- package/src/accessorSorting/useSortedEntities.ts +15 -18
- package/src/accessorTree/MutationRequestResponse.ts +1 -1
- package/src/core/MutationGenerator.ts +16 -5
- package/LICENSE +0 -186
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { MarkerSugarer } from "./MarkerSugarer.js";
|
|
2
|
+
import { TreeParameterSugarer } from "./TreeParameterSugarer.js";
|
|
3
|
+
import { assertNever } from "../../utils/assertNever.js";
|
|
1
4
|
var __defProp = Object.defineProperty;
|
|
2
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
6
|
var __publicField = (obj, key, value) => {
|
|
4
7
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
8
|
return value;
|
|
6
9
|
};
|
|
7
|
-
import { MarkerSugarer } from "./MarkerSugarer.js";
|
|
8
|
-
import { TreeParameterSugarer } from "./TreeParameterSugarer.js";
|
|
9
|
-
import { assertNever } from "../../utils/assertNever.js";
|
|
10
10
|
class ErrorLocator {
|
|
11
11
|
static locateMarkerPath(path) {
|
|
12
12
|
return path.map((marker) => MarkerSugarer.sugarMarker(marker)).join(this.GLUE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorLocator.js","sources":["../../../../src/core/exceptions/ErrorLocator.ts"],"sourcesContent":["import { assertNever } from '../../utils'\nimport type { StateNode } from '../state'\nimport { MarkerSugarer } from './MarkerSugarer'\nimport type { RawMarkerPath } from './RawMarkerPath'\nimport { TreeParameterSugarer } from './TreeParameterSugarer'\n\nexport class ErrorLocator {\n\tprivate static readonly GLUE = '.'\n\n\tpublic static locateMarkerPath(path: RawMarkerPath): string {\n\t\treturn path.map(marker => MarkerSugarer.sugarMarker(marker)).join(this.GLUE)\n\t}\n\n\tpublic static locateInternalState(state: StateNode): string {\n\t\tfunction stateToPath(state: StateNode | undefined): string[] {\n\t\t\tif (state === undefined) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tswitch (state.type) {\n\t\t\t\tcase 'field':\n\t\t\t\t\treturn [...stateToPath(state.parent), TreeParameterSugarer.sugarField(state.fieldMarker.fieldName)]\n\t\t\t\tcase 'entityRealm': {\n\t\t\t\t\tconst blueprint = state.blueprint\n\t\t\t\t\tif (blueprint.type === 'subTree') {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tTreeParameterSugarer.sugarRootEntity(\n\t\t\t\t\t\t\t\tstate.entity.entityName,\n\t\t\t\t\t\t\t\tblueprint.marker.parameters.isCreating ? undefined : blueprint.marker.parameters.where,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t\tif (blueprint.type === 'listEntity') {\n\t\t\t\t\t\treturn [...stateToPath(blueprint.parent)]\n\t\t\t\t\t}\n\t\t\t\t\tif (blueprint.type === 'hasOne') {\n\t\t\t\t\t\treturn [...stateToPath(blueprint.parent), MarkerSugarer.sugarHasOneRelationMarker(blueprint.marker)]\n\t\t\t\t\t}\n\t\t\t\t\treturn assertNever(blueprint)\n\t\t\t\t}\n\t\t\t\tcase 'entityList': {\n\t\t\t\t\tconst blueprint = state.blueprint\n\n\t\t\t\t\tif (blueprint.parent === undefined) {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tTreeParameterSugarer.sugarRootEntityList(\n\t\t\t\t\t\t\t\tstate.entityName,\n\t\t\t\t\t\t\t\tblueprint.marker.parameters.isCreating ? undefined : blueprint.marker.parameters.filter,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t\tconst hasMany = blueprint.marker\n\t\t\t\t\treturn [...stateToPath(blueprint.parent), MarkerSugarer.sugarHasManyRelationMarker(hasMany)]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn stateToPath(state).join(this.GLUE)\n\t}\n}\n"],"names":["state"],"mappings":";;;;;;;;;AAMO,MAAM,aAAa;AAAA,EAGzB,OAAc,iBAAiB,MAA6B;AACpD,WAAA,KAAK,IAAI,CAAA,WAAU,cAAc,YAAY,MAAM,CAAC,EAAE,KAAK,KAAK,IAAI;AAAA,EAC5E;AAAA,EAEA,OAAc,oBAAoB,OAA0B;AAC3D,aAAS,YAAYA,QAAwC;AAC5D,UAAIA,WAAU,QAAW;AACxB,eAAO;MACR;AACA,cAAQA,OAAM;AAAA,
|
|
1
|
+
{"version":3,"file":"ErrorLocator.js","sources":["../../../../src/core/exceptions/ErrorLocator.ts"],"sourcesContent":["import { assertNever } from '../../utils'\nimport type { StateNode } from '../state'\nimport { MarkerSugarer } from './MarkerSugarer'\nimport type { RawMarkerPath } from './RawMarkerPath'\nimport { TreeParameterSugarer } from './TreeParameterSugarer'\n\nexport class ErrorLocator {\n\tprivate static readonly GLUE = '.'\n\n\tpublic static locateMarkerPath(path: RawMarkerPath): string {\n\t\treturn path.map(marker => MarkerSugarer.sugarMarker(marker)).join(this.GLUE)\n\t}\n\n\tpublic static locateInternalState(state: StateNode): string {\n\t\tfunction stateToPath(state: StateNode | undefined): string[] {\n\t\t\tif (state === undefined) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tswitch (state.type) {\n\t\t\t\tcase 'field':\n\t\t\t\t\treturn [...stateToPath(state.parent), TreeParameterSugarer.sugarField(state.fieldMarker.fieldName)]\n\t\t\t\tcase 'entityRealm': {\n\t\t\t\t\tconst blueprint = state.blueprint\n\t\t\t\t\tif (blueprint.type === 'subTree') {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tTreeParameterSugarer.sugarRootEntity(\n\t\t\t\t\t\t\t\tstate.entity.entityName,\n\t\t\t\t\t\t\t\tblueprint.marker.parameters.isCreating ? undefined : blueprint.marker.parameters.where,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t\tif (blueprint.type === 'listEntity') {\n\t\t\t\t\t\treturn [...stateToPath(blueprint.parent)]\n\t\t\t\t\t}\n\t\t\t\t\tif (blueprint.type === 'hasOne') {\n\t\t\t\t\t\treturn [...stateToPath(blueprint.parent), MarkerSugarer.sugarHasOneRelationMarker(blueprint.marker)]\n\t\t\t\t\t}\n\t\t\t\t\treturn assertNever(blueprint)\n\t\t\t\t}\n\t\t\t\tcase 'entityList': {\n\t\t\t\t\tconst blueprint = state.blueprint\n\n\t\t\t\t\tif (blueprint.parent === undefined) {\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tTreeParameterSugarer.sugarRootEntityList(\n\t\t\t\t\t\t\t\tstate.entityName,\n\t\t\t\t\t\t\t\tblueprint.marker.parameters.isCreating ? undefined : blueprint.marker.parameters.filter,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t\tconst hasMany = blueprint.marker\n\t\t\t\t\treturn [...stateToPath(blueprint.parent), MarkerSugarer.sugarHasManyRelationMarker(hasMany)]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn stateToPath(state).join(this.GLUE)\n\t}\n}\n"],"names":["state"],"mappings":";;;;;;;;;AAMO,MAAM,aAAa;AAAA,EAGzB,OAAc,iBAAiB,MAA6B;AACpD,WAAA,KAAK,IAAI,CAAA,WAAU,cAAc,YAAY,MAAM,CAAC,EAAE,KAAK,KAAK,IAAI;AAAA,EAC5E;AAAA,EAEA,OAAc,oBAAoB,OAA0B;AAC3D,aAAS,YAAYA,QAAwC;AAC5D,UAAIA,WAAU,QAAW;AACxB,eAAO;MACR;AACA,cAAQA,OAAM,MAAM;AAAA,QACnB,KAAK;AACG,iBAAA,CAAC,GAAG,YAAYA,OAAM,MAAM,GAAG,qBAAqB,WAAWA,OAAM,YAAY,SAAS,CAAC;AAAA,QACnG,KAAK,eAAe;AACnB,gBAAM,YAAYA,OAAM;AACpB,cAAA,UAAU,SAAS,WAAW;AAC1B,mBAAA;AAAA,cACN,qBAAqB;AAAA,gBACpBA,OAAM,OAAO;AAAA,gBACb,UAAU,OAAO,WAAW,aAAa,SAAY,UAAU,OAAO,WAAW;AAAA,cAClF;AAAA,YAAA;AAAA,UAEF;AACI,cAAA,UAAU,SAAS,cAAc;AACpC,mBAAO,CAAC,GAAG,YAAY,UAAU,MAAM,CAAC;AAAA,UACzC;AACI,cAAA,UAAU,SAAS,UAAU;AACzB,mBAAA,CAAC,GAAG,YAAY,UAAU,MAAM,GAAG,cAAc,0BAA0B,UAAU,MAAM,CAAC;AAAA,UACpG;AACA,iBAAO,YAAqB;AAAA,QAC7B;AAAA,QACA,KAAK,cAAc;AAClB,gBAAM,YAAYA,OAAM;AAEpB,cAAA,UAAU,WAAW,QAAW;AAC5B,mBAAA;AAAA,cACN,qBAAqB;AAAA,gBACpBA,OAAM;AAAA,gBACN,UAAU,OAAO,WAAW,aAAa,SAAY,UAAU,OAAO,WAAW;AAAA,cAClF;AAAA,YAAA;AAAA,UAEF;AACA,gBAAM,UAAU,UAAU;AACnB,iBAAA,CAAC,GAAG,YAAY,UAAU,MAAM,GAAG,cAAc,2BAA2B,OAAO,CAAC;AAAA,QAC5F;AAAA,MACD;AAAA,IACD;AACA,WAAO,YAAY,KAAK,EAAE,KAAK,KAAK,IAAI;AAAA,EACzC;AACD;AAlDC,cADY,cACY,QAAO,GAAA;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Schema } from "./Schema.js";
|
|
2
|
+
import { SchemaPreprocessor } from "./SchemaPreprocessor.js";
|
|
1
3
|
var __defProp = Object.defineProperty;
|
|
2
4
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
5
|
var __publicField = (obj, key, value) => {
|
|
4
6
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
7
|
return value;
|
|
6
8
|
};
|
|
7
|
-
import { Schema } from "./Schema.js";
|
|
8
|
-
import { SchemaPreprocessor } from "./SchemaPreprocessor.js";
|
|
9
9
|
class SchemaLoader {
|
|
10
10
|
static async loadSchema(client, options) {
|
|
11
11
|
const existing = this.schemaLoadCache.get(client.apiUrl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaLoader.js","sources":["../../../../src/core/schema/SchemaLoader.ts"],"sourcesContent":["import type { GraphQlClient, GraphQlClientRequestOptions } from '@contember/client'\nimport type { RawSchema } from './RawSchema'\nimport { Schema } from './Schema'\nimport { SchemaPreprocessor } from './SchemaPreprocessor'\n\nexport class SchemaLoader {\n\tprivate static readonly schemaLoadCache: Map<string, Promise<Schema>> = new Map()\n\n\tprivate static readonly schemaQuery =\n\t\t'query {\\n' +\n\t\t' schema {\\n' +\n\t\t' enums {\\n' +\n\t\t' name\\n' +\n\t\t' values\\n' +\n\t\t' }\\n' +\n\t\t' entities {\\n' +\n\t\t' name\\n' +\n\t\t' customPrimaryAllowed\\n' +\n\t\t' unique {\\n' +\n\t\t' fields\\n' +\n\t\t' }\\n' +\n\t\t' fields {\\n' +\n\t\t' __typename\\n' +\n\t\t' name\\n' +\n\t\t' type\\n' +\n\t\t' nullable\\n' +\n\t\t' ... on _Column {\\n' +\n\t\t' enumName\\n' +\n\t\t' defaultValue\\n' +\n\t\t' }\\n' +\n\t\t' ... on _Relation {\\n' +\n\t\t' side\\n' +\n\t\t' targetEntity\\n' +\n\t\t' ownedBy\\n' +\n\t\t' inversedBy\\n' +\n\t\t' onDelete\\n' +\n\t\t' orphanRemoval\\n' +\n\t\t' orderBy {\\n' +\n\t\t' path\\n' +\n\t\t' direction\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t'}'\n\n\tpublic static async loadSchema(\n\t\tclient: GraphQlClient,\n\t\toptions?: GraphQlClientRequestOptions,\n\t): Promise<Schema> {\n\n\t\tconst existing = this.schemaLoadCache.get(client.apiUrl)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\t\tconst schemaPromise = (async () => {\n\t\t\tconst raw: { data: { schema: RawSchema } } = await client.sendRequest(this.schemaQuery, options)\n\t\t\treturn new Schema(SchemaPreprocessor.processRawSchema(raw.data.schema))\n\t\t})()\n\t\tthis.schemaLoadCache.set(client.apiUrl, schemaPromise)\n\t\treturn await schemaPromise\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAKO,MAAM,aAAa;AAAA,EA0CzB,aAAoB,WACnB,QACA,SACkB;AAElB,UAAM,WAAW,KAAK,gBAAgB,IAAI,OAAO,MAAM;AACvD,QAAI,aAAa,QAAW;AACpB,aAAA;AAAA,IACR;AACA,UAAM,iBAAiB,YAAY;AAClC,YAAM,MAAuC,MAAM,OAAO,YAAY,KAAK,aAAa,OAAO;AAC/F,aAAO,IAAI,OAAO,mBAAmB,iBAAiB,IAAI,KAAK,MAAM,CAAC;AAAA,IAAA;AAEvE,SAAK,gBAAgB,IAAI,OAAO,QAAQ,aAAa;AACrD,WAAO,MAAM;AAAA,EACd;AACD;AAzDC,cADY,cACY,mBAAgD,oBAAI;
|
|
1
|
+
{"version":3,"file":"SchemaLoader.js","sources":["../../../../src/core/schema/SchemaLoader.ts"],"sourcesContent":["import type { GraphQlClient, GraphQlClientRequestOptions } from '@contember/client'\nimport type { RawSchema } from './RawSchema'\nimport { Schema } from './Schema'\nimport { SchemaPreprocessor } from './SchemaPreprocessor'\n\nexport class SchemaLoader {\n\tprivate static readonly schemaLoadCache: Map<string, Promise<Schema>> = new Map()\n\n\tprivate static readonly schemaQuery =\n\t\t'query {\\n' +\n\t\t' schema {\\n' +\n\t\t' enums {\\n' +\n\t\t' name\\n' +\n\t\t' values\\n' +\n\t\t' }\\n' +\n\t\t' entities {\\n' +\n\t\t' name\\n' +\n\t\t' customPrimaryAllowed\\n' +\n\t\t' unique {\\n' +\n\t\t' fields\\n' +\n\t\t' }\\n' +\n\t\t' fields {\\n' +\n\t\t' __typename\\n' +\n\t\t' name\\n' +\n\t\t' type\\n' +\n\t\t' nullable\\n' +\n\t\t' ... on _Column {\\n' +\n\t\t' enumName\\n' +\n\t\t' defaultValue\\n' +\n\t\t' }\\n' +\n\t\t' ... on _Relation {\\n' +\n\t\t' side\\n' +\n\t\t' targetEntity\\n' +\n\t\t' ownedBy\\n' +\n\t\t' inversedBy\\n' +\n\t\t' onDelete\\n' +\n\t\t' orphanRemoval\\n' +\n\t\t' orderBy {\\n' +\n\t\t' path\\n' +\n\t\t' direction\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t'}'\n\n\tpublic static async loadSchema(\n\t\tclient: GraphQlClient,\n\t\toptions?: GraphQlClientRequestOptions,\n\t): Promise<Schema> {\n\n\t\tconst existing = this.schemaLoadCache.get(client.apiUrl)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\t\tconst schemaPromise = (async () => {\n\t\t\tconst raw: { data: { schema: RawSchema } } = await client.sendRequest(this.schemaQuery, options)\n\t\t\treturn new Schema(SchemaPreprocessor.processRawSchema(raw.data.schema))\n\t\t})()\n\t\tthis.schemaLoadCache.set(client.apiUrl, schemaPromise)\n\t\treturn await schemaPromise\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAKO,MAAM,aAAa;AAAA,EA0CzB,aAAoB,WACnB,QACA,SACkB;AAElB,UAAM,WAAW,KAAK,gBAAgB,IAAI,OAAO,MAAM;AACvD,QAAI,aAAa,QAAW;AACpB,aAAA;AAAA,IACR;AACA,UAAM,iBAAiB,YAAY;AAClC,YAAM,MAAuC,MAAM,OAAO,YAAY,KAAK,aAAa,OAAO;AAC/F,aAAO,IAAI,OAAO,mBAAmB,iBAAiB,IAAI,KAAK,MAAM,CAAC;AAAA,IAAA;AAEvE,SAAK,gBAAgB,IAAI,OAAO,QAAQ,aAAa;AACrD,WAAO,MAAM;AAAA,EACd;AACD;AAzDC,cADY,cACY,mBAAgD,oBAAI,IAAI,CAAA;AAEhF,cAHY,cAGY,eACvB,+kBAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateIterator.js","sources":["../../../../src/core/state/StateIterator.ts"],"sourcesContent":["import { FieldMarker, HasManyRelationMarker, HasOneRelationMarker } from '../../markers'\nimport type { FieldValue, PlaceholderName } from '../../treeParameters'\nimport { assertNever } from '../../utils'\nimport type { TreeStore } from '../TreeStore'\nimport type { EntityListState } from './EntityListState'\nimport type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\nimport type { FieldState } from './FieldState'\nimport { getEntityMarker } from './getEntityMarker'\nimport type { RootStateNode, StateINode, StateNode } from './StateNode'\n\nexport class StateIterator {\n\tpublic static *eachSiblingRealm(\n\t\tstate: EntityRealmState,\n\t\trelevantPlaceholder?: PlaceholderName,\n\t): IterableIterator<EntityRealmState> {\n\t\tfor (let [realmKey, realm] of state.entity.realms) {\n\t\t\tif (realm.type === 'entityRealmStub') {\n\t\t\t\tif (relevantPlaceholder === undefined || getEntityMarker(realm).fields.placeholders.has(relevantPlaceholder)) {\n\t\t\t\t\trealm.getAccessor()\n\t\t\t\t\trealm = state.entity.realms.get(realmKey) as EntityRealmState\n\t\t\t\t} else {\n\t\t\t\t\t// This realm is irrelevant. No need to force-initialize it.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield realm\n\t\t}\n\t}\n\n\t// Note that this only yields siblings with the same placeholderName!\n\tpublic static *eachSiblingRealmChild<Value extends FieldValue, S extends EntityListState | FieldState<Value>>(\n\t\ttreeStore: TreeStore,\n\t\tstate: S & StateNode<Value>,\n\t): IterableIterator<S> {\n\t\tif (state.type === 'entityList' && state.blueprint.parent === undefined) {\n\t\t\t// Top-level entity list\n\t\t\tfor (const [, rootStates] of treeStore.subTreeStatesByRoot) {\n\t\t\t\tconst rootList = rootStates.get(state.blueprint.marker.placeholderName)\n\t\t\t\tif (rootList?.type === 'entityList') {\n\t\t\t\t\tyield rootList as S\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet closestEntityRealm: EntityRealmState\n\t\tlet placeholderName: PlaceholderName\n\n\t\tif (state.type === 'field') {\n\t\t\tclosestEntityRealm = state.parent\n\t\t\tplaceholderName = state.placeholderName\n\t\t} else if (state.type === 'entityList') {\n\t\t\tclosestEntityRealm = state.blueprint.parent! // The parent-less case is handled above. Hence the assertion.\n\t\t\tplaceholderName = state.blueprint.marker.placeholderName\n\t\t} else {\n\t\t\treturn assertNever(state)\n\t\t}\n\n\t\tfor (const realm of this.eachSiblingRealm(closestEntityRealm, placeholderName)) {\n\t\t\tconst child = realm.children.get(placeholderName)\n\t\t\tif (child === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (child.type === state.type) {\n\t\t\t\tyield child as S\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static *depthFirstAllNodes(root: StateNode): IterableIterator<StateNode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tswitch (childState.type) {\n\t\t\t\t\t\tcase 'field':\n\t\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\t\tyield* this.depthFirstAllNodes(childState)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'entityRealmStub':\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(childState)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'field':\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tyield root\n\t}\n\n\tpublic static *depthFirstINodes(\n\t\troot: StateINode,\n\t\tmatch?: (iNode: StateINode) => boolean,\n\t): IterableIterator<StateINode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tif (childState.type === 'entityRealm' || childState.type === 'entityList') {\n\t\t\t\t\t\tyield* this.depthFirstINodes(childState, match)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tif (match === undefined || match(root)) {\n\t\t\tyield root\n\t\t}\n\t}\n\n\tpublic static *eachRootState(treeStore: TreeStore): IterableIterator<[PlaceholderName, RootStateNode]> {\n\t\tfor (const rootStates of treeStore.subTreeStatesByRoot.values()) {\n\t\t\tyield* rootStates.entries()\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAUO,MAAM,cAAc;AAAA,EAC1B,QAAe,iBACd,OACA,qBACqC;AACrC,aAAS,CAAC,UAAU,KAAK,KAAK,MAAM,OAAO,QAAQ;AAC9C,UAAA,MAAM,SAAS,mBAAmB;AACjC,YAAA,wBAAwB,UAAa,gBAAgB,KAAK,EAAE,OAAO,aAAa,IAAI,mBAAmB,GAAG;AAC7G,gBAAM,YAAY;AAClB,kBAAQ,MAAM,OAAO,OAAO,IAAI,QAAQ;AAAA,QAAA,OAClC;AAEN;AAAA,QACD;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,EACD;AAAA,EAGA,QAAe,sBACd,WACA,OACsB;AACtB,QAAI,MAAM,SAAS,gBAAgB,MAAM,UAAU,WAAW,QAAW;AAExE,iBAAW,CAAG,EAAA,UAAU,KAAK,UAAU,qBAAqB;AAC3D,cAAM,WAAW,WAAW,IAAI,MAAM,UAAU,OAAO,eAAe;AAClE,YAAA,UAAU,SAAS,cAAc;AAC9B,gBAAA;AAAA,QACP;AAAA,MACD;AACA;AAAA,IACD;AAEI,QAAA;AACA,QAAA;AAEA,QAAA,MAAM,SAAS,SAAS;AAC3B,2BAAqB,MAAM;AAC3B,wBAAkB,MAAM;AAAA,IAAA,WACd,MAAM,SAAS,cAAc;AACvC,2BAAqB,MAAM,UAAU;AACnB,wBAAA,MAAM,UAAU,OAAO;AAAA,IAAA,OACnC;AACN,aAAO,YAAiB;AAAA,IACzB;AAEA,eAAW,SAAS,KAAK,iBAAiB,oBAAoB,eAAe,GAAG;AAC/E,YAAM,QAAQ,MAAM,SAAS,IAAI,eAAe;AAChD,UAAI,UAAU,QAAW;AACxB;AAAA,MACD;AACI,UAAA,MAAM,SAAS,MAAM,MAAM;AACxB,cAAA;AAAA,MACP;AAAA,IACD;AAAA,EACD;AAAA,EAEA,QAAe,mBAAmB,MAA8C;AAC/E,YAAQ,KAAK;AAAA,
|
|
1
|
+
{"version":3,"file":"StateIterator.js","sources":["../../../../src/core/state/StateIterator.ts"],"sourcesContent":["import { FieldMarker, HasManyRelationMarker, HasOneRelationMarker } from '../../markers'\nimport type { FieldValue, PlaceholderName } from '../../treeParameters'\nimport { assertNever } from '../../utils'\nimport type { TreeStore } from '../TreeStore'\nimport type { EntityListState } from './EntityListState'\nimport type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\nimport type { FieldState } from './FieldState'\nimport { getEntityMarker } from './getEntityMarker'\nimport type { RootStateNode, StateINode, StateNode } from './StateNode'\n\nexport class StateIterator {\n\tpublic static *eachSiblingRealm(\n\t\tstate: EntityRealmState,\n\t\trelevantPlaceholder?: PlaceholderName,\n\t): IterableIterator<EntityRealmState> {\n\t\tfor (let [realmKey, realm] of state.entity.realms) {\n\t\t\tif (realm.type === 'entityRealmStub') {\n\t\t\t\tif (relevantPlaceholder === undefined || getEntityMarker(realm).fields.placeholders.has(relevantPlaceholder)) {\n\t\t\t\t\trealm.getAccessor()\n\t\t\t\t\trealm = state.entity.realms.get(realmKey) as EntityRealmState\n\t\t\t\t} else {\n\t\t\t\t\t// This realm is irrelevant. No need to force-initialize it.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield realm\n\t\t}\n\t}\n\n\t// Note that this only yields siblings with the same placeholderName!\n\tpublic static *eachSiblingRealmChild<Value extends FieldValue, S extends EntityListState | FieldState<Value>>(\n\t\ttreeStore: TreeStore,\n\t\tstate: S & StateNode<Value>,\n\t): IterableIterator<S> {\n\t\tif (state.type === 'entityList' && state.blueprint.parent === undefined) {\n\t\t\t// Top-level entity list\n\t\t\tfor (const [, rootStates] of treeStore.subTreeStatesByRoot) {\n\t\t\t\tconst rootList = rootStates.get(state.blueprint.marker.placeholderName)\n\t\t\t\tif (rootList?.type === 'entityList') {\n\t\t\t\t\tyield rootList as S\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet closestEntityRealm: EntityRealmState\n\t\tlet placeholderName: PlaceholderName\n\n\t\tif (state.type === 'field') {\n\t\t\tclosestEntityRealm = state.parent\n\t\t\tplaceholderName = state.placeholderName\n\t\t} else if (state.type === 'entityList') {\n\t\t\tclosestEntityRealm = state.blueprint.parent! // The parent-less case is handled above. Hence the assertion.\n\t\t\tplaceholderName = state.blueprint.marker.placeholderName\n\t\t} else {\n\t\t\treturn assertNever(state)\n\t\t}\n\n\t\tfor (const realm of this.eachSiblingRealm(closestEntityRealm, placeholderName)) {\n\t\t\tconst child = realm.children.get(placeholderName)\n\t\t\tif (child === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (child.type === state.type) {\n\t\t\t\tyield child as S\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static *depthFirstAllNodes(root: StateNode): IterableIterator<StateNode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tswitch (childState.type) {\n\t\t\t\t\t\tcase 'field':\n\t\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\t\tyield* this.depthFirstAllNodes(childState)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'entityRealmStub':\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(childState)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'field':\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tyield root\n\t}\n\n\tpublic static *depthFirstINodes(\n\t\troot: StateINode,\n\t\tmatch?: (iNode: StateINode) => boolean,\n\t): IterableIterator<StateINode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tif (childState.type === 'entityRealm' || childState.type === 'entityList') {\n\t\t\t\t\t\tyield* this.depthFirstINodes(childState, match)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tif (match === undefined || match(root)) {\n\t\t\tyield root\n\t\t}\n\t}\n\n\tpublic static *eachRootState(treeStore: TreeStore): IterableIterator<[PlaceholderName, RootStateNode]> {\n\t\tfor (const rootStates of treeStore.subTreeStatesByRoot.values()) {\n\t\t\tyield* rootStates.entries()\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAUO,MAAM,cAAc;AAAA,EAC1B,QAAe,iBACd,OACA,qBACqC;AACrC,aAAS,CAAC,UAAU,KAAK,KAAK,MAAM,OAAO,QAAQ;AAC9C,UAAA,MAAM,SAAS,mBAAmB;AACjC,YAAA,wBAAwB,UAAa,gBAAgB,KAAK,EAAE,OAAO,aAAa,IAAI,mBAAmB,GAAG;AAC7G,gBAAM,YAAY;AAClB,kBAAQ,MAAM,OAAO,OAAO,IAAI,QAAQ;AAAA,QAAA,OAClC;AAEN;AAAA,QACD;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,EACD;AAAA,EAGA,QAAe,sBACd,WACA,OACsB;AACtB,QAAI,MAAM,SAAS,gBAAgB,MAAM,UAAU,WAAW,QAAW;AAExE,iBAAW,CAAG,EAAA,UAAU,KAAK,UAAU,qBAAqB;AAC3D,cAAM,WAAW,WAAW,IAAI,MAAM,UAAU,OAAO,eAAe;AAClE,YAAA,UAAU,SAAS,cAAc;AAC9B,gBAAA;AAAA,QACP;AAAA,MACD;AACA;AAAA,IACD;AAEI,QAAA;AACA,QAAA;AAEA,QAAA,MAAM,SAAS,SAAS;AAC3B,2BAAqB,MAAM;AAC3B,wBAAkB,MAAM;AAAA,IAAA,WACd,MAAM,SAAS,cAAc;AACvC,2BAAqB,MAAM,UAAU;AACnB,wBAAA,MAAM,UAAU,OAAO;AAAA,IAAA,OACnC;AACN,aAAO,YAAiB;AAAA,IACzB;AAEA,eAAW,SAAS,KAAK,iBAAiB,oBAAoB,eAAe,GAAG;AAC/E,YAAM,QAAQ,MAAM,SAAS,IAAI,eAAe;AAChD,UAAI,UAAU,QAAW;AACxB;AAAA,MACD;AACI,UAAA,MAAM,SAAS,MAAM,MAAM;AACxB,cAAA;AAAA,MACP;AAAA,IACD;AAAA,EACD;AAAA,EAEA,QAAe,mBAAmB,MAA8C;AAC/E,YAAQ,KAAK,MAAM;AAAA,MAClB,KAAK;AAAA,MACL,KAAK;AACJ,mBAAW,cAAc,KAAK,SAAS,OAAA,GAAU;AAChD,kBAAQ,WAAW,MAAM;AAAA,YACxB,KAAK;AAAA,YACL,KAAK;AAAA,YACL,KAAK;AACG,qBAAA,KAAK,mBAAmB,UAAU;AACzC;AAAA,YACD,KAAK;AACJ;AAAA,YACD;AACC,qBAAO,YAAsB;AAAA,UAC/B;AAAA,QACD;AACA;AAAA,MACD,KAAK;AACJ;AAAA,MACD;AACC,eAAO,YAAgB;AAAA,IACzB;AACM,UAAA;AAAA,EACP;AAAA,EAEA,QAAe,iBACd,MACA,OAC+B;AAC/B,YAAQ,KAAK,MAAM;AAAA,MAClB,KAAK;AAAA,MACL,KAAK;AACJ,mBAAW,cAAc,KAAK,SAAS,OAAA,GAAU;AAChD,cAAI,WAAW,SAAS,iBAAiB,WAAW,SAAS,cAAc;AACnE,mBAAA,KAAK,iBAAiB,YAAY,KAAK;AAAA,UAC/C;AAAA,QACD;AACA;AAAA,MACD;AACC,eAAO,YAAgB;AAAA,IACzB;AACA,QAAI,UAAU,UAAa,MAAM,IAAI,GAAG;AACjC,YAAA;AAAA,IACP;AAAA,EACD;AAAA,EAEA,QAAe,cAAc,WAA0E;AACtG,eAAW,cAAc,UAAU,oBAAoB,OAAA,GAAU;AAChE,aAAO,WAAW;IACnB;AAAA,EACD;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement } from 'react'\nimport { useEnvironment } from '../accessorPropagation/useEnvironment'\nimport type { Environment } from '../dao'\nimport { assertNever } from '../utils'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactElement<any, any> | null;\n\tdisplayName?: string | undefined;\n}\n\nfunction Component<Props extends {}>(\n\tstatelessRender: EnvironmentAwareFunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tstaticRender: (\n\t\tprops: StaticRenderProviderProps<Props, NonStaticPropNames>,\n\t\tenvironment: Environment,\n\t) => ReactElement | null,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: EnvironmentAwareFunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactElement | null)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tconst RenderWithEnv = (props: Props) => render(props, useEnvironment())\n\tconst renderWithEnv = typeof render !== 'function' || render.length < 2 ? render : RenderWithEnv\n\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(renderWithEnv)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(renderWithEnv)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport type { EnvironmentAwareFunctionComponent }\nexport { Component }\n"],"names":["
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement } from 'react'\nimport { useEnvironment } from '../accessorPropagation/useEnvironment'\nimport type { Environment } from '../dao'\nimport { assertNever } from '../utils'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactElement<any, any> | null;\n\tdisplayName?: string | undefined;\n}\n\nfunction Component<Props extends {}>(\n\tstatelessRender: EnvironmentAwareFunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tstaticRender: (\n\t\tprops: StaticRenderProviderProps<Props, NonStaticPropNames>,\n\t\tenvironment: Environment,\n\t) => ReactElement | null,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: EnvironmentAwareFunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactElement | null)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tconst RenderWithEnv = (props: Props) => render(props, useEnvironment())\n\tconst renderWithEnv = typeof render !== 'function' || render.length < 2 ? render : RenderWithEnv\n\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(renderWithEnv)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(renderWithEnv)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport type { EnvironmentAwareFunctionComponent }\nexport { Component }\n"],"names":["augmentedRender"],"mappings":";;;AA+BA,SAAS,UACR,QACA,SAIA,aACC;AACD,QAAM,gBAAgB,CAAC,UAAiB,OAAO,OAAO,gBAAgB;AACtE,QAAM,gBAAgB,OAAO,WAAW,cAAc,OAAO,SAAS,IAAI,SAAS;AAEnF,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACfA,UAAAA,mBAAuE,KAAY,aAAa;AACtGA,qBAAgB,eAAe;AAC/BA,qBAAgB,cAAc;AAEvBA,WAAAA;AAAAA,EACR;AAEA,SAAO,cAAc;AACf,QAAA,kBAA2F,KAAY,aAAa;AAC1H,kBAAgB,cAAc;AAE1B,MAAA,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAExB,WAAA;AAAA,EACR;AACI,MAAA,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AACjB,sBAAgB,cACjB,QAAQ;AAAA,IACV;AAEO,WAAA;AAAA,EACR;AACA,cAAmB;AACpB;"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { memo, createElement } from "react";
|
|
2
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, createElement } from "react";
|
|
3
3
|
import { useDataBinding } from "../accessorTree/useDataBinding.js";
|
|
4
4
|
import { AccessorTree } from "../accessorTree/AccessorTree.js";
|
|
5
5
|
const DataBindingProvider = memo(function DataBindingProvider2(props) {
|
|
6
6
|
const accessorTreeState = useDataBinding(props);
|
|
7
|
-
const children = "stateComponent" in props && props.stateComponent ? createElement(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
children
|
|
14
|
-
|
|
7
|
+
const children = "stateComponent" in props && props.stateComponent ? createElement(
|
|
8
|
+
props.stateComponent,
|
|
9
|
+
{
|
|
10
|
+
...props.stateProps,
|
|
11
|
+
accessorTreeState
|
|
12
|
+
},
|
|
13
|
+
props.children
|
|
14
|
+
) : props.children;
|
|
15
|
+
return /* @__PURE__ */ jsx(AccessorTree, { state: accessorTreeState, children });
|
|
15
16
|
});
|
|
16
17
|
export {
|
|
17
18
|
DataBindingProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataBindingProvider.js","sources":["../../../src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, AccessorTreeStateOptions, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderBaseProps =\n\t& AccessorTreeStateOptions\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> = DataBindingProviderBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\t\t\t\tstateProps?: StateProps\n\t\t }\n\t)\n\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children =\n\t\t'stateComponent' in props && props.stateComponent\n\t\t\t? createElement(\n\t\t\t\t\tprops.stateComponent,\n\t\t\t\t\t{\n\t\t\t\t\t\t...props.stateProps!,\n\t\t\t\t\t\taccessorTreeState: accessorTreeState,\n\t\t\t\t\t},\n\t\t\t\t\tprops.children,\n\t\t\t )\n\t\t\t: props.children\n\treturn <AccessorTree state={accessorTreeState}>{children}</AccessorTree>\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["DataBindingProvider"
|
|
1
|
+
{"version":3,"file":"DataBindingProvider.js","sources":["../../../src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, AccessorTreeStateOptions, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderBaseProps =\n\t& AccessorTreeStateOptions\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> = DataBindingProviderBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\t\t\t\tstateProps?: StateProps\n\t\t }\n\t)\n\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children =\n\t\t'stateComponent' in props && props.stateComponent\n\t\t\t? createElement(\n\t\t\t\t\tprops.stateComponent,\n\t\t\t\t\t{\n\t\t\t\t\t\t...props.stateProps!,\n\t\t\t\t\t\taccessorTreeState: accessorTreeState,\n\t\t\t\t\t},\n\t\t\t\t\tprops.children,\n\t\t\t )\n\t\t\t: props.children\n\treturn <AccessorTree state={accessorTreeState}>{children}</AccessorTree>\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["DataBindingProvider"],"mappings":";;;;AAoBO,MAAM,sBAAsB,KAAK,SAASA,qBAChD,OACC;AACK,QAAA,oBAAoB,eAAe,KAAK;AAE9C,QAAM,WACL,oBAAoB,SAAS,MAAM,iBAChC;AAAA,IACA,MAAM;AAAA,IACN;AAAA,MACC,GAAG,MAAM;AAAA,MACT;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EAAA,IAEN,MAAM;AACV,SAAQ,oBAAA,cAAA,EAAa,OAAO,mBAAoB,SAAS,CAAA;AAC1D,CAAC;"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { Component } from "./Component.js";
|
|
2
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from "./Component.js";
|
|
3
3
|
import { AccessorProvider } from "../accessorPropagation/AccessorProvider.js";
|
|
4
|
-
const Entity = Component(
|
|
5
|
-
children,
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
children
|
|
11
|
-
}, accessor?.key);
|
|
12
|
-
}, "Entity");
|
|
4
|
+
const Entity = Component(
|
|
5
|
+
({ children, accessor }) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(AccessorProvider, { accessor, children }, accessor?.key);
|
|
7
|
+
},
|
|
8
|
+
"Entity"
|
|
9
|
+
);
|
|
13
10
|
export {
|
|
14
11
|
Entity
|
|
15
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":[],"mappings":";;;AAYO,MAAM,SAAS;AAAA,EACrB,CAAC,EAAE,UAAU,eAA4B;AACzC,WAEE,oBAAA,kBAAA,EAAiB,UAChB,YADyC,UAAU,GAErD;AAAA,EAED;AAAA,EACA;AACD;"}
|
|
@@ -1,35 +1,32 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
1
2
|
import { createElement } from "react";
|
|
2
3
|
import { Component } from "./Component.js";
|
|
3
4
|
import { Entity } from "./Entity.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
const EntityList = Component(
|
|
6
|
+
(props) => {
|
|
7
|
+
if ("listComponent" in props && props.listComponent) {
|
|
8
|
+
return createElement(props.listComponent, {
|
|
9
|
+
...props.listProps,
|
|
10
|
+
accessor: props.accessor,
|
|
11
|
+
children: props.children
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return /* @__PURE__ */ jsx(Fragment, { children: Array.from(props.accessor, (entity) => {
|
|
15
|
+
return /* @__PURE__ */ jsx(Entity, { accessor: entity, children: props.children }, entity.key);
|
|
16
|
+
}) });
|
|
17
|
+
},
|
|
18
|
+
(props) => {
|
|
19
|
+
if ("listComponent" in props && props.listComponent) {
|
|
20
|
+
return createElement(props.listComponent, {
|
|
21
|
+
...props.listProps,
|
|
22
|
+
accessor: void 0,
|
|
17
23
|
children: props.children
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...props.listProps,
|
|
25
|
-
accessor: void 0,
|
|
26
|
-
children: props.children
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return /* @__PURE__ */ jsx(Fragment, {
|
|
30
|
-
children: props.children
|
|
31
|
-
});
|
|
32
|
-
}, "EntityList");
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
27
|
+
},
|
|
28
|
+
"EntityList"
|
|
29
|
+
);
|
|
33
30
|
export {
|
|
34
31
|
EntityList
|
|
35
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":[
|
|
1
|
+
{"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":[],"mappings":";;;;AAmBO,MAAM,aAAa;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACA,WAEG,oBAAA,UAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,iCACE,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,GAEpB;AAAA,IAED,CAAA,EACF,CAAA;AAAA,EAEF;AAAA,EACA,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU;AAAA,QACV,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,EAC1B;AAAA,EACA;AACD;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useConstantValueInvariant } from "@contember/react-utils";
|
|
2
3
|
import { useCallback } from "react";
|
|
3
4
|
import { PRIMARY_KEY_NAME } from "../bindingTypes.js";
|
|
@@ -5,40 +6,40 @@ import { Component } from "./Component.js";
|
|
|
5
6
|
import { EntityList } from "./EntityList.js";
|
|
6
7
|
import { Field } from "./Field.js";
|
|
7
8
|
import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
|
|
8
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
9
9
|
import { useGetEntityListSubTree } from "../accessorPropagation/useGetEntityListSubTree.js";
|
|
10
10
|
import { useEntityListSubTreeParameters } from "../accessorPropagation/useEntityListSubTreeParameters.js";
|
|
11
11
|
import { useAccessorUpdateSubscription } from "../accessorPropagation/useAccessorUpdateSubscription.js";
|
|
12
12
|
import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
|
|
13
|
-
const EntityListSubTree = Component(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
const EntityListSubTree = Component(
|
|
14
|
+
(props) => {
|
|
15
|
+
useConstantValueInvariant(props.isCreating, "EntityListSubTree: cannot update isCreating");
|
|
16
|
+
const getSubTree = useGetEntityListSubTree();
|
|
17
|
+
const parameters = useEntityListSubTreeParameters(props);
|
|
18
|
+
const getAccessor = useCallback(
|
|
19
|
+
() => getSubTree(parameters, props.treeRootId),
|
|
20
|
+
[getSubTree, parameters, props.treeRootId]
|
|
21
|
+
);
|
|
22
|
+
const accessor = useAccessorUpdateSubscription(getAccessor);
|
|
23
|
+
return /* @__PURE__ */ jsx(EntityList, { ...props, accessor });
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
generateBranchMarker: (props, fields, environment) => {
|
|
27
|
+
if ("isCreating" in props && props.isCreating) {
|
|
28
|
+
return MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment);
|
|
29
|
+
}
|
|
30
|
+
return MarkerFactory.createEntityListSubTreeMarker(props, fields, environment);
|
|
31
|
+
},
|
|
32
|
+
staticRender: (props) => /* @__PURE__ */ jsxs(EntityList, { ...props, accessor: 0, children: [
|
|
33
|
+
/* @__PURE__ */ jsx(Field, { field: PRIMARY_KEY_NAME }),
|
|
34
|
+
props.children
|
|
35
|
+
] }),
|
|
36
|
+
generateEnvironment: (props, oldEnvironment) => {
|
|
37
|
+
const environment = oldEnvironment.withVariables(props.variables);
|
|
38
|
+
return TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props);
|
|
27
39
|
}
|
|
28
|
-
return MarkerFactory.createEntityListSubTreeMarker(props, fields, environment);
|
|
29
40
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
accessor: 0,
|
|
33
|
-
children: [/* @__PURE__ */ jsx(Field, {
|
|
34
|
-
field: PRIMARY_KEY_NAME
|
|
35
|
-
}), props.children]
|
|
36
|
-
}),
|
|
37
|
-
generateEnvironment: (props, oldEnvironment) => {
|
|
38
|
-
const environment = oldEnvironment.withVariables(props.variables);
|
|
39
|
-
return TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props);
|
|
40
|
-
}
|
|
41
|
-
}, "EntityListSubTree");
|
|
41
|
+
"EntityListSubTree"
|
|
42
|
+
);
|
|
42
43
|
export {
|
|
43
44
|
EntityListSubTree
|
|
44
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":[
|
|
1
|
+
{"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;AAiCO,MAAM,oBAAoB;AAAA,EAChC,CAAyB,UAA0D;AACxD,8BAAA,MAAM,YAAY,6CAA6C;AAEzF,UAAM,aAAa;AACb,UAAA,aAAa,+BAA+B,KAAK;AACvD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,YAAA,EAAY,GAAG,OAAO,SAAoB,CAAA;AAAA,EACnD;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,2CAA2C,OAAO,QAAQ,WAAW;AAAA,MAC3F;AACA,aAAO,cAAc,8BAA8B,OAAO,QAAQ,WAAW;AAAA,IAC9E;AAAA,IACA,cAAc,CACb,UAAA,qBAAC,cAAY,GAAG,OAAO,UAAU,GAChC,UAAA;AAAA,MAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,sCAAsC,aAAa,KAAK;AAAA,IAC3F;AAAA,EACD;AAAA,EACA;AACD;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useConstantValueInvariant } from "@contember/react-utils";
|
|
2
3
|
import { useCallback } from "react";
|
|
3
4
|
import { PRIMARY_KEY_NAME } from "../bindingTypes.js";
|
|
@@ -5,47 +6,51 @@ import { Component } from "./Component.js";
|
|
|
5
6
|
import { Entity } from "./Entity.js";
|
|
6
7
|
import { Field } from "./Field.js";
|
|
7
8
|
import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
|
|
8
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
9
9
|
import { SetOrderFieldOnCreate } from "../accessorSorting/SetOrderFieldOnCreate.js";
|
|
10
10
|
import { useGetEntitySubTree } from "../accessorPropagation/useGetEntitySubTree.js";
|
|
11
11
|
import { useEntitySubTreeParameters } from "../accessorPropagation/useEntitySubTreeParameters.js";
|
|
12
12
|
import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
|
|
13
13
|
import { useAccessorUpdateSubscription } from "../accessorPropagation/useAccessorUpdateSubscription.js";
|
|
14
|
-
const EntitySubTree = Component(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
const EntitySubTree = Component(
|
|
15
|
+
(props) => {
|
|
16
|
+
useConstantValueInvariant(props.isCreating, "EntitySubTree: cannot update isCreating");
|
|
17
|
+
const getSubTree = useGetEntitySubTree();
|
|
18
|
+
const parameters = useEntitySubTreeParameters(props);
|
|
19
|
+
const getAccessor = useCallback(
|
|
20
|
+
() => getSubTree(parameters, props.treeRootId),
|
|
21
|
+
[getSubTree, parameters, props.treeRootId]
|
|
22
|
+
);
|
|
23
|
+
const accessor = useAccessorUpdateSubscription(getAccessor);
|
|
24
|
+
return /* @__PURE__ */ jsx(Entity, { ...props, accessor });
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
generateBranchMarker: (props, fields, environment) => {
|
|
28
|
+
if ("isCreating" in props && props.isCreating) {
|
|
29
|
+
return MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment);
|
|
30
|
+
}
|
|
31
|
+
return MarkerFactory.createEntitySubTreeMarker(props, fields, environment);
|
|
32
|
+
},
|
|
33
|
+
staticRender: (props) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
/* @__PURE__ */ jsxs(Entity, { ...props, accessor: 0, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Field, { field: PRIMARY_KEY_NAME }),
|
|
36
|
+
props.children
|
|
37
|
+
] }),
|
|
38
|
+
props.isCreating && "orderField" in props && /* @__PURE__ */ jsx(
|
|
39
|
+
SetOrderFieldOnCreate,
|
|
40
|
+
{
|
|
41
|
+
orderField: props.orderField,
|
|
42
|
+
newOrderFieldValue: props.newOrderFieldValue,
|
|
43
|
+
entity: props.entity
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] }),
|
|
47
|
+
generateEnvironment: (props, oldEnvironment) => {
|
|
48
|
+
const environment = oldEnvironment.withVariables(props.variables);
|
|
49
|
+
return TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props);
|
|
28
50
|
}
|
|
29
|
-
return MarkerFactory.createEntitySubTreeMarker(props, fields, environment);
|
|
30
51
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
...props,
|
|
34
|
-
accessor: 0,
|
|
35
|
-
children: [/* @__PURE__ */ jsx(Field, {
|
|
36
|
-
field: PRIMARY_KEY_NAME
|
|
37
|
-
}), props.children]
|
|
38
|
-
}), props.isCreating && "orderField" in props && /* @__PURE__ */ jsx(SetOrderFieldOnCreate, {
|
|
39
|
-
orderField: props.orderField,
|
|
40
|
-
newOrderFieldValue: props.newOrderFieldValue,
|
|
41
|
-
entity: props.entity
|
|
42
|
-
})]
|
|
43
|
-
}),
|
|
44
|
-
generateEnvironment: (props, oldEnvironment) => {
|
|
45
|
-
const environment = oldEnvironment.withVariables(props.variables);
|
|
46
|
-
return TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props);
|
|
47
|
-
}
|
|
48
|
-
}, "EntitySubTree");
|
|
52
|
+
"EntitySubTree"
|
|
53
|
+
);
|
|
49
54
|
export {
|
|
50
55
|
EntitySubTree
|
|
51
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":[
|
|
1
|
+
{"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;;AAkCO,MAAM,gBAAgB;AAAA,EAC5B,CAAyB,UAA2C;AACzC,8BAAA,MAAM,YAAY,yCAAyC;AAErF,UAAM,aAAa;AACb,UAAA,aAAa,2BAA2B,KAAK;AACnD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,oBAAA,QAAA,EAAQ,GAAG,OAAO,SAAoB,CAAA;AAAA,EAC/C;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,uCAAuC,OAAO,QAAQ,WAAW;AAAA,MACvF;AACA,aAAO,cAAc,0BAA0B,OAAO,QAAQ,WAAW;AAAA,IAC1E;AAAA,IACA,cAAc,WAEZ,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,qBAAC,QAAQ,EAAA,GAAG,OAAO,UAAU,GAC5B,UAAA;AAAA,QAAC,oBAAA,OAAA,EAAM,OAAO,iBAAkB,CAAA;AAAA,QAC/B,MAAM;AAAA,MAAA,GACR;AAAA,MACC,MAAM,cAAc,gBAAgB,SACpC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,YAAY,MAAM;AAAA,UAClB,oBAAoB,MAAM;AAAA,UAC1B,QAAQ,MAAM;AAAA,QAAA;AAAA,MACf;AAAA,IAAA,GAEF;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,kCAAkC,aAAa,KAAK;AAAA,IACvF;AAAA,EACD;AAAA,EACA;AACD;"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
1
2
|
import { GraphQlBuilder } from "@contember/client";
|
|
2
3
|
import { Component } from "./Component.js";
|
|
3
4
|
import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
|
|
4
|
-
import { jsx, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { useField } from "../accessorPropagation/useField.js";
|
|
6
6
|
import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
|
|
7
|
-
const Field = Component(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
children: props.format(field.value)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
const Field = Component(
|
|
8
|
+
(props) => {
|
|
9
|
+
const field = useField(props);
|
|
10
|
+
if (props.format !== void 0) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Fragment, { children: props.format(field.value) });
|
|
12
|
+
}
|
|
13
|
+
if (field.value instanceof GraphQlBuilder.GraphQlLiteral || field.value === null || typeof field.value === "boolean") {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ jsx(Fragment, { children: field.value });
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
generateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),
|
|
20
|
+
generateEnvironment: (props, environment) => {
|
|
21
|
+
return TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"Field"
|
|
25
|
+
);
|
|
26
26
|
export {
|
|
27
27
|
Field
|
|
28
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;;;;AAkBO,MAAM,QAAQ;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQ,SAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAAE,CAAA;AAAA,IACrC;AAGC,QAAA,MAAM,iBAAiB,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,MAAM,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO,WAAW;AAAA,IAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,aAAA,2BAA2B,0BAA0B,aAAa,KAAK;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AACD;"}
|