@nocobase/client-v2 2.3.0-beta.2 → 2.3.0-beta.21
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/RouteRepository.d.ts +6 -0
- package/es/components/form/ScanInput/useCodeScanner.d.ts +12 -2
- package/es/components/form/ScanInput/zxingWasmDecoder.d.ts +9 -0
- package/es/flow/admin-shell/admin-layout/MobileTopbarActionsContext.d.ts +10 -0
- package/es/flow/components/FieldAssignValueInput.d.ts +2 -0
- package/es/flow/components/field-value-variable/FieldValueVariableInput.d.ts +1 -0
- package/es/flow/components/filter/VariableFilterItem.d.ts +10 -1
- package/es/flow/internal/utils/quickEditDataScope.d.ts +48 -0
- package/es/flow/internal/utils/quickEditViewContainer.d.ts +27 -0
- package/es/flow/models/actions/LinkActionUtils.d.ts +1 -0
- package/es/flow/models/blocks/assign-form/assignFormValue.d.ts +29 -0
- package/es/flow/models/blocks/form/QuickEditFormModel.d.ts +1 -0
- package/es/index.mjs +100 -100
- package/lib/index.js +102 -102
- package/package.json +9 -8
- package/src/BaseApplication.tsx +2 -0
- package/src/RouteRepository.ts +14 -0
- package/src/__tests__/RouteRepository.test.ts +51 -0
- package/src/__tests__/app.test.tsx +13 -0
- package/src/collection-manager/__tests__/field-configure.test.ts +52 -0
- package/src/collection-manager/field-configure.ts +2 -2
- package/src/components/form/ScanInput/CodeScanner.tsx +3 -1
- package/src/components/form/ScanInput/__tests__/CodeScanner.test.tsx +7 -1
- package/src/components/form/ScanInput/__tests__/useCodeScanner.test.tsx +182 -8
- package/src/components/form/ScanInput/__tests__/zxingWasmDecoder.test.ts +78 -0
- package/src/components/form/ScanInput/useCodeScanner.ts +135 -20
- package/src/components/form/ScanInput/zxingWasmDecoder.ts +64 -0
- package/src/flow/actions/__tests__/validation.test.ts +48 -0
- package/src/flow/admin-shell/admin-layout/MobileTopbarActionsContext.ts +13 -0
- package/src/flow/admin-shell/admin-layout/TopbarActionsBar.tsx +13 -2
- package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.mobile.test.tsx +205 -0
- package/src/flow/admin-shell/admin-layout/__tests__/TopbarActionsBar.test.tsx +42 -23
- package/src/flow/components/FieldAssignValueInput.tsx +4 -0
- package/src/flow/components/field-value-variable/FieldValueVariableInput.tsx +21 -12
- package/src/flow/components/field-value-variable/__tests__/FieldValueVariableInput.test.tsx +9 -0
- package/src/flow/components/filter/VariableFilterItem.tsx +14 -4
- package/src/flow/components/filter/__tests__/VariableFilterItem.rightMetaTree.test.tsx +158 -0
- package/src/flow/internal/components/Markdown/DisplayMarkdown.tsx +14 -9
- package/src/flow/internal/components/Markdown/__tests__/DisplayMarkdown.test.tsx +46 -0
- package/src/flow/internal/utils/__tests__/quickEditDataScope.test.ts +156 -0
- package/src/flow/internal/utils/__tests__/quickEditViewContainer.test.ts +52 -0
- package/src/flow/internal/utils/quickEditDataScope.tsx +177 -0
- package/src/flow/internal/utils/quickEditViewContainer.ts +46 -0
- package/src/flow/models/actions/JSItemActionModel.tsx +19 -3
- package/src/flow/models/actions/LinkActionModel.tsx +11 -9
- package/src/flow/models/actions/LinkActionUtils.ts +4 -2
- package/src/flow/models/actions/__tests__/JSItemActionModel.test.tsx +47 -1
- package/src/flow/models/actions/__tests__/LinkActionModel.test.ts +14 -0
- package/src/flow/models/base/GridModel.tsx +0 -1
- package/src/flow/models/blocks/assign-form/AssignFormGridModel.tsx +22 -1
- package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +40 -12
- package/src/flow/models/blocks/assign-form/__tests__/assignFieldValuesFlow.editor.test.tsx +140 -0
- package/src/flow/models/blocks/assign-form/__tests__/assignFieldValuesFlow.multipleSelect.test.tsx +216 -0
- package/src/flow/models/blocks/assign-form/__tests__/assignFormValue.test.ts +41 -0
- package/src/flow/models/blocks/assign-form/assignFormValue.ts +64 -0
- package/src/flow/models/blocks/filter-form/__tests__/FilterFormGridModel.toggleFormFieldsCollapse.test.ts +29 -0
- package/src/flow/models/blocks/filter-form/fields/FieldComponentProps.tsx +1 -1
- package/src/flow/models/blocks/filter-form/fields/__tests__/FieldComponentProps.options.test.tsx +61 -0
- package/src/flow/models/blocks/form/FormBlockModel.tsx +26 -5
- package/src/flow/models/blocks/form/QuickEditFormModel.tsx +45 -11
- package/src/flow/models/blocks/form/__tests__/FormBlockModel.test.tsx +145 -0
- package/src/flow/models/blocks/form/__tests__/QuickEditFormModel.quickEdit.test.ts +120 -0
- package/src/flow/models/blocks/form/__tests__/popupLinkage.test.tsx +175 -0
- package/src/flow/models/blocks/js-block/JSBlock.tsx +5 -1
- package/src/flow/models/blocks/js-block/__tests__/JSBlockModel.test.tsx +23 -1
- package/src/flow/models/blocks/table/TableColumnModel.tsx +31 -0
- package/src/flow/models/blocks/table/__tests__/TableColumnModel.test.tsx +64 -0
- package/src/flow/models/fields/AssociationFieldModel/CascadeSelectFieldModel.tsx +11 -2
- package/src/flow/models/fields/AssociationFieldModel/PopupSubTableFieldModel/PopupSubTableFieldModel.tsx +4 -3
- package/src/flow/models/fields/AssociationFieldModel/RecordPickerFieldModel.tsx +6 -3
- package/src/flow/models/fields/AssociationFieldModel/RecordSelectFieldModel.tsx +13 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableColumnModel.tsx +47 -17
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/SubTableField.tsx +6 -1
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableColumnModel.largeField.test.tsx +178 -0
- package/src/flow/models/fields/AssociationFieldModel/SubTableFieldModel/__tests__/SubTableField.disabled.test.tsx +90 -0
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordPickerFieldModel.itemContext.test.ts +26 -2
- package/src/flow/models/fields/AssociationFieldModel/__tests__/RecordSelectFieldModel.quickCreatePopup.test.tsx +183 -0
- package/src/flow/models/fields/AssociationFieldModel/__tests__/associationSelect.search.test.ts +113 -0
- package/src/flow/models/fields/DisplayAssociationField/DisplaySubTableFieldModel.tsx +42 -7
- package/src/flow/models/fields/DisplayAssociationField/__tests__/DisplaySubTableFieldModel.test.tsx +351 -0
- package/src/flow/models/fields/DisplayHtmlFieldModel.tsx +2 -1
- package/src/flow/models/fields/InputFieldModel.tsx +1 -1
- package/src/flow/models/fields/RichTextFieldModel/__tests__/RichTextFieldModel.test.tsx +74 -0
- package/src/flow/models/fields/RichTextFieldModel/index.tsx +27 -6
- package/src/flow/models/fields/SelectFieldModel.tsx +5 -0
- package/src/flow/models/fields/__tests__/InputFieldModel.test.tsx +16 -0
- package/src/flow/models/fields/__tests__/SelectFieldModel.test.tsx +29 -1
- package/src/flow/models/fields/mobile-components/MobileLazySelect.tsx +1 -0
- package/src/flow/models/fields/mobile-components/__tests__/MobileSelect.test.tsx +20 -0
- package/src/flow/models/topbar/TopbarActionModel.tsx +5 -5
- package/src/flow/models/topbar/UserCenterTopbarActionModel.tsx +8 -4
package/es/RouteRepository.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ export declare class RouteRepository {
|
|
|
72
72
|
* @returns 当前可访问的路由数组
|
|
73
73
|
*/
|
|
74
74
|
ensureAccessibleLoaded(): Promise<any>;
|
|
75
|
+
/**
|
|
76
|
+
* 清空所有布局的路由缓存,并丢弃清空前发起的请求结果。
|
|
77
|
+
*
|
|
78
|
+
* 用于登录态失效(如退出登录)时,避免下一个用户沿用上一个用户的可访问路由。
|
|
79
|
+
*/
|
|
80
|
+
clear(): void;
|
|
75
81
|
/**
|
|
76
82
|
* 订阅路由缓存变化,用于驱动 React 上下文刷新。
|
|
77
83
|
*
|
|
@@ -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 type { RefObject } from 'react';
|
|
9
10
|
import type { CodeFormatsToSupport } from './types';
|
|
10
11
|
type ScannerSize = {
|
|
11
12
|
width: number;
|
|
@@ -16,17 +17,26 @@ type UseCodeScannerOptions = {
|
|
|
16
17
|
elementId: string;
|
|
17
18
|
formatsToSupport?: CodeFormatsToSupport;
|
|
18
19
|
onScannerSizeChanged?: (size: ScannerSize) => void;
|
|
20
|
+
scanViewportRef?: RefObject<HTMLElement | null>;
|
|
19
21
|
onScanSuccess: (text: string) => void;
|
|
20
22
|
onScanFailure?: () => void;
|
|
21
23
|
onCameraStartFailure?: (error: unknown) => void;
|
|
22
24
|
};
|
|
25
|
+
type QrFrameCaptureLimits = {
|
|
26
|
+
maxHeight: number;
|
|
27
|
+
maxPixels: number;
|
|
28
|
+
maxWidth: number;
|
|
29
|
+
};
|
|
23
30
|
export declare const DEFAULT_CODE_FORMATS: CodeFormatsToSupport;
|
|
24
31
|
export declare function getCodeScanBoxSize(width: number, height: number): {
|
|
25
32
|
width: number;
|
|
26
33
|
height: number;
|
|
27
34
|
};
|
|
28
|
-
export declare function
|
|
29
|
-
export declare function
|
|
35
|
+
export declare function isIOSBrowser(): boolean;
|
|
36
|
+
export declare function getQrVideoFrameImageData(video: HTMLVideoElement, canvas: HTMLCanvasElement, scanViewport?: Element, limits?: QrFrameCaptureLimits): ImageData;
|
|
37
|
+
export declare function scanQrVideoFrame(video: HTMLVideoElement, canvas: HTMLCanvasElement, scanViewport?: Element): string;
|
|
38
|
+
export declare function scanQrVideoFrameWithZxingWasm(video: HTMLVideoElement, canvas: HTMLCanvasElement, scanViewport: Element): Promise<string>;
|
|
39
|
+
export declare function useCodeScanner({ enabled, elementId, formatsToSupport, onScannerSizeChanged, scanViewportRef, onScanSuccess, onScanFailure, onCameraStartFailure, }: UseCodeScannerOptions): {
|
|
30
40
|
startScanFile: (file: File) => Promise<void>;
|
|
31
41
|
};
|
|
32
42
|
export {};
|
|
@@ -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 decodeQrCodeWithZxingWasm(imageData: ImageData): Promise<string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
10
|
+
export declare const MobileTopbarActionsContext: import("react").Context<() => void>;
|
|
@@ -34,6 +34,8 @@ interface Props {
|
|
|
34
34
|
enableDateVariableAsConstant?: boolean;
|
|
35
35
|
/** 是否允许在变量选择器中使用 RunJS。默认 true,保持历史行为。 */
|
|
36
36
|
allowRunJS?: boolean;
|
|
37
|
+
/** 是否允许在变量选择器中使用内置日期变量。默认 true。 */
|
|
38
|
+
allowDateVariables?: boolean;
|
|
37
39
|
maxAssociationFieldDepth?: number;
|
|
38
40
|
disabled?: boolean;
|
|
39
41
|
variableConverters?: VariableInputProps['converters'];
|
|
@@ -25,6 +25,7 @@ export type FieldValueVariableInputProps = Omit<VariableInputProps, 'value' | 'o
|
|
|
25
25
|
isDateLikeField: boolean;
|
|
26
26
|
dateComponentProps: DateVariableComponentProps;
|
|
27
27
|
allowRunJS?: boolean;
|
|
28
|
+
allowDateVariables?: boolean;
|
|
28
29
|
converters?: VariableInputProps['converters'];
|
|
29
30
|
};
|
|
30
31
|
export declare const FieldValueVariableInput: React.FC<FieldValueVariableInputProps>;
|
|
@@ -27,7 +27,9 @@ export interface VariableFilterItemProps {
|
|
|
27
27
|
rightAsVariable?: boolean;
|
|
28
28
|
/**
|
|
29
29
|
* 右侧 VariableInput 的 metaTree 提供器;
|
|
30
|
-
*
|
|
30
|
+
* 默认使用视图上下文的 metaTree:useFlowViewContext().getPropertyMetaTree()。
|
|
31
|
+
* 注意它取自视图上下文而非 `model.context`:当调用方传入的 model 与打开设置弹窗的模型不是同一个时,
|
|
32
|
+
* 右侧变量不会跟随 model 变化,需要显式传入本属性。
|
|
31
33
|
*/
|
|
32
34
|
rightMetaTree?: MetaTreeNode[] | (() => MetaTreeNode[] | Promise<MetaTreeNode[]>);
|
|
33
35
|
/**
|
|
@@ -36,6 +38,13 @@ export interface VariableFilterItemProps {
|
|
|
36
38
|
rightVariableConverters?: Pick<Converters, 'resolvePathFromValue' | 'resolveValueFromPath'>;
|
|
37
39
|
ignoreFieldNames?: string[];
|
|
38
40
|
maxAssociationFieldDepth?: number;
|
|
41
|
+
/**
|
|
42
|
+
* 右侧变量树的关联层级上限,默认与 `maxAssociationFieldDepth` 一致。
|
|
43
|
+
* 传 `null` 表示不限制:右侧是变量树而非集合字段树,其深度可能已由调用方约束
|
|
44
|
+
* (例如工作流的变量树由触发器的「预加载关系数据」决定),此时再按左侧的层级上限裁剪
|
|
45
|
+
* 会让已配置好的深层变量选不到。
|
|
46
|
+
*/
|
|
47
|
+
rightMaxAssociationFieldDepth?: number | null;
|
|
39
48
|
}
|
|
40
49
|
/**
|
|
41
50
|
* 上下文筛选项组件
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { FlowEngineContext, ModelConstructor } from '@nocobase/flow-engine';
|
|
10
|
+
import { CollectionField, FlowModel } from '@nocobase/flow-engine';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
export declare const QUICK_EDIT_DATA_SCOPE_FLOW_KEY = "tableColumnSettings";
|
|
13
|
+
export declare const QUICK_EDIT_DATA_SCOPE_STEP_KEY = "quickEditDataScope";
|
|
14
|
+
export type DataScopeStepLocation = {
|
|
15
|
+
flowKey: string;
|
|
16
|
+
stepKey: string;
|
|
17
|
+
};
|
|
18
|
+
type DataScopeFilter = {
|
|
19
|
+
logic?: string;
|
|
20
|
+
items?: unknown[];
|
|
21
|
+
} | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Locate the flow and step that carry the shared `dataScope` action on a field model class. Both association editors
|
|
24
|
+
* currently keep it under `selectSettings`, but the lookup resolves it from the class instead of hard-coding that name,
|
|
25
|
+
* so an editor registered later is picked up without touching the quick edit path. Returns the first match.
|
|
26
|
+
*/
|
|
27
|
+
export declare function findDataScopeStep(ModelClass: ModelConstructor | typeof FlowModel | undefined | null): DataScopeStepLocation | null;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the data scope step of the editor model that the quick edit popover builds for `collectionField`. Returns null
|
|
30
|
+
* when the field is not an association or when its default editor has no data scope step, which is what the column
|
|
31
|
+
* setting uses to decide whether to offer the item at all.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveQuickEditDataScopeStep(ctx: FlowEngineContext, collectionField: CollectionField): DataScopeStepLocation | null;
|
|
34
|
+
export declare function isEmptyDataScopeFilter(filter: DataScopeFilter): boolean;
|
|
35
|
+
/** Read the quick edit data scope filter stored on the table column that owns `sourceFieldModel`. */
|
|
36
|
+
export declare function getQuickEditDataScopeFilter(sourceFieldModel?: FlowModel): DataScopeFilter;
|
|
37
|
+
/**
|
|
38
|
+
* Context the filter builder is configured against. The setting lives on the table column, but the filter describes
|
|
39
|
+
* records of the association target, so `collection` points at the target collection to drive the left-hand field list.
|
|
40
|
+
* `record` is declared with meta only so that "Current record" is offered as a right-hand variable and describes the row
|
|
41
|
+
* being edited rather than whatever record an enclosing popup happens to supply; it has no value while configuring and
|
|
42
|
+
* resolves per row once the popover opens.
|
|
43
|
+
*/
|
|
44
|
+
export declare function createQuickEditDataScopeContext(columnModel: FlowModel): Promise<import("@nocobase/flow-engine").FlowModelContext>;
|
|
45
|
+
export declare function QuickEditDataScopeInput(props: {
|
|
46
|
+
value?: Record<string, any>;
|
|
47
|
+
}): React.JSX.Element;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
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 QuickEditViewContainerLike = {
|
|
10
|
+
update?: (newConfig: {
|
|
11
|
+
preventClose?: boolean;
|
|
12
|
+
}) => unknown;
|
|
13
|
+
};
|
|
14
|
+
type QuickEditFieldModelLike = {
|
|
15
|
+
parent?: {
|
|
16
|
+
use?: string;
|
|
17
|
+
viewContainer?: QuickEditViewContainerLike;
|
|
18
|
+
} | null;
|
|
19
|
+
};
|
|
20
|
+
export declare function getQuickEditViewContainer(model: QuickEditFieldModelLike | undefined): QuickEditViewContainerLike;
|
|
21
|
+
/**
|
|
22
|
+
* Keeps the quick edit popover open while a nested dropdown (Select / Cascader) is open. The outside click that
|
|
23
|
+
* closes the dropdown would otherwise also close the popover and drop the unsaved edit. Releasing is deferred so the
|
|
24
|
+
* closing click itself never reaches the popover as a close request.
|
|
25
|
+
*/
|
|
26
|
+
export declare function syncQuickEditPreventClose(model: QuickEditFieldModelLike | undefined, dropdownOpen: boolean): void;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
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 ArrayValueCollectionField = {
|
|
10
|
+
interface?: string;
|
|
11
|
+
uiSchema?: {
|
|
12
|
+
type?: string;
|
|
13
|
+
} | null;
|
|
14
|
+
} | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Fields whose stored value is an array. Besides `multipleSelect`/`checkboxGroup`,
|
|
17
|
+
* some legacy fields declare `uiSchema.type === 'array'` explicitly.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isArrayValueField(collectionField: ArrayValueCollectionField): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Normalize a constant assignment value for array-valued fields.
|
|
22
|
+
*
|
|
23
|
+
* Historical configurations may store a scalar (before the multi-select control
|
|
24
|
+
* was rendered correctly), so wrap it into an array instead of submitting a
|
|
25
|
+
* string to the server. Variable expressions, RunJS values, Null and empty
|
|
26
|
+
* values are kept as-is so the assignment mode is not changed.
|
|
27
|
+
*/
|
|
28
|
+
export declare function normalizeAssignFormValue(value: unknown, arrayValueField: boolean): unknown;
|
|
29
|
+
export {};
|