@nocobase/client-v2 2.1.0-alpha.46 → 2.1.0-alpha.47
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/collection-manager/filter-operators/index.d.ts +1 -0
- package/es/components/form/filter/CollectionFilterItem.d.ts +5 -1
- package/es/components/form/filter/FilterValueInput.d.ts +5 -0
- package/es/flow/internal/utils/operatorSchemaHelper.d.ts +26 -3
- package/es/flow/models/blocks/filter-manager/utils.d.ts +23 -1
- package/es/index.mjs +77 -77
- package/lib/index.js +82 -82
- package/package.json +7 -7
- package/src/__tests__/browserChecker.test.ts +103 -0
- package/src/__tests__/dataSourceRuntime.test.tsx +22 -1
- package/src/collection-field-interface/CollectionFieldInterface.ts +14 -7
- package/src/collection-manager/filter-operators/index.ts +29 -2
- package/src/components/form/filter/CollectionFilterItem.tsx +10 -2
- package/src/components/form/filter/FilterValueInput.tsx +27 -2
- package/src/components/form/filter/__tests__/FilterValueInput.test.tsx +39 -0
- package/src/flow/actions/__tests__/linkageRules.subFormSetFieldProps.test.ts +369 -2
- package/src/flow/actions/linkageRules.tsx +53 -0
- package/src/flow/components/DefaultValue.tsx +14 -8
- package/src/flow/components/FieldAssignValueInput.tsx +6 -10
- package/src/flow/components/filter/LinkageFilterItem.tsx +4 -3
- package/src/flow/components/filter/VariableFilterItem.tsx +5 -4
- package/src/flow/internal/utils/operatorSchemaHelper.ts +112 -5
- package/src/flow/models/blocks/filter-form/FilterFormItemModel.tsx +13 -11
- package/src/flow/models/blocks/filter-manager/__tests__/getDefaultOperator.test.ts +35 -1
- package/src/flow/models/blocks/filter-manager/flow-actions/__tests__/customizeFilterRender.test.tsx +148 -0
- package/src/flow/models/blocks/filter-manager/flow-actions/__tests__/defaultOperator.test.tsx +85 -0
- package/src/flow/models/blocks/filter-manager/flow-actions/customizeFilterRender.tsx +14 -44
- package/src/flow/models/blocks/filter-manager/flow-actions/defaultOperator.tsx +3 -5
- package/src/flow/models/blocks/filter-manager/flow-actions/operatorComponentProps.tsx +2 -12
- package/src/flow/models/blocks/filter-manager/utils.ts +143 -4
|
@@ -16,6 +16,7 @@ export type FieldFilterOperatorList<TMeta = unknown> = FieldFilterOperator<TMeta
|
|
|
16
16
|
export type FieldFilterable<TMeta = unknown> = {
|
|
17
17
|
operators?: FieldFilterOperatorList<TMeta>;
|
|
18
18
|
operatorGroup?: string;
|
|
19
|
+
operatorOverrides?: FieldFilterOperator<TMeta>[];
|
|
19
20
|
children?: unknown[];
|
|
20
21
|
nested?: boolean;
|
|
21
22
|
[key: string]: unknown;
|
|
@@ -33,6 +33,10 @@ export interface CollectionFilterItemProps {
|
|
|
33
33
|
noIgnore?: boolean;
|
|
34
34
|
/** Translator; defaults to identity so callers can omit it. */
|
|
35
35
|
t?: (key: string) => string;
|
|
36
|
+
/** Optional v2 app registry used to resolve plugin-provided operator components. */
|
|
37
|
+
app?: {
|
|
38
|
+
getComponent?: (name: string) => React.ComponentType<any> | undefined;
|
|
39
|
+
};
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
38
42
|
* Filter row bound directly to a `Collection`, with no `FlowModel` dependency. Use this from settings pages or other surfaces that need a filter UI but don't have (and shouldn't synthesise) a block model just to satisfy `FilterItem`. Pair with `FilterContainer` via either an inline wrapper or `createCollectionFilterItem(collection)`.
|
|
@@ -43,7 +47,7 @@ export declare const CollectionFilterItem: FC<CollectionFilterItemProps>;
|
|
|
43
47
|
/**
|
|
44
48
|
* Convenience factory returning a `FilterContainer`-compatible `FilterItem` component bound to a specific collection. Avoids creating an inline closure on every parent render, which would otherwise reset any focused inner antd control.
|
|
45
49
|
*/
|
|
46
|
-
export declare function createCollectionFilterItem(collection: Collection, bound?: Pick<CollectionFilterItemProps, 'filterableFieldNames' | 'nonfilterableFieldNames' | 'noIgnore' | 't'>): React.FC<{
|
|
50
|
+
export declare function createCollectionFilterItem(collection: Collection, bound?: Pick<CollectionFilterItemProps, 'filterableFieldNames' | 'nonfilterableFieldNames' | 'noIgnore' | 't' | 'app'>): React.FC<{
|
|
47
51
|
value: CollectionFilterItemValue;
|
|
48
52
|
}>;
|
|
49
53
|
export default CollectionFilterItem;
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import type { FilterOperator, FilterOption } from '../../../flow/components/filter/useFilterOptions';
|
|
11
|
+
type ComponentRegistryApp = {
|
|
12
|
+
getComponent?: (name: string) => React.ComponentType<any> | undefined;
|
|
13
|
+
};
|
|
11
14
|
export interface FilterValueInputProps {
|
|
12
15
|
/** The currently selected leaf field option from the field picker. */
|
|
13
16
|
field?: FilterOption;
|
|
@@ -21,6 +24,8 @@ export interface FilterValueInputProps {
|
|
|
21
24
|
t?: (key: string) => string;
|
|
22
25
|
/** Optional placeholder for the fallback `Input`. */
|
|
23
26
|
placeholder?: string;
|
|
27
|
+
/** Optional v2 app registry used to resolve plugin-provided operator components. */
|
|
28
|
+
app?: ComponentRegistryApp;
|
|
24
29
|
}
|
|
25
30
|
/**
|
|
26
31
|
* Interface-aware value renderer for filter rows. Returns `null` for `noValue` operators (`$empty`, `$notEmpty`). Otherwise dispatches the effective `x-component` (operator schema > field uiSchema > Input) to a small registry of antd controls.
|
|
@@ -6,10 +6,33 @@
|
|
|
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 React, { type ComponentType, type CSSProperties } from 'react';
|
|
10
|
+
type OperatorMeta = {
|
|
11
|
+
value?: string;
|
|
12
|
+
schema?: {
|
|
13
|
+
'x-component'?: string;
|
|
14
|
+
'x-component-props'?: Record<string, unknown>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
type ComponentRegistry = {
|
|
18
|
+
getComponent?: (name: string) => ComponentType<Record<string, unknown>> | undefined;
|
|
19
|
+
};
|
|
20
|
+
type OperatorComponentRenderOptions = {
|
|
21
|
+
app?: ComponentRegistry;
|
|
22
|
+
fieldModel: unknown;
|
|
23
|
+
operator: string;
|
|
24
|
+
operators?: OperatorMeta[];
|
|
25
|
+
propsPriority?: 'field' | 'operator';
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
};
|
|
28
|
+
export declare function pickOperatorStyle(value: unknown): CSSProperties | undefined;
|
|
9
29
|
/**
|
|
10
30
|
* 根据操作符的 schema 定位组件及其 props。
|
|
11
31
|
*/
|
|
12
|
-
export declare function resolveOperatorComponent(app:
|
|
13
|
-
Comp:
|
|
14
|
-
props: Record<string,
|
|
32
|
+
export declare function resolveOperatorComponent(app: ComponentRegistry | undefined, operator: string, operators?: OperatorMeta[]): {
|
|
33
|
+
Comp: React.ComponentType<Record<string, unknown>>;
|
|
34
|
+
props: Record<string, unknown>;
|
|
15
35
|
};
|
|
36
|
+
export declare function restoreOperatorComponentRender(fieldModel?: unknown): boolean;
|
|
37
|
+
export declare function applyOperatorComponentRender({ app, fieldModel, operator, operators, propsPriority, style, }: OperatorComponentRenderOptions): boolean;
|
|
38
|
+
export {};
|
|
@@ -7,8 +7,29 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { FlowModel } from '@nocobase/flow-engine';
|
|
10
|
+
import { type FieldFilterable, type FieldFilterOperator } from '../../../../collection-manager/filter-operators';
|
|
10
11
|
import { BlockGridModel } from '../../base';
|
|
11
|
-
|
|
12
|
+
type FilterFormFieldMeta = {
|
|
13
|
+
filterable?: FieldFilterable<unknown> | false;
|
|
14
|
+
interface?: string;
|
|
15
|
+
type?: string;
|
|
16
|
+
};
|
|
17
|
+
type FilterFormOperatorModel = FlowModel & {
|
|
18
|
+
operator?: string;
|
|
19
|
+
collectionField?: FilterFormFieldMeta;
|
|
20
|
+
filterField?: FilterFormFieldMeta;
|
|
21
|
+
subModels?: {
|
|
22
|
+
field?: {
|
|
23
|
+
operator?: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
getStepParams?: (flowKey: string, stepKey: string) => {
|
|
27
|
+
value?: string;
|
|
28
|
+
} | undefined;
|
|
29
|
+
};
|
|
30
|
+
export declare function getFilterFormOperatorList(model: FlowModel): FieldFilterOperator<unknown>[];
|
|
31
|
+
export declare function getFilterFormOperatorMeta(model: FlowModel, operator?: any): FieldFilterOperator<unknown>;
|
|
32
|
+
export declare function getDefaultOperator(model: FilterFormOperatorModel): any;
|
|
12
33
|
/**
|
|
13
34
|
* 判断筛选值是否为空
|
|
14
35
|
*
|
|
@@ -19,3 +40,4 @@ export declare function getDefaultOperator(model: any): any;
|
|
|
19
40
|
*/
|
|
20
41
|
export declare function isFilterValueEmpty(value: any): boolean;
|
|
21
42
|
export declare function getAllDataModels(gridModel: BlockGridModel): FlowModel[];
|
|
43
|
+
export {};
|