@nocobase/plugin-data-visualization 0.20.0-alpha.15 → 0.20.0-alpha.17

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,5 +1,6 @@
1
1
  import React from 'react';
2
2
  type ChartData = {
3
+ dataSource: string;
3
4
  collection: string;
4
5
  service: any;
5
6
  query: any;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const CollectionFieldInitializer: () => React.JSX.Element;
@@ -1,21 +1,19 @@
1
1
  import React from 'react';
2
+ type FilterField = {
3
+ title?: string;
4
+ operator?: {
5
+ value: string;
6
+ noValue?: boolean;
7
+ };
8
+ };
2
9
  export declare const ChartFilterContext: React.Context<{
3
10
  ready: boolean;
4
11
  enabled: boolean;
5
12
  setEnabled: (enabled: boolean) => void;
6
13
  fields: {
7
- [name: string]: {
8
- title: string;
9
- operator?: {
10
- value: string;
11
- noValue?: boolean;
12
- };
13
- };
14
+ [name: string]: FilterField;
14
15
  };
15
- setField: (name: string, field: {
16
- title?: string;
17
- operator?: string;
18
- }) => void;
16
+ setField: (name: string, field: FilterField) => void;
19
17
  removeField: (name: string) => void;
20
18
  collapse: {
21
19
  collapsed: boolean;
@@ -29,3 +27,4 @@ export declare const ChartFilterContext: React.Context<{
29
27
  setForm: (form: any) => void;
30
28
  }>;
31
29
  export declare const ChartFilterProvider: React.FC;
30
+ export {};
@@ -1,3 +1,4 @@
1
+ import { Schema } from '@formily/react';
1
2
  export declare const getOptionsSchema: () => {
2
3
  title: string;
3
4
  type: string;
@@ -49,3 +50,10 @@ export declare const getOptionsSchema: () => {
49
50
  export declare const getPropsSchemaByComponent: (component: string) => any;
50
51
  export declare const transformValue: (value: any, props: any) => any;
51
52
  export declare const setDefaultValue: (field: any, variables: any) => Promise<void>;
53
+ export declare const FILTER_FIELD_PREFIX_SEPARATOR = "-";
54
+ export declare const getFilterFieldPrefix: (dataSource: string, fieldName: string) => string;
55
+ export declare const parseFilterFieldName: (name: string) => {
56
+ dataSource: string;
57
+ fieldName: string;
58
+ };
59
+ export declare const findSchema: (schema: Schema, key: string, targetName: string) => any;
@@ -1,21 +1,31 @@
1
- import { SchemaInitializerItemType } from '@nocobase/client';
2
- import { CollectionOptions } from '@nocobase/database';
1
+ import { Collection, CollectionFieldInterfaceManager, CollectionManager, SchemaInitializerItemType } from '@nocobase/client';
3
2
  export declare const useCustomFieldInterface: () => {
4
3
  getSchemaByInterface: (fieldInterface: string) => any;
5
4
  };
6
5
  export declare const useChartData: () => {
7
- getChartCollections: () => string[];
6
+ chartCollections: {
7
+ [dataSource: string]: string[];
8
+ };
9
+ showDataSource: boolean;
10
+ getIsChartCollectionExists: (dataSource: string, collection: string) => boolean;
8
11
  };
9
12
  export declare const useChartFilter: () => {
10
13
  filter: () => Promise<void>;
11
14
  refresh: () => Promise<void>;
12
- getChartFilterFields: (collection: CollectionOptions) => SchemaInitializerItemType[];
15
+ getChartFilterFields: ({ dataSource, collection, cm, fim, }: {
16
+ dataSource: string;
17
+ collection: Collection;
18
+ cm: CollectionManager;
19
+ fim: CollectionFieldInterfaceManager;
20
+ }) => SchemaInitializerItemType[];
13
21
  getFilter: () => {};
14
22
  hasFilter: (chart: {
23
+ dataSource: string;
15
24
  collection: string;
16
25
  query: any;
17
26
  }, filterValues: any) => any;
18
27
  appendFilter: (chart: {
28
+ dataSource: string;
19
29
  collection: string;
20
30
  query: any;
21
31
  }, filterValues: any) => any;
@@ -31,7 +41,15 @@ export declare const useFilterVariable: () => {
31
41
  label: string;
32
42
  }[];
33
43
  };
34
- export declare const useChartFilterSourceFields: () => any[];
44
+ export declare const useChartFilterSourceFields: () => {
45
+ value: string;
46
+ label: any;
47
+ children: {
48
+ value: string;
49
+ label: any;
50
+ children: any[];
51
+ }[];
52
+ }[];
35
53
  export declare const useFieldComponents: () => {
36
54
  options: {
37
55
  label: string;
@@ -39,4 +57,4 @@ export declare const useFieldComponents: () => {
39
57
  }[];
40
58
  values: string[];
41
59
  };
42
- export declare const useCollectionJoinFieldTitle: (name: string) => any;
60
+ export declare const useCollectionJoinFieldTitle: (dataSource: string, name: string) => any;
@@ -1,6 +1,6 @@
1
1
  import { ArrayField } from '@formily/core';
2
2
  import { ISchema } from '@formily/react';
3
- import { CollectionFieldOptions_deprecated } from '@nocobase/client';
3
+ import { CollectionFieldOptions, CollectionManager } from '@nocobase/client';
4
4
  export type FieldOption = {
5
5
  value: string;
6
6
  label: string;
@@ -13,73 +13,22 @@ export type FieldOption = {
13
13
  target?: string;
14
14
  targetFields?: FieldOption[];
15
15
  };
16
- export declare const useFields: (collection?: string) => (CollectionFieldOptions_deprecated & {
16
+ export declare const useChartDataSource: (dataSource?: string) => {
17
+ cm: CollectionManager;
18
+ fim: import("@nocobase/client").CollectionFieldInterfaceManager;
19
+ collection: string;
20
+ };
21
+ export declare const useFields: (collectionFields: CollectionFieldOptions[]) => (CollectionFieldOptions & {
17
22
  key: string;
18
23
  label: string;
19
24
  value: string;
20
25
  })[];
21
- export declare const useFieldsWithAssociation: (collection?: string) => ({
26
+ export declare const useFieldsWithAssociation: (dataSource?: string, collection?: string) => ({
22
27
  label: any;
23
28
  name?: any;
24
29
  collectionName?: string;
25
30
  sourceKey?: string;
26
- uiSchema?: import("@formily/react").Stringify<{
27
- [key: symbol]: any;
28
- [key: `x-${string}`]: any;
29
- [key: `x-${number}`]: any;
30
- version?: string;
31
- name?: import("@formily/react").SchemaKey;
32
- title?: any;
33
- description?: any;
34
- default?: any;
35
- readOnly?: boolean;
36
- writeOnly?: boolean;
37
- type?: import("@formily/react").SchemaTypes;
38
- enum?: import("@formily/react").SchemaEnum<any>;
39
- const?: any;
40
- multipleOf?: number;
41
- maximum?: number;
42
- exclusiveMaximum?: number;
43
- minimum?: number;
44
- exclusiveMinimum?: number;
45
- maxLength?: number;
46
- minLength?: number;
47
- pattern?: string | RegExp;
48
- maxItems?: number;
49
- minItems?: number;
50
- uniqueItems?: boolean;
51
- maxProperties?: number;
52
- minProperties?: number;
53
- required?: string | boolean | string[];
54
- format?: string;
55
- $ref?: string;
56
- $namespace?: string;
57
- definitions?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
58
- properties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
59
- items?: import("@formily/react").SchemaItems<any, any, any, any, any, any, any, any>;
60
- additionalItems?: import("@formily/react").Stringify<any>;
61
- patternProperties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
62
- additionalProperties?: import("@formily/react").Stringify<any>;
63
- "x-value"?: any;
64
- "x-index"?: number;
65
- "x-pattern"?: any;
66
- "x-display"?: any;
67
- "x-validator"?: any;
68
- "x-decorator"?: any;
69
- "x-decorator-props"?: any;
70
- "x-component"?: any;
71
- "x-component-props"?: any;
72
- "x-reactions"?: import("@formily/react").SchemaReactions<any>;
73
- "x-content"?: any;
74
- "x-data"?: any;
75
- "x-visible"?: boolean;
76
- "x-hidden"?: boolean;
77
- "x-disabled"?: boolean;
78
- "x-editable"?: boolean;
79
- "x-read-only"?: boolean;
80
- "x-read-pretty"?: boolean;
81
- "x-compile-omitted"?: string[];
82
- }>;
31
+ uiSchema?: any;
83
32
  target?: string;
84
33
  key: string;
85
34
  value: string;
@@ -89,63 +38,7 @@ export declare const useFieldsWithAssociation: (collection?: string) => ({
89
38
  name?: any;
90
39
  collectionName?: string;
91
40
  sourceKey?: string;
92
- uiSchema?: import("@formily/react").Stringify<{
93
- [key: symbol]: any;
94
- [key: `x-${string}`]: any;
95
- [key: `x-${number}`]: any;
96
- version?: string;
97
- name?: import("@formily/react").SchemaKey;
98
- title?: any;
99
- description?: any;
100
- default?: any;
101
- readOnly?: boolean;
102
- writeOnly?: boolean;
103
- type?: import("@formily/react").SchemaTypes;
104
- enum?: import("@formily/react").SchemaEnum<any>;
105
- const?: any;
106
- multipleOf?: number;
107
- maximum?: number;
108
- exclusiveMaximum?: number;
109
- minimum?: number;
110
- exclusiveMinimum?: number;
111
- maxLength?: number;
112
- minLength?: number;
113
- pattern?: string | RegExp;
114
- maxItems?: number;
115
- minItems?: number;
116
- uniqueItems?: boolean;
117
- maxProperties?: number;
118
- minProperties?: number;
119
- required?: string | boolean | string[];
120
- format?: string;
121
- $ref?: string;
122
- $namespace?: string;
123
- definitions?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
124
- properties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
125
- items?: import("@formily/react").SchemaItems<any, any, any, any, any, any, any, any>;
126
- additionalItems?: import("@formily/react").Stringify<any>;
127
- patternProperties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
128
- additionalProperties?: import("@formily/react").Stringify<any>;
129
- "x-value"?: any;
130
- "x-index"?: number;
131
- "x-pattern"?: any;
132
- "x-display"?: any;
133
- "x-validator"?: any;
134
- "x-decorator"?: any;
135
- "x-decorator-props"?: any;
136
- "x-component"?: any;
137
- "x-component-props"?: any;
138
- "x-reactions"?: import("@formily/react").SchemaReactions<any>;
139
- "x-content"?: any;
140
- "x-data"?: any;
141
- "x-visible"?: boolean;
142
- "x-hidden"?: boolean;
143
- "x-disabled"?: boolean;
144
- "x-editable"?: boolean;
145
- "x-read-only"?: boolean;
146
- "x-read-pretty"?: boolean;
147
- "x-compile-omitted"?: string[];
148
- }>;
41
+ uiSchema?: any;
149
42
  target?: string;
150
43
  key: string;
151
44
  value: string;
@@ -155,4 +48,6 @@ export declare const useFormatters: (fields: FieldOption[]) => (field: any) => v
155
48
  export declare const useCollectionOptions: () => any;
156
49
  export declare const useOrderFieldsOptions: (defaultOptions: any[], fields: FieldOption[]) => (field: any) => void;
157
50
  export declare const useOrderReaction: (defaultOptions: any[], fields: FieldOption[]) => (field: ArrayField) => void;
158
- export declare const useData: (data?: any[], collection?: string) => {}[];
51
+ export declare const useData: (data?: any[], dataSource?: string, collection?: string) => {}[];
52
+ export declare const useCollectionFieldsOptions: (dataSource: string, collectionName: string, maxDepth?: number, excludes?: any[]) => any[];
53
+ export declare const useCollectionFilterOptions: (dataSource: string, collection: string) => any[];