@nocobase/client-v2 2.1.0-alpha.25 → 2.1.0-alpha.27
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/BaseApplication.d.ts +1 -0
- package/es/flow/actions/dataScopeFilter.d.ts +9 -0
- package/es/flow/components/Grid/index.d.ts +5 -3
- package/es/flow/components/code-editor/types.d.ts +1 -0
- package/es/flow/internal/utils/rebuildFieldSubModel.d.ts +2 -1
- package/es/flow/models/base/GridModel.d.ts +19 -2
- package/es/flow/models/blocks/filter-form/FilterFormGridModel.d.ts +1 -0
- package/es/flow/models/blocks/form/QuickEditFormModel.d.ts +7 -1
- package/es/flow/models/fields/JSFieldModel.d.ts +5 -0
- package/es/index.mjs +81 -81
- package/lib/index.js +73 -73
- package/package.json +5 -5
- package/src/BaseApplication.tsx +4 -0
- package/src/flow/actions/__tests__/dataScopeFilter.test.ts +158 -0
- package/src/flow/actions/dataScope.tsx +6 -4
- package/src/flow/actions/dataScopeFilter.ts +70 -0
- package/src/flow/actions/setTargetDataScope.tsx +6 -5
- package/src/flow/components/Grid/index.tsx +66 -20
- package/src/flow/components/code-editor/__tests__/linter.test.ts +18 -0
- package/src/flow/components/code-editor/__tests__/runjsDiagnostics.test.ts +23 -0
- package/src/flow/components/code-editor/index.tsx +18 -17
- package/src/flow/components/code-editor/linter.ts +222 -158
- package/src/flow/components/code-editor/runjsDiagnostics.ts +161 -97
- package/src/flow/components/code-editor/types.ts +1 -0
- package/src/flow/internal/utils/__tests__/rebuildFieldSubModel.test.ts +77 -2
- package/src/flow/internal/utils/rebuildFieldSubModel.ts +21 -5
- package/src/flow/models/base/BlockGridModel.tsx +2 -2
- package/src/flow/models/base/GridModel.tsx +428 -195
- package/src/flow/models/base/__tests__/BlockGridModel.dragOverlayConfig.test.ts +44 -0
- package/src/flow/models/base/__tests__/GridModel.computeOverlayRect.test.ts +29 -0
- package/src/flow/models/base/__tests__/GridModel.dragSnapshotContainer.test.ts +181 -2
- package/src/flow/models/base/__tests__/GridModel.resizeLayout.test.ts +124 -0
- package/src/flow/models/base/__tests__/GridModel.visibleLayout.test.ts +55 -15
- package/src/flow/models/blocks/details/DetailsGridModel.tsx +6 -6
- package/src/flow/models/blocks/filter-form/FilterFormBlockModel.tsx +9 -5
- package/src/flow/models/blocks/filter-form/FilterFormGridModel.tsx +54 -14
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormBlockModel.cleanup.test.ts +138 -0
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormGridModel.toggleFormFieldsCollapse.test.ts +45 -0
- package/src/flow/models/blocks/form/FormGridModel.tsx +6 -6
- package/src/flow/models/blocks/form/QuickEditFormModel.tsx +39 -16
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +22 -0
- package/src/flow/models/blocks/table/JSColumnModel.tsx +30 -2
- package/src/flow/models/blocks/table/TableBlockModel.tsx +8 -1
- package/src/flow/models/blocks/table/TableColumnModel.tsx +1 -0
- package/src/flow/models/blocks/table/__tests__/JSColumnModel.test.tsx +51 -0
- package/src/flow/models/blocks/table/__tests__/TableBlockModel.quickEditRefresh.test.ts +49 -0
- package/src/flow/models/fields/JSFieldModel.tsx +54 -14
package/es/BaseApplication.d.ts
CHANGED
|
@@ -121,6 +121,7 @@ export declare abstract class BaseApplication<TOptions extends BaseApplicationOp
|
|
|
121
121
|
* 注册两边共享的默认 providers。
|
|
122
122
|
*/
|
|
123
123
|
protected addBaseProviders(): void;
|
|
124
|
+
protected addFinalProviders(): void;
|
|
124
125
|
addReactRouterComponents(): void;
|
|
125
126
|
addRoutes(): void;
|
|
126
127
|
updateFavicon(favicon?: string): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export declare function normalizeDataScopeFilter(rawFilter: any, resolvedFilter: any): any;
|
|
@@ -6,21 +6,23 @@
|
|
|
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 { GridLayoutV2 } from '@nocobase/flow-engine';
|
|
9
10
|
import React from 'react';
|
|
10
11
|
interface DragOverlayRect {
|
|
11
12
|
readonly top: number;
|
|
12
13
|
readonly left: number;
|
|
13
14
|
readonly width: number;
|
|
14
15
|
readonly height: number;
|
|
15
|
-
readonly type: 'column' | 'column-edge' | 'row-gap' | 'empty-row' | 'empty-column';
|
|
16
|
+
readonly type: 'column' | 'column-edge' | 'row-gap' | 'empty-row' | 'empty-column' | 'item-edge';
|
|
16
17
|
}
|
|
17
18
|
interface GridProps {
|
|
18
|
-
readonly rows
|
|
19
|
+
readonly rows?: Record<string, string[][]>;
|
|
19
20
|
readonly sizes?: Record<string, number[]>;
|
|
21
|
+
readonly layout?: GridLayoutV2;
|
|
20
22
|
readonly renderItem: (uid: string) => React.ReactNode;
|
|
21
23
|
readonly rowGap?: number;
|
|
22
24
|
readonly colGap?: number;
|
|
23
25
|
readonly dragOverlayRect?: DragOverlayRect | null;
|
|
24
26
|
}
|
|
25
|
-
export declare function Grid({ rows, sizes, renderItem, rowGap, colGap, dragOverlayRect }: GridProps): React.JSX.Element;
|
|
27
|
+
export declare function Grid({ rows, sizes, layout, renderItem, rowGap, colGap, dragOverlayRect, }: GridProps): React.JSX.Element;
|
|
26
28
|
export {};
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* 通用的字段子模型重建工具:
|
|
11
11
|
* - 保留原有 uid
|
|
12
|
-
* -
|
|
12
|
+
* - 直接重建为目标字段类,保持与 defineChildren 初始创建逻辑一致
|
|
13
13
|
* - 支持同步父项模式(pattern)
|
|
14
|
+
* - 同一字段模型类型下保留已有字段设置;切换到其他字段模型类型时丢弃不兼容设置
|
|
14
15
|
* - 重建后触发 beforeRender(useCache: false)
|
|
15
16
|
*/
|
|
16
17
|
import { FieldModel } from '../../models/base/FieldModel';
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { DragCancelEvent, DragEndEvent, DragMoveEvent, DragStartEvent } from '@dnd-kit/core';
|
|
10
|
-
import { DragOverlayConfig, FlowModel, GridLayoutData } from '@nocobase/flow-engine';
|
|
11
10
|
import type { FlowModelRendererProps } from '@nocobase/flow-engine';
|
|
11
|
+
import { DragOverlayConfig, FlowModel, GridLayoutData, GridLayoutV2 } from '@nocobase/flow-engine';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
export declare const GRID_FLOW_KEY = "gridSettings";
|
|
14
14
|
export declare const GRID_STEP = "grid";
|
|
@@ -33,6 +33,9 @@ export declare class GridModel<T extends {
|
|
|
33
33
|
private readonly itemExtraToolbarItems;
|
|
34
34
|
private dragState?;
|
|
35
35
|
private _memoItemFlowSettings?;
|
|
36
|
+
private updateDragPointerPosition;
|
|
37
|
+
private handleDragScroll;
|
|
38
|
+
private bindDragDocumentListeners;
|
|
36
39
|
protected deriveRowOrder(rows: Record<string, string[][]>, provided?: string[]): string[];
|
|
37
40
|
normalizeRowsWithOrder(rows: Record<string, string[][]>, provided?: string[]): {
|
|
38
41
|
rows: Record<string, string[][]>;
|
|
@@ -40,18 +43,32 @@ export declare class GridModel<T extends {
|
|
|
40
43
|
};
|
|
41
44
|
orderSizesByRowOrder(sizes: Record<string, number[]>, rowOrder: string[]): Record<string, number[]>;
|
|
42
45
|
private getItemFlowSettings;
|
|
46
|
+
getItemUids(): string[];
|
|
47
|
+
protected normalizeLayoutFromSource(source?: Partial<GridLayoutData>): GridLayoutV2;
|
|
48
|
+
getGridLayout(): GridLayoutV2;
|
|
49
|
+
syncLayoutProps(layout: GridLayoutV2): void;
|
|
50
|
+
setGridStepLayout(layout: GridLayoutV2): void;
|
|
51
|
+
private findLayoutRowByPath;
|
|
52
|
+
private collectCellItemsForResize;
|
|
53
|
+
private buildResizedCells;
|
|
54
|
+
private getResizeRowPath;
|
|
55
|
+
private getResizeContainerWidth;
|
|
56
|
+
private resizeGridLayout;
|
|
43
57
|
onMount(): void;
|
|
44
|
-
saveGridLayout(layout?: GridLayoutData): void;
|
|
58
|
+
saveGridLayout(layout?: GridLayoutData | GridLayoutV2): void;
|
|
45
59
|
mergeRowsWithItems(rows: Record<string, string[][]>): Record<string, string[][]>;
|
|
46
60
|
resetRows(syncProps?: boolean): void;
|
|
47
61
|
private computePointerPosition;
|
|
48
62
|
private getDragContainer;
|
|
49
63
|
private updateLayoutSnapshot;
|
|
50
64
|
private scheduleSnapshotRefresh;
|
|
65
|
+
private refreshPreviewFromPointer;
|
|
51
66
|
/**
|
|
52
67
|
* 根据 slot 类型、位置和配置计算最终的 overlay 尺寸和位置
|
|
53
68
|
*/
|
|
54
69
|
private computeOverlayRect;
|
|
70
|
+
private getHitTestSlot;
|
|
71
|
+
private resolveDragSlot;
|
|
55
72
|
private applyPreview;
|
|
56
73
|
handleDragStart(event: DragStartEvent): void;
|
|
57
74
|
handleDragMove(event: DragMoveEvent): void;
|
|
@@ -11,6 +11,7 @@ import React from 'react';
|
|
|
11
11
|
import { GridModel } from '../../base';
|
|
12
12
|
import { FilterFormItemModel } from './FilterFormItemModel';
|
|
13
13
|
export declare class FilterFormGridModel extends GridModel {
|
|
14
|
+
private fullLayoutBeforeCollapse?;
|
|
14
15
|
itemSettingsMenuLevel: number;
|
|
15
16
|
itemFlowSettings: {
|
|
16
17
|
showBackground: boolean;
|
|
@@ -6,8 +6,14 @@
|
|
|
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 { Collection, FlowEngine, FlowModel, SingleRecordResource } from '@nocobase/flow-engine';
|
|
9
|
+
import { Collection, CollectionField, FlowEngine, FlowModel, SingleRecordResource } from '@nocobase/flow-engine';
|
|
10
10
|
import React from 'react';
|
|
11
|
+
export declare const QUICK_EDIT_POPOVER_MAX_HEIGHT = "calc(100vh - 96px)";
|
|
12
|
+
export declare const QUICK_EDIT_FORM_MAX_HEIGHT = "calc(100vh - 160px)";
|
|
13
|
+
export declare const QUICK_EDIT_MARKDOWN_HEIGHT = "min(480px, calc(100vh - 320px))";
|
|
14
|
+
export declare function getQuickEditFieldProps(collectionField: CollectionField, fieldProps?: Record<string, any>): {
|
|
15
|
+
[x: string]: any;
|
|
16
|
+
};
|
|
11
17
|
export declare class QuickEditFormModel extends FlowModel {
|
|
12
18
|
fieldPath: string;
|
|
13
19
|
resource: SingleRecordResource;
|
|
@@ -17,6 +17,9 @@ import { FieldModel } from '../base/FieldModel';
|
|
|
17
17
|
*/
|
|
18
18
|
export declare class JSFieldModel extends FieldModel {
|
|
19
19
|
private _mountedOnce;
|
|
20
|
+
private _lastRenderedElement?;
|
|
21
|
+
private _pendingRenderedElement?;
|
|
22
|
+
private _lastRunJs?;
|
|
20
23
|
getInputArgs(): {
|
|
21
24
|
collectionName: any;
|
|
22
25
|
associationName: string;
|
|
@@ -36,6 +39,8 @@ export declare class JSFieldModel extends FieldModel {
|
|
|
36
39
|
/**
|
|
37
40
|
* 渲染一个占位容器,供 JS 脚本写入内容
|
|
38
41
|
*/
|
|
42
|
+
private getRunJsCode;
|
|
43
|
+
private refreshRenderedElement;
|
|
39
44
|
render(): React.JSX.Element;
|
|
40
45
|
/**
|
|
41
46
|
* 组件挂载后,如果容器引用已就绪,强制重跑一次 beforeRender flows 以把 HTML 写入当前 DOM。
|