@nocobase/client 2.0.0-alpha.2 → 2.0.0-alpha.4
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/components/Grid/index.d.ts +17 -7
- package/es/flow/components/code-editor/hooks/useCodeRunner.d.ts +3 -2
- package/es/flow/models/base/BlockGridModel.d.ts +2 -0
- package/es/flow/models/base/GridModel.d.ts +19 -6
- package/es/flow/models/blocks/details/DetailsGridModel.d.ts +2 -0
- package/es/flow/models/blocks/filter-form/FilterFormGridModel.d.ts +2 -0
- package/es/flow/models/blocks/form/FormGridModel.d.ts +2 -0
- package/es/flow/models/utils/resolveRunJsParams.d.ts +19 -0
- package/es/index.mjs +1782 -1492
- package/es/nocobase-buildin-plugin/index.d.ts +7 -0
- package/lib/index-C3fHjsMw-CvPTaiKU.js +2081 -0
- package/lib/index.js +76 -76
- package/package.json +10 -5
- package/lib/index-C3fHjsMw-mwRBOzGB.js +0 -1977
|
@@ -7,10 +7,20 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
10
|
+
interface DragOverlayRect {
|
|
11
|
+
readonly top: number;
|
|
12
|
+
readonly left: number;
|
|
13
|
+
readonly width: number;
|
|
14
|
+
readonly height: number;
|
|
15
|
+
readonly type: 'column' | 'column-edge' | 'row-gap' | 'empty-row' | 'empty-column';
|
|
16
|
+
}
|
|
17
|
+
interface GridProps {
|
|
18
|
+
readonly rows: Record<string, string[][]>;
|
|
19
|
+
readonly sizes?: Record<string, number[]>;
|
|
20
|
+
readonly renderItem: (uid: string) => React.ReactNode;
|
|
21
|
+
readonly rowGap?: number;
|
|
22
|
+
readonly colGap?: number;
|
|
23
|
+
readonly dragOverlayRect?: DragOverlayRect | null;
|
|
24
|
+
}
|
|
25
|
+
export declare function Grid({ rows, sizes, renderItem, rowGap, colGap, dragOverlayRect }: GridProps): React.JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import { FlowModelContext, JSRunner } from '@nocobase/flow-engine';
|
|
9
10
|
export type RunLog = {
|
|
10
11
|
level: 'log' | 'info' | 'warn' | 'error';
|
|
11
12
|
msg: string;
|
|
12
13
|
line?: number;
|
|
13
14
|
column?: number;
|
|
14
15
|
};
|
|
15
|
-
export declare function useCodeRunner(hostCtx:
|
|
16
|
-
run: (code: string) => Promise<
|
|
16
|
+
export declare function useCodeRunner(hostCtx: FlowModelContext, version?: string): {
|
|
17
|
+
run: (code: string) => Promise<Awaited<ReturnType<JSRunner['run']>> | undefined>;
|
|
17
18
|
logs: RunLog[];
|
|
18
19
|
clearLogs: () => void;
|
|
19
20
|
running: boolean;
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import { DragOverlayConfig } from '@nocobase/flow-engine';
|
|
9
10
|
import React from 'react';
|
|
10
11
|
import { FilterManager } from '../blocks/filter-manager/FilterManager';
|
|
11
12
|
import { GridModel } from './GridModel';
|
|
12
13
|
export declare class BlockGridModel extends GridModel {
|
|
14
|
+
dragOverlayConfig: DragOverlayConfig;
|
|
13
15
|
onInit(options: any): void;
|
|
14
16
|
get subModelBaseClasses(): string[];
|
|
15
17
|
get filterManager(): FilterManager;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { DragMoveEvent } from '@dnd-kit/core';
|
|
10
|
-
import { FlowModel } from '@nocobase/flow-engine';
|
|
9
|
+
import { DragCancelEvent, DragEndEvent, DragMoveEvent, DragStartEvent } from '@dnd-kit/core';
|
|
10
|
+
import { DragOverlayConfig, FlowModel, GridLayoutData } from '@nocobase/flow-engine';
|
|
11
11
|
import type { FlowModelRendererProps } from '@nocobase/flow-engine';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
export declare const GRID_FLOW_KEY = "gridSettings";
|
|
@@ -28,16 +28,29 @@ export declare class GridModel<T extends {
|
|
|
28
28
|
prevMoveDistance: number;
|
|
29
29
|
itemSettingsMenuLevel: number;
|
|
30
30
|
itemFlowSettings: Exclude<FlowModelRendererProps['showFlowSettings'], boolean>;
|
|
31
|
-
|
|
32
|
-
private
|
|
31
|
+
dragOverlayConfig?: DragOverlayConfig;
|
|
32
|
+
private readonly itemFallback;
|
|
33
|
+
private readonly itemExtraToolbarItems;
|
|
34
|
+
private dragState?;
|
|
33
35
|
private _memoItemFlowSettings?;
|
|
34
36
|
private getItemFlowSettings;
|
|
35
37
|
onInit(options: any): void;
|
|
36
|
-
saveGridLayout(): void;
|
|
38
|
+
saveGridLayout(layout?: GridLayoutData): void;
|
|
37
39
|
mergeRowsWithItems(rows: Record<string, string[][]>): Record<string, string[][]>;
|
|
38
40
|
resetRows(syncProps?: boolean): void;
|
|
41
|
+
private computePointerPosition;
|
|
42
|
+
private updateLayoutSnapshot;
|
|
43
|
+
private scheduleSnapshotRefresh;
|
|
44
|
+
/**
|
|
45
|
+
* 根据 slot 类型、位置和配置计算最终的 overlay 尺寸和位置
|
|
46
|
+
*/
|
|
47
|
+
private computeOverlayRect;
|
|
48
|
+
private applyPreview;
|
|
49
|
+
handleDragStart(event: DragStartEvent): void;
|
|
39
50
|
handleDragMove(event: DragMoveEvent): void;
|
|
40
|
-
|
|
51
|
+
private finishDrag;
|
|
52
|
+
handleDragEnd(_event: DragEndEvent): void;
|
|
53
|
+
handleDragCancel(_event: DragCancelEvent): void;
|
|
41
54
|
renderAddSubModelButton(): JSX.Element;
|
|
42
55
|
getRows(): any;
|
|
43
56
|
getSizes(): any;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import { DragOverlayConfig } from '@nocobase/flow-engine';
|
|
9
10
|
import React from 'react';
|
|
10
11
|
import { FieldModel, GridModel } from '../../base';
|
|
11
12
|
import { DetailsBlockModel } from './DetailsBlockModel';
|
|
@@ -25,5 +26,6 @@ export declare class DetailsGridModel extends GridModel<{
|
|
|
25
26
|
bottom: number;
|
|
26
27
|
};
|
|
27
28
|
};
|
|
29
|
+
dragOverlayConfig: DragOverlayConfig;
|
|
28
30
|
renderAddSubModelButton(): React.JSX.Element;
|
|
29
31
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import { DragOverlayConfig } from '@nocobase/flow-engine';
|
|
9
10
|
import React from 'react';
|
|
10
11
|
import { GridModel } from '../../base';
|
|
11
12
|
import { FilterFormItemModel } from './FilterFormItemModel';
|
|
@@ -19,6 +20,7 @@ export declare class FilterFormGridModel extends GridModel {
|
|
|
19
20
|
bottom: number;
|
|
20
21
|
};
|
|
21
22
|
};
|
|
23
|
+
dragOverlayConfig: DragOverlayConfig;
|
|
22
24
|
private hiddenRows;
|
|
23
25
|
readonly loading: {
|
|
24
26
|
value: boolean;
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import { DragOverlayConfig } from '@nocobase/flow-engine';
|
|
9
10
|
import React from 'react';
|
|
10
11
|
import { FieldModel, GridModel } from '../../base';
|
|
11
12
|
import { FormBlockModel } from './FormBlockModel';
|
|
@@ -26,5 +27,6 @@ export declare class FormGridModel<T extends DefaultFormGridStructure = DefaultF
|
|
|
26
27
|
bottom: number;
|
|
27
28
|
};
|
|
28
29
|
};
|
|
30
|
+
dragOverlayConfig: DragOverlayConfig;
|
|
29
31
|
renderAddSubModelButton(): React.JSX.Element;
|
|
30
32
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
import type { FlowContext } from '@nocobase/flow-engine';
|
|
10
|
+
/**
|
|
11
|
+
* 统一解析预览模式的 code/version:
|
|
12
|
+
* - 优先读取 ctx.inputArgs.preview.{code,version}
|
|
13
|
+
* - 其次读取 params.{code,version}
|
|
14
|
+
* - 最后回退到 defaults
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveRunJsParams(ctx: FlowContext, params?: Record<string, any>): {
|
|
17
|
+
code: string;
|
|
18
|
+
version: string;
|
|
19
|
+
};
|