@object-ui/plugin-report 4.2.1 → 4.3.0

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.
@@ -1,38 +1,24 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- export type AvailableField = {
9
- value: string;
10
- label: string;
11
- type?: string;
12
- options?: Array<{
13
- value: string;
14
- label: string;
15
- }>;
16
- };
1
+ import { AvailableField } from './editorTypes';
2
+ export type { AvailableField } from './editorTypes';
3
+ export { specFilterToUIGroup, uiGroupToSpecFilter, SpecFilterAdapter, } from './specFilterAdapter';
4
+ export type { SpecFilterParseResult } from './specFilterAdapter';
5
+ export { ColumnsEditor, normalizeColumns } from './ColumnsEditor';
6
+ export { GroupingsBuilder } from './GroupingsBuilder';
7
+ export { ChartConfig } from './ChartConfig';
17
8
  export interface ReportConfigPanelProps {
18
- /** Whether the panel is open */
19
9
  open: boolean;
20
- /** Close handler */
21
10
  onClose: () => void;
22
- /** Initial / committed report configuration */
23
- config: Record<string, any>;
24
- /** Persist the updated config */
11
+ config: Record<string, any> | null;
25
12
  onSave: (config: Record<string, any>) => void;
26
- /** Optional live-update callback */
27
- onFieldChange?: (field: string, value: any) => void;
28
- /** Available fields for filter/sort sub-editors */
13
+ onFieldChange?: (key: string, value: any, draft: Record<string, any>) => void;
29
14
  availableFields?: AvailableField[];
15
+ /**
16
+ * Optional resolver that returns the field list for a given object name.
17
+ * Used by `JoinedBlocksEditor` so blocks with an `objectName` override
18
+ * pick their fields from the right object schema instead of the container's.
19
+ * If omitted, blocks fall back to `availableFields`.
20
+ */
21
+ getFieldsForObject?: (objectName: string | undefined) => AvailableField[] | undefined;
30
22
  }
31
- /**
32
- * ReportConfigPanel — Schema-driven configuration panel for reports.
33
- *
34
- * Built entirely on the generic ConfigPanelRenderer + useConfigDraft,
35
- * mirroring the DashboardConfigPanel pattern so that report configuration
36
- * uses the same schema-driven approach as all other view types.
37
- */
38
- export declare function ReportConfigPanel({ open, onClose, config, onSave, onFieldChange, availableFields, }: ReportConfigPanelProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare function ReportConfigPanel({ open, onClose, config, onSave, onFieldChange, availableFields, getFieldsForObject, }: ReportConfigPanelProps): import("react/jsx-runtime").JSX.Element | null;
24
+ export default ReportConfigPanel;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export type AvailableField = {
9
+ value: string;
10
+ label: string;
11
+ type?: string;
12
+ options?: Array<{
13
+ value: string;
14
+ label: string;
15
+ }>;
16
+ };
17
+ export type Translator = (key: string, defaultValue?: string, options?: any) => string;
18
+ export declare const DATE_TYPES: Set<string>;
19
+ export declare const NUMERIC_TYPES: Set<string>;
20
+ export declare const NONE: "";
@@ -15,6 +15,8 @@ export type { JoinedReportRendererProps } from './JoinedReportRenderer';
15
15
  export { buildDrillAction, createDrillHandler, registerDrillHandler, isDrillAction, } from './drill';
16
16
  export type { DrillActionDef, DrillHandlerOptions, DrillNavigateTarget, DrillOpenIn, DrillView, } from './drill';
17
17
  export type { AvailableField } from './ReportConfigPanel';
18
+ export { JoinedBlocksEditor, validateJoinedBlocks } from './JoinedBlocksEditor';
19
+ export type { JoinedBlocksEditorProps } from './JoinedBlocksEditor';
18
20
  export { formatValue } from './formatValue';
19
21
  export { exportReport, exportAsCSV, exportAsJSON, exportAsHTML, exportAsPDF, exportAsExcel } from './ReportExportEngine';
20
22
  export { ScheduleConfig } from './ScheduleConfig';
@@ -0,0 +1,38 @@
1
+ import { AvailableField, Translator } from './editorTypes';
2
+ type UICondition = {
3
+ id: string;
4
+ field: string;
5
+ operator: string;
6
+ value: any;
7
+ };
8
+ type UIGroup = {
9
+ id: string;
10
+ logic: 'and' | 'or';
11
+ conditions: UICondition[];
12
+ };
13
+ export interface SpecFilterParseResult {
14
+ group: UIGroup;
15
+ /** When true the spec filter could not be fully represented in the UI. */
16
+ complex: boolean;
17
+ }
18
+ /**
19
+ * Convert a spec `FilterCondition` into a UI `FilterGroup`.
20
+ * Falsy / non-object input yields an empty AND group.
21
+ * Nested `$and` / `$or`, `$not`, or any unrecognized shape sets `complex: true`.
22
+ */
23
+ export declare function specFilterToUIGroup(spec: unknown): SpecFilterParseResult;
24
+ /**
25
+ * Convert a UI `FilterGroup` back into a spec `FilterCondition`.
26
+ * - Empty group → `undefined` (drop the key).
27
+ * - Single condition (equals + simple value) → `{field: value}` shorthand.
28
+ * - Single condition (other operator) → `{field: {$op: value}}`.
29
+ * - Multiple conditions → `{$and: [...]}` or `{$or: [...]}`.
30
+ */
31
+ export declare function uiGroupToSpecFilter(group: UIGroup | undefined): any;
32
+ export declare function SpecFilterAdapter({ availableFields, value, onChange, t, }: {
33
+ availableFields: AvailableField[];
34
+ value: any;
35
+ onChange: (v: any) => void;
36
+ t: Translator;
37
+ }): import("react/jsx-runtime").JSX.Element;
38
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-report",
3
- "version": "4.2.1",
3
+ "version": "4.3.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.cjs",
6
6
  "module": "dist/index.js",
@@ -23,13 +23,13 @@
23
23
  "lucide-react": "^1.16.0",
24
24
  "react-i18next": "^17.0.7",
25
25
  "tailwind-merge": "^3.6.0",
26
- "@object-ui/components": "4.2.1",
27
- "@object-ui/core": "4.2.1",
28
- "@object-ui/fields": "4.2.1",
29
- "@object-ui/i18n": "4.2.1",
30
- "@object-ui/plugin-grid": "4.2.1",
31
- "@object-ui/react": "4.2.1",
32
- "@object-ui/types": "4.2.1"
26
+ "@object-ui/components": "4.3.0",
27
+ "@object-ui/core": "4.3.0",
28
+ "@object-ui/fields": "4.3.0",
29
+ "@object-ui/i18n": "4.3.0",
30
+ "@object-ui/plugin-grid": "4.3.0",
31
+ "@object-ui/react": "4.3.0",
32
+ "@object-ui/types": "4.3.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "^18.0.0",