@contember/interface 2.0.0-alpha.9 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +2 -4
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +2 -4
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/bootstrap/ApplicationEntrypoint.cjs.map +1 -1
- package/dist/development/src/bootstrap/ApplicationEntrypoint.js.map +1 -1
- package/dist/development/src/bootstrap/DataViewPageNameKeyProvider.cjs.map +1 -1
- package/dist/development/src/bootstrap/DataViewPageNameKeyProvider.js.map +1 -1
- package/dist/development/src/components/binding/DisconnectEntityTrigger.cjs +2 -2
- package/dist/development/src/components/binding/DisconnectEntityTrigger.cjs.map +1 -1
- package/dist/development/src/components/binding/DisconnectEntityTrigger.js +3 -3
- package/dist/development/src/components/binding/DisconnectEntityTrigger.js.map +1 -1
- package/dist/development/src/components/binding/EntityBeforePersist.cjs.map +1 -1
- package/dist/development/src/components/binding/RedirectOnPersist.cjs.map +1 -1
- package/dist/development/src/components/binding/RedirectOnPersist.js.map +1 -1
- package/dist/development/src/hooks/useBlockNavigationOnDirtyState.cjs +36 -0
- package/dist/development/src/hooks/useBlockNavigationOnDirtyState.cjs.map +1 -0
- package/dist/development/src/hooks/useBlockNavigationOnDirtyState.js +36 -0
- package/dist/development/src/hooks/useBlockNavigationOnDirtyState.js.map +1 -0
- package/dist/development/src/hooks/useIsApplicationOutdated.cjs +1 -1
- package/dist/development/src/hooks/useIsApplicationOutdated.cjs.map +1 -1
- package/dist/development/src/hooks/useIsApplicationOutdated.js +1 -1
- package/dist/development/src/hooks/useIsApplicationOutdated.js.map +1 -1
- package/dist/production/index.cjs +2 -4
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +2 -4
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/bootstrap/ApplicationEntrypoint.cjs.map +1 -1
- package/dist/production/src/bootstrap/ApplicationEntrypoint.js.map +1 -1
- package/dist/production/src/bootstrap/DataViewPageNameKeyProvider.cjs.map +1 -1
- package/dist/production/src/bootstrap/DataViewPageNameKeyProvider.js.map +1 -1
- package/dist/production/src/components/binding/ClearFieldTrigger.cjs.map +1 -1
- package/dist/production/src/components/binding/ClearFieldTrigger.js.map +1 -1
- package/dist/production/src/components/binding/DisconnectEntityTrigger.cjs +1 -1
- package/dist/production/src/components/binding/DisconnectEntityTrigger.cjs.map +1 -1
- package/dist/production/src/components/binding/DisconnectEntityTrigger.js +2 -2
- package/dist/production/src/components/binding/DisconnectEntityTrigger.js.map +1 -1
- package/dist/production/src/components/binding/EntityBeforePersist.cjs.map +1 -1
- package/dist/production/src/components/binding/RedirectOnPersist.cjs.map +1 -1
- package/dist/production/src/components/binding/RedirectOnPersist.js.map +1 -1
- package/dist/production/src/hooks/useBlockNavigationOnDirtyState.cjs +36 -0
- package/dist/production/src/hooks/useBlockNavigationOnDirtyState.cjs.map +1 -0
- package/dist/production/src/hooks/useBlockNavigationOnDirtyState.js +36 -0
- package/dist/production/src/hooks/useBlockNavigationOnDirtyState.js.map +1 -0
- package/dist/production/src/hooks/useIsApplicationOutdated.cjs +1 -1
- package/dist/production/src/hooks/useIsApplicationOutdated.cjs.map +1 -1
- package/dist/production/src/hooks/useIsApplicationOutdated.js +1 -1
- package/dist/production/src/hooks/useIsApplicationOutdated.js.map +1 -1
- package/dist/types/bootstrap/ApplicationEntrypoint.d.ts.map +1 -1
- package/dist/types/components/binding/DisconnectEntityTrigger.d.ts.map +1 -1
- package/dist/types/components/binding/index.d.ts +0 -2
- package/dist/types/components/binding/index.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/useBlockNavigationOnDirtyState.d.ts +7 -0
- package/dist/types/hooks/useBlockNavigationOnDirtyState.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/bootstrap/ApplicationEntrypoint.tsx +1 -1
- package/src/components/binding/DisconnectEntityTrigger.tsx +3 -2
- package/src/components/binding/index.ts +0 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useBlockNavigationOnDirtyState.ts +40 -0
- package/src/hooks/useIsApplicationOutdated.ts +1 -1
- package/src/tsconfig.json +0 -1
- package/dist/development/src/components/binding/DeleteEntityTrigger.cjs +0 -36
- package/dist/development/src/components/binding/DeleteEntityTrigger.cjs.map +0 -1
- package/dist/development/src/components/binding/DeleteEntityTrigger.js +0 -36
- package/dist/development/src/components/binding/DeleteEntityTrigger.js.map +0 -1
- package/dist/development/src/components/binding/PersistTrigger.cjs +0 -37
- package/dist/development/src/components/binding/PersistTrigger.cjs.map +0 -1
- package/dist/development/src/components/binding/PersistTrigger.js +0 -37
- package/dist/development/src/components/binding/PersistTrigger.js.map +0 -1
- package/dist/production/src/components/binding/DeleteEntityTrigger.cjs +0 -28
- package/dist/production/src/components/binding/DeleteEntityTrigger.cjs.map +0 -1
- package/dist/production/src/components/binding/DeleteEntityTrigger.js +0 -28
- package/dist/production/src/components/binding/DeleteEntityTrigger.js.map +0 -1
- package/dist/production/src/components/binding/PersistTrigger.cjs +0 -29
- package/dist/production/src/components/binding/PersistTrigger.cjs.map +0 -1
- package/dist/production/src/components/binding/PersistTrigger.js +0 -29
- package/dist/production/src/components/binding/PersistTrigger.js.map +0 -1
- package/dist/types/components/binding/DeleteEntityTrigger.d.ts +0 -10
- package/dist/types/components/binding/DeleteEntityTrigger.d.ts.map +0 -1
- package/dist/types/components/binding/PersistTrigger.d.ts +0 -9
- package/dist/types/components/binding/PersistTrigger.d.ts.map +0 -1
- package/src/components/binding/DeleteEntityTrigger.tsx +0 -36
- package/src/components/binding/PersistTrigger.tsx +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisconnectEntityTrigger.js","sources":["../../../../../../packages/interface/src/components/binding/DisconnectEntityTrigger.tsx"],"sourcesContent":["import { ComponentType, ReactNode, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { BindingError, EntityListAccessor, ErrorPersistResult, SuccessfulPersistResult, SugaredRelativeSingleEntity, useEntity, useMutationState, usePersist } from '@contember/react-binding'\n\n\nconst SlotButton = Slot as ComponentType<React.ButtonHTMLAttributes<HTMLButtonElement>>\n\nexport interface DisconnectEntityTriggerProps {\n\timmediatePersist?: true\n\tchildren: ReactNode\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\tonPersistError?: (result: ErrorPersistResult) => void\n\tfield?: SugaredRelativeSingleEntity['field']\n}\n\nexport const DisconnectEntityTrigger = ({ immediatePersist, onPersistError, onPersistSuccess, field, ...props }: DisconnectEntityTriggerProps) => {\n\tconst entity = useEntity()\n\tconst triggerPersist = usePersist()\n\tconst isMutating = useMutationState()\n\tconst onClick = useCallback(() => {\n\t\tif (field) {\n\t\t\tentity.disconnectEntityAtField({ field })\n\t\t} else {\n\t\t\tconst parent = entity.getParent()\n\t\t\tif (!parent) {\n\t\t\t\tthrow new BindingError('Cannot disconnect root entity')\n\t\t\t}\n\t\t\tif (parent
|
|
1
|
+
{"version":3,"file":"DisconnectEntityTrigger.js","sources":["../../../../../../packages/interface/src/components/binding/DisconnectEntityTrigger.tsx"],"sourcesContent":["import { ComponentType, ReactNode, useCallback } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { BindingError, EntityListAccessor, ErrorPersistResult,\n\tisEntityListAccessor, SuccessfulPersistResult, SugaredRelativeSingleEntity, useEntity, useMutationState, usePersist } from '@contember/react-binding'\n\n\nconst SlotButton = Slot as ComponentType<React.ButtonHTMLAttributes<HTMLButtonElement>>\n\nexport interface DisconnectEntityTriggerProps {\n\timmediatePersist?: true\n\tchildren: ReactNode\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\tonPersistError?: (result: ErrorPersistResult) => void\n\tfield?: SugaredRelativeSingleEntity['field']\n}\n\nexport const DisconnectEntityTrigger = ({ immediatePersist, onPersistError, onPersistSuccess, field, ...props }: DisconnectEntityTriggerProps) => {\n\tconst entity = useEntity()\n\tconst triggerPersist = usePersist()\n\tconst isMutating = useMutationState()\n\tconst onClick = useCallback(() => {\n\t\tif (field) {\n\t\t\tentity.disconnectEntityAtField({ field })\n\t\t} else {\n\t\t\tconst parent = entity.getParent()\n\t\t\tif (!parent) {\n\t\t\t\tthrow new BindingError('Cannot disconnect root entity')\n\t\t\t}\n\t\t\tif (isEntityListAccessor(parent)) {\n\t\t\t\tparent.disconnectEntity(entity)\n\t\t\t} else {\n\t\t\t\tconst subTreeNode = entity.environment.getSubTreeNode()\n\t\t\t\tif (subTreeNode.type !== 'entity') {\n\t\t\t\t\tthrow new BindingError('Cannot disconnect root entity')\n\t\t\t\t}\n\t\t\t\tparent.disconnectEntityAtField({ field: subTreeNode.field.name })\n\t\t\t}\n\t\t}\n\n\t\tif (immediatePersist) {\n\t\t\ttriggerPersist()\n\t\t\t\t.then(onPersistSuccess)\n\t\t\t\t.catch(onPersistError)\n\t\t}\n\t}, [field, immediatePersist, entity, triggerPersist, onPersistSuccess, onPersistError])\n\n\treturn (\n\t\t<SlotButton\n\t\t\tonClick={onClick}\n\t\t\tdisabled={isMutating ? true : undefined}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":[],"mappings":";;;;AAMA,MAAM,aAAa;AAUN,MAAA,0BAA0B,CAAC,EAAE,kBAAkB,gBAAgB,kBAAkB,OAAO,GAAG,YAA0C;AACjJ,QAAM,SAAS,UAAU;AACzB,QAAM,iBAAiB,WAAW;AAClC,QAAM,aAAa,iBAAiB;AAC9B,QAAA,UAAU,YAAY,MAAM;AACjC,QAAI,OAAO;AACH,aAAA,wBAAwB,EAAE,OAAO;AAAA,IAAA,OAClC;AACA,YAAA,SAAS,OAAO,UAAU;AAChC,UAAI,CAAC,QAAQ;AACN,cAAA,IAAI,aAAa,+BAA+B;AAAA,MAAA;AAEnD,UAAA,qBAAqB,MAAM,GAAG;AACjC,eAAO,iBAAiB,MAAM;AAAA,MAAA,OACxB;AACA,cAAA,cAAc,OAAO,YAAY,eAAe;AAClD,YAAA,YAAY,SAAS,UAAU;AAC5B,gBAAA,IAAI,aAAa,+BAA+B;AAAA,QAAA;AAEvD,eAAO,wBAAwB,EAAE,OAAO,YAAY,MAAM,MAAM;AAAA,MAAA;AAAA,IACjE;AAGD,QAAI,kBAAkB;AACrB,qBACE,EAAA,KAAK,gBAAgB,EACrB,MAAM,cAAc;AAAA,IAAA;AAAA,EACvB,GACE,CAAC,OAAO,kBAAkB,QAAQ,gBAAgB,kBAAkB,cAAc,CAAC;AAGrF,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,UAAU,aAAa,OAAO;AAAA,MAC7B,GAAG;AAAA,IAAA;AAAA,EACL;AAEF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityBeforePersist.cjs","sources":["../../../../../../packages/interface/src/components/binding/EntityBeforePersist.tsx"],"sourcesContent":["import { EntityAccessor, useEntityBeforePersist } from '@contember/react-binding'\n\nexport const EntityBeforePersist = ({ listener }: { listener: EntityAccessor.EntityEventListenerMap['beforePersist']}) => {\n\tuseEntityBeforePersist(listener)\n\treturn null\n}\n"],"names":["useEntityBeforePersist"],"mappings":";;;AAEO,MAAM,sBAAsB,CAAC,EAAE,eAAoF;AACzHA,
|
|
1
|
+
{"version":3,"file":"EntityBeforePersist.cjs","sources":["../../../../../../packages/interface/src/components/binding/EntityBeforePersist.tsx"],"sourcesContent":["import { EntityAccessor, useEntityBeforePersist } from '@contember/react-binding'\n\nexport const EntityBeforePersist = ({ listener }: { listener: EntityAccessor.EntityEventListenerMap['beforePersist']}) => {\n\tuseEntityBeforePersist(listener)\n\treturn null\n}\n"],"names":["useEntityBeforePersist"],"mappings":";;;AAEO,MAAM,sBAAsB,CAAC,EAAE,eAAoF;AACzHA,eAAAA,uBAAuB,QAAQ;AACxB,SAAA;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectOnPersist.cjs","sources":["../../../../../../packages/interface/src/components/binding/RedirectOnPersist.tsx"],"sourcesContent":["import { useEntityPersistSuccess } from '@contember/react-binding'\nimport { RequestParameters, useRedirect } from '@contember/react-routing'\nimport { RoutingLinkTarget } from '@contember/react-routing'\n\nexport const RedirectOnPersist = ({ to, parameters }: { to: RoutingLinkTarget; parameters?: RequestParameters }) => {\n\tconst redirect = useRedirect()\n\tuseEntityPersistSuccess((getEntity, options) => {\n\t\tif (options.successType !== 'justSuccess') {\n\t\t\treturn\n\t\t}\n\t\tredirect(to, parameters)\n\t})\n\treturn null\n}\n"],"names":["useRedirect","useEntityPersistSuccess"],"mappings":";;;;AAIO,MAAM,oBAAoB,CAAC,EAAE,IAAI,iBAA4E;AACnH,QAAM,WAAWA,aAAAA;
|
|
1
|
+
{"version":3,"file":"RedirectOnPersist.cjs","sources":["../../../../../../packages/interface/src/components/binding/RedirectOnPersist.tsx"],"sourcesContent":["import { useEntityPersistSuccess } from '@contember/react-binding'\nimport { RequestParameters, useRedirect } from '@contember/react-routing'\nimport { RoutingLinkTarget } from '@contember/react-routing'\n\nexport const RedirectOnPersist = ({ to, parameters }: { to: RoutingLinkTarget; parameters?: RequestParameters }) => {\n\tconst redirect = useRedirect()\n\tuseEntityPersistSuccess((getEntity, options) => {\n\t\tif (options.successType !== 'justSuccess') {\n\t\t\treturn\n\t\t}\n\t\tredirect(to, parameters)\n\t})\n\treturn null\n}\n"],"names":["useRedirect","useEntityPersistSuccess"],"mappings":";;;;AAIO,MAAM,oBAAoB,CAAC,EAAE,IAAI,iBAA4E;AACnH,QAAM,WAAWA,aAAAA,YAAY;AACLC,uCAAA,CAAC,WAAW,YAAY;AAC3C,QAAA,QAAQ,gBAAgB,eAAe;AAC1C;AAAA,IAAA;AAED,aAAS,IAAI,UAAU;AAAA,EAAA,CACvB;AACM,SAAA;AACR;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectOnPersist.js","sources":["../../../../../../packages/interface/src/components/binding/RedirectOnPersist.tsx"],"sourcesContent":["import { useEntityPersistSuccess } from '@contember/react-binding'\nimport { RequestParameters, useRedirect } from '@contember/react-routing'\nimport { RoutingLinkTarget } from '@contember/react-routing'\n\nexport const RedirectOnPersist = ({ to, parameters }: { to: RoutingLinkTarget; parameters?: RequestParameters }) => {\n\tconst redirect = useRedirect()\n\tuseEntityPersistSuccess((getEntity, options) => {\n\t\tif (options.successType !== 'justSuccess') {\n\t\t\treturn\n\t\t}\n\t\tredirect(to, parameters)\n\t})\n\treturn null\n}\n"],"names":[],"mappings":";;AAIO,MAAM,oBAAoB,CAAC,EAAE,IAAI,iBAA4E;AACnH,QAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"RedirectOnPersist.js","sources":["../../../../../../packages/interface/src/components/binding/RedirectOnPersist.tsx"],"sourcesContent":["import { useEntityPersistSuccess } from '@contember/react-binding'\nimport { RequestParameters, useRedirect } from '@contember/react-routing'\nimport { RoutingLinkTarget } from '@contember/react-routing'\n\nexport const RedirectOnPersist = ({ to, parameters }: { to: RoutingLinkTarget; parameters?: RequestParameters }) => {\n\tconst redirect = useRedirect()\n\tuseEntityPersistSuccess((getEntity, options) => {\n\t\tif (options.successType !== 'justSuccess') {\n\t\t\treturn\n\t\t}\n\t\tredirect(to, parameters)\n\t})\n\treturn null\n}\n"],"names":[],"mappings":";;AAIO,MAAM,oBAAoB,CAAC,EAAE,IAAI,iBAA4E;AACnH,QAAM,WAAW,YAAY;AACL,0BAAA,CAAC,WAAW,YAAY;AAC3C,QAAA,QAAQ,gBAAgB,eAAe;AAC1C;AAAA,IAAA;AAED,aAAS,IAAI,UAAU;AAAA,EAAA,CACvB;AACM,SAAA;AACR;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const reactBinding = require("@contember/react-binding");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const reactRouting = require("@contember/react-routing");
|
|
6
|
+
const useBlockNavigationOnDirtyState = (handler, options) => {
|
|
7
|
+
const isDirty = reactBinding.useDirtinessState();
|
|
8
|
+
const isDirtyRef = React.useRef(isDirty);
|
|
9
|
+
isDirtyRef.current = isDirty;
|
|
10
|
+
const isMutating = reactBinding.useMutationState();
|
|
11
|
+
const isMutatingRef = React.useRef(isMutating);
|
|
12
|
+
isMutatingRef.current = isMutating;
|
|
13
|
+
const persist = reactBinding.usePersist();
|
|
14
|
+
reactRouting.useRegisterRequestChangeListener(React.useCallback(async (event) => {
|
|
15
|
+
if (!isDirtyRef.current || isMutatingRef.current) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const result = await handler();
|
|
19
|
+
if (result === "cancel") {
|
|
20
|
+
event.abortNavigation();
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (result === "save") {
|
|
24
|
+
try {
|
|
25
|
+
const result2 = await persist();
|
|
26
|
+
options?.onPersistSuccess?.(result2);
|
|
27
|
+
} catch (e) {
|
|
28
|
+
options?.onPersistError?.(e);
|
|
29
|
+
event.abortNavigation();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, [handler, options, persist]));
|
|
34
|
+
};
|
|
35
|
+
exports.useBlockNavigationOnDirtyState = useBlockNavigationOnDirtyState;
|
|
36
|
+
//# sourceMappingURL=useBlockNavigationOnDirtyState.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBlockNavigationOnDirtyState.cjs","sources":["../../../../../packages/interface/src/hooks/useBlockNavigationOnDirtyState.ts"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult, useDirtinessState, useMutationState, usePersist } from '@contember/react-binding'\nimport { useCallback, useRef } from 'react'\nimport { useRegisterRequestChangeListener } from '@contember/react-routing'\n\nexport type BlockNavigationOnDirtyStateResult = 'save' | 'discard' | 'cancel'\n\nexport const useBlockNavigationOnDirtyState = (handler: () => Promise<BlockNavigationOnDirtyStateResult>, options?: {\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\tonPersistError?: (result: ErrorPersistResult) => void\n}) => {\n\tconst isDirty = useDirtinessState()\n\tconst isDirtyRef = useRef(isDirty)\n\tisDirtyRef.current = isDirty\n\tconst isMutating = useMutationState()\n\tconst isMutatingRef = useRef(isMutating)\n\tisMutatingRef.current = isMutating\n\tconst persist = usePersist()\n\n\tuseRegisterRequestChangeListener(useCallback(async event => {\n\t\tif (!isDirtyRef.current || isMutatingRef.current) {\n\t\t\treturn\n\t\t}\n\t\tconst result = await handler()\n\t\tif (result === 'cancel') {\n\t\t\tevent.abortNavigation()\n\t\t\treturn\n\t\t}\n\n\t\tif (result === 'save') {\n\t\t\ttry {\n\t\t\t\tconst result = await persist()\n\t\t\t\toptions?.onPersistSuccess?.(result)\n\t\t\t} catch (e: any) {\n\t\t\t\toptions?.onPersistError?.(e)\n\t\t\t\tevent.abortNavigation()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}, [handler, options, persist]))\n}\n"],"names":["useDirtinessState","useRef","useMutationState","usePersist","useRegisterRequestChangeListener","useCallback","result"],"mappings":";;;;;AAMa,MAAA,iCAAiC,CAAC,SAA2D,YAGpG;AACL,QAAM,UAAUA,aAAAA,kBAAkB;AAC5B,QAAA,aAAaC,aAAO,OAAO;AACjC,aAAW,UAAU;AACrB,QAAM,aAAaC,aAAAA,iBAAiB;AAC9B,QAAA,gBAAgBD,aAAO,UAAU;AACvC,gBAAc,UAAU;AACxB,QAAM,UAAUE,aAAAA,WAAW;AAEMC,gDAAAC,MAAAA,YAAY,OAAM,UAAS;AAC3D,QAAI,CAAC,WAAW,WAAW,cAAc,SAAS;AACjD;AAAA,IAAA;AAEK,UAAA,SAAS,MAAM,QAAQ;AAC7B,QAAI,WAAW,UAAU;AACxB,YAAM,gBAAgB;AACtB;AAAA,IAAA;AAGD,QAAI,WAAW,QAAQ;AAClB,UAAA;AACGC,cAAAA,UAAS,MAAM,QAAQ;AAC7B,iBAAS,mBAAmBA,OAAM;AAAA,eAC1B,GAAQ;AAChB,iBAAS,iBAAiB,CAAC;AAC3B,cAAM,gBAAgB;AACtB;AAAA,MAAA;AAAA,IACD;AAAA,KAEC,CAAC,SAAS,SAAS,OAAO,CAAC,CAAC;AAChC;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useDirtinessState, useMutationState, usePersist } from "@contember/react-binding";
|
|
2
|
+
import { useRef, useCallback } from "react";
|
|
3
|
+
import { useRegisterRequestChangeListener } from "@contember/react-routing";
|
|
4
|
+
const useBlockNavigationOnDirtyState = (handler, options) => {
|
|
5
|
+
const isDirty = useDirtinessState();
|
|
6
|
+
const isDirtyRef = useRef(isDirty);
|
|
7
|
+
isDirtyRef.current = isDirty;
|
|
8
|
+
const isMutating = useMutationState();
|
|
9
|
+
const isMutatingRef = useRef(isMutating);
|
|
10
|
+
isMutatingRef.current = isMutating;
|
|
11
|
+
const persist = usePersist();
|
|
12
|
+
useRegisterRequestChangeListener(useCallback(async (event) => {
|
|
13
|
+
if (!isDirtyRef.current || isMutatingRef.current) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const result = await handler();
|
|
17
|
+
if (result === "cancel") {
|
|
18
|
+
event.abortNavigation();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (result === "save") {
|
|
22
|
+
try {
|
|
23
|
+
const result2 = await persist();
|
|
24
|
+
options?.onPersistSuccess?.(result2);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
options?.onPersistError?.(e);
|
|
27
|
+
event.abortNavigation();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, [handler, options, persist]));
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
useBlockNavigationOnDirtyState
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=useBlockNavigationOnDirtyState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBlockNavigationOnDirtyState.js","sources":["../../../../../packages/interface/src/hooks/useBlockNavigationOnDirtyState.ts"],"sourcesContent":["import { ErrorPersistResult, SuccessfulPersistResult, useDirtinessState, useMutationState, usePersist } from '@contember/react-binding'\nimport { useCallback, useRef } from 'react'\nimport { useRegisterRequestChangeListener } from '@contember/react-routing'\n\nexport type BlockNavigationOnDirtyStateResult = 'save' | 'discard' | 'cancel'\n\nexport const useBlockNavigationOnDirtyState = (handler: () => Promise<BlockNavigationOnDirtyStateResult>, options?: {\n\tonPersistSuccess?: (result: SuccessfulPersistResult) => void\n\tonPersistError?: (result: ErrorPersistResult) => void\n}) => {\n\tconst isDirty = useDirtinessState()\n\tconst isDirtyRef = useRef(isDirty)\n\tisDirtyRef.current = isDirty\n\tconst isMutating = useMutationState()\n\tconst isMutatingRef = useRef(isMutating)\n\tisMutatingRef.current = isMutating\n\tconst persist = usePersist()\n\n\tuseRegisterRequestChangeListener(useCallback(async event => {\n\t\tif (!isDirtyRef.current || isMutatingRef.current) {\n\t\t\treturn\n\t\t}\n\t\tconst result = await handler()\n\t\tif (result === 'cancel') {\n\t\t\tevent.abortNavigation()\n\t\t\treturn\n\t\t}\n\n\t\tif (result === 'save') {\n\t\t\ttry {\n\t\t\t\tconst result = await persist()\n\t\t\t\toptions?.onPersistSuccess?.(result)\n\t\t\t} catch (e: any) {\n\t\t\t\toptions?.onPersistError?.(e)\n\t\t\t\tevent.abortNavigation()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}, [handler, options, persist]))\n}\n"],"names":["result"],"mappings":";;;AAMa,MAAA,iCAAiC,CAAC,SAA2D,YAGpG;AACL,QAAM,UAAU,kBAAkB;AAC5B,QAAA,aAAa,OAAO,OAAO;AACjC,aAAW,UAAU;AACrB,QAAM,aAAa,iBAAiB;AAC9B,QAAA,gBAAgB,OAAO,UAAU;AACvC,gBAAc,UAAU;AACxB,QAAM,UAAU,WAAW;AAEM,mCAAA,YAAY,OAAM,UAAS;AAC3D,QAAI,CAAC,WAAW,WAAW,cAAc,SAAS;AACjD;AAAA,IAAA;AAEK,UAAA,SAAS,MAAM,QAAQ;AAC7B,QAAI,WAAW,UAAU;AACxB,YAAM,gBAAgB;AACtB;AAAA,IAAA;AAGD,QAAI,WAAW,QAAQ;AAClB,UAAA;AACGA,cAAAA,UAAS,MAAM,QAAQ;AAC7B,iBAAS,mBAAmBA,OAAM;AAAA,eAC1B,GAAQ;AAChB,iBAAS,iBAAiB,CAAC;AAC3B,cAAM,gBAAgB;AACtB;AAAA,MAAA;AAAA,IACD;AAAA,KAEC,CAAC,SAAS,SAAS,OAAO,CAAC,CAAC;AAChC;"}
|
|
@@ -13,7 +13,7 @@ const useIsApplicationOutdated = ({ checkIntervalMs = defaultCheckIntervalMs } =
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
const version = await fetchVersion();
|
|
16
|
-
if (version !== initialVersion) {
|
|
16
|
+
if (version && version !== initialVersion) {
|
|
17
17
|
setIsOutdated(true);
|
|
18
18
|
}
|
|
19
19
|
}, [fetchVersion, initialVersion]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsApplicationOutdated.cjs","sources":["../../../../../packages/interface/src/hooks/useIsApplicationOutdated.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\n\nconst defaultCheckIntervalMs = 30_000\n\n\nexport const useIsApplicationOutdated = ({ checkIntervalMs = defaultCheckIntervalMs }: {\n\tcheckIntervalMs?: number\n} = {}) => {\n\tconst [initialVersion] = useState(() => {\n\t\treturn getVersionFromDocument(document.head)\n\t})\n\tconst [isOutdated, setIsOutdated] = useState(false)\n\tconst fetchVersion = useFetchVersion()\n\n\tconst checkVersion = useCallback(async () => {\n\t\tif (document.hidden) {\n\t\t\treturn\n\t\t}\n\t\tconst version = await fetchVersion()\n\t\tif (version !== initialVersion) {\n\t\t\tsetIsOutdated(true)\n\t\t}\n\t}, [fetchVersion, initialVersion])\n\tconst shouldCheck = !!initialVersion && !isOutdated\n\n\tuseEffect(() => {\n\t\tif (!shouldCheck) {\n\t\t\treturn\n\t\t}\n\t\tconst handle = setInterval(checkVersion, checkIntervalMs)\n\t\treturn () => clearInterval(handle)\n\t}, [checkIntervalMs, checkVersion, shouldCheck])\n\n\tuseEffect(() => {\n\t\tif (!shouldCheck) {\n\t\t\treturn\n\t\t}\n\t\tdocument.addEventListener('visibilitychange', checkVersion)\n\t\treturn () => document.removeEventListener('visibilitychange', checkVersion)\n\t}, [checkVersion, shouldCheck])\n\n\treturn isOutdated\n}\n\nconst getVersionFromDocument = (node: ParentNode) => {\n\tconst meta = node.querySelector<HTMLMetaElement>('meta[name=contember-build-version]')\n\treturn meta?.content\n}\n\nconst useFetchVersion = () => {\n\treturn useCallback(async () => {\n\t\ttry {\n\t\t\tconst result = await (await fetch(window.location.href)).text()\n\t\t\tconst html = document.createElement('html')\n\t\t\thtml.innerHTML = result\n\t\t\treturn getVersionFromDocument(html)\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\treturn undefined\n\t\t}\n\t}, [])\n}\n"],"names":["useState","useCallback","useEffect"],"mappings":";;;AAEA,MAAM,yBAAyB;AAGxB,MAAM,2BAA2B,CAAC,EAAE,kBAAkB,uBAAuB,IAEhF,CAAA,MAAO;AACV,QAAM,CAAC,cAAc,IAAIA,MAAAA,SAAS,MAAM;AAChC,WAAA,uBAAuB,SAAS,IAAI;AAAA,EAAA,CAC3C;AACD,QAAM,CAAC,YAAY,aAAa,IAAIA,
|
|
1
|
+
{"version":3,"file":"useIsApplicationOutdated.cjs","sources":["../../../../../packages/interface/src/hooks/useIsApplicationOutdated.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\n\nconst defaultCheckIntervalMs = 30_000\n\n\nexport const useIsApplicationOutdated = ({ checkIntervalMs = defaultCheckIntervalMs }: {\n\tcheckIntervalMs?: number\n} = {}) => {\n\tconst [initialVersion] = useState(() => {\n\t\treturn getVersionFromDocument(document.head)\n\t})\n\tconst [isOutdated, setIsOutdated] = useState(false)\n\tconst fetchVersion = useFetchVersion()\n\n\tconst checkVersion = useCallback(async () => {\n\t\tif (document.hidden) {\n\t\t\treturn\n\t\t}\n\t\tconst version = await fetchVersion()\n\t\tif (version && version !== initialVersion) {\n\t\t\tsetIsOutdated(true)\n\t\t}\n\t}, [fetchVersion, initialVersion])\n\tconst shouldCheck = !!initialVersion && !isOutdated\n\n\tuseEffect(() => {\n\t\tif (!shouldCheck) {\n\t\t\treturn\n\t\t}\n\t\tconst handle = setInterval(checkVersion, checkIntervalMs)\n\t\treturn () => clearInterval(handle)\n\t}, [checkIntervalMs, checkVersion, shouldCheck])\n\n\tuseEffect(() => {\n\t\tif (!shouldCheck) {\n\t\t\treturn\n\t\t}\n\t\tdocument.addEventListener('visibilitychange', checkVersion)\n\t\treturn () => document.removeEventListener('visibilitychange', checkVersion)\n\t}, [checkVersion, shouldCheck])\n\n\treturn isOutdated\n}\n\nconst getVersionFromDocument = (node: ParentNode) => {\n\tconst meta = node.querySelector<HTMLMetaElement>('meta[name=contember-build-version]')\n\treturn meta?.content\n}\n\nconst useFetchVersion = () => {\n\treturn useCallback(async () => {\n\t\ttry {\n\t\t\tconst result = await (await fetch(window.location.href)).text()\n\t\t\tconst html = document.createElement('html')\n\t\t\thtml.innerHTML = result\n\t\t\treturn getVersionFromDocument(html)\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\treturn undefined\n\t\t}\n\t}, [])\n}\n"],"names":["useState","useCallback","useEffect"],"mappings":";;;AAEA,MAAM,yBAAyB;AAGxB,MAAM,2BAA2B,CAAC,EAAE,kBAAkB,uBAAuB,IAEhF,CAAA,MAAO;AACV,QAAM,CAAC,cAAc,IAAIA,MAAAA,SAAS,MAAM;AAChC,WAAA,uBAAuB,SAAS,IAAI;AAAA,EAAA,CAC3C;AACD,QAAM,CAAC,YAAY,aAAa,IAAIA,MAAAA,SAAS,KAAK;AAClD,QAAM,eAAe,gBAAgB;AAE/B,QAAA,eAAeC,MAAAA,YAAY,YAAY;AAC5C,QAAI,SAAS,QAAQ;AACpB;AAAA,IAAA;AAEK,UAAA,UAAU,MAAM,aAAa;AAC/B,QAAA,WAAW,YAAY,gBAAgB;AAC1C,oBAAc,IAAI;AAAA,IAAA;AAAA,EACnB,GACE,CAAC,cAAc,cAAc,CAAC;AACjC,QAAM,cAAc,CAAC,CAAC,kBAAkB,CAAC;AAEzCC,QAAAA,UAAU,MAAM;AACf,QAAI,CAAC,aAAa;AACjB;AAAA,IAAA;AAEK,UAAA,SAAS,YAAY,cAAc,eAAe;AACjD,WAAA,MAAM,cAAc,MAAM;AAAA,EAC/B,GAAA,CAAC,iBAAiB,cAAc,WAAW,CAAC;AAE/CA,QAAAA,UAAU,MAAM;AACf,QAAI,CAAC,aAAa;AACjB;AAAA,IAAA;AAEQ,aAAA,iBAAiB,oBAAoB,YAAY;AAC1D,WAAO,MAAM,SAAS,oBAAoB,oBAAoB,YAAY;AAAA,EAAA,GACxE,CAAC,cAAc,WAAW,CAAC;AAEvB,SAAA;AACR;AAEA,MAAM,yBAAyB,CAAC,SAAqB;AAC9C,QAAA,OAAO,KAAK,cAA+B,oCAAoC;AACrF,SAAO,MAAM;AACd;AAEA,MAAM,kBAAkB,MAAM;AAC7B,SAAOD,kBAAY,YAAY;AAC1B,QAAA;AACG,YAAA,SAAS,OAAO,MAAM,MAAM,OAAO,SAAS,IAAI,GAAG,KAAK;AACxD,YAAA,OAAO,SAAS,cAAc,MAAM;AAC1C,WAAK,YAAY;AACjB,aAAO,uBAAuB,IAAI;AAAA,aAC1B,GAAG;AACX,cAAQ,MAAM,CAAC;AACR,aAAA;AAAA,IAAA;AAAA,EAET,GAAG,EAAE;AACN;;"}
|
|
@@ -11,7 +11,7 @@ const useIsApplicationOutdated = ({ checkIntervalMs = defaultCheckIntervalMs } =
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
const version = await fetchVersion();
|
|
14
|
-
if (version !== initialVersion) {
|
|
14
|
+
if (version && version !== initialVersion) {
|
|
15
15
|
setIsOutdated(true);
|
|
16
16
|
}
|
|
17
17
|
}, [fetchVersion, initialVersion]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsApplicationOutdated.js","sources":["../../../../../packages/interface/src/hooks/useIsApplicationOutdated.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\n\nconst defaultCheckIntervalMs = 30_000\n\n\nexport const useIsApplicationOutdated = ({ checkIntervalMs = defaultCheckIntervalMs }: {\n\tcheckIntervalMs?: number\n} = {}) => {\n\tconst [initialVersion] = useState(() => {\n\t\treturn getVersionFromDocument(document.head)\n\t})\n\tconst [isOutdated, setIsOutdated] = useState(false)\n\tconst fetchVersion = useFetchVersion()\n\n\tconst checkVersion = useCallback(async () => {\n\t\tif (document.hidden) {\n\t\t\treturn\n\t\t}\n\t\tconst version = await fetchVersion()\n\t\tif (version !== initialVersion) {\n\t\t\tsetIsOutdated(true)\n\t\t}\n\t}, [fetchVersion, initialVersion])\n\tconst shouldCheck = !!initialVersion && !isOutdated\n\n\tuseEffect(() => {\n\t\tif (!shouldCheck) {\n\t\t\treturn\n\t\t}\n\t\tconst handle = setInterval(checkVersion, checkIntervalMs)\n\t\treturn () => clearInterval(handle)\n\t}, [checkIntervalMs, checkVersion, shouldCheck])\n\n\tuseEffect(() => {\n\t\tif (!shouldCheck) {\n\t\t\treturn\n\t\t}\n\t\tdocument.addEventListener('visibilitychange', checkVersion)\n\t\treturn () => document.removeEventListener('visibilitychange', checkVersion)\n\t}, [checkVersion, shouldCheck])\n\n\treturn isOutdated\n}\n\nconst getVersionFromDocument = (node: ParentNode) => {\n\tconst meta = node.querySelector<HTMLMetaElement>('meta[name=contember-build-version]')\n\treturn meta?.content\n}\n\nconst useFetchVersion = () => {\n\treturn useCallback(async () => {\n\t\ttry {\n\t\t\tconst result = await (await fetch(window.location.href)).text()\n\t\t\tconst html = document.createElement('html')\n\t\t\thtml.innerHTML = result\n\t\t\treturn getVersionFromDocument(html)\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\treturn undefined\n\t\t}\n\t}, [])\n}\n"],"names":[],"mappings":";AAEA,MAAM,yBAAyB;AAGxB,MAAM,2BAA2B,CAAC,EAAE,kBAAkB,uBAAuB,IAEhF,CAAA,MAAO;AACV,QAAM,CAAC,cAAc,IAAI,SAAS,MAAM;AAChC,WAAA,uBAAuB,SAAS,IAAI;AAAA,EAAA,CAC3C;AACD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,eAAe;
|
|
1
|
+
{"version":3,"file":"useIsApplicationOutdated.js","sources":["../../../../../packages/interface/src/hooks/useIsApplicationOutdated.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\n\nconst defaultCheckIntervalMs = 30_000\n\n\nexport const useIsApplicationOutdated = ({ checkIntervalMs = defaultCheckIntervalMs }: {\n\tcheckIntervalMs?: number\n} = {}) => {\n\tconst [initialVersion] = useState(() => {\n\t\treturn getVersionFromDocument(document.head)\n\t})\n\tconst [isOutdated, setIsOutdated] = useState(false)\n\tconst fetchVersion = useFetchVersion()\n\n\tconst checkVersion = useCallback(async () => {\n\t\tif (document.hidden) {\n\t\t\treturn\n\t\t}\n\t\tconst version = await fetchVersion()\n\t\tif (version && version !== initialVersion) {\n\t\t\tsetIsOutdated(true)\n\t\t}\n\t}, [fetchVersion, initialVersion])\n\tconst shouldCheck = !!initialVersion && !isOutdated\n\n\tuseEffect(() => {\n\t\tif (!shouldCheck) {\n\t\t\treturn\n\t\t}\n\t\tconst handle = setInterval(checkVersion, checkIntervalMs)\n\t\treturn () => clearInterval(handle)\n\t}, [checkIntervalMs, checkVersion, shouldCheck])\n\n\tuseEffect(() => {\n\t\tif (!shouldCheck) {\n\t\t\treturn\n\t\t}\n\t\tdocument.addEventListener('visibilitychange', checkVersion)\n\t\treturn () => document.removeEventListener('visibilitychange', checkVersion)\n\t}, [checkVersion, shouldCheck])\n\n\treturn isOutdated\n}\n\nconst getVersionFromDocument = (node: ParentNode) => {\n\tconst meta = node.querySelector<HTMLMetaElement>('meta[name=contember-build-version]')\n\treturn meta?.content\n}\n\nconst useFetchVersion = () => {\n\treturn useCallback(async () => {\n\t\ttry {\n\t\t\tconst result = await (await fetch(window.location.href)).text()\n\t\t\tconst html = document.createElement('html')\n\t\t\thtml.innerHTML = result\n\t\t\treturn getVersionFromDocument(html)\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\treturn undefined\n\t\t}\n\t}, [])\n}\n"],"names":[],"mappings":";AAEA,MAAM,yBAAyB;AAGxB,MAAM,2BAA2B,CAAC,EAAE,kBAAkB,uBAAuB,IAEhF,CAAA,MAAO;AACV,QAAM,CAAC,cAAc,IAAI,SAAS,MAAM;AAChC,WAAA,uBAAuB,SAAS,IAAI;AAAA,EAAA,CAC3C;AACD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,eAAe,gBAAgB;AAE/B,QAAA,eAAe,YAAY,YAAY;AAC5C,QAAI,SAAS,QAAQ;AACpB;AAAA,IAAA;AAEK,UAAA,UAAU,MAAM,aAAa;AAC/B,QAAA,WAAW,YAAY,gBAAgB;AAC1C,oBAAc,IAAI;AAAA,IAAA;AAAA,EACnB,GACE,CAAC,cAAc,cAAc,CAAC;AACjC,QAAM,cAAc,CAAC,CAAC,kBAAkB,CAAC;AAEzC,YAAU,MAAM;AACf,QAAI,CAAC,aAAa;AACjB;AAAA,IAAA;AAEK,UAAA,SAAS,YAAY,cAAc,eAAe;AACjD,WAAA,MAAM,cAAc,MAAM;AAAA,EAC/B,GAAA,CAAC,iBAAiB,cAAc,WAAW,CAAC;AAE/C,YAAU,MAAM;AACf,QAAI,CAAC,aAAa;AACjB;AAAA,IAAA;AAEQ,aAAA,iBAAiB,oBAAoB,YAAY;AAC1D,WAAO,MAAM,SAAS,oBAAoB,oBAAoB,YAAY;AAAA,EAAA,GACxE,CAAC,cAAc,WAAW,CAAC;AAEvB,SAAA;AACR;AAEA,MAAM,yBAAyB,CAAC,SAAqB;AAC9C,QAAA,OAAO,KAAK,cAA+B,oCAAoC;AACrF,SAAO,MAAM;AACd;AAEA,MAAM,kBAAkB,MAAM;AAC7B,SAAO,YAAY,YAAY;AAC1B,QAAA;AACG,YAAA,SAAS,OAAO,MAAM,MAAM,OAAO,SAAS,IAAI,GAAG,KAAK;AACxD,YAAA,OAAO,SAAS,cAAc,MAAM;AAC1C,WAAK,YAAY;AACjB,aAAO,uBAAuB,IAAI;AAAA,aAC1B,GAAG;AACX,cAAQ,MAAM,CAAC;AACR,aAAA;AAAA,IAAA;AAAA,EAET,GAAG,EAAE;AACN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationEntrypoint.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ApplicationEntrypoint.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoD,MAAM,0BAA0B,CAAA;AACxG,OAAO,EAAmB,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"ApplicationEntrypoint.d.ts","sourceRoot":"","sources":["../../../src/bootstrap/ApplicationEntrypoint.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAoD,MAAM,0BAA0B,CAAA;AACxG,OAAO,EAAmB,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAwC,MAAM,0BAA0B,CAAA;AAIzF,MAAM,WAAW,0BAA2B,SAAQ,oBAAoB;IACvE,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,QAAQ,CAAA;IACjB,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,CAAC,EAAE,WAAW,CAAA;CACzB;AAQD;;GAEG;AACH,eAAO,MAAM,qBAAqB,UAAW,0BAA0B,4CAmCtE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisconnectEntityTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/binding/DisconnectEntityTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAe,MAAM,OAAO,CAAA;AAE7D,OAAO,EAAoC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"DisconnectEntityTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/binding/DisconnectEntityTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAe,MAAM,OAAO,CAAA;AAE7D,OAAO,EAAoC,kBAAkB,EACtC,uBAAuB,EAAE,2BAA2B,EAA2C,MAAM,0BAA0B,CAAA;AAKtJ,MAAM,WAAW,4BAA4B;IAC5C,gBAAgB,CAAC,EAAE,IAAI,CAAA;IACvB,QAAQ,EAAE,SAAS,CAAA;IACnB,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,CAAA;IAC5D,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAA;IACrD,KAAK,CAAC,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAA;CAC5C;AAED,eAAO,MAAM,uBAAuB,4EAA6E,4BAA4B,4CAqC5I,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export * from './ClearFieldTrigger';
|
|
2
|
-
export * from './DeleteEntityTrigger';
|
|
3
2
|
export * from './DisconnectEntityTrigger';
|
|
4
|
-
export * from './PersistTrigger';
|
|
5
3
|
export * from './EntityBeforePersist';
|
|
6
4
|
export * from './RedirectOnPersist';
|
|
7
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/binding/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/binding/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kCAAkC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ErrorPersistResult, SuccessfulPersistResult } from '@contember/react-binding';
|
|
2
|
+
export type BlockNavigationOnDirtyStateResult = 'save' | 'discard' | 'cancel';
|
|
3
|
+
export declare const useBlockNavigationOnDirtyState: (handler: () => Promise<BlockNavigationOnDirtyStateResult>, options?: {
|
|
4
|
+
onPersistSuccess?: (result: SuccessfulPersistResult) => void;
|
|
5
|
+
onPersistError?: (result: ErrorPersistResult) => void;
|
|
6
|
+
}) => void;
|
|
7
|
+
//# sourceMappingURL=useBlockNavigationOnDirtyState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBlockNavigationOnDirtyState.d.ts","sourceRoot":"","sources":["../../../src/hooks/useBlockNavigationOnDirtyState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAmD,MAAM,0BAA0B,CAAA;AAIvI,MAAM,MAAM,iCAAiC,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAA;AAE7E,eAAO,MAAM,8BAA8B,YAAa,MAAM,OAAO,CAAC,iCAAiC,CAAC,YAAY;IACnH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,CAAA;IAC5D,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAA;CACrD,SA8BA,CAAA"}
|