@nocobase/client 2.0.11 → 2.0.12
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/es/flow/models/actions/AddChildActionModel.d.ts +1 -0
- package/es/flow/models/actions/BulkDeleteActionModel.d.ts +1 -0
- package/es/flow/models/base/ActionGroupModel.d.ts +8 -0
- package/es/flow/models/base/CollectionBlockModel.d.ts +7 -0
- package/es/flow/models/base/PageModel/RootPageModel.d.ts +8 -0
- package/es/flow/models/blocks/form/CreateFormModel.d.ts +1 -0
- package/es/flow/models/blocks/form/EditFormModel.d.ts +1 -0
- package/es/flow/utils/actionCapability.d.ts +60 -0
- package/es/index.mjs +219 -127
- package/es/schema-settings/VariableInput/hooks/useParentIterationVariable.d.ts +3 -3
- package/lib/index.js +12 -16
- package/package.json +6 -6
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import type { ButtonProps } from 'antd/es/button';
|
|
10
10
|
import { PopupActionModel } from '../base';
|
|
11
11
|
export declare class AddChildActionModel extends PopupActionModel {
|
|
12
|
+
static capabilityActionName: any;
|
|
12
13
|
defaultProps: ButtonProps;
|
|
13
14
|
getAclActionName(): string;
|
|
14
15
|
onInit(options: any): void;
|
|
@@ -10,6 +10,7 @@ import { ButtonProps } from 'antd';
|
|
|
10
10
|
import { ActionModel } from '../base';
|
|
11
11
|
export declare class BulkDeleteActionModel extends ActionModel {
|
|
12
12
|
static scene: import("../base").ActionSceneType;
|
|
13
|
+
static capabilityActionName: string;
|
|
13
14
|
defaultProps: ButtonProps;
|
|
14
15
|
getAclActionName(): string;
|
|
15
16
|
}
|
|
@@ -16,6 +16,14 @@ export declare class ActionGroupModel extends FlowModel {
|
|
|
16
16
|
static get currentModels(): Map<string, typeof ActionModel>;
|
|
17
17
|
static get models(): Map<any, any>;
|
|
18
18
|
static registerActionModels(models: Record<string, any>): void;
|
|
19
|
+
/**
|
|
20
|
+
* 判断动作模型在当前数据表上下文下是否应显示在 v2 的“添加动作”菜单中。
|
|
21
|
+
*
|
|
22
|
+
* @param ModelClass 动作模型类
|
|
23
|
+
* @param ctx Flow 上下文
|
|
24
|
+
* @returns 是否显示
|
|
25
|
+
*/
|
|
26
|
+
static isActionModelVisible(ModelClass: typeof ActionModel, ctx: FlowModelContext): boolean;
|
|
19
27
|
static defineChildren(ctx: FlowModelContext): Promise<any[]>;
|
|
20
28
|
}
|
|
21
29
|
export declare class CollectionActionGroupModel extends ActionGroupModel {
|
|
@@ -28,6 +28,13 @@ export declare class CollectionBlockModel<T = DefaultStructure> extends DataBloc
|
|
|
28
28
|
* 子菜单过滤函数
|
|
29
29
|
*/
|
|
30
30
|
static filterCollection(_collection: Collection): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 判断当前区块模型在 collection 选择菜单中是否应该展示指定数据表。
|
|
33
|
+
*
|
|
34
|
+
* @param collection 数据表
|
|
35
|
+
* @returns 是否显示
|
|
36
|
+
*/
|
|
37
|
+
static isCollectionAvailable(collection: Collection | undefined): boolean;
|
|
31
38
|
/**
|
|
32
39
|
* 定义子菜单选项
|
|
33
40
|
*/
|
|
@@ -10,6 +10,14 @@ import { DragEndEvent } from '@dnd-kit/core';
|
|
|
10
10
|
import { PageModel } from './PageModel';
|
|
11
11
|
export declare class RootPageModel extends PageModel {
|
|
12
12
|
mounted: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 新建 tab 在首次保存完成前,前端 route 里可能还没有数据库 id。
|
|
15
|
+
* 拖拽前兜底触发一次保存,确保 move 接口拿到真实主键。
|
|
16
|
+
*
|
|
17
|
+
* @param model - 当前参与拖拽的 tab model
|
|
18
|
+
* @returns 可用于排序接口的 route id
|
|
19
|
+
*/
|
|
20
|
+
private ensurePersistedRouteId;
|
|
13
21
|
onMount(): void;
|
|
14
22
|
saveStepParams(): Promise<void>;
|
|
15
23
|
handleDragEnd(event: DragEndEvent): Promise<void>;
|
|
@@ -11,6 +11,7 @@ import React from 'react';
|
|
|
11
11
|
import { FormBlockModel } from './FormBlockModel';
|
|
12
12
|
export declare class CreateFormModel extends FormBlockModel {
|
|
13
13
|
static scene: import("../../base/BlockModel").BlockSceneType;
|
|
14
|
+
static blockCapabilityActionName: string;
|
|
14
15
|
private actionFlowSettings;
|
|
15
16
|
private actionExtraToolbarItems;
|
|
16
17
|
createResource(ctx: any, params: any): SingleRecordResource<unknown>;
|
|
@@ -11,6 +11,7 @@ import React from 'react';
|
|
|
11
11
|
import { FormBlockModel } from './FormBlockModel';
|
|
12
12
|
export declare class EditFormModel extends FormBlockModel {
|
|
13
13
|
static scene: import("../../base").BlockSceneType;
|
|
14
|
+
static blockCapabilityActionName: string;
|
|
14
15
|
private actionFlowSettings;
|
|
15
16
|
private actionExtraToolbarItems;
|
|
16
17
|
createResource(_ctx: FlowModelContext, params: any): SingleRecordResource<unknown> | MultiRecordResource<unknown>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
type CapabilityCollection = {
|
|
10
|
+
options?: Record<string, any>;
|
|
11
|
+
};
|
|
12
|
+
type CapabilityModelClass = {
|
|
13
|
+
prototype?: {
|
|
14
|
+
getAclActionName?: () => string | null | undefined;
|
|
15
|
+
};
|
|
16
|
+
capabilityActionName?: string | null;
|
|
17
|
+
capabilityActionNames?: string[] | null;
|
|
18
|
+
blockCapabilityActionName?: string | null;
|
|
19
|
+
blockCapabilityActionNames?: string[] | null;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 统一动作能力名,保证 v2 与 v1 使用同一套数据源动作键。
|
|
23
|
+
*
|
|
24
|
+
* @param actionName 动作名
|
|
25
|
+
* @returns 归一化后的动作能力名
|
|
26
|
+
*/
|
|
27
|
+
export declare const normalizeCapabilityActionName: (actionName?: string | null) => string;
|
|
28
|
+
/**
|
|
29
|
+
* 判断 collection 是否支持指定动作能力。
|
|
30
|
+
*
|
|
31
|
+
* @param collection 数据表
|
|
32
|
+
* @param capabilityName 动作能力键
|
|
33
|
+
* @returns 是否支持
|
|
34
|
+
*/
|
|
35
|
+
export declare const isCapabilitySupported: (collection: CapabilityCollection | null | undefined, capabilityName?: string | null) => boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 判断 collection 是否支持一组动作能力。
|
|
38
|
+
*
|
|
39
|
+
* @param collection 数据表
|
|
40
|
+
* @param capabilityNames 动作能力键数组
|
|
41
|
+
* @returns 是否全部支持
|
|
42
|
+
*/
|
|
43
|
+
export declare const areCapabilitiesSupported: (collection: CapabilityCollection | null | undefined, capabilityNames?: Array<string | null | undefined> | null) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 推导动作模型使用的数据源动作能力键。
|
|
46
|
+
* 默认会回落到 getAclActionName,但允许通过静态字段显式覆写。
|
|
47
|
+
*
|
|
48
|
+
* @param ModelClass 动作模型类
|
|
49
|
+
* @returns 动作能力键数组或 null
|
|
50
|
+
*/
|
|
51
|
+
export declare const getActionCapabilityNamesFromModelClass: (ModelClass: CapabilityModelClass) => string[];
|
|
52
|
+
/**
|
|
53
|
+
* 推导区块模型在“选择 collection”时需要满足的数据源动作能力键。
|
|
54
|
+
* 仅对显式声明的区块生效,避免误把所有区块都套上 view/create/update 过滤。
|
|
55
|
+
*
|
|
56
|
+
* @param ModelClass 区块模型类
|
|
57
|
+
* @returns 动作能力键数组或 null
|
|
58
|
+
*/
|
|
59
|
+
export declare const getBlockCapabilityNamesFromModelClass: (ModelClass: CapabilityModelClass) => string[];
|
|
60
|
+
export {};
|