@object-ui/react 7.1.0 → 7.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @object-ui/react
2
2
 
3
+ ## 7.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8e7c1da]
8
+ - Updated dependencies [d23db5c]
9
+ - @object-ui/i18n@7.2.0
10
+ - @object-ui/types@7.2.0
11
+ - @object-ui/core@7.2.0
12
+ - @object-ui/data-objectstack@7.2.0
13
+
3
14
  ## 7.1.0
4
15
 
5
16
  ### Minor Changes
@@ -9,6 +9,7 @@ export * from './useExpression';
9
9
  export * from './useActionRunner';
10
10
  export * from './useNavigationOverlay';
11
11
  export * from './usePageVariables';
12
+ export * from './usePageVariableActionBridge';
12
13
  export * from './useViewData';
13
14
  export * from './useDynamicApp';
14
15
  export * from './useDiscovery';
@@ -9,6 +9,7 @@ export * from './useExpression';
9
9
  export * from './useActionRunner';
10
10
  export * from './useNavigationOverlay';
11
11
  export * from './usePageVariables';
12
+ export * from './usePageVariableActionBridge';
12
13
  export * from './useViewData';
13
14
  export * from './useDynamicApp';
14
15
  export * from './useDiscovery';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ /**
9
+ * PageVariableActionBridge — publishes the live page-variable snapshot into the
10
+ * shared ActionRunner context as `pageVariables`, so a submit action (`api` /
11
+ * `script` / `flow`, or an `onClick` expression) can pull page-local form state
12
+ * into its request body via `{{page.<var>}}` token interpolation (resolved in
13
+ * app-shell's `useConsoleActionRuntime`).
14
+ *
15
+ * This is the data-entry counterpart to ObjectGrid publishing `selectedRecords`
16
+ * into the same context. Page variables live BELOW the ActionProvider — they're
17
+ * mounted by `PageVariablesProvider` inside the page layout renderer, whereas
18
+ * the action runtime is mounted above it — so the runtime can't read them
19
+ * directly. The bridge carries them up via `updateContext`.
20
+ *
21
+ * Mount it once inside a `PageVariablesProvider`. Outside an `ActionProvider`,
22
+ * `useAction()` falls back to a throwaway runner, so the bridge is a safe no-op
23
+ * (never throws in standalone / test contexts). Renders nothing.
24
+ */
25
+ export declare function PageVariableActionBridge(): null;
26
+ export declare namespace PageVariableActionBridge {
27
+ var displayName: string;
28
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ import * as React from 'react';
9
+ import { usePageVariables } from './usePageVariables';
10
+ import { useAction } from '../context';
11
+ /**
12
+ * PageVariableActionBridge — publishes the live page-variable snapshot into the
13
+ * shared ActionRunner context as `pageVariables`, so a submit action (`api` /
14
+ * `script` / `flow`, or an `onClick` expression) can pull page-local form state
15
+ * into its request body via `{{page.<var>}}` token interpolation (resolved in
16
+ * app-shell's `useConsoleActionRuntime`).
17
+ *
18
+ * This is the data-entry counterpart to ObjectGrid publishing `selectedRecords`
19
+ * into the same context. Page variables live BELOW the ActionProvider — they're
20
+ * mounted by `PageVariablesProvider` inside the page layout renderer, whereas
21
+ * the action runtime is mounted above it — so the runtime can't read them
22
+ * directly. The bridge carries them up via `updateContext`.
23
+ *
24
+ * Mount it once inside a `PageVariablesProvider`. Outside an `ActionProvider`,
25
+ * `useAction()` falls back to a throwaway runner, so the bridge is a safe no-op
26
+ * (never throws in standalone / test contexts). Renders nothing.
27
+ */
28
+ export function PageVariableActionBridge() {
29
+ const { variables } = usePageVariables();
30
+ const { updateContext } = useAction();
31
+ React.useEffect(() => {
32
+ updateContext({ pageVariables: variables });
33
+ return () => {
34
+ updateContext({ pageVariables: {} });
35
+ };
36
+ }, [variables, updateContext]);
37
+ return null;
38
+ }
39
+ PageVariableActionBridge.displayName = 'PageVariableActionBridge';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/react",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "React bindings and SchemaRenderer component for Object UI",
@@ -26,10 +26,10 @@
26
26
  "dependencies": {
27
27
  "@objectstack/spec": "^10.0.0",
28
28
  "react-hook-form": "^7.80.0",
29
- "@object-ui/core": "7.1.0",
30
- "@object-ui/data-objectstack": "7.1.0",
31
- "@object-ui/i18n": "7.1.0",
32
- "@object-ui/types": "7.1.0"
29
+ "@object-ui/core": "7.2.0",
30
+ "@object-ui/data-objectstack": "7.2.0",
31
+ "@object-ui/i18n": "7.2.0",
32
+ "@object-ui/types": "7.2.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "^18.0.0 || ^19.0.0",