@contember/react-binding 1.3.0-alpha.6 → 1.3.0-alpha.8
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/MarkerTreeGenerator.cjs +2 -2
- package/dist/development/MarkerTreeGenerator.cjs.map +1 -1
- package/dist/development/MarkerTreeGenerator.js +2 -2
- package/dist/development/MarkerTreeGenerator.js.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
- package/dist/development/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/development/accessorPropagation/EnvironmentContext.cjs +4 -4
- package/dist/development/accessorPropagation/EnvironmentContext.cjs.map +1 -1
- package/dist/development/accessorPropagation/EnvironmentContext.js +4 -4
- package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/development/accessorPropagation/useExtendTree.cjs.map +1 -1
- package/dist/development/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.cjs +9 -9
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +9 -9
- package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
- package/dist/development/accessorSorting/errors.cjs.map +1 -1
- package/dist/development/accessorSorting/errors.js.map +1 -1
- package/dist/development/accessorTree/AccessorTree.cjs +5 -5
- package/dist/development/accessorTree/AccessorTree.cjs.map +1 -1
- package/dist/development/accessorTree/AccessorTree.js +5 -5
- package/dist/development/accessorTree/AccessorTree.js.map +1 -1
- package/dist/development/accessorTree/useDataBinding.cjs.map +1 -1
- package/dist/development/accessorTree/useDataBinding.js.map +1 -1
- package/dist/development/coreComponents/Component.cjs.map +1 -1
- package/dist/development/coreComponents/Component.js.map +1 -1
- package/dist/development/coreComponents/Entity.cjs +1 -1
- package/dist/development/coreComponents/Entity.cjs.map +1 -1
- package/dist/development/coreComponents/Entity.js +1 -1
- package/dist/development/coreComponents/Entity.js.map +1 -1
- package/dist/development/coreComponents/EntityList.cjs +3 -3
- package/dist/development/coreComponents/EntityList.cjs.map +1 -1
- package/dist/development/coreComponents/EntityList.js +3 -3
- package/dist/development/coreComponents/EntityList.js.map +1 -1
- package/dist/development/coreComponents/EntityListSubTree.cjs +3 -3
- package/dist/development/coreComponents/EntityListSubTree.cjs.map +1 -1
- package/dist/development/coreComponents/EntityListSubTree.js +3 -3
- package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
- package/dist/development/coreComponents/EntitySubTree.cjs +5 -5
- package/dist/development/coreComponents/EntitySubTree.cjs.map +1 -1
- package/dist/development/coreComponents/EntitySubTree.js +5 -5
- package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
- package/dist/development/coreComponents/Field.cjs +2 -2
- package/dist/development/coreComponents/Field.cjs.map +1 -1
- package/dist/development/coreComponents/Field.js +2 -2
- package/dist/development/coreComponents/Field.js.map +1 -1
- package/dist/development/coreComponents/HasMany.cjs +3 -3
- package/dist/development/coreComponents/HasMany.cjs.map +1 -1
- package/dist/development/coreComponents/HasMany.js +3 -3
- package/dist/development/coreComponents/HasMany.js.map +1 -1
- package/dist/development/coreComponents/HasOne.cjs +3 -3
- package/dist/development/coreComponents/HasOne.cjs.map +1 -1
- package/dist/development/coreComponents/HasOne.js +3 -3
- package/dist/development/coreComponents/HasOne.js.map +1 -1
- package/dist/development/coreComponents/ParentEntity.cjs +1 -1
- package/dist/development/coreComponents/ParentEntity.cjs.map +1 -1
- package/dist/development/coreComponents/ParentEntity.js +1 -1
- package/dist/development/coreComponents/ParentEntity.js.map +1 -1
- package/dist/development/helperComponents/DeferredSubTrees.cjs +4 -4
- package/dist/development/helperComponents/DeferredSubTrees.cjs.map +1 -1
- package/dist/development/helperComponents/DeferredSubTrees.js +4 -4
- package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
- package/dist/development/helperComponents/FieldView.cjs +3 -3
- package/dist/development/helperComponents/FieldView.cjs.map +1 -1
- package/dist/development/helperComponents/FieldView.js +3 -3
- package/dist/development/helperComponents/FieldView.js.map +1 -1
- package/dist/development/helperComponents/If.cjs +8 -8
- package/dist/development/helperComponents/If.cjs.map +1 -1
- package/dist/development/helperComponents/If.js +8 -8
- package/dist/development/helperComponents/If.js.map +1 -1
- package/dist/development/helperComponents/LabelMiddleware.cjs +1 -1
- package/dist/development/helperComponents/LabelMiddleware.cjs.map +1 -1
- package/dist/development/helperComponents/LabelMiddleware.js +1 -1
- package/dist/development/helperComponents/LabelMiddleware.js.map +1 -1
- package/dist/development/helperComponents/StaticRender.cjs +1 -1
- package/dist/development/helperComponents/StaticRender.cjs.map +1 -1
- package/dist/development/helperComponents/StaticRender.js +1 -1
- package/dist/development/helperComponents/StaticRender.js.map +1 -1
- package/dist/development/helperComponents/SugaredField.cjs +2 -2
- package/dist/development/helperComponents/SugaredField.cjs.map +1 -1
- package/dist/development/helperComponents/SugaredField.js +2 -2
- package/dist/development/helperComponents/SugaredField.js.map +1 -1
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.cjs.map +1 -1
- package/dist/development/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/development/index.cjs +1 -1
- package/dist/production/MarkerTreeGenerator.cjs +2 -2
- package/dist/production/MarkerTreeGenerator.cjs.map +1 -1
- package/dist/production/MarkerTreeGenerator.js +2 -2
- package/dist/production/MarkerTreeGenerator.js.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
- package/dist/production/accessorPropagation/BindingOperationsContext.js.map +1 -1
- package/dist/production/accessorPropagation/EnvironmentContext.cjs.map +1 -1
- package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
- package/dist/production/accessorPropagation/useExtendTree.cjs.map +1 -1
- package/dist/production/accessorPropagation/useExtendTree.js.map +1 -1
- package/dist/production/accessorSorting/errors.cjs.map +1 -1
- package/dist/production/accessorSorting/errors.js.map +1 -1
- package/dist/production/accessorTree/useDataBinding.cjs.map +1 -1
- package/dist/production/accessorTree/useDataBinding.js.map +1 -1
- package/dist/production/coreComponents/Component.cjs.map +1 -1
- package/dist/production/coreComponents/Component.js.map +1 -1
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.cjs.map +1 -1
- package/dist/production/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
- package/dist/production/index.cjs +1 -1
- package/dist/types/accessorPropagation/AccessorProvider.d.ts +1 -1
- package/dist/types/accessorPropagation/AccessorProvider.d.ts.map +1 -1
- package/dist/types/accessorPropagation/BindingOperationsProvider.d.ts +1 -1
- package/dist/types/accessorPropagation/BindingOperationsProvider.d.ts.map +1 -1
- package/dist/types/accessorPropagation/EntityKeyProvider.d.ts +1 -1
- package/dist/types/accessorPropagation/EntityKeyProvider.d.ts.map +1 -1
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts +2 -2
- package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -1
- package/dist/types/accessorPropagation/TreeRootIdProvider.d.ts +1 -1
- package/dist/types/accessorPropagation/TreeRootIdProvider.d.ts.map +1 -1
- package/dist/types/accessorTree/AccessorTree.d.ts +1 -1
- package/dist/types/coreComponents/Component.d.ts +3 -3
- package/dist/types/coreComponents/Component.d.ts.map +1 -1
- package/dist/types/coreComponents/MarkerProvider.d.ts +2 -2
- package/dist/types/coreComponents/MarkerProvider.d.ts.map +1 -1
- package/dist/types/helperComponents/EntityView.d.ts +1 -1
- package/dist/types/helperComponents/EntityView.d.ts.map +1 -1
- package/dist/types/helperComponents/LabelMiddleware.d.ts +1 -1
- package/dist/types/helperComponents/LabelMiddleware.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/accessorPropagation/EnvironmentContext.tsx +2 -2
- package/src/coreComponents/Component.tsx +4 -7
- package/src/coreComponents/MarkerProvider.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataBinding.cjs","sources":["../../../src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, Schema, SchemaLoader, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../MarkerTreeGenerator'\nimport ReactDOM from 'react-dom'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\tconst [schema, setSchema] = useState<Schema>()\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'setData', data, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'failWithError', error, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tdispatch({ type: 'reset', binding, environment })\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, {\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\ttype: 'failWithError',\n\t\t\t\t\t\terror: e,\n\t\t\t\t\t\tbinding: state.binding!,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, isMountedRef, schema, state.binding])\n\n\tuseEffect(() => {\n\t\tif (schema) {\n\t\t\tresetDataBinding(environment.withSchema(schema), false)\n\t\t}\n\t}, [resetDataBinding, schema, environment])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["useCurrentContentGraphQlClient","useCurrentSystemGraphQlClient","useTenantGraphQlClient","useEnvironment","useRef","useIsMounted","useState","useCallback","environment","binding","TreeStore","DataBinding","MarkerTreeGenerator","useReducer","accessorTreeStateReducer","useEffect","SchemaLoader","GraphQlClientError"],"mappings":";;;;;;;;;;AAiBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAAmD;AAClD,QAAM,gBAAgBA,YAAAA;AACtB,QAAM,eAAeC,YAAAA;AACrB,QAAM,eAAeC,YAAAA;AACrB,QAAM,cAAcC,eAAAA;AACpB,QAAM,mBAAmBC,MAAAA;AACzB,QAAM,eAAeC,WAAAA;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAIC,MAAiB,SAAA;AAE7C,QAAM,mBAAmBC,MAAAA,YAAY,CAACC,cAA0B,aAAsB;AAC/E,UAAA,WAAW,CAAC,MAAmCC,aAAoC;AACxF,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,WAAW,MAAM,SAAAA,UAAS;AAAA,MAC5C;AAAA,IAAA;AAGK,UAAA,UAAU,CAAC,OAA2BA,aAAoC;AAC/E,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,iBAAiB,OAAO,SAAAA,UAAS;AAAA,MACnD;AAAA,IAAA;AAGD,UAAM,mBAAmB,MAAM;AAC1B,UAAA,aAAa,WAAW,kBAAkB;AAC7C,yBAAiBD,cAAa,IAAI;AAAA,MACnC;AAAA,IAAA;AAGG,QAAA,iBAAiB,YAAY,UAAa,UAAU;AACvD,uBAAiB,UAAU,IAAIE,QAAAA,UAAUF,aAAY,UAAW,CAAA;AAAA,IACjE;AAEA,UAAMC,YAAU,IAAIE,QAAA;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjBH;AAAAA,MACA,CAAC,MAAM,QAAQ;AACd,cAAM,MAAM,IAAII,oBAAAA,oBAAoB,MAAM,GAAG;AAC7C,eAAO,IAAI;MACZ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,+BAA+B;AAAA,MAC7D;AAAA,IAAA;AAED,aAAS,EAAE,MAAM,SAAA,SAASH,WAAS,aAAAD,cAAa;AAAA,EAAA,GAC9C,CAAC,eAAe,cAAc,cAAc,cAAc,kBAAkB,2BAA2B,CAAC;AAE3G,QAAM,CAAC,OAAO,QAAQ,IAAIK,MAAAA,WAAWC,yBAAAA,0BAA0B;AAAA,IAC9D,MAAM;AAAA,IACN;AAAA,EAAA,CACA;AAEDC,QAAAA,UAAU,MAAM;AACf,QAAI,WAAW,QAAW;AACzB;AAAA,IACD;AAEA,KAAC,YAAY;AACR,UAAA;AACH,kBAAU,MAAMC,QAAA,aAAa,WAAW,aAAa,CAAC;AAAA,eAE9C;
|
|
1
|
+
{"version":3,"file":"useDataBinding.cjs","sources":["../../../src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, Schema, SchemaLoader, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../MarkerTreeGenerator'\nimport ReactDOM from 'react-dom'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\tconst [schema, setSchema] = useState<Schema>()\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'setData', data, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'failWithError', error, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tdispatch({ type: 'reset', binding, environment })\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, {\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\ttype: 'failWithError',\n\t\t\t\t\t\terror: e,\n\t\t\t\t\t\tbinding: state.binding!,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, isMountedRef, schema, state.binding])\n\n\tuseEffect(() => {\n\t\tif (schema) {\n\t\t\tresetDataBinding(environment.withSchema(schema), false)\n\t\t}\n\t}, [resetDataBinding, schema, environment])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["useCurrentContentGraphQlClient","useCurrentSystemGraphQlClient","useTenantGraphQlClient","useEnvironment","useRef","useIsMounted","useState","useCallback","environment","binding","TreeStore","DataBinding","MarkerTreeGenerator","useReducer","accessorTreeStateReducer","useEffect","SchemaLoader","GraphQlClientError"],"mappings":";;;;;;;;;;AAiBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAAmD;AAClD,QAAM,gBAAgBA,YAAAA;AACtB,QAAM,eAAeC,YAAAA;AACrB,QAAM,eAAeC,YAAAA;AACrB,QAAM,cAAcC,eAAAA;AACpB,QAAM,mBAAmBC,MAAAA;AACzB,QAAM,eAAeC,WAAAA;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAIC,MAAiB,SAAA;AAE7C,QAAM,mBAAmBC,MAAAA,YAAY,CAACC,cAA0B,aAAsB;AAC/E,UAAA,WAAW,CAAC,MAAmCC,aAAoC;AACxF,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,WAAW,MAAM,SAAAA,UAAS;AAAA,MAC5C;AAAA,IAAA;AAGK,UAAA,UAAU,CAAC,OAA2BA,aAAoC;AAC/E,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,iBAAiB,OAAO,SAAAA,UAAS;AAAA,MACnD;AAAA,IAAA;AAGD,UAAM,mBAAmB,MAAM;AAC1B,UAAA,aAAa,WAAW,kBAAkB;AAC7C,yBAAiBD,cAAa,IAAI;AAAA,MACnC;AAAA,IAAA;AAGG,QAAA,iBAAiB,YAAY,UAAa,UAAU;AACvD,uBAAiB,UAAU,IAAIE,QAAAA,UAAUF,aAAY,UAAW,CAAA;AAAA,IACjE;AAEA,UAAMC,YAAU,IAAIE,QAAA;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjBH;AAAAA,MACA,CAAC,MAAM,QAAQ;AACd,cAAM,MAAM,IAAII,oBAAAA,oBAAoB,MAAM,GAAG;AAC7C,eAAO,IAAI;MACZ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,+BAA+B;AAAA,MAC7D;AAAA,IAAA;AAED,aAAS,EAAE,MAAM,SAAA,SAASH,WAAS,aAAAD,cAAa;AAAA,EAAA,GAC9C,CAAC,eAAe,cAAc,cAAc,cAAc,kBAAkB,2BAA2B,CAAC;AAE3G,QAAM,CAAC,OAAO,QAAQ,IAAIK,MAAAA,WAAWC,yBAAAA,0BAA0B;AAAA,IAC9D,MAAM;AAAA,IACN;AAAA,EAAA,CACA;AAEDC,QAAAA,UAAU,MAAM;AACf,QAAI,WAAW,QAAW;AACzB;AAAA,IACD;AAEA,KAAC,YAAY;AACR,UAAA;AACH,kBAAU,MAAMC,QAAA,aAAa,WAAW,aAAa,CAAC;AAAA,eAE9C,GAAG;AACX,YAAI,aAAaC,YAAAA,oBAAoB;AAChC,cAAA,EAAE,SAAS,WAAW;AACzB;AAAA,UACD;AACS,mBAAA;AAAA,YACR,MAAM;AAAA,YACN,OAAO;AAAA,YACP,SAAS,MAAM;AAAA,UAAA,CACf;AAAA,QAAA,OACK;AACA,gBAAA;AAAA,QACP;AAAA,MACD;AAAA,IAAA;EACE,GACD,CAAC,eAAe,cAAc,QAAQ,MAAM,OAAO,CAAC;AAEvDF,QAAAA,UAAU,MAAM;AACf,QAAI,QAAQ;AACX,uBAAiB,YAAY,WAAW,MAAM,GAAG,KAAK;AAAA,IACvD;AAAA,EACE,GAAA,CAAC,kBAAkB,QAAQ,WAAW,CAAC;AAE1CA,QAAAA,UAAU,MAAM;AACT,UAAA,SAAS,WAAW,QAAQ;AAAA,EAChC,GAAA,CAAC,UAAU,MAAM,OAAO,CAAC;AAErB,SAAA;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataBinding.js","sources":["../../../src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, Schema, SchemaLoader, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../MarkerTreeGenerator'\nimport ReactDOM from 'react-dom'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\tconst [schema, setSchema] = useState<Schema>()\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'setData', data, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'failWithError', error, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tdispatch({ type: 'reset', binding, environment })\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, {\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\ttype: 'failWithError',\n\t\t\t\t\t\terror: e,\n\t\t\t\t\t\tbinding: state.binding!,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, isMountedRef, schema, state.binding])\n\n\tuseEffect(() => {\n\t\tif (schema) {\n\t\t\tresetDataBinding(environment.withSchema(schema), false)\n\t\t}\n\t}, [resetDataBinding, schema, environment])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["environment","binding"],"mappings":";;;;;;;;AAiBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAAmD;AAClD,QAAM,gBAAgB;AACtB,QAAM,eAAe;AACrB,QAAM,eAAe;AACrB,QAAM,cAAc;AACpB,QAAM,mBAAmB;AACzB,QAAM,eAAe;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAiB;AAE7C,QAAM,mBAAmB,YAAY,CAACA,cAA0B,aAAsB;AAC/E,UAAA,WAAW,CAAC,MAAmCC,aAAoC;AACxF,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,WAAW,MAAM,SAAAA,UAAS;AAAA,MAC5C;AAAA,IAAA;AAGK,UAAA,UAAU,CAAC,OAA2BA,aAAoC;AAC/E,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,iBAAiB,OAAO,SAAAA,UAAS;AAAA,MACnD;AAAA,IAAA;AAGD,UAAM,mBAAmB,MAAM;AAC1B,UAAA,aAAa,WAAW,kBAAkB;AAC7C,yBAAiBD,cAAa,IAAI;AAAA,MACnC;AAAA,IAAA;AAGG,QAAA,iBAAiB,YAAY,UAAa,UAAU;AACvD,uBAAiB,UAAU,IAAI,UAAUA,aAAY,UAAW,CAAA;AAAA,IACjE;AAEA,UAAM,UAAU,IAAI;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjBA;AAAAA,MACA,CAAC,MAAM,QAAQ;AACd,cAAM,MAAM,IAAI,oBAAoB,MAAM,GAAG;AAC7C,eAAO,IAAI;MACZ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,+BAA+B;AAAA,MAC7D;AAAA,IAAA;AAED,aAAS,EAAE,MAAM,SAAS,SAAS,aAAAA,cAAa;AAAA,EAAA,GAC9C,CAAC,eAAe,cAAc,cAAc,cAAc,kBAAkB,2BAA2B,CAAC;AAE3G,QAAM,CAAC,OAAO,QAAQ,IAAI,WAAW,0BAA0B;AAAA,IAC9D,MAAM;AAAA,IACN;AAAA,EAAA,CACA;AAED,YAAU,MAAM;AACf,QAAI,WAAW,QAAW;AACzB;AAAA,IACD;AAEA,KAAC,YAAY;AACR,UAAA;AACH,kBAAU,MAAM,aAAa,WAAW,aAAa,CAAC;AAAA,eAE9C;
|
|
1
|
+
{"version":3,"file":"useDataBinding.js","sources":["../../../src/accessorTree/useDataBinding.ts"],"sourcesContent":["import {\n\tGraphQlClientError,\n\tuseCurrentContentGraphQlClient,\n\tuseCurrentSystemGraphQlClient,\n\tuseTenantGraphQlClient,\n} from '@contember/react-client'\nimport { ReactNode, useCallback, useEffect, useReducer, useRef, useState } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { TreeRootAccessor } from '@contember/binding'\nimport { DataBinding, Environment, Schema, SchemaLoader, TreeStore } from '@contember/binding'\nimport type { AccessorTreeState } from './AccessorTreeState'\nimport type { AccessorTreeStateOptions } from './AccessorTreeStateOptions'\nimport { accessorTreeStateReducer } from './accessorTreeStateReducer'\nimport { useIsMounted } from '@contember/react-utils'\nimport { MarkerTreeGenerator } from '../MarkerTreeGenerator'\nimport ReactDOM from 'react-dom'\n\nexport const useDataBinding = ({\n\tchildren,\n\trefreshOnPersist,\n\tskipStateUpdateAfterPersist,\n}: AccessorTreeStateOptions): AccessorTreeState => {\n\tconst contentClient = useCurrentContentGraphQlClient()\n\tconst systemClient = useCurrentSystemGraphQlClient()\n\tconst tenantClient = useTenantGraphQlClient()\n\tconst environment = useEnvironment()\n\tconst currentTreeStore = useRef<TreeStore>()\n\tconst isMountedRef = useIsMounted()\n\tconst [schema, setSchema] = useState<Schema>()\n\n\tconst resetDataBinding = useCallback((environment: Environment, newStore: boolean) => {\n\t\tconst onUpdate = (data: TreeRootAccessor<ReactNode>, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'setData', data, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onError = (error: GraphQlClientError, binding: DataBinding<ReactNode>) => {\n\t\t\tif (isMountedRef.current) {\n\t\t\t\tdispatch({ type: 'failWithError', error, binding })\n\t\t\t}\n\t\t}\n\n\t\tconst onPersistSuccess = () => {\n\t\t\tif (isMountedRef.current && refreshOnPersist) {\n\t\t\t\tresetDataBinding(environment, true)\n\t\t\t}\n\t\t}\n\n\t\tif (currentTreeStore.current === undefined || newStore) {\n\t\t\tcurrentTreeStore.current = new TreeStore(environment.getSchema())\n\t\t}\n\n\t\tconst binding = new DataBinding(\n\t\t\tcontentClient,\n\t\t\tsystemClient,\n\t\t\ttenantClient,\n\t\t\tcurrentTreeStore.current,\n\t\t\tenvironment,\n\t\t\t(node, env) => {\n\t\t\t\tconst gen = new MarkerTreeGenerator(node, env)\n\t\t\t\treturn gen.generate()\n\t\t\t},\n\t\t\tReactDOM.unstable_batchedUpdates,\n\t\t\tonUpdate,\n\t\t\tonError,\n\t\t\tonPersistSuccess,\n\t\t\t{\n\t\t\t\tskipStateUpdateAfterPersist: skipStateUpdateAfterPersist ?? false,\n\t\t\t},\n\t\t)\n\t\tdispatch({ type: 'reset', binding, environment })\n\t}, [contentClient, systemClient, tenantClient, isMountedRef, refreshOnPersist, skipStateUpdateAfterPersist])\n\n\tconst [state, dispatch] = useReducer(accessorTreeStateReducer, {\n\t\tname: 'initializing',\n\t\tenvironment,\n\t})\n\n\tuseEffect(() => {\n\t\tif (schema !== undefined) {\n\t\t\treturn\n\t\t}\n\n\t\t(async () => {\n\t\t\ttry {\n\t\t\t\tsetSchema(await SchemaLoader.loadSchema(contentClient))\n\n\t\t\t} catch (e) {\n\t\t\t\tif (e instanceof GraphQlClientError) {\n\t\t\t\t\tif (e.type === 'aborted') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\ttype: 'failWithError',\n\t\t\t\t\t\terror: e,\n\t\t\t\t\t\tbinding: state.binding!,\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tthrow e\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [contentClient, isMountedRef, schema, state.binding])\n\n\tuseEffect(() => {\n\t\tif (schema) {\n\t\t\tresetDataBinding(environment.withSchema(schema), false)\n\t\t}\n\t}, [resetDataBinding, schema, environment])\n\n\tuseEffect(() => {\n\t\tstate.binding?.extendTree(children)\n\t}, [children, state.binding])\n\n\treturn state\n}\n"],"names":["environment","binding"],"mappings":";;;;;;;;AAiBO,MAAM,iBAAiB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,MAAmD;AAClD,QAAM,gBAAgB;AACtB,QAAM,eAAe;AACrB,QAAM,eAAe;AACrB,QAAM,cAAc;AACpB,QAAM,mBAAmB;AACzB,QAAM,eAAe;AACrB,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAiB;AAE7C,QAAM,mBAAmB,YAAY,CAACA,cAA0B,aAAsB;AAC/E,UAAA,WAAW,CAAC,MAAmCC,aAAoC;AACxF,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,WAAW,MAAM,SAAAA,UAAS;AAAA,MAC5C;AAAA,IAAA;AAGK,UAAA,UAAU,CAAC,OAA2BA,aAAoC;AAC/E,UAAI,aAAa,SAAS;AACzB,iBAAS,EAAE,MAAM,iBAAiB,OAAO,SAAAA,UAAS;AAAA,MACnD;AAAA,IAAA;AAGD,UAAM,mBAAmB,MAAM;AAC1B,UAAA,aAAa,WAAW,kBAAkB;AAC7C,yBAAiBD,cAAa,IAAI;AAAA,MACnC;AAAA,IAAA;AAGG,QAAA,iBAAiB,YAAY,UAAa,UAAU;AACvD,uBAAiB,UAAU,IAAI,UAAUA,aAAY,UAAW,CAAA;AAAA,IACjE;AAEA,UAAM,UAAU,IAAI;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjBA;AAAAA,MACA,CAAC,MAAM,QAAQ;AACd,cAAM,MAAM,IAAI,oBAAoB,MAAM,GAAG;AAC7C,eAAO,IAAI;MACZ;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACC,6BAA6B,+BAA+B;AAAA,MAC7D;AAAA,IAAA;AAED,aAAS,EAAE,MAAM,SAAS,SAAS,aAAAA,cAAa;AAAA,EAAA,GAC9C,CAAC,eAAe,cAAc,cAAc,cAAc,kBAAkB,2BAA2B,CAAC;AAE3G,QAAM,CAAC,OAAO,QAAQ,IAAI,WAAW,0BAA0B;AAAA,IAC9D,MAAM;AAAA,IACN;AAAA,EAAA,CACA;AAED,YAAU,MAAM;AACf,QAAI,WAAW,QAAW;AACzB;AAAA,IACD;AAEA,KAAC,YAAY;AACR,UAAA;AACH,kBAAU,MAAM,aAAa,WAAW,aAAa,CAAC;AAAA,eAE9C,GAAG;AACX,YAAI,aAAa,oBAAoB;AAChC,cAAA,EAAE,SAAS,WAAW;AACzB;AAAA,UACD;AACS,mBAAA;AAAA,YACR,MAAM;AAAA,YACN,OAAO;AAAA,YACP,SAAS,MAAM;AAAA,UAAA,CACf;AAAA,QAAA,OACK;AACA,gBAAA;AAAA,QACP;AAAA,MACD;AAAA,IAAA;EACE,GACD,CAAC,eAAe,cAAc,QAAQ,MAAM,OAAO,CAAC;AAEvD,YAAU,MAAM;AACf,QAAI,QAAQ;AACX,uBAAiB,YAAY,WAAW,MAAM,GAAG,KAAK;AAAA,IACvD;AAAA,EACE,GAAA,CAAC,kBAAkB,QAAQ,WAAW,CAAC;AAE1C,YAAU,MAAM;AACT,UAAA,SAAS,WAAW,QAAQ;AAAA,EAChC,GAAA,CAAC,UAAU,MAAM,OAAO,CAAC;AAErB,SAAA;AACR;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.cjs","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment):
|
|
1
|
+
{"version":3,"file":"Component.cjs","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement, ReactNode } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactNode;\n\tdisplayName?: string | undefined;\n}\n\nfunction Component<Props extends {}>(\n\tstatelessRender: EnvironmentAwareFunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tstaticRender: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: EnvironmentAwareFunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tconst RenderWithEnv = (props: Props) => render(props, useEnvironment())\n\tconst renderWithEnv = typeof render !== 'function' || render.length < 2 ? render : RenderWithEnv\n\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(renderWithEnv)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(renderWithEnv)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport type { EnvironmentAwareFunctionComponent }\nexport { Component }\n"],"names":["useEnvironment","augmentedRender","memo","assertNever"],"mappings":";;;;;AA4BA,SAAS,UACR,QACA,SAIA,aACC;AACD,QAAM,gBAAgB,CAAC,UAAiB,OAAO,OAAOA,+BAAgB;AACtE,QAAM,gBAAgB,OAAO,WAAW,cAAc,OAAO,SAAS,IAAI,SAAS;AAEnF,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACfC,UAAAA,mBAAuEC,WAAY,aAAa;AACtGD,qBAAgB,eAAe;AAC/BA,qBAAgB,cAAc;AAEvBA,WAAAA;AAAAA,EACR;AAEA,SAAO,cAAc;AACf,QAAA,kBAA2FC,WAAY,aAAa;AAC1H,kBAAgB,cAAc;AAE1B,MAAA,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAExB,WAAA;AAAA,EACR;AACI,MAAA,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AACjB,sBAAgB,UAAU,IAC3B,QAAQ,UAAU;AAAA,IACpB;AAEO,WAAA;AAAA,EACR;AACAC,YAAA,YAAY,OAAO;AACpB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment):
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { memo, NamedExoticComponent, PropsWithChildren, ReactElement, ReactNode } from 'react'\nimport { useEnvironment } from '../accessorPropagation'\nimport type { Environment } from '@contember/binding'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\nimport { assertNever } from '@contember/utilities'\n\ninterface EnvironmentAwareFunctionComponent<P> {\n\t(props: PropsWithChildren<P>, environment: Environment): ReactNode;\n\tdisplayName?: string | undefined;\n}\n\nfunction Component<Props extends {}>(\n\tstatelessRender: EnvironmentAwareFunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tstaticRender: (props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: EnvironmentAwareFunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\n\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: EnvironmentAwareFunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactNode)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tconst RenderWithEnv = (props: Props) => render(props, useEnvironment())\n\tconst renderWithEnv = typeof render !== 'function' || render.length < 2 ? render : RenderWithEnv\n\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(renderWithEnv)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(renderWithEnv)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport type { EnvironmentAwareFunctionComponent }\nexport { Component }\n"],"names":["augmentedRender"],"mappings":";;;AA4BA,SAAS,UACR,QACA,SAIA,aACC;AACD,QAAM,gBAAgB,CAAC,UAAiB,OAAO,OAAO,gBAAgB;AACtE,QAAM,gBAAgB,OAAO,WAAW,cAAc,OAAO,SAAS,IAAI,SAAS;AAEnF,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACfA,UAAAA,mBAAuE,KAAY,aAAa;AACtGA,qBAAgB,eAAe;AAC/BA,qBAAgB,cAAc;AAEvBA,WAAAA;AAAAA,EACR;AAEA,SAAO,cAAc;AACf,QAAA,kBAA2F,KAAY,aAAa;AAC1H,kBAAgB,cAAc;AAE1B,MAAA,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAExB,WAAA;AAAA,EACR;AACI,MAAA,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AACjB,sBAAgB,UAAU,IAC3B,QAAQ,UAAU;AAAA,IACpB;AAEO,WAAA;AAAA,EACR;AACA,cAAY,OAAO;AACpB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.cjs","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '@contember/binding'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\n/**\n * @group Data binding\n */\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":["Component","jsxDEV","AccessorProvider","this"],"mappings":";;;;;AAeO,MAAM,SAASA,UAAA;AAAA,EACrB,CAAC,EAAE,UAAU,eAA4B;AACzC;AAAA;AAAA,MAEEC,8BAAA,OAAAC,iBAAA,kBAAA,EAAiB,UAChB,SAAA,GADyC,UAAU,KAArD,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAEA,GAAAC,
|
|
1
|
+
{"version":3,"file":"Entity.cjs","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '@contember/binding'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\n/**\n * @group Data binding\n */\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":["Component","jsxDEV","AccessorProvider","this"],"mappings":";;;;;AAeO,MAAM,SAASA,UAAA;AAAA,EACrB,CAAC,EAAE,UAAU,eAA4B;AACzC;AAAA;AAAA,MAEEC,8BAAA,OAAAC,iBAAA,kBAAA,EAAiB,UAChB,SAAA,GADyC,UAAU,KAArD,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAEA,GAAAC,MAAA;AAAA;AAAA,EAED;AAAA,EACA;AACD;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '@contember/binding'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\n/**\n * @group Data binding\n */\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":["this"],"mappings":";;;AAeO,MAAM,SAAS;AAAA,EACrB,CAAC,EAAE,UAAU,eAA4B;AACzC;AAAA;AAAA,MAEE,uBAAA,kBAAA,EAAiB,UAChB,SAAA,GADyC,UAAU,KAArD,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAEA,GAAAA,
|
|
1
|
+
{"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '@contember/binding'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\n/**\n * @group Data binding\n */\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":["this"],"mappings":";;;AAeO,MAAM,SAAS;AAAA,EACrB,CAAC,EAAE,UAAU,eAA4B;AACzC;AAAA;AAAA,MAEE,uBAAA,kBAAA,EAAiB,UAChB,SAAA,GADyC,UAAU,KAArD,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAEA,GAAAA,MAAA;AAAA;AAAA,EAED;AAAA,EACA;AACD;"}
|
|
@@ -18,12 +18,12 @@ const EntityList = Component.Component(
|
|
|
18
18
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityList.tsx",
|
|
19
19
|
lineNumber: 36,
|
|
20
20
|
columnNumber: 7
|
|
21
|
-
},
|
|
21
|
+
}, void 0);
|
|
22
22
|
}) }, void 0, false, {
|
|
23
23
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityList.tsx",
|
|
24
24
|
lineNumber: 33,
|
|
25
25
|
columnNumber: 4
|
|
26
|
-
},
|
|
26
|
+
}, void 0);
|
|
27
27
|
},
|
|
28
28
|
(props) => {
|
|
29
29
|
if ("listComponent" in props && props.listComponent) {
|
|
@@ -37,7 +37,7 @@ const EntityList = Component.Component(
|
|
|
37
37
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityList.tsx",
|
|
38
38
|
lineNumber: 52,
|
|
39
39
|
columnNumber: 10
|
|
40
|
-
},
|
|
40
|
+
}, void 0);
|
|
41
41
|
},
|
|
42
42
|
"EntityList"
|
|
43
43
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityList.cjs","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":["Component","createElement","jsxDEV","Fragment","Entity","this"],"mappings":";;;;;;AAsBO,MAAM,aAAaA,UAAA;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAAC,MAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACA,WAEGC,8BAAA,OAAAC,wBAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,kDACEC,OAAAA,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,KAApB,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAEA,GAAAC,
|
|
1
|
+
{"version":3,"file":"EntityList.cjs","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":["Component","createElement","jsxDEV","Fragment","Entity","this"],"mappings":";;;;;;AAsBO,MAAM,aAAaA,UAAA;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAAC,MAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACA,WAEGC,8BAAA,OAAAC,wBAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,kDACEC,OAAAA,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,KAApB,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAEA,GAAAC,MAAA;AAAA,IAAA,CAED,EAPF,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAQA,GAAAA,MAAA;AAAA,EAEF;AAAA,EACA,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAAJ,MAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU;AAAA,QACV,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACO,WAAAC,8BAAA,OAAAC,cAAA,UAAA,EAAG,gBAAM,SAAT,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAkB,GAAAE,MAAA;AAAA,EAC1B;AAAA,EACA;AACD;;"}
|
|
@@ -16,12 +16,12 @@ const EntityList = Component(
|
|
|
16
16
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityList.tsx",
|
|
17
17
|
lineNumber: 36,
|
|
18
18
|
columnNumber: 7
|
|
19
|
-
},
|
|
19
|
+
}, void 0);
|
|
20
20
|
}) }, void 0, false, {
|
|
21
21
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityList.tsx",
|
|
22
22
|
lineNumber: 33,
|
|
23
23
|
columnNumber: 4
|
|
24
|
-
},
|
|
24
|
+
}, void 0);
|
|
25
25
|
},
|
|
26
26
|
(props) => {
|
|
27
27
|
if ("listComponent" in props && props.listComponent) {
|
|
@@ -35,7 +35,7 @@ const EntityList = Component(
|
|
|
35
35
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityList.tsx",
|
|
36
36
|
lineNumber: 52,
|
|
37
37
|
columnNumber: 10
|
|
38
|
-
},
|
|
38
|
+
}, void 0);
|
|
39
39
|
},
|
|
40
40
|
"EntityList"
|
|
41
41
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":["this"],"mappings":";;;;AAsBO,MAAM,aAAa;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACA,WAEG,uBAAA,UAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,oCACE,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,KAApB,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAEA,GAAAA,
|
|
1
|
+
{"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":["this"],"mappings":";;;;AAsBO,MAAM,aAAa;AAAA,EACzB,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU,MAAM;AAAA,QAChB,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACA,WAEG,uBAAA,UAAA,EAAA,UAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,oCACE,QAAwB,EAAA,UAAU,QACjC,UAAM,MAAA,SAAA,GADK,OAAO,KAApB,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAEA,GAAAA,MAAA;AAAA,IAAA,CAED,EAPF,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAQA,GAAAA,MAAA;AAAA,EAEF;AAAA,EACA,CAAuB,UAAsC;AACxD,QAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,aAAA,cAAc,MAAM,eAAe;AAAA,QACzC,GAAG,MAAM;AAAA,QACT,UAAU;AAAA,QACV,UAAU,MAAM;AAAA,MAAA,CAChB;AAAA,IACF;AACO,WAAA,uBAAA,UAAA,EAAG,gBAAM,SAAT,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAkB,GAAAA,MAAA;AAAA,EAC1B;AAAA,EACA;AACD;"}
|
|
@@ -24,7 +24,7 @@ const EntityListSubTree = Component.Component(
|
|
|
24
24
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityListSubTree.tsx",
|
|
25
25
|
lineNumber: 62,
|
|
26
26
|
columnNumber: 10
|
|
27
|
-
},
|
|
27
|
+
}, void 0);
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
generateBranchMarker: (props, fields, environment) => {
|
|
@@ -38,13 +38,13 @@ const EntityListSubTree = Component.Component(
|
|
|
38
38
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityListSubTree.tsx",
|
|
39
39
|
lineNumber: 73,
|
|
40
40
|
columnNumber: 5
|
|
41
|
-
},
|
|
41
|
+
}, void 0),
|
|
42
42
|
props.children
|
|
43
43
|
] }, void 0, true, {
|
|
44
44
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityListSubTree.tsx",
|
|
45
45
|
lineNumber: 72,
|
|
46
46
|
columnNumber: 4
|
|
47
|
-
},
|
|
47
|
+
}, void 0),
|
|
48
48
|
generateEnvironment: (props, oldEnvironment) => {
|
|
49
49
|
const environment = oldEnvironment.withVariables(props.variables);
|
|
50
50
|
return binding.TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListSubTree.cjs","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":["Component","useConstantValueInvariant","useGetEntityListSubTree","useEntityListSubTreeParameters","useCallback","useAccessorUpdateSubscription","jsxDEV","EntityList","this","MarkerFactory","Field","PRIMARY_KEY_NAME","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;;;;;;AA2CO,MAAM,oBAAoBA,UAAA;AAAA,EAChC,CAAyB,UAA0D;AACxDC,eAAAA,0BAAA,MAAM,YAAY,6CAA6C;AAEzF,UAAM,aAAaC,wBAAAA;AACb,UAAA,aAAaC,8DAA+B,KAAK;AACvD,UAAM,cAAcC,MAAA;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAWC,4DAA8B,WAAW;AAQ1D,WAAQC,8BAAA,OAAAC,WAAA,YAAA,EAAY,GAAG,OAAO,YAAvB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAA2C,GAAAC,
|
|
1
|
+
{"version":3,"file":"EntityListSubTree.cjs","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":["Component","useConstantValueInvariant","useGetEntityListSubTree","useEntityListSubTreeParameters","useCallback","useAccessorUpdateSubscription","jsxDEV","EntityList","this","MarkerFactory","Field","PRIMARY_KEY_NAME","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;;;;;;AA2CO,MAAM,oBAAoBA,UAAA;AAAA,EAChC,CAAyB,UAA0D;AACxDC,eAAAA,0BAAA,MAAM,YAAY,6CAA6C;AAEzF,UAAM,aAAaC,wBAAAA;AACb,UAAA,aAAaC,8DAA+B,KAAK;AACvD,UAAM,cAAcC,MAAA;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAWC,4DAA8B,WAAW;AAQ1D,WAAQC,8BAAA,OAAAC,WAAA,YAAA,EAAY,GAAG,OAAO,YAAvB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAA2C,GAAAC,MAAA;AAAA,EACnD;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAOC,QAAc,cAAA,2CAA2C,OAAO,QAAQ,WAAW;AAAA,MAC3F;AACA,aAAOA,QAAc,cAAA,8BAA8B,OAAO,QAAQ,WAAW;AAAA,IAC9E;AAAA,IACA,cAAc,CACb,UAAAH,8BAAAA,OAACC,yBAAY,GAAG,OAAO,UAAU,GAChC,UAAA;AAAA,MAACD,8BAAA,OAAAI,MAAA,OAAA,EAAM,OAAOC,QAAd,iBAAA,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAgC,GAAAH,MAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,KAFR,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAGA,GAAAA,MAAA;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAAI,mCAA2B,sCAAsC,aAAa,KAAK;AAAA,IAC3F;AAAA,EACD;AAAA,EACA;AACD;;"}
|
|
@@ -22,7 +22,7 @@ const EntityListSubTree = Component(
|
|
|
22
22
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityListSubTree.tsx",
|
|
23
23
|
lineNumber: 62,
|
|
24
24
|
columnNumber: 10
|
|
25
|
-
},
|
|
25
|
+
}, void 0);
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
generateBranchMarker: (props, fields, environment) => {
|
|
@@ -36,13 +36,13 @@ const EntityListSubTree = Component(
|
|
|
36
36
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityListSubTree.tsx",
|
|
37
37
|
lineNumber: 73,
|
|
38
38
|
columnNumber: 5
|
|
39
|
-
},
|
|
39
|
+
}, void 0),
|
|
40
40
|
props.children
|
|
41
41
|
] }, void 0, true, {
|
|
42
42
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntityListSubTree.tsx",
|
|
43
43
|
lineNumber: 72,
|
|
44
44
|
columnNumber: 4
|
|
45
|
-
},
|
|
45
|
+
}, void 0),
|
|
46
46
|
generateEnvironment: (props, oldEnvironment) => {
|
|
47
47
|
const environment = oldEnvironment.withVariables(props.variables);
|
|
48
48
|
return TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":["this"],"mappings":";;;;;;;;;;AA2CO,MAAM,oBAAoB;AAAA,EAChC,CAAyB,UAA0D;AACxD,8BAAA,MAAM,YAAY,6CAA6C;AAEzF,UAAM,aAAa;AACb,UAAA,aAAa,+BAA+B,KAAK;AACvD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,uBAAA,YAAA,EAAY,GAAG,OAAO,YAAvB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAA2C,GAAAA,
|
|
1
|
+
{"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * Creates a subtree with list of entities in current data binding context.\n *\n * @example\n * ```\n * <EntityListSubTree entities=\"Post\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":["this"],"mappings":";;;;;;;;;;AA2CO,MAAM,oBAAoB;AAAA,EAChC,CAAyB,UAA0D;AACxD,8BAAA,MAAM,YAAY,6CAA6C;AAEzF,UAAM,aAAa;AACb,UAAA,aAAa,+BAA+B,KAAK;AACvD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,uBAAA,YAAA,EAAY,GAAG,OAAO,YAAvB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAA2C,GAAAA,MAAA;AAAA,EACnD;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,2CAA2C,OAAO,QAAQ,WAAW;AAAA,MAC3F;AACA,aAAO,cAAc,8BAA8B,OAAO,QAAQ,WAAW;AAAA,IAC9E;AAAA,IACA,cAAc,CACb,UAAA,uBAAC,cAAY,GAAG,OAAO,UAAU,GAChC,UAAA;AAAA,MAAC,uBAAA,OAAA,EAAM,OAAO,iBAAd,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAgC,GAAAA,MAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,KAFR,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAGA,GAAAA,MAAA;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,sCAAsC,aAAa,KAAK;AAAA,IAC3F;AAAA,EACD;AAAA,EACA;AACD;"}
|
|
@@ -25,7 +25,7 @@ const EntitySubTree = Component.Component(
|
|
|
25
25
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntitySubTree.tsx",
|
|
26
26
|
lineNumber: 63,
|
|
27
27
|
columnNumber: 10
|
|
28
|
-
},
|
|
28
|
+
}, void 0);
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
generateBranchMarker: (props, fields, environment) => {
|
|
@@ -40,13 +40,13 @@ const EntitySubTree = Component.Component(
|
|
|
40
40
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntitySubTree.tsx",
|
|
41
41
|
lineNumber: 75,
|
|
42
42
|
columnNumber: 6
|
|
43
|
-
},
|
|
43
|
+
}, void 0),
|
|
44
44
|
props.children
|
|
45
45
|
] }, void 0, true, {
|
|
46
46
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntitySubTree.tsx",
|
|
47
47
|
lineNumber: 74,
|
|
48
48
|
columnNumber: 5
|
|
49
|
-
},
|
|
49
|
+
}, void 0),
|
|
50
50
|
props.isCreating && "orderField" in props && /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
51
51
|
SetOrderFieldOnCreate.SetOrderFieldOnCreate,
|
|
52
52
|
{
|
|
@@ -61,13 +61,13 @@ const EntitySubTree = Component.Component(
|
|
|
61
61
|
lineNumber: 79,
|
|
62
62
|
columnNumber: 6
|
|
63
63
|
},
|
|
64
|
-
|
|
64
|
+
void 0
|
|
65
65
|
)
|
|
66
66
|
] }, void 0, true, {
|
|
67
67
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntitySubTree.tsx",
|
|
68
68
|
lineNumber: 73,
|
|
69
69
|
columnNumber: 4
|
|
70
|
-
},
|
|
70
|
+
}, void 0),
|
|
71
71
|
generateEnvironment: (props, oldEnvironment) => {
|
|
72
72
|
const environment = oldEnvironment.withVariables(props.variables);
|
|
73
73
|
return binding.TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitySubTree.cjs","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":["Component","useConstantValueInvariant","useGetEntitySubTree","useEntitySubTreeParameters","useCallback","useAccessorUpdateSubscription","jsxDEV","Entity","this","MarkerFactory","Fragment","Field","PRIMARY_KEY_NAME","SetOrderFieldOnCreate","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;;;;;;;AA4CO,MAAM,gBAAgBA,UAAA;AAAA,EAC5B,CAAyB,UAA2C;AACzCC,eAAAA,0BAAA,MAAM,YAAY,yCAAyC;AAErF,UAAM,aAAaC,oBAAAA;AACb,UAAA,aAAaC,sDAA2B,KAAK;AACnD,UAAM,cAAcC,MAAA;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAWC,4DAA8B,WAAW;AAQ1D,WAAQC,8BAAA,OAAAC,OAAA,QAAA,EAAQ,GAAG,OAAO,YAAnB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAuC,GAAAC,
|
|
1
|
+
{"version":3,"file":"EntitySubTree.cjs","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":["Component","useConstantValueInvariant","useGetEntitySubTree","useEntitySubTreeParameters","useCallback","useAccessorUpdateSubscription","jsxDEV","Entity","this","MarkerFactory","Fragment","Field","PRIMARY_KEY_NAME","SetOrderFieldOnCreate","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;;;;;;;AA4CO,MAAM,gBAAgBA,UAAA;AAAA,EAC5B,CAAyB,UAA2C;AACzCC,eAAAA,0BAAA,MAAM,YAAY,yCAAyC;AAErF,UAAM,aAAaC,oBAAAA;AACb,UAAA,aAAaC,sDAA2B,KAAK;AACnD,UAAM,cAAcC,MAAA;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAWC,4DAA8B,WAAW;AAQ1D,WAAQC,8BAAA,OAAAC,OAAA,QAAA,EAAQ,GAAG,OAAO,YAAnB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAuC,GAAAC,MAAA;AAAA,EAC/C;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAOC,QAAc,cAAA,uCAAuC,OAAO,QAAQ,WAAW;AAAA,MACvF;AACA,aAAOA,QAAc,cAAA,0BAA0B,OAAO,QAAQ,WAAW;AAAA,IAC1E;AAAA,IACA,cAAc,WAEZH,8BAAA,OAAAI,cAAA,UAAA,EAAA,UAAA;AAAA,MAAAJ,8BAAA,OAACC,OAAQ,QAAA,EAAA,GAAG,OAAO,UAAU,GAC5B,UAAA;AAAA,QAACD,8BAAA,OAAAK,MAAA,OAAA,EAAM,OAAOC,QAAd,iBAAA,GAAA,QAAA,OAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAgC,GAAAJ,MAAA;AAAA,QAC/B,MAAM;AAAA,MAAA,KAFR,QAAA,MAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAGA,GAAAA,MAAA;AAAA,MACC,MAAM,cAAc,gBAAgB,SACpCF,8BAAA;AAAA,QAACO,sBAAA;AAAA,QAAA;AAAA,UACA,YAAY,MAAM;AAAA,UAClB,oBAAoB,MAAM;AAAA,UAC1B,QAAQ,MAAM;AAAA,QAAA;AAAA,QAHf;AAAA,QAAA;AAAA,QAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAA;AAAA,QAAAL;AAAAA,MAIA;AAAA,IAAA,KAVF,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAYA,GAAAA,MAAA;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAAM,mCAA2B,kCAAkC,aAAa,KAAK;AAAA,IACvF;AAAA,EACD;AAAA,EACA;AACD;;"}
|
|
@@ -23,7 +23,7 @@ const EntitySubTree = Component(
|
|
|
23
23
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntitySubTree.tsx",
|
|
24
24
|
lineNumber: 63,
|
|
25
25
|
columnNumber: 10
|
|
26
|
-
},
|
|
26
|
+
}, void 0);
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
generateBranchMarker: (props, fields, environment) => {
|
|
@@ -38,13 +38,13 @@ const EntitySubTree = Component(
|
|
|
38
38
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntitySubTree.tsx",
|
|
39
39
|
lineNumber: 75,
|
|
40
40
|
columnNumber: 6
|
|
41
|
-
},
|
|
41
|
+
}, void 0),
|
|
42
42
|
props.children
|
|
43
43
|
] }, void 0, true, {
|
|
44
44
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntitySubTree.tsx",
|
|
45
45
|
lineNumber: 74,
|
|
46
46
|
columnNumber: 5
|
|
47
|
-
},
|
|
47
|
+
}, void 0),
|
|
48
48
|
props.isCreating && "orderField" in props && /* @__PURE__ */ jsxDEV(
|
|
49
49
|
SetOrderFieldOnCreate,
|
|
50
50
|
{
|
|
@@ -59,13 +59,13 @@ const EntitySubTree = Component(
|
|
|
59
59
|
lineNumber: 79,
|
|
60
60
|
columnNumber: 6
|
|
61
61
|
},
|
|
62
|
-
|
|
62
|
+
void 0
|
|
63
63
|
)
|
|
64
64
|
] }, void 0, true, {
|
|
65
65
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/EntitySubTree.tsx",
|
|
66
66
|
lineNumber: 73,
|
|
67
67
|
columnNumber: 4
|
|
68
|
-
},
|
|
68
|
+
}, void 0),
|
|
69
69
|
generateEnvironment: (props, oldEnvironment) => {
|
|
70
70
|
const environment = oldEnvironment.withVariables(props.variables);
|
|
71
71
|
return TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":["this"],"mappings":";;;;;;;;;;;AA4CO,MAAM,gBAAgB;AAAA,EAC5B,CAAyB,UAA2C;AACzC,8BAAA,MAAM,YAAY,yCAAyC;AAErF,UAAM,aAAa;AACb,UAAA,aAAa,2BAA2B,KAAK;AACnD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,uBAAA,QAAA,EAAQ,GAAG,OAAO,YAAnB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAuC,GAAAA,
|
|
1
|
+
{"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '@contember/binding'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\n/**\n * Creates a single entity subtree in current data binding context.\n *\n * @example\n * ```\n * <EntitySubTree entity=\"Post(id = $id)\" />\n * ```\n *\n * @group Data binding\n */\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":["this"],"mappings":";;;;;;;;;;;AA4CO,MAAM,gBAAgB;AAAA,EAC5B,CAAyB,UAA2C;AACzC,8BAAA,MAAM,YAAY,yCAAyC;AAErF,UAAM,aAAa;AACb,UAAA,aAAa,2BAA2B,KAAK;AACnD,UAAM,cAAc;AAAA,MACnB,MAAM,WAAW,YAAY,MAAM,UAAU;AAAA,MAC7C,CAAC,YAAY,YAAY,MAAM,UAAU;AAAA,IAAA;AAEpC,UAAA,WAAW,8BAA8B,WAAW;AAQ1D,WAAQ,uBAAA,QAAA,EAAQ,GAAG,OAAO,YAAnB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAuC,GAAAA,MAAA;AAAA,EAC/C;AAAA,EACA;AAAA,IACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,UAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,eAAO,cAAc,uCAAuC,OAAO,QAAQ,WAAW;AAAA,MACvF;AACA,aAAO,cAAc,0BAA0B,OAAO,QAAQ,WAAW;AAAA,IAC1E;AAAA,IACA,cAAc,WAEZ,uBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,uBAAC,QAAQ,EAAA,GAAG,OAAO,UAAU,GAC5B,UAAA;AAAA,QAAC,uBAAA,OAAA,EAAM,OAAO,iBAAd,GAAA,QAAA,OAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAgC,GAAAA,MAAA;AAAA,QAC/B,MAAM;AAAA,MAAA,KAFR,QAAA,MAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAGA,GAAAA,MAAA;AAAA,MACC,MAAM,cAAc,gBAAgB,SACpC;AAAA,QAAC;AAAA,QAAA;AAAA,UACA,YAAY,MAAM;AAAA,UAClB,oBAAoB,MAAM;AAAA,UAC1B,QAAQ,MAAM;AAAA,QAAA;AAAA,QAHf;AAAA,QAAA;AAAA,QAAA;AAAA,UAAA,UAAA;AAAA,UAAA,YAAA;AAAA,UAAA,cAAA;AAAA,QAAA;AAAA,QAAAA;AAAAA,MAIA;AAAA,IAAA,KAVF,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAYA,GAAAA,MAAA;AAAA,IAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAA,2BAA2B,kCAAkC,aAAa,KAAK;AAAA,IACvF;AAAA,EACD;AAAA,EACA;AACD;"}
|
|
@@ -13,7 +13,7 @@ const Field = Component.Component(
|
|
|
13
13
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/Field.tsx",
|
|
14
14
|
lineNumber: 27,
|
|
15
15
|
columnNumber: 11
|
|
16
|
-
},
|
|
16
|
+
}, void 0);
|
|
17
17
|
}
|
|
18
18
|
if (field.value instanceof client.GraphQlBuilder.GraphQlLiteral || field.value === null || typeof field.value === "boolean") {
|
|
19
19
|
return null;
|
|
@@ -22,7 +22,7 @@ const Field = Component.Component(
|
|
|
22
22
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/Field.tsx",
|
|
23
23
|
lineNumber: 37,
|
|
24
24
|
columnNumber: 10
|
|
25
|
-
},
|
|
25
|
+
}, void 0);
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
generateLeafMarker: (props, environment) => binding.MarkerFactory.createFieldMarker(props, environment),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.cjs","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '@contember/binding'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\n/**\n * @group Data binding\n */\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":["Component","useField","jsxDEV","Fragment","this","GraphQlBuilder","MarkerFactory","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;AAqBO,MAAM,QAAQA,UAAA;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQC,kBAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAUC,qCAAAC,cAAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAA3B,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAA6B,GAAAC,
|
|
1
|
+
{"version":3,"file":"Field.cjs","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '@contember/binding'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\n/**\n * @group Data binding\n */\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":["Component","useField","jsxDEV","Fragment","this","GraphQlBuilder","MarkerFactory","TreeNodeEnvironmentFactory"],"mappings":";;;;;;;AAqBO,MAAM,QAAQA,UAAA;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQC,kBAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAUC,qCAAAC,cAAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAA3B,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAA6B,GAAAC,MAAA;AAAA,IACrC;AAGC,QAAA,MAAM,iBAAiBC,OAAA,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAAH,8BAAA,OAAAC,cAAA,UAAA,EAAG,gBAAM,MAAT,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAe,GAAAC,MAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgBE,QAAc,cAAA,kBAAkB,OAAO,WAAW;AAAA,IAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,aAAAC,mCAA2B,0BAA0B,aAAa,KAAK;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AACD;;"}
|
|
@@ -11,7 +11,7 @@ const Field = Component(
|
|
|
11
11
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/Field.tsx",
|
|
12
12
|
lineNumber: 27,
|
|
13
13
|
columnNumber: 11
|
|
14
|
-
},
|
|
14
|
+
}, void 0);
|
|
15
15
|
}
|
|
16
16
|
if (field.value instanceof GraphQlBuilder.GraphQlLiteral || field.value === null || typeof field.value === "boolean") {
|
|
17
17
|
return null;
|
|
@@ -20,7 +20,7 @@ const Field = Component(
|
|
|
20
20
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/Field.tsx",
|
|
21
21
|
lineNumber: 37,
|
|
22
22
|
columnNumber: 10
|
|
23
|
-
},
|
|
23
|
+
}, void 0);
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
generateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '@contember/binding'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\n/**\n * @group Data binding\n */\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":["this"],"mappings":";;;;;AAqBO,MAAM,QAAQ;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQ,SAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAU,uBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAA3B,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAA6B,GAAAA,
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '@contember/binding'\nimport type { FieldValue, SugaredRelativeSingleField } from '@contember/binding'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\n/**\n * @group Data binding\n */\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":["this"],"mappings":";;;;;AAqBO,MAAM,QAAQ;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQ,SAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAU,uBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAA3B,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAA6B,GAAAA,MAAA;AAAA,IACrC;AAGC,QAAA,MAAM,iBAAiB,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAA,uBAAA,UAAA,EAAG,gBAAM,MAAT,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAe,GAAAA,MAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO,WAAW;AAAA,IAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,aAAA,2BAA2B,0BAA0B,aAAa,KAAK;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AACD;"}
|
|
@@ -13,7 +13,7 @@ const HasMany = Component.Component(
|
|
|
13
13
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/HasMany.tsx",
|
|
14
14
|
lineNumber: 30,
|
|
15
15
|
columnNumber: 10
|
|
16
|
-
},
|
|
16
|
+
}, void 0);
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
generateEnvironment: (props, oldEnvironment) => {
|
|
@@ -25,13 +25,13 @@ const HasMany = Component.Component(
|
|
|
25
25
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/HasMany.tsx",
|
|
26
26
|
lineNumber: 39,
|
|
27
27
|
columnNumber: 5
|
|
28
|
-
},
|
|
28
|
+
}, void 0),
|
|
29
29
|
props.children
|
|
30
30
|
] }, void 0, true, {
|
|
31
31
|
fileName: "/__w/interface/interface/packages/react-binding/src/coreComponents/HasMany.tsx",
|
|
32
32
|
lineNumber: 38,
|
|
33
33
|
columnNumber: 4
|
|
34
|
-
},
|
|
34
|
+
}, void 0),
|
|
35
35
|
generateBranchMarker: (props, fields, environment) => binding.MarkerFactory.createRelativeEntityListFields(props, environment, fields)
|
|
36
36
|
},
|
|
37
37
|
"HasMany"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HasMany.cjs","sources":["../../../src/coreComponents/HasMany.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityList } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type { SugaredRelativeEntityList } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport type HasManyProps<ListProps = never, EntityProps = never> = SugaredRelativeEntityList & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n} & (\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const HasMany = Component(\n\t<ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => {\n\t\tconst entityList = useEntityList(props)\n\n\t\treturn <EntityList {...props} accessor={entityList} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeEntityListFields(props, environment, fields),\n\t},\n\t'HasMany',\n) as <ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => ReactElement\n"],"names":["Component","useEntityList","jsxDEV","EntityList","this","TreeNodeEnvironmentFactory","Field","PRIMARY_KEY_NAME","MarkerFactory"],"mappings":";;;;;;;;AAyBO,MAAM,UAAUA,UAAA;AAAA,EACtB,CAAyB,UAAgD;AAClE,UAAA,aAAaC,4BAAc,KAAK;AAEtC,WAAQC,8BAAA,OAAAC,uBAAA,EAAY,GAAG,OAAO,UAAU,WAAjC,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAA6C,GAAAC,
|
|
1
|
+
{"version":3,"file":"HasMany.cjs","sources":["../../../src/coreComponents/HasMany.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityList } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '@contember/binding'\nimport { Environment } from '@contember/binding'\nimport { MarkerFactory } from '@contember/binding'\nimport type { SugaredRelativeEntityList } from '@contember/binding'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '@contember/binding'\n\nexport type HasManyProps<ListProps = never, EntityProps = never> = SugaredRelativeEntityList & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n} & (\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\n/**\n * @group Data binding\n */\nexport const HasMany = Component(\n\t<ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => {\n\t\tconst entityList = useEntityList(props)\n\n\t\treturn <EntityList {...props} accessor={entityList} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeEntityListFields(props, environment, fields),\n\t},\n\t'HasMany',\n) as <ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => ReactElement\n"],"names":["Component","useEntityList","jsxDEV","EntityList","this","TreeNodeEnvironmentFactory","Field","PRIMARY_KEY_NAME","MarkerFactory"],"mappings":";;;;;;;;AAyBO,MAAM,UAAUA,UAAA;AAAA,EACtB,CAAyB,UAAgD;AAClE,UAAA,aAAaC,4BAAc,KAAK;AAEtC,WAAQC,8BAAA,OAAAC,uBAAA,EAAY,GAAG,OAAO,UAAU,WAAjC,GAAA,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAA6C,GAAAC,MAAA;AAAA,EACrD;AAAA,EACA;AAAA,IACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,YAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,aAAAC,mCAA2B,+BAA+B,aAAa,KAAK;AAAA,IACpF;AAAA,IACA,cAAc,CACb,UAAAH,8BAAAA,OAACC,yBAAY,GAAG,OAAO,UAAU,QAChC,UAAA;AAAA,MAACD,8BAAA,OAAAI,MAAA,OAAA,EAAM,OAAOC,QAAd,iBAAA,GAAA,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAgC,GAAAH,MAAA;AAAA,MAC/B,MAAM;AAAA,IAAA,KAFR,QAAA,MAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAGA,GAAAA,MAAA;AAAA,IAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrCI,QAAc,cAAA,+BAA+B,OAAO,aAAa,MAAM;AAAA,EACzE;AAAA,EACA;AACD;;"}
|