@contember/react-binding 2.0.0-alpha.19 → 2.0.0-alpha.20

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.
Files changed (56) hide show
  1. package/dist/development/index.cjs +0 -2
  2. package/dist/development/index.cjs.map +1 -1
  3. package/dist/development/index.js +0 -2
  4. package/dist/development/index.js.map +1 -1
  5. package/dist/development/src/accessorPropagation/BindingOperationsContext.cjs +0 -1
  6. package/dist/development/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
  7. package/dist/development/src/accessorPropagation/BindingOperationsContext.js +0 -1
  8. package/dist/development/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
  9. package/dist/development/src/coreComponents/Field.cjs +3 -4
  10. package/dist/development/src/coreComponents/Field.cjs.map +1 -1
  11. package/dist/development/src/coreComponents/Field.js +3 -4
  12. package/dist/development/src/coreComponents/Field.js.map +1 -1
  13. package/dist/development/src/helperComponents/helpers/evaluateCondition.cjs +14 -21
  14. package/dist/development/src/helperComponents/helpers/evaluateCondition.cjs.map +1 -1
  15. package/dist/development/src/helperComponents/helpers/evaluateCondition.js +14 -21
  16. package/dist/development/src/helperComponents/helpers/evaluateCondition.js.map +1 -1
  17. package/dist/production/index.cjs +0 -2
  18. package/dist/production/index.cjs.map +1 -1
  19. package/dist/production/index.js +0 -2
  20. package/dist/production/index.js.map +1 -1
  21. package/dist/production/src/accessorPropagation/BindingOperationsContext.cjs +0 -1
  22. package/dist/production/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
  23. package/dist/production/src/accessorPropagation/BindingOperationsContext.js +0 -1
  24. package/dist/production/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
  25. package/dist/production/src/coreComponents/Field.cjs +1 -2
  26. package/dist/production/src/coreComponents/Field.cjs.map +1 -1
  27. package/dist/production/src/coreComponents/Field.js +1 -2
  28. package/dist/production/src/coreComponents/Field.js.map +1 -1
  29. package/dist/production/src/helperComponents/helpers/evaluateCondition.cjs +14 -21
  30. package/dist/production/src/helperComponents/helpers/evaluateCondition.cjs.map +1 -1
  31. package/dist/production/src/helperComponents/helpers/evaluateCondition.js +14 -21
  32. package/dist/production/src/helperComponents/helpers/evaluateCondition.js.map +1 -1
  33. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts.map +1 -1
  34. package/dist/types/accessorPropagation/index.d.ts +0 -1
  35. package/dist/types/accessorPropagation/index.d.ts.map +1 -1
  36. package/dist/types/coreComponents/Field.d.ts.map +1 -1
  37. package/dist/types/helperComponents/helpers/evaluateCondition.d.ts +2 -2
  38. package/dist/types/helperComponents/helpers/evaluateCondition.d.ts.map +1 -1
  39. package/dist/types/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +8 -8
  41. package/src/accessorPropagation/BindingOperationsContext.ts +0 -1
  42. package/src/accessorPropagation/index.ts +0 -1
  43. package/src/coreComponents/Field.tsx +0 -2
  44. package/src/helperComponents/helpers/evaluateCondition.ts +16 -23
  45. package/tests/cases/unit/helperComponents/evaluateCondition.spec.ts +0 -4
  46. package/dist/development/src/accessorPropagation/useGetTreeFilters.cjs +0 -6
  47. package/dist/development/src/accessorPropagation/useGetTreeFilters.cjs.map +0 -1
  48. package/dist/development/src/accessorPropagation/useGetTreeFilters.js +0 -6
  49. package/dist/development/src/accessorPropagation/useGetTreeFilters.js.map +0 -1
  50. package/dist/production/src/accessorPropagation/useGetTreeFilters.cjs +0 -6
  51. package/dist/production/src/accessorPropagation/useGetTreeFilters.cjs.map +0 -1
  52. package/dist/production/src/accessorPropagation/useGetTreeFilters.js +0 -6
  53. package/dist/production/src/accessorPropagation/useGetTreeFilters.js.map +0 -1
  54. package/dist/types/accessorPropagation/useGetTreeFilters.d.ts +0 -3
  55. package/dist/types/accessorPropagation/useGetTreeFilters.d.ts.map +0 -1
  56. package/src/accessorPropagation/useGetTreeFilters.ts +0 -4
@@ -34,7 +34,6 @@ const useField = require("./src/accessorPropagation/useField.cjs");
34
34
  const useGetEntityByKey = require("./src/accessorPropagation/useGetEntityByKey.cjs");
35
35
  const useGetEntityListSubTree = require("./src/accessorPropagation/useGetEntityListSubTree.cjs");
36
36
  const useGetEntitySubTree = require("./src/accessorPropagation/useGetEntitySubTree.cjs");
37
- const useGetTreeFilters = require("./src/accessorPropagation/useGetTreeFilters.cjs");
38
37
  const usePersist = require("./src/accessorPropagation/usePersist.cjs");
39
38
  const useTreeRootId = require("./src/accessorPropagation/useTreeRootId.cjs");
40
39
  const addEntityAtIndex = require("./src/accessorSorting/addEntityAtIndex.cjs");
@@ -103,7 +102,6 @@ exports.useField = useField.useField;
103
102
  exports.useGetEntityByKey = useGetEntityByKey.useGetEntityByKey;
104
103
  exports.useGetEntityListSubTree = useGetEntityListSubTree.useGetEntityListSubTree;
105
104
  exports.useGetEntitySubTree = useGetEntitySubTree.useGetEntitySubTree;
106
- exports.useGetTreeFilters = useGetTreeFilters.useGetTreeFilters;
107
105
  exports.usePersist = usePersist.usePersist;
108
106
  exports.useTreeRootId = useTreeRootId.useTreeRootId;
109
107
  exports.addEntityAtIndex = addEntityAtIndex.addEntityAtIndex;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -32,7 +32,6 @@ import { useField } from "./src/accessorPropagation/useField.js";
32
32
  import { useGetEntityByKey } from "./src/accessorPropagation/useGetEntityByKey.js";
33
33
  import { useGetEntityListSubTree } from "./src/accessorPropagation/useGetEntityListSubTree.js";
34
34
  import { useGetEntitySubTree } from "./src/accessorPropagation/useGetEntitySubTree.js";
35
- import { useGetTreeFilters } from "./src/accessorPropagation/useGetTreeFilters.js";
36
35
  import { usePersist } from "./src/accessorPropagation/usePersist.js";
37
36
  import { useTreeRootId } from "./src/accessorPropagation/useTreeRootId.js";
38
37
  import { addEntityAtIndex } from "./src/accessorSorting/addEntityAtIndex.js";
@@ -131,7 +130,6 @@ export {
131
130
  useGetEntityByKey,
132
131
  useGetEntityListSubTree,
133
132
  useGetEntitySubTree,
134
- useGetTreeFilters,
135
133
  useHasEntity,
136
134
  useLabelMiddleware,
137
135
  useMutationState,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -20,7 +20,6 @@ const defaultBindingOperations = Object.freeze({
20
20
  getEntityListSubTree: getRejecter("retrieve an entity list sub tree"),
21
21
  getEntitySubTree: getRejecter("retrieve a single entity sub tree"),
22
22
  getEntityByKey: getRejecter("retrieve an entity by key"),
23
- getTreeFilters: getRejecter("retrieve tree filters"),
24
23
  batchDeferredUpdates: getRejecter("batch deferred updates"),
25
24
  extendTree: getRejecter("extendTree"),
26
25
  persist: getRejecter("persist"),
@@ -1 +1 @@
1
- {"version":3,"file":"BindingOperationsContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":["BindingError","createContext"],"mappings":";;;;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAIA,QAAA;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2BC,oBAA4C,wBAAwB;;;"}
1
+ {"version":3,"file":"BindingOperationsContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":["BindingError","createContext"],"mappings":";;;;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAIA,QAAA;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2BC,oBAA4C,wBAAwB;;;"}
@@ -18,7 +18,6 @@ const defaultBindingOperations = Object.freeze({
18
18
  getEntityListSubTree: getRejecter("retrieve an entity list sub tree"),
19
19
  getEntitySubTree: getRejecter("retrieve a single entity sub tree"),
20
20
  getEntityByKey: getRejecter("retrieve an entity by key"),
21
- getTreeFilters: getRejecter("retrieve tree filters"),
22
21
  batchDeferredUpdates: getRejecter("batch deferred updates"),
23
22
  extendTree: getRejecter("extendTree"),
24
23
  persist: getRejecter("persist"),
@@ -1 +1 @@
1
- {"version":3,"file":"BindingOperationsContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":[],"mappings":";;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAI;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2B,cAA4C,wBAAwB;"}
1
+ {"version":3,"file":"BindingOperationsContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":[],"mappings":";;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAI;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2B,cAA4C,wBAAwB;"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxDevRuntime = require("react/jsx-dev-runtime");
4
- const client = require("@contember/client");
5
4
  const binding = require("@contember/binding");
6
5
  const Component = require("./Component.cjs");
7
6
  const useField = require("../accessorPropagation/useField.cjs");
@@ -11,16 +10,16 @@ const Field = Component.Component(
11
10
  if (props.format !== void 0) {
12
11
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: props.format(field.value) }, void 0, false, {
13
12
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/coreComponents/Field.tsx",
14
- lineNumber: 27,
13
+ lineNumber: 26,
15
14
  columnNumber: 11
16
15
  }, void 0);
17
16
  }
18
- if (field.value instanceof client.GraphQlBuilder.GraphQlLiteral || field.value === null || typeof field.value === "boolean") {
17
+ if (field.value === null || typeof field.value === "boolean") {
19
18
  return null;
20
19
  }
21
20
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: field.value }, void 0, false, {
22
21
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/coreComponents/Field.tsx",
23
- lineNumber: 37,
22
+ lineNumber: 35,
24
23
  columnNumber: 10
25
24
  }, void 0);
26
25
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Field.cjs","sources":["../../../../../packages/react-binding/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\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;;"}
1
+ {"version":3,"file":"Field.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/Field.tsx"],"sourcesContent":["import 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\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 === 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","MarkerFactory","TreeNodeEnvironmentFactory"],"mappings":";;;;;;AAoBO,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;AAEA,QACC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAAF,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,gBAAgBC,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;;"}
@@ -1,5 +1,4 @@
1
1
  import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
2
- import { GraphQlBuilder } from "@contember/client";
3
2
  import { MarkerFactory, TreeNodeEnvironmentFactory } from "@contember/binding";
4
3
  import { Component } from "./Component.js";
5
4
  import { useField } from "../accessorPropagation/useField.js";
@@ -9,16 +8,16 @@ const Field = Component(
9
8
  if (props.format !== void 0) {
10
9
  return /* @__PURE__ */ jsxDEV(Fragment, { children: props.format(field.value) }, void 0, false, {
11
10
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/coreComponents/Field.tsx",
12
- lineNumber: 27,
11
+ lineNumber: 26,
13
12
  columnNumber: 11
14
13
  }, void 0);
15
14
  }
16
- if (field.value instanceof GraphQlBuilder.GraphQlLiteral || field.value === null || typeof field.value === "boolean") {
15
+ if (field.value === null || typeof field.value === "boolean") {
17
16
  return null;
18
17
  }
19
18
  return /* @__PURE__ */ jsxDEV(Fragment, { children: field.value }, void 0, false, {
20
19
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/coreComponents/Field.tsx",
21
- lineNumber: 37,
20
+ lineNumber: 35,
22
21
  columnNumber: 10
23
22
  }, void 0);
24
23
  },
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../../../packages/react-binding/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\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;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../../../packages/react-binding/src/coreComponents/Field.tsx"],"sourcesContent":["import 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\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 === 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":";;;;AAoBO,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;AAEA,QACC,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;"}
@@ -1,33 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const client = require("@contember/client");
4
3
  const binding = require("@contember/binding");
5
- const unwrapGraphqlLiteral = (value) => {
6
- if (value instanceof client.GraphQlLiteral) {
7
- return value.value;
8
- }
9
- return value;
10
- };
11
4
  const evaluateCondition = (value, condition) => {
12
5
  const handlers = {
13
6
  and: (expr) => expr.every((it) => evaluateCondition(value, it)),
14
7
  or: (expr) => expr.some((it) => evaluateCondition(value, it)),
15
8
  not: (expr) => !evaluateCondition(value, expr),
16
- eq: (expr) => value === unwrapGraphqlLiteral(expr),
17
- notEq: (expr) => value !== unwrapGraphqlLiteral(expr),
9
+ eq: (expr) => value === expr,
10
+ notEq: (expr) => value !== expr,
18
11
  isNull: (expr) => value === null === expr,
19
- in: (expr) => expr.map(unwrapGraphqlLiteral).includes(value),
20
- notIn: (expr) => !expr.map(unwrapGraphqlLiteral).includes(value),
21
- lt: (expr) => value !== null && value < unwrapGraphqlLiteral(expr),
22
- lte: (expr) => value !== null && value <= unwrapGraphqlLiteral(expr),
23
- gt: (expr) => value !== null && value > unwrapGraphqlLiteral(expr),
24
- gte: (expr) => value !== null && value >= unwrapGraphqlLiteral(expr),
25
- contains: (expr) => typeof value === "string" && value.includes(unwrapGraphqlLiteral(expr)),
26
- startsWith: (expr) => typeof value === "string" && value.startsWith(unwrapGraphqlLiteral(expr)),
27
- endsWith: (expr) => typeof value === "string" && value.endsWith(unwrapGraphqlLiteral(expr)),
28
- containsCI: (expr) => typeof value === "string" && value.toLowerCase().includes(unwrapGraphqlLiteral(expr).toLowerCase()),
29
- startsWithCI: (expr) => typeof value === "string" && value.toLowerCase().startsWith(unwrapGraphqlLiteral(expr).toLowerCase()),
30
- endsWithCI: (expr) => typeof value === "string" && value.toLowerCase().endsWith(unwrapGraphqlLiteral(expr).toLowerCase()),
12
+ in: (expr) => expr.includes(value),
13
+ notIn: (expr) => !expr.includes(value),
14
+ lt: (expr) => value !== null && value < expr,
15
+ lte: (expr) => value !== null && value <= expr,
16
+ gt: (expr) => value !== null && value > expr,
17
+ gte: (expr) => value !== null && value >= expr,
18
+ contains: (expr) => typeof value === "string" && value.includes(expr),
19
+ startsWith: (expr) => typeof value === "string" && value.startsWith(expr),
20
+ endsWith: (expr) => typeof value === "string" && value.endsWith(expr),
21
+ containsCI: (expr) => typeof value === "string" && value.toLowerCase().includes(expr.toLowerCase()),
22
+ startsWithCI: (expr) => typeof value === "string" && value.toLowerCase().startsWith(expr.toLowerCase()),
23
+ endsWithCI: (expr) => typeof value === "string" && value.toLowerCase().endsWith(expr.toLowerCase()),
31
24
  never: () => false,
32
25
  always: () => true,
33
26
  // deprecated
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateCondition.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { GraphQlLiteral, Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst unwrapGraphqlLiteral = (value: Input.ColumnValue<GraphQlLiteral>): any => {\n\tif (value instanceof GraphQlLiteral) {\n\t\treturn value.value\n\t}\n\treturn value\n}\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue<GraphQlLiteral>>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === unwrapGraphqlLiteral(expr),\n\t\tnotEq: expr => value !== unwrapGraphqlLiteral(expr),\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.map(unwrapGraphqlLiteral).includes(value),\n\t\tnotIn: expr => !expr.map(unwrapGraphqlLiteral).includes(value),\n\t\tlt: expr => value !== null && value < unwrapGraphqlLiteral(expr),\n\t\tlte: expr => value !== null && value <= unwrapGraphqlLiteral(expr),\n\t\tgt: expr => value !== null && value > unwrapGraphqlLiteral(expr),\n\t\tgte: expr => value !== null && value >= unwrapGraphqlLiteral(expr),\n\t\tcontains: expr => typeof value === 'string' && value.includes(unwrapGraphqlLiteral(expr)),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(unwrapGraphqlLiteral(expr)),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(unwrapGraphqlLiteral(expr)),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":["GraphQlLiteral","BindingError"],"mappings":";;;;AAIA,MAAM,uBAAuB,CAAC,UAAkD;AAC/E,MAAI,iBAAiBA,OAAAA,gBAAgB;AACpC,WAAO,MAAM;AAAA,EACd;AACO,SAAA;AACR;AAEa,MAAA,oBAAoB,CAAC,OAA0B,cAAkE;AAC7H,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAC/C,OAAO,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAClD,QAAQ,CAAS,SAAA,UAAU,SAAU;AAAA,IACrC,IAAI,CAAQ,SAAA,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IACzD,OAAO,UAAQ,CAAC,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IAC7D,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,UAAQ,OAAO,UAAU,YAAY,MAAM,WAAW,qBAAqB,IAAI,CAAC;AAAA,IAC5F,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,cAAc,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,WAAW,qBAAqB,IAAI,EAAE,aAAa;AAAA,IAC1H,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAS,SAAA,UAAU,SAAU;AAAA,EAAA;AAE7B,SAAA,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACA,UAAM,aAAa;AACb,UAAA,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAIC,QAAa,aAAA;AAAA,IACxB;AACA,WAAQ,QAAgB,QAAQ;AAAA,EAAA,CAChC;AACF;;"}
1
+ {"version":3,"file":"evaluateCondition.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === expr,\n\t\tnotEq: expr => value !== expr,\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.includes(value),\n\t\tnotIn: expr => !expr.includes(value),\n\t\tlt: expr => value !== null && value < expr,\n\t\tlte: expr => value !== null && value <= expr,\n\t\tgt: expr => value !== null && value > expr,\n\t\tgte: expr => value !== null && value >= expr,\n\t\tcontains: expr => typeof value === 'string' && value.includes(expr),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(expr),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(expr),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(expr.toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(expr.toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(expr.toLowerCase()),\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":["BindingError"],"mappings":";;;AAIa,MAAA,oBAAoB,CAAC,OAA0B,cAAkD;AAC7G,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,UAAQ,UAAU;AAAA,IACtB,OAAO,UAAQ,UAAU;AAAA,IACzB,QAAQ,CAAS,SAAA,UAAU,SAAU;AAAA,IACrC,IAAI,CAAA,SAAQ,KAAK,SAAS,KAAK;AAAA,IAC/B,OAAO,CAAA,SAAQ,CAAC,KAAK,SAAS,KAAK;AAAA,IACnC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,UAAU,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,WAAW,IAAI;AAAA,IACtE,UAAU,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,cAAc,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,cAAc,WAAW,KAAK,YAAA,CAAa;AAAA,IACpG,YAAY,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAS,SAAA,UAAU,SAAU;AAAA,EAAA;AAE7B,SAAA,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACA,UAAM,aAAa;AACb,UAAA,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACA,WAAQ,QAAgB,QAAQ;AAAA,EAAA,CAChC;AACF;;"}
@@ -1,31 +1,24 @@
1
- import { GraphQlLiteral } from "@contember/client";
2
1
  import { BindingError } from "@contember/binding";
3
- const unwrapGraphqlLiteral = (value) => {
4
- if (value instanceof GraphQlLiteral) {
5
- return value.value;
6
- }
7
- return value;
8
- };
9
2
  const evaluateCondition = (value, condition) => {
10
3
  const handlers = {
11
4
  and: (expr) => expr.every((it) => evaluateCondition(value, it)),
12
5
  or: (expr) => expr.some((it) => evaluateCondition(value, it)),
13
6
  not: (expr) => !evaluateCondition(value, expr),
14
- eq: (expr) => value === unwrapGraphqlLiteral(expr),
15
- notEq: (expr) => value !== unwrapGraphqlLiteral(expr),
7
+ eq: (expr) => value === expr,
8
+ notEq: (expr) => value !== expr,
16
9
  isNull: (expr) => value === null === expr,
17
- in: (expr) => expr.map(unwrapGraphqlLiteral).includes(value),
18
- notIn: (expr) => !expr.map(unwrapGraphqlLiteral).includes(value),
19
- lt: (expr) => value !== null && value < unwrapGraphqlLiteral(expr),
20
- lte: (expr) => value !== null && value <= unwrapGraphqlLiteral(expr),
21
- gt: (expr) => value !== null && value > unwrapGraphqlLiteral(expr),
22
- gte: (expr) => value !== null && value >= unwrapGraphqlLiteral(expr),
23
- contains: (expr) => typeof value === "string" && value.includes(unwrapGraphqlLiteral(expr)),
24
- startsWith: (expr) => typeof value === "string" && value.startsWith(unwrapGraphqlLiteral(expr)),
25
- endsWith: (expr) => typeof value === "string" && value.endsWith(unwrapGraphqlLiteral(expr)),
26
- containsCI: (expr) => typeof value === "string" && value.toLowerCase().includes(unwrapGraphqlLiteral(expr).toLowerCase()),
27
- startsWithCI: (expr) => typeof value === "string" && value.toLowerCase().startsWith(unwrapGraphqlLiteral(expr).toLowerCase()),
28
- endsWithCI: (expr) => typeof value === "string" && value.toLowerCase().endsWith(unwrapGraphqlLiteral(expr).toLowerCase()),
10
+ in: (expr) => expr.includes(value),
11
+ notIn: (expr) => !expr.includes(value),
12
+ lt: (expr) => value !== null && value < expr,
13
+ lte: (expr) => value !== null && value <= expr,
14
+ gt: (expr) => value !== null && value > expr,
15
+ gte: (expr) => value !== null && value >= expr,
16
+ contains: (expr) => typeof value === "string" && value.includes(expr),
17
+ startsWith: (expr) => typeof value === "string" && value.startsWith(expr),
18
+ endsWith: (expr) => typeof value === "string" && value.endsWith(expr),
19
+ containsCI: (expr) => typeof value === "string" && value.toLowerCase().includes(expr.toLowerCase()),
20
+ startsWithCI: (expr) => typeof value === "string" && value.toLowerCase().startsWith(expr.toLowerCase()),
21
+ endsWithCI: (expr) => typeof value === "string" && value.toLowerCase().endsWith(expr.toLowerCase()),
29
22
  never: () => false,
30
23
  always: () => true,
31
24
  // deprecated
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateCondition.js","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { GraphQlLiteral, Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst unwrapGraphqlLiteral = (value: Input.ColumnValue<GraphQlLiteral>): any => {\n\tif (value instanceof GraphQlLiteral) {\n\t\treturn value.value\n\t}\n\treturn value\n}\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue<GraphQlLiteral>>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === unwrapGraphqlLiteral(expr),\n\t\tnotEq: expr => value !== unwrapGraphqlLiteral(expr),\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.map(unwrapGraphqlLiteral).includes(value),\n\t\tnotIn: expr => !expr.map(unwrapGraphqlLiteral).includes(value),\n\t\tlt: expr => value !== null && value < unwrapGraphqlLiteral(expr),\n\t\tlte: expr => value !== null && value <= unwrapGraphqlLiteral(expr),\n\t\tgt: expr => value !== null && value > unwrapGraphqlLiteral(expr),\n\t\tgte: expr => value !== null && value >= unwrapGraphqlLiteral(expr),\n\t\tcontains: expr => typeof value === 'string' && value.includes(unwrapGraphqlLiteral(expr)),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(unwrapGraphqlLiteral(expr)),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(unwrapGraphqlLiteral(expr)),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":[],"mappings":";;AAIA,MAAM,uBAAuB,CAAC,UAAkD;AAC/E,MAAI,iBAAiB,gBAAgB;AACpC,WAAO,MAAM;AAAA,EACd;AACO,SAAA;AACR;AAEa,MAAA,oBAAoB,CAAC,OAA0B,cAAkE;AAC7H,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAC/C,OAAO,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAClD,QAAQ,CAAS,SAAA,UAAU,SAAU;AAAA,IACrC,IAAI,CAAQ,SAAA,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IACzD,OAAO,UAAQ,CAAC,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IAC7D,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,UAAQ,OAAO,UAAU,YAAY,MAAM,WAAW,qBAAqB,IAAI,CAAC;AAAA,IAC5F,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,cAAc,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,WAAW,qBAAqB,IAAI,EAAE,aAAa;AAAA,IAC1H,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAS,SAAA,UAAU,SAAU;AAAA,EAAA;AAE7B,SAAA,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACA,UAAM,aAAa;AACb,UAAA,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAI,aAAa;AAAA,IACxB;AACA,WAAQ,QAAgB,QAAQ;AAAA,EAAA,CAChC;AACF;"}
1
+ {"version":3,"file":"evaluateCondition.js","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === expr,\n\t\tnotEq: expr => value !== expr,\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.includes(value),\n\t\tnotIn: expr => !expr.includes(value),\n\t\tlt: expr => value !== null && value < expr,\n\t\tlte: expr => value !== null && value <= expr,\n\t\tgt: expr => value !== null && value > expr,\n\t\tgte: expr => value !== null && value >= expr,\n\t\tcontains: expr => typeof value === 'string' && value.includes(expr),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(expr),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(expr),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(expr.toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(expr.toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(expr.toLowerCase()),\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":[],"mappings":";AAIa,MAAA,oBAAoB,CAAC,OAA0B,cAAkD;AAC7G,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,UAAQ,UAAU;AAAA,IACtB,OAAO,UAAQ,UAAU;AAAA,IACzB,QAAQ,CAAS,SAAA,UAAU,SAAU;AAAA,IACrC,IAAI,CAAA,SAAQ,KAAK,SAAS,KAAK;AAAA,IAC/B,OAAO,CAAA,SAAQ,CAAC,KAAK,SAAS,KAAK;AAAA,IACnC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,UAAU,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,WAAW,IAAI;AAAA,IACtE,UAAU,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,cAAc,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,cAAc,WAAW,KAAK,YAAA,CAAa;AAAA,IACpG,YAAY,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAS,SAAA,UAAU,SAAU;AAAA,EAAA;AAE7B,SAAA,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACA,UAAM,aAAa;AACb,UAAA,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAI,aAAa;AAAA,IACxB;AACA,WAAQ,QAAgB,QAAQ;AAAA,EAAA,CAChC;AACF;"}
@@ -34,7 +34,6 @@ const useField = require("./src/accessorPropagation/useField.cjs");
34
34
  const useGetEntityByKey = require("./src/accessorPropagation/useGetEntityByKey.cjs");
35
35
  const useGetEntityListSubTree = require("./src/accessorPropagation/useGetEntityListSubTree.cjs");
36
36
  const useGetEntitySubTree = require("./src/accessorPropagation/useGetEntitySubTree.cjs");
37
- const useGetTreeFilters = require("./src/accessorPropagation/useGetTreeFilters.cjs");
38
37
  const usePersist = require("./src/accessorPropagation/usePersist.cjs");
39
38
  const useTreeRootId = require("./src/accessorPropagation/useTreeRootId.cjs");
40
39
  const addEntityAtIndex = require("./src/accessorSorting/addEntityAtIndex.cjs");
@@ -103,7 +102,6 @@ exports.useField = useField.useField;
103
102
  exports.useGetEntityByKey = useGetEntityByKey.useGetEntityByKey;
104
103
  exports.useGetEntityListSubTree = useGetEntityListSubTree.useGetEntityListSubTree;
105
104
  exports.useGetEntitySubTree = useGetEntitySubTree.useGetEntitySubTree;
106
- exports.useGetTreeFilters = useGetTreeFilters.useGetTreeFilters;
107
105
  exports.usePersist = usePersist.usePersist;
108
106
  exports.useTreeRootId = useTreeRootId.useTreeRootId;
109
107
  exports.addEntityAtIndex = addEntityAtIndex.addEntityAtIndex;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -32,7 +32,6 @@ import { useField } from "./src/accessorPropagation/useField.js";
32
32
  import { useGetEntityByKey } from "./src/accessorPropagation/useGetEntityByKey.js";
33
33
  import { useGetEntityListSubTree } from "./src/accessorPropagation/useGetEntityListSubTree.js";
34
34
  import { useGetEntitySubTree } from "./src/accessorPropagation/useGetEntitySubTree.js";
35
- import { useGetTreeFilters } from "./src/accessorPropagation/useGetTreeFilters.js";
36
35
  import { usePersist } from "./src/accessorPropagation/usePersist.js";
37
36
  import { useTreeRootId } from "./src/accessorPropagation/useTreeRootId.js";
38
37
  import { addEntityAtIndex } from "./src/accessorSorting/addEntityAtIndex.js";
@@ -131,7 +130,6 @@ export {
131
130
  useGetEntityByKey,
132
131
  useGetEntityListSubTree,
133
132
  useGetEntitySubTree,
134
- useGetTreeFilters,
135
133
  useHasEntity,
136
134
  useLabelMiddleware,
137
135
  useMutationState,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -20,7 +20,6 @@ const defaultBindingOperations = Object.freeze({
20
20
  getEntityListSubTree: getRejecter("retrieve an entity list sub tree"),
21
21
  getEntitySubTree: getRejecter("retrieve a single entity sub tree"),
22
22
  getEntityByKey: getRejecter("retrieve an entity by key"),
23
- getTreeFilters: getRejecter("retrieve tree filters"),
24
23
  batchDeferredUpdates: getRejecter("batch deferred updates"),
25
24
  extendTree: getRejecter("extendTree"),
26
25
  persist: getRejecter("persist"),
@@ -1 +1 @@
1
- {"version":3,"file":"BindingOperationsContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":["BindingError","createContext"],"mappings":";;;;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAIA,QAAA;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2BC,oBAA4C,wBAAwB;;;"}
1
+ {"version":3,"file":"BindingOperationsContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":["BindingError","createContext"],"mappings":";;;;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAIA,QAAA;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2BC,oBAA4C,wBAAwB;;;"}
@@ -18,7 +18,6 @@ const defaultBindingOperations = Object.freeze({
18
18
  getEntityListSubTree: getRejecter("retrieve an entity list sub tree"),
19
19
  getEntitySubTree: getRejecter("retrieve a single entity sub tree"),
20
20
  getEntityByKey: getRejecter("retrieve an entity by key"),
21
- getTreeFilters: getRejecter("retrieve tree filters"),
22
21
  batchDeferredUpdates: getRejecter("batch deferred updates"),
23
22
  extendTree: getRejecter("extendTree"),
24
23
  persist: getRejecter("persist"),
@@ -1 +1 @@
1
- {"version":3,"file":"BindingOperationsContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":[],"mappings":";;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAI;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2B,cAA4C,wBAAwB;"}
1
+ {"version":3,"file":"BindingOperationsContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":[],"mappings":";;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAI;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2B,cAA4C,wBAAwB;"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
- const client = require("@contember/client");
5
4
  const binding = require("@contember/binding");
6
5
  const Component = require("./Component.cjs");
7
6
  const useField = require("../accessorPropagation/useField.cjs");
@@ -11,7 +10,7 @@ const Field = Component.Component(
11
10
  if (props.format !== void 0) {
12
11
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.format(field.value) });
13
12
  }
14
- if (field.value instanceof client.GraphQlBuilder.GraphQlLiteral || field.value === null || typeof field.value === "boolean") {
13
+ if (field.value === null || typeof field.value === "boolean") {
15
14
  return null;
16
15
  }
17
16
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: field.value });
@@ -1 +1 @@
1
- {"version":3,"file":"Field.cjs","sources":["../../../../../packages/react-binding/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\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","jsx","Fragment","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,2BAAA,IAAAC,qBAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAAE,CAAA;AAAA,IACrC;AAGC,QAAA,MAAM,iBAAiBC,OAAA,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAAF,2BAAAA,IAAAC,WAAAA,UAAA,EAAG,gBAAM,MAAM,CAAA;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;;"}
1
+ {"version":3,"file":"Field.cjs","sources":["../../../../../packages/react-binding/src/coreComponents/Field.tsx"],"sourcesContent":["import 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\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 === 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","jsx","Fragment","MarkerFactory","TreeNodeEnvironmentFactory"],"mappings":";;;;;;AAoBO,MAAM,QAAQA,UAAA;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQC,kBAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAUC,2BAAA,IAAAC,qBAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAAE,CAAA;AAAA,IACrC;AAEA,QACC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAAD,2BAAAA,IAAAC,WAAAA,UAAA,EAAG,gBAAM,MAAM,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgBC,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;;"}
@@ -1,5 +1,4 @@
1
1
  import { jsx, Fragment } from "react/jsx-runtime";
2
- import { GraphQlBuilder } from "@contember/client";
3
2
  import { MarkerFactory, TreeNodeEnvironmentFactory } from "@contember/binding";
4
3
  import { Component } from "./Component.js";
5
4
  import { useField } from "../accessorPropagation/useField.js";
@@ -9,7 +8,7 @@ const Field = Component(
9
8
  if (props.format !== void 0) {
10
9
  return /* @__PURE__ */ jsx(Fragment, { children: props.format(field.value) });
11
10
  }
12
- if (field.value instanceof GraphQlBuilder.GraphQlLiteral || field.value === null || typeof field.value === "boolean") {
11
+ if (field.value === null || typeof field.value === "boolean") {
13
12
  return null;
14
13
  }
15
14
  return /* @__PURE__ */ jsx(Fragment, { children: field.value });
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../../../packages/react-binding/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\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":[],"mappings":";;;;;AAqBO,MAAM,QAAQ;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQ,SAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAAE,CAAA;AAAA,IACrC;AAGC,QAAA,MAAM,iBAAiB,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,MAAM,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO,WAAW;AAAA,IAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,aAAA,2BAA2B,0BAA0B,aAAa,KAAK;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../../../packages/react-binding/src/coreComponents/Field.tsx"],"sourcesContent":["import 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\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 === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;;AAoBO,MAAM,QAAQ;AAAA,EACpB,CAA4C,UAAiC;AACtE,UAAA,QAAQ,SAAoB,KAAK;AAEnC,QAAA,MAAM,WAAW,QAAW;AAC/B,aAAU,oBAAA,UAAA,EAAA,UAAA,MAAM,OAAO,MAAM,KAAK,EAAE,CAAA;AAAA,IACrC;AAEA,QACC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,aAAA;AAAA,IACR;AACO,WAAA,oBAAA,UAAA,EAAG,gBAAM,MAAM,CAAA;AAAA,EACvB;AAAA,EACA;AAAA,IACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO,WAAW;AAAA,IAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,aAAA,2BAA2B,0BAA0B,aAAa,KAAK;AAAA,IAC/E;AAAA,EACD;AAAA,EACA;AACD;"}
@@ -1,33 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const client = require("@contember/client");
4
3
  const binding = require("@contember/binding");
5
- const unwrapGraphqlLiteral = (value) => {
6
- if (value instanceof client.GraphQlLiteral) {
7
- return value.value;
8
- }
9
- return value;
10
- };
11
4
  const evaluateCondition = (value, condition) => {
12
5
  const handlers = {
13
6
  and: (expr) => expr.every((it) => evaluateCondition(value, it)),
14
7
  or: (expr) => expr.some((it) => evaluateCondition(value, it)),
15
8
  not: (expr) => !evaluateCondition(value, expr),
16
- eq: (expr) => value === unwrapGraphqlLiteral(expr),
17
- notEq: (expr) => value !== unwrapGraphqlLiteral(expr),
9
+ eq: (expr) => value === expr,
10
+ notEq: (expr) => value !== expr,
18
11
  isNull: (expr) => value === null === expr,
19
- in: (expr) => expr.map(unwrapGraphqlLiteral).includes(value),
20
- notIn: (expr) => !expr.map(unwrapGraphqlLiteral).includes(value),
21
- lt: (expr) => value !== null && value < unwrapGraphqlLiteral(expr),
22
- lte: (expr) => value !== null && value <= unwrapGraphqlLiteral(expr),
23
- gt: (expr) => value !== null && value > unwrapGraphqlLiteral(expr),
24
- gte: (expr) => value !== null && value >= unwrapGraphqlLiteral(expr),
25
- contains: (expr) => typeof value === "string" && value.includes(unwrapGraphqlLiteral(expr)),
26
- startsWith: (expr) => typeof value === "string" && value.startsWith(unwrapGraphqlLiteral(expr)),
27
- endsWith: (expr) => typeof value === "string" && value.endsWith(unwrapGraphqlLiteral(expr)),
28
- containsCI: (expr) => typeof value === "string" && value.toLowerCase().includes(unwrapGraphqlLiteral(expr).toLowerCase()),
29
- startsWithCI: (expr) => typeof value === "string" && value.toLowerCase().startsWith(unwrapGraphqlLiteral(expr).toLowerCase()),
30
- endsWithCI: (expr) => typeof value === "string" && value.toLowerCase().endsWith(unwrapGraphqlLiteral(expr).toLowerCase()),
12
+ in: (expr) => expr.includes(value),
13
+ notIn: (expr) => !expr.includes(value),
14
+ lt: (expr) => value !== null && value < expr,
15
+ lte: (expr) => value !== null && value <= expr,
16
+ gt: (expr) => value !== null && value > expr,
17
+ gte: (expr) => value !== null && value >= expr,
18
+ contains: (expr) => typeof value === "string" && value.includes(expr),
19
+ startsWith: (expr) => typeof value === "string" && value.startsWith(expr),
20
+ endsWith: (expr) => typeof value === "string" && value.endsWith(expr),
21
+ containsCI: (expr) => typeof value === "string" && value.toLowerCase().includes(expr.toLowerCase()),
22
+ startsWithCI: (expr) => typeof value === "string" && value.toLowerCase().startsWith(expr.toLowerCase()),
23
+ endsWithCI: (expr) => typeof value === "string" && value.toLowerCase().endsWith(expr.toLowerCase()),
31
24
  never: () => false,
32
25
  always: () => true,
33
26
  // deprecated
@@ -1 +1 @@
1
- {"version":3,"file":"evaluateCondition.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { GraphQlLiteral, Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst unwrapGraphqlLiteral = (value: Input.ColumnValue<GraphQlLiteral>): any => {\n\tif (value instanceof GraphQlLiteral) {\n\t\treturn value.value\n\t}\n\treturn value\n}\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue<GraphQlLiteral>>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === unwrapGraphqlLiteral(expr),\n\t\tnotEq: expr => value !== unwrapGraphqlLiteral(expr),\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.map(unwrapGraphqlLiteral).includes(value),\n\t\tnotIn: expr => !expr.map(unwrapGraphqlLiteral).includes(value),\n\t\tlt: expr => value !== null && value < unwrapGraphqlLiteral(expr),\n\t\tlte: expr => value !== null && value <= unwrapGraphqlLiteral(expr),\n\t\tgt: expr => value !== null && value > unwrapGraphqlLiteral(expr),\n\t\tgte: expr => value !== null && value >= unwrapGraphqlLiteral(expr),\n\t\tcontains: expr => typeof value === 'string' && value.includes(unwrapGraphqlLiteral(expr)),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(unwrapGraphqlLiteral(expr)),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(unwrapGraphqlLiteral(expr)),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(unwrapGraphqlLiteral(expr).toLowerCase()),\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":["GraphQlLiteral","BindingError"],"mappings":";;;;AAIA,MAAM,uBAAuB,CAAC,UAAkD;AAC/E,MAAI,iBAAiBA,OAAAA,gBAAgB;AACpC,WAAO,MAAM;AAAA,EACd;AACO,SAAA;AACR;AAEa,MAAA,oBAAoB,CAAC,OAA0B,cAAkE;AAC7H,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAC/C,OAAO,CAAA,SAAQ,UAAU,qBAAqB,IAAI;AAAA,IAClD,QAAQ,CAAS,SAAA,UAAU,SAAU;AAAA,IACrC,IAAI,CAAQ,SAAA,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IACzD,OAAO,UAAQ,CAAC,KAAK,IAAI,oBAAoB,EAAE,SAAS,KAAK;AAAA,IAC7D,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,IAAI,CAAQ,SAAA,UAAU,QAAQ,QAAQ,qBAAqB,IAAI;AAAA,IAC/D,KAAK,CAAQ,SAAA,UAAU,QAAQ,SAAS,qBAAqB,IAAI;AAAA,IACjE,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,UAAQ,OAAO,UAAU,YAAY,MAAM,WAAW,qBAAqB,IAAI,CAAC;AAAA,IAC5F,UAAU,UAAQ,OAAO,UAAU,YAAY,MAAM,SAAS,qBAAqB,IAAI,CAAC;AAAA,IACxF,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,cAAc,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,WAAW,qBAAqB,IAAI,EAAE,aAAa;AAAA,IAC1H,YAAY,CAAA,SAAQ,OAAO,UAAU,YAAY,MAAM,YAAY,EAAE,SAAS,qBAAqB,IAAI,EAAE,aAAa;AAAA,IACtH,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAS,SAAA,UAAU,SAAU;AAAA,EAAA;AAE7B,SAAA,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACA,UAAM,aAAa;AACb,UAAA,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAIC,QAAa,aAAA;AAAA,IACxB;AACA,WAAQ,QAAgB,QAAQ;AAAA,EAAA,CAChC;AACF;;"}
1
+ {"version":3,"file":"evaluateCondition.cjs","sources":["../../../../../../packages/react-binding/src/helperComponents/helpers/evaluateCondition.ts"],"sourcesContent":["import { Input } from '@contember/client'\nimport { FieldValue } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nexport const evaluateCondition = (value: FieldValue | null, condition: Input.Condition<Input.ColumnValue>) => {\n\tconst handlers: {\n\t\t[K in keyof Required<Input.Condition<any>>]: (\n\t\t\tparam: Exclude<Input.Condition<any>[K], undefined>,\n\t\t) => boolean\n\t} = {\n\t\tand: expr => expr.every(it => evaluateCondition(value, it)),\n\t\tor: expr => expr.some(it => evaluateCondition(value, it)),\n\t\tnot: expr => !evaluateCondition(value, expr),\n\t\teq: expr => value === expr,\n\t\tnotEq: expr => value !== expr,\n\t\tisNull: expr => (value === null) === expr,\n\t\tin: expr => expr.includes(value),\n\t\tnotIn: expr => !expr.includes(value),\n\t\tlt: expr => value !== null && value < expr,\n\t\tlte: expr => value !== null && value <= expr,\n\t\tgt: expr => value !== null && value > expr,\n\t\tgte: expr => value !== null && value >= expr,\n\t\tcontains: expr => typeof value === 'string' && value.includes(expr),\n\t\tstartsWith: expr => typeof value === 'string' && value.startsWith(expr),\n\t\tendsWith: expr => typeof value === 'string' && value.endsWith(expr),\n\t\tcontainsCI: expr => typeof value === 'string' && value.toLowerCase().includes(expr.toLowerCase()),\n\t\tstartsWithCI: expr => typeof value === 'string' && value.toLowerCase().startsWith(expr.toLowerCase()),\n\t\tendsWithCI: expr => typeof value === 'string' && value.toLowerCase().endsWith(expr.toLowerCase()),\n\t\tnever: () => false,\n\t\talways: () => true,\n\t\t// deprecated\n\t\tnull: expr => (value === null) === expr,\n\t}\n\treturn Object.entries(condition).every(([operator, argument]) => {\n\t\tif (value === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst handlerKey = operator as keyof typeof handlers\n\t\tconst handler = handlers[handlerKey]\n\t\tif (!handler) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn (handler as any)(argument)\n\t})\n}\n"],"names":["BindingError"],"mappings":";;;AAIa,MAAA,oBAAoB,CAAC,OAA0B,cAAkD;AAC7G,QAAM,WAIF;AAAA,IACH,KAAK,UAAQ,KAAK,MAAM,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IAC1D,IAAI,UAAQ,KAAK,KAAK,QAAM,kBAAkB,OAAO,EAAE,CAAC;AAAA,IACxD,KAAK,CAAA,SAAQ,CAAC,kBAAkB,OAAO,IAAI;AAAA,IAC3C,IAAI,UAAQ,UAAU;AAAA,IACtB,OAAO,UAAQ,UAAU;AAAA,IACzB,QAAQ,CAAS,SAAA,UAAU,SAAU;AAAA,IACrC,IAAI,CAAA,SAAQ,KAAK,SAAS,KAAK;AAAA,IAC/B,OAAO,CAAA,SAAQ,CAAC,KAAK,SAAS,KAAK;AAAA,IACnC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,IAAI,CAAA,SAAQ,UAAU,QAAQ,QAAQ;AAAA,IACtC,KAAK,CAAA,SAAQ,UAAU,QAAQ,SAAS;AAAA,IACxC,UAAU,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,WAAW,IAAI;AAAA,IACtE,UAAU,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI;AAAA,IAClE,YAAY,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,cAAc,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,cAAc,WAAW,KAAK,YAAA,CAAa;AAAA,IACpG,YAAY,CAAQ,SAAA,OAAO,UAAU,YAAY,MAAM,cAAc,SAAS,KAAK,YAAA,CAAa;AAAA,IAChG,OAAO,MAAM;AAAA,IACb,QAAQ,MAAM;AAAA;AAAA,IAEd,MAAM,CAAS,SAAA,UAAU,SAAU;AAAA,EAAA;AAE7B,SAAA,OAAO,QAAQ,SAAS,EAAE,MAAM,CAAC,CAAC,UAAU,QAAQ,MAAM;AAChE,QAAI,UAAU,QAAW;AACjB,aAAA;AAAA,IACR;AACA,UAAM,aAAa;AACb,UAAA,UAAU,SAAS,UAAU;AACnC,QAAI,CAAC,SAAS;AACb,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACA,WAAQ,QAAgB,QAAQ;AAAA,EAAA,CAChC;AACF;;"}