@nocobase/plugin-data-visualization 2.0.0-alpha.5 → 2.0.0-alpha.51

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.
Files changed (45) hide show
  1. package/dist/client/2ba6e739852f8f86.js +10 -0
  2. package/dist/client/8795975cb8946be4.js +10 -0
  3. package/dist/client/924c5f5607998e1c.js +10 -0
  4. package/dist/client/eeeb04a24ff7f522.js +47 -0
  5. package/dist/client/flow/components/AntdFilterSelector.d.ts +35 -0
  6. package/dist/client/flow/{models/ChartPreviewer.d.ts → components/DaraButton.d.ts} +5 -1
  7. package/dist/client/flow/models/ChartBlockModel.d.ts +18 -19
  8. package/dist/client/flow/models/ChartOptionsBuilder.d.ts +3 -5
  9. package/dist/client/flow/models/ChartOptionsBuilder.service.d.ts +45 -3
  10. package/dist/client/flow/models/ChartOptionsPanel.d.ts +1 -0
  11. package/dist/client/flow/models/{ChartEventsEditor.d.ts → EventsEditor.d.ts} +2 -1
  12. package/dist/client/flow/models/QueryBuilder.d.ts +7 -1
  13. package/dist/client/flow/models/QueryBuilder.service.d.ts +19 -0
  14. package/dist/client/flow/resources/ChartResource.d.ts +1 -4
  15. package/dist/client/flow/utils.d.ts +4 -0
  16. package/dist/client/index.js +1 -1
  17. package/dist/client/utils.d.ts +11 -11
  18. package/dist/externalVersion.js +10 -9
  19. package/dist/locale/de-DE.json +122 -79
  20. package/dist/locale/en-US.json +122 -86
  21. package/dist/locale/es-ES.json +145 -0
  22. package/dist/locale/fr-FR.json +145 -0
  23. package/dist/locale/hu-HU.json +145 -0
  24. package/dist/locale/id-ID.json +145 -0
  25. package/dist/locale/it-IT.json +122 -79
  26. package/dist/locale/ja-JP.json +130 -78
  27. package/dist/locale/ko-KR.json +140 -70
  28. package/dist/locale/nl-NL.json +149 -99
  29. package/dist/locale/pt-BR.json +145 -0
  30. package/dist/locale/ru-RU.json +145 -0
  31. package/dist/locale/tr-TR.json +145 -0
  32. package/dist/locale/uk-UA.json +145 -0
  33. package/dist/locale/vi-VN.json +145 -0
  34. package/dist/locale/zh-CN.json +122 -87
  35. package/dist/locale/zh-TW.json +145 -0
  36. package/dist/node_modules/koa-compose/package.json +1 -1
  37. package/dist/node_modules/moment-timezone/package.json +1 -1
  38. package/dist/server/actions/query.js +20 -2
  39. package/package.json +5 -2
  40. package/dist/client/33f0f13fb9c8b63c.js +0 -10
  41. package/dist/client/b60420c7da874e70.js +0 -47
  42. package/dist/client/d5982ab2df5b1822.js +0 -10
  43. package/dist/client/e5eee84a69b5014e.js +0 -10
  44. package/dist/client/flow/models/FormItemLite.d.ts +0 -13
  45. package/dist/client/flow/models/queryBuilder.logic.d.ts +0 -25
@@ -0,0 +1,35 @@
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 React from 'react';
10
+ import type { CSSProperties } from 'react';
11
+ import type { VariableFilterItemValue } from '@nocobase/client';
12
+ import type { FlowModel } from '@nocobase/flow-engine';
13
+ type LogicOp = '$and' | '$or';
14
+ export type FilterCondition = VariableFilterItemValue;
15
+ export type FilterGroupValue = {
16
+ logic: LogicOp;
17
+ items: Array<FilterCondition | FilterGroupValue>;
18
+ };
19
+ export interface AntdFilterSelectorProps {
20
+ value?: FilterGroupValue;
21
+ onChange?: (next: FilterGroupValue) => void;
22
+ model: FlowModel;
23
+ rightAsVariable?: boolean;
24
+ collectionPath?: string[];
25
+ className?: string;
26
+ style?: CSSProperties;
27
+ }
28
+ /**
29
+ * AntdFilterSelector
30
+ * - antd Form.Item 子组件
31
+ * - 内部用响应式对象驱动 FilterGroup/VariableFilterItem
32
+ * - reaction 桥接所有深层变更为 antd 的 onChange
33
+ */
34
+ export declare const AntdFilterSelector: React.FC<AntdFilterSelectorProps>;
35
+ export default AntdFilterSelector;
@@ -7,4 +7,8 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import React from 'react';
10
- export declare const ChartPreviewer: React.FC;
10
+ import type { FlowSettingsContext } from '@nocobase/flow-engine';
11
+ export declare const DaraButton: React.FC<{
12
+ ctx: FlowSettingsContext<any>;
13
+ }>;
14
+ export default DaraButton;
@@ -6,32 +6,19 @@
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 { DataBlockModel, SubPageModel } from '@nocobase/client';
9
+ import { ChildPageModel, DataBlockModel } from '@nocobase/client';
10
10
  import { SQLResource } from '@nocobase/flow-engine';
11
11
  import React from 'react';
12
12
  import { ChartOptions } from './Chart';
13
13
  import { ChartResource } from '../resources/ChartResource';
14
14
  type ChartBlockModelStructure = {
15
15
  subModels: {
16
- page: SubPageModel;
16
+ page: ChildPageModel;
17
17
  };
18
18
  };
19
19
  type ChartProps = {
20
- query: {
21
- mode: 'builder' | 'sql';
22
- measure?: any;
23
- dimension?: any;
24
- filter?: any;
25
- order?: any;
26
- limit?: any;
27
- offset?: any;
28
- sql?: string;
29
- };
30
20
  chart: ChartOptions & {
31
21
  optionRaw?: string;
32
- mode: 'basic' | 'custom';
33
- builder?: any;
34
- raw?: string;
35
22
  };
36
23
  };
37
24
  export declare class ChartBlockModel extends DataBlockModel<ChartBlockModelStructure> {
@@ -39,9 +26,10 @@ export declare class ChartBlockModel extends DataBlockModel<ChartBlockModelStruc
39
26
  _previousStepParams: any;
40
27
  get resource(): ChartResource<any> | SQLResource<any>;
41
28
  private __onResourceRefresh;
29
+ onActive(): void;
42
30
  initResource(mode?: string): void;
43
31
  getResourceSettingsInitParams(): any;
44
- onInit(options: any): void;
32
+ onInit(options: any): Promise<void>;
45
33
  renderComponent(): React.JSX.Element;
46
34
  getFilterFields(): Promise<{
47
35
  name: string;
@@ -57,8 +45,19 @@ export declare class ChartBlockModel extends DataBlockModel<ChartBlockModelStruc
57
45
  };
58
46
  }[]>;
59
47
  checkResource(query: any): void;
60
- runQueryAndUpdateResult(query: any): Promise<void>;
61
- setParamsAndRerender(params: any): Promise<void>;
62
- cancelAndRerender(): Promise<void>;
48
+ applyQuery(query: any): void;
49
+ setDataResult(): void;
50
+ applyChartOptions(payload: {
51
+ mode: 'basic' | 'custom';
52
+ builder?: any;
53
+ raw?: string;
54
+ }): Promise<void>;
55
+ applyEvents(raw?: string): Promise<void>;
56
+ renderChart(): void;
57
+ onPreview(params: {
58
+ query: any;
59
+ chart: any;
60
+ }, needQueryData?: boolean): Promise<void>;
61
+ cancelPreview(): Promise<void>;
63
62
  }
64
63
  export {};
@@ -8,9 +8,7 @@
8
8
  */
9
9
  import React from 'react';
10
10
  export declare const ChartOptionsBuilder: React.FC<{
11
- columns: string[];
12
- value?: any;
13
- defaultValue?: any;
14
- onChange?: (next: any) => void;
15
- onRawChange?: (raw: string) => void;
11
+ columns?: string[];
12
+ initialValues: any;
13
+ onChange: (next: any) => void;
16
14
  }>;
@@ -6,11 +6,53 @@
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
+ export type ChartTypeKey = 'line' | 'bar' | 'barHorizontal' | 'pie' | 'doughnut' | 'scatter' | 'area' | 'funnel';
10
+ export declare function getChartFormSpec(type: ChartTypeKey): ({
11
+ kind: string;
12
+ name: any;
13
+ labelKey: any;
14
+ options: any;
15
+ required?: undefined;
16
+ allowClear?: undefined;
17
+ placeholderKey?: undefined;
18
+ min?: undefined;
19
+ max?: undefined;
20
+ } | {
21
+ kind: string;
22
+ name: any;
23
+ labelKey: any;
24
+ required: boolean;
25
+ allowClear: boolean;
26
+ placeholderKey: string;
27
+ options?: undefined;
28
+ min?: undefined;
29
+ max?: undefined;
30
+ } | {
31
+ kind: string;
32
+ name: any;
33
+ labelKey: any;
34
+ options?: undefined;
35
+ required?: undefined;
36
+ allowClear?: undefined;
37
+ placeholderKey?: undefined;
38
+ min?: undefined;
39
+ max?: undefined;
40
+ } | {
41
+ kind: string;
42
+ name: any;
43
+ labelKey: any;
44
+ min: any;
45
+ max: any;
46
+ options?: undefined;
47
+ required?: undefined;
48
+ allowClear?: undefined;
49
+ placeholderKey?: undefined;
50
+ })[];
9
51
  export declare function buildFieldOptions(columns?: string[]): {
10
52
  label: string;
11
53
  value: string;
12
54
  }[];
13
- export declare function stripInvalidColumns(builder?: any, columns?: string[]): any;
14
- export declare function normalizeBuilder(builder?: any, columns?: string[]): any;
15
- export declare function applyTypeChange(builder: any, nextType: 'line' | 'bar' | 'pie', columns?: string[]): any;
55
+ export declare function stripInvalidColumns(builder?: {}, columns?: string[]): any;
56
+ export declare function normalizeBuilder(builder: any, columns?: string[]): any;
57
+ export declare function applyTypeChange(builder: {}, nextType: ChartTypeKey, columns?: string[]): any;
16
58
  export declare function genRawByBuilder(builder: any): string;
@@ -7,4 +7,5 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import React from 'react';
10
+ export declare const chartOptionDefaultValue = "return {\n dataset: { source: ctx.data.objects || [] },\n xAxis: { type: 'category' },\n yAxis: {},\n series: [\n {\n type: 'line',\n smooth: true,\n showSymbol: false,\n },\n ],\n}\n";
10
11
  export declare const ChartOptionsPanel: React.FC;
@@ -7,4 +7,5 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  /// <reference types="react" />
10
- export declare const ChartEventsEditor: import("react").ForwardRefExoticComponent<Omit<Partial<import("../components/CodeEditor").CodeEditorProps & import("react").RefAttributes<import("../components/CodeEditor").CodeEditorHandle>>, "ref"> & import("react").RefAttributes<unknown>>;
10
+ declare const EventsEditor: import("react").ForwardRefExoticComponent<Omit<Partial<import("../components/CodeEditor").CodeEditorProps & import("react").RefAttributes<import("../components/CodeEditor").CodeEditorHandle>>, "ref"> & import("react").RefAttributes<unknown>>;
11
+ export default EventsEditor;
@@ -7,4 +7,10 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import React from 'react';
10
- export declare const QueryBuilder: React.FC;
10
+ export type QueryBuilderRef = {
11
+ validate: () => Promise<any>;
12
+ };
13
+ export declare const QueryBuilder: React.ForwardRefExoticComponent<{
14
+ initialValues?: any;
15
+ onChange?: (v: any) => void;
16
+ } & React.RefAttributes<QueryBuilderRef>>;
@@ -0,0 +1,19 @@
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 getFieldOptions(dm: any, compile: (v: any) => string, collectionPath?: string[]): any;
10
+ export declare function aliasOf(val: any): string;
11
+ export declare function getFormatterOptionsByField(dm: any, collectionPath: string[] | undefined, dimField: any): {
12
+ label: string;
13
+ value: string;
14
+ }[];
15
+ export declare function getCollectionOptions(dm: any, compile: (v: any) => string): any;
16
+ export declare function validateQuery(query: Record<string, any>): {
17
+ success: boolean;
18
+ message: string;
19
+ };
@@ -19,10 +19,6 @@ export declare class ChartResource<TData = any> extends BaseRecordResource<TData
19
19
  };
20
20
  setQueryParams(query: Record<string, any>, mark?: string): this;
21
21
  setFilter(filter: Record<string, any>): this;
22
- validateQuery(query: Record<string, any>): {
23
- success: boolean;
24
- message: string;
25
- };
26
22
  parseQuery(query: Record<string, any>): {
27
23
  mode: any;
28
24
  sql: any;
@@ -31,6 +27,7 @@ export declare class ChartResource<TData = any> extends BaseRecordResource<TData
31
27
  measures: any;
32
28
  dimensions: any;
33
29
  filter: any;
30
+ orders: any;
34
31
  limit: any;
35
32
  offset: any;
36
33
  };
@@ -31,3 +31,7 @@ export declare const formatters: {
31
31
  value: string;
32
32
  }[];
33
33
  };
34
+ export declare function sleep(ms: number): Promise<void>;
35
+ export declare function appendColon(label: string, lang?: string): string;
36
+ export declare const isDebugEnabled: () => boolean;
37
+ export declare const debugLog: (...args: any[]) => void;