@contember/react-binding 2.1.0-beta.1 → 2.2.0-alpha.1
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/AccessorProvider.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/AccessorProvider.js.map +1 -1
- package/dist/development/src/accessorPropagation/BindingOperationsProvider.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/BindingOperationsProvider.js.map +1 -1
- package/dist/development/src/accessorPropagation/EntityKeyProvider.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/EntityKeyProvider.js.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/TreeRootIdProvider.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/development/src/accessorPropagation/useBindingOperations.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useBindingOperations.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/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/useEnvironment.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useEnvironment.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/useGetEntityByKey.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useGetEntityByKey.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/accessorPropagation/useHasEntity.js.map +1 -1
- package/dist/development/src/accessorPropagation/usePersist.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/usePersist.js.map +1 -1
- package/dist/development/src/accessorPropagation/useTreeRootId.cjs.map +1 -1
- package/dist/development/src/accessorPropagation/useTreeRootId.js.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/accessorTree/AccessorTree.cjs.map +1 -1
- package/dist/development/src/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/src/accessorTree/AccessorTreeStateContext.cjs.map +1 -1
- package/dist/development/src/accessorTree/AccessorTreeStateContext.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/useDirtinessState.cjs.map +1 -1
- package/dist/development/src/accessorTree/useDirtinessState.js.map +1 -1
- package/dist/development/src/accessorTree/useMutationState.cjs.map +1 -1
- package/dist/development/src/accessorTree/useMutationState.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/HasMany.js.map +1 -1
- package/dist/development/src/coreComponents/HasOne.cjs.map +1 -1
- package/dist/development/src/coreComponents/HasOne.js.map +1 -1
- package/dist/development/src/coreComponents/ParentEntity.cjs.map +1 -1
- package/dist/development/src/coreComponents/ParentEntity.js.map +1 -1
- package/dist/development/src/entityEvents/useDataBindingEvent.cjs.map +1 -1
- package/dist/development/src/entityEvents/useDataBindingEvent.js.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/useEntityBeforePersist.js.map +1 -1
- package/dist/development/src/entityEvents/useEntityBeforeUpdate.cjs.map +1 -1
- package/dist/development/src/entityEvents/useEntityBeforeUpdate.js.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/useEntityPersistError.js.map +1 -1
- package/dist/development/src/entityEvents/useEntityPersistSuccess.cjs.map +1 -1
- package/dist/development/src/entityEvents/useEntityPersistSuccess.js.map +1 -1
- package/dist/development/src/entityEvents/useOnConnectionUpdate.cjs.map +1 -1
- package/dist/development/src/entityEvents/useOnConnectionUpdate.js.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/DeleteEntityTrigger.cjs.map +1 -1
- package/dist/development/src/helperComponents/DeleteEntityTrigger.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/StaticRender.cjs.map +1 -1
- package/dist/development/src/helperComponents/StaticRender.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/evaluateCondition.cjs +33 -0
- package/dist/development/src/helperComponents/helpers/evaluateCondition.cjs.map +1 -1
- package/dist/development/src/helperComponents/helpers/evaluateCondition.js +33 -0
- package/dist/development/src/helperComponents/helpers/evaluateCondition.js.map +1 -1
- package/dist/development/src/helperComponents/persist/PersistOnFieldChange.cjs.map +1 -1
- package/dist/development/src/helperComponents/persist/PersistOnFieldChange.js.map +1 -1
- package/dist/development/src/helperComponents/persist/PersistOnHasOneChange.cjs.map +1 -1
- package/dist/development/src/helperComponents/persist/PersistOnHasOneChange.js.map +1 -1
- package/dist/development/src/helperComponents/persist/PersistOnKey.cjs.map +1 -1
- package/dist/development/src/helperComponents/persist/PersistOnKey.js.map +1 -1
- package/dist/development/src/helperComponents/persist/PersistTrigger.cjs +1 -1
- package/dist/development/src/helperComponents/persist/PersistTrigger.cjs.map +1 -1
- package/dist/development/src/helperComponents/persist/PersistTrigger.js +1 -1
- package/dist/development/src/helperComponents/persist/PersistTrigger.js.map +1 -1
- package/dist/development/src/helperComponents/persist/useDecoratedPersist.cjs.map +1 -1
- package/dist/development/src/helperComponents/persist/useDecoratedPersist.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/BindingOperationsProvider.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/BindingOperationsProvider.js.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/TreeRootIdProvider.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/TreeRootIdProvider.js.map +1 -1
- package/dist/production/src/accessorPropagation/useBindingOperations.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useBindingOperations.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/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/useEnvironment.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useEnvironment.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/useGetEntityByKey.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useGetEntityByKey.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/accessorPropagation/useHasEntity.js.map +1 -1
- package/dist/production/src/accessorPropagation/usePersist.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/usePersist.js.map +1 -1
- package/dist/production/src/accessorPropagation/useTreeRootId.cjs.map +1 -1
- package/dist/production/src/accessorPropagation/useTreeRootId.js.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/accessorTree/AccessorTree.cjs.map +1 -1
- package/dist/production/src/accessorTree/AccessorTree.js.map +1 -1
- package/dist/production/src/accessorTree/AccessorTreeStateContext.cjs.map +1 -1
- package/dist/production/src/accessorTree/AccessorTreeStateContext.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/useDirtinessState.cjs.map +1 -1
- package/dist/production/src/accessorTree/useDirtinessState.js.map +1 -1
- package/dist/production/src/accessorTree/useMutationState.cjs.map +1 -1
- package/dist/production/src/accessorTree/useMutationState.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/Entity.cjs.map +1 -1
- package/dist/production/src/coreComponents/Entity.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/coreComponents/ParentEntity.js.map +1 -1
- package/dist/production/src/entityEvents/useDataBindingEvent.cjs.map +1 -1
- package/dist/production/src/entityEvents/useDataBindingEvent.js.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/useEntityBeforePersist.js.map +1 -1
- package/dist/production/src/entityEvents/useEntityBeforeUpdate.cjs.map +1 -1
- package/dist/production/src/entityEvents/useEntityBeforeUpdate.js.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/useEntityPersistError.js.map +1 -1
- package/dist/production/src/entityEvents/useEntityPersistSuccess.cjs.map +1 -1
- package/dist/production/src/entityEvents/useEntityPersistSuccess.js.map +1 -1
- package/dist/production/src/entityEvents/useOnConnectionUpdate.cjs.map +1 -1
- package/dist/production/src/entityEvents/useOnConnectionUpdate.js.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/DeleteEntityTrigger.cjs.map +1 -1
- package/dist/production/src/helperComponents/DeleteEntityTrigger.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/StaticRender.cjs.map +1 -1
- package/dist/production/src/helperComponents/StaticRender.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/evaluateCondition.cjs +33 -0
- package/dist/production/src/helperComponents/helpers/evaluateCondition.cjs.map +1 -1
- package/dist/production/src/helperComponents/helpers/evaluateCondition.js +33 -0
- package/dist/production/src/helperComponents/helpers/evaluateCondition.js.map +1 -1
- package/dist/production/src/helperComponents/persist/PersistOnFieldChange.cjs.map +1 -1
- package/dist/production/src/helperComponents/persist/PersistOnFieldChange.js.map +1 -1
- package/dist/production/src/helperComponents/persist/PersistOnHasOneChange.cjs.map +1 -1
- package/dist/production/src/helperComponents/persist/PersistOnHasOneChange.js.map +1 -1
- package/dist/production/src/helperComponents/persist/PersistOnKey.cjs.map +1 -1
- package/dist/production/src/helperComponents/persist/PersistOnKey.js.map +1 -1
- package/dist/production/src/helperComponents/persist/PersistTrigger.cjs.map +1 -1
- package/dist/production/src/helperComponents/persist/PersistTrigger.js.map +1 -1
- package/dist/production/src/helperComponents/persist/useDecoratedPersist.cjs.map +1 -1
- package/dist/production/src/helperComponents/persist/useDecoratedPersist.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/accessorPropagation/index.d.ts +28 -28
- package/dist/types/accessorPropagation/index.d.ts.map +1 -1
- package/dist/types/accessorSorting/index.d.ts +5 -5
- package/dist/types/accessorSorting/index.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTree.d.ts +1 -1
- package/dist/types/accessorTree/AccessorTree.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTreeStateContext.d.ts +1 -1
- package/dist/types/accessorTree/AccessorTreeStateContext.d.ts.map +1 -1
- package/dist/types/accessorTree/index.d.ts +11 -11
- package/dist/types/accessorTree/index.d.ts.map +1 -1
- package/dist/types/accessorTree/useAccessorTreeState.d.ts +1 -1
- package/dist/types/accessorTree/useAccessorTreeState.d.ts.map +1 -1
- package/dist/types/accessorTree/useDataBinding.d.ts +1 -1
- package/dist/types/accessorTree/useDataBinding.d.ts.map +1 -1
- package/dist/types/coreComponents/Component.d.ts +1 -1
- package/dist/types/coreComponents/Component.d.ts.map +1 -1
- package/dist/types/coreComponents/DataBindingProvider.d.ts +1 -1
- package/dist/types/coreComponents/DataBindingProvider.d.ts.map +1 -1
- package/dist/types/coreComponents/EntityListSubTree.d.ts +1 -1
- package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
- package/dist/types/coreComponents/EntitySubTree.d.ts +1 -1
- package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -1
- package/dist/types/coreComponents/HasMany.d.ts +1 -1
- package/dist/types/coreComponents/HasMany.d.ts.map +1 -1
- package/dist/types/coreComponents/index.d.ts +10 -10
- package/dist/types/coreComponents/index.d.ts.map +1 -1
- package/dist/types/entityEvents/index.d.ts +8 -8
- package/dist/types/entityEvents/index.d.ts.map +1 -1
- package/dist/types/helperComponents/RecursionTerminatorPortal.d.ts +1 -1
- package/dist/types/helperComponents/RecursionTerminatorPortal.d.ts.map +1 -1
- package/dist/types/helperComponents/SugaredField.d.ts +1 -1
- package/dist/types/helperComponents/SugaredField.d.ts.map +1 -1
- package/dist/types/helperComponents/helpers/evaluateCondition.d.ts.map +1 -1
- package/dist/types/helperComponents/index.d.ts +13 -13
- package/dist/types/helperComponents/index.d.ts.map +1 -1
- package/dist/types/helperComponents/persist/PersistTrigger.d.ts +3 -0
- package/dist/types/helperComponents/persist/PersistTrigger.d.ts.map +1 -1
- package/dist/types/helperComponents/persist/index.d.ts +4 -4
- package/dist/types/helperComponents/persist/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/markers/index.d.ts +2 -2
- package/dist/types/markers/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -8
- package/src/accessorPropagation/AccessorProvider.tsx +2 -2
- package/src/accessorPropagation/BindingOperationsProvider.tsx +1 -1
- package/src/accessorPropagation/EntityKeyProvider.tsx +1 -1
- package/src/accessorPropagation/EnvironmentContext.tsx +2 -2
- package/src/accessorPropagation/TreeRootIdProvider.tsx +1 -1
- package/src/accessorPropagation/index.ts +31 -31
- package/src/accessorPropagation/useBindingOperations.ts +1 -1
- package/src/accessorPropagation/useDesugaredRelativeEntityList.ts +1 -1
- package/src/accessorPropagation/useDesugaredRelativeSingleEntity.ts +1 -1
- package/src/accessorPropagation/useDesugaredRelativeSingleField.ts +1 -1
- package/src/accessorPropagation/useEntity.ts +4 -4
- package/src/accessorPropagation/useEntityKey.ts +1 -1
- package/src/accessorPropagation/useEntityList.ts +4 -4
- package/src/accessorPropagation/useEntityListSubTree.ts +3 -3
- package/src/accessorPropagation/useEntityListSubTreeLoader.ts +3 -3
- package/src/accessorPropagation/useEntitySubTree.ts +3 -3
- package/src/accessorPropagation/useEntitySubTreeLoader.ts +2 -2
- package/src/accessorPropagation/useEnvironment.ts +1 -1
- package/src/accessorPropagation/useExtendTree.ts +2 -2
- package/src/accessorPropagation/useField.ts +4 -4
- package/src/accessorPropagation/useGetEntityByKey.ts +1 -1
- package/src/accessorPropagation/useGetEntityListSubTree.ts +3 -3
- package/src/accessorPropagation/useGetEntitySubTree.ts +3 -3
- package/src/accessorPropagation/useHasEntity.ts +1 -1
- package/src/accessorPropagation/usePersist.ts +1 -1
- package/src/accessorPropagation/useTreeRootId.ts +1 -1
- package/src/accessorSorting/SetOrderFieldOnCreate.tsx +3 -3
- package/src/accessorSorting/addEntityAtIndex.ts +2 -2
- package/src/accessorSorting/index.ts +5 -5
- package/src/accessorTree/AccessorTree.tsx +6 -6
- package/src/accessorTree/AccessorTreeStateContext.ts +1 -1
- package/src/accessorTree/index.ts +11 -11
- package/src/accessorTree/useAccessorTreeState.ts +1 -1
- package/src/accessorTree/useDataBinding.ts +4 -4
- package/src/accessorTree/useDirtinessState.ts +1 -1
- package/src/accessorTree/useMutationState.ts +1 -1
- package/src/coreComponents/Component.tsx +2 -2
- package/src/coreComponents/DataBindingProvider.tsx +1 -1
- package/src/coreComponents/Entity.tsx +2 -2
- package/src/coreComponents/EntityList.tsx +2 -2
- package/src/coreComponents/EntityListSubTree.tsx +4 -4
- package/src/coreComponents/EntitySubTree.tsx +5 -5
- package/src/coreComponents/Field.tsx +2 -2
- package/src/coreComponents/HasMany.tsx +4 -4
- package/src/coreComponents/HasOne.tsx +4 -4
- package/src/coreComponents/ParentEntity.tsx +1 -1
- package/src/coreComponents/index.ts +10 -10
- package/src/entityEvents/index.ts +8 -8
- package/src/entityEvents/useDataBindingEvent.ts +1 -1
- package/src/entityEvents/useDerivedField.ts +1 -1
- package/src/entityEvents/useEntityBeforePersist.ts +1 -1
- package/src/entityEvents/useEntityBeforeUpdate.ts +1 -1
- package/src/entityEvents/useEntityEvent.ts +1 -1
- package/src/entityEvents/useEntityPersistError.ts +1 -1
- package/src/entityEvents/useEntityPersistSuccess.ts +1 -1
- package/src/entityEvents/useOnConnectionUpdate.ts +1 -1
- package/src/helperComponents/DeferredSubTrees.tsx +4 -4
- package/src/helperComponents/DeleteEntityTrigger.tsx +3 -3
- package/src/helperComponents/DimensionRenderer.tsx +2 -2
- package/src/helperComponents/EntityView.tsx +1 -1
- package/src/helperComponents/FieldView.tsx +3 -3
- package/src/helperComponents/If.tsx +4 -4
- package/src/helperComponents/LabelMiddleware.tsx +1 -1
- package/src/helperComponents/RecursionTerminator.tsx +1 -1
- package/src/helperComponents/RecursionTerminatorPortal.tsx +3 -3
- package/src/helperComponents/StaticRender.tsx +1 -1
- package/src/helperComponents/SugaredField.tsx +1 -1
- package/src/helperComponents/Variable.tsx +1 -1
- package/src/helperComponents/helpers/FilterEvaluator.ts +1 -1
- package/src/helperComponents/helpers/evaluateCondition.ts +33 -0
- package/src/helperComponents/index.ts +13 -13
- package/src/helperComponents/persist/PersistOnFieldChange.tsx +3 -3
- package/src/helperComponents/persist/PersistOnHasOneChange.tsx +3 -3
- package/src/helperComponents/persist/PersistOnKey.tsx +1 -1
- package/src/helperComponents/persist/PersistTrigger.tsx +5 -2
- package/src/helperComponents/persist/index.tsx +4 -4
- package/src/helperComponents/persist/useDecoratedPersist.ts +1 -1
- package/src/index.ts +7 -7
- package/src/markers/MarkerStaticAnalyzer.ts +2 -2
- package/src/markers/MarkerTreeGenerator.ts +1 -1
- package/src/markers/index.ts +2 -2
- package/tests/cases/unit/core/entityOperations.test.tsx +3 -3
- package/tests/cases/unit/core/eventManager.test.tsx +3 -3
- package/tests/cases/unit/helperComponents/FilterEvaluator.spec.ts +3 -3
- package/tests/cases/unit/helperComponents/FilterFieldsCollector.spec.ts +2 -2
- package/tests/cases/unit/helperComponents/evaluateCondition.spec.ts +1 -1
- package/tests/cases/unit/model/markerTreeGenerator.spec.tsx +1 -1
- package/tests/lib/bindingFactory.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldView.js","sources":["../../../../../packages/react-binding/src/helperComponents/FieldView.tsx"],"sourcesContent":["import { useArrayMapMemo, useConstantLengthInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback, useMemo } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport type { FieldAccessor, FieldValue, RelativeSingleField, SugaredRelativeSingleField } from '@contember/binding'\nimport { QueryLanguage, throwBindingError } from '@contember/binding'\nimport { Component } from '../coreComponents'\nimport { SugaredField } from './SugaredField'\n\nexport interface FieldViewCommonProps {\n\tfallbackIfUnpersisted?: ReactNode\n}\n\nexport type FieldViewProps =\n\t& FieldViewCommonProps\n\t& (\n\t\t| {\n\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\tfield: string | SugaredRelativeSingleField\n\t\t}\n\t\t| {\n\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\tfields: Array<string | SugaredRelativeSingleField>\n\t\t}\n\t)\n\n/**\n * Base field view component with no default formatting.\n *\n * @example\n * ```\n * <FieldView\n * field=\"startsAt\"\n * render={(accessor) => <>{accessor.value}</>}\n * />\n * ```\n *\n * @group Field Views\n */\nexport const FieldView = Component<FieldViewProps>(\n\tprops => {\n\t\tconst { fallbackIfUnpersisted, render } = props\n\t\tconst fields = 'fields' in props && Array.isArray(props.fields)\n\t\t\t? props.fields\n\t\t\t: 'field' in props && props.field\n\t\t\t? [props.field]\n\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\n\t\tuseConstantLengthInvariant(\n\t\t\tfields,\n\t\t\t`The number of fields in the 'fields' prop of the 'FieldView' must remain constant between renders!`,\n\t\t)\n\n\t\t// TODO over-subscribe less\n\t\tconst entityAccessor = useEntity()\n\t\tconst environment = entityAccessor.environment\n\n\t\tconst desugarField = useCallback(\n\t\t\t(rsf: string | SugaredRelativeSingleField) => QueryLanguage.desugarRelativeSingleField(rsf, environment),\n\t\t\t[environment],\n\t\t)\n\t\tconst desugaredFields = useArrayMapMemo(fields, desugarField)\n\n\t\tconst retrieveField = useCallback(\n\t\t\t(desugaredRsf: RelativeSingleField) => entityAccessor.getField(desugaredRsf),\n\t\t\t[entityAccessor],\n\t\t)\n\t\tconst accessors = useArrayMapMemo(desugaredFields, retrieveField)\n\n\t\t// TODO we probably want something like useDeferredValue from here.\n\t\t// Will probably just wait for Concurrent React though.\n\t\tconst output = useMemo(() => {\n\t\t\tif (!entityAccessor.existsOnServer && fallbackIfUnpersisted !== undefined) {\n\t\t\t\treturn fallbackIfUnpersisted\n\t\t\t}\n\t\t\treturn render(...accessors)\n\t\t}, [accessors, entityAccessor.existsOnServer, fallbackIfUnpersisted, render])\n\n\t\treturn <>{output}</>\n\t},\n\tprops => {\n\t\tconst fields = 'fields' in props && Array.isArray(props.fields)\n\t\t\t? props.fields\n\t\t\t: 'field' in props && props.field\n\t\t\t? [props.field]\n\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{props.fallbackIfUnpersisted}\n\t\t\t\t{fields.map((field, i) => <SugaredField key={i} field={field} />)}\n\t\t\t</>\n\t\t)\n\t},\n\t'FieldView',\n) as FieldViewComponentSignature\n\nexport type FieldViewComponentSignature = {\n\t<FV1 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfield: string | SugaredRelativeSingleField\n\t\t\t\trender: (field1: FieldAccessor<FV1>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [string | SugaredRelativeSingleField]\n\t\t\t\trender: (field1: FieldAccessor<FV1>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue, FV2 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [string | SugaredRelativeSingleField, string | SugaredRelativeSingleField]\n\t\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue, FV2 extends FieldValue, FV3 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [string | SugaredRelativeSingleField, string | SugaredRelativeSingleField, string | SugaredRelativeSingleField]\n\t\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>, field3: FieldAccessor<FV3>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue, FV2 extends FieldValue, FV3 extends FieldValue, FV4 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t]\n\t\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>, field3: FieldAccessor<FV3>, field4: FieldAccessor<FV4>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue, FV2 extends FieldValue, FV3 extends FieldValue, FV4 extends FieldValue, FV5 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t]\n\t\t\t\trender: (\n\t\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t\t\tfield5: FieldAccessor<FV5>,\n\t\t\t\t) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t(props: FieldViewProps): ReactElement | null\n}\n"],"names":["this"],"mappings":";;;;;;;AAsCO,MAAM,YAAY;AAAA,EACxB,CAAA,UAAS;AACR,UAAM,EAAE,uBAAuB,OAAA,IAAW;AAC1C,UAAM,SAAS,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC3D,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAE3F;AAAA,MACC;AAAA,MACA;AAAA,IAAA;AAID,UAAM,iBAAiB,UAAA;AACvB,UAAM,cAAc,eAAe;AAEnC,UAAM,eAAe;AAAA,MACpB,CAAC,QAA6C,cAAc,2BAA2B,KAAK,WAAW;AAAA,MACvG,CAAC,WAAW;AAAA,IAAA;AAEb,UAAM,kBAAkB,gBAAgB,QAAQ,YAAY;AAE5D,UAAM,gBAAgB;AAAA,MACrB,CAAC,iBAAsC,eAAe,SAAS,YAAY;AAAA,MAC3E,CAAC,cAAc;AAAA,IAAA;AAEhB,UAAM,YAAY,gBAAgB,iBAAiB,aAAa;AAIhE,UAAM,SAAS,QAAQ,MAAM;AAC5B,UAAI,CAAC,eAAe,kBAAkB,0BAA0B,QAAW;AAC1E,eAAO;AAAA,MACR;AACA,aAAO,OAAO,GAAG,SAAS;AAAA,IAC3B,GAAG,CAAC,WAAW,eAAe,gBAAgB,uBAAuB,MAAM,CAAC;AAE5E,8CAAU,UAAA,OAAA,GAAH,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAAU;AAAA,EAClB;AAAA,EACA,CAAA,UAAS;AACR,UAAM,SAAS,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC3D,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAC3F,WACC,uBAAA,UAAA,EACE,UAAA;AAAA,MAAA,MAAM;AAAA,MACN,OAAO,IAAI,CAAC,OAAO,MAAM,uBAAC,cAAA,EAAqB,SAAH,GAAnB,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAA,MAAoC,CAAE;AAAA,IAAA,EAAA,GAFjE,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAGA;AAAA,EAEF;AAAA,EACA;AACD;"}
|
|
1
|
+
{"version":3,"file":"FieldView.js","sources":["../../../../../packages/react-binding/src/helperComponents/FieldView.tsx"],"sourcesContent":["import { useArrayMapMemo, useConstantLengthInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback, useMemo } from 'react'\nimport { useEntity } from '../accessorPropagation/index.js'\nimport type { FieldAccessor, FieldValue, RelativeSingleField, SugaredRelativeSingleField } from '@contember/binding'\nimport { QueryLanguage, throwBindingError } from '@contember/binding'\nimport { Component } from '../coreComponents/index.js'\nimport { SugaredField } from './SugaredField.js'\n\nexport interface FieldViewCommonProps {\n\tfallbackIfUnpersisted?: ReactNode\n}\n\nexport type FieldViewProps =\n\t& FieldViewCommonProps\n\t& (\n\t\t| {\n\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\tfield: string | SugaredRelativeSingleField\n\t\t}\n\t\t| {\n\t\t\trender: (...accessors: FieldAccessor[]) => ReactNode\n\t\t\tfields: Array<string | SugaredRelativeSingleField>\n\t\t}\n\t)\n\n/**\n * Base field view component with no default formatting.\n *\n * @example\n * ```\n * <FieldView\n * field=\"startsAt\"\n * render={(accessor) => <>{accessor.value}</>}\n * />\n * ```\n *\n * @group Field Views\n */\nexport const FieldView = Component<FieldViewProps>(\n\tprops => {\n\t\tconst { fallbackIfUnpersisted, render } = props\n\t\tconst fields = 'fields' in props && Array.isArray(props.fields)\n\t\t\t? props.fields\n\t\t\t: 'field' in props && props.field\n\t\t\t? [props.field]\n\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\n\t\tuseConstantLengthInvariant(\n\t\t\tfields,\n\t\t\t`The number of fields in the 'fields' prop of the 'FieldView' must remain constant between renders!`,\n\t\t)\n\n\t\t// TODO over-subscribe less\n\t\tconst entityAccessor = useEntity()\n\t\tconst environment = entityAccessor.environment\n\n\t\tconst desugarField = useCallback(\n\t\t\t(rsf: string | SugaredRelativeSingleField) => QueryLanguage.desugarRelativeSingleField(rsf, environment),\n\t\t\t[environment],\n\t\t)\n\t\tconst desugaredFields = useArrayMapMemo(fields, desugarField)\n\n\t\tconst retrieveField = useCallback(\n\t\t\t(desugaredRsf: RelativeSingleField) => entityAccessor.getField(desugaredRsf),\n\t\t\t[entityAccessor],\n\t\t)\n\t\tconst accessors = useArrayMapMemo(desugaredFields, retrieveField)\n\n\t\t// TODO we probably want something like useDeferredValue from here.\n\t\t// Will probably just wait for Concurrent React though.\n\t\tconst output = useMemo(() => {\n\t\t\tif (!entityAccessor.existsOnServer && fallbackIfUnpersisted !== undefined) {\n\t\t\t\treturn fallbackIfUnpersisted\n\t\t\t}\n\t\t\treturn render(...accessors)\n\t\t}, [accessors, entityAccessor.existsOnServer, fallbackIfUnpersisted, render])\n\n\t\treturn <>{output}</>\n\t},\n\tprops => {\n\t\tconst fields = 'fields' in props && Array.isArray(props.fields)\n\t\t\t? props.fields\n\t\t\t: 'field' in props && props.field\n\t\t\t? [props.field]\n\t\t\t: throwBindingError(`FieldView: failed to supply either the 'field' or the 'fields' prop.`)\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{props.fallbackIfUnpersisted}\n\t\t\t\t{fields.map((field, i) => <SugaredField key={i} field={field} />)}\n\t\t\t</>\n\t\t)\n\t},\n\t'FieldView',\n) as FieldViewComponentSignature\n\nexport type FieldViewComponentSignature = {\n\t<FV1 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfield: string | SugaredRelativeSingleField\n\t\t\t\trender: (field1: FieldAccessor<FV1>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [string | SugaredRelativeSingleField]\n\t\t\t\trender: (field1: FieldAccessor<FV1>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue, FV2 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [string | SugaredRelativeSingleField, string | SugaredRelativeSingleField]\n\t\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue, FV2 extends FieldValue, FV3 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [string | SugaredRelativeSingleField, string | SugaredRelativeSingleField, string | SugaredRelativeSingleField]\n\t\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>, field3: FieldAccessor<FV3>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue, FV2 extends FieldValue, FV3 extends FieldValue, FV4 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t]\n\t\t\t\trender: (field1: FieldAccessor<FV1>, field2: FieldAccessor<FV2>, field3: FieldAccessor<FV3>, field4: FieldAccessor<FV4>) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t<FV1 extends FieldValue, FV2 extends FieldValue, FV3 extends FieldValue, FV4 extends FieldValue, FV5 extends FieldValue>(\n\t\tprops:\n\t\t\t& FieldViewCommonProps\n\t\t\t& {\n\t\t\t\tfields: [\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t\tstring | SugaredRelativeSingleField,\n\t\t\t\t]\n\t\t\t\trender: (\n\t\t\t\t\tfield1: FieldAccessor<FV1>,\n\t\t\t\t\tfield2: FieldAccessor<FV2>,\n\t\t\t\t\tfield3: FieldAccessor<FV3>,\n\t\t\t\t\tfield4: FieldAccessor<FV4>,\n\t\t\t\t\tfield5: FieldAccessor<FV5>,\n\t\t\t\t) => ReactNode\n\t\t\t},\n\t): ReactElement | null\n\n\t(props: FieldViewProps): ReactElement | null\n}\n"],"names":["this"],"mappings":";;;;;;;AAsCO,MAAM,YAAY;AAAA,EACxB,CAAA,UAAS;AACR,UAAM,EAAE,uBAAuB,OAAA,IAAW;AAC1C,UAAM,SAAS,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC3D,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAE3F;AAAA,MACC;AAAA,MACA;AAAA,IAAA;AAID,UAAM,iBAAiB,UAAA;AACvB,UAAM,cAAc,eAAe;AAEnC,UAAM,eAAe;AAAA,MACpB,CAAC,QAA6C,cAAc,2BAA2B,KAAK,WAAW;AAAA,MACvG,CAAC,WAAW;AAAA,IAAA;AAEb,UAAM,kBAAkB,gBAAgB,QAAQ,YAAY;AAE5D,UAAM,gBAAgB;AAAA,MACrB,CAAC,iBAAsC,eAAe,SAAS,YAAY;AAAA,MAC3E,CAAC,cAAc;AAAA,IAAA;AAEhB,UAAM,YAAY,gBAAgB,iBAAiB,aAAa;AAIhE,UAAM,SAAS,QAAQ,MAAM;AAC5B,UAAI,CAAC,eAAe,kBAAkB,0BAA0B,QAAW;AAC1E,eAAO;AAAA,MACR;AACA,aAAO,OAAO,GAAG,SAAS;AAAA,IAC3B,GAAG,CAAC,WAAW,eAAe,gBAAgB,uBAAuB,MAAM,CAAC;AAE5E,8CAAU,UAAA,OAAA,GAAH,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAAU;AAAA,EAClB;AAAA,EACA,CAAA,UAAS;AACR,UAAM,SAAS,YAAY,SAAS,MAAM,QAAQ,MAAM,MAAM,IAC3D,MAAM,SACN,WAAW,SAAS,MAAM,QAC1B,CAAC,MAAM,KAAK,IACZ,kBAAkB,sEAAsE;AAC3F,WACC,uBAAA,UAAA,EACE,UAAA;AAAA,MAAA,MAAM;AAAA,MACN,OAAO,IAAI,CAAC,OAAO,MAAM,uBAAC,cAAA,EAAqB,SAAH,GAAnB,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAA,MAAoC,CAAE;AAAA,IAAA,EAAA,GAFjE,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAGA;AAAA,EAEF;AAAA,EACA;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"If.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/If.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useMemo } from 'react'\nimport { Component, Field } from '../coreComponents'\nimport { EntityAccessor } from '@contember/binding'\nimport { QueryLanguage } from '@contember/binding'\nimport { useEntity, useEnvironment } from '../accessorPropagation'\nimport { Filter } from '@contember/binding'\nimport { FilterFieldsCollector } from './helpers/FilterFieldsCollector'\nimport { FilterEvaluator } from './helpers/FilterEvaluator'\n\nexport type IfProps =\n\t| IfFilterProps\n\t| IfCallbackProps\n\nexport interface IfFilterProps {\n\tcondition: string | Filter\n\tchildren?: ReactNode\n\tthen?: ReactNode\n\telse?: ReactNode\n}\n\nexport interface IfCallbackProps {\n\tcondition: (accessor: EntityAccessor) => boolean\n\tchildren?: ReactNode\n\tthen?: ReactNode\n\telse?: ReactNode\n}\n\n/**\n * @group Logic Components\n */\nexport const If = Component<IfProps>(({ condition, ...props }) => {\n\tif (props.children && props.then) {\n\t\tthrow new Error('If component cannot have both children and then prop')\n\t}\n\treturn typeof condition !== 'function'\n\t\t? <IfFilter condition={condition} {...props} />\n\t\t: <IfCallback condition={condition} {...props} />\n}, 'If')\n\nconst IfCallback = Component<IfCallbackProps>(\n\t({ children, condition, then, else: elseIn }) => {\n\t\tconst entity = useEntity()\n\t\tconst evaluated = useMemo(() => condition(entity), [condition, entity])\n\n\t\treturn <>{evaluated ? (children ?? then) : elseIn}</>\n\t},\n\t({ children, then, else: elseIn }) => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{children}\n\t\t\t\t{then}\n\t\t\t\t{elseIn}\n\t\t\t</>\n\t\t)\n\t},\n\t'IfCallback',\n)\n\nconst IfFilter = Component<IfFilterProps>(\n\t({ children, condition, then, else: elseIn }) => {\n\t\tconst env = useEnvironment()\n\t\tconst entity = useEntity()\n\n\t\tconst schema = env.getSchema()\n\t\tconst evaluated = useMemo(\n\t\t\t() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),\n\t\t\t[condition, entity, env, schema],\n\t\t)\n\t\treturn <>{evaluated ? (children ?? then) : elseIn}</>\n\t},\n\t({ children, condition, then, else: elseIn }, env) => {\n\t\tconst desugaredFilter = QueryLanguage.desugarFilter(condition, env)\n\t\tconst collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity)\n\t\tconst additionalFields = <>{Array.from(collectedFields).map(it => <Field field={it} key={it} />)}</>\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{additionalFields}\n\t\t\t\t{children}\n\t\t\t\t{then}\n\t\t\t\t{elseIn}\n\t\t\t</>\n\t\t)\n\t},\n\t'IfFilter',\n)\n"],"names":["Component","this","jsxDEV","useEntity","useMemo","Fragment","useEnvironment","FilterEvaluator","QueryLanguage","FilterFieldsCollector","Field"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"If.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/If.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useMemo } from 'react'\nimport { Component, Field } from '../coreComponents/index.js'\nimport { EntityAccessor } from '@contember/binding'\nimport { QueryLanguage } from '@contember/binding'\nimport { useEntity, useEnvironment } from '../accessorPropagation/index.js'\nimport { Filter } from '@contember/binding'\nimport { FilterFieldsCollector } from './helpers/FilterFieldsCollector.js'\nimport { FilterEvaluator } from './helpers/FilterEvaluator.js'\n\nexport type IfProps =\n\t| IfFilterProps\n\t| IfCallbackProps\n\nexport interface IfFilterProps {\n\tcondition: string | Filter\n\tchildren?: ReactNode\n\tthen?: ReactNode\n\telse?: ReactNode\n}\n\nexport interface IfCallbackProps {\n\tcondition: (accessor: EntityAccessor) => boolean\n\tchildren?: ReactNode\n\tthen?: ReactNode\n\telse?: ReactNode\n}\n\n/**\n * @group Logic Components\n */\nexport const If = Component<IfProps>(({ condition, ...props }) => {\n\tif (props.children && props.then) {\n\t\tthrow new Error('If component cannot have both children and then prop')\n\t}\n\treturn typeof condition !== 'function'\n\t\t? <IfFilter condition={condition} {...props} />\n\t\t: <IfCallback condition={condition} {...props} />\n}, 'If')\n\nconst IfCallback = Component<IfCallbackProps>(\n\t({ children, condition, then, else: elseIn }) => {\n\t\tconst entity = useEntity()\n\t\tconst evaluated = useMemo(() => condition(entity), [condition, entity])\n\n\t\treturn <>{evaluated ? (children ?? then) : elseIn}</>\n\t},\n\t({ children, then, else: elseIn }) => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{children}\n\t\t\t\t{then}\n\t\t\t\t{elseIn}\n\t\t\t</>\n\t\t)\n\t},\n\t'IfCallback',\n)\n\nconst IfFilter = Component<IfFilterProps>(\n\t({ children, condition, then, else: elseIn }) => {\n\t\tconst env = useEnvironment()\n\t\tconst entity = useEntity()\n\n\t\tconst schema = env.getSchema()\n\t\tconst evaluated = useMemo(\n\t\t\t() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),\n\t\t\t[condition, entity, env, schema],\n\t\t)\n\t\treturn <>{evaluated ? (children ?? then) : elseIn}</>\n\t},\n\t({ children, condition, then, else: elseIn }, env) => {\n\t\tconst desugaredFilter = QueryLanguage.desugarFilter(condition, env)\n\t\tconst collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity)\n\t\tconst additionalFields = <>{Array.from(collectedFields).map(it => <Field field={it} key={it} />)}</>\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{additionalFields}\n\t\t\t\t{children}\n\t\t\t\t{then}\n\t\t\t\t{elseIn}\n\t\t\t</>\n\t\t)\n\t},\n\t'IfFilter',\n)\n"],"names":["Component","this","jsxDEV","useEntity","useMemo","Fragment","useEnvironment","FilterEvaluator","QueryLanguage","FilterFieldsCollector","Field"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"If.js","sources":["../../../../../packages/react-binding/src/helperComponents/If.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useMemo } from 'react'\nimport { Component, Field } from '../coreComponents'\nimport { EntityAccessor } from '@contember/binding'\nimport { QueryLanguage } from '@contember/binding'\nimport { useEntity, useEnvironment } from '../accessorPropagation'\nimport { Filter } from '@contember/binding'\nimport { FilterFieldsCollector } from './helpers/FilterFieldsCollector'\nimport { FilterEvaluator } from './helpers/FilterEvaluator'\n\nexport type IfProps =\n\t| IfFilterProps\n\t| IfCallbackProps\n\nexport interface IfFilterProps {\n\tcondition: string | Filter\n\tchildren?: ReactNode\n\tthen?: ReactNode\n\telse?: ReactNode\n}\n\nexport interface IfCallbackProps {\n\tcondition: (accessor: EntityAccessor) => boolean\n\tchildren?: ReactNode\n\tthen?: ReactNode\n\telse?: ReactNode\n}\n\n/**\n * @group Logic Components\n */\nexport const If = Component<IfProps>(({ condition, ...props }) => {\n\tif (props.children && props.then) {\n\t\tthrow new Error('If component cannot have both children and then prop')\n\t}\n\treturn typeof condition !== 'function'\n\t\t? <IfFilter condition={condition} {...props} />\n\t\t: <IfCallback condition={condition} {...props} />\n}, 'If')\n\nconst IfCallback = Component<IfCallbackProps>(\n\t({ children, condition, then, else: elseIn }) => {\n\t\tconst entity = useEntity()\n\t\tconst evaluated = useMemo(() => condition(entity), [condition, entity])\n\n\t\treturn <>{evaluated ? (children ?? then) : elseIn}</>\n\t},\n\t({ children, then, else: elseIn }) => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{children}\n\t\t\t\t{then}\n\t\t\t\t{elseIn}\n\t\t\t</>\n\t\t)\n\t},\n\t'IfCallback',\n)\n\nconst IfFilter = Component<IfFilterProps>(\n\t({ children, condition, then, else: elseIn }) => {\n\t\tconst env = useEnvironment()\n\t\tconst entity = useEntity()\n\n\t\tconst schema = env.getSchema()\n\t\tconst evaluated = useMemo(\n\t\t\t() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),\n\t\t\t[condition, entity, env, schema],\n\t\t)\n\t\treturn <>{evaluated ? (children ?? then) : elseIn}</>\n\t},\n\t({ children, condition, then, else: elseIn }, env) => {\n\t\tconst desugaredFilter = QueryLanguage.desugarFilter(condition, env)\n\t\tconst collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity)\n\t\tconst additionalFields = <>{Array.from(collectedFields).map(it => <Field field={it} key={it} />)}</>\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{additionalFields}\n\t\t\t\t{children}\n\t\t\t\t{then}\n\t\t\t\t{elseIn}\n\t\t\t</>\n\t\t)\n\t},\n\t'IfFilter',\n)\n"],"names":["this"],"mappings":";;;;;;;;;AA+BO,MAAM,KAAK,UAAmB,CAAC,EAAE,WAAW,GAAG,YAAY;AACjE,MAAI,MAAM,YAAY,MAAM,MAAM;AACjC,UAAM,IAAI,MAAM,sDAAsD;AAAA,EACvE;AACA,SAAO,OAAO,cAAc,oCACxB,UAAA,EAAS,WAAuB,GAAG,MAAA,GAApC,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAA2C,IAC3C,uBAAC,YAAA,EAAW,WAAuB,GAAG,MAAA,GAAtC,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAA6C;AACjD,GAAG,IAAI;AAEP,MAAM,aAAa;AAAA,EAClB,CAAC,EAAE,UAAU,WAAW,MAAM,MAAM,aAAa;AAChD,UAAM,SAAS,UAAA;AACf,UAAM,YAAY,QAAQ,MAAM,UAAU,MAAM,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtE,WAAO,uBAAA,UAAA,EAAG,UAAA,YAAa,YAAY,OAAQ,OAAA,GAApC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAA2C;AAAA,EACnD;AAAA,EACA,CAAC,EAAE,UAAU,MAAM,MAAM,aAAa;AACrC,WACC,uBAAA,UAAA,EACE,UAAA;AAAA,MAAA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,EAAA,GAHF,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAIA;AAAA,EAEF;AAAA,EACA;AACD;AAEA,MAAM,WAAW;AAAA,EAChB,CAAC,EAAE,UAAU,WAAW,MAAM,MAAM,aAAa;AAChD,UAAM,MAAM,eAAA;AACZ,UAAM,SAAS,UAAA;AAEf,UAAM,SAAS,IAAI,UAAA;AACnB,UAAM,YAAY;AAAA,MACjB,MAAM,IAAI,gBAAgB,MAAM,EAAE,eAAe,QAAQ,cAAc,cAAc,WAAW,GAAG,CAAC;AAAA,MACpG,CAAC,WAAW,QAAQ,KAAK,MAAM;AAAA,IAAA;AAEhC,WAAO,uBAAA,UAAA,EAAG,UAAA,YAAa,YAAY,OAAQ,OAAA,GAApC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAA2C;AAAA,EACnD;AAAA,EACA,CAAC,EAAE,UAAU,WAAW,MAAM,MAAM,OAAA,GAAU,QAAQ;AACrD,UAAM,kBAAkB,cAAc,cAAc,WAAW,GAAG;AAClE,UAAM,kBAAkB,IAAI,sBAAsB,IAAI,UAAA,GAAa,eAAe,EAAE,cAAc,IAAI,eAAA,EAAiB,MAAM;AAC7H,UAAM,mBAAmB,uBAAA,UAAA,EAAG,UAAA,MAAM,KAAK,eAAe,EAAE,IAAI,CAAA,OAAM,uBAAC,OAAA,EAAM,OAAO,GAAA,GAAS,IAAvB,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAA2B,CAAE,KAAtE,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAAwE;AAEjG,WACC,uBAAA,UAAA,EACE,UAAA;AAAA,MAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,EAAA,GAJF,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAKA;AAAA,EAEF;AAAA,EACA;AACD;"}
|
|
1
|
+
{"version":3,"file":"If.js","sources":["../../../../../packages/react-binding/src/helperComponents/If.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useMemo } from 'react'\nimport { Component, Field } from '../coreComponents/index.js'\nimport { EntityAccessor } from '@contember/binding'\nimport { QueryLanguage } from '@contember/binding'\nimport { useEntity, useEnvironment } from '../accessorPropagation/index.js'\nimport { Filter } from '@contember/binding'\nimport { FilterFieldsCollector } from './helpers/FilterFieldsCollector.js'\nimport { FilterEvaluator } from './helpers/FilterEvaluator.js'\n\nexport type IfProps =\n\t| IfFilterProps\n\t| IfCallbackProps\n\nexport interface IfFilterProps {\n\tcondition: string | Filter\n\tchildren?: ReactNode\n\tthen?: ReactNode\n\telse?: ReactNode\n}\n\nexport interface IfCallbackProps {\n\tcondition: (accessor: EntityAccessor) => boolean\n\tchildren?: ReactNode\n\tthen?: ReactNode\n\telse?: ReactNode\n}\n\n/**\n * @group Logic Components\n */\nexport const If = Component<IfProps>(({ condition, ...props }) => {\n\tif (props.children && props.then) {\n\t\tthrow new Error('If component cannot have both children and then prop')\n\t}\n\treturn typeof condition !== 'function'\n\t\t? <IfFilter condition={condition} {...props} />\n\t\t: <IfCallback condition={condition} {...props} />\n}, 'If')\n\nconst IfCallback = Component<IfCallbackProps>(\n\t({ children, condition, then, else: elseIn }) => {\n\t\tconst entity = useEntity()\n\t\tconst evaluated = useMemo(() => condition(entity), [condition, entity])\n\n\t\treturn <>{evaluated ? (children ?? then) : elseIn}</>\n\t},\n\t({ children, then, else: elseIn }) => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{children}\n\t\t\t\t{then}\n\t\t\t\t{elseIn}\n\t\t\t</>\n\t\t)\n\t},\n\t'IfCallback',\n)\n\nconst IfFilter = Component<IfFilterProps>(\n\t({ children, condition, then, else: elseIn }) => {\n\t\tconst env = useEnvironment()\n\t\tconst entity = useEntity()\n\n\t\tconst schema = env.getSchema()\n\t\tconst evaluated = useMemo(\n\t\t\t() => new FilterEvaluator(schema).evaluateFilter(entity, QueryLanguage.desugarFilter(condition, env)),\n\t\t\t[condition, entity, env, schema],\n\t\t)\n\t\treturn <>{evaluated ? (children ?? then) : elseIn}</>\n\t},\n\t({ children, condition, then, else: elseIn }, env) => {\n\t\tconst desugaredFilter = QueryLanguage.desugarFilter(condition, env)\n\t\tconst collectedFields = new FilterFieldsCollector(env.getSchema(), desugaredFilter).collectFields(env.getSubTreeNode().entity)\n\t\tconst additionalFields = <>{Array.from(collectedFields).map(it => <Field field={it} key={it} />)}</>\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{additionalFields}\n\t\t\t\t{children}\n\t\t\t\t{then}\n\t\t\t\t{elseIn}\n\t\t\t</>\n\t\t)\n\t},\n\t'IfFilter',\n)\n"],"names":["this"],"mappings":";;;;;;;;;AA+BO,MAAM,KAAK,UAAmB,CAAC,EAAE,WAAW,GAAG,YAAY;AACjE,MAAI,MAAM,YAAY,MAAM,MAAM;AACjC,UAAM,IAAI,MAAM,sDAAsD;AAAA,EACvE;AACA,SAAO,OAAO,cAAc,oCACxB,UAAA,EAAS,WAAuB,GAAG,MAAA,GAApC,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAA2C,IAC3C,uBAAC,YAAA,EAAW,WAAuB,GAAG,MAAA,GAAtC,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAA6C;AACjD,GAAG,IAAI;AAEP,MAAM,aAAa;AAAA,EAClB,CAAC,EAAE,UAAU,WAAW,MAAM,MAAM,aAAa;AAChD,UAAM,SAAS,UAAA;AACf,UAAM,YAAY,QAAQ,MAAM,UAAU,MAAM,GAAG,CAAC,WAAW,MAAM,CAAC;AAEtE,WAAO,uBAAA,UAAA,EAAG,UAAA,YAAa,YAAY,OAAQ,OAAA,GAApC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAA2C;AAAA,EACnD;AAAA,EACA,CAAC,EAAE,UAAU,MAAM,MAAM,aAAa;AACrC,WACC,uBAAA,UAAA,EACE,UAAA;AAAA,MAAA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,EAAA,GAHF,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAIA;AAAA,EAEF;AAAA,EACA;AACD;AAEA,MAAM,WAAW;AAAA,EAChB,CAAC,EAAE,UAAU,WAAW,MAAM,MAAM,aAAa;AAChD,UAAM,MAAM,eAAA;AACZ,UAAM,SAAS,UAAA;AAEf,UAAM,SAAS,IAAI,UAAA;AACnB,UAAM,YAAY;AAAA,MACjB,MAAM,IAAI,gBAAgB,MAAM,EAAE,eAAe,QAAQ,cAAc,cAAc,WAAW,GAAG,CAAC;AAAA,MACpG,CAAC,WAAW,QAAQ,KAAK,MAAM;AAAA,IAAA;AAEhC,WAAO,uBAAA,UAAA,EAAG,UAAA,YAAa,YAAY,OAAQ,OAAA,GAApC,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAA2C;AAAA,EACnD;AAAA,EACA,CAAC,EAAE,UAAU,WAAW,MAAM,MAAM,OAAA,GAAU,QAAQ;AACrD,UAAM,kBAAkB,cAAc,cAAc,WAAW,GAAG;AAClE,UAAM,kBAAkB,IAAI,sBAAsB,IAAI,UAAA,GAAa,eAAe,EAAE,cAAc,IAAI,eAAA,EAAiB,MAAM;AAC7H,UAAM,mBAAmB,uBAAA,UAAA,EAAG,UAAA,MAAM,KAAK,eAAe,EAAE,IAAI,CAAA,OAAM,uBAAC,OAAA,EAAM,OAAO,GAAA,GAAS,IAAvB,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAA2B,CAAE,KAAtE,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAAwE;AAEjG,WACC,uBAAA,UAAA,EACE,UAAA;AAAA,MAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,EAAA,GAJF,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAKA;AAAA,EAEF;AAAA,EACA;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabelMiddleware.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/LabelMiddleware.tsx"],"sourcesContent":["import { createContext, ReactNode, useCallback, useContext } from 'react'\nimport { Environment } from '@contember/binding'\nimport { useEnvironment } from '../accessorPropagation'\n\nexport type LabelMiddleware = (label: ReactNode, environment: Environment) => ReactNode\n\nexport const LabelMiddlewareContext = createContext<LabelMiddleware>(it => it)\n\nexport const useLabelMiddleware = () => {\n\tconst env = useEnvironment()\n\tconst labelMiddleware = useContext(LabelMiddlewareContext)\n\treturn useCallback((it: ReactNode) => labelMiddleware(it, env), [env, labelMiddleware])\n}\n\nexport const LabelMiddlewareProvider = ({ value, children }: { value: LabelMiddleware; children: ReactNode }) => {\n\treturn (\n\t\t<LabelMiddlewareContext.Provider value={value}>\n\t\t\t{children}\n\t\t</LabelMiddlewareContext.Provider>\n\t)\n}\n"],"names":["createContext","useEnvironment","useContext","useCallback","jsxDEV","this"],"mappings":";;;;;AAMO,MAAM,yBAAyBA,MAAAA,cAA+B,CAAA,OAAM,EAAE;AAEtE,MAAM,qBAAqB,MAAM;AACvC,QAAM,MAAMC,eAAAA,eAAA;AACZ,QAAM,kBAAkBC,MAAAA,WAAW,sBAAsB;AACzD,SAAOC,MAAAA,YAAY,CAAC,OAAkB,gBAAgB,IAAI,GAAG,GAAG,CAAC,KAAK,eAAe,CAAC;AACvF;AAEO,MAAM,0BAA0B,CAAC,EAAE,OAAO,eAAgE;AAChH,SACCC,8BAAAA,OAAC,uBAAuB,UAAvB,EAAgC,OAC/B,SAAA,GADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA;AAEF;;;;"}
|
|
1
|
+
{"version":3,"file":"LabelMiddleware.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/LabelMiddleware.tsx"],"sourcesContent":["import { createContext, ReactNode, useCallback, useContext } from 'react'\nimport { Environment } from '@contember/binding'\nimport { useEnvironment } from '../accessorPropagation/index.js'\n\nexport type LabelMiddleware = (label: ReactNode, environment: Environment) => ReactNode\n\nexport const LabelMiddlewareContext = createContext<LabelMiddleware>(it => it)\n\nexport const useLabelMiddleware = () => {\n\tconst env = useEnvironment()\n\tconst labelMiddleware = useContext(LabelMiddlewareContext)\n\treturn useCallback((it: ReactNode) => labelMiddleware(it, env), [env, labelMiddleware])\n}\n\nexport const LabelMiddlewareProvider = ({ value, children }: { value: LabelMiddleware; children: ReactNode }) => {\n\treturn (\n\t\t<LabelMiddlewareContext.Provider value={value}>\n\t\t\t{children}\n\t\t</LabelMiddlewareContext.Provider>\n\t)\n}\n"],"names":["createContext","useEnvironment","useContext","useCallback","jsxDEV","this"],"mappings":";;;;;AAMO,MAAM,yBAAyBA,MAAAA,cAA+B,CAAA,OAAM,EAAE;AAEtE,MAAM,qBAAqB,MAAM;AACvC,QAAM,MAAMC,eAAAA,eAAA;AACZ,QAAM,kBAAkBC,MAAAA,WAAW,sBAAsB;AACzD,SAAOC,MAAAA,YAAY,CAAC,OAAkB,gBAAgB,IAAI,GAAG,GAAG,CAAC,KAAK,eAAe,CAAC;AACvF;AAEO,MAAM,0BAA0B,CAAC,EAAE,OAAO,eAAgE;AAChH,SACCC,8BAAAA,OAAC,uBAAuB,UAAvB,EAAgC,OAC/B,SAAA,GADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA;AAEF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabelMiddleware.js","sources":["../../../../../packages/react-binding/src/helperComponents/LabelMiddleware.tsx"],"sourcesContent":["import { createContext, ReactNode, useCallback, useContext } from 'react'\nimport { Environment } from '@contember/binding'\nimport { useEnvironment } from '../accessorPropagation'\n\nexport type LabelMiddleware = (label: ReactNode, environment: Environment) => ReactNode\n\nexport const LabelMiddlewareContext = createContext<LabelMiddleware>(it => it)\n\nexport const useLabelMiddleware = () => {\n\tconst env = useEnvironment()\n\tconst labelMiddleware = useContext(LabelMiddlewareContext)\n\treturn useCallback((it: ReactNode) => labelMiddleware(it, env), [env, labelMiddleware])\n}\n\nexport const LabelMiddlewareProvider = ({ value, children }: { value: LabelMiddleware; children: ReactNode }) => {\n\treturn (\n\t\t<LabelMiddlewareContext.Provider value={value}>\n\t\t\t{children}\n\t\t</LabelMiddlewareContext.Provider>\n\t)\n}\n"],"names":["this"],"mappings":";;;AAMO,MAAM,yBAAyB,cAA+B,CAAA,OAAM,EAAE;AAEtE,MAAM,qBAAqB,MAAM;AACvC,QAAM,MAAM,eAAA;AACZ,QAAM,kBAAkB,WAAW,sBAAsB;AACzD,SAAO,YAAY,CAAC,OAAkB,gBAAgB,IAAI,GAAG,GAAG,CAAC,KAAK,eAAe,CAAC;AACvF;AAEO,MAAM,0BAA0B,CAAC,EAAE,OAAO,eAAgE;AAChH,SACC,uBAAC,uBAAuB,UAAvB,EAAgC,OAC/B,SAAA,GADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA;AAEF;"}
|
|
1
|
+
{"version":3,"file":"LabelMiddleware.js","sources":["../../../../../packages/react-binding/src/helperComponents/LabelMiddleware.tsx"],"sourcesContent":["import { createContext, ReactNode, useCallback, useContext } from 'react'\nimport { Environment } from '@contember/binding'\nimport { useEnvironment } from '../accessorPropagation/index.js'\n\nexport type LabelMiddleware = (label: ReactNode, environment: Environment) => ReactNode\n\nexport const LabelMiddlewareContext = createContext<LabelMiddleware>(it => it)\n\nexport const useLabelMiddleware = () => {\n\tconst env = useEnvironment()\n\tconst labelMiddleware = useContext(LabelMiddlewareContext)\n\treturn useCallback((it: ReactNode) => labelMiddleware(it, env), [env, labelMiddleware])\n}\n\nexport const LabelMiddlewareProvider = ({ value, children }: { value: LabelMiddleware; children: ReactNode }) => {\n\treturn (\n\t\t<LabelMiddlewareContext.Provider value={value}>\n\t\t\t{children}\n\t\t</LabelMiddlewareContext.Provider>\n\t)\n}\n"],"names":["this"],"mappings":";;;AAMO,MAAM,yBAAyB,cAA+B,CAAA,OAAM,EAAE;AAEtE,MAAM,qBAAqB,MAAM;AACvC,QAAM,MAAM,eAAA;AACZ,QAAM,kBAAkB,WAAW,sBAAsB;AACzD,SAAO,YAAY,CAAC,OAAkB,gBAAgB,IAAI,GAAG,GAAG,CAAC,KAAK,eAAe,CAAC;AACvF;AAEO,MAAM,0BAA0B,CAAC,EAAE,OAAO,eAAgE;AAChH,SACC,uBAAC,uBAAuB,UAAvB,EAAgC,OAC/B,SAAA,GADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA;AAEF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecursionTerminator.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/RecursionTerminator.tsx"],"sourcesContent":["import { Environment, SugarableHasOneRelation, SugaredRelativeEntityList, SugaredRelativeSingleEntity, TokenRegExps } from '@contember/binding'\nimport { ReactNode, useMemo } from 'react'\nimport { Component } from '../coreComponents'\n\nexport interface RecursionTerminatorOptions {\n\tshouldTerminate?: (args: { node: Environment.AnyNode; field: string; environment: Environment }) => boolean | undefined\n}\n\nexport const recursionTerminatorEnvironmentExtension = Environment.createExtension((options: RecursionTerminatorOptions | undefined) => {\n\treturn options\n})\n\nexport interface RecursionTerminatorProps {\n\tfield:\n\t\t| { kind: 'hasOne'; field: SugaredRelativeSingleEntity['field'] }\n\t\t| { kind: 'hasMany'; field: SugaredRelativeEntityList['field'] }\n\tchildren: ReactNode\n}\n\nexport const RecursionTerminator = Component<RecursionTerminatorProps>(({ field, children }, env) => {\n\tconst isRecursion = useMemo(() => {\n\t\treturn recursionDetector(field, env)\n\t}, [field, env])\n\n\treturn !isRecursion ? children : null\n}, ({ field, children }, env) => {\n\tconst isRecursion = recursionDetector(field, env)\n\treturn !isRecursion ? children : null\n})\n\nconst recursionDetector = (field: RecursionTerminatorProps['field'], env: Environment) => {\n\tconst firstPathItem = getFirstPathItem(field)\n\tif (!firstPathItem) {\n\t\treturn false\n\t}\n\tconst shouldTerminate = env.getExtension(recursionTerminatorEnvironmentExtension)?.shouldTerminate\n\tconst shouldTerminateResult = shouldTerminate?.({ node: env.getSubTreeNode(), field: firstPathItem, environment: env })\n\tif (shouldTerminateResult !== undefined) {\n\t\treturn shouldTerminateResult\n\t}\n\n\tconst node = env.getSubTreeNode()\n\tconst otherSide = node.type === 'entity-list' || node.type === 'entity' ? (node.field.ownedBy ?? node.field.inversedBy) : undefined\n\tif (!otherSide) {\n\t\treturn false\n\t}\n\tif (!firstPathItem) {\n\t\treturn false\n\t}\n\treturn otherSide === firstPathItem\n}\n\nconst getFirstPathItem = (field: RecursionTerminatorProps['field']) => {\n\tif (typeof field.field === 'string') {\n\t\treturn field.field.match(TokenRegExps.identifier)?.[0]\n\t}\n\tconst getFromHasOne = (relation: SugarableHasOneRelation[] | SugarableHasOneRelation | undefined) => {\n\t\tif (Array.isArray(relation)) {\n\t\t\treturn relation?.[0].field\n\t\t}\n\t\treturn relation?.field\n\t}\n\tif (field.kind === 'hasMany') {\n\t\treturn getFromHasOne(field.field.hasOneRelationPath) ?? field.field.hasManyRelation.field\n\t}\n\treturn getFromHasOne(field.field)\n}\n"],"names":["Environment","Component","useMemo","TokenRegExps"],"mappings":";;;;;AAQO,MAAM,0CAA0CA,QAAAA,YAAY,gBAAgB,CAAC,YAAoD;AACvI,SAAO;AACR,CAAC;AASM,MAAM,sBAAsBC,UAAAA,UAAoC,CAAC,EAAE,OAAO,SAAA,GAAY,QAAQ;AACpG,QAAM,cAAcC,MAAAA,QAAQ,MAAM;AACjC,WAAO,kBAAkB,OAAO,GAAG;AAAA,EACpC,GAAG,CAAC,OAAO,GAAG,CAAC;AAEf,SAAO,CAAC,cAAc,WAAW;AAClC,GAAG,CAAC,EAAE,OAAO,SAAA,GAAY,QAAQ;AAChC,QAAM,cAAc,kBAAkB,OAAO,GAAG;AAChD,SAAO,CAAC,cAAc,WAAW;AAClC,CAAC;AAED,MAAM,oBAAoB,CAAC,OAA0C,QAAqB;AACzF,QAAM,gBAAgB,iBAAiB,KAAK;AAC5C,MAAI,CAAC,eAAe;AACnB,WAAO;AAAA,EACR;AACA,QAAM,kBAAkB,IAAI,aAAa,uCAAuC,GAAG;AACnF,QAAM,wBAAwB,kBAAkB,EAAE,MAAM,IAAI,eAAA,GAAkB,OAAO,eAAe,aAAa,IAAA,CAAK;AACtH,MAAI,0BAA0B,QAAW;AACxC,WAAO;AAAA,EACR;AAEA,QAAM,OAAO,IAAI,eAAA;AACjB,QAAM,YAAY,KAAK,SAAS,iBAAiB,KAAK,SAAS,WAAY,KAAK,MAAM,WAAW,KAAK,MAAM,aAAc;AAC1H,MAAI,CAAC,WAAW;AACf,WAAO;AAAA,EACR;AACA,MAAI,CAAC,eAAe;AACnB,WAAO;AAAA,EACR;AACA,SAAO,cAAc;AACtB;AAEA,MAAM,mBAAmB,CAAC,UAA6C;AACtE,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,WAAO,MAAM,MAAM,MAAMC,QAAAA,aAAa,UAAU,IAAI,CAAC;AAAA,EACtD;AACA,QAAM,gBAAgB,CAAC,aAA8E;AACpG,QAAI,MAAM,QAAQ,QAAQ,GAAG;AAC5B,aAAO,WAAW,CAAC,EAAE;AAAA,IACtB;AACA,WAAO,UAAU;AAAA,EAClB;AACA,MAAI,MAAM,SAAS,WAAW;AAC7B,WAAO,cAAc,MAAM,MAAM,kBAAkB,KAAK,MAAM,MAAM,gBAAgB;AAAA,EACrF;AACA,SAAO,cAAc,MAAM,KAAK;AACjC;;;"}
|
|
1
|
+
{"version":3,"file":"RecursionTerminator.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/RecursionTerminator.tsx"],"sourcesContent":["import { Environment, SugarableHasOneRelation, SugaredRelativeEntityList, SugaredRelativeSingleEntity, TokenRegExps } from '@contember/binding'\nimport { ReactNode, useMemo } from 'react'\nimport { Component } from '../coreComponents/index.js'\n\nexport interface RecursionTerminatorOptions {\n\tshouldTerminate?: (args: { node: Environment.AnyNode; field: string; environment: Environment }) => boolean | undefined\n}\n\nexport const recursionTerminatorEnvironmentExtension = Environment.createExtension((options: RecursionTerminatorOptions | undefined) => {\n\treturn options\n})\n\nexport interface RecursionTerminatorProps {\n\tfield:\n\t\t| { kind: 'hasOne'; field: SugaredRelativeSingleEntity['field'] }\n\t\t| { kind: 'hasMany'; field: SugaredRelativeEntityList['field'] }\n\tchildren: ReactNode\n}\n\nexport const RecursionTerminator = Component<RecursionTerminatorProps>(({ field, children }, env) => {\n\tconst isRecursion = useMemo(() => {\n\t\treturn recursionDetector(field, env)\n\t}, [field, env])\n\n\treturn !isRecursion ? children : null\n}, ({ field, children }, env) => {\n\tconst isRecursion = recursionDetector(field, env)\n\treturn !isRecursion ? children : null\n})\n\nconst recursionDetector = (field: RecursionTerminatorProps['field'], env: Environment) => {\n\tconst firstPathItem = getFirstPathItem(field)\n\tif (!firstPathItem) {\n\t\treturn false\n\t}\n\tconst shouldTerminate = env.getExtension(recursionTerminatorEnvironmentExtension)?.shouldTerminate\n\tconst shouldTerminateResult = shouldTerminate?.({ node: env.getSubTreeNode(), field: firstPathItem, environment: env })\n\tif (shouldTerminateResult !== undefined) {\n\t\treturn shouldTerminateResult\n\t}\n\n\tconst node = env.getSubTreeNode()\n\tconst otherSide = node.type === 'entity-list' || node.type === 'entity' ? (node.field.ownedBy ?? node.field.inversedBy) : undefined\n\tif (!otherSide) {\n\t\treturn false\n\t}\n\tif (!firstPathItem) {\n\t\treturn false\n\t}\n\treturn otherSide === firstPathItem\n}\n\nconst getFirstPathItem = (field: RecursionTerminatorProps['field']) => {\n\tif (typeof field.field === 'string') {\n\t\treturn field.field.match(TokenRegExps.identifier)?.[0]\n\t}\n\tconst getFromHasOne = (relation: SugarableHasOneRelation[] | SugarableHasOneRelation | undefined) => {\n\t\tif (Array.isArray(relation)) {\n\t\t\treturn relation?.[0].field\n\t\t}\n\t\treturn relation?.field\n\t}\n\tif (field.kind === 'hasMany') {\n\t\treturn getFromHasOne(field.field.hasOneRelationPath) ?? field.field.hasManyRelation.field\n\t}\n\treturn getFromHasOne(field.field)\n}\n"],"names":["Environment","Component","useMemo","TokenRegExps"],"mappings":";;;;;AAQO,MAAM,0CAA0CA,QAAAA,YAAY,gBAAgB,CAAC,YAAoD;AACvI,SAAO;AACR,CAAC;AASM,MAAM,sBAAsBC,UAAAA,UAAoC,CAAC,EAAE,OAAO,SAAA,GAAY,QAAQ;AACpG,QAAM,cAAcC,MAAAA,QAAQ,MAAM;AACjC,WAAO,kBAAkB,OAAO,GAAG;AAAA,EACpC,GAAG,CAAC,OAAO,GAAG,CAAC;AAEf,SAAO,CAAC,cAAc,WAAW;AAClC,GAAG,CAAC,EAAE,OAAO,SAAA,GAAY,QAAQ;AAChC,QAAM,cAAc,kBAAkB,OAAO,GAAG;AAChD,SAAO,CAAC,cAAc,WAAW;AAClC,CAAC;AAED,MAAM,oBAAoB,CAAC,OAA0C,QAAqB;AACzF,QAAM,gBAAgB,iBAAiB,KAAK;AAC5C,MAAI,CAAC,eAAe;AACnB,WAAO;AAAA,EACR;AACA,QAAM,kBAAkB,IAAI,aAAa,uCAAuC,GAAG;AACnF,QAAM,wBAAwB,kBAAkB,EAAE,MAAM,IAAI,eAAA,GAAkB,OAAO,eAAe,aAAa,IAAA,CAAK;AACtH,MAAI,0BAA0B,QAAW;AACxC,WAAO;AAAA,EACR;AAEA,QAAM,OAAO,IAAI,eAAA;AACjB,QAAM,YAAY,KAAK,SAAS,iBAAiB,KAAK,SAAS,WAAY,KAAK,MAAM,WAAW,KAAK,MAAM,aAAc;AAC1H,MAAI,CAAC,WAAW;AACf,WAAO;AAAA,EACR;AACA,MAAI,CAAC,eAAe;AACnB,WAAO;AAAA,EACR;AACA,SAAO,cAAc;AACtB;AAEA,MAAM,mBAAmB,CAAC,UAA6C;AACtE,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,WAAO,MAAM,MAAM,MAAMC,QAAAA,aAAa,UAAU,IAAI,CAAC;AAAA,EACtD;AACA,QAAM,gBAAgB,CAAC,aAA8E;AACpG,QAAI,MAAM,QAAQ,QAAQ,GAAG;AAC5B,aAAO,WAAW,CAAC,EAAE;AAAA,IACtB;AACA,WAAO,UAAU;AAAA,EAClB;AACA,MAAI,MAAM,SAAS,WAAW;AAC7B,WAAO,cAAc,MAAM,MAAM,kBAAkB,KAAK,MAAM,MAAM,gBAAgB;AAAA,EACrF;AACA,SAAO,cAAc,MAAM,KAAK;AACjC;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecursionTerminator.js","sources":["../../../../../packages/react-binding/src/helperComponents/RecursionTerminator.tsx"],"sourcesContent":["import { Environment, SugarableHasOneRelation, SugaredRelativeEntityList, SugaredRelativeSingleEntity, TokenRegExps } from '@contember/binding'\nimport { ReactNode, useMemo } from 'react'\nimport { Component } from '../coreComponents'\n\nexport interface RecursionTerminatorOptions {\n\tshouldTerminate?: (args: { node: Environment.AnyNode; field: string; environment: Environment }) => boolean | undefined\n}\n\nexport const recursionTerminatorEnvironmentExtension = Environment.createExtension((options: RecursionTerminatorOptions | undefined) => {\n\treturn options\n})\n\nexport interface RecursionTerminatorProps {\n\tfield:\n\t\t| { kind: 'hasOne'; field: SugaredRelativeSingleEntity['field'] }\n\t\t| { kind: 'hasMany'; field: SugaredRelativeEntityList['field'] }\n\tchildren: ReactNode\n}\n\nexport const RecursionTerminator = Component<RecursionTerminatorProps>(({ field, children }, env) => {\n\tconst isRecursion = useMemo(() => {\n\t\treturn recursionDetector(field, env)\n\t}, [field, env])\n\n\treturn !isRecursion ? children : null\n}, ({ field, children }, env) => {\n\tconst isRecursion = recursionDetector(field, env)\n\treturn !isRecursion ? children : null\n})\n\nconst recursionDetector = (field: RecursionTerminatorProps['field'], env: Environment) => {\n\tconst firstPathItem = getFirstPathItem(field)\n\tif (!firstPathItem) {\n\t\treturn false\n\t}\n\tconst shouldTerminate = env.getExtension(recursionTerminatorEnvironmentExtension)?.shouldTerminate\n\tconst shouldTerminateResult = shouldTerminate?.({ node: env.getSubTreeNode(), field: firstPathItem, environment: env })\n\tif (shouldTerminateResult !== undefined) {\n\t\treturn shouldTerminateResult\n\t}\n\n\tconst node = env.getSubTreeNode()\n\tconst otherSide = node.type === 'entity-list' || node.type === 'entity' ? (node.field.ownedBy ?? node.field.inversedBy) : undefined\n\tif (!otherSide) {\n\t\treturn false\n\t}\n\tif (!firstPathItem) {\n\t\treturn false\n\t}\n\treturn otherSide === firstPathItem\n}\n\nconst getFirstPathItem = (field: RecursionTerminatorProps['field']) => {\n\tif (typeof field.field === 'string') {\n\t\treturn field.field.match(TokenRegExps.identifier)?.[0]\n\t}\n\tconst getFromHasOne = (relation: SugarableHasOneRelation[] | SugarableHasOneRelation | undefined) => {\n\t\tif (Array.isArray(relation)) {\n\t\t\treturn relation?.[0].field\n\t\t}\n\t\treturn relation?.field\n\t}\n\tif (field.kind === 'hasMany') {\n\t\treturn getFromHasOne(field.field.hasOneRelationPath) ?? field.field.hasManyRelation.field\n\t}\n\treturn getFromHasOne(field.field)\n}\n"],"names":[],"mappings":";;;AAQO,MAAM,0CAA0C,YAAY,gBAAgB,CAAC,YAAoD;AACvI,SAAO;AACR,CAAC;AASM,MAAM,sBAAsB,UAAoC,CAAC,EAAE,OAAO,SAAA,GAAY,QAAQ;AACpG,QAAM,cAAc,QAAQ,MAAM;AACjC,WAAO,kBAAkB,OAAO,GAAG;AAAA,EACpC,GAAG,CAAC,OAAO,GAAG,CAAC;AAEf,SAAO,CAAC,cAAc,WAAW;AAClC,GAAG,CAAC,EAAE,OAAO,SAAA,GAAY,QAAQ;AAChC,QAAM,cAAc,kBAAkB,OAAO,GAAG;AAChD,SAAO,CAAC,cAAc,WAAW;AAClC,CAAC;AAED,MAAM,oBAAoB,CAAC,OAA0C,QAAqB;AACzF,QAAM,gBAAgB,iBAAiB,KAAK;AAC5C,MAAI,CAAC,eAAe;AACnB,WAAO;AAAA,EACR;AACA,QAAM,kBAAkB,IAAI,aAAa,uCAAuC,GAAG;AACnF,QAAM,wBAAwB,kBAAkB,EAAE,MAAM,IAAI,eAAA,GAAkB,OAAO,eAAe,aAAa,IAAA,CAAK;AACtH,MAAI,0BAA0B,QAAW;AACxC,WAAO;AAAA,EACR;AAEA,QAAM,OAAO,IAAI,eAAA;AACjB,QAAM,YAAY,KAAK,SAAS,iBAAiB,KAAK,SAAS,WAAY,KAAK,MAAM,WAAW,KAAK,MAAM,aAAc;AAC1H,MAAI,CAAC,WAAW;AACf,WAAO;AAAA,EACR;AACA,MAAI,CAAC,eAAe;AACnB,WAAO;AAAA,EACR;AACA,SAAO,cAAc;AACtB;AAEA,MAAM,mBAAmB,CAAC,UAA6C;AACtE,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,WAAO,MAAM,MAAM,MAAM,aAAa,UAAU,IAAI,CAAC;AAAA,EACtD;AACA,QAAM,gBAAgB,CAAC,aAA8E;AACpG,QAAI,MAAM,QAAQ,QAAQ,GAAG;AAC5B,aAAO,WAAW,CAAC,EAAE;AAAA,IACtB;AACA,WAAO,UAAU;AAAA,EAClB;AACA,MAAI,MAAM,SAAS,WAAW;AAC7B,WAAO,cAAc,MAAM,MAAM,kBAAkB,KAAK,MAAM,MAAM,gBAAgB;AAAA,EACrF;AACA,SAAO,cAAc,MAAM,KAAK;AACjC;"}
|
|
1
|
+
{"version":3,"file":"RecursionTerminator.js","sources":["../../../../../packages/react-binding/src/helperComponents/RecursionTerminator.tsx"],"sourcesContent":["import { Environment, SugarableHasOneRelation, SugaredRelativeEntityList, SugaredRelativeSingleEntity, TokenRegExps } from '@contember/binding'\nimport { ReactNode, useMemo } from 'react'\nimport { Component } from '../coreComponents/index.js'\n\nexport interface RecursionTerminatorOptions {\n\tshouldTerminate?: (args: { node: Environment.AnyNode; field: string; environment: Environment }) => boolean | undefined\n}\n\nexport const recursionTerminatorEnvironmentExtension = Environment.createExtension((options: RecursionTerminatorOptions | undefined) => {\n\treturn options\n})\n\nexport interface RecursionTerminatorProps {\n\tfield:\n\t\t| { kind: 'hasOne'; field: SugaredRelativeSingleEntity['field'] }\n\t\t| { kind: 'hasMany'; field: SugaredRelativeEntityList['field'] }\n\tchildren: ReactNode\n}\n\nexport const RecursionTerminator = Component<RecursionTerminatorProps>(({ field, children }, env) => {\n\tconst isRecursion = useMemo(() => {\n\t\treturn recursionDetector(field, env)\n\t}, [field, env])\n\n\treturn !isRecursion ? children : null\n}, ({ field, children }, env) => {\n\tconst isRecursion = recursionDetector(field, env)\n\treturn !isRecursion ? children : null\n})\n\nconst recursionDetector = (field: RecursionTerminatorProps['field'], env: Environment) => {\n\tconst firstPathItem = getFirstPathItem(field)\n\tif (!firstPathItem) {\n\t\treturn false\n\t}\n\tconst shouldTerminate = env.getExtension(recursionTerminatorEnvironmentExtension)?.shouldTerminate\n\tconst shouldTerminateResult = shouldTerminate?.({ node: env.getSubTreeNode(), field: firstPathItem, environment: env })\n\tif (shouldTerminateResult !== undefined) {\n\t\treturn shouldTerminateResult\n\t}\n\n\tconst node = env.getSubTreeNode()\n\tconst otherSide = node.type === 'entity-list' || node.type === 'entity' ? (node.field.ownedBy ?? node.field.inversedBy) : undefined\n\tif (!otherSide) {\n\t\treturn false\n\t}\n\tif (!firstPathItem) {\n\t\treturn false\n\t}\n\treturn otherSide === firstPathItem\n}\n\nconst getFirstPathItem = (field: RecursionTerminatorProps['field']) => {\n\tif (typeof field.field === 'string') {\n\t\treturn field.field.match(TokenRegExps.identifier)?.[0]\n\t}\n\tconst getFromHasOne = (relation: SugarableHasOneRelation[] | SugarableHasOneRelation | undefined) => {\n\t\tif (Array.isArray(relation)) {\n\t\t\treturn relation?.[0].field\n\t\t}\n\t\treturn relation?.field\n\t}\n\tif (field.kind === 'hasMany') {\n\t\treturn getFromHasOne(field.field.hasOneRelationPath) ?? field.field.hasManyRelation.field\n\t}\n\treturn getFromHasOne(field.field)\n}\n"],"names":[],"mappings":";;;AAQO,MAAM,0CAA0C,YAAY,gBAAgB,CAAC,YAAoD;AACvI,SAAO;AACR,CAAC;AASM,MAAM,sBAAsB,UAAoC,CAAC,EAAE,OAAO,SAAA,GAAY,QAAQ;AACpG,QAAM,cAAc,QAAQ,MAAM;AACjC,WAAO,kBAAkB,OAAO,GAAG;AAAA,EACpC,GAAG,CAAC,OAAO,GAAG,CAAC;AAEf,SAAO,CAAC,cAAc,WAAW;AAClC,GAAG,CAAC,EAAE,OAAO,SAAA,GAAY,QAAQ;AAChC,QAAM,cAAc,kBAAkB,OAAO,GAAG;AAChD,SAAO,CAAC,cAAc,WAAW;AAClC,CAAC;AAED,MAAM,oBAAoB,CAAC,OAA0C,QAAqB;AACzF,QAAM,gBAAgB,iBAAiB,KAAK;AAC5C,MAAI,CAAC,eAAe;AACnB,WAAO;AAAA,EACR;AACA,QAAM,kBAAkB,IAAI,aAAa,uCAAuC,GAAG;AACnF,QAAM,wBAAwB,kBAAkB,EAAE,MAAM,IAAI,eAAA,GAAkB,OAAO,eAAe,aAAa,IAAA,CAAK;AACtH,MAAI,0BAA0B,QAAW;AACxC,WAAO;AAAA,EACR;AAEA,QAAM,OAAO,IAAI,eAAA;AACjB,QAAM,YAAY,KAAK,SAAS,iBAAiB,KAAK,SAAS,WAAY,KAAK,MAAM,WAAW,KAAK,MAAM,aAAc;AAC1H,MAAI,CAAC,WAAW;AACf,WAAO;AAAA,EACR;AACA,MAAI,CAAC,eAAe;AACnB,WAAO;AAAA,EACR;AACA,SAAO,cAAc;AACtB;AAEA,MAAM,mBAAmB,CAAC,UAA6C;AACtE,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,WAAO,MAAM,MAAM,MAAM,aAAa,UAAU,IAAI,CAAC;AAAA,EACtD;AACA,QAAM,gBAAgB,CAAC,aAA8E;AACpG,QAAI,MAAM,QAAQ,QAAQ,GAAG;AAC5B,aAAO,WAAW,CAAC,EAAE;AAAA,IACtB;AACA,WAAO,UAAU;AAAA,EAClB;AACA,MAAI,MAAM,SAAS,WAAW;AAC7B,WAAO,cAAc,MAAM,MAAM,kBAAkB,KAAK,MAAM,MAAM,gBAAgB;AAAA,EACrF;AACA,SAAO,cAAc,MAAM,KAAK;AACjC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecursionTerminatorPortal.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/RecursionTerminatorPortal.tsx"],"sourcesContent":["import { BindingError, Environment, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from '../coreComponents'\nimport { recursionTerminatorEnvironmentExtension, RecursionTerminatorProps } from './RecursionTerminator'\nimport { EnvironmentMiddleware } from '../accessorPropagation'\n\nexport const RecursionTerminatorPortal = Component<RecursionTerminatorProps>(({ field, children }) => {\n\treturn <EnvironmentMiddleware args={[field]} create={createEnvWithExtension}>{children}</EnvironmentMiddleware>\n})\n\nconst createEnvWithExtension = (env: Environment, [{ field, kind }]: [field: RecursionTerminatorProps['field']]) => {\n\tconst envForField = kind === 'hasOne'\n\t\t? TreeNodeEnvironmentFactory.createEnvironmentForEntity(env, { field })\n\t\t: TreeNodeEnvironmentFactory.createEnvironmentForEntityList(env, { field })\n\n\tconst parentNode = envForField.getSubTreeNode()\n\tif (!(parentNode.type === 'entity-list' || parentNode.type === 'entity')) {\n\t\tthrow new BindingError()\n\t}\n\treturn env.withExtension(recursionTerminatorEnvironmentExtension, {\n\t\tshouldTerminate: args => {\n\t\t\tconst currentNode = args.node\n\t\t\tif (currentNode.type !== 'subtree-entity' || currentNode.entity.name !== parentNode.field.targetEntity) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst inverseField = parentNode.field.inversedBy ?? parentNode.field.ownedBy\n\t\t\tif (!inverseField) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn args.field === inverseField\n\t\t},\n\t})\n}\n"],"names":["Component","jsxDEV","EnvironmentMiddleware","this","TreeNodeEnvironmentFactory","BindingError","recursionTerminatorEnvironmentExtension"],"mappings":";;;;;;;AAKO,MAAM,4BAA4BA,UAAAA,UAAoC,CAAC,EAAE,OAAO,eAAe;AACrG,SAAOC,qCAACC,mBAAAA,yBAAsB,MAAM,CAAC,KAAK,GAAG,QAAQ,wBAAyB,YAAvE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAgF;AACxF,CAAC;AAED,MAAM,yBAAyB,CAAC,KAAkB,CAAC,EAAE,OAAO,KAAA,CAAM,MAAkD;AACnH,QAAM,cAAc,SAAS,WAC1BC,QAAAA,2BAA2B,2BAA2B,KAAK,EAAE,MAAA,CAAO,IACpEA,QAAAA,2BAA2B,+BAA+B,KAAK,EAAE,OAAO;AAE3E,QAAM,aAAa,YAAY,eAAA;AAC/B,MAAI,EAAE,WAAW,SAAS,iBAAiB,WAAW,SAAS,WAAW;AACzE,UAAM,IAAIC,QAAAA,aAAA;AAAA,EACX;AACA,SAAO,IAAI,cAAcC,6DAAyC;AAAA,IACjE,iBAAiB,CAAA,SAAQ;AACxB,YAAM,cAAc,KAAK;AACzB,UAAI,YAAY,SAAS,oBAAoB,YAAY,OAAO,SAAS,WAAW,MAAM,cAAc;AACvG,eAAO;AAAA,MACR;AACA,YAAM,eAAe,WAAW,MAAM,cAAc,WAAW,MAAM;AACrE,UAAI,CAAC,cAAc;AAClB,eAAO;AAAA,MACR;AACA,aAAO,KAAK,UAAU;AAAA,IACvB;AAAA,EAAA,CACA;AACF;;"}
|
|
1
|
+
{"version":3,"file":"RecursionTerminatorPortal.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/RecursionTerminatorPortal.tsx"],"sourcesContent":["import { BindingError, Environment, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from '../coreComponents/index.js'\nimport { recursionTerminatorEnvironmentExtension, RecursionTerminatorProps } from './RecursionTerminator.js'\nimport { EnvironmentMiddleware } from '../accessorPropagation/index.js'\n\nexport const RecursionTerminatorPortal = Component<RecursionTerminatorProps>(({ field, children }) => {\n\treturn <EnvironmentMiddleware args={[field]} create={createEnvWithExtension}>{children}</EnvironmentMiddleware>\n})\n\nconst createEnvWithExtension = (env: Environment, [{ field, kind }]: [field: RecursionTerminatorProps['field']]) => {\n\tconst envForField = kind === 'hasOne'\n\t\t? TreeNodeEnvironmentFactory.createEnvironmentForEntity(env, { field })\n\t\t: TreeNodeEnvironmentFactory.createEnvironmentForEntityList(env, { field })\n\n\tconst parentNode = envForField.getSubTreeNode()\n\tif (!(parentNode.type === 'entity-list' || parentNode.type === 'entity')) {\n\t\tthrow new BindingError()\n\t}\n\treturn env.withExtension(recursionTerminatorEnvironmentExtension, {\n\t\tshouldTerminate: args => {\n\t\t\tconst currentNode = args.node\n\t\t\tif (currentNode.type !== 'subtree-entity' || currentNode.entity.name !== parentNode.field.targetEntity) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst inverseField = parentNode.field.inversedBy ?? parentNode.field.ownedBy\n\t\t\tif (!inverseField) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn args.field === inverseField\n\t\t},\n\t})\n}\n"],"names":["Component","jsxDEV","EnvironmentMiddleware","this","TreeNodeEnvironmentFactory","BindingError","recursionTerminatorEnvironmentExtension"],"mappings":";;;;;;;AAKO,MAAM,4BAA4BA,UAAAA,UAAoC,CAAC,EAAE,OAAO,eAAe;AACrG,SAAOC,qCAACC,mBAAAA,yBAAsB,MAAM,CAAC,KAAK,GAAG,QAAQ,wBAAyB,YAAvE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAgF;AACxF,CAAC;AAED,MAAM,yBAAyB,CAAC,KAAkB,CAAC,EAAE,OAAO,KAAA,CAAM,MAAkD;AACnH,QAAM,cAAc,SAAS,WAC1BC,QAAAA,2BAA2B,2BAA2B,KAAK,EAAE,MAAA,CAAO,IACpEA,QAAAA,2BAA2B,+BAA+B,KAAK,EAAE,OAAO;AAE3E,QAAM,aAAa,YAAY,eAAA;AAC/B,MAAI,EAAE,WAAW,SAAS,iBAAiB,WAAW,SAAS,WAAW;AACzE,UAAM,IAAIC,QAAAA,aAAA;AAAA,EACX;AACA,SAAO,IAAI,cAAcC,6DAAyC;AAAA,IACjE,iBAAiB,CAAA,SAAQ;AACxB,YAAM,cAAc,KAAK;AACzB,UAAI,YAAY,SAAS,oBAAoB,YAAY,OAAO,SAAS,WAAW,MAAM,cAAc;AACvG,eAAO;AAAA,MACR;AACA,YAAM,eAAe,WAAW,MAAM,cAAc,WAAW,MAAM;AACrE,UAAI,CAAC,cAAc;AAClB,eAAO;AAAA,MACR;AACA,aAAO,KAAK,UAAU;AAAA,IACvB;AAAA,EAAA,CACA;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecursionTerminatorPortal.js","sources":["../../../../../packages/react-binding/src/helperComponents/RecursionTerminatorPortal.tsx"],"sourcesContent":["import { BindingError, Environment, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from '../coreComponents'\nimport { recursionTerminatorEnvironmentExtension, RecursionTerminatorProps } from './RecursionTerminator'\nimport { EnvironmentMiddleware } from '../accessorPropagation'\n\nexport const RecursionTerminatorPortal = Component<RecursionTerminatorProps>(({ field, children }) => {\n\treturn <EnvironmentMiddleware args={[field]} create={createEnvWithExtension}>{children}</EnvironmentMiddleware>\n})\n\nconst createEnvWithExtension = (env: Environment, [{ field, kind }]: [field: RecursionTerminatorProps['field']]) => {\n\tconst envForField = kind === 'hasOne'\n\t\t? TreeNodeEnvironmentFactory.createEnvironmentForEntity(env, { field })\n\t\t: TreeNodeEnvironmentFactory.createEnvironmentForEntityList(env, { field })\n\n\tconst parentNode = envForField.getSubTreeNode()\n\tif (!(parentNode.type === 'entity-list' || parentNode.type === 'entity')) {\n\t\tthrow new BindingError()\n\t}\n\treturn env.withExtension(recursionTerminatorEnvironmentExtension, {\n\t\tshouldTerminate: args => {\n\t\t\tconst currentNode = args.node\n\t\t\tif (currentNode.type !== 'subtree-entity' || currentNode.entity.name !== parentNode.field.targetEntity) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst inverseField = parentNode.field.inversedBy ?? parentNode.field.ownedBy\n\t\t\tif (!inverseField) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn args.field === inverseField\n\t\t},\n\t})\n}\n"],"names":["this"],"mappings":";;;;;AAKO,MAAM,4BAA4B,UAAoC,CAAC,EAAE,OAAO,eAAe;AACrG,SAAO,uBAAC,yBAAsB,MAAM,CAAC,KAAK,GAAG,QAAQ,wBAAyB,YAAvE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAgF;AACxF,CAAC;AAED,MAAM,yBAAyB,CAAC,KAAkB,CAAC,EAAE,OAAO,KAAA,CAAM,MAAkD;AACnH,QAAM,cAAc,SAAS,WAC1B,2BAA2B,2BAA2B,KAAK,EAAE,MAAA,CAAO,IACpE,2BAA2B,+BAA+B,KAAK,EAAE,OAAO;AAE3E,QAAM,aAAa,YAAY,eAAA;AAC/B,MAAI,EAAE,WAAW,SAAS,iBAAiB,WAAW,SAAS,WAAW;AACzE,UAAM,IAAI,aAAA;AAAA,EACX;AACA,SAAO,IAAI,cAAc,yCAAyC;AAAA,IACjE,iBAAiB,CAAA,SAAQ;AACxB,YAAM,cAAc,KAAK;AACzB,UAAI,YAAY,SAAS,oBAAoB,YAAY,OAAO,SAAS,WAAW,MAAM,cAAc;AACvG,eAAO;AAAA,MACR;AACA,YAAM,eAAe,WAAW,MAAM,cAAc,WAAW,MAAM;AACrE,UAAI,CAAC,cAAc;AAClB,eAAO;AAAA,MACR;AACA,aAAO,KAAK,UAAU;AAAA,IACvB;AAAA,EAAA,CACA;AACF;"}
|
|
1
|
+
{"version":3,"file":"RecursionTerminatorPortal.js","sources":["../../../../../packages/react-binding/src/helperComponents/RecursionTerminatorPortal.tsx"],"sourcesContent":["import { BindingError, Environment, TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { Component } from '../coreComponents/index.js'\nimport { recursionTerminatorEnvironmentExtension, RecursionTerminatorProps } from './RecursionTerminator.js'\nimport { EnvironmentMiddleware } from '../accessorPropagation/index.js'\n\nexport const RecursionTerminatorPortal = Component<RecursionTerminatorProps>(({ field, children }) => {\n\treturn <EnvironmentMiddleware args={[field]} create={createEnvWithExtension}>{children}</EnvironmentMiddleware>\n})\n\nconst createEnvWithExtension = (env: Environment, [{ field, kind }]: [field: RecursionTerminatorProps['field']]) => {\n\tconst envForField = kind === 'hasOne'\n\t\t? TreeNodeEnvironmentFactory.createEnvironmentForEntity(env, { field })\n\t\t: TreeNodeEnvironmentFactory.createEnvironmentForEntityList(env, { field })\n\n\tconst parentNode = envForField.getSubTreeNode()\n\tif (!(parentNode.type === 'entity-list' || parentNode.type === 'entity')) {\n\t\tthrow new BindingError()\n\t}\n\treturn env.withExtension(recursionTerminatorEnvironmentExtension, {\n\t\tshouldTerminate: args => {\n\t\t\tconst currentNode = args.node\n\t\t\tif (currentNode.type !== 'subtree-entity' || currentNode.entity.name !== parentNode.field.targetEntity) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst inverseField = parentNode.field.inversedBy ?? parentNode.field.ownedBy\n\t\t\tif (!inverseField) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn args.field === inverseField\n\t\t},\n\t})\n}\n"],"names":["this"],"mappings":";;;;;AAKO,MAAM,4BAA4B,UAAoC,CAAC,EAAE,OAAO,eAAe;AACrG,SAAO,uBAAC,yBAAsB,MAAM,CAAC,KAAK,GAAG,QAAQ,wBAAyB,YAAvE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAgF;AACxF,CAAC;AAED,MAAM,yBAAyB,CAAC,KAAkB,CAAC,EAAE,OAAO,KAAA,CAAM,MAAkD;AACnH,QAAM,cAAc,SAAS,WAC1B,2BAA2B,2BAA2B,KAAK,EAAE,MAAA,CAAO,IACpE,2BAA2B,+BAA+B,KAAK,EAAE,OAAO;AAE3E,QAAM,aAAa,YAAY,eAAA;AAC/B,MAAI,EAAE,WAAW,SAAS,iBAAiB,WAAW,SAAS,WAAW;AACzE,UAAM,IAAI,aAAA;AAAA,EACX;AACA,SAAO,IAAI,cAAc,yCAAyC;AAAA,IACjE,iBAAiB,CAAA,SAAQ;AACxB,YAAM,cAAc,KAAK;AACzB,UAAI,YAAY,SAAS,oBAAoB,YAAY,OAAO,SAAS,WAAW,MAAM,cAAc;AACvG,eAAO;AAAA,MACR;AACA,YAAM,eAAe,WAAW,MAAM,cAAc,WAAW,MAAM;AACrE,UAAI,CAAC,cAAc;AAClB,eAAO;AAAA,MACR;AACA,aAAO,KAAK,UAAU;AAAA,IACvB;AAAA,EAAA,CACA;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticRender.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/StaticRender.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Component } from '../coreComponents'\n\nexport interface StaticRenderProps {\n\tchildren?: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const StaticRender = Component<StaticRenderProps>(\n\t() => null,\n\t({ children }) => <>{children}</>,\n\t'StaticRender',\n)\n"],"names":["Component","this"],"mappings":";;;;AAUO,MAAM,eAAeA,UAAAA;AAAAA,EAC3B,MAAM;AAAA,EACN,CAAC,EAAE,SAAA,qEAAkB,SAAA,GAAH,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAY;AAAA,EAC9B;AACD;;"}
|
|
1
|
+
{"version":3,"file":"StaticRender.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/StaticRender.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Component } from '../coreComponents/index.js'\n\nexport interface StaticRenderProps {\n\tchildren?: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const StaticRender = Component<StaticRenderProps>(\n\t() => null,\n\t({ children }) => <>{children}</>,\n\t'StaticRender',\n)\n"],"names":["Component","this"],"mappings":";;;;AAUO,MAAM,eAAeA,UAAAA;AAAAA,EAC3B,MAAM;AAAA,EACN,CAAC,EAAE,SAAA,qEAAkB,SAAA,GAAH,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAY;AAAA,EAC9B;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticRender.js","sources":["../../../../../packages/react-binding/src/helperComponents/StaticRender.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Component } from '../coreComponents'\n\nexport interface StaticRenderProps {\n\tchildren?: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const StaticRender = Component<StaticRenderProps>(\n\t() => null,\n\t({ children }) => <>{children}</>,\n\t'StaticRender',\n)\n"],"names":["this"],"mappings":";;AAUO,MAAM,eAAe;AAAA,EAC3B,MAAM;AAAA,EACN,CAAC,EAAE,SAAA,yCAAkB,SAAA,GAAH,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAY;AAAA,EAC9B;AACD;"}
|
|
1
|
+
{"version":3,"file":"StaticRender.js","sources":["../../../../../packages/react-binding/src/helperComponents/StaticRender.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { Component } from '../coreComponents/index.js'\n\nexport interface StaticRenderProps {\n\tchildren?: ReactNode\n}\n\n/**\n * @group Data binding\n */\nexport const StaticRender = Component<StaticRenderProps>(\n\t() => null,\n\t({ children }) => <>{children}</>,\n\t'StaticRender',\n)\n"],"names":["this"],"mappings":";;AAUO,MAAM,eAAe;AAAA,EAC3B,MAAM;AAAA,EACN,CAAC,EAAE,SAAA,yCAAkB,SAAA,GAAH,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAY;AAAA,EAC9B;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SugaredField.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '@contember/binding'\nimport { FieldValue } from '@contember/binding'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\n/**\n * @group Data binding\n */\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":["Component","Field","this"],"mappings":";;;;;AAYO,MAAM,eAAeA,UAAAA,UAAU,CAA4C,UAAwC;AACzH,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,gDAAQC,aAAA,EAAO,GAAG,OAAO,OAAO,MAAM,MAAA,GAA/B,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAC,MAAsC;AAAA,EAC9C;AACA,8CAAQD,aAAA,EAAO,GAAG,OAAQ,GAAG,MAAM,MAAA,GAA5B,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAmC;AAC3C,GAAG,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"SugaredField.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents/index.js'\nimport type { SugaredRelativeSingleField } from '@contember/binding'\nimport { FieldValue } from '@contember/binding'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\n/**\n * @group Data binding\n */\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":["Component","Field","this"],"mappings":";;;;;AAYO,MAAM,eAAeA,UAAAA,UAAU,CAA4C,UAAwC;AACzH,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,gDAAQC,aAAA,EAAO,GAAG,OAAO,OAAO,MAAM,MAAA,GAA/B,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAC,MAAsC;AAAA,EAC9C;AACA,8CAAQD,aAAA,EAAO,GAAG,OAAQ,GAAG,MAAM,MAAA,GAA5B,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAmC;AAC3C,GAAG,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SugaredField.js","sources":["../../../../../packages/react-binding/src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents'\nimport type { SugaredRelativeSingleField } from '@contember/binding'\nimport { FieldValue } from '@contember/binding'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\n/**\n * @group Data binding\n */\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":["this"],"mappings":";;;AAYO,MAAM,eAAe,UAAU,CAA4C,UAAwC;AACzH,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,kCAAQ,OAAA,EAAO,GAAG,OAAO,OAAO,MAAM,MAAA,GAA/B,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAAsC;AAAA,EAC9C;AACA,gCAAQ,OAAA,EAAO,GAAG,OAAQ,GAAG,MAAM,MAAA,GAA5B,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAmC;AAC3C,GAAG,cAAc;"}
|
|
1
|
+
{"version":3,"file":"SugaredField.js","sources":["../../../../../packages/react-binding/src/helperComponents/SugaredField.tsx"],"sourcesContent":["import { Component, Field, FieldProps } from '../coreComponents/index.js'\nimport type { SugaredRelativeSingleField } from '@contember/binding'\nimport { FieldValue } from '@contember/binding'\nimport { ReactElement } from 'react'\n\nexport interface SugaredFieldProps<Persisted extends FieldValue = FieldValue> extends Omit<FieldProps<Persisted>, 'field'> {\n\tfield: string | SugaredRelativeSingleField\n}\n\n/**\n * @group Data binding\n */\nexport const SugaredField = Component(<Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => {\n\tif (typeof props.field === 'string') {\n\t\treturn <Field {...props} field={props.field} />\n\t}\n\treturn <Field {...props} {...props.field} />\n}, 'SugaredField') as <Persisted extends FieldValue = FieldValue>(props: SugaredFieldProps<Persisted>) => ReactElement\n"],"names":["this"],"mappings":";;;AAYO,MAAM,eAAe,UAAU,CAA4C,UAAwC;AACzH,MAAI,OAAO,MAAM,UAAU,UAAU;AACpC,kCAAQ,OAAA,EAAO,GAAG,OAAO,OAAO,MAAM,MAAA,GAA/B,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAAsC;AAAA,EAC9C;AACA,gCAAQ,OAAA,EAAO,GAAG,OAAQ,GAAG,MAAM,MAAA,GAA5B,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAmC;AAC3C,GAAG,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Variable.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/Variable.tsx"],"sourcesContent":["import { Environment } from '@contember/binding'\nimport { memo, ReactElement, ReactNode, useMemo } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\n\nexport interface VariableProps {\n\tname: Environment.Name\n\tformat?: (value: ReactNode) => ReactNode\n}\n\nexport const Variable = memo(({ name, format }: VariableProps): ReactElement => {\n\tconst environment = useEnvironment()\n\tconst value = environment.getVariableOrElse<undefined, ReactNode & Environment.Value>(name, undefined) ?? environment.getParameter(name)\n\n\tconst formatted = useMemo(() => (format ? format(value) : value), [format, value])\n\n\treturn <>{formatted}</>\n})\nVariable.displayName = 'Variable'\n"],"names":["memo","useEnvironment","useMemo","this"],"mappings":";;;;;AASO,MAAM,WAAWA,MAAAA,KAAK,CAAC,EAAE,MAAM,aAA0C;AAC/E,QAAM,cAAcC,eAAAA,eAAA;AACpB,QAAM,QAAQ,YAAY,kBAA4D,MAAM,MAAS,KAAK,YAAY,aAAa,IAAI;AAEvI,QAAM,YAAYC,MAAAA,QAAQ,MAAO,SAAS,OAAO,KAAK,IAAI,OAAQ,CAAC,QAAQ,KAAK,CAAC;AAEjF,wEAAU,UAAA,UAAA,GAAH,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAa;AACrB,CAAC;AACD,SAAS,cAAc;;"}
|
|
1
|
+
{"version":3,"file":"Variable.cjs","sources":["../../../../../packages/react-binding/src/helperComponents/Variable.tsx"],"sourcesContent":["import { Environment } from '@contember/binding'\nimport { memo, ReactElement, ReactNode, useMemo } from 'react'\nimport { useEnvironment } from '../accessorPropagation/index.js'\n\nexport interface VariableProps {\n\tname: Environment.Name\n\tformat?: (value: ReactNode) => ReactNode\n}\n\nexport const Variable = memo(({ name, format }: VariableProps): ReactElement => {\n\tconst environment = useEnvironment()\n\tconst value = environment.getVariableOrElse<undefined, ReactNode & Environment.Value>(name, undefined) ?? environment.getParameter(name)\n\n\tconst formatted = useMemo(() => (format ? format(value) : value), [format, value])\n\n\treturn <>{formatted}</>\n})\nVariable.displayName = 'Variable'\n"],"names":["memo","useEnvironment","useMemo","this"],"mappings":";;;;;AASO,MAAM,WAAWA,MAAAA,KAAK,CAAC,EAAE,MAAM,aAA0C;AAC/E,QAAM,cAAcC,eAAAA,eAAA;AACpB,QAAM,QAAQ,YAAY,kBAA4D,MAAM,MAAS,KAAK,YAAY,aAAa,IAAI;AAEvI,QAAM,YAAYC,MAAAA,QAAQ,MAAO,SAAS,OAAO,KAAK,IAAI,OAAQ,CAAC,QAAQ,KAAK,CAAC;AAEjF,wEAAU,UAAA,UAAA,GAAH,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAa;AACrB,CAAC;AACD,SAAS,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Variable.js","sources":["../../../../../packages/react-binding/src/helperComponents/Variable.tsx"],"sourcesContent":["import { Environment } from '@contember/binding'\nimport { memo, ReactElement, ReactNode, useMemo } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\n\nexport interface VariableProps {\n\tname: Environment.Name\n\tformat?: (value: ReactNode) => ReactNode\n}\n\nexport const Variable = memo(({ name, format }: VariableProps): ReactElement => {\n\tconst environment = useEnvironment()\n\tconst value = environment.getVariableOrElse<undefined, ReactNode & Environment.Value>(name, undefined) ?? environment.getParameter(name)\n\n\tconst formatted = useMemo(() => (format ? format(value) : value), [format, value])\n\n\treturn <>{formatted}</>\n})\nVariable.displayName = 'Variable'\n"],"names":["this"],"mappings":";;;AASO,MAAM,WAAW,KAAK,CAAC,EAAE,MAAM,aAA0C;AAC/E,QAAM,cAAc,eAAA;AACpB,QAAM,QAAQ,YAAY,kBAA4D,MAAM,MAAS,KAAK,YAAY,aAAa,IAAI;AAEvI,QAAM,YAAY,QAAQ,MAAO,SAAS,OAAO,KAAK,IAAI,OAAQ,CAAC,QAAQ,KAAK,CAAC;AAEjF,4CAAU,UAAA,UAAA,GAAH,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAa;AACrB,CAAC;AACD,SAAS,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Variable.js","sources":["../../../../../packages/react-binding/src/helperComponents/Variable.tsx"],"sourcesContent":["import { Environment } from '@contember/binding'\nimport { memo, ReactElement, ReactNode, useMemo } from 'react'\nimport { useEnvironment } from '../accessorPropagation/index.js'\n\nexport interface VariableProps {\n\tname: Environment.Name\n\tformat?: (value: ReactNode) => ReactNode\n}\n\nexport const Variable = memo(({ name, format }: VariableProps): ReactElement => {\n\tconst environment = useEnvironment()\n\tconst value = environment.getVariableOrElse<undefined, ReactNode & Environment.Value>(name, undefined) ?? environment.getParameter(name)\n\n\tconst formatted = useMemo(() => (format ? format(value) : value), [format, value])\n\n\treturn <>{formatted}</>\n})\nVariable.displayName = 'Variable'\n"],"names":["this"],"mappings":";;;AASO,MAAM,WAAW,KAAK,CAAC,EAAE,MAAM,aAA0C;AAC/E,QAAM,cAAc,eAAA;AACpB,QAAM,QAAQ,YAAY,kBAA4D,MAAM,MAAS,KAAK,YAAY,aAAa,IAAI;AAEvI,QAAM,YAAY,QAAQ,MAAO,SAAS,OAAO,KAAK,IAAI,OAAQ,CAAC,QAAQ,KAAK,CAAC;AAEjF,4CAAU,UAAA,UAAA,GAAH,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAAa;AACrB,CAAC;AACD,SAAS,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterEvaluator.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/FilterEvaluator.ts"],"sourcesContent":["import { Schema } from '@contember/binding'\nimport { Input } from '@contember/client'\nimport { EntityAccessor } from '@contember/binding'\nimport { Filter } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\nimport { evaluateCondition } from './evaluateCondition'\n\nexport class FilterEvaluator {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t) {\n\t}\n\n\tevaluateFilter(entity: EntityAccessor, filter: Filter): boolean {\n\t\tconst entitySchema = this.schema.getEntity(entity.name)\n\n\t\tlet acc = true\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tconst operation = key === 'and' ? 'every' : 'some' as const\n\t\t\t\tacc &&= value[operation](it => this.evaluateFilter(entity, it))\n\t\t\t} else if (key === 'not') {\n\t\t\t\tacc &&= !this.evaluateFilter(entity, value as Filter)\n\t\t\t} else {\n\t\t\t\tconst field = entitySchema.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tacc &&= evaluateCondition(entity.getField(key).value, value as Input.Condition)\n\t\t\t\t} else {\n\t\t\t\t\tacc &&= this.evaluateFilter(entity.getEntity(key), value as Filter)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn acc\n\t}\n}\n"],"names":["BindingError","evaluateCondition"],"mappings":";;;;AAOO,MAAM,gBAAgB;AAAA,EAC5B,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,eAAe,QAAwB,QAAyB;AAC/D,UAAM,eAAe,KAAK,OAAO,UAAU,OAAO,IAAI;AAEtD,QAAI,MAAM;AACV,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAClD,UAAI,QAAQ,SAAS,QAAQ,MAAM;AAClC,YAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,gBAAM,IAAIA,QAAAA,aAAA;AAAA,QACX;AAEA,cAAM,YAAY,QAAQ,QAAQ,UAAU;AAC5C,gBAAA,MAAQ,MAAM,SAAS,EAAE,CAAA,OAAM,KAAK,eAAe,QAAQ,EAAE,CAAC;AAAA,MAC/D,WAAW,QAAQ,OAAO;AACzB,gBAAA,MAAQ,CAAC,KAAK,eAAe,QAAQ,KAAe;AAAA,MACrD,OAAO;AACN,cAAM,QAAQ,aAAa,OAAO,IAAI,GAAG;AACzC,YAAI,CAAC,OAAO;AACX,gBAAM,IAAIA,QAAAA,aAAA;AAAA,QACX;AAEA,YAAI,MAAM,eAAe,WAAW;AACnC,kBAAA,MAAQC,kBAAAA,kBAAkB,OAAO,SAAS,GAAG,EAAE,OAAO,KAAwB;AAAA,QAC/E,OAAO;AACN,kBAAA,MAAQ,KAAK,eAAe,OAAO,UAAU,GAAG,GAAG,KAAe;AAAA,QACnE;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR;AACD;;"}
|
|
1
|
+
{"version":3,"file":"FilterEvaluator.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/FilterEvaluator.ts"],"sourcesContent":["import { Schema } from '@contember/binding'\nimport { Input } from '@contember/client'\nimport { EntityAccessor } from '@contember/binding'\nimport { Filter } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\nimport { evaluateCondition } from './evaluateCondition.js'\n\nexport class FilterEvaluator {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t) {\n\t}\n\n\tevaluateFilter(entity: EntityAccessor, filter: Filter): boolean {\n\t\tconst entitySchema = this.schema.getEntity(entity.name)\n\n\t\tlet acc = true\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tconst operation = key === 'and' ? 'every' : 'some' as const\n\t\t\t\tacc &&= value[operation](it => this.evaluateFilter(entity, it))\n\t\t\t} else if (key === 'not') {\n\t\t\t\tacc &&= !this.evaluateFilter(entity, value as Filter)\n\t\t\t} else {\n\t\t\t\tconst field = entitySchema.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tacc &&= evaluateCondition(entity.getField(key).value, value as Input.Condition)\n\t\t\t\t} else {\n\t\t\t\t\tacc &&= this.evaluateFilter(entity.getEntity(key), value as Filter)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn acc\n\t}\n}\n"],"names":["BindingError","evaluateCondition"],"mappings":";;;;AAOO,MAAM,gBAAgB;AAAA,EAC5B,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,eAAe,QAAwB,QAAyB;AAC/D,UAAM,eAAe,KAAK,OAAO,UAAU,OAAO,IAAI;AAEtD,QAAI,MAAM;AACV,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAClD,UAAI,QAAQ,SAAS,QAAQ,MAAM;AAClC,YAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,gBAAM,IAAIA,QAAAA,aAAA;AAAA,QACX;AAEA,cAAM,YAAY,QAAQ,QAAQ,UAAU;AAC5C,gBAAA,MAAQ,MAAM,SAAS,EAAE,CAAA,OAAM,KAAK,eAAe,QAAQ,EAAE,CAAC;AAAA,MAC/D,WAAW,QAAQ,OAAO;AACzB,gBAAA,MAAQ,CAAC,KAAK,eAAe,QAAQ,KAAe;AAAA,MACrD,OAAO;AACN,cAAM,QAAQ,aAAa,OAAO,IAAI,GAAG;AACzC,YAAI,CAAC,OAAO;AACX,gBAAM,IAAIA,QAAAA,aAAA;AAAA,QACX;AAEA,YAAI,MAAM,eAAe,WAAW;AACnC,kBAAA,MAAQC,kBAAAA,kBAAkB,OAAO,SAAS,GAAG,EAAE,OAAO,KAAwB;AAAA,QAC/E,OAAO;AACN,kBAAA,MAAQ,KAAK,eAAe,OAAO,UAAU,GAAG,GAAG,KAAe;AAAA,QACnE;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterEvaluator.js","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/FilterEvaluator.ts"],"sourcesContent":["import { Schema } from '@contember/binding'\nimport { Input } from '@contember/client'\nimport { EntityAccessor } from '@contember/binding'\nimport { Filter } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\nimport { evaluateCondition } from './evaluateCondition'\n\nexport class FilterEvaluator {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t) {\n\t}\n\n\tevaluateFilter(entity: EntityAccessor, filter: Filter): boolean {\n\t\tconst entitySchema = this.schema.getEntity(entity.name)\n\n\t\tlet acc = true\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tconst operation = key === 'and' ? 'every' : 'some' as const\n\t\t\t\tacc &&= value[operation](it => this.evaluateFilter(entity, it))\n\t\t\t} else if (key === 'not') {\n\t\t\t\tacc &&= !this.evaluateFilter(entity, value as Filter)\n\t\t\t} else {\n\t\t\t\tconst field = entitySchema.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tacc &&= evaluateCondition(entity.getField(key).value, value as Input.Condition)\n\t\t\t\t} else {\n\t\t\t\t\tacc &&= this.evaluateFilter(entity.getEntity(key), value as Filter)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn acc\n\t}\n}\n"],"names":[],"mappings":";;AAOO,MAAM,gBAAgB;AAAA,EAC5B,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,eAAe,QAAwB,QAAyB;AAC/D,UAAM,eAAe,KAAK,OAAO,UAAU,OAAO,IAAI;AAEtD,QAAI,MAAM;AACV,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAClD,UAAI,QAAQ,SAAS,QAAQ,MAAM;AAClC,YAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,gBAAM,IAAI,aAAA;AAAA,QACX;AAEA,cAAM,YAAY,QAAQ,QAAQ,UAAU;AAC5C,gBAAA,MAAQ,MAAM,SAAS,EAAE,CAAA,OAAM,KAAK,eAAe,QAAQ,EAAE,CAAC;AAAA,MAC/D,WAAW,QAAQ,OAAO;AACzB,gBAAA,MAAQ,CAAC,KAAK,eAAe,QAAQ,KAAe;AAAA,MACrD,OAAO;AACN,cAAM,QAAQ,aAAa,OAAO,IAAI,GAAG;AACzC,YAAI,CAAC,OAAO;AACX,gBAAM,IAAI,aAAA;AAAA,QACX;AAEA,YAAI,MAAM,eAAe,WAAW;AACnC,kBAAA,MAAQ,kBAAkB,OAAO,SAAS,GAAG,EAAE,OAAO,KAAwB;AAAA,QAC/E,OAAO;AACN,kBAAA,MAAQ,KAAK,eAAe,OAAO,UAAU,GAAG,GAAG,KAAe;AAAA,QACnE;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR;AACD;"}
|
|
1
|
+
{"version":3,"file":"FilterEvaluator.js","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/FilterEvaluator.ts"],"sourcesContent":["import { Schema } from '@contember/binding'\nimport { Input } from '@contember/client'\nimport { EntityAccessor } from '@contember/binding'\nimport { Filter } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\nimport { evaluateCondition } from './evaluateCondition.js'\n\nexport class FilterEvaluator {\n\tconstructor(\n\t\tprivate readonly schema: Schema,\n\t) {\n\t}\n\n\tevaluateFilter(entity: EntityAccessor, filter: Filter): boolean {\n\t\tconst entitySchema = this.schema.getEntity(entity.name)\n\n\t\tlet acc = true\n\t\tfor (const [key, value] of Object.entries(filter)) {\n\t\t\tif (key === 'and' || key === 'or') {\n\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tconst operation = key === 'and' ? 'every' : 'some' as const\n\t\t\t\tacc &&= value[operation](it => this.evaluateFilter(entity, it))\n\t\t\t} else if (key === 'not') {\n\t\t\t\tacc &&= !this.evaluateFilter(entity, value as Filter)\n\t\t\t} else {\n\t\t\t\tconst field = entitySchema.fields.get(key)\n\t\t\t\tif (!field) {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\n\t\t\t\tif (field.__typename === '_Column') {\n\t\t\t\t\tacc &&= evaluateCondition(entity.getField(key).value, value as Input.Condition)\n\t\t\t\t} else {\n\t\t\t\t\tacc &&= this.evaluateFilter(entity.getEntity(key), value as Filter)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn acc\n\t}\n}\n"],"names":[],"mappings":";;AAOO,MAAM,gBAAgB;AAAA,EAC5B,YACkB,QAChB;AADgB,SAAA,SAAA;AAAA,EAElB;AAAA,EAEA,eAAe,QAAwB,QAAyB;AAC/D,UAAM,eAAe,KAAK,OAAO,UAAU,OAAO,IAAI;AAEtD,QAAI,MAAM;AACV,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AAClD,UAAI,QAAQ,SAAS,QAAQ,MAAM;AAClC,YAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,gBAAM,IAAI,aAAA;AAAA,QACX;AAEA,cAAM,YAAY,QAAQ,QAAQ,UAAU;AAC5C,gBAAA,MAAQ,MAAM,SAAS,EAAE,CAAA,OAAM,KAAK,eAAe,QAAQ,EAAE,CAAC;AAAA,MAC/D,WAAW,QAAQ,OAAO;AACzB,gBAAA,MAAQ,CAAC,KAAK,eAAe,QAAQ,KAAe;AAAA,MACrD,OAAO;AACN,cAAM,QAAQ,aAAa,OAAO,IAAI,GAAG;AACzC,YAAI,CAAC,OAAO;AACX,gBAAM,IAAI,aAAA;AAAA,QACX;AAEA,YAAI,MAAM,eAAe,WAAW;AACnC,kBAAA,MAAQ,kBAAkB,OAAO,SAAS,GAAG,EAAE,OAAO,KAAwB;AAAA,QAC/E,OAAO;AACN,kBAAA,MAAQ,KAAK,eAAe,OAAO,UAAU,GAAG,GAAG,KAAe;AAAA,QACnE;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR;AACD;"}
|
|
@@ -24,6 +24,39 @@ const evaluateCondition = (value, condition) => {
|
|
|
24
24
|
containsCI: (expr) => typeof value === "string" && value.toLowerCase().includes(expr.toLowerCase()),
|
|
25
25
|
startsWithCI: (expr) => typeof value === "string" && value.toLowerCase().startsWith(expr.toLowerCase()),
|
|
26
26
|
endsWithCI: (expr) => typeof value === "string" && value.toLowerCase().endsWith(expr.toLowerCase()),
|
|
27
|
+
similar: (expr) => {
|
|
28
|
+
if (typeof value !== "string") return false;
|
|
29
|
+
const trigrams = (s) => {
|
|
30
|
+
const lower = s.toLowerCase();
|
|
31
|
+
const padded = ` ${lower} `;
|
|
32
|
+
const set = /* @__PURE__ */ new Set();
|
|
33
|
+
for (let i = 0; i < padded.length - 2; i++) set.add(padded.slice(i, i + 3));
|
|
34
|
+
return set;
|
|
35
|
+
};
|
|
36
|
+
const a = trigrams(value);
|
|
37
|
+
const b = trigrams(expr);
|
|
38
|
+
const intersection = [...a].filter((t) => b.has(t)).length;
|
|
39
|
+
const union = (/* @__PURE__ */ new Set([...a, ...b])).size;
|
|
40
|
+
return union > 0 && intersection / union >= 0.3;
|
|
41
|
+
},
|
|
42
|
+
wordSimilar: (expr) => {
|
|
43
|
+
if (typeof value !== "string") return false;
|
|
44
|
+
const trigrams = (s) => {
|
|
45
|
+
const lower = s.toLowerCase();
|
|
46
|
+
const padded = ` ${lower} `;
|
|
47
|
+
const set = /* @__PURE__ */ new Set();
|
|
48
|
+
for (let i = 0; i < padded.length - 2; i++) set.add(padded.slice(i, i + 3));
|
|
49
|
+
return set;
|
|
50
|
+
};
|
|
51
|
+
const queryTrigrams = trigrams(expr);
|
|
52
|
+
const words = value.toLowerCase().split(/\s+/);
|
|
53
|
+
return words.some((word) => {
|
|
54
|
+
const wordTrigrams = trigrams(word);
|
|
55
|
+
const intersection = [...queryTrigrams].filter((t) => wordTrigrams.has(t)).length;
|
|
56
|
+
const union = (/* @__PURE__ */ new Set([...queryTrigrams, ...wordTrigrams])).size;
|
|
57
|
+
return union > 0 && intersection / union >= 0.6;
|
|
58
|
+
});
|
|
59
|
+
},
|
|
27
60
|
never: () => false,
|
|
28
61
|
always: () => true,
|
|
29
62
|
// deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluateCondition.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === expr,\n\t\tnotEq: expr => value !== expr,\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.includes(value),\n\t\tnotIn: expr => !expr.includes(value),\n\t\tlt: expr => value !== null && value < expr,\n\t\tlte: expr => value !== null && value <= expr,\n\t\tgt: expr => value !== null && value > expr,\n\t\tgte: expr => value !== null && value >= expr,\n\t\tincludes: (expr: any) => Array.isArray(value) && value.includes(expr),\n\t\tmaxLength: expr => Array.isArray(value) && value.length <= expr,\n\t\tminLength: expr => Array.isArray(value) && value.length >= expr,\n\t\tcontains: expr => typeof value === 'string' && value.includes(expr),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(expr),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(expr),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(expr.toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(expr.toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(expr.toLowerCase()),\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":["BindingError"],"mappings":";;;AAIO,MAAM,oBAAoB,CAAC,OAA0B,cAAkD;AAC7G,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,UAAQ,UAAU;AAAA,IACtB,OAAO,UAAQ,UAAU;AAAA,IACzB,QAAQ,CAAA,SAAS,UAAU,SAAU;AAAA,IACrC,IAAI,CAAA,SAAQ,KAAK,SAAS,KAAK;AAAA,IAC/B,OAAO,CAAA,SAAQ,CAAC,KAAK,SAAS,KAAK;AAAA,IACnC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,UAAU,CAAC,SAAc,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,IAAI;AAAA,IACpE,WAAW,CAAA,SAAQ,MAAM,QAAQ,KAAK,KAAK,MAAM,UAAU;AAAA,IAC3D,WAAW,CAAA,SAAQ,MAAM,QAAQ,KAAK,KAAK,MAAM,UAAU;AAAA,IAC3D,UAAU,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,WAAW,IAAI;AAAA,IACtE,UAAU,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,cAAc,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,cAAc,WAAW,KAAK,YAAA,CAAa;AAAA,IACpG,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAA,SAAS,UAAU,SAAU;AAAA,EAAA;AAEpC,SAAO,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACxB,aAAO;AAAA,IACR;AACA,UAAM,aAAa;AACnB,UAAM,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAIA,QAAAA,aAAA;AAAA,IACX;AACA,WAAQ,QAAgB,QAAQ;AAAA,EACjC,CAAC;AACF;;"}
|
|
1
|
+
{"version":3,"file":"evaluateCondition.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === expr,\n\t\tnotEq: expr => value !== expr,\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.includes(value),\n\t\tnotIn: expr => !expr.includes(value),\n\t\tlt: expr => value !== null && value < expr,\n\t\tlte: expr => value !== null && value <= expr,\n\t\tgt: expr => value !== null && value > expr,\n\t\tgte: expr => value !== null && value >= expr,\n\t\tincludes: (expr: any) => Array.isArray(value) && value.includes(expr),\n\t\tmaxLength: expr => Array.isArray(value) && value.length <= expr,\n\t\tminLength: expr => Array.isArray(value) && value.length >= expr,\n\t\tcontains: expr => typeof value === 'string' && value.includes(expr),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(expr),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(expr),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(expr.toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(expr.toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(expr.toLowerCase()),\n\t\tsimilar: expr => {\n\t\t\tif (typeof value !== 'string') return false\n\t\t\tconst trigrams = (s: string): Set<string> => {\n\t\t\t\tconst lower = s.toLowerCase()\n\t\t\t\tconst padded = ` ${lower} `\n\t\t\t\tconst set = new Set<string>()\n\t\t\t\tfor (let i = 0; i < padded.length - 2; i++) set.add(padded.slice(i, i + 3))\n\t\t\t\treturn set\n\t\t\t}\n\t\t\tconst a = trigrams(value)\n\t\t\tconst b = trigrams(expr)\n\t\t\tconst intersection = [...a].filter(t => b.has(t)).length\n\t\t\tconst union = new Set([...a, ...b]).size\n\t\t\treturn union > 0 && intersection / union >= 0.3\n\t\t},\n\t\twordSimilar: expr => {\n\t\t\tif (typeof value !== 'string') return false\n\t\t\tconst trigrams = (s: string): Set<string> => {\n\t\t\t\tconst lower = s.toLowerCase()\n\t\t\t\tconst padded = ` ${lower} `\n\t\t\t\tconst set = new Set<string>()\n\t\t\t\tfor (let i = 0; i < padded.length - 2; i++) set.add(padded.slice(i, i + 3))\n\t\t\t\treturn set\n\t\t\t}\n\t\t\tconst queryTrigrams = trigrams(expr)\n\t\t\tconst words = value.toLowerCase().split(/\\s+/)\n\t\t\treturn words.some(word => {\n\t\t\t\tconst wordTrigrams = trigrams(word)\n\t\t\t\tconst intersection = [...queryTrigrams].filter(t => wordTrigrams.has(t)).length\n\t\t\t\tconst union = new Set([...queryTrigrams, ...wordTrigrams]).size\n\t\t\t\treturn union > 0 && intersection / union >= 0.6\n\t\t\t})\n\t\t},\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":["BindingError"],"mappings":";;;AAIO,MAAM,oBAAoB,CAAC,OAA0B,cAAkD;AAC7G,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,UAAQ,UAAU;AAAA,IACtB,OAAO,UAAQ,UAAU;AAAA,IACzB,QAAQ,CAAA,SAAS,UAAU,SAAU;AAAA,IACrC,IAAI,CAAA,SAAQ,KAAK,SAAS,KAAK;AAAA,IAC/B,OAAO,CAAA,SAAQ,CAAC,KAAK,SAAS,KAAK;AAAA,IACnC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,UAAU,CAAC,SAAc,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,IAAI;AAAA,IACpE,WAAW,CAAA,SAAQ,MAAM,QAAQ,KAAK,KAAK,MAAM,UAAU;AAAA,IAC3D,WAAW,CAAA,SAAQ,MAAM,QAAQ,KAAK,KAAK,MAAM,UAAU;AAAA,IAC3D,UAAU,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,WAAW,IAAI;AAAA,IACtE,UAAU,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,cAAc,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,cAAc,WAAW,KAAK,YAAA,CAAa;AAAA,IACpG,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,SAAS,CAAA,SAAQ;AAChB,UAAI,OAAO,UAAU,SAAU,QAAO;AACtC,YAAM,WAAW,CAAC,MAA2B;AAC5C,cAAM,QAAQ,EAAE,YAAA;AAChB,cAAM,SAAS,KAAK,KAAK;AACzB,cAAM,0BAAU,IAAA;AAChB,iBAAS,IAAI,GAAG,IAAI,OAAO,SAAS,GAAG,IAAK,KAAI,IAAI,OAAO,MAAM,GAAG,IAAI,CAAC,CAAC;AAC1E,eAAO;AAAA,MACR;AACA,YAAM,IAAI,SAAS,KAAK;AACxB,YAAM,IAAI,SAAS,IAAI;AACvB,YAAM,eAAe,CAAC,GAAG,CAAC,EAAE,OAAO,CAAA,MAAK,EAAE,IAAI,CAAC,CAAC,EAAE;AAClD,YAAM,6BAAY,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,GAAE;AACpC,aAAO,QAAQ,KAAK,eAAe,SAAS;AAAA,IAC7C;AAAA,IACA,aAAa,CAAA,SAAQ;AACpB,UAAI,OAAO,UAAU,SAAU,QAAO;AACtC,YAAM,WAAW,CAAC,MAA2B;AAC5C,cAAM,QAAQ,EAAE,YAAA;AAChB,cAAM,SAAS,KAAK,KAAK;AACzB,cAAM,0BAAU,IAAA;AAChB,iBAAS,IAAI,GAAG,IAAI,OAAO,SAAS,GAAG,IAAK,KAAI,IAAI,OAAO,MAAM,GAAG,IAAI,CAAC,CAAC;AAC1E,eAAO;AAAA,MACR;AACA,YAAM,gBAAgB,SAAS,IAAI;AACnC,YAAM,QAAQ,MAAM,YAAA,EAAc,MAAM,KAAK;AAC7C,aAAO,MAAM,KAAK,CAAA,SAAQ;AACzB,cAAM,eAAe,SAAS,IAAI;AAClC,cAAM,eAAe,CAAC,GAAG,aAAa,EAAE,OAAO,CAAA,MAAK,aAAa,IAAI,CAAC,CAAC,EAAE;AACzE,cAAM,6BAAY,IAAI,CAAC,GAAG,eAAe,GAAG,YAAY,CAAC,GAAE;AAC3D,eAAO,QAAQ,KAAK,eAAe,SAAS;AAAA,MAC7C,CAAC;AAAA,IACF;AAAA,IACA,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAA,SAAS,UAAU,SAAU;AAAA,EAAA;AAEpC,SAAO,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACxB,aAAO;AAAA,IACR;AACA,UAAM,aAAa;AACnB,UAAM,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAIA,QAAAA,aAAA;AAAA,IACX;AACA,WAAQ,QAAgB,QAAQ;AAAA,EACjC,CAAC;AACF;;"}
|
|
@@ -22,6 +22,39 @@ const evaluateCondition = (value, condition) => {
|
|
|
22
22
|
containsCI: (expr) => typeof value === "string" && value.toLowerCase().includes(expr.toLowerCase()),
|
|
23
23
|
startsWithCI: (expr) => typeof value === "string" && value.toLowerCase().startsWith(expr.toLowerCase()),
|
|
24
24
|
endsWithCI: (expr) => typeof value === "string" && value.toLowerCase().endsWith(expr.toLowerCase()),
|
|
25
|
+
similar: (expr) => {
|
|
26
|
+
if (typeof value !== "string") return false;
|
|
27
|
+
const trigrams = (s) => {
|
|
28
|
+
const lower = s.toLowerCase();
|
|
29
|
+
const padded = ` ${lower} `;
|
|
30
|
+
const set = /* @__PURE__ */ new Set();
|
|
31
|
+
for (let i = 0; i < padded.length - 2; i++) set.add(padded.slice(i, i + 3));
|
|
32
|
+
return set;
|
|
33
|
+
};
|
|
34
|
+
const a = trigrams(value);
|
|
35
|
+
const b = trigrams(expr);
|
|
36
|
+
const intersection = [...a].filter((t) => b.has(t)).length;
|
|
37
|
+
const union = (/* @__PURE__ */ new Set([...a, ...b])).size;
|
|
38
|
+
return union > 0 && intersection / union >= 0.3;
|
|
39
|
+
},
|
|
40
|
+
wordSimilar: (expr) => {
|
|
41
|
+
if (typeof value !== "string") return false;
|
|
42
|
+
const trigrams = (s) => {
|
|
43
|
+
const lower = s.toLowerCase();
|
|
44
|
+
const padded = ` ${lower} `;
|
|
45
|
+
const set = /* @__PURE__ */ new Set();
|
|
46
|
+
for (let i = 0; i < padded.length - 2; i++) set.add(padded.slice(i, i + 3));
|
|
47
|
+
return set;
|
|
48
|
+
};
|
|
49
|
+
const queryTrigrams = trigrams(expr);
|
|
50
|
+
const words = value.toLowerCase().split(/\s+/);
|
|
51
|
+
return words.some((word) => {
|
|
52
|
+
const wordTrigrams = trigrams(word);
|
|
53
|
+
const intersection = [...queryTrigrams].filter((t) => wordTrigrams.has(t)).length;
|
|
54
|
+
const union = (/* @__PURE__ */ new Set([...queryTrigrams, ...wordTrigrams])).size;
|
|
55
|
+
return union > 0 && intersection / union >= 0.6;
|
|
56
|
+
});
|
|
57
|
+
},
|
|
25
58
|
never: () => false,
|
|
26
59
|
always: () => true,
|
|
27
60
|
// deprecated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluateCondition.js","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === expr,\n\t\tnotEq: expr => value !== expr,\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.includes(value),\n\t\tnotIn: expr => !expr.includes(value),\n\t\tlt: expr => value !== null && value < expr,\n\t\tlte: expr => value !== null && value <= expr,\n\t\tgt: expr => value !== null && value > expr,\n\t\tgte: expr => value !== null && value >= expr,\n\t\tincludes: (expr: any) => Array.isArray(value) && value.includes(expr),\n\t\tmaxLength: expr => Array.isArray(value) && value.length <= expr,\n\t\tminLength: expr => Array.isArray(value) && value.length >= expr,\n\t\tcontains: expr => typeof value === 'string' && value.includes(expr),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(expr),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(expr),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(expr.toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(expr.toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(expr.toLowerCase()),\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":[],"mappings":";AAIO,MAAM,oBAAoB,CAAC,OAA0B,cAAkD;AAC7G,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,UAAQ,UAAU;AAAA,IACtB,OAAO,UAAQ,UAAU;AAAA,IACzB,QAAQ,CAAA,SAAS,UAAU,SAAU;AAAA,IACrC,IAAI,CAAA,SAAQ,KAAK,SAAS,KAAK;AAAA,IAC/B,OAAO,CAAA,SAAQ,CAAC,KAAK,SAAS,KAAK;AAAA,IACnC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,UAAU,CAAC,SAAc,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,IAAI;AAAA,IACpE,WAAW,CAAA,SAAQ,MAAM,QAAQ,KAAK,KAAK,MAAM,UAAU;AAAA,IAC3D,WAAW,CAAA,SAAQ,MAAM,QAAQ,KAAK,KAAK,MAAM,UAAU;AAAA,IAC3D,UAAU,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,WAAW,IAAI;AAAA,IACtE,UAAU,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,cAAc,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,cAAc,WAAW,KAAK,YAAA,CAAa;AAAA,IACpG,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAA,SAAS,UAAU,SAAU;AAAA,EAAA;AAEpC,SAAO,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACxB,aAAO;AAAA,IACR;AACA,UAAM,aAAa;AACnB,UAAM,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAI,aAAA;AAAA,IACX;AACA,WAAQ,QAAgB,QAAQ;AAAA,EACjC,CAAC;AACF;"}
|
|
1
|
+
{"version":3,"file":"evaluateCondition.js","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === expr,\n\t\tnotEq: expr => value !== expr,\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.includes(value),\n\t\tnotIn: expr => !expr.includes(value),\n\t\tlt: expr => value !== null && value < expr,\n\t\tlte: expr => value !== null && value <= expr,\n\t\tgt: expr => value !== null && value > expr,\n\t\tgte: expr => value !== null && value >= expr,\n\t\tincludes: (expr: any) => Array.isArray(value) && value.includes(expr),\n\t\tmaxLength: expr => Array.isArray(value) && value.length <= expr,\n\t\tminLength: expr => Array.isArray(value) && value.length >= expr,\n\t\tcontains: expr => typeof value === 'string' && value.includes(expr),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(expr),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(expr),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(expr.toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(expr.toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(expr.toLowerCase()),\n\t\tsimilar: expr => {\n\t\t\tif (typeof value !== 'string') return false\n\t\t\tconst trigrams = (s: string): Set<string> => {\n\t\t\t\tconst lower = s.toLowerCase()\n\t\t\t\tconst padded = ` ${lower} `\n\t\t\t\tconst set = new Set<string>()\n\t\t\t\tfor (let i = 0; i < padded.length - 2; i++) set.add(padded.slice(i, i + 3))\n\t\t\t\treturn set\n\t\t\t}\n\t\t\tconst a = trigrams(value)\n\t\t\tconst b = trigrams(expr)\n\t\t\tconst intersection = [...a].filter(t => b.has(t)).length\n\t\t\tconst union = new Set([...a, ...b]).size\n\t\t\treturn union > 0 && intersection / union >= 0.3\n\t\t},\n\t\twordSimilar: expr => {\n\t\t\tif (typeof value !== 'string') return false\n\t\t\tconst trigrams = (s: string): Set<string> => {\n\t\t\t\tconst lower = s.toLowerCase()\n\t\t\t\tconst padded = ` ${lower} `\n\t\t\t\tconst set = new Set<string>()\n\t\t\t\tfor (let i = 0; i < padded.length - 2; i++) set.add(padded.slice(i, i + 3))\n\t\t\t\treturn set\n\t\t\t}\n\t\t\tconst queryTrigrams = trigrams(expr)\n\t\t\tconst words = value.toLowerCase().split(/\\s+/)\n\t\t\treturn words.some(word => {\n\t\t\t\tconst wordTrigrams = trigrams(word)\n\t\t\t\tconst intersection = [...queryTrigrams].filter(t => wordTrigrams.has(t)).length\n\t\t\t\tconst union = new Set([...queryTrigrams, ...wordTrigrams]).size\n\t\t\t\treturn union > 0 && intersection / union >= 0.6\n\t\t\t})\n\t\t},\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistOnFieldChange.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnFieldChange.tsx"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult, SugaredRelativeSingleField } from '@contember/binding'\nimport { useEffect } from 'react'\nimport { useField } from '../../accessorPropagation'\nimport { useDecoratedPersist } from './useDecoratedPersist'\nimport { Component, Field } from '../../coreComponents'\n\nexport type PersistOnFieldChangeProps = {\n\t/**\n\t * The field that should trigger persist when changed.\n\t */\n\tfield: SugaredRelativeSingleField['field']\n\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * Triggers persist when the specified field changes.\n * This only works for scalar fields, for relations, see {@link PersistOnHasOneChange}.\n *\n * ## Props {@link PersistOnFieldChangeProps}\n * - field, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnFieldChange field=\"name\" />\n * ```\n */\nexport const PersistOnFieldChange = Component(({ field, onPersistError, onPersistSuccess }: PersistOnFieldChangeProps) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\tconst getField = useField(field).getAccessor\n\n\tuseEffect(() => {\n\t\tconst unregister = getField().addEventListener({ type: 'update' }, async field => {\n\t\t\tif (!field.hasUnpersistedChanges) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait doPersist()\n\t\t})\n\n\t\treturn unregister\n\t}, [getField, doPersist])\n\n\treturn null\n}, ({ field }) => <Field field={field} />)\n"],"names":["Component","useDecoratedPersist","useField","useEffect","field","jsxDEV","Field","this"],"mappings":";;;;;;;;AAmCO,MAAM,uBAAuBA,UAAAA,UAAU,CAAC,EAAE,OAAO,gBAAgB,uBAAkD;AACzH,QAAM,YAAYC,oBAAAA,oBAAoB,EAAE,gBAAgB,kBAAkB;AAC1E,QAAM,WAAWC,SAAAA,SAAS,KAAK,EAAE;AAEjCC,QAAAA,UAAU,MAAM;AACf,UAAM,aAAa,WAAW,iBAAiB,EAAE,MAAM,SAAA,GAAY,OAAMC,WAAS;AACjF,UAAI,CAACA,OAAM,uBAAuB;AACjC;AAAA,MACD;AACA,YAAM,UAAA;AAAA,IACP,CAAC;AAED,WAAO;AAAA,EACR,GAAG,CAAC,UAAU,SAAS,CAAC;AAExB,SAAO;AACR,GAAG,CAAC,EAAE,MAAA,MAAYC,8BAAAA,OAACC,MAAAA,SAAM,MAAA,GAAP,QAAA,OAAA;AAAA,EAAA,UAAA;AAAA,EAAA,YAAA;AAAA,EAAA,cAAA;AAAA,GAAAC,MAAqB,CAAE;;"}
|
|
1
|
+
{"version":3,"file":"PersistOnFieldChange.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnFieldChange.tsx"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult, SugaredRelativeSingleField } from '@contember/binding'\nimport { useEffect } from 'react'\nimport { useField } from '../../accessorPropagation/index.js'\nimport { useDecoratedPersist } from './useDecoratedPersist.js'\nimport { Component, Field } from '../../coreComponents/index.js'\n\nexport type PersistOnFieldChangeProps = {\n\t/**\n\t * The field that should trigger persist when changed.\n\t */\n\tfield: SugaredRelativeSingleField['field']\n\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * Triggers persist when the specified field changes.\n * This only works for scalar fields, for relations, see {@link PersistOnHasOneChange}.\n *\n * ## Props {@link PersistOnFieldChangeProps}\n * - field, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnFieldChange field=\"name\" />\n * ```\n */\nexport const PersistOnFieldChange = Component(({ field, onPersistError, onPersistSuccess }: PersistOnFieldChangeProps) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\tconst getField = useField(field).getAccessor\n\n\tuseEffect(() => {\n\t\tconst unregister = getField().addEventListener({ type: 'update' }, async field => {\n\t\t\tif (!field.hasUnpersistedChanges) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait doPersist()\n\t\t})\n\n\t\treturn unregister\n\t}, [getField, doPersist])\n\n\treturn null\n}, ({ field }) => <Field field={field} />)\n"],"names":["Component","useDecoratedPersist","useField","useEffect","field","jsxDEV","Field","this"],"mappings":";;;;;;;;AAmCO,MAAM,uBAAuBA,UAAAA,UAAU,CAAC,EAAE,OAAO,gBAAgB,uBAAkD;AACzH,QAAM,YAAYC,oBAAAA,oBAAoB,EAAE,gBAAgB,kBAAkB;AAC1E,QAAM,WAAWC,SAAAA,SAAS,KAAK,EAAE;AAEjCC,QAAAA,UAAU,MAAM;AACf,UAAM,aAAa,WAAW,iBAAiB,EAAE,MAAM,SAAA,GAAY,OAAMC,WAAS;AACjF,UAAI,CAACA,OAAM,uBAAuB;AACjC;AAAA,MACD;AACA,YAAM,UAAA;AAAA,IACP,CAAC;AAED,WAAO;AAAA,EACR,GAAG,CAAC,UAAU,SAAS,CAAC;AAExB,SAAO;AACR,GAAG,CAAC,EAAE,MAAA,MAAYC,8BAAAA,OAACC,MAAAA,SAAM,MAAA,GAAP,QAAA,OAAA;AAAA,EAAA,UAAA;AAAA,EAAA,YAAA;AAAA,EAAA,cAAA;AAAA,GAAAC,MAAqB,CAAE;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistOnFieldChange.js","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnFieldChange.tsx"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult, SugaredRelativeSingleField } from '@contember/binding'\nimport { useEffect } from 'react'\nimport { useField } from '../../accessorPropagation'\nimport { useDecoratedPersist } from './useDecoratedPersist'\nimport { Component, Field } from '../../coreComponents'\n\nexport type PersistOnFieldChangeProps = {\n\t/**\n\t * The field that should trigger persist when changed.\n\t */\n\tfield: SugaredRelativeSingleField['field']\n\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * Triggers persist when the specified field changes.\n * This only works for scalar fields, for relations, see {@link PersistOnHasOneChange}.\n *\n * ## Props {@link PersistOnFieldChangeProps}\n * - field, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnFieldChange field=\"name\" />\n * ```\n */\nexport const PersistOnFieldChange = Component(({ field, onPersistError, onPersistSuccess }: PersistOnFieldChangeProps) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\tconst getField = useField(field).getAccessor\n\n\tuseEffect(() => {\n\t\tconst unregister = getField().addEventListener({ type: 'update' }, async field => {\n\t\t\tif (!field.hasUnpersistedChanges) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait doPersist()\n\t\t})\n\n\t\treturn unregister\n\t}, [getField, doPersist])\n\n\treturn null\n}, ({ field }) => <Field field={field} />)\n"],"names":["field","this"],"mappings":";;;;;;AAmCO,MAAM,uBAAuB,UAAU,CAAC,EAAE,OAAO,gBAAgB,uBAAkD;AACzH,QAAM,YAAY,oBAAoB,EAAE,gBAAgB,kBAAkB;AAC1E,QAAM,WAAW,SAAS,KAAK,EAAE;AAEjC,YAAU,MAAM;AACf,UAAM,aAAa,WAAW,iBAAiB,EAAE,MAAM,SAAA,GAAY,OAAMA,WAAS;AACjF,UAAI,CAACA,OAAM,uBAAuB;AACjC;AAAA,MACD;AACA,YAAM,UAAA;AAAA,IACP,CAAC;AAED,WAAO;AAAA,EACR,GAAG,CAAC,UAAU,SAAS,CAAC;AAExB,SAAO;AACR,GAAG,CAAC,EAAE,MAAA,MAAY,uBAAC,SAAM,MAAA,GAAP,QAAA,OAAA;AAAA,EAAA,UAAA;AAAA,EAAA,YAAA;AAAA,EAAA,cAAA;AAAA,GAAAC,MAAqB,CAAE;"}
|
|
1
|
+
{"version":3,"file":"PersistOnFieldChange.js","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnFieldChange.tsx"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult, SugaredRelativeSingleField } from '@contember/binding'\nimport { useEffect } from 'react'\nimport { useField } from '../../accessorPropagation/index.js'\nimport { useDecoratedPersist } from './useDecoratedPersist.js'\nimport { Component, Field } from '../../coreComponents/index.js'\n\nexport type PersistOnFieldChangeProps = {\n\t/**\n\t * The field that should trigger persist when changed.\n\t */\n\tfield: SugaredRelativeSingleField['field']\n\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * Triggers persist when the specified field changes.\n * This only works for scalar fields, for relations, see {@link PersistOnHasOneChange}.\n *\n * ## Props {@link PersistOnFieldChangeProps}\n * - field, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnFieldChange field=\"name\" />\n * ```\n */\nexport const PersistOnFieldChange = Component(({ field, onPersistError, onPersistSuccess }: PersistOnFieldChangeProps) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\tconst getField = useField(field).getAccessor\n\n\tuseEffect(() => {\n\t\tconst unregister = getField().addEventListener({ type: 'update' }, async field => {\n\t\t\tif (!field.hasUnpersistedChanges) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait doPersist()\n\t\t})\n\n\t\treturn unregister\n\t}, [getField, doPersist])\n\n\treturn null\n}, ({ field }) => <Field field={field} />)\n"],"names":["field","this"],"mappings":";;;;;;AAmCO,MAAM,uBAAuB,UAAU,CAAC,EAAE,OAAO,gBAAgB,uBAAkD;AACzH,QAAM,YAAY,oBAAoB,EAAE,gBAAgB,kBAAkB;AAC1E,QAAM,WAAW,SAAS,KAAK,EAAE;AAEjC,YAAU,MAAM;AACf,UAAM,aAAa,WAAW,iBAAiB,EAAE,MAAM,SAAA,GAAY,OAAMA,WAAS;AACjF,UAAI,CAACA,OAAM,uBAAuB;AACjC;AAAA,MACD;AACA,YAAM,UAAA;AAAA,IACP,CAAC;AAED,WAAO;AAAA,EACR,GAAG,CAAC,UAAU,SAAS,CAAC;AAExB,SAAO;AACR,GAAG,CAAC,EAAE,MAAA,MAAY,uBAAC,SAAM,MAAA,GAAP,QAAA,OAAA;AAAA,EAAA,UAAA;AAAA,EAAA,YAAA;AAAA,EAAA,cAAA;AAAA,GAAAC,MAAqB,CAAE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistOnHasOneChange.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnHasOneChange.tsx"],"sourcesContent":["import { ErrorPersistResult, QueryLanguage, SuccessfulPersistResult, SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useEffect, useMemo } from 'react'\nimport { useDecoratedPersist } from './useDecoratedPersist'\nimport { useEntity, useEnvironment } from '../../accessorPropagation'\nimport { Component, HasOne } from '../../coreComponents'\n\nexport type PersistOnHasOneChangeProps = {\n\t/**\n\t * The relation field that should trigger persist when changed.\n\t */\n\tfield: SugaredRelativeSingleEntity['field']\n\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * Triggers persist when the specified relation field changes.\n * This only works for has-one relation fields, for scalar fields, see {@link PersistOnFieldChange}.\n *\n * ## Props {@link PersistOnHasOneChangeProps}\n * - field, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnHasOneChange field=\"author\" />\n * ```\n */\nexport const PersistOnHasOneChange = Component<PersistOnHasOneChangeProps>(({ field, onPersistError, onPersistSuccess }) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\tconst env = useEnvironment()\n\tconst desugaredPath = useMemo(() => QueryLanguage.desugarRelativeSingleEntity({ field }, env), [field, env])\n\tconst getEntity = useEntity(useMemo(() => ({\n\t\tfield: desugaredPath.hasOneRelationPath.slice(0, -1),\n\t}), [desugaredPath])).getAccessor\n\n\tconst lastField = desugaredPath.hasOneRelationPath[desugaredPath.hasOneRelationPath.length - 1].field\n\n\tuseEffect(() => {\n\t\tconst unregister = getEntity().addEventListener({ type: 'connectionUpdate', key: lastField }, async accessor => {\n\t\t\tif (!accessor.hasUnpersistedChanges) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait doPersist()\n\t\t})\n\n\t\treturn unregister\n\t}, [getEntity, doPersist, lastField])\n\n\treturn null\n}, ({ field }) => <HasOne field={field} />)\n"],"names":["Component","useDecoratedPersist","useEnvironment","useMemo","QueryLanguage","useEntity","useEffect","jsxDEV","HasOne","this"],"mappings":";;;;;;;;;;AAmCO,MAAM,wBAAwBA,UAAAA,UAAsC,CAAC,EAAE,OAAO,gBAAgB,uBAAuB;AAC3H,QAAM,YAAYC,oBAAAA,oBAAoB,EAAE,gBAAgB,kBAAkB;AAC1E,QAAM,MAAMC,eAAAA,eAAA;AACZ,QAAM,gBAAgBC,MAAAA,QAAQ,MAAMC,QAAAA,cAAc,4BAA4B,EAAE,MAAA,GAAS,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC;AAC3G,QAAM,YAAYC,oBAAUF,MAAAA,QAAQ,OAAO;AAAA,IAC1C,OAAO,cAAc,mBAAmB,MAAM,GAAG,EAAE;AAAA,EAAA,IAChD,CAAC,aAAa,CAAC,CAAC,EAAE;AAEtB,QAAM,YAAY,cAAc,mBAAmB,cAAc,mBAAmB,SAAS,CAAC,EAAE;AAEhGG,QAAAA,UAAU,MAAM;AACf,UAAM,aAAa,YAAY,iBAAiB,EAAE,MAAM,oBAAoB,KAAK,aAAa,OAAM,aAAY;AAC/G,UAAI,CAAC,SAAS,uBAAuB;AACpC;AAAA,MACD;AACA,YAAM,UAAA;AAAA,IACP,CAAC;AAED,WAAO;AAAA,EACR,GAAG,CAAC,WAAW,WAAW,SAAS,CAAC;AAEpC,SAAO;AACR,GAAG,CAAC,EAAE,MAAA,MAAYC,8BAAAA,OAACC,OAAAA,UAAO,MAAA,GAAR,QAAA,OAAA;AAAA,EAAA,UAAA;AAAA,EAAA,YAAA;AAAA,EAAA,cAAA;AAAA,GAAAC,MAAsB,CAAE;;"}
|
|
1
|
+
{"version":3,"file":"PersistOnHasOneChange.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnHasOneChange.tsx"],"sourcesContent":["import { ErrorPersistResult, QueryLanguage, SuccessfulPersistResult, SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useEffect, useMemo } from 'react'\nimport { useDecoratedPersist } from './useDecoratedPersist.js'\nimport { useEntity, useEnvironment } from '../../accessorPropagation/index.js'\nimport { Component, HasOne } from '../../coreComponents/index.js'\n\nexport type PersistOnHasOneChangeProps = {\n\t/**\n\t * The relation field that should trigger persist when changed.\n\t */\n\tfield: SugaredRelativeSingleEntity['field']\n\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * Triggers persist when the specified relation field changes.\n * This only works for has-one relation fields, for scalar fields, see {@link PersistOnFieldChange}.\n *\n * ## Props {@link PersistOnHasOneChangeProps}\n * - field, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnHasOneChange field=\"author\" />\n * ```\n */\nexport const PersistOnHasOneChange = Component<PersistOnHasOneChangeProps>(({ field, onPersistError, onPersistSuccess }) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\tconst env = useEnvironment()\n\tconst desugaredPath = useMemo(() => QueryLanguage.desugarRelativeSingleEntity({ field }, env), [field, env])\n\tconst getEntity = useEntity(useMemo(() => ({\n\t\tfield: desugaredPath.hasOneRelationPath.slice(0, -1),\n\t}), [desugaredPath])).getAccessor\n\n\tconst lastField = desugaredPath.hasOneRelationPath[desugaredPath.hasOneRelationPath.length - 1].field\n\n\tuseEffect(() => {\n\t\tconst unregister = getEntity().addEventListener({ type: 'connectionUpdate', key: lastField }, async accessor => {\n\t\t\tif (!accessor.hasUnpersistedChanges) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait doPersist()\n\t\t})\n\n\t\treturn unregister\n\t}, [getEntity, doPersist, lastField])\n\n\treturn null\n}, ({ field }) => <HasOne field={field} />)\n"],"names":["Component","useDecoratedPersist","useEnvironment","useMemo","QueryLanguage","useEntity","useEffect","jsxDEV","HasOne","this"],"mappings":";;;;;;;;;;AAmCO,MAAM,wBAAwBA,UAAAA,UAAsC,CAAC,EAAE,OAAO,gBAAgB,uBAAuB;AAC3H,QAAM,YAAYC,oBAAAA,oBAAoB,EAAE,gBAAgB,kBAAkB;AAC1E,QAAM,MAAMC,eAAAA,eAAA;AACZ,QAAM,gBAAgBC,MAAAA,QAAQ,MAAMC,QAAAA,cAAc,4BAA4B,EAAE,MAAA,GAAS,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC;AAC3G,QAAM,YAAYC,oBAAUF,MAAAA,QAAQ,OAAO;AAAA,IAC1C,OAAO,cAAc,mBAAmB,MAAM,GAAG,EAAE;AAAA,EAAA,IAChD,CAAC,aAAa,CAAC,CAAC,EAAE;AAEtB,QAAM,YAAY,cAAc,mBAAmB,cAAc,mBAAmB,SAAS,CAAC,EAAE;AAEhGG,QAAAA,UAAU,MAAM;AACf,UAAM,aAAa,YAAY,iBAAiB,EAAE,MAAM,oBAAoB,KAAK,aAAa,OAAM,aAAY;AAC/G,UAAI,CAAC,SAAS,uBAAuB;AACpC;AAAA,MACD;AACA,YAAM,UAAA;AAAA,IACP,CAAC;AAED,WAAO;AAAA,EACR,GAAG,CAAC,WAAW,WAAW,SAAS,CAAC;AAEpC,SAAO;AACR,GAAG,CAAC,EAAE,MAAA,MAAYC,8BAAAA,OAACC,OAAAA,UAAO,MAAA,GAAR,QAAA,OAAA;AAAA,EAAA,UAAA;AAAA,EAAA,YAAA;AAAA,EAAA,cAAA;AAAA,GAAAC,MAAsB,CAAE;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistOnHasOneChange.js","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnHasOneChange.tsx"],"sourcesContent":["import { ErrorPersistResult, QueryLanguage, SuccessfulPersistResult, SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useEffect, useMemo } from 'react'\nimport { useDecoratedPersist } from './useDecoratedPersist'\nimport { useEntity, useEnvironment } from '../../accessorPropagation'\nimport { Component, HasOne } from '../../coreComponents'\n\nexport type PersistOnHasOneChangeProps = {\n\t/**\n\t * The relation field that should trigger persist when changed.\n\t */\n\tfield: SugaredRelativeSingleEntity['field']\n\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * Triggers persist when the specified relation field changes.\n * This only works for has-one relation fields, for scalar fields, see {@link PersistOnFieldChange}.\n *\n * ## Props {@link PersistOnHasOneChangeProps}\n * - field, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnHasOneChange field=\"author\" />\n * ```\n */\nexport const PersistOnHasOneChange = Component<PersistOnHasOneChangeProps>(({ field, onPersistError, onPersistSuccess }) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\tconst env = useEnvironment()\n\tconst desugaredPath = useMemo(() => QueryLanguage.desugarRelativeSingleEntity({ field }, env), [field, env])\n\tconst getEntity = useEntity(useMemo(() => ({\n\t\tfield: desugaredPath.hasOneRelationPath.slice(0, -1),\n\t}), [desugaredPath])).getAccessor\n\n\tconst lastField = desugaredPath.hasOneRelationPath[desugaredPath.hasOneRelationPath.length - 1].field\n\n\tuseEffect(() => {\n\t\tconst unregister = getEntity().addEventListener({ type: 'connectionUpdate', key: lastField }, async accessor => {\n\t\t\tif (!accessor.hasUnpersistedChanges) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait doPersist()\n\t\t})\n\n\t\treturn unregister\n\t}, [getEntity, doPersist, lastField])\n\n\treturn null\n}, ({ field }) => <HasOne field={field} />)\n"],"names":["this"],"mappings":";;;;;;;;AAmCO,MAAM,wBAAwB,UAAsC,CAAC,EAAE,OAAO,gBAAgB,uBAAuB;AAC3H,QAAM,YAAY,oBAAoB,EAAE,gBAAgB,kBAAkB;AAC1E,QAAM,MAAM,eAAA;AACZ,QAAM,gBAAgB,QAAQ,MAAM,cAAc,4BAA4B,EAAE,MAAA,GAAS,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC;AAC3G,QAAM,YAAY,UAAU,QAAQ,OAAO;AAAA,IAC1C,OAAO,cAAc,mBAAmB,MAAM,GAAG,EAAE;AAAA,EAAA,IAChD,CAAC,aAAa,CAAC,CAAC,EAAE;AAEtB,QAAM,YAAY,cAAc,mBAAmB,cAAc,mBAAmB,SAAS,CAAC,EAAE;AAEhG,YAAU,MAAM;AACf,UAAM,aAAa,YAAY,iBAAiB,EAAE,MAAM,oBAAoB,KAAK,aAAa,OAAM,aAAY;AAC/G,UAAI,CAAC,SAAS,uBAAuB;AACpC;AAAA,MACD;AACA,YAAM,UAAA;AAAA,IACP,CAAC;AAED,WAAO;AAAA,EACR,GAAG,CAAC,WAAW,WAAW,SAAS,CAAC;AAEpC,SAAO;AACR,GAAG,CAAC,EAAE,MAAA,MAAY,uBAAC,UAAO,MAAA,GAAR,QAAA,OAAA;AAAA,EAAA,UAAA;AAAA,EAAA,YAAA;AAAA,EAAA,cAAA;AAAA,GAAAA,MAAsB,CAAE;"}
|
|
1
|
+
{"version":3,"file":"PersistOnHasOneChange.js","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnHasOneChange.tsx"],"sourcesContent":["import { ErrorPersistResult, QueryLanguage, SuccessfulPersistResult, SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useEffect, useMemo } from 'react'\nimport { useDecoratedPersist } from './useDecoratedPersist.js'\nimport { useEntity, useEnvironment } from '../../accessorPropagation/index.js'\nimport { Component, HasOne } from '../../coreComponents/index.js'\n\nexport type PersistOnHasOneChangeProps = {\n\t/**\n\t * The relation field that should trigger persist when changed.\n\t */\n\tfield: SugaredRelativeSingleEntity['field']\n\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * Triggers persist when the specified relation field changes.\n * This only works for has-one relation fields, for scalar fields, see {@link PersistOnFieldChange}.\n *\n * ## Props {@link PersistOnHasOneChangeProps}\n * - field, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnHasOneChange field=\"author\" />\n * ```\n */\nexport const PersistOnHasOneChange = Component<PersistOnHasOneChangeProps>(({ field, onPersistError, onPersistSuccess }) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\tconst env = useEnvironment()\n\tconst desugaredPath = useMemo(() => QueryLanguage.desugarRelativeSingleEntity({ field }, env), [field, env])\n\tconst getEntity = useEntity(useMemo(() => ({\n\t\tfield: desugaredPath.hasOneRelationPath.slice(0, -1),\n\t}), [desugaredPath])).getAccessor\n\n\tconst lastField = desugaredPath.hasOneRelationPath[desugaredPath.hasOneRelationPath.length - 1].field\n\n\tuseEffect(() => {\n\t\tconst unregister = getEntity().addEventListener({ type: 'connectionUpdate', key: lastField }, async accessor => {\n\t\t\tif (!accessor.hasUnpersistedChanges) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait doPersist()\n\t\t})\n\n\t\treturn unregister\n\t}, [getEntity, doPersist, lastField])\n\n\treturn null\n}, ({ field }) => <HasOne field={field} />)\n"],"names":["this"],"mappings":";;;;;;;;AAmCO,MAAM,wBAAwB,UAAsC,CAAC,EAAE,OAAO,gBAAgB,uBAAuB;AAC3H,QAAM,YAAY,oBAAoB,EAAE,gBAAgB,kBAAkB;AAC1E,QAAM,MAAM,eAAA;AACZ,QAAM,gBAAgB,QAAQ,MAAM,cAAc,4BAA4B,EAAE,MAAA,GAAS,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC;AAC3G,QAAM,YAAY,UAAU,QAAQ,OAAO;AAAA,IAC1C,OAAO,cAAc,mBAAmB,MAAM,GAAG,EAAE;AAAA,EAAA,IAChD,CAAC,aAAa,CAAC,CAAC,EAAE;AAEtB,QAAM,YAAY,cAAc,mBAAmB,cAAc,mBAAmB,SAAS,CAAC,EAAE;AAEhG,YAAU,MAAM;AACf,UAAM,aAAa,YAAY,iBAAiB,EAAE,MAAM,oBAAoB,KAAK,aAAa,OAAM,aAAY;AAC/G,UAAI,CAAC,SAAS,uBAAuB;AACpC;AAAA,MACD;AACA,YAAM,UAAA;AAAA,IACP,CAAC;AAED,WAAO;AAAA,EACR,GAAG,CAAC,WAAW,WAAW,SAAS,CAAC;AAEpC,SAAO;AACR,GAAG,CAAC,EAAE,MAAA,MAAY,uBAAC,UAAO,MAAA,GAAR,QAAA,OAAA;AAAA,EAAA,UAAA;AAAA,EAAA,YAAA;AAAA,EAAA,cAAA;AAAA,GAAAA,MAAsB,CAAE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistOnKey.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnKey.tsx"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult } from '@contember/binding'\nimport { useEffect } from 'react'\nimport { useDecoratedPersist } from './useDecoratedPersist'\n\nexport type PersistOnKeyProps = {\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n\t/**\n\t * Optional function that decides whether a given KeyboardEvent\n\t * should trigger the persist action.\n\t */\n\tisHotkey?: (event: KeyboardEvent) => boolean\n}\n\n/**\n * Triggers persist when the specified hotkey is pressed.\n *\n * ## Props {@link PersistOnKeyProps}\n * - ?isHotkey, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnKey />\n * ```\n */\nexport const PersistOnKey = ({\n\tonPersistSuccess,\n\tonPersistError,\n\tisHotkey,\n}: PersistOnKeyProps) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\n\tuseEffect(() => {\n\t\tconst shouldHandleHotkey = isHotkey ?? defaultHotkeyCheck\n\n\t\tconst listener = (event: KeyboardEvent) => {\n\t\t\tif (shouldHandleHotkey(event)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tdoPersist()\n\t\t\t}\n\t\t}\n\n\t\tdocument.body.addEventListener('keydown', listener)\n\t\treturn () => {\n\t\t\tdocument.body.removeEventListener('keydown', listener)\n\t\t}\n\t}, [doPersist, isHotkey]) // Re-run effect if these change\n\n\treturn null\n}\n\n// Default hotkey check: ctrl+s or command+s\nconst defaultHotkeyCheck = (event: KeyboardEvent) => {\n\treturn (\n\t\t(event.ctrlKey || event.metaKey)\n\t\t&& event.key.toLowerCase() === 's'\n\t)\n}\n"],"names":["useDecoratedPersist","useEffect"],"mappings":";;;;AA+BO,MAAM,eAAe,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACD,MAAyB;AACxB,QAAM,YAAYA,oBAAAA,oBAAoB,EAAE,gBAAgB,kBAAkB;AAE1EC,QAAAA,UAAU,MAAM;AACf,UAAM,qBAAqB,YAAY;AAEvC,UAAM,WAAW,CAAC,UAAyB;AAC1C,UAAI,mBAAmB,KAAK,GAAG;AAC9B,cAAM,eAAA;AACN,kBAAA;AAAA,MACD;AAAA,IACD;AAEA,aAAS,KAAK,iBAAiB,WAAW,QAAQ;AAClD,WAAO,MAAM;AACZ,eAAS,KAAK,oBAAoB,WAAW,QAAQ;AAAA,IACtD;AAAA,EACD,GAAG,CAAC,WAAW,QAAQ,CAAC;AAExB,SAAO;AACR;AAGA,MAAM,qBAAqB,CAAC,UAAyB;AACpD,UACE,MAAM,WAAW,MAAM,YACrB,MAAM,IAAI,kBAAkB;AAEjC;;"}
|
|
1
|
+
{"version":3,"file":"PersistOnKey.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnKey.tsx"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult } from '@contember/binding'\nimport { useEffect } from 'react'\nimport { useDecoratedPersist } from './useDecoratedPersist.js'\n\nexport type PersistOnKeyProps = {\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n\t/**\n\t * Optional function that decides whether a given KeyboardEvent\n\t * should trigger the persist action.\n\t */\n\tisHotkey?: (event: KeyboardEvent) => boolean\n}\n\n/**\n * Triggers persist when the specified hotkey is pressed.\n *\n * ## Props {@link PersistOnKeyProps}\n * - ?isHotkey, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnKey />\n * ```\n */\nexport const PersistOnKey = ({\n\tonPersistSuccess,\n\tonPersistError,\n\tisHotkey,\n}: PersistOnKeyProps) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\n\tuseEffect(() => {\n\t\tconst shouldHandleHotkey = isHotkey ?? defaultHotkeyCheck\n\n\t\tconst listener = (event: KeyboardEvent) => {\n\t\t\tif (shouldHandleHotkey(event)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tdoPersist()\n\t\t\t}\n\t\t}\n\n\t\tdocument.body.addEventListener('keydown', listener)\n\t\treturn () => {\n\t\t\tdocument.body.removeEventListener('keydown', listener)\n\t\t}\n\t}, [doPersist, isHotkey]) // Re-run effect if these change\n\n\treturn null\n}\n\n// Default hotkey check: ctrl+s or command+s\nconst defaultHotkeyCheck = (event: KeyboardEvent) => {\n\treturn (\n\t\t(event.ctrlKey || event.metaKey)\n\t\t&& event.key.toLowerCase() === 's'\n\t)\n}\n"],"names":["useDecoratedPersist","useEffect"],"mappings":";;;;AA+BO,MAAM,eAAe,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACD,MAAyB;AACxB,QAAM,YAAYA,oBAAAA,oBAAoB,EAAE,gBAAgB,kBAAkB;AAE1EC,QAAAA,UAAU,MAAM;AACf,UAAM,qBAAqB,YAAY;AAEvC,UAAM,WAAW,CAAC,UAAyB;AAC1C,UAAI,mBAAmB,KAAK,GAAG;AAC9B,cAAM,eAAA;AACN,kBAAA;AAAA,MACD;AAAA,IACD;AAEA,aAAS,KAAK,iBAAiB,WAAW,QAAQ;AAClD,WAAO,MAAM;AACZ,eAAS,KAAK,oBAAoB,WAAW,QAAQ;AAAA,IACtD;AAAA,EACD,GAAG,CAAC,WAAW,QAAQ,CAAC;AAExB,SAAO;AACR;AAGA,MAAM,qBAAqB,CAAC,UAAyB;AACpD,UACE,MAAM,WAAW,MAAM,YACrB,MAAM,IAAI,kBAAkB;AAEjC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistOnKey.js","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnKey.tsx"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult } from '@contember/binding'\nimport { useEffect } from 'react'\nimport { useDecoratedPersist } from './useDecoratedPersist'\n\nexport type PersistOnKeyProps = {\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n\t/**\n\t * Optional function that decides whether a given KeyboardEvent\n\t * should trigger the persist action.\n\t */\n\tisHotkey?: (event: KeyboardEvent) => boolean\n}\n\n/**\n * Triggers persist when the specified hotkey is pressed.\n *\n * ## Props {@link PersistOnKeyProps}\n * - ?isHotkey, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnKey />\n * ```\n */\nexport const PersistOnKey = ({\n\tonPersistSuccess,\n\tonPersistError,\n\tisHotkey,\n}: PersistOnKeyProps) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\n\tuseEffect(() => {\n\t\tconst shouldHandleHotkey = isHotkey ?? defaultHotkeyCheck\n\n\t\tconst listener = (event: KeyboardEvent) => {\n\t\t\tif (shouldHandleHotkey(event)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tdoPersist()\n\t\t\t}\n\t\t}\n\n\t\tdocument.body.addEventListener('keydown', listener)\n\t\treturn () => {\n\t\t\tdocument.body.removeEventListener('keydown', listener)\n\t\t}\n\t}, [doPersist, isHotkey]) // Re-run effect if these change\n\n\treturn null\n}\n\n// Default hotkey check: ctrl+s or command+s\nconst defaultHotkeyCheck = (event: KeyboardEvent) => {\n\treturn (\n\t\t(event.ctrlKey || event.metaKey)\n\t\t&& event.key.toLowerCase() === 's'\n\t)\n}\n"],"names":[],"mappings":";;AA+BO,MAAM,eAAe,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACD,MAAyB;AACxB,QAAM,YAAY,oBAAoB,EAAE,gBAAgB,kBAAkB;AAE1E,YAAU,MAAM;AACf,UAAM,qBAAqB,YAAY;AAEvC,UAAM,WAAW,CAAC,UAAyB;AAC1C,UAAI,mBAAmB,KAAK,GAAG;AAC9B,cAAM,eAAA;AACN,kBAAA;AAAA,MACD;AAAA,IACD;AAEA,aAAS,KAAK,iBAAiB,WAAW,QAAQ;AAClD,WAAO,MAAM;AACZ,eAAS,KAAK,oBAAoB,WAAW,QAAQ;AAAA,IACtD;AAAA,EACD,GAAG,CAAC,WAAW,QAAQ,CAAC;AAExB,SAAO;AACR;AAGA,MAAM,qBAAqB,CAAC,UAAyB;AACpD,UACE,MAAM,WAAW,MAAM,YACrB,MAAM,IAAI,kBAAkB;AAEjC;"}
|
|
1
|
+
{"version":3,"file":"PersistOnKey.js","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistOnKey.tsx"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult } from '@contember/binding'\nimport { useEffect } from 'react'\nimport { useDecoratedPersist } from './useDecoratedPersist.js'\n\nexport type PersistOnKeyProps = {\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n\t/**\n\t * Optional function that decides whether a given KeyboardEvent\n\t * should trigger the persist action.\n\t */\n\tisHotkey?: (event: KeyboardEvent) => boolean\n}\n\n/**\n * Triggers persist when the specified hotkey is pressed.\n *\n * ## Props {@link PersistOnKeyProps}\n * - ?isHotkey, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistOnKey />\n * ```\n */\nexport const PersistOnKey = ({\n\tonPersistSuccess,\n\tonPersistError,\n\tisHotkey,\n}: PersistOnKeyProps) => {\n\tconst doPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\n\tuseEffect(() => {\n\t\tconst shouldHandleHotkey = isHotkey ?? defaultHotkeyCheck\n\n\t\tconst listener = (event: KeyboardEvent) => {\n\t\t\tif (shouldHandleHotkey(event)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tdoPersist()\n\t\t\t}\n\t\t}\n\n\t\tdocument.body.addEventListener('keydown', listener)\n\t\treturn () => {\n\t\t\tdocument.body.removeEventListener('keydown', listener)\n\t\t}\n\t}, [doPersist, isHotkey]) // Re-run effect if these change\n\n\treturn null\n}\n\n// Default hotkey check: ctrl+s or command+s\nconst defaultHotkeyCheck = (event: KeyboardEvent) => {\n\treturn (\n\t\t(event.ctrlKey || event.metaKey)\n\t\t&& event.key.toLowerCase() === 's'\n\t)\n}\n"],"names":[],"mappings":";;AA+BO,MAAM,eAAe,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AACD,MAAyB;AACxB,QAAM,YAAY,oBAAoB,EAAE,gBAAgB,kBAAkB;AAE1E,YAAU,MAAM;AACf,UAAM,qBAAqB,YAAY;AAEvC,UAAM,WAAW,CAAC,UAAyB;AAC1C,UAAI,mBAAmB,KAAK,GAAG;AAC9B,cAAM,eAAA;AACN,kBAAA;AAAA,MACD;AAAA,IACD;AAEA,aAAS,KAAK,iBAAiB,WAAW,QAAQ;AAClD,WAAO,MAAM;AACZ,eAAS,KAAK,oBAAoB,WAAW,QAAQ;AAAA,IACtD;AAAA,EACD,GAAG,CAAC,WAAW,QAAQ,CAAC;AAExB,SAAO;AACR;AAGA,MAAM,qBAAqB,CAAC,UAAyB;AACpD,UACE,MAAM,WAAW,MAAM,YACrB,MAAM,IAAI,kBAAkB;AAEjC;"}
|
|
@@ -27,7 +27,7 @@ const PersistTrigger = ({ onPersistError, onPersistSuccess, ...props }) => {
|
|
|
27
27
|
false,
|
|
28
28
|
{
|
|
29
29
|
fileName: "/home/runner/work/contember/contember/packages/react-binding/src/helperComponents/persist/PersistTrigger.tsx",
|
|
30
|
-
lineNumber:
|
|
30
|
+
lineNumber: 56,
|
|
31
31
|
columnNumber: 3
|
|
32
32
|
},
|
|
33
33
|
void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistTrigger.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistTrigger.tsx"],"sourcesContent":["import { ReactElement } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\nimport { useDecoratedPersist } from './useDecoratedPersist'\nimport { ErrorPersistResult, SuccessfulPersistResult } from '@contember/binding'\nimport { useDirtinessState, useMutationState } from '../../accessorTree'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nexport interface PersistTriggerAttributes {\n\t['data-dirty']?: ''\n\t['data-loading']?: ''\n}\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<\n\tReact.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement> & PersistTriggerAttributes\n>\n\nexport interface PersistTriggerProps {\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * A button that triggers persist when clicked.\n *\n * ## Props {@link PersistTriggerProps}\n * - children, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistTrigger>\n * <button>Save</button>\n * </PersistTrigger>\n * ```\n */\nexport const PersistTrigger = ({ onPersistError, onPersistSuccess, ...props }: PersistTriggerProps) => {\n\tconst isMutating = useMutationState()\n\tconst isDirty = useDirtinessState()\n\tconst triggerPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\n\tconst isDisabled = isMutating || !isDirty\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn (\n\t\t<SlotType\n\t\t\tdisabled={isDisabled}\n\t\t\tdata-dirty={dataAttribute(isDirty)}\n\t\t\tdata-loading={dataAttribute(isMutating)}\n\t\t\tonClick={composeEventHandlers(triggerPersist, onClick)}\n\t\t\t{...otherProps}\n\t\t/>\n\t)\n}\n"],"names":["Slot","useMutationState","useDirtinessState","useDecoratedPersist","jsxDEV","dataAttribute","composeEventHandlers","this"],"mappings":";;;;;;;;;AAaA,MAAM,WAAWA,UAAAA;
|
|
1
|
+
{"version":3,"file":"PersistTrigger.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/persist/PersistTrigger.tsx"],"sourcesContent":["import { ReactElement } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\nimport { useDecoratedPersist } from './useDecoratedPersist.js'\nimport { ErrorPersistResult, SuccessfulPersistResult } from '@contember/binding'\nimport { useDirtinessState, useMutationState } from '../../accessorTree/index.js'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nexport interface PersistTriggerAttributes {\n\t['data-dirty']?: ''\n\t['data-loading']?: ''\n}\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<\n\tReact.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement> & PersistTriggerAttributes\n>\n\nexport interface PersistTriggerProps {\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n\t/**\n\t * Callback that is called when persist is successful.\n\t */\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\t/**\n\t * Callback that is called when an error occurs during persist.\n\t */\n\tonPersistError?: (result: ErrorPersistResult) => void\n}\n\n/**\n * A button that triggers persist when clicked.\n *\n * ## Props {@link PersistTriggerProps}\n * - children, ?onPersistError, ?onPersistSuccess\n *\n * ## Example\n * ```tsx\n * <PersistTrigger>\n * <button>Save</button>\n * </PersistTrigger>\n * ```\n */\nexport const PersistTrigger = ({ onPersistError, onPersistSuccess, ...props }: PersistTriggerProps) => {\n\tconst isMutating = useMutationState()\n\tconst isDirty = useDirtinessState()\n\tconst triggerPersist = useDecoratedPersist({ onPersistError, onPersistSuccess })\n\n\tconst isDisabled = isMutating || !isDirty\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn (\n\t\t<SlotType\n\t\t\tdisabled={isDisabled}\n\t\t\tdata-dirty={dataAttribute(isDirty)}\n\t\t\tdata-loading={dataAttribute(isMutating)}\n\t\t\tonClick={composeEventHandlers(triggerPersist, onClick)}\n\t\t\t{...otherProps}\n\t\t/>\n\t)\n}\n"],"names":["Slot","useMutationState","useDirtinessState","useDecoratedPersist","jsxDEV","dataAttribute","composeEventHandlers","this"],"mappings":";;;;;;;;;AAaA,MAAM,WAAWA,UAAAA;AAgCV,MAAM,iBAAiB,CAAC,EAAE,gBAAgB,kBAAkB,GAAG,YAAiC;AACtG,QAAM,aAAaC,iBAAAA,iBAAA;AACnB,QAAM,UAAUC,kBAAAA,kBAAA;AAChB,QAAM,iBAAiBC,oBAAAA,oBAAoB,EAAE,gBAAgB,kBAAkB;AAE/E,QAAM,aAAa,cAAc,CAAC;AAElC,QAAM,EAAE,SAAS,GAAG,WAAA,IAAe;AAEnC,SACCC,8BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACA,UAAU;AAAA,MACV,cAAYC,UAAAA,cAAc,OAAO;AAAA,MACjC,gBAAcA,UAAAA,cAAc,UAAU;AAAA,MACtC,SAASC,UAAAA,qBAAqB,gBAAgB,OAAO;AAAA,MACpD,GAAG;AAAA,IAAA;AAAA,IALL;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AAQF;;"}
|
|
@@ -25,7 +25,7 @@ const PersistTrigger = ({ onPersistError, onPersistSuccess, ...props }) => {
|
|
|
25
25
|
false,
|
|
26
26
|
{
|
|
27
27
|
fileName: "/home/runner/work/contember/contember/packages/react-binding/src/helperComponents/persist/PersistTrigger.tsx",
|
|
28
|
-
lineNumber:
|
|
28
|
+
lineNumber: 56,
|
|
29
29
|
columnNumber: 3
|
|
30
30
|
},
|
|
31
31
|
void 0
|