@nocobase/client-v2 2.1.0-beta.46 → 2.1.0-beta.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.
@@ -13,6 +13,8 @@ import { CompiledFilter } from './useFilterActionProps';
13
13
  export interface CollectionFilterProps {
14
14
  /** Collection whose fields drive the filter row's field picker. */
15
15
  collection: Collection | undefined;
16
+ /** Previously compiled filter param used to seed the editable filter group. */
17
+ initialValue?: CompiledFilter;
16
18
  /** Called on Submit or Reset with the compiled NocoBase filter param (`undefined` when cleared). */
17
19
  onChange: (filter: CompiledFilter) => void;
18
20
  /** Translator. Defaults to identity. */
@@ -0,0 +1,38 @@
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 { Collection } from '@nocobase/flow-engine';
10
+ import React from 'react';
11
+ import { type CompiledFilter } from './useFilterActionProps';
12
+ export interface CollectionFilterPanelRef {
13
+ getFilter: () => CompiledFilter;
14
+ reset: () => void;
15
+ }
16
+ export interface CollectionFilterPanelProps {
17
+ /** Collection whose fields drive the filter row's field picker. */
18
+ collection: Collection | undefined;
19
+ /** Previously compiled filter param used to seed the editable filter group. */
20
+ initialValue?: CompiledFilter;
21
+ /** Called when the condition group structure changes or `reset()` is invoked. */
22
+ onChange?: (filter: CompiledFilter) => void;
23
+ /** Translator. Defaults to identity. */
24
+ t?: (key: string, options?: Record<string, unknown>) => string;
25
+ /** Whitelist of root-level field names to expose. */
26
+ filterableFieldNames?: string[];
27
+ /**
28
+ * Blacklist of root-level field names to drop. Mirrors v1's `nonfilterable: [...]` on `Filter.Action`.
29
+ */
30
+ nonfilterableFieldNames?: string[];
31
+ /** Bypass the `filterableFieldNames` whitelist. */
32
+ noIgnore?: boolean;
33
+ }
34
+ /**
35
+ * Inline collection filter editor for forms and drawers. Unlike `CollectionFilter`, this does not render a trigger button, popover, or nested `<form>`, so it can safely live inside an antd form and be submitted by the outer drawer action.
36
+ */
37
+ export declare const CollectionFilterPanel: React.ForwardRefExoticComponent<CollectionFilterPanelProps & React.RefAttributes<CollectionFilterPanelRef>>;
38
+ export default CollectionFilterPanel;
@@ -8,4 +8,6 @@
8
8
  */
9
9
  export { CollectionFilter } from './CollectionFilter';
10
10
  export type { CollectionFilterProps } from './CollectionFilter';
11
+ export { CollectionFilterPanel } from './CollectionFilterPanel';
12
+ export type { CollectionFilterPanelProps, CollectionFilterPanelRef } from './CollectionFilterPanel';
11
13
  export type { CompiledFilter } from './useFilterActionProps';
@@ -27,6 +27,7 @@ interface FilterCtxModel {
27
27
  export interface FilterCtx {
28
28
  model: FilterCtxModel;
29
29
  }
30
+ export declare function decompileFilterGroup(filter: CompiledFilter): FilterGroupValue | undefined;
30
31
  /**
31
32
  * Compile a reactive filter group into the `{ $and: [{ path: { op: val } }] }` envelope accepted by NocoBase's resource `list` filter param. Returns `undefined` when the group is empty so callers can drop the param.
32
33
  *
@@ -43,6 +44,8 @@ export type FilterApplyAction = 'submit' | 'reset';
43
44
  export interface UseFilterActionPropsArgs extends UseFilterOptionsArgs {
44
45
  /** Collection whose fields populate the filter row's field picker. */
45
46
  collection: Collection | undefined;
47
+ /** Previously compiled filter param used to seed the editable filter group. */
48
+ initialValue?: CompiledFilter;
46
49
  /**
47
50
  * Called when the user submits or resets the filter popover. Receives the compiled filter param (`undefined` when cleared) and which footer button triggered the call. Typical implementation: `(filter, action) => { listRequest.run(filter); if (action === 'submit') closePopover(); }`.
48
51
  */
@@ -17,6 +17,8 @@ type Option = {
17
17
  label: any;
18
18
  value: any;
19
19
  } & Record<string, any>;
20
+ export declare function isTranslationTemplate(value: unknown): value is string;
21
+ export declare function translateOptionLabel(label: any, t: (s: string) => string): any;
20
22
  export declare function translateOptions(options: Option[], t: (s: string) => string): Option[];
21
23
  export declare function enumToOptions(uiEnum: UiSchemaEnumItem[] | undefined, t: (s: string) => string): Option[] | undefined;
22
24
  export declare function normalizeSelectRenderValue(value: unknown, props?: Record<string, any>): unknown;
@@ -9,5 +9,6 @@
9
9
  import React from 'react';
10
10
  import { DisplayTitleFieldModel } from './DisplayTitleFieldModel';
11
11
  export declare class DisplayJSONFieldModel extends DisplayTitleFieldModel {
12
- renderComponent(value: any): React.JSX.Element;
12
+ renderComponent(value: unknown): React.JSX.Element;
13
+ render(): React.JSX.Element;
13
14
  }