@nocobase/flow-engine 2.0.0-alpha.42 → 2.0.0-alpha.44

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.
@@ -103,7 +103,6 @@ const toolbarPositionToCSS = {
103
103
  };
104
104
  const floatContainerStyles = /* @__PURE__ */ __name(({ showBackground, showBorder, ctx, toolbarPosition = "inside", toolbarCount }) => import_css.css`
105
105
  position: relative;
106
- display: inline;
107
106
 
108
107
  /* 当检测到button时使用inline-block */
109
108
  &.has-button-child {
@@ -10,7 +10,7 @@ import type { Collection } from '../../data-source';
10
10
  import { FlowModelContext } from '../../flowContext';
11
11
  import { ModelConstructor } from '../../types';
12
12
  import { SubModelItem } from './AddSubModelButton';
13
- export declare function buildSubModelItem(M: ModelConstructor, ctx: FlowModelContext, skipHide?: boolean): SubModelItem;
13
+ export declare function buildSubModelItem(M: ModelConstructor, ctx: FlowModelContext, skipHide?: boolean): Promise<SubModelItem | undefined>;
14
14
  export declare function buildItems(subModelBaseClass: string | ModelConstructor): (ctx: FlowModelContext) => Promise<any>;
15
15
  export declare function buildSubModelItems(subModelBaseClass: string | ModelConstructor, exclude?: any[]): (ctx: FlowModelContext) => Promise<SubModelItem[]>;
16
16
  export declare function buildSubModelGroups(subModelBaseClasses?: (string | ModelConstructor)[]): (ctx: FlowModelContext) => Promise<SubModelItem[]>;
@@ -46,9 +46,16 @@ __export(utils_exports, {
46
46
  module.exports = __toCommonJS(utils_exports);
47
47
  var _ = __toESM(require("lodash"));
48
48
  var import_utils = require("../../utils");
49
- function buildSubModelItem(M, ctx, skipHide = false) {
49
+ async function callHideFunction(hide, ctx) {
50
+ if (typeof hide === "function") {
51
+ return await hide(ctx);
52
+ }
53
+ return hide;
54
+ }
55
+ __name(callHideFunction, "callHideFunction");
56
+ async function buildSubModelItem(M, ctx, skipHide = false) {
50
57
  const meta = M.meta ?? {};
51
- if (meta.hide && !skipHide) {
58
+ if (await callHideFunction(meta.hide, ctx) && !skipHide) {
52
59
  return;
53
60
  }
54
61
  const item = {
@@ -127,12 +134,15 @@ function buildItems(subModelBaseClass) {
127
134
  __name(buildItems, "buildItems");
128
135
  function buildSubModelItems(subModelBaseClass, exclude = []) {
129
136
  return async (ctx) => {
130
- var _a;
137
+ var _a, _b;
131
138
  const SubModelClasses = ctx.engine.getSubclassesOf(subModelBaseClass);
132
- let candidates = Array.from(SubModelClasses.values()).filter((C) => {
133
- var _a2;
134
- return !((_a2 = C.meta) == null ? void 0 : _a2.hide);
135
- }).filter((C) => {
139
+ let candidates = [];
140
+ for (const C of Array.from(SubModelClasses.values())) {
141
+ if (!await callHideFunction((_a = C.meta) == null ? void 0 : _a.hide, ctx)) {
142
+ candidates.push(C);
143
+ }
144
+ }
145
+ candidates = candidates.filter((C) => {
136
146
  for (const P of exclude) {
137
147
  if (typeof P === "string") {
138
148
  if (C.name === P) return false;
@@ -142,18 +152,18 @@ function buildSubModelItems(subModelBaseClass, exclude = []) {
142
152
  }
143
153
  return true;
144
154
  }).sort((A, B) => {
145
- var _a2, _b;
146
- return (((_a2 = A.meta) == null ? void 0 : _a2.sort) ?? 1e3) - (((_b = B.meta) == null ? void 0 : _b.sort) ?? 1e3);
155
+ var _a2, _b2;
156
+ return (((_a2 = A.meta) == null ? void 0 : _a2.sort) ?? 1e3) - (((_b2 = B.meta) == null ? void 0 : _b2.sort) ?? 1e3);
147
157
  });
148
158
  if (candidates.length === 0) {
149
159
  const BaseClass = typeof subModelBaseClass === "string" ? ctx.engine.getModelClass(subModelBaseClass) : subModelBaseClass;
150
- if (BaseClass && !((_a = BaseClass.meta) == null ? void 0 : _a.hide)) {
160
+ if (BaseClass && !await callHideFunction((_b = BaseClass.meta) == null ? void 0 : _b.hide, ctx)) {
151
161
  candidates = [BaseClass];
152
162
  }
153
163
  }
154
164
  const items = [];
155
165
  for (const M of candidates) {
156
- const item = buildSubModelItem(M, ctx);
166
+ const item = await buildSubModelItem(M, ctx);
157
167
  if (item) items.push(item);
158
168
  }
159
169
  return items;
@@ -18,9 +18,9 @@ import { ModelEventRegistry } from '../event-registry/ModelEventRegistry';
18
18
  import { GlobalFlowRegistry } from '../flow-registry/GlobalFlowRegistry';
19
19
  import { FlowDefinition } from '../FlowDefinition';
20
20
  import { FlowSettingsOpenOptions } from '../flowSettings';
21
- import type { EventDefinition, DispatchEventOptions } from '../types';
22
- import { ForkFlowModel } from './forkFlowModel';
23
21
  import type { ScheduleOptions } from '../scheduler/ModelOperationScheduler';
22
+ import type { DispatchEventOptions, EventDefinition } from '../types';
23
+ import { ForkFlowModel } from './forkFlowModel';
24
24
  export declare enum ModelRenderMode {
25
25
  ReactElement = "reactElement",
26
26
  RenderFunction = "renderFunction"
@@ -115,7 +115,7 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
115
115
  * 批量注册仅当前 FlowModel 类及其子类可用的 Events。
116
116
  */
117
117
  static registerEvents<TModel extends FlowModel = FlowModel>(events: Record<string, EventDefinition<TModel>>): void;
118
- static buildChildrenFromModels(ctx: any, Models: Array<any>): import("..").SubModelItem[];
118
+ static buildChildrenFromModels(ctx: any, Models: Array<any>): Promise<import("..").SubModelItem[]>;
119
119
  get title(): any;
120
120
  setTitle(value: string): void;
121
121
  setHidden(value: boolean): void;
@@ -316,8 +316,8 @@ const _FlowModel = class _FlowModel {
316
316
  static registerEvents(events) {
317
317
  this.eventRegistry.registerEvents(events);
318
318
  }
319
- static buildChildrenFromModels(ctx, Models) {
320
- return Models.map((M) => (0, import_utils2.buildSubModelItem)(M, ctx, true));
319
+ static async buildChildrenFromModels(ctx, Models) {
320
+ return Promise.all(Models.map((M) => (0, import_utils2.buildSubModelItem)(M, ctx, true)));
321
321
  }
322
322
  get title() {
323
323
  var _a;
@@ -620,14 +620,10 @@ const _FlowModel = class _FlowModel {
620
620
  if (isBeforeRender) {
621
621
  this._lastAutoRunParams = [inputArgs, execOptions.useCache];
622
622
  }
623
- let finalInputArgs = inputArgs;
624
- if (this.context.record) {
625
- finalInputArgs = { record: this.context.record, ...inputArgs };
626
- }
627
623
  if (options == null ? void 0 : options.debounce) {
628
- return this._dispatchEventWithDebounce(eventName, finalInputArgs, execOptions);
624
+ return this._dispatchEventWithDebounce(eventName, inputArgs, execOptions);
629
625
  }
630
- return this._dispatchEvent(eventName, finalInputArgs, execOptions);
626
+ return this._dispatchEvent(eventName, inputArgs, execOptions);
631
627
  }
632
628
  /**
633
629
  * 按事件名获取对应的流程集合(保持 getFlows 的顺序,即按 sort 排序)。
@@ -39,7 +39,9 @@ export declare class MultiRecordResource<TDataItem = any> extends BaseRecordReso
39
39
  next(): Promise<void>;
40
40
  previous(): Promise<void>;
41
41
  goto(page: number): Promise<void>;
42
- create(data: TDataItem, options?: AxiosRequestConfig): Promise<void>;
42
+ create(data: TDataItem, options?: AxiosRequestConfig & {
43
+ refresh?: boolean;
44
+ }): Promise<void>;
43
45
  get(filterByTk: any): Promise<TDataItem | undefined>;
44
46
  update(filterByTk: string | number, data: Partial<TDataItem>, options?: AxiosRequestConfig): Promise<void>;
45
47
  destroySelectedRows(): Promise<void>;
@@ -129,9 +129,12 @@ const _MultiRecordResource = class _MultiRecordResource extends import_baseRecor
129
129
  }
130
130
  async create(data, options) {
131
131
  const config = this.mergeRequestConfig({ data }, this.createActionOptions, options);
132
- await this.runAction("create", config);
132
+ const res = await this.runAction("create", config);
133
133
  this.emit("saved", data);
134
- await this.refresh();
134
+ if ((options == null ? void 0 : options.refresh) !== false) {
135
+ await this.refresh();
136
+ }
137
+ return res;
135
138
  }
136
139
  async get(filterByTk) {
137
140
  const options = {
@@ -198,7 +201,7 @@ const _MultiRecordResource = class _MultiRecordResource extends import_baseRecor
198
201
  const currentPage = this.getPage();
199
202
  const lastPage = Math.ceil((this.getCount() - import_lodash.default.castArray(filterByTk).length) / this.getPageSize());
200
203
  if (currentPage > lastPage) {
201
- this.setPage(lastPage);
204
+ this.setPage(lastPage || 1);
202
205
  }
203
206
  await this.refresh();
204
207
  }
@@ -82,7 +82,7 @@ const _SingleRecordResource = class _SingleRecordResource extends import_baseRec
82
82
  }
83
83
  }
84
84
  }
85
- await this.runAction(actionName, {
85
+ const res = await this.runAction(actionName, {
86
86
  ...config,
87
87
  data: result
88
88
  });
@@ -90,6 +90,7 @@ const _SingleRecordResource = class _SingleRecordResource extends import_baseRec
90
90
  if ((options == null ? void 0 : options.refresh) !== false) {
91
91
  await this.refresh();
92
92
  }
93
+ return res;
93
94
  }
94
95
  async destroy(options) {
95
96
  const config = this.mergeRequestConfig(
package/lib/types.d.ts CHANGED
@@ -9,8 +9,8 @@
9
9
  /// <reference types="react" />
10
10
  import { ISchema } from '@formily/json-schema';
11
11
  import { SubModelItem } from './components';
12
- import { FlowContext, FlowModelContext, FlowRuntimeContext, FlowSettingsContext } from './flowContext';
13
12
  import type { PropertyOptions } from './flowContext';
13
+ import { FlowContext, FlowModelContext, FlowRuntimeContext, FlowSettingsContext } from './flowContext';
14
14
  import type { FlowEngine } from './flowEngine';
15
15
  import type { FlowModel } from './models';
16
16
  /**
@@ -366,7 +366,7 @@ export type FlowModelMeta = Pick<SubModelItem, 'key' | 'label' | 'icon' | 'child
366
366
  * 是否在菜单中隐藏该模型类
367
367
  * @default false
368
368
  */
369
- hide?: boolean;
369
+ hide?: boolean | ((context: FlowModelContext) => boolean);
370
370
  eventList?: {
371
371
  label: string;
372
372
  value: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/flow-engine",
3
- "version": "2.0.0-alpha.42",
3
+ "version": "2.0.0-alpha.44",
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.42",
12
- "@nocobase/shared": "2.0.0-alpha.42",
11
+ "@nocobase/sdk": "2.0.0-alpha.44",
12
+ "@nocobase/shared": "2.0.0-alpha.44",
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": "9e96dd78d0c1445c8da76863e30f046be5b48d90"
39
+ "gitHead": "075bd484c270740fe9b02f1989818da91139b6b9"
40
40
  }
@@ -104,7 +104,6 @@ const toolbarPositionToCSS = {
104
104
  // 使用与 NocoBase 一致的悬浮工具栏样式
105
105
  const floatContainerStyles = ({ showBackground, showBorder, ctx, toolbarPosition = 'inside', toolbarCount }) => css`
106
106
  position: relative;
107
- display: inline;
108
107
 
109
108
  /* 当检测到button时使用inline-block */
110
109
  &.has-button-child {
@@ -7,14 +7,14 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- import { describe, it, expect } from 'vitest';
11
- import { buildItems, buildSubModelGroups, buildSubModelItem, buildSubModelItems } from '../utils';
12
- import { mergeSubModelItems } from '../AddSubModelButton';
10
+ import { describe, expect, it } from 'vitest';
11
+ import type { FlowModelContext } from '../../../flowContext';
13
12
  import { FlowEngine } from '../../../flowEngine';
14
13
  import { FlowModel } from '../../../models';
15
- import type { FlowModelContext } from '../../../flowContext';
16
- import type { SubModelItem } from '../AddSubModelButton';
17
14
  import type { ModelConstructor } from '../../../types';
15
+ import type { SubModelItem } from '../AddSubModelButton';
16
+ import { mergeSubModelItems } from '../AddSubModelButton';
17
+ import { buildItems, buildSubModelGroups, buildSubModelItem, buildSubModelItems } from '../utils';
18
18
 
19
19
  type DefineChildren = (ctx: FlowModelContext) => SubModelItem[] | Promise<SubModelItem[]>;
20
20
  type WithDefineChildren<T extends ModelConstructor = ModelConstructor> = T & { defineChildren: DefineChildren };
@@ -153,7 +153,7 @@ describe('subModel/utils', () => {
153
153
  });
154
154
 
155
155
  describe('buildSubModelItem', () => {
156
- it('returns undefined for hidden meta entries', () => {
156
+ it('returns undefined for hidden meta entries', async () => {
157
157
  const engine = new FlowEngine();
158
158
 
159
159
  class Parent extends FlowModel {}
@@ -163,7 +163,7 @@ describe('subModel/utils', () => {
163
163
  engine.registerModels({ Parent, HiddenChild });
164
164
  const parent = engine.createModel({ use: 'Parent', uid: 'parent-hidden' });
165
165
 
166
- const item = buildSubModelItem(HiddenChild, parent.context);
166
+ const item = await buildSubModelItem(HiddenChild, parent.context);
167
167
  expect(item).toBeUndefined();
168
168
  });
169
169
 
@@ -194,7 +194,7 @@ describe('subModel/utils', () => {
194
194
  const parent = engine.createModel<Parent>({ use: 'Parent', uid: 'parent-child-group' });
195
195
  const ctx = parent.context;
196
196
 
197
- const item = buildSubModelItem(ChildGroup, ctx, false);
197
+ const item = await buildSubModelItem(ChildGroup, ctx, false);
198
198
  expect(item).toBeTruthy();
199
199
  expect(item?.label).toBe('Child Group');
200
200
  expect(item?.searchable).toBe(true);
@@ -214,7 +214,7 @@ describe('subModel/utils', () => {
214
214
  expect(merged?.extra).toMatchObject({ fromTest: true });
215
215
  });
216
216
 
217
- it('falls back to use=current class name when meta createModelOptions omitted', () => {
217
+ it('falls back to use=current class name when meta createModelOptions omitted', async () => {
218
218
  const engine = new FlowEngine();
219
219
 
220
220
  class Parent extends FlowModel {}
@@ -223,11 +223,11 @@ describe('subModel/utils', () => {
223
223
  engine.registerModels({ Parent, PlainChild });
224
224
  const parent = engine.createModel<Parent>({ use: 'Parent', uid: 'parent-default-create-options' });
225
225
 
226
- const item = buildSubModelItem(PlainChild, parent.context);
226
+ const item = await buildSubModelItem(PlainChild, parent.context);
227
227
  expect(item?.createModelOptions).toEqual({ use: 'PlainChild' });
228
228
  });
229
229
 
230
- it('still returns item when skipHide=true', () => {
230
+ it('still returns item when skipHide=true', async () => {
231
231
  const engine = new FlowEngine();
232
232
 
233
233
  class Parent extends FlowModel {}
@@ -237,7 +237,7 @@ describe('subModel/utils', () => {
237
237
  engine.registerModels({ Parent, HiddenChild });
238
238
  const parent = engine.createModel({ use: 'Parent', uid: 'parent-skip-hide' });
239
239
 
240
- const item = buildSubModelItem(HiddenChild, parent.context, true);
240
+ const item = await buildSubModelItem(HiddenChild, parent.context, true);
241
241
  expect(item).toBeTruthy();
242
242
  expect(item?.label).toBe('Hidden but allowed');
243
243
  });
@@ -14,9 +14,23 @@ import { FlowModelMeta, ModelConstructor } from '../../types';
14
14
  import { isInheritedFrom, resolveCreateModelOptions } from '../../utils';
15
15
  import { SubModelItem } from './AddSubModelButton';
16
16
 
17
- export function buildSubModelItem(M: ModelConstructor, ctx: FlowModelContext, skipHide = false): SubModelItem {
17
+ async function callHideFunction(
18
+ hide: boolean | ((context: FlowModelContext) => boolean | Promise<boolean>),
19
+ ctx: FlowModelContext,
20
+ ) {
21
+ if (typeof hide === 'function') {
22
+ return await hide(ctx);
23
+ }
24
+ return hide;
25
+ }
26
+
27
+ export async function buildSubModelItem(
28
+ M: ModelConstructor,
29
+ ctx: FlowModelContext,
30
+ skipHide = false,
31
+ ): Promise<SubModelItem | undefined> {
18
32
  const meta: FlowModelMeta = (M.meta ?? {}) as FlowModelMeta;
19
- if (meta.hide && !skipHide) {
33
+ if ((await callHideFunction(meta.hide, ctx)) && !skipHide) {
20
34
  return;
21
35
  }
22
36
  // 判断是否为 CollectionBlockModel 的子类(用于集合选择层开启搜索)
@@ -102,8 +116,13 @@ export function buildSubModelItems(subModelBaseClass: string | ModelConstructor,
102
116
  return async (ctx: FlowModelContext) => {
103
117
  const SubModelClasses = ctx.engine.getSubclassesOf(subModelBaseClass);
104
118
  // Collect and sort subclasses by meta.sort (ascending), excluding hidden or inherited ones in `exclude`
105
- let candidates = Array.from(SubModelClasses.values())
106
- .filter((C) => !C.meta?.hide)
119
+ let candidates = [];
120
+ for (const C of Array.from(SubModelClasses.values())) {
121
+ if (!(await callHideFunction(C.meta?.hide, ctx))) {
122
+ candidates.push(C);
123
+ }
124
+ }
125
+ candidates = candidates
107
126
  .filter((C) => {
108
127
  for (const P of exclude as (string | ModelConstructor)[]) {
109
128
  if (typeof P === 'string') {
@@ -120,14 +139,14 @@ export function buildSubModelItems(subModelBaseClass: string | ModelConstructor,
120
139
  if (candidates.length === 0) {
121
140
  const BaseClass =
122
141
  typeof subModelBaseClass === 'string' ? ctx.engine.getModelClass(subModelBaseClass) : subModelBaseClass;
123
- if (BaseClass && !BaseClass.meta?.hide) {
142
+ if (BaseClass && !(await callHideFunction(BaseClass.meta?.hide, ctx))) {
124
143
  candidates = [BaseClass];
125
144
  }
126
145
  }
127
146
 
128
147
  const items: SubModelItem[] = [];
129
148
  for (const M of candidates) {
130
- const item = buildSubModelItem(M, ctx);
149
+ const item = await buildSubModelItem(M, ctx);
131
150
  if (item) items.push(item);
132
151
  }
133
152
  return items;
@@ -50,9 +50,9 @@ import { ModelEventRegistry } from '../event-registry/ModelEventRegistry';
50
50
  import { GlobalFlowRegistry } from '../flow-registry/GlobalFlowRegistry';
51
51
  import { FlowDefinition } from '../FlowDefinition';
52
52
  import { FlowSettingsOpenOptions } from '../flowSettings';
53
- import type { EventDefinition, FlowEvent, DispatchEventOptions } from '../types';
54
- import { ForkFlowModel } from './forkFlowModel';
55
53
  import type { ScheduleOptions } from '../scheduler/ModelOperationScheduler';
54
+ import type { DispatchEventOptions, EventDefinition, FlowEvent } from '../types';
55
+ import { ForkFlowModel } from './forkFlowModel';
56
56
 
57
57
  // 使用 WeakMap 为每个类缓存一个 ModelActionRegistry 实例
58
58
  const classActionRegistries = new WeakMap<typeof FlowModel, ModelActionRegistry>();
@@ -352,8 +352,8 @@ export class FlowModel<Structure extends DefaultStructure = DefaultStructure> {
352
352
  this.eventRegistry.registerEvents(events);
353
353
  }
354
354
 
355
- static buildChildrenFromModels(ctx, Models: Array<any>) {
356
- return Models.map((M) => buildSubModelItem(M, ctx, true));
355
+ static async buildChildrenFromModels(ctx, Models: Array<any>) {
356
+ return Promise.all(Models.map((M) => buildSubModelItem(M, ctx, true)));
357
357
  }
358
358
 
359
359
  get title() {
@@ -749,15 +749,11 @@ export class FlowModel<Structure extends DefaultStructure = DefaultStructure> {
749
749
  if (isBeforeRender) {
750
750
  this._lastAutoRunParams = [inputArgs, execOptions.useCache];
751
751
  }
752
- let finalInputArgs = inputArgs;
753
- if (this.context.record) {
754
- finalInputArgs = { record: this.context.record, ...inputArgs };
755
- }
756
752
 
757
753
  if (options?.debounce) {
758
- return this._dispatchEventWithDebounce(eventName, finalInputArgs, execOptions);
754
+ return this._dispatchEventWithDebounce(eventName, inputArgs, execOptions);
759
755
  }
760
- return this._dispatchEvent(eventName, finalInputArgs, execOptions);
756
+ return this._dispatchEvent(eventName, inputArgs, execOptions);
761
757
  }
762
758
 
763
759
  /**
@@ -110,11 +110,14 @@ export class MultiRecordResource<TDataItem = any> extends BaseRecordResource<TDa
110
110
  }
111
111
  }
112
112
 
113
- async create(data: TDataItem, options?: AxiosRequestConfig): Promise<void> {
113
+ async create(data: TDataItem, options?: AxiosRequestConfig & { refresh?: boolean }): Promise<void> {
114
114
  const config = this.mergeRequestConfig({ data }, this.createActionOptions, options);
115
- await this.runAction('create', config);
115
+ const res = await this.runAction('create', config);
116
116
  this.emit('saved', data);
117
- await this.refresh();
117
+ if (options?.refresh !== false) {
118
+ await this.refresh();
119
+ }
120
+ return res;
118
121
  }
119
122
 
120
123
  async get(filterByTk: any): Promise<TDataItem | undefined> {
@@ -191,7 +194,7 @@ export class MultiRecordResource<TDataItem = any> extends BaseRecordResource<TDa
191
194
  const currentPage = this.getPage();
192
195
  const lastPage = Math.ceil((this.getCount() - _.castArray(filterByTk).length) / this.getPageSize());
193
196
  if (currentPage > lastPage) {
194
- this.setPage(lastPage);
197
+ this.setPage(lastPage || 1);
195
198
  }
196
199
  await this.refresh();
197
200
  }
@@ -56,7 +56,7 @@ export class SingleRecordResource<TData = any> extends BaseRecordResource<TData>
56
56
  }
57
57
  }
58
58
  }
59
- await this.runAction(actionName, {
59
+ const res = await this.runAction(actionName, {
60
60
  ...config,
61
61
  data: result,
62
62
  });
@@ -64,6 +64,7 @@ export class SingleRecordResource<TData = any> extends BaseRecordResource<TData>
64
64
  if (options?.refresh !== false) {
65
65
  await this.refresh();
66
66
  }
67
+ return res;
67
68
  }
68
69
 
69
70
  async destroy(options?: AxiosRequestConfig): Promise<void> {
package/src/types.ts CHANGED
@@ -9,8 +9,8 @@
9
9
 
10
10
  import { ISchema } from '@formily/json-schema';
11
11
  import { SubModelItem } from './components';
12
- import { FlowContext, FlowModelContext, FlowRuntimeContext, FlowSettingsContext } from './flowContext';
13
12
  import type { PropertyOptions } from './flowContext';
13
+ import { FlowContext, FlowModelContext, FlowRuntimeContext, FlowSettingsContext } from './flowContext';
14
14
  import type { FlowEngine } from './flowEngine';
15
15
  import type { FlowModel } from './models';
16
16
  import { FilterGroupOptions } from './resources';
@@ -453,7 +453,7 @@ export type FlowModelMeta =
453
453
  * 是否在菜单中隐藏该模型类
454
454
  * @default false
455
455
  */
456
- hide?: boolean;
456
+ hide?: boolean | ((context: FlowModelContext) => boolean);
457
457
  eventList?: { label: string; value: string }[]; // 支持的事件列表
458
458
  };
459
459