@nocobase/flow-engine 2.0.0-alpha.63 → 2.0.0-alpha.64

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.
@@ -682,6 +682,9 @@ const _CollectionField = class _CollectionField {
682
682
  if (typeof v !== "object") {
683
683
  return v;
684
684
  }
685
+ if (v.value === null || v.value === void 0) {
686
+ return v;
687
+ }
685
688
  return {
686
689
  ...v,
687
690
  value: Number(v.value)
package/lib/provider.js CHANGED
@@ -97,9 +97,10 @@ const FlowEngineGlobalsContextProvider = /* @__PURE__ */ __name(({ children }) =
97
97
  const useFlowEngine = /* @__PURE__ */ __name(({ throwError = true } = {}) => {
98
98
  const context = (0, import_react.useContext)(FlowEngineReactContext);
99
99
  if (!context && throwError) {
100
- throw new Error(
100
+ console.warn(
101
101
  "useFlowEngine must be used within a FlowEngineProvider, and FlowEngineProvider must be supplied with an engine."
102
102
  );
103
+ return;
103
104
  }
104
105
  return context;
105
106
  }, "useFlowEngine");
@@ -170,9 +170,9 @@ function useDialog() {
170
170
  className: "nb-dialog-overflow-hidden",
171
171
  ref: dialogRef,
172
172
  hidden: (_d = (_c2 = config.inputArgs) == null ? void 0 : _c2.hidden) == null ? void 0 : _d.value,
173
- ...config,
174
173
  footer: currentFooter,
175
174
  header: currentHeader,
175
+ ...config,
176
176
  onCancel: () => {
177
177
  currentDialog.close(config.result);
178
178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/flow-engine",
3
- "version": "2.0.0-alpha.63",
3
+ "version": "2.0.0-alpha.64",
4
4
  "private": false,
5
5
  "description": "A standalone flow engine for NocoBase, managing workflows, models, and actions.",
6
6
  "main": "lib/index.js",
@@ -8,8 +8,8 @@
8
8
  "dependencies": {
9
9
  "@formily/antd-v5": "1.x",
10
10
  "@formily/reactive": "2.x",
11
- "@nocobase/sdk": "2.0.0-alpha.63",
12
- "@nocobase/shared": "2.0.0-alpha.63",
11
+ "@nocobase/sdk": "2.0.0-alpha.64",
12
+ "@nocobase/shared": "2.0.0-alpha.64",
13
13
  "ahooks": "^3.7.2",
14
14
  "dayjs": "^1.11.9",
15
15
  "dompurify": "^3.0.2",
@@ -36,5 +36,5 @@
36
36
  ],
37
37
  "author": "NocoBase Team",
38
38
  "license": "AGPL-3.0",
39
- "gitHead": "0d5e9eb45e4d0f3ba70d7561a0d296d12a4d8bf8"
39
+ "gitHead": "f6c2831b27608b53de6dc8b7aa6a48d12ec48a14"
40
40
  }
@@ -14,11 +14,6 @@ import { FlowEngine } from '../flowEngine';
14
14
  import { FlowEngineProvider, useFlowEngine } from '../provider';
15
15
 
16
16
  describe('FlowEngineProvider/useFlowEngine', () => {
17
- it('throws without provider', () => {
18
- const run = () => renderHook(() => useFlowEngine());
19
- expect(run).toThrow(/FlowEngineProvider/);
20
- });
21
-
22
17
  it('returns engine within provider', () => {
23
18
  const engine = new FlowEngine();
24
19
  const wrapper = ({ children }: any) => <FlowEngineProvider engine={engine}>{children}</FlowEngineProvider>;
@@ -815,6 +815,9 @@ export class CollectionField {
815
815
  if (typeof v !== 'object') {
816
816
  return v;
817
817
  }
818
+ if (v.value === null || v.value === undefined) {
819
+ return v;
820
+ }
818
821
  return {
819
822
  ...v,
820
823
  value: Number(v.value),
package/src/provider.tsx CHANGED
@@ -90,9 +90,10 @@ export const useFlowEngine = ({ throwError = true } = {}): FlowEngine => {
90
90
  if (!context && throwError) {
91
91
  // This error should ideally not be hit if FlowEngineProvider is used correctly at the root
92
92
  // and always supplied with an engine.
93
- throw new Error(
93
+ console.warn(
94
94
  'useFlowEngine must be used within a FlowEngineProvider, and FlowEngineProvider must be supplied with an engine.',
95
95
  );
96
+ return;
96
97
  }
97
98
  return context;
98
99
  };
@@ -164,9 +164,9 @@ export function useDialog() {
164
164
  className="nb-dialog-overflow-hidden"
165
165
  ref={dialogRef}
166
166
  hidden={config.inputArgs?.hidden?.value}
167
- {...config}
168
167
  footer={currentFooter}
169
168
  header={currentHeader}
169
+ {...config}
170
170
  onCancel={() => {
171
171
  currentDialog.close(config.result);
172
172
  }}