@contember/react-binding 2.0.0-alpha.32 → 2.0.0-alpha.35
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/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/development/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/EnvironmentContext.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/development/src/accessorPropagation/TreeRootIdContext.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/development/src/accessorPropagation/useDesugaredRelativeEntityList.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
- package/dist/development/src/accessorPropagation/useDesugaredRelativeSingleEntity.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
- package/dist/development/src/accessorPropagation/useDesugaredRelativeSingleField.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntity.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntity.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityKey.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityList.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTree.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTreeLoader.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTreeLoader.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTreeParameters.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTree.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTreeLoader.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTreeLoader.js.map +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTreeParameters.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
- package/dist/development/src/accessorPropagation/useExtendTree.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/development/src/accessorPropagation/useField.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useField.js.map +1 -1
- package/dist/development/src/accessorPropagation/useGetEntityListSubTree.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
- package/dist/development/src/accessorPropagation/useGetEntitySubTree.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useGetEntitySubTree.js.map +1 -1
- package/dist/development/src/accessorPropagation/useHasEntity.cjs.map +1 -1
- package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
- package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/development/src/accessorSorting/addEntityAtIndex.cjs.map +1 -1
- package/dist/development/src/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/development/src/accessorSorting/repairEntitiesOrder.cjs.map +1 -1
- package/dist/development/src/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/development/src/accessorSorting/sortEntities.cjs.map +1 -1
- package/dist/development/src/accessorSorting/sortEntities.js.map +1 -1
- package/dist/development/src/accessorTree/AccessorTree.cjs.map +1 -1
- package/dist/development/src/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/src/accessorTree/useAccessorTreeState.cjs.map +1 -1
- package/dist/development/src/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/development/src/accessorTree/useDataBinding.cjs.map +1 -1
- package/dist/development/src/accessorTree/useDataBinding.js.map +1 -1
- package/dist/development/src/accessorTree/useEnvironmentWithSchema.cjs.map +1 -1
- package/dist/development/src/accessorTree/useEnvironmentWithSchema.js.map +1 -1
- package/dist/development/src/coreComponents/Component.cjs.map +1 -1
- package/dist/development/src/coreComponents/Component.js.map +1 -1
- package/dist/development/src/coreComponents/DataBindingProvider.cjs.map +1 -1
- package/dist/development/src/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/development/src/coreComponents/Entity.cjs.map +1 -1
- package/dist/development/src/coreComponents/Entity.js.map +1 -1
- package/dist/development/src/coreComponents/EntityList.cjs.map +1 -1
- package/dist/development/src/coreComponents/EntityList.js.map +1 -1
- package/dist/development/src/coreComponents/EntityListSubTree.cjs.map +1 -1
- package/dist/development/src/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/development/src/coreComponents/EntitySubTree.cjs.map +1 -1
- package/dist/development/src/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/development/src/coreComponents/Field.cjs.map +1 -1
- package/dist/development/src/coreComponents/Field.js.map +1 -1
- package/dist/development/src/coreComponents/HasMany.cjs.map +1 -1
- package/dist/development/src/coreComponents/HasOne.cjs.map +1 -1
- package/dist/development/src/coreComponents/ParentEntity.cjs.map +1 -1
- package/dist/development/src/entityEvents/useDerivedField.cjs.map +1 -1
- package/dist/development/src/entityEvents/useDerivedField.js.map +1 -1
- package/dist/development/src/entityEvents/useEntityBeforePersist.cjs.map +1 -1
- package/dist/development/src/entityEvents/useEntityBeforeUpdate.cjs.map +1 -1
- package/dist/development/src/entityEvents/useEntityEvent.cjs.map +1 -1
- package/dist/development/src/entityEvents/useEntityEvent.js.map +1 -1
- package/dist/development/src/entityEvents/useEntityPersistError.cjs.map +1 -1
- package/dist/development/src/entityEvents/useEntityPersistSuccess.cjs.map +1 -1
- package/dist/development/src/entityEvents/useOnConnectionUpdate.cjs.map +1 -1
- package/dist/development/src/helperComponents/DeferredSubTrees.cjs.map +1 -1
- package/dist/development/src/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/development/src/helperComponents/DimensionRenderer.cjs.map +1 -1
- package/dist/development/src/helperComponents/DimensionRenderer.js.map +1 -1
- package/dist/development/src/helperComponents/EntityView.cjs.map +1 -1
- package/dist/development/src/helperComponents/EntityView.js.map +1 -1
- package/dist/development/src/helperComponents/FieldView.cjs.map +1 -1
- package/dist/development/src/helperComponents/FieldView.js.map +1 -1
- package/dist/development/src/helperComponents/If.cjs.map +1 -1
- package/dist/development/src/helperComponents/If.js.map +1 -1
- package/dist/development/src/helperComponents/LabelMiddleware.cjs.map +1 -1
- package/dist/development/src/helperComponents/LabelMiddleware.js.map +1 -1
- package/dist/development/src/helperComponents/RecursionTerminator.cjs.map +1 -1
- package/dist/development/src/helperComponents/RecursionTerminator.js.map +1 -1
- package/dist/development/src/helperComponents/RecursionTerminatorPortal.cjs.map +1 -1
- package/dist/development/src/helperComponents/RecursionTerminatorPortal.js.map +1 -1
- package/dist/development/src/helperComponents/SugaredField.cjs.map +1 -1
- package/dist/development/src/helperComponents/SugaredField.js.map +1 -1
- package/dist/development/src/helperComponents/Variable.cjs.map +1 -1
- package/dist/development/src/helperComponents/Variable.js.map +1 -1
- package/dist/development/src/helperComponents/helpers/FilterEvaluator.cjs.map +1 -1
- package/dist/development/src/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/development/src/helperComponents/helpers/FilterFieldsCollector.cjs.map +1 -1
- package/dist/development/src/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/development/src/helperComponents/helpers/evaluateCondition.cjs.map +1 -1
- package/dist/development/src/helperComponents/helpers/evaluateCondition.js.map +1 -1
- package/dist/development/src/markers/IncrementalMarkerBuilder.cjs.map +1 -1
- package/dist/development/src/markers/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/development/src/markers/MarkerStaticAnalyzer.cjs.map +1 -1
- package/dist/development/src/markers/MarkerStaticAnalyzer.js.map +1 -1
- package/dist/development/src/markers/MarkerTreeGenerator.cjs.map +1 -1
- package/dist/development/src/markers/MarkerTreeGenerator.js.map +1 -1
- package/dist/production/src/accessorPropagation/AccessorProvider.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/production/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/production/src/accessorPropagation/BindingOperationsProvider.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/EntityKeyProvider.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/EntityKeyProvider.js.map +1 -1
- package/dist/production/src/accessorPropagation/EnvironmentContext.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/production/src/accessorPropagation/TreeRootIdContext.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/TreeRootIdProvider.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
- package/dist/production/src/accessorPropagation/useDesugaredRelativeEntityList.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
- package/dist/production/src/accessorPropagation/useDesugaredRelativeSingleEntity.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
- package/dist/production/src/accessorPropagation/useDesugaredRelativeSingleField.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntity.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntity.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityKey.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityKey.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityList.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityList.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTree.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTree.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTreeLoader.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTreeLoader.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTreeParameters.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTree.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTree.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTreeLoader.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTreeLoader.js.map +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTreeParameters.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
- package/dist/production/src/accessorPropagation/useExtendTree.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/production/src/accessorPropagation/useField.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useField.js.map +1 -1
- package/dist/production/src/accessorPropagation/useGetEntityListSubTree.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
- package/dist/production/src/accessorPropagation/useGetEntitySubTree.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useGetEntitySubTree.js.map +1 -1
- package/dist/production/src/accessorPropagation/useHasEntity.cjs.map +1 -1
- package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
- package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/production/src/accessorSorting/addEntityAtIndex.cjs.map +1 -1
- package/dist/production/src/accessorSorting/addEntityAtIndex.js.map +1 -1
- package/dist/production/src/accessorSorting/repairEntitiesOrder.cjs.map +1 -1
- package/dist/production/src/accessorSorting/repairEntitiesOrder.js.map +1 -1
- package/dist/production/src/accessorSorting/sortEntities.cjs.map +1 -1
- package/dist/production/src/accessorSorting/sortEntities.js.map +1 -1
- package/dist/production/src/accessorTree/AccessorTree.cjs.map +1 -1
- package/dist/production/src/accessorTree/AccessorTree.js.map +1 -1
- package/dist/production/src/accessorTree/useAccessorTreeState.cjs.map +1 -1
- package/dist/production/src/accessorTree/useAccessorTreeState.js.map +1 -1
- package/dist/production/src/accessorTree/useDataBinding.cjs.map +1 -1
- package/dist/production/src/accessorTree/useDataBinding.js.map +1 -1
- package/dist/production/src/accessorTree/useEnvironmentWithSchema.cjs.map +1 -1
- package/dist/production/src/accessorTree/useEnvironmentWithSchema.js.map +1 -1
- package/dist/production/src/coreComponents/Component.cjs.map +1 -1
- package/dist/production/src/coreComponents/Component.js.map +1 -1
- package/dist/production/src/coreComponents/DataBindingProvider.cjs.map +1 -1
- package/dist/production/src/coreComponents/DataBindingProvider.js.map +1 -1
- package/dist/production/src/coreComponents/EntityList.cjs.map +1 -1
- package/dist/production/src/coreComponents/EntityList.js.map +1 -1
- package/dist/production/src/coreComponents/EntityListSubTree.cjs.map +1 -1
- package/dist/production/src/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/production/src/coreComponents/EntitySubTree.cjs.map +1 -1
- package/dist/production/src/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/production/src/coreComponents/Field.cjs.map +1 -1
- package/dist/production/src/coreComponents/Field.js.map +1 -1
- package/dist/production/src/coreComponents/HasMany.cjs.map +1 -1
- package/dist/production/src/coreComponents/HasMany.js.map +1 -1
- package/dist/production/src/coreComponents/HasOne.cjs.map +1 -1
- package/dist/production/src/coreComponents/HasOne.js.map +1 -1
- package/dist/production/src/coreComponents/ParentEntity.cjs.map +1 -1
- package/dist/production/src/entityEvents/useDerivedField.cjs.map +1 -1
- package/dist/production/src/entityEvents/useDerivedField.js.map +1 -1
- package/dist/production/src/entityEvents/useEntityBeforePersist.cjs.map +1 -1
- package/dist/production/src/entityEvents/useEntityBeforeUpdate.cjs.map +1 -1
- package/dist/production/src/entityEvents/useEntityEvent.cjs.map +1 -1
- package/dist/production/src/entityEvents/useEntityEvent.js.map +1 -1
- package/dist/production/src/entityEvents/useEntityPersistError.cjs.map +1 -1
- package/dist/production/src/entityEvents/useEntityPersistSuccess.cjs.map +1 -1
- package/dist/production/src/entityEvents/useOnConnectionUpdate.cjs.map +1 -1
- package/dist/production/src/helperComponents/DeferredSubTrees.cjs.map +1 -1
- package/dist/production/src/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/production/src/helperComponents/DimensionRenderer.cjs.map +1 -1
- package/dist/production/src/helperComponents/DimensionRenderer.js.map +1 -1
- package/dist/production/src/helperComponents/EntityView.cjs.map +1 -1
- package/dist/production/src/helperComponents/EntityView.js.map +1 -1
- package/dist/production/src/helperComponents/FieldView.cjs.map +1 -1
- package/dist/production/src/helperComponents/FieldView.js.map +1 -1
- package/dist/production/src/helperComponents/If.cjs.map +1 -1
- package/dist/production/src/helperComponents/If.js.map +1 -1
- package/dist/production/src/helperComponents/LabelMiddleware.cjs.map +1 -1
- package/dist/production/src/helperComponents/LabelMiddleware.js.map +1 -1
- package/dist/production/src/helperComponents/RecursionTerminator.cjs.map +1 -1
- package/dist/production/src/helperComponents/RecursionTerminator.js.map +1 -1
- package/dist/production/src/helperComponents/RecursionTerminatorPortal.cjs.map +1 -1
- package/dist/production/src/helperComponents/RecursionTerminatorPortal.js.map +1 -1
- package/dist/production/src/helperComponents/SugaredField.cjs.map +1 -1
- package/dist/production/src/helperComponents/SugaredField.js.map +1 -1
- package/dist/production/src/helperComponents/Variable.cjs.map +1 -1
- package/dist/production/src/helperComponents/Variable.js.map +1 -1
- package/dist/production/src/helperComponents/helpers/FilterEvaluator.cjs.map +1 -1
- package/dist/production/src/helperComponents/helpers/FilterEvaluator.js.map +1 -1
- package/dist/production/src/helperComponents/helpers/FilterFieldsCollector.cjs.map +1 -1
- package/dist/production/src/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/production/src/helperComponents/helpers/evaluateCondition.cjs.map +1 -1
- package/dist/production/src/helperComponents/helpers/evaluateCondition.js.map +1 -1
- package/dist/production/src/markers/IncrementalMarkerBuilder.cjs.map +1 -1
- package/dist/production/src/markers/IncrementalMarkerBuilder.js.map +1 -1
- package/dist/production/src/markers/MarkerStaticAnalyzer.cjs.map +1 -1
- package/dist/production/src/markers/MarkerStaticAnalyzer.js.map +1 -1
- package/dist/production/src/markers/MarkerTreeGenerator.cjs.map +1 -1
- package/dist/production/src/markers/MarkerTreeGenerator.js.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -8
- package/tests/cases/unit/core/entityOperations.test.tsx +4 -4
- package/tests/cases/unit/core/eventManager.test.tsx +11 -8
- package/tests/cases/unit/helperComponents/FilterEvaluator.spec.ts +1 -1
- package/tests/cases/unit/helperComponents/FilterFieldsCollector.spec.ts +1 -1
- package/tests/cases/unit/helperComponents/evaluateCondition.spec.ts +1 -1
- package/tests/cases/unit/model/markerTreeGenerator.spec.tsx +24 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useField.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useField.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { FieldAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleField } from './useDesugaredRelativeSingleField'\n\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): FieldAccessor<Value>\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined {\n\tconst relativeSingleField = useDesugaredRelativeSingleField(sugaredRelativeSingleField)\n\tuseConstantValueInvariant(\n\t\t!!relativeSingleField,\n\t\t'useField: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getField = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getField<Value>(relativeSingleField!)\n\t}, [entityKey, getEntityByKey, relativeSingleField])\n\n\tif (relativeSingleField) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleField.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [field, { update }] = useAccessorUpdateSubscription(getField)\n\n\t\tif (relativeSingleField.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn field\n\t}\n\treturn undefined\n}\n\nexport { useField }\n"],"names":["useDesugaredRelativeSingleField","useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useConstantLengthInvariant","useAccessorUpdateSubscription","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAeA,SAAS,SACR,4BACmC;AAC7B,QAAA,sBAAsBA,gEAAgC,0BAA0B;AACtFC,aAAA;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,
|
|
1
|
+
{"version":3,"file":"useField.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useField.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { FieldAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleField } from './useDesugaredRelativeSingleField'\n\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): FieldAccessor<Value>\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined {\n\tconst relativeSingleField = useDesugaredRelativeSingleField(sugaredRelativeSingleField)\n\tuseConstantValueInvariant(\n\t\t!!relativeSingleField,\n\t\t'useField: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getField = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getField<Value>(relativeSingleField!)\n\t}, [entityKey, getEntityByKey, relativeSingleField])\n\n\tif (relativeSingleField) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleField.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [field, { update }] = useAccessorUpdateSubscription(getField)\n\n\t\tif (relativeSingleField.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn field\n\t}\n\treturn undefined\n}\n\nexport { useField }\n"],"names":["useDesugaredRelativeSingleField","useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useConstantLengthInvariant","useAccessorUpdateSubscription","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAeA,SAAS,SACR,4BACmC;AAC7B,QAAA,sBAAsBA,gEAAgC,0BAA0B;AACtFC,aAAA;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EACD;AAEA,QAAM,YAAYC,aAAAA,aAAa;AAC/B,QAAM,iBAAiBC,kBAAAA,kBAAkB;AACnC,QAAA,WAAWC,MAAAA,YAAY,MAAM;AAC5B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,SAAgB,mBAAoB;AAAA,EAChD,GAAA,CAAC,WAAW,gBAAgB,mBAAmB,CAAC;AAEnD,MAAI,qBAAqB;AAExBC,eAAA;AAAA,MACC,oBAAoB;AAAA,MACpB;AAAA,IACD;AAEA,UAAM,CAAC,OAAO,EAAE,OAAQ,CAAA,IAAIC,8BAAAA,8BAA8B,QAAQ;AAE9D,QAAA,oBAAoB,mBAAmB,QAAQ;AAElDC,4BAAA,sBAAsB,oBAAoB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAAA;AAGvE,WAAA;AAAA,EAAA;AAED,SAAA;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useField.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useField.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { FieldAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleField } from './useDesugaredRelativeSingleField'\n\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): FieldAccessor<Value>\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined {\n\tconst relativeSingleField = useDesugaredRelativeSingleField(sugaredRelativeSingleField)\n\tuseConstantValueInvariant(\n\t\t!!relativeSingleField,\n\t\t'useField: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getField = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getField<Value>(relativeSingleField!)\n\t}, [entityKey, getEntityByKey, relativeSingleField])\n\n\tif (relativeSingleField) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleField.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [field, { update }] = useAccessorUpdateSubscription(getField)\n\n\t\tif (relativeSingleField.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn field\n\t}\n\treturn undefined\n}\n\nexport { useField }\n"],"names":[],"mappings":";;;;;;;AAeA,SAAS,SACR,4BACmC;AAC7B,QAAA,sBAAsB,gCAAgC,0BAA0B;AACtF;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,
|
|
1
|
+
{"version":3,"file":"useField.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useField.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { FieldAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleField } from './useDesugaredRelativeSingleField'\n\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField,\n): FieldAccessor<Value>\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined\nfunction useField<Value extends FieldValue = FieldValue>(\n\tsugaredRelativeSingleField: string | SugaredRelativeSingleField | undefined,\n): FieldAccessor<Value> | undefined {\n\tconst relativeSingleField = useDesugaredRelativeSingleField(sugaredRelativeSingleField)\n\tuseConstantValueInvariant(\n\t\t!!relativeSingleField,\n\t\t'useField: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getField = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getField<Value>(relativeSingleField!)\n\t}, [entityKey, getEntityByKey, relativeSingleField])\n\n\tif (relativeSingleField) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleField.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [field, { update }] = useAccessorUpdateSubscription(getField)\n\n\t\tif (relativeSingleField.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleField.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn field\n\t}\n\treturn undefined\n}\n\nexport { useField }\n"],"names":[],"mappings":";;;;;;;AAeA,SAAS,SACR,4BACmC;AAC7B,QAAA,sBAAsB,gCAAgC,0BAA0B;AACtF;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EACD;AAEA,QAAM,YAAY,aAAa;AAC/B,QAAM,iBAAiB,kBAAkB;AACnC,QAAA,WAAW,YAAY,MAAM;AAC5B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,SAAgB,mBAAoB;AAAA,EAChD,GAAA,CAAC,WAAW,gBAAgB,mBAAmB,CAAC;AAEnD,MAAI,qBAAqB;AAExB;AAAA,MACC,oBAAoB;AAAA,MACpB;AAAA,IACD;AAEA,UAAM,CAAC,OAAO,EAAE,OAAQ,CAAA,IAAI,8BAA8B,QAAQ;AAE9D,QAAA,oBAAoB,mBAAmB,QAAQ;AAElD,4BAAsB,oBAAoB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAAA;AAGvE,WAAA;AAAA,EAAA;AAED,SAAA;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetEntityListSubTree.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useGetEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport type {\n\tAlias,\n\tSugaredQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tTreeRootId,\n} from '@contember/binding'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntityListSubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityListAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntityListSubTree = useBindingOperations().getEntityListSubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntityListSubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntityListSubTree, treeRootId],\n\t)\n}\n"],"names":["useEnvironment","useBindingOperations","useTreeRootId","useCallback"],"mappings":";;;;;;AAYO,MAAM,0BAA0B,MAGX;AAC3B,QAAM,cAAcA,eAAAA;
|
|
1
|
+
{"version":3,"file":"useGetEntityListSubTree.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useGetEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport type {\n\tAlias,\n\tSugaredQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tTreeRootId,\n} from '@contember/binding'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntityListSubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityListAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntityListSubTree = useBindingOperations().getEntityListSubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntityListSubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntityListSubTree, treeRootId],\n\t)\n}\n"],"names":["useEnvironment","useBindingOperations","useTreeRootId","useCallback"],"mappings":";;;;;;AAYO,MAAM,0BAA0B,MAGX;AAC3B,QAAM,cAAcA,eAAAA,eAAe;AAC7B,QAAA,uBAAuBC,4CAAuB;AACpD,QAAM,aAAaC,cAAAA,cAAc;AAE1B,SAAAC,MAAA;AAAA,IACN,CACC,sBACG,WACC,qBAAqB,mBAAmB,OAAO,WAAW,IAAI,aAAa,OAAO,CAAC,GAAG,WAAW;AAAA,IACtG,CAAC,aAAa,sBAAsB,UAAU;AAAA,EAC/C;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetEntityListSubTree.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useGetEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport type {\n\tAlias,\n\tSugaredQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tTreeRootId,\n} from '@contember/binding'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntityListSubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityListAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntityListSubTree = useBindingOperations().getEntityListSubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntityListSubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntityListSubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,0BAA0B,MAGX;AAC3B,QAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"useGetEntityListSubTree.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useGetEntityListSubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport type {\n\tAlias,\n\tSugaredQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tTreeRootId,\n} from '@contember/binding'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntityListSubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityListAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntityListSubTree = useBindingOperations().getEntityListSubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntityListSubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntityListSubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,0BAA0B,MAGX;AAC3B,QAAM,cAAc,eAAe;AAC7B,QAAA,uBAAuB,uBAAuB;AACpD,QAAM,aAAa,cAAc;AAE1B,SAAA;AAAA,IACN,CACC,sBACG,WACC,qBAAqB,mBAAmB,OAAO,WAAW,IAAI,aAAa,OAAO,CAAC,GAAG,WAAW;AAAA,IACtG,CAAC,aAAa,sBAAsB,UAAU;AAAA,EAC/C;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetEntitySubTree.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useGetEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport type {\n\tAlias,\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '@contember/binding'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntitySubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntitySubTree = useBindingOperations().getEntitySubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntitySubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntitySubTree, treeRootId],\n\t)\n}\n"],"names":["useEnvironment","useBindingOperations","useTreeRootId","useCallback"],"mappings":";;;;;;AAYO,MAAM,sBAAsB,MAGX;AACvB,QAAM,cAAcA,eAAAA;
|
|
1
|
+
{"version":3,"file":"useGetEntitySubTree.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useGetEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport type {\n\tAlias,\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '@contember/binding'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntitySubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntitySubTree = useBindingOperations().getEntitySubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntitySubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntitySubTree, treeRootId],\n\t)\n}\n"],"names":["useEnvironment","useBindingOperations","useTreeRootId","useCallback"],"mappings":";;;;;;AAYO,MAAM,sBAAsB,MAGX;AACvB,QAAM,cAAcA,eAAAA,eAAe;AAC7B,QAAA,mBAAmBC,4CAAuB;AAChD,QAAM,aAAaC,cAAAA,cAAc;AAE1B,SAAAC,MAAA;AAAA,IACN,CACC,sBACG,WACC,iBAAiB,mBAAmB,OAAO,WAAW,IAAI,aAAa,OAAO,CAAC,GAAG,WAAW;AAAA,IAClG,CAAC,aAAa,kBAAkB,UAAU;AAAA,EAC3C;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetEntitySubTree.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useGetEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport type {\n\tAlias,\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '@contember/binding'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntitySubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntitySubTree = useBindingOperations().getEntitySubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntitySubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntitySubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,sBAAsB,MAGX;AACvB,QAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"useGetEntitySubTree.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useGetEntitySubTree.ts"],"sourcesContent":["import { useCallback } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport type {\n\tAlias,\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '@contember/binding'\nimport { useBindingOperations } from './useBindingOperations'\nimport { useEnvironment } from './useEnvironment'\nimport { useTreeRootId } from './useTreeRootId'\n\nexport const useGetEntitySubTree = (): ((\n\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t...treeId: [TreeRootId | undefined] | []\n) => EntityAccessor) => {\n\tconst environment = useEnvironment()\n\tconst getEntitySubTree = useBindingOperations().getEntitySubTree\n\tconst treeRootId = useTreeRootId()\n\n\treturn useCallback(\n\t\t(\n\t\t\tparametersOrAlias: Alias | SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t\t\t...treeId: [TreeRootId | undefined] | []\n\t\t) => getEntitySubTree(parametersOrAlias, treeId.length === 0 ? treeRootId : treeId[0], environment),\n\t\t[environment, getEntitySubTree, treeRootId],\n\t)\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,sBAAsB,MAGX;AACvB,QAAM,cAAc,eAAe;AAC7B,QAAA,mBAAmB,uBAAuB;AAChD,QAAM,aAAa,cAAc;AAE1B,SAAA;AAAA,IACN,CACC,sBACG,WACC,iBAAiB,mBAAmB,OAAO,WAAW,IAAI,aAAa,OAAO,CAAC,GAAG,WAAW;AAAA,IAClG,CAAC,aAAa,kBAAkB,UAAU;AAAA,EAC3C;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHasEntity.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useHasEntity.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useHasEntity = (): boolean => {\n\treturn useContext(EntityKeyContext) !== undefined\n}\n"],"names":["useContext","EntityKeyContext"],"mappings":";;;;AAGO,MAAM,eAAe,MAAe;AACnC,SAAAA,
|
|
1
|
+
{"version":3,"file":"useHasEntity.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useHasEntity.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useHasEntity = (): boolean => {\n\treturn useContext(EntityKeyContext) !== undefined\n}\n"],"names":["useContext","EntityKeyContext"],"mappings":";;;;AAGO,MAAM,eAAe,MAAe;AACnC,SAAAA,MAAA,WAAWC,iCAAgB,MAAM;AACzC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetOrderFieldOnCreate.cjs","sources":["../../../../../packages/react-binding/src/accessorSorting/SetOrderFieldOnCreate.tsx"],"sourcesContent":["import type { Input } from '@contember/client'\nimport type {\n\tSugaredOrderBy,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '@contember/binding'\nimport { QueryLanguage } from '@contember/binding'\nimport { Component, EntityListSubTree, EntitySubTree, Field } from '../coreComponents'\nimport { SugaredField } from '../helperComponents'\nimport { addEntityAtIndex } from './addEntityAtIndex'\n\nexport interface SetOrderFieldOnCreateOwnProps {\n\torderField: SugaredRelativeSingleField | string\n\tnewOrderFieldValue?: number\n}\n\nexport interface SetOrderFieldOnCreateProps\n\textends SetOrderFieldOnCreateOwnProps,\n\tPick<SugaredUnconstrainedQualifiedSingleEntity, 'entity'> {}\n\nexport const SetOrderFieldOnCreate = Component<SetOrderFieldOnCreateProps>(\n\t() => null,\n\t({ orderField, newOrderFieldValue, entity }, environment) => {\n\t\tconst desugaredOrderField = QueryLanguage.desugarRelativeSingleField(orderField, environment)\n\t\tconst getOrderBy = (order: 'asc' | 'desc'): SugaredOrderBy => [\n\t\t\tdesugaredOrderField.hasOneRelationPath\n\t\t\t\t.map(relation => relation.field)\n\t\t\t\t.reduceRight(\n\t\t\t\t\t(accumulator, currentValue) => ({\n\t\t\t\t\t\t[currentValue]: accumulator,\n\t\t\t\t\t}),\n\t\t\t\t\t{\n\t\t\t\t\t\t[desugaredOrderField.field]: order,\n\t\t\t\t\t} as Input.OrderBy<`${Input.OrderDirection}`>,\n\t\t\t\t),\n\t\t]\n\n\t\tif (newOrderFieldValue === undefined) {\n\t\t\tconst qel: SugaredQualifiedEntityList = {\n\t\t\t\tentities: entity,\n\t\t\t\texpectedMutation: 'none',\n\t\t\t\tlimit: 1,\n\t\t\t\torderBy: getOrderBy('desc'),\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<EntitySubTree\n\t\t\t\t\t\tentity={entity}\n\t\t\t\t\t\tisCreating\n\t\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t\tconst listSubTree = bindingOperations.getEntityListSubTree(qel)\n\t\t\t\t\t\t\tconst entities = Array.from(listSubTree)\n\t\t\t\t\t\t\tconst newOrderFieldValue = !entities.length\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: (entities[0].getField<number>(desugaredOrderField).value ?? 0) + 1\n\t\t\t\t\t\t\tgetAccessor().getField<number>(desugaredOrderField).updateValue(newOrderFieldValue)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntitySubTree>\n\t\t\t\t\t<EntityListSubTree {...qel}>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntityListSubTree>\n\t\t\t\t</>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Field field={desugaredOrderField} defaultValue={newOrderFieldValue} isNonbearing />\n\t\t\t\t<EntityListSubTree\n\t\t\t\t\tentities={entity}\n\t\t\t\t\texpectedMutation=\"anyMutation\"\n\t\t\t\t\torderBy={getOrderBy('asc')}\n\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t// We're creating a new entity which adjusts the numbering of the other ones if applicable\n\t\t\t\t\t\t// and then deleting it again which leaves a hole for newOrderFieldValue that is set above.\n\t\t\t\t\t\tlet newEntityKey: string | undefined = undefined\n\t\t\t\t\t\taddEntityAtIndex(getAccessor(), desugaredOrderField, newOrderFieldValue, getNewEntity => {\n\t\t\t\t\t\t\tnewEntityKey = getNewEntity().key\n\t\t\t\t\t\t})\n\t\t\t\t\t\tnewEntityKey && bindingOperations.getEntityByKey(newEntityKey).deleteEntity()\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t</EntityListSubTree>\n\t\t\t</>\n\t\t)\n\t},\n\t'SetOrderFieldOnCreate',\n)\n"],"names":["Component","QueryLanguage","jsxs","Fragment","jsx","EntitySubTree","newOrderFieldValue","SugaredField","EntityListSubTree","Field","addEntityAtIndex"],"mappings":";;;;;;;;;;AAqBO,MAAM,wBAAwBA,UAAA;AAAA,EACpC,MAAM;AAAA,EACN,CAAC,EAAE,YAAY,oBAAoB,OAAA,GAAU,gBAAgB;AAC5D,UAAM,sBAAsBC,QAAA,cAAc,2BAA2B,YAAY,WAAW;AACtF,UAAA,aAAa,CAAC,UAA0C;AAAA,MAC7D,oBAAoB,mBAClB,IAAI,CAAY,aAAA,SAAS,KAAK,EAC9B;AAAA,QACA,CAAC,aAAa,kBAAkB;AAAA,UAC/B,CAAC,YAAY,GAAG;AAAA,QAAA;AAAA,QAEjB;AAAA,UACC,CAAC,oBAAoB,KAAK,GAAG;AAAA,
|
|
1
|
+
{"version":3,"file":"SetOrderFieldOnCreate.cjs","sources":["../../../../../packages/react-binding/src/accessorSorting/SetOrderFieldOnCreate.tsx"],"sourcesContent":["import type { Input } from '@contember/client'\nimport type {\n\tSugaredOrderBy,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '@contember/binding'\nimport { QueryLanguage } from '@contember/binding'\nimport { Component, EntityListSubTree, EntitySubTree, Field } from '../coreComponents'\nimport { SugaredField } from '../helperComponents'\nimport { addEntityAtIndex } from './addEntityAtIndex'\n\nexport interface SetOrderFieldOnCreateOwnProps {\n\torderField: SugaredRelativeSingleField | string\n\tnewOrderFieldValue?: number\n}\n\nexport interface SetOrderFieldOnCreateProps\n\textends SetOrderFieldOnCreateOwnProps,\n\tPick<SugaredUnconstrainedQualifiedSingleEntity, 'entity'> {}\n\nexport const SetOrderFieldOnCreate = Component<SetOrderFieldOnCreateProps>(\n\t() => null,\n\t({ orderField, newOrderFieldValue, entity }, environment) => {\n\t\tconst desugaredOrderField = QueryLanguage.desugarRelativeSingleField(orderField, environment)\n\t\tconst getOrderBy = (order: 'asc' | 'desc'): SugaredOrderBy => [\n\t\t\tdesugaredOrderField.hasOneRelationPath\n\t\t\t\t.map(relation => relation.field)\n\t\t\t\t.reduceRight(\n\t\t\t\t\t(accumulator, currentValue) => ({\n\t\t\t\t\t\t[currentValue]: accumulator,\n\t\t\t\t\t}),\n\t\t\t\t\t{\n\t\t\t\t\t\t[desugaredOrderField.field]: order,\n\t\t\t\t\t} as Input.OrderBy<`${Input.OrderDirection}`>,\n\t\t\t\t),\n\t\t]\n\n\t\tif (newOrderFieldValue === undefined) {\n\t\t\tconst qel: SugaredQualifiedEntityList = {\n\t\t\t\tentities: entity,\n\t\t\t\texpectedMutation: 'none',\n\t\t\t\tlimit: 1,\n\t\t\t\torderBy: getOrderBy('desc'),\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<EntitySubTree\n\t\t\t\t\t\tentity={entity}\n\t\t\t\t\t\tisCreating\n\t\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t\tconst listSubTree = bindingOperations.getEntityListSubTree(qel)\n\t\t\t\t\t\t\tconst entities = Array.from(listSubTree)\n\t\t\t\t\t\t\tconst newOrderFieldValue = !entities.length\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: (entities[0].getField<number>(desugaredOrderField).value ?? 0) + 1\n\t\t\t\t\t\t\tgetAccessor().getField<number>(desugaredOrderField).updateValue(newOrderFieldValue)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntitySubTree>\n\t\t\t\t\t<EntityListSubTree {...qel}>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntityListSubTree>\n\t\t\t\t</>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Field field={desugaredOrderField} defaultValue={newOrderFieldValue} isNonbearing />\n\t\t\t\t<EntityListSubTree\n\t\t\t\t\tentities={entity}\n\t\t\t\t\texpectedMutation=\"anyMutation\"\n\t\t\t\t\torderBy={getOrderBy('asc')}\n\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t// We're creating a new entity which adjusts the numbering of the other ones if applicable\n\t\t\t\t\t\t// and then deleting it again which leaves a hole for newOrderFieldValue that is set above.\n\t\t\t\t\t\tlet newEntityKey: string | undefined = undefined\n\t\t\t\t\t\taddEntityAtIndex(getAccessor(), desugaredOrderField, newOrderFieldValue, getNewEntity => {\n\t\t\t\t\t\t\tnewEntityKey = getNewEntity().key\n\t\t\t\t\t\t})\n\t\t\t\t\t\tnewEntityKey && bindingOperations.getEntityByKey(newEntityKey).deleteEntity()\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t</EntityListSubTree>\n\t\t\t</>\n\t\t)\n\t},\n\t'SetOrderFieldOnCreate',\n)\n"],"names":["Component","QueryLanguage","jsxs","Fragment","jsx","EntitySubTree","newOrderFieldValue","SugaredField","EntityListSubTree","Field","addEntityAtIndex"],"mappings":";;;;;;;;;;AAqBO,MAAM,wBAAwBA,UAAA;AAAA,EACpC,MAAM;AAAA,EACN,CAAC,EAAE,YAAY,oBAAoB,OAAA,GAAU,gBAAgB;AAC5D,UAAM,sBAAsBC,QAAA,cAAc,2BAA2B,YAAY,WAAW;AACtF,UAAA,aAAa,CAAC,UAA0C;AAAA,MAC7D,oBAAoB,mBAClB,IAAI,CAAY,aAAA,SAAS,KAAK,EAC9B;AAAA,QACA,CAAC,aAAa,kBAAkB;AAAA,UAC/B,CAAC,YAAY,GAAG;AAAA,QAAA;AAAA,QAEjB;AAAA,UACC,CAAC,oBAAoB,KAAK,GAAG;AAAA,QAAA;AAAA,MAC9B;AAAA,IAEH;AAEA,QAAI,uBAAuB,QAAW;AACrC,YAAM,MAAkC;AAAA,QACvC,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,OAAO;AAAA,QACP,SAAS,WAAW,MAAM;AAAA,MAC3B;AACA,aAEEC,2BAAA,KAAAC,qBAAA,EAAA,UAAA;AAAA,QAAAC,2BAAA;AAAA,UAACC,cAAA;AAAA,UAAA;AAAA,YACA;AAAA,YACA,YAAU;AAAA,YACV,iBAAiB,CAAC,aAAa,sBAAsB;AAC9C,oBAAA,cAAc,kBAAkB,qBAAqB,GAAG;AACxD,oBAAA,WAAW,MAAM,KAAK,WAAW;AACvC,oBAAMC,sBAAqB,CAAC,SAAS,SAClC,KACC,SAAS,CAAC,EAAE,SAAiB,mBAAmB,EAAE,SAAS,KAAK;AACpE,0BAAc,EAAA,SAAiB,mBAAmB,EAAE,YAAYA,mBAAkB;AAAA,YACnF;AAAA,YAEA,UAAAF,2BAAAA,IAACG,aAAAA,cAAa,EAAA,OAAO,WAAY,CAAA;AAAA,UAAA;AAAA,QAClC;AAAA,QACAH,2BAAAA,IAACI,uCAAmB,GAAG,KACtB,yCAACD,aAAAA,cAAa,EAAA,OAAO,YAAY,EAClC,CAAA;AAAA,MAAA,GACD;AAAA,IAAA;AAGF,WAEEL,2BAAA,KAAAC,qBAAA,EAAA,UAAA;AAAA,MAAAC,+BAACK,MAAAA,SAAM,OAAO,qBAAqB,cAAc,oBAAoB,cAAY,MAAC;AAAA,MAClFL,2BAAA;AAAA,QAACI,kBAAA;AAAA,QAAA;AAAA,UACA,UAAU;AAAA,UACV,kBAAiB;AAAA,UACjB,SAAS,WAAW,KAAK;AAAA,UACzB,iBAAiB,CAAC,aAAa,sBAAsB;AAGpD,gBAAI,eAAmC;AACvCE,6BAAAA,iBAAiB,YAAY,GAAG,qBAAqB,oBAAoB,CAAgB,iBAAA;AACxF,6BAAe,eAAe;AAAA,YAAA,CAC9B;AACD,4BAAgB,kBAAkB,eAAe,YAAY,EAAE,aAAa;AAAA,UAC7E;AAAA,UAEA,UAAAN,2BAAAA,IAACG,aAAAA,cAAa,EAAA,OAAO,WAAY,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAClC,GACD;AAAA,EAEF;AAAA,EACA;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetOrderFieldOnCreate.js","sources":["../../../../../packages/react-binding/src/accessorSorting/SetOrderFieldOnCreate.tsx"],"sourcesContent":["import type { Input } from '@contember/client'\nimport type {\n\tSugaredOrderBy,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '@contember/binding'\nimport { QueryLanguage } from '@contember/binding'\nimport { Component, EntityListSubTree, EntitySubTree, Field } from '../coreComponents'\nimport { SugaredField } from '../helperComponents'\nimport { addEntityAtIndex } from './addEntityAtIndex'\n\nexport interface SetOrderFieldOnCreateOwnProps {\n\torderField: SugaredRelativeSingleField | string\n\tnewOrderFieldValue?: number\n}\n\nexport interface SetOrderFieldOnCreateProps\n\textends SetOrderFieldOnCreateOwnProps,\n\tPick<SugaredUnconstrainedQualifiedSingleEntity, 'entity'> {}\n\nexport const SetOrderFieldOnCreate = Component<SetOrderFieldOnCreateProps>(\n\t() => null,\n\t({ orderField, newOrderFieldValue, entity }, environment) => {\n\t\tconst desugaredOrderField = QueryLanguage.desugarRelativeSingleField(orderField, environment)\n\t\tconst getOrderBy = (order: 'asc' | 'desc'): SugaredOrderBy => [\n\t\t\tdesugaredOrderField.hasOneRelationPath\n\t\t\t\t.map(relation => relation.field)\n\t\t\t\t.reduceRight(\n\t\t\t\t\t(accumulator, currentValue) => ({\n\t\t\t\t\t\t[currentValue]: accumulator,\n\t\t\t\t\t}),\n\t\t\t\t\t{\n\t\t\t\t\t\t[desugaredOrderField.field]: order,\n\t\t\t\t\t} as Input.OrderBy<`${Input.OrderDirection}`>,\n\t\t\t\t),\n\t\t]\n\n\t\tif (newOrderFieldValue === undefined) {\n\t\t\tconst qel: SugaredQualifiedEntityList = {\n\t\t\t\tentities: entity,\n\t\t\t\texpectedMutation: 'none',\n\t\t\t\tlimit: 1,\n\t\t\t\torderBy: getOrderBy('desc'),\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<EntitySubTree\n\t\t\t\t\t\tentity={entity}\n\t\t\t\t\t\tisCreating\n\t\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t\tconst listSubTree = bindingOperations.getEntityListSubTree(qel)\n\t\t\t\t\t\t\tconst entities = Array.from(listSubTree)\n\t\t\t\t\t\t\tconst newOrderFieldValue = !entities.length\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: (entities[0].getField<number>(desugaredOrderField).value ?? 0) + 1\n\t\t\t\t\t\t\tgetAccessor().getField<number>(desugaredOrderField).updateValue(newOrderFieldValue)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntitySubTree>\n\t\t\t\t\t<EntityListSubTree {...qel}>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntityListSubTree>\n\t\t\t\t</>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Field field={desugaredOrderField} defaultValue={newOrderFieldValue} isNonbearing />\n\t\t\t\t<EntityListSubTree\n\t\t\t\t\tentities={entity}\n\t\t\t\t\texpectedMutation=\"anyMutation\"\n\t\t\t\t\torderBy={getOrderBy('asc')}\n\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t// We're creating a new entity which adjusts the numbering of the other ones if applicable\n\t\t\t\t\t\t// and then deleting it again which leaves a hole for newOrderFieldValue that is set above.\n\t\t\t\t\t\tlet newEntityKey: string | undefined = undefined\n\t\t\t\t\t\taddEntityAtIndex(getAccessor(), desugaredOrderField, newOrderFieldValue, getNewEntity => {\n\t\t\t\t\t\t\tnewEntityKey = getNewEntity().key\n\t\t\t\t\t\t})\n\t\t\t\t\t\tnewEntityKey && bindingOperations.getEntityByKey(newEntityKey).deleteEntity()\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t</EntityListSubTree>\n\t\t\t</>\n\t\t)\n\t},\n\t'SetOrderFieldOnCreate',\n)\n"],"names":["newOrderFieldValue"],"mappings":";;;;;;;;AAqBO,MAAM,wBAAwB;AAAA,EACpC,MAAM;AAAA,EACN,CAAC,EAAE,YAAY,oBAAoB,OAAA,GAAU,gBAAgB;AAC5D,UAAM,sBAAsB,cAAc,2BAA2B,YAAY,WAAW;AACtF,UAAA,aAAa,CAAC,UAA0C;AAAA,MAC7D,oBAAoB,mBAClB,IAAI,CAAY,aAAA,SAAS,KAAK,EAC9B;AAAA,QACA,CAAC,aAAa,kBAAkB;AAAA,UAC/B,CAAC,YAAY,GAAG;AAAA,QAAA;AAAA,QAEjB;AAAA,UACC,CAAC,oBAAoB,KAAK,GAAG;AAAA,
|
|
1
|
+
{"version":3,"file":"SetOrderFieldOnCreate.js","sources":["../../../../../packages/react-binding/src/accessorSorting/SetOrderFieldOnCreate.tsx"],"sourcesContent":["import type { Input } from '@contember/client'\nimport type {\n\tSugaredOrderBy,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '@contember/binding'\nimport { QueryLanguage } from '@contember/binding'\nimport { Component, EntityListSubTree, EntitySubTree, Field } from '../coreComponents'\nimport { SugaredField } from '../helperComponents'\nimport { addEntityAtIndex } from './addEntityAtIndex'\n\nexport interface SetOrderFieldOnCreateOwnProps {\n\torderField: SugaredRelativeSingleField | string\n\tnewOrderFieldValue?: number\n}\n\nexport interface SetOrderFieldOnCreateProps\n\textends SetOrderFieldOnCreateOwnProps,\n\tPick<SugaredUnconstrainedQualifiedSingleEntity, 'entity'> {}\n\nexport const SetOrderFieldOnCreate = Component<SetOrderFieldOnCreateProps>(\n\t() => null,\n\t({ orderField, newOrderFieldValue, entity }, environment) => {\n\t\tconst desugaredOrderField = QueryLanguage.desugarRelativeSingleField(orderField, environment)\n\t\tconst getOrderBy = (order: 'asc' | 'desc'): SugaredOrderBy => [\n\t\t\tdesugaredOrderField.hasOneRelationPath\n\t\t\t\t.map(relation => relation.field)\n\t\t\t\t.reduceRight(\n\t\t\t\t\t(accumulator, currentValue) => ({\n\t\t\t\t\t\t[currentValue]: accumulator,\n\t\t\t\t\t}),\n\t\t\t\t\t{\n\t\t\t\t\t\t[desugaredOrderField.field]: order,\n\t\t\t\t\t} as Input.OrderBy<`${Input.OrderDirection}`>,\n\t\t\t\t),\n\t\t]\n\n\t\tif (newOrderFieldValue === undefined) {\n\t\t\tconst qel: SugaredQualifiedEntityList = {\n\t\t\t\tentities: entity,\n\t\t\t\texpectedMutation: 'none',\n\t\t\t\tlimit: 1,\n\t\t\t\torderBy: getOrderBy('desc'),\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<EntitySubTree\n\t\t\t\t\t\tentity={entity}\n\t\t\t\t\t\tisCreating\n\t\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t\tconst listSubTree = bindingOperations.getEntityListSubTree(qel)\n\t\t\t\t\t\t\tconst entities = Array.from(listSubTree)\n\t\t\t\t\t\t\tconst newOrderFieldValue = !entities.length\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: (entities[0].getField<number>(desugaredOrderField).value ?? 0) + 1\n\t\t\t\t\t\t\tgetAccessor().getField<number>(desugaredOrderField).updateValue(newOrderFieldValue)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntitySubTree>\n\t\t\t\t\t<EntityListSubTree {...qel}>\n\t\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t\t</EntityListSubTree>\n\t\t\t\t</>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Field field={desugaredOrderField} defaultValue={newOrderFieldValue} isNonbearing />\n\t\t\t\t<EntityListSubTree\n\t\t\t\t\tentities={entity}\n\t\t\t\t\texpectedMutation=\"anyMutation\"\n\t\t\t\t\torderBy={getOrderBy('asc')}\n\t\t\t\t\tonBeforePersist={(getAccessor, bindingOperations) => {\n\t\t\t\t\t\t// We're creating a new entity which adjusts the numbering of the other ones if applicable\n\t\t\t\t\t\t// and then deleting it again which leaves a hole for newOrderFieldValue that is set above.\n\t\t\t\t\t\tlet newEntityKey: string | undefined = undefined\n\t\t\t\t\t\taddEntityAtIndex(getAccessor(), desugaredOrderField, newOrderFieldValue, getNewEntity => {\n\t\t\t\t\t\t\tnewEntityKey = getNewEntity().key\n\t\t\t\t\t\t})\n\t\t\t\t\t\tnewEntityKey && bindingOperations.getEntityByKey(newEntityKey).deleteEntity()\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<SugaredField field={orderField} />\n\t\t\t\t</EntityListSubTree>\n\t\t\t</>\n\t\t)\n\t},\n\t'SetOrderFieldOnCreate',\n)\n"],"names":["newOrderFieldValue"],"mappings":";;;;;;;;AAqBO,MAAM,wBAAwB;AAAA,EACpC,MAAM;AAAA,EACN,CAAC,EAAE,YAAY,oBAAoB,OAAA,GAAU,gBAAgB;AAC5D,UAAM,sBAAsB,cAAc,2BAA2B,YAAY,WAAW;AACtF,UAAA,aAAa,CAAC,UAA0C;AAAA,MAC7D,oBAAoB,mBAClB,IAAI,CAAY,aAAA,SAAS,KAAK,EAC9B;AAAA,QACA,CAAC,aAAa,kBAAkB;AAAA,UAC/B,CAAC,YAAY,GAAG;AAAA,QAAA;AAAA,QAEjB;AAAA,UACC,CAAC,oBAAoB,KAAK,GAAG;AAAA,QAAA;AAAA,MAC9B;AAAA,IAEH;AAEA,QAAI,uBAAuB,QAAW;AACrC,YAAM,MAAkC;AAAA,QACvC,UAAU;AAAA,QACV,kBAAkB;AAAA,QAClB,OAAO;AAAA,QACP,SAAS,WAAW,MAAM;AAAA,MAC3B;AACA,aAEE,qBAAA,UAAA,EAAA,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACA;AAAA,YACA,YAAU;AAAA,YACV,iBAAiB,CAAC,aAAa,sBAAsB;AAC9C,oBAAA,cAAc,kBAAkB,qBAAqB,GAAG;AACxD,oBAAA,WAAW,MAAM,KAAK,WAAW;AACvC,oBAAMA,sBAAqB,CAAC,SAAS,SAClC,KACC,SAAS,CAAC,EAAE,SAAiB,mBAAmB,EAAE,SAAS,KAAK;AACpE,0BAAc,EAAA,SAAiB,mBAAmB,EAAE,YAAYA,mBAAkB;AAAA,YACnF;AAAA,YAEA,UAAA,oBAAC,cAAa,EAAA,OAAO,WAAY,CAAA;AAAA,UAAA;AAAA,QAClC;AAAA,QACA,oBAAC,qBAAmB,GAAG,KACtB,8BAAC,cAAa,EAAA,OAAO,YAAY,EAClC,CAAA;AAAA,MAAA,GACD;AAAA,IAAA;AAGF,WAEE,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,oBAAC,SAAM,OAAO,qBAAqB,cAAc,oBAAoB,cAAY,MAAC;AAAA,MAClF;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,UAAU;AAAA,UACV,kBAAiB;AAAA,UACjB,SAAS,WAAW,KAAK;AAAA,UACzB,iBAAiB,CAAC,aAAa,sBAAsB;AAGpD,gBAAI,eAAmC;AACvC,6BAAiB,YAAY,GAAG,qBAAqB,oBAAoB,CAAgB,iBAAA;AACxF,6BAAe,eAAe;AAAA,YAAA,CAC9B;AACD,4BAAgB,kBAAkB,eAAe,YAAY,EAAE,aAAa;AAAA,UAC7E;AAAA,UAEA,UAAA,oBAAC,cAAa,EAAA,OAAO,WAAY,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAClC,GACD;AAAA,EAEF;AAAA,EACA;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addEntityAtIndex.cjs","sources":["../../../../../packages/react-binding/src/accessorSorting/addEntityAtIndex.ts"],"sourcesContent":["import { repairEntitiesOrder } from './repairEntitiesOrder'\nimport { sortEntities } from './sortEntities'\nimport { EntityAccessor, EntityListAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const addEntityAtIndex = (\n\tentityList: EntityListAccessor,\n\tsortableByField: RelativeSingleField,\n\tindex: number,\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler,\n) => {\n\tconst sortedEntities = sortEntities(Array.from(entityList), sortableByField)\n\n\tentityList.createNewEntity((getNewlyAdded, options) => {\n\t\tlet newlyAdded = getNewlyAdded()\n\n\t\tconst sortableField = newlyAdded.getField<number>(sortableByField)\n\n\t\tsortableField.updateValue(index)\n\t\tnewlyAdded = getNewlyAdded()\n\n\t\tsortedEntities.splice(index, 0, newlyAdded)\n\t\trepairEntitiesOrder(sortableByField, sortedEntities)\n\n\t\tpreprocess?.(getNewlyAdded, options)\n\t})\n}\n"],"names":["sortEntities","repairEntitiesOrder"],"mappings":";;;;AAIO,MAAM,mBAAmB,CAC/B,YACA,iBACA,OACA,eACI;AACJ,QAAM,iBAAiBA,aAAAA,aAAa,MAAM,KAAK,UAAU,GAAG,eAAe;AAEhE,aAAA,gBAAgB,CAAC,eAAe,YAAY;AACtD,QAAI,aAAa;
|
|
1
|
+
{"version":3,"file":"addEntityAtIndex.cjs","sources":["../../../../../packages/react-binding/src/accessorSorting/addEntityAtIndex.ts"],"sourcesContent":["import { repairEntitiesOrder } from './repairEntitiesOrder'\nimport { sortEntities } from './sortEntities'\nimport { EntityAccessor, EntityListAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const addEntityAtIndex = (\n\tentityList: EntityListAccessor,\n\tsortableByField: RelativeSingleField,\n\tindex: number,\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler,\n) => {\n\tconst sortedEntities = sortEntities(Array.from(entityList), sortableByField)\n\n\tentityList.createNewEntity((getNewlyAdded, options) => {\n\t\tlet newlyAdded = getNewlyAdded()\n\n\t\tconst sortableField = newlyAdded.getField<number>(sortableByField)\n\n\t\tsortableField.updateValue(index)\n\t\tnewlyAdded = getNewlyAdded()\n\n\t\tsortedEntities.splice(index, 0, newlyAdded)\n\t\trepairEntitiesOrder(sortableByField, sortedEntities)\n\n\t\tpreprocess?.(getNewlyAdded, options)\n\t})\n}\n"],"names":["sortEntities","repairEntitiesOrder"],"mappings":";;;;AAIO,MAAM,mBAAmB,CAC/B,YACA,iBACA,OACA,eACI;AACJ,QAAM,iBAAiBA,aAAAA,aAAa,MAAM,KAAK,UAAU,GAAG,eAAe;AAEhE,aAAA,gBAAgB,CAAC,eAAe,YAAY;AACtD,QAAI,aAAa,cAAc;AAEzB,UAAA,gBAAgB,WAAW,SAAiB,eAAe;AAEjE,kBAAc,YAAY,KAAK;AAC/B,iBAAa,cAAc;AAEZ,mBAAA,OAAO,OAAO,GAAG,UAAU;AAC1CC,wBAAA,oBAAoB,iBAAiB,cAAc;AAEnD,iBAAa,eAAe,OAAO;AAAA,EAAA,CACnC;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addEntityAtIndex.js","sources":["../../../../../packages/react-binding/src/accessorSorting/addEntityAtIndex.ts"],"sourcesContent":["import { repairEntitiesOrder } from './repairEntitiesOrder'\nimport { sortEntities } from './sortEntities'\nimport { EntityAccessor, EntityListAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const addEntityAtIndex = (\n\tentityList: EntityListAccessor,\n\tsortableByField: RelativeSingleField,\n\tindex: number,\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler,\n) => {\n\tconst sortedEntities = sortEntities(Array.from(entityList), sortableByField)\n\n\tentityList.createNewEntity((getNewlyAdded, options) => {\n\t\tlet newlyAdded = getNewlyAdded()\n\n\t\tconst sortableField = newlyAdded.getField<number>(sortableByField)\n\n\t\tsortableField.updateValue(index)\n\t\tnewlyAdded = getNewlyAdded()\n\n\t\tsortedEntities.splice(index, 0, newlyAdded)\n\t\trepairEntitiesOrder(sortableByField, sortedEntities)\n\n\t\tpreprocess?.(getNewlyAdded, options)\n\t})\n}\n"],"names":[],"mappings":";;AAIO,MAAM,mBAAmB,CAC/B,YACA,iBACA,OACA,eACI;AACJ,QAAM,iBAAiB,aAAa,MAAM,KAAK,UAAU,GAAG,eAAe;AAEhE,aAAA,gBAAgB,CAAC,eAAe,YAAY;AACtD,QAAI,aAAa;
|
|
1
|
+
{"version":3,"file":"addEntityAtIndex.js","sources":["../../../../../packages/react-binding/src/accessorSorting/addEntityAtIndex.ts"],"sourcesContent":["import { repairEntitiesOrder } from './repairEntitiesOrder'\nimport { sortEntities } from './sortEntities'\nimport { EntityAccessor, EntityListAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const addEntityAtIndex = (\n\tentityList: EntityListAccessor,\n\tsortableByField: RelativeSingleField,\n\tindex: number,\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler,\n) => {\n\tconst sortedEntities = sortEntities(Array.from(entityList), sortableByField)\n\n\tentityList.createNewEntity((getNewlyAdded, options) => {\n\t\tlet newlyAdded = getNewlyAdded()\n\n\t\tconst sortableField = newlyAdded.getField<number>(sortableByField)\n\n\t\tsortableField.updateValue(index)\n\t\tnewlyAdded = getNewlyAdded()\n\n\t\tsortedEntities.splice(index, 0, newlyAdded)\n\t\trepairEntitiesOrder(sortableByField, sortedEntities)\n\n\t\tpreprocess?.(getNewlyAdded, options)\n\t})\n}\n"],"names":[],"mappings":";;AAIO,MAAM,mBAAmB,CAC/B,YACA,iBACA,OACA,eACI;AACJ,QAAM,iBAAiB,aAAa,MAAM,KAAK,UAAU,GAAG,eAAe;AAEhE,aAAA,gBAAgB,CAAC,eAAe,YAAY;AACtD,QAAI,aAAa,cAAc;AAEzB,UAAA,gBAAgB,WAAW,SAAiB,eAAe;AAEjE,kBAAc,YAAY,KAAK;AAC/B,iBAAa,cAAc;AAEZ,mBAAA,OAAO,OAAO,GAAG,UAAU;AAC1C,wBAAoB,iBAAiB,cAAc;AAEnD,iBAAa,eAAe,OAAO;AAAA,EAAA,CACnC;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repairEntitiesOrder.cjs","sources":["../../../../../packages/react-binding/src/accessorSorting/repairEntitiesOrder.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const repairEntitiesOrder = (sortableByField: RelativeSingleField, sortedEntities: EntityAccessor[]) => {\n\tfor (let i = 0, len = sortedEntities.length; i < len; i++) {\n\t\tconst entity = sortedEntities[i]\n\t\tconst orderField = entity.getField(sortableByField)\n\n\t\tif (orderField.value !== i) {\n\t\t\t// TODO ideally, this condition should just be `orderField.value === null`\n\t\t\t// We should generally try to touch the indexes less\n\t\t\torderField.updateValue(i)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAEa,MAAA,sBAAsB,CAAC,iBAAsC,mBAAqC;AAC9G,WAAS,IAAI,GAAG,MAAM,eAAe,QAAQ,IAAI,KAAK,KAAK;AACpD,UAAA,SAAS,eAAe,CAAC;AACzB,UAAA,aAAa,OAAO,SAAS,eAAe;AAE9C,QAAA,WAAW,UAAU,GAAG;AAG3B,iBAAW,YAAY,CAAC;AAAA,
|
|
1
|
+
{"version":3,"file":"repairEntitiesOrder.cjs","sources":["../../../../../packages/react-binding/src/accessorSorting/repairEntitiesOrder.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const repairEntitiesOrder = (sortableByField: RelativeSingleField, sortedEntities: EntityAccessor[]) => {\n\tfor (let i = 0, len = sortedEntities.length; i < len; i++) {\n\t\tconst entity = sortedEntities[i]\n\t\tconst orderField = entity.getField(sortableByField)\n\n\t\tif (orderField.value !== i) {\n\t\t\t// TODO ideally, this condition should just be `orderField.value === null`\n\t\t\t// We should generally try to touch the indexes less\n\t\t\torderField.updateValue(i)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAEa,MAAA,sBAAsB,CAAC,iBAAsC,mBAAqC;AAC9G,WAAS,IAAI,GAAG,MAAM,eAAe,QAAQ,IAAI,KAAK,KAAK;AACpD,UAAA,SAAS,eAAe,CAAC;AACzB,UAAA,aAAa,OAAO,SAAS,eAAe;AAE9C,QAAA,WAAW,UAAU,GAAG;AAG3B,iBAAW,YAAY,CAAC;AAAA,IAAA;AAAA,EACzB;AAEF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repairEntitiesOrder.js","sources":["../../../../../packages/react-binding/src/accessorSorting/repairEntitiesOrder.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const repairEntitiesOrder = (sortableByField: RelativeSingleField, sortedEntities: EntityAccessor[]) => {\n\tfor (let i = 0, len = sortedEntities.length; i < len; i++) {\n\t\tconst entity = sortedEntities[i]\n\t\tconst orderField = entity.getField(sortableByField)\n\n\t\tif (orderField.value !== i) {\n\t\t\t// TODO ideally, this condition should just be `orderField.value === null`\n\t\t\t// We should generally try to touch the indexes less\n\t\t\torderField.updateValue(i)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAEa,MAAA,sBAAsB,CAAC,iBAAsC,mBAAqC;AAC9G,WAAS,IAAI,GAAG,MAAM,eAAe,QAAQ,IAAI,KAAK,KAAK;AACpD,UAAA,SAAS,eAAe,CAAC;AACzB,UAAA,aAAa,OAAO,SAAS,eAAe;AAE9C,QAAA,WAAW,UAAU,GAAG;AAG3B,iBAAW,YAAY,CAAC;AAAA,
|
|
1
|
+
{"version":3,"file":"repairEntitiesOrder.js","sources":["../../../../../packages/react-binding/src/accessorSorting/repairEntitiesOrder.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const repairEntitiesOrder = (sortableByField: RelativeSingleField, sortedEntities: EntityAccessor[]) => {\n\tfor (let i = 0, len = sortedEntities.length; i < len; i++) {\n\t\tconst entity = sortedEntities[i]\n\t\tconst orderField = entity.getField(sortableByField)\n\n\t\tif (orderField.value !== i) {\n\t\t\t// TODO ideally, this condition should just be `orderField.value === null`\n\t\t\t// We should generally try to touch the indexes less\n\t\t\torderField.updateValue(i)\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAEa,MAAA,sBAAsB,CAAC,iBAAsC,mBAAqC;AAC9G,WAAS,IAAI,GAAG,MAAM,eAAe,QAAQ,IAAI,KAAK,KAAK;AACpD,UAAA,SAAS,eAAe,CAAC;AACzB,UAAA,aAAa,OAAO,SAAS,eAAe;AAE9C,QAAA,WAAW,UAAU,GAAG;AAG3B,iBAAW,YAAY,CAAC;AAAA,IAAA;AAAA,EACzB;AAEF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.cjs","sources":["../../../../../packages/react-binding/src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getField<number>(sortByField)\n\t\tconst bField = b.getField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":";;AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"sortEntities.cjs","sources":["../../../../../packages/react-binding/src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getField<number>(sortByField)\n\t\tconst bField = b.getField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":";;AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,EAAA;AAER,SAAO,SAAS,KAAK,CAAC,GAAG,MAAM;AACxB,UAAA,SAAS,EAAE,SAAiB,WAAW;AACvC,UAAA,SAAS,EAAE,SAAiB,WAAW;AAE7C,YAAQ,OAAO,SAAS,OAAO,qBAAqB,OAAO,SAAS,OAAO;AAAA,EAAA,CAC3E;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortEntities.js","sources":["../../../../../packages/react-binding/src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getField<number>(sortByField)\n\t\tconst bField = b.getField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":"AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"sortEntities.js","sources":["../../../../../packages/react-binding/src/accessorSorting/sortEntities.ts"],"sourcesContent":["import { EntityAccessor, RelativeSingleField } from '@contember/binding'\n\nexport const sortEntities = (\n\tentities: EntityAccessor[],\n\tsortByField: RelativeSingleField | undefined,\n): EntityAccessor[] => {\n\tif (!sortByField) {\n\t\treturn entities\n\t}\n\treturn entities.sort((a, b) => {\n\t\tconst aField = a.getField<number>(sortByField)\n\t\tconst bField = b.getField<number>(sortByField)\n\n\t\treturn (aField.value ?? Number.MAX_SAFE_INTEGER) - (bField.value ?? Number.MAX_SAFE_INTEGER)\n\t})\n}\n"],"names":[],"mappings":"AAEa,MAAA,eAAe,CAC3B,UACA,gBACsB;AACtB,MAAI,CAAC,aAAa;AACV,WAAA;AAAA,EAAA;AAER,SAAO,SAAS,KAAK,CAAC,GAAG,MAAM;AACxB,UAAA,SAAS,EAAE,SAAiB,WAAW;AACvC,UAAA,SAAS,EAAE,SAAiB,WAAW;AAE7C,YAAQ,OAAO,SAAS,OAAO,qBAAqB,OAAO,SAAS,OAAO;AAAA,EAAA,CAC3E;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessorTree.cjs","sources":["../../../../../packages/react-binding/src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider, EnvironmentContext, TreeRootIdProvider } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\nimport { EntityKeyContext } from '../accessorPropagation/EntityKeyContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const AccessorTree = ({ state, children }: AccessorTreeProps) => {\n\tconst stateData = state.name === 'initialized' ? state.data : {\n\t\thasUnpersistedChanges: false,\n\t\tisMutating: false,\n\t\tbindingOperations: undefined,\n\t}\n\treturn (\n\t\t<TreeRootIdProvider treeRootId={undefined}>\n\t\t\t<EntityKeyContext.Provider value={undefined}>\n\t\t\t\t<EnvironmentContext.Provider value={state.environment}>\n\t\t\t\t\t<AccessorTreeStateContext.Provider value={state}>\n\t\t\t\t\t\t<DirtinessContext.Provider value={stateData.hasUnpersistedChanges}>\n\t\t\t\t\t\t\t<MutationStateContext.Provider value={stateData.isMutating}>\n\t\t\t\t\t\t\t\t<BindingOperationsProvider bindingOperations={stateData.bindingOperations}>\n\t\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t\t\t\t</MutationStateContext.Provider>\n\t\t\t\t\t\t</DirtinessContext.Provider>\n\t\t\t\t\t</AccessorTreeStateContext.Provider>\n\t\t\t\t</EnvironmentContext.Provider>\n\t\t\t</EntityKeyContext.Provider>\n\t\t</TreeRootIdProvider>\n\t)\n}\n\nAccessorTree.displayName = 'AccessorTree'\n"],"names":["jsx","TreeRootIdProvider","EntityKeyContext","EnvironmentContext","AccessorTreeStateContext","DirtinessContext","MutationStateContext","BindingOperationsProvider"],"mappings":";;;;;;;;;;AAgBO,MAAM,eAAe,CAAC,EAAE,OAAO,eAAkC;AACvE,QAAM,YAAY,MAAM,SAAS,gBAAgB,MAAM,OAAO;AAAA,IAC7D,uBAAuB;AAAA,IACvB,YAAY;AAAA,IACZ,mBAAmB;AAAA,
|
|
1
|
+
{"version":3,"file":"AccessorTree.cjs","sources":["../../../../../packages/react-binding/src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider, EnvironmentContext, TreeRootIdProvider } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\nimport { EntityKeyContext } from '../accessorPropagation/EntityKeyContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const AccessorTree = ({ state, children }: AccessorTreeProps) => {\n\tconst stateData = state.name === 'initialized' ? state.data : {\n\t\thasUnpersistedChanges: false,\n\t\tisMutating: false,\n\t\tbindingOperations: undefined,\n\t}\n\treturn (\n\t\t<TreeRootIdProvider treeRootId={undefined}>\n\t\t\t<EntityKeyContext.Provider value={undefined}>\n\t\t\t\t<EnvironmentContext.Provider value={state.environment}>\n\t\t\t\t\t<AccessorTreeStateContext.Provider value={state}>\n\t\t\t\t\t\t<DirtinessContext.Provider value={stateData.hasUnpersistedChanges}>\n\t\t\t\t\t\t\t<MutationStateContext.Provider value={stateData.isMutating}>\n\t\t\t\t\t\t\t\t<BindingOperationsProvider bindingOperations={stateData.bindingOperations}>\n\t\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t\t\t\t</MutationStateContext.Provider>\n\t\t\t\t\t\t</DirtinessContext.Provider>\n\t\t\t\t\t</AccessorTreeStateContext.Provider>\n\t\t\t\t</EnvironmentContext.Provider>\n\t\t\t</EntityKeyContext.Provider>\n\t\t</TreeRootIdProvider>\n\t)\n}\n\nAccessorTree.displayName = 'AccessorTree'\n"],"names":["jsx","TreeRootIdProvider","EntityKeyContext","EnvironmentContext","AccessorTreeStateContext","DirtinessContext","MutationStateContext","BindingOperationsProvider"],"mappings":";;;;;;;;;;AAgBO,MAAM,eAAe,CAAC,EAAE,OAAO,eAAkC;AACvE,QAAM,YAAY,MAAM,SAAS,gBAAgB,MAAM,OAAO;AAAA,IAC7D,uBAAuB;AAAA,IACvB,YAAY;AAAA,IACZ,mBAAmB;AAAA,EACpB;AAEC,SAAAA,2BAAA,IAACC,yCAAmB,YAAY,QAC/B,yCAACC,iBAAiB,iBAAA,UAAjB,EAA0B,OAAO,QACjC,UAAAF,2BAAA,IAACG,sCAAmB,UAAnB,EAA4B,OAAO,MAAM,aACzC,yCAACC,yBAAAA,yBAAyB,UAAzB,EAAkC,OAAO,OACzC,UAAAJ,+BAACK,iBAAAA,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,uBAC3C,yCAACC,qBAAqB,qBAAA,UAArB,EAA8B,OAAO,UAAU,YAC/C,yCAACC,0BAAAA,2BAA0B,EAAA,mBAAmB,UAAU,mBACtD,UACF,GACD,EACD,CAAA,EAAA,CACD,EACD,CAAA,EAAA,CACD,EACD,CAAA;AAEF;AAEA,aAAa,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessorTree.js","sources":["../../../../../packages/react-binding/src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider, EnvironmentContext, TreeRootIdProvider } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\nimport { EntityKeyContext } from '../accessorPropagation/EntityKeyContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const AccessorTree = ({ state, children }: AccessorTreeProps) => {\n\tconst stateData = state.name === 'initialized' ? state.data : {\n\t\thasUnpersistedChanges: false,\n\t\tisMutating: false,\n\t\tbindingOperations: undefined,\n\t}\n\treturn (\n\t\t<TreeRootIdProvider treeRootId={undefined}>\n\t\t\t<EntityKeyContext.Provider value={undefined}>\n\t\t\t\t<EnvironmentContext.Provider value={state.environment}>\n\t\t\t\t\t<AccessorTreeStateContext.Provider value={state}>\n\t\t\t\t\t\t<DirtinessContext.Provider value={stateData.hasUnpersistedChanges}>\n\t\t\t\t\t\t\t<MutationStateContext.Provider value={stateData.isMutating}>\n\t\t\t\t\t\t\t\t<BindingOperationsProvider bindingOperations={stateData.bindingOperations}>\n\t\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t\t\t\t</MutationStateContext.Provider>\n\t\t\t\t\t\t</DirtinessContext.Provider>\n\t\t\t\t\t</AccessorTreeStateContext.Provider>\n\t\t\t\t</EnvironmentContext.Provider>\n\t\t\t</EntityKeyContext.Provider>\n\t\t</TreeRootIdProvider>\n\t)\n}\n\nAccessorTree.displayName = 'AccessorTree'\n"],"names":[],"mappings":";;;;;;;;AAgBO,MAAM,eAAe,CAAC,EAAE,OAAO,eAAkC;AACvE,QAAM,YAAY,MAAM,SAAS,gBAAgB,MAAM,OAAO;AAAA,IAC7D,uBAAuB;AAAA,IACvB,YAAY;AAAA,IACZ,mBAAmB;AAAA,
|
|
1
|
+
{"version":3,"file":"AccessorTree.js","sources":["../../../../../packages/react-binding/src/accessorTree/AccessorTree.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingOperationsProvider, EnvironmentContext, TreeRootIdProvider } from '../accessorPropagation'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { DirtinessContext } from './DirtinessContext'\nimport { MutationStateContext } from './MutationStateContext'\nimport { EntityKeyContext } from '../accessorPropagation/EntityKeyContext'\n\nexport interface AccessorTreeProps {\n\tstate: AccessorTreeState\n\tchildren: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const AccessorTree = ({ state, children }: AccessorTreeProps) => {\n\tconst stateData = state.name === 'initialized' ? state.data : {\n\t\thasUnpersistedChanges: false,\n\t\tisMutating: false,\n\t\tbindingOperations: undefined,\n\t}\n\treturn (\n\t\t<TreeRootIdProvider treeRootId={undefined}>\n\t\t\t<EntityKeyContext.Provider value={undefined}>\n\t\t\t\t<EnvironmentContext.Provider value={state.environment}>\n\t\t\t\t\t<AccessorTreeStateContext.Provider value={state}>\n\t\t\t\t\t\t<DirtinessContext.Provider value={stateData.hasUnpersistedChanges}>\n\t\t\t\t\t\t\t<MutationStateContext.Provider value={stateData.isMutating}>\n\t\t\t\t\t\t\t\t<BindingOperationsProvider bindingOperations={stateData.bindingOperations}>\n\t\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t\t</BindingOperationsProvider>\n\t\t\t\t\t\t\t</MutationStateContext.Provider>\n\t\t\t\t\t\t</DirtinessContext.Provider>\n\t\t\t\t\t</AccessorTreeStateContext.Provider>\n\t\t\t\t</EnvironmentContext.Provider>\n\t\t\t</EntityKeyContext.Provider>\n\t\t</TreeRootIdProvider>\n\t)\n}\n\nAccessorTree.displayName = 'AccessorTree'\n"],"names":[],"mappings":";;;;;;;;AAgBO,MAAM,eAAe,CAAC,EAAE,OAAO,eAAkC;AACvE,QAAM,YAAY,MAAM,SAAS,gBAAgB,MAAM,OAAO;AAAA,IAC7D,uBAAuB;AAAA,IACvB,YAAY;AAAA,IACZ,mBAAmB;AAAA,EACpB;AAEC,SAAA,oBAAC,sBAAmB,YAAY,QAC/B,8BAAC,iBAAiB,UAAjB,EAA0B,OAAO,QACjC,UAAA,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,aACzC,8BAAC,yBAAyB,UAAzB,EAAkC,OAAO,OACzC,UAAA,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,UAAU,uBAC3C,8BAAC,qBAAqB,UAArB,EAA8B,OAAO,UAAU,YAC/C,8BAAC,2BAA0B,EAAA,mBAAmB,UAAU,mBACtD,UACF,GACD,EACD,CAAA,EAAA,CACD,EACD,CAAA,EAAA,CACD,EACD,CAAA;AAEF;AAEA,aAAa,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccessorTreeState.cjs","sources":["../../../../../packages/react-binding/src/accessorTree/useAccessorTreeState.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { BindingError } from '@contember/binding'\n\nexport const useAccessorTreeState = () => {\n\tconst state = useContext(AccessorTreeStateContext)\n\tif (!state) {\n\t\tthrow new BindingError()\n\t}\n\treturn state\n}\n"],"names":["useContext","AccessorTreeStateContext","BindingError"],"mappings":";;;;;AAIO,MAAM,uBAAuB,MAAM;AACnC,QAAA,QAAQA,iBAAWC,
|
|
1
|
+
{"version":3,"file":"useAccessorTreeState.cjs","sources":["../../../../../packages/react-binding/src/accessorTree/useAccessorTreeState.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { BindingError } from '@contember/binding'\n\nexport const useAccessorTreeState = () => {\n\tconst state = useContext(AccessorTreeStateContext)\n\tif (!state) {\n\t\tthrow new BindingError()\n\t}\n\treturn state\n}\n"],"names":["useContext","AccessorTreeStateContext","BindingError"],"mappings":";;;;;AAIO,MAAM,uBAAuB,MAAM;AACnC,QAAA,QAAQA,iBAAWC,iDAAwB;AACjD,MAAI,CAAC,OAAO;AACX,UAAM,IAAIC,QAAAA,aAAa;AAAA,EAAA;AAEjB,SAAA;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccessorTreeState.js","sources":["../../../../../packages/react-binding/src/accessorTree/useAccessorTreeState.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { BindingError } from '@contember/binding'\n\nexport const useAccessorTreeState = () => {\n\tconst state = useContext(AccessorTreeStateContext)\n\tif (!state) {\n\t\tthrow new BindingError()\n\t}\n\treturn state\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB,MAAM;AACnC,QAAA,QAAQ,WAAW,wBAAwB;AACjD,MAAI,CAAC,OAAO;AACX,UAAM,IAAI,aAAa;AAAA,
|
|
1
|
+
{"version":3,"file":"useAccessorTreeState.js","sources":["../../../../../packages/react-binding/src/accessorTree/useAccessorTreeState.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { AccessorTreeStateContext } from './AccessorTreeStateContext'\nimport { BindingError } from '@contember/binding'\n\nexport const useAccessorTreeState = () => {\n\tconst state = useContext(AccessorTreeStateContext)\n\tif (!state) {\n\t\tthrow new BindingError()\n\t}\n\treturn state\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB,MAAM;AACnC,QAAA,QAAQ,WAAW,wBAAwB;AACjD,MAAI,CAAC,OAAO;AACX,UAAM,IAAI,aAAa;AAAA,EAAA;AAEjB,SAAA;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataBinding.cjs","sources":["../../../../../packages/react-binding/src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../markers'\nimport ReactDOM from 'react-dom'\nimport { useEnvironmentWithSchema } from './useEnvironmentWithSchema'\nimport { useEnvironment } from '../accessorPropagation'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: {\n\tchildren?: ReactNode\n\trefreshOnPersist?: boolean\n\tskipStateUpdateAfterPersist?: boolean\n}): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\n\tconst environment = useEnvironment()\n\tconst environmentWithSchema = useEnvironmentWithSchema(environment)\n\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\n\tconst [state, setState] = useState<AccessorTreeState & { binding?: DataBinding<ReactNode> }>({\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tsetState(it => it.name === 'error' || it.binding !== binding ? it : {\n\t\t\t\t\tname: 'initialized',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tbinding,\n\t\t\t\t\tdata,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tsetState(it => it.binding !== binding ? it : {\n\t\t\t\t\tname: 'error',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tbinding,\n\t\t\t\t\terror,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tsetState({ binding, environment, name: 'initializing' })\n\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\n\tuseEffect(() => {\n\t\tif (environmentWithSchema) {\n\t\t\tresetDataBinding(environmentWithSchema, false)\n\t\t}\n\t}, [resetDataBinding, environmentWithSchema])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["useCurrentContentGraphQlClient","useCurrentSystemGraphQlClient","useTenantGraphQlClient","useEnvironment","useEnvironmentWithSchema","useRef","useIsMounted","useState","useCallback","environment","binding","TreeStore","DataBinding","MarkerTreeGenerator","useEffect"],"mappings":";;;;;;;;;;AAgBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAIyB;AACxB,QAAM,gBAAgBA,YAAAA;
|
|
1
|
+
{"version":3,"file":"useDataBinding.cjs","sources":["../../../../../packages/react-binding/src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../markers'\nimport ReactDOM from 'react-dom'\nimport { useEnvironmentWithSchema } from './useEnvironmentWithSchema'\nimport { useEnvironment } from '../accessorPropagation'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: {\n\tchildren?: ReactNode\n\trefreshOnPersist?: boolean\n\tskipStateUpdateAfterPersist?: boolean\n}): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\n\tconst environment = useEnvironment()\n\tconst environmentWithSchema = useEnvironmentWithSchema(environment)\n\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\n\tconst [state, setState] = useState<AccessorTreeState & { binding?: DataBinding<ReactNode> }>({\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tsetState(it => it.name === 'error' || it.binding !== binding ? it : {\n\t\t\t\t\tname: 'initialized',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tbinding,\n\t\t\t\t\tdata,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tsetState(it => it.binding !== binding ? it : {\n\t\t\t\t\tname: 'error',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tbinding,\n\t\t\t\t\terror,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tsetState({ binding, environment, name: 'initializing' })\n\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\n\tuseEffect(() => {\n\t\tif (environmentWithSchema) {\n\t\t\tresetDataBinding(environmentWithSchema, false)\n\t\t}\n\t}, [resetDataBinding, environmentWithSchema])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["useCurrentContentGraphQlClient","useCurrentSystemGraphQlClient","useTenantGraphQlClient","useEnvironment","useEnvironmentWithSchema","useRef","useIsMounted","useState","useCallback","environment","binding","TreeStore","DataBinding","MarkerTreeGenerator","useEffect"],"mappings":";;;;;;;;;;AAgBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAIyB;AACxB,QAAM,gBAAgBA,YAAAA,+BAA+B;AACrD,QAAM,eAAeC,YAAAA,8BAA8B;AACnD,QAAM,eAAeC,YAAAA,uBAAuB;AAE5C,QAAM,cAAcC,eAAAA,eAAe;AAC7B,QAAA,wBAAwBC,kDAAyB,WAAW;AAElE,QAAM,mBAAmBC,MAAAA,OAAkB;AAC3C,QAAM,eAAeC,WAAAA,aAAa;AAElC,QAAM,CAAC,OAAO,QAAQ,IAAIC,eAAmE;AAAA,IAC5F,MAAM;AAAA,IACN;AAAA,EAAA,CACA;AAED,QAAM,mBAAmBC,MAAAA,YAAY,CAACC,cAA0B,aAAsB;AAC/E,UAAA,WAAW,CAAC,MAAmCC,aAAoC;AACxF,UAAI,aAAa,SAAS;AACzB,iBAAS,QAAM,GAAG,SAAS,WAAW,GAAG,YAAYA,WAAU,KAAK;AAAA,UACnE,MAAM;AAAA,UACN,aAAAD;AAAAA,UACA,SAAAC;AAAAA,UACA;AAAA,QAAA,CACA;AAAA,MAAA;AAAA,IAEH;AAEM,UAAA,UAAU,CAAC,OAA2BA,aAAoC;AAC/E,UAAI,aAAa,SAAS;AACzB,iBAAS,CAAM,OAAA,GAAG,YAAYA,WAAU,KAAM;AAAA,UAC7C,MAAM;AAAA,UACN,aAAAD;AAAAA,UACA,SAAAC;AAAAA,UACA;AAAA,QAAA,CACA;AAAA,MAAA;AAAA,IAEH;AAEA,UAAM,mBAAmB,MAAM;AAC1B,UAAA,aAAa,WAAW,kBAAkB;AAC7C,yBAAiBD,cAAa,IAAI;AAAA,MAAA;AAAA,IAEpC;AAEI,QAAA,iBAAiB,YAAY,UAAa,UAAU;AACvD,uBAAiB,UAAU,IAAIE,QAAUF,UAAAA,aAAY,WAAW;AAAA,IAAA;AAGjE,UAAMC,YAAU,IAAIE,QAAA;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjBH;AAAAA,MACA,CAAC,MAAM,QAAQ;AACd,cAAM,MAAM,IAAII,wCAAoB,MAAM,GAAG;AAC7C,eAAO,IAAI,SAAS;AAAA,MACrB;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,+BAA+B;AAAA,MAAA;AAAA,IAE9D;AACA,aAAS,EAAEH,SAAAA,WAAS,aAAAD,cAAa,MAAM,gBAAgB;AAAA,EAAA,GAErD,CAAC,eAAe,cAAc,cAAc,cAAc,kBAAkB,2BAA2B,CAAC;AAG3GK,QAAAA,UAAU,MAAM;AACf,QAAI,uBAAuB;AAC1B,uBAAiB,uBAAuB,KAAK;AAAA,IAAA;AAAA,EAC9C,GACE,CAAC,kBAAkB,qBAAqB,CAAC;AAE5CA,QAAAA,UAAU,MAAM;AACT,UAAA,SAAS,WAAW,QAAQ;AAAA,EAChC,GAAA,CAAC,UAAU,MAAM,OAAO,CAAC;AAErB,SAAA;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataBinding.js","sources":["../../../../../packages/react-binding/src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../markers'\nimport ReactDOM from 'react-dom'\nimport { useEnvironmentWithSchema } from './useEnvironmentWithSchema'\nimport { useEnvironment } from '../accessorPropagation'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: {\n\tchildren?: ReactNode\n\trefreshOnPersist?: boolean\n\tskipStateUpdateAfterPersist?: boolean\n}): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\n\tconst environment = useEnvironment()\n\tconst environmentWithSchema = useEnvironmentWithSchema(environment)\n\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\n\tconst [state, setState] = useState<AccessorTreeState & { binding?: DataBinding<ReactNode> }>({\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tsetState(it => it.name === 'error' || it.binding !== binding ? it : {\n\t\t\t\t\tname: 'initialized',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tbinding,\n\t\t\t\t\tdata,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tsetState(it => it.binding !== binding ? it : {\n\t\t\t\t\tname: 'error',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tbinding,\n\t\t\t\t\terror,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tsetState({ binding, environment, name: 'initializing' })\n\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\n\tuseEffect(() => {\n\t\tif (environmentWithSchema) {\n\t\t\tresetDataBinding(environmentWithSchema, false)\n\t\t}\n\t}, [resetDataBinding, environmentWithSchema])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["environment","binding","ReactDOM"],"mappings":";;;;;;;;AAgBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAIyB;AACxB,QAAM,gBAAgB;
|
|
1
|
+
{"version":3,"file":"useDataBinding.js","sources":["../../../../../packages/react-binding/src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../markers'\nimport ReactDOM from 'react-dom'\nimport { useEnvironmentWithSchema } from './useEnvironmentWithSchema'\nimport { useEnvironment } from '../accessorPropagation'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: {\n\tchildren?: ReactNode\n\trefreshOnPersist?: boolean\n\tskipStateUpdateAfterPersist?: boolean\n}): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\n\tconst environment = useEnvironment()\n\tconst environmentWithSchema = useEnvironmentWithSchema(environment)\n\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\n\tconst [state, setState] = useState<AccessorTreeState & { binding?: DataBinding<ReactNode> }>({\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tsetState(it => it.name === 'error' || it.binding !== binding ? it : {\n\t\t\t\t\tname: 'initialized',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tbinding,\n\t\t\t\t\tdata,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tsetState(it => it.binding !== binding ? it : {\n\t\t\t\t\tname: 'error',\n\t\t\t\t\tenvironment,\n\t\t\t\t\tbinding,\n\t\t\t\t\terror,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tsetState({ binding, environment, name: 'initializing' })\n\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\n\tuseEffect(() => {\n\t\tif (environmentWithSchema) {\n\t\t\tresetDataBinding(environmentWithSchema, false)\n\t\t}\n\t}, [resetDataBinding, environmentWithSchema])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["environment","binding","ReactDOM"],"mappings":";;;;;;;;AAgBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAIyB;AACxB,QAAM,gBAAgB,+BAA+B;AACrD,QAAM,eAAe,8BAA8B;AACnD,QAAM,eAAe,uBAAuB;AAE5C,QAAM,cAAc,eAAe;AAC7B,QAAA,wBAAwB,yBAAyB,WAAW;AAElE,QAAM,mBAAmB,OAAkB;AAC3C,QAAM,eAAe,aAAa;AAElC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAmE;AAAA,IAC5F,MAAM;AAAA,IACN;AAAA,EAAA,CACA;AAED,QAAM,mBAAmB,YAAY,CAACA,cAA0B,aAAsB;AAC/E,UAAA,WAAW,CAAC,MAAmCC,aAAoC;AACxF,UAAI,aAAa,SAAS;AACzB,iBAAS,QAAM,GAAG,SAAS,WAAW,GAAG,YAAYA,WAAU,KAAK;AAAA,UACnE,MAAM;AAAA,UACN,aAAAD;AAAAA,UACA,SAAAC;AAAAA,UACA;AAAA,QAAA,CACA;AAAA,MAAA;AAAA,IAEH;AAEM,UAAA,UAAU,CAAC,OAA2BA,aAAoC;AAC/E,UAAI,aAAa,SAAS;AACzB,iBAAS,CAAM,OAAA,GAAG,YAAYA,WAAU,KAAM;AAAA,UAC7C,MAAM;AAAA,UACN,aAAAD;AAAAA,UACA,SAAAC;AAAAA,UACA;AAAA,QAAA,CACA;AAAA,MAAA;AAAA,IAEH;AAEA,UAAM,mBAAmB,MAAM;AAC1B,UAAA,aAAa,WAAW,kBAAkB;AAC7C,yBAAiBD,cAAa,IAAI;AAAA,MAAA;AAAA,IAEpC;AAEI,QAAA,iBAAiB,YAAY,UAAa,UAAU;AACvD,uBAAiB,UAAU,IAAI,UAAUA,aAAY,WAAW;AAAA,IAAA;AAGjE,UAAM,UAAU,IAAI;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjBA;AAAAA,MACA,CAAC,MAAM,QAAQ;AACd,cAAM,MAAM,IAAI,oBAAoB,MAAM,GAAG;AAC7C,eAAO,IAAI,SAAS;AAAA,MACrB;AAAA,MACAE,kBAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,+BAA+B;AAAA,MAAA;AAAA,IAE9D;AACA,aAAS,EAAE,SAAS,aAAAF,cAAa,MAAM,gBAAgB;AAAA,EAAA,GAErD,CAAC,eAAe,cAAc,cAAc,cAAc,kBAAkB,2BAA2B,CAAC;AAG3G,YAAU,MAAM;AACf,QAAI,uBAAuB;AAC1B,uBAAiB,uBAAuB,KAAK;AAAA,IAAA;AAAA,EAC9C,GACE,CAAC,kBAAkB,qBAAqB,CAAC;AAE5C,YAAU,MAAM;AACT,UAAA,SAAS,WAAW,QAAQ;AAAA,EAChC,GAAA,CAAC,UAAU,MAAM,OAAO,CAAC;AAErB,SAAA;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEnvironmentWithSchema.cjs","sources":["../../../../../packages/react-binding/src/accessorTree/useEnvironmentWithSchema.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport { Environment, Schema, SchemaLoader } from '@contember/binding'\nimport { GraphQlClientError } from '@contember/graphql-client'\nimport { useCurrentContentGraphQlClient } from '@contember/react-client'\n\nexport const useEnvironmentWithSchema = (env: Environment): Environment | undefined => {\n\tconst [schema, setSchema] = useState<Schema | undefined>(() => env.hasSchema() ? env.getSchema() : undefined)\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, schema])\n\n\treturn useMemo(() => schema ? env.withSchema(schema) : undefined, [env, schema])\n}\n"],"names":["useState","useCurrentContentGraphQlClient","useEffect","SchemaLoader","GraphQlClientError","useMemo"],"mappings":";;;;;;AAKa,MAAA,2BAA2B,CAAC,QAA8C;AACtF,QAAM,CAAC,QAAQ,SAAS,IAAIA,MAA6B,SAAA,MAAM,IAAI,UAAA,IAAc,IAAI,
|
|
1
|
+
{"version":3,"file":"useEnvironmentWithSchema.cjs","sources":["../../../../../packages/react-binding/src/accessorTree/useEnvironmentWithSchema.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport { Environment, Schema, SchemaLoader } from '@contember/binding'\nimport { GraphQlClientError } from '@contember/graphql-client'\nimport { useCurrentContentGraphQlClient } from '@contember/react-client'\n\nexport const useEnvironmentWithSchema = (env: Environment): Environment | undefined => {\n\tconst [schema, setSchema] = useState<Schema | undefined>(() => env.hasSchema() ? env.getSchema() : undefined)\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, schema])\n\n\treturn useMemo(() => schema ? env.withSchema(schema) : undefined, [env, schema])\n}\n"],"names":["useState","useCurrentContentGraphQlClient","useEffect","SchemaLoader","GraphQlClientError","useMemo"],"mappings":";;;;;;AAKa,MAAA,2BAA2B,CAAC,QAA8C;AACtF,QAAM,CAAC,QAAQ,SAAS,IAAIA,MAA6B,SAAA,MAAM,IAAI,UAAA,IAAc,IAAI,UAAU,IAAI,MAAS;AAC5G,QAAM,gBAAgBC,YAAAA,+BAA+B;AACrDC,QAAAA,UAAU,MAAM;AACf,QAAI,WAAW,QAAW;AACzB;AAAA,IAAA;AAGD,KAAC,YAAY;AACR,UAAA;AACH,kBAAU,MAAMC,QAAAA,aAAa,WAAW,aAAa,CAAC;AAAA,eAE9C,GAAG;AACX,YAAI,aAAaC,cAAAA,oBAAoB;AAChC,cAAA,EAAE,SAAS,WAAW;AACzB;AAAA,UAAA;AAAA,QACD,OACM;AACA,gBAAA;AAAA,QAAA;AAAA,MACP;AAAA,IACD,GACE;AAAA,EAAA,GACD,CAAC,eAAe,MAAM,CAAC;AAEnB,SAAAC,cAAQ,MAAM,SAAS,IAAI,WAAW,MAAM,IAAI,QAAW,CAAC,KAAK,MAAM,CAAC;AAChF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEnvironmentWithSchema.js","sources":["../../../../../packages/react-binding/src/accessorTree/useEnvironmentWithSchema.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport { Environment, Schema, SchemaLoader } from '@contember/binding'\nimport { GraphQlClientError } from '@contember/graphql-client'\nimport { useCurrentContentGraphQlClient } from '@contember/react-client'\n\nexport const useEnvironmentWithSchema = (env: Environment): Environment | undefined => {\n\tconst [schema, setSchema] = useState<Schema | undefined>(() => env.hasSchema() ? env.getSchema() : undefined)\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, schema])\n\n\treturn useMemo(() => schema ? env.withSchema(schema) : undefined, [env, schema])\n}\n"],"names":[],"mappings":";;;;AAKa,MAAA,2BAA2B,CAAC,QAA8C;AACtF,QAAM,CAAC,QAAQ,SAAS,IAAI,SAA6B,MAAM,IAAI,UAAA,IAAc,IAAI,
|
|
1
|
+
{"version":3,"file":"useEnvironmentWithSchema.js","sources":["../../../../../packages/react-binding/src/accessorTree/useEnvironmentWithSchema.ts"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react'\nimport { Environment, Schema, SchemaLoader } from '@contember/binding'\nimport { GraphQlClientError } from '@contember/graphql-client'\nimport { useCurrentContentGraphQlClient } from '@contember/react-client'\n\nexport const useEnvironmentWithSchema = (env: Environment): Environment | undefined => {\n\tconst [schema, setSchema] = useState<Schema | undefined>(() => env.hasSchema() ? env.getSchema() : undefined)\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, schema])\n\n\treturn useMemo(() => schema ? env.withSchema(schema) : undefined, [env, schema])\n}\n"],"names":[],"mappings":";;;;AAKa,MAAA,2BAA2B,CAAC,QAA8C;AACtF,QAAM,CAAC,QAAQ,SAAS,IAAI,SAA6B,MAAM,IAAI,UAAA,IAAc,IAAI,UAAU,IAAI,MAAS;AAC5G,QAAM,gBAAgB,+BAA+B;AACrD,YAAU,MAAM;AACf,QAAI,WAAW,QAAW;AACzB;AAAA,IAAA;AAGD,KAAC,YAAY;AACR,UAAA;AACH,kBAAU,MAAM,aAAa,WAAW,aAAa,CAAC;AAAA,eAE9C,GAAG;AACX,YAAI,aAAa,oBAAoB;AAChC,cAAA,EAAE,SAAS,WAAW;AACzB;AAAA,UAAA;AAAA,QACD,OACM;AACA,gBAAA;AAAA,QAAA;AAAA,MACP;AAAA,IACD,GACE;AAAA,EAAA,GACD,CAAC,eAAe,MAAM,CAAC;AAEnB,SAAA,QAAQ,MAAM,SAAS,IAAI,WAAW,MAAM,IAAI,QAAW,CAAC,KAAK,MAAM,CAAC;AAChF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactNode } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from '../markers'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactNode\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: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode,\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) => ReactNode)\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":["useEnvironment","augmentedRender","memo","assertNever"],"mappings":";;;;;AA4BA,SAAS,UACR,QACA,SAIA,aACC;AACD,QAAM,gBAAgB,CAAC,UAAiB,OAAO,OAAOA,+BAAgB;AACtE,QAAM,gBAAgB,OAAO,WAAW,cAAc,OAAO,SAAS,IAAI,SAAS;AAEnF,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACfC,UAAAA,mBAAuEC,WAAY,aAAa;AACtGD,qBAAgB,eAAe;AAC/BA,qBAAgB,cAAc;AAEvBA,WAAAA;AAAAA,
|
|
1
|
+
{"version":3,"file":"Component.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactNode } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from '../markers'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactNode\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: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode,\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) => ReactNode)\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":["useEnvironment","augmentedRender","memo","assertNever"],"mappings":";;;;;AA4BA,SAAS,UACR,QACA,SAIA,aACC;AACD,QAAM,gBAAgB,CAAC,UAAiB,OAAO,OAAOA,+BAAgB;AACtE,QAAM,gBAAgB,OAAO,WAAW,cAAc,OAAO,SAAS,IAAI,SAAS;AAEnF,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACfC,UAAAA,mBAAuEC,WAAY,aAAa;AACtGD,qBAAgB,eAAe;AAC/BA,qBAAgB,cAAc;AAEvBA,WAAAA;AAAAA,EAAA;AAGR,SAAO,cAAc;AACf,QAAA,kBAA2FC,WAAY,aAAa;AAC1H,kBAAgB,cAAc;AAE1B,MAAA,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAExB,WAAA;AAAA,EAAA;AAEJ,MAAA,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AACjB,sBAAgB,UAAU,IAC3B,QAAQ,UAAU;AAAA,IAAA;AAGb,WAAA;AAAA,EAAA;AAERC,YAAAA,YAAY,OAAO;AACpB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../../../packages/react-binding/src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactNode } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from '../markers'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactNode\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: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode,\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) => ReactNode)\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":";;;AA4BA,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,
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../../../packages/react-binding/src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactNode } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from '../markers'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactNode\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: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode,\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) => ReactNode)\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":";;;AA4BA,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,EAAA;AAGR,SAAO,cAAc;AACf,QAAA,kBAA2F,KAAY,aAAa;AAC1H,kBAAgB,cAAc;AAE1B,MAAA,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAExB,WAAA;AAAA,EAAA;AAEJ,MAAA,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AACjB,sBAAgB,UAAU,IAC3B,QAAQ,UAAU;AAAA,IAAA;AAGb,WAAA;AAAA,EAAA;AAER,cAAY,OAAO;AACpB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataBindingProvider.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderStateComponent<StateProps> = {\n\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\tstateProps?: StateProps\n}\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> =\n\t& {\n\t\trefreshOnPersist?: boolean\n\t\tskipStateUpdateAfterPersist?: boolean\n\t\tchildren?: ReactNode\n\t}\n\t& DataBindingProviderStateComponent<StateProps>\n\n\n/**\n * The `DataBindingProvider` is a root component for all other data binding related components.\n *\n * @example\n * ```\n * <DataBindingProvider stateComponent={FeedbackRenderer} />\n * ```\n *\n * @group Data binding\n */\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children = createElement(\n\t\tprops.stateComponent,\n\t\t{\n\t\t\t...props.stateProps!,\n\t\t\taccessorTreeState: accessorTreeState,\n\t\t},\n\t\tprops.children,\n\t)\n\treturn (\n\t\t<AccessorTree state={accessorTreeState}>\n\t\t\t{children}\n\t\t</AccessorTree>\n\t)\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["memo","DataBindingProvider","useDataBinding","createElement","jsx","AccessorTree"],"mappings":";;;;;;AAgCO,MAAM,sBAAsBA,MAAA,KAAK,SAASC,qBAChD,OACC;AACK,QAAA,oBAAoBC,8BAAe,KAAK;AAE9C,QAAM,WAAWC,MAAA;AAAA,IAChB,MAAM;AAAA,IACN;AAAA,MACC,GAAG,MAAM;AAAA,MACT;AAAA,IACD;AAAA,IACA,MAAM;AAAA,
|
|
1
|
+
{"version":3,"file":"DataBindingProvider.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderStateComponent<StateProps> = {\n\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\tstateProps?: StateProps\n}\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> =\n\t& {\n\t\trefreshOnPersist?: boolean\n\t\tskipStateUpdateAfterPersist?: boolean\n\t\tchildren?: ReactNode\n\t}\n\t& DataBindingProviderStateComponent<StateProps>\n\n\n/**\n * The `DataBindingProvider` is a root component for all other data binding related components.\n *\n * @example\n * ```\n * <DataBindingProvider stateComponent={FeedbackRenderer} />\n * ```\n *\n * @group Data binding\n */\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children = createElement(\n\t\tprops.stateComponent,\n\t\t{\n\t\t\t...props.stateProps!,\n\t\t\taccessorTreeState: accessorTreeState,\n\t\t},\n\t\tprops.children,\n\t)\n\treturn (\n\t\t<AccessorTree state={accessorTreeState}>\n\t\t\t{children}\n\t\t</AccessorTree>\n\t)\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["memo","DataBindingProvider","useDataBinding","createElement","jsx","AccessorTree"],"mappings":";;;;;;AAgCO,MAAM,sBAAsBA,MAAA,KAAK,SAASC,qBAChD,OACC;AACK,QAAA,oBAAoBC,8BAAe,KAAK;AAE9C,QAAM,WAAWC,MAAA;AAAA,IAChB,MAAM;AAAA,IACN;AAAA,MACC,GAAG,MAAM;AAAA,MACT;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EACP;AACA,SACEC,2BAAAA,IAAAC,aAAAA,cAAA,EAAa,OAAO,mBACnB,SACF,CAAA;AAEF,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataBindingProvider.js","sources":["../../../../../packages/react-binding/src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderStateComponent<StateProps> = {\n\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\tstateProps?: StateProps\n}\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> =\n\t& {\n\t\trefreshOnPersist?: boolean\n\t\tskipStateUpdateAfterPersist?: boolean\n\t\tchildren?: ReactNode\n\t}\n\t& DataBindingProviderStateComponent<StateProps>\n\n\n/**\n * The `DataBindingProvider` is a root component for all other data binding related components.\n *\n * @example\n * ```\n * <DataBindingProvider stateComponent={FeedbackRenderer} />\n * ```\n *\n * @group Data binding\n */\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children = createElement(\n\t\tprops.stateComponent,\n\t\t{\n\t\t\t...props.stateProps!,\n\t\t\taccessorTreeState: accessorTreeState,\n\t\t},\n\t\tprops.children,\n\t)\n\treturn (\n\t\t<AccessorTree state={accessorTreeState}>\n\t\t\t{children}\n\t\t</AccessorTree>\n\t)\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["DataBindingProvider"],"mappings":";;;;AAgCO,MAAM,sBAAsB,KAAK,SAASA,qBAChD,OACC;AACK,QAAA,oBAAoB,eAAe,KAAK;AAE9C,QAAM,WAAW;AAAA,IAChB,MAAM;AAAA,IACN;AAAA,MACC,GAAG,MAAM;AAAA,MACT;AAAA,IACD;AAAA,IACA,MAAM;AAAA,
|
|
1
|
+
{"version":3,"file":"DataBindingProvider.js","sources":["../../../../../packages/react-binding/src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, useDataBinding } from '../accessorTree'\n\nexport type DataBindingProviderStateComponent<StateProps> = {\n\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\tstateProps?: StateProps\n}\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> =\n\t& {\n\t\trefreshOnPersist?: boolean\n\t\tskipStateUpdateAfterPersist?: boolean\n\t\tchildren?: ReactNode\n\t}\n\t& DataBindingProviderStateComponent<StateProps>\n\n\n/**\n * The `DataBindingProvider` is a root component for all other data binding related components.\n *\n * @example\n * ```\n * <DataBindingProvider stateComponent={FeedbackRenderer} />\n * ```\n *\n * @group Data binding\n */\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding(props)\n\n\tconst children = createElement(\n\t\tprops.stateComponent,\n\t\t{\n\t\t\t...props.stateProps!,\n\t\t\taccessorTreeState: accessorTreeState,\n\t\t},\n\t\tprops.children,\n\t)\n\treturn (\n\t\t<AccessorTree state={accessorTreeState}>\n\t\t\t{children}\n\t\t</AccessorTree>\n\t)\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["DataBindingProvider"],"mappings":";;;;AAgCO,MAAM,sBAAsB,KAAK,SAASA,qBAChD,OACC;AACK,QAAA,oBAAoB,eAAe,KAAK;AAE9C,QAAM,WAAW;AAAA,IAChB,MAAM;AAAA,IACN;AAAA,MACC,GAAG,MAAM;AAAA,MACT;AAAA,IACD;AAAA,IACA,MAAM;AAAA,EACP;AACA,SACE,oBAAA,cAAA,EAAa,OAAO,mBACnB,SACF,CAAA;AAEF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityList.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\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(\n\t| {}\n\t| {\n\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\tlistProps?: ListProps\n\t\t }\n)\n\n/**\n * @group Data binding\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":["Component","createElement","jsx","Fragment","Entity"],"mappings":";;;;;;AAsBO,MAAM,aAAaA,UAAA;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAAC,MAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,
|
|
1
|
+
{"version":3,"file":"EntityList.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\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(\n\t| {}\n\t| {\n\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\tlistProps?: ListProps\n\t\t }\n)\n\n/**\n * @group Data binding\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":["Component","createElement","jsx","Fragment","Entity"],"mappings":";;;;;;AAsBO,MAAM,aAAaA,UAAA;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAAC,MAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IAAA;AAEF,WAEGC,2BAAA,IAAAC,qBAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,4CACEC,OAAAA,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,GAEpB;AAAA,IAED,CAAA,GACF;AAAA,EAEF;AAAA,EACA,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAAH,MAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU;AAAA,QACV,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IAAA;AAEK,WAAAC,2BAAAA,IAAAC,WAAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,EAC1B;AAAA,EACA;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityList.js","sources":["../../../../../packages/react-binding/src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\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(\n\t| {}\n\t| {\n\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\tlistProps?: ListProps\n\t\t }\n)\n\n/**\n * @group Data binding\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":";;;;AAsBO,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,
|
|
1
|
+
{"version":3,"file":"EntityList.js","sources":["../../../../../packages/react-binding/src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\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(\n\t| {}\n\t| {\n\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\tlistProps?: ListProps\n\t\t }\n)\n\n/**\n * @group Data binding\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":";;;;AAsBO,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,IAAA;AAEF,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,GACF;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,IAAA;AAEK,WAAA,oBAAA,UAAA,EAAG,gBAAM,SAAS,CAAA;AAAA,EAC1B;AAAA,EACA;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListSubTree.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityListSubTree } from '../accessorPropagation'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { Environment, MarkerFactory, PRIMARY_KEY_NAME, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n(\n\t| {}\n\t| {\n\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\tlistProps?: ListProps\n\t\t }\n)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\t\tconst accessor = useEntityListSubTree(props, ...props.treeRootId ? [props.treeRootId] : [])\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":["Component","useConstantValueInvariant","useEntityListSubTree","jsx","EntityList","MarkerFactory","jsxs","Field","PRIMARY_KEY_NAME","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;;;AAoCO,MAAM,oBAAoBA,UAAA;AAAA,EAChC,CAAyB,UAA0D;AACxDC,
|
|
1
|
+
{"version":3,"file":"EntityListSubTree.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityListSubTree } from '../accessorPropagation'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { Environment, MarkerFactory, PRIMARY_KEY_NAME, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n(\n\t| {}\n\t| {\n\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\tlistProps?: ListProps\n\t\t }\n)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\t\tconst accessor = useEntityListSubTree(props, ...props.treeRootId ? [props.treeRootId] : [])\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":["Component","useConstantValueInvariant","useEntityListSubTree","jsx","EntityList","MarkerFactory","jsxs","Field","PRIMARY_KEY_NAME","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;;;AAoCO,MAAM,oBAAoBA,UAAA;AAAA,EAChC,CAAyB,UAA0D;AACxDC,yCAAA,MAAM,YAAY,6CAA6C;AACnF,UAAA,WAAWC,0CAAqB,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,UAAU,IAAI,EAAE;AAQ1F,WAAQC,2BAAA,IAAAC,WAAA,YAAA,EAAY,GAAG,OAAO,SAAoB,CAAA;AAAA,EACnD;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAOC,QAAc,cAAA,2CAA2C,OAAO,QAAQ,WAAW;AAAA,MAAA;AAE3F,aAAOA,QAAc,cAAA,8BAA8B,OAAO,QAAQ,WAAW;AAAA,IAC9E;AAAA,IACA,cAAc,CACb,UAAAC,2BAAAA,KAACF,yBAAY,GAAG,OAAO,UAAU,GAChC,UAAA;AAAA,MAACD,2BAAAA,IAAAI,MAAA,OAAA,EAAM,OAAOC,QAAkB,iBAAA,CAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,GACR;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAAC,mCAA2B,sCAAsC,aAAa,KAAK;AAAA,IAAA;AAAA,EAE5F;AAAA,EACA;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListSubTree.js","sources":["../../../../../packages/react-binding/src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityListSubTree } from '../accessorPropagation'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { Environment, MarkerFactory, PRIMARY_KEY_NAME, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n(\n\t| {}\n\t| {\n\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\tlistProps?: ListProps\n\t\t }\n)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\t\tconst accessor = useEntityListSubTree(props, ...props.treeRootId ? [props.treeRootId] : [])\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":";;;;;;;AAoCO,MAAM,oBAAoB;AAAA,EAChC,CAAyB,UAA0D;AACxD,8BAAA,MAAM,YAAY,6CAA6C;AACnF,UAAA,WAAW,qBAAqB,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,UAAU,IAAI,
|
|
1
|
+
{"version":3,"file":"EntityListSubTree.js","sources":["../../../../../packages/react-binding/src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityListSubTree } from '../accessorPropagation'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { Environment, MarkerFactory, PRIMARY_KEY_NAME, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n(\n\t| {}\n\t| {\n\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\tlistProps?: ListProps\n\t\t }\n)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\t\tconst accessor = useEntityListSubTree(props, ...props.treeRootId ? [props.treeRootId] : [])\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":";;;;;;;AAoCO,MAAM,oBAAoB;AAAA,EAChC,CAAyB,UAA0D;AACxD,8BAAA,MAAM,YAAY,6CAA6C;AACnF,UAAA,WAAW,qBAAqB,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,UAAU,IAAI,EAAE;AAQ1F,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,MAAA;AAE3F,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,IAAA;AAAA,EAE5F;AAAA,EACA;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitySubTree.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode } from 'react'\nimport { useEntitySubTree } from '../accessorPropagation'\nimport type { SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity, TreeRootId } from '@contember/binding'\nimport { Environment, MarkerFactory, PRIMARY_KEY_NAME, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\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\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\t\tconst accessor = useEntitySubTree(props, ...props.treeRootId ? [props.treeRootId] : [])\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":["Component","useConstantValueInvariant","useEntitySubTree","jsx","Entity","MarkerFactory","jsxs","Fragment","Field","PRIMARY_KEY_NAME","SetOrderFieldOnCreate","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;;;;AAqCO,MAAM,gBAAgBA,UAAA;AAAA,EAC5B,CAAyB,UAA2C;AACzCC,
|
|
1
|
+
{"version":3,"file":"EntitySubTree.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode } from 'react'\nimport { useEntitySubTree } from '../accessorPropagation'\nimport type { SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity, TreeRootId } from '@contember/binding'\nimport { Environment, MarkerFactory, PRIMARY_KEY_NAME, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\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\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\t\tconst accessor = useEntitySubTree(props, ...props.treeRootId ? [props.treeRootId] : [])\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":["Component","useConstantValueInvariant","useEntitySubTree","jsx","Entity","MarkerFactory","jsxs","Fragment","Field","PRIMARY_KEY_NAME","SetOrderFieldOnCreate","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;;;;AAqCO,MAAM,gBAAgBA,UAAA;AAAA,EAC5B,CAAyB,UAA2C;AACzCC,yCAAA,MAAM,YAAY,yCAAyC;AAC/E,UAAA,WAAWC,kCAAiB,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,UAAU,IAAI,EAAE;AAOtF,WAAQC,2BAAA,IAAAC,OAAA,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,eAAOC,QAAc,cAAA,uCAAuC,OAAO,QAAQ,WAAW;AAAA,MAAA;AAEvF,aAAOA,QAAc,cAAA,0BAA0B,OAAO,QAAQ,WAAW;AAAA,IAC1E;AAAA,IACA,cAAc,WAEZC,2BAAA,KAAAC,WAAA,UAAA,EAAA,UAAA;AAAA,MAAAD,2BAAA,KAACF,OAAQ,QAAA,EAAA,GAAG,OAAO,UAAU,GAC5B,UAAA;AAAA,QAACD,2BAAAA,IAAAK,MAAA,OAAA,EAAM,OAAOC,QAAkB,iBAAA,CAAA;AAAA,QAC/B,MAAM;AAAA,MAAA,GACR;AAAA,MACC,MAAM,cAAc,gBAAgB,SACpCN,2BAAA;AAAA,QAACO,sBAAA;AAAA,QAAA;AAAA,UACA,YAAY,MAAM;AAAA,UAClB,oBAAoB,MAAM;AAAA,UAC1B,QAAQ,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IACf,GAEF;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAAC,mCAA2B,kCAAkC,aAAa,KAAK;AAAA,IAAA;AAAA,EAExF;AAAA,EACA;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitySubTree.js","sources":["../../../../../packages/react-binding/src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode } from 'react'\nimport { useEntitySubTree } from '../accessorPropagation'\nimport type { SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity, TreeRootId } from '@contember/binding'\nimport { Environment, MarkerFactory, PRIMARY_KEY_NAME, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\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\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\t\tconst accessor = useEntitySubTree(props, ...props.treeRootId ? [props.treeRootId] : [])\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":";;;;;;;;AAqCO,MAAM,gBAAgB;AAAA,EAC5B,CAAyB,UAA2C;AACzC,8BAAA,MAAM,YAAY,yCAAyC;AAC/E,UAAA,WAAW,iBAAiB,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,UAAU,IAAI,
|
|
1
|
+
{"version":3,"file":"EntitySubTree.js","sources":["../../../../../packages/react-binding/src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode } from 'react'\nimport { useEntitySubTree } from '../accessorPropagation'\nimport type { SugaredQualifiedSingleEntity, SugaredUnconstrainedQualifiedSingleEntity, TreeRootId } from '@contember/binding'\nimport { Environment, MarkerFactory, PRIMARY_KEY_NAME, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\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\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\t\tconst accessor = useEntitySubTree(props, ...props.treeRootId ? [props.treeRootId] : [])\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":";;;;;;;;AAqCO,MAAM,gBAAgB;AAAA,EAC5B,CAAyB,UAA2C;AACzC,8BAAA,MAAM,YAAY,yCAAyC;AAC/E,UAAA,WAAW,iBAAiB,OAAO,GAAG,MAAM,aAAa,CAAC,MAAM,UAAU,IAAI,EAAE;AAOtF,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,MAAA;AAEvF,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,MAAA;AAAA,IACf,GAEF;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,kCAAkC,aAAa,KAAK;AAAA,IAAA;AAAA,EAExF;AAAA,EACA;AACD;"}
|