@nocobase/plugin-data-visualization 0.11.1-alpha.5 → 0.12.0-alpha.2
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/client.d.ts +2 -2
- package/client.js +1 -1
- package/dist/client/chart/antd/antd.d.ts +7 -0
- package/dist/client/chart/antd/index.d.ts +4 -0
- package/dist/client/chart/antd/statistic.d.ts +19 -0
- package/dist/client/chart/antd/table.d.ts +6 -0
- package/dist/client/chart/chart.d.ts +65 -0
- package/dist/client/chart/g2plot/bar.d.ts +16 -0
- package/dist/client/chart/g2plot/dualAxes.d.ts +20 -0
- package/dist/client/chart/g2plot/g2plot.d.ts +19 -0
- package/dist/client/chart/g2plot/index.d.ts +6 -0
- package/dist/client/chart/g2plot/pie.d.ts +17 -0
- package/dist/client/chart/library.d.ts +28 -0
- package/{lib → dist}/client/hooks.d.ts +22 -154
- package/{lib → dist}/client/index.d.ts +3 -1
- package/dist/client/index.js +67448 -0
- package/{lib → dist}/client/renderer/ChartRendererProvider.d.ts +1 -8
- package/{lib → dist}/client/renderer/index.d.ts +0 -2
- package/{lib → dist}/client/utils.d.ts +1 -1
- package/{lib → dist}/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/locale/en-US.js +26 -0
- package/dist/locale/fr-FR.js +5 -0
- package/dist/locale/ja-JP.js +5 -0
- package/dist/locale/pt-BR.js +26 -0
- package/dist/locale/ru-RU.js +5 -0
- package/dist/locale/tr-TR.js +5 -0
- package/dist/locale/zh-CN.js +74 -0
- package/dist/server/actions/formatter.js +41 -0
- package/{src/server/actions/query.ts → dist/server/actions/query.js} +75 -133
- package/dist/server/index.js +11 -0
- package/dist/server/plugin.js +42 -0
- package/package.json +23 -22
- package/server.d.ts +2 -2
- package/server.js +1 -1
- package/lib/client/Settings.js +0 -81
- package/lib/client/block/ChartBlock.js +0 -74
- package/lib/client/block/ChartBlockDesigner.js +0 -35
- package/lib/client/block/ChartBlockInitializer.js +0 -114
- package/lib/client/block/ChartConfigure.js +0 -499
- package/lib/client/block/formatters.js +0 -58
- package/lib/client/block/index.js +0 -49
- package/lib/client/block/schemas/configure.js +0 -517
- package/lib/client/block/transformers.js +0 -68
- package/lib/client/hooks.js +0 -275
- package/lib/client/index.js +0 -80
- package/lib/client/locale/index.js +0 -37
- package/lib/client/renderer/ChartLibrary.d.ts +0 -72
- package/lib/client/renderer/ChartLibrary.js +0 -146
- package/lib/client/renderer/ChartRenderer.js +0 -181
- package/lib/client/renderer/ChartRendererProvider.js +0 -105
- package/lib/client/renderer/index.js +0 -49
- package/lib/client/renderer/library/AntdLibrary.d.ts +0 -2
- package/lib/client/renderer/library/AntdLibrary.js +0 -123
- package/lib/client/renderer/library/G2PlotLibrary.d.ts +0 -2
- package/lib/client/renderer/library/G2PlotLibrary.js +0 -288
- package/lib/client/renderer/library/index.d.ts +0 -3
- package/lib/client/renderer/library/index.js +0 -15
- package/lib/client/utils.js +0 -137
- package/lib/index.js +0 -13
- package/lib/locale/en-US.js +0 -29
- package/lib/locale/fr-FR.js +0 -8
- package/lib/locale/ja-JP.js +0 -8
- package/lib/locale/pt-BR.js +0 -29
- package/lib/locale/ru-RU.js +0 -8
- package/lib/locale/tr-TR.js +0 -8
- package/lib/locale/zh-CN.js +0 -77
- package/lib/server/actions/formatter.js +0 -44
- package/lib/server/actions/query.js +0 -331
- package/lib/server/index.js +0 -13
- package/lib/server/plugin.js +0 -64
- package/src/client/Settings.tsx +0 -43
- package/src/client/__tests__/chart-configure.test.tsx +0 -14
- package/src/client/__tests__/chart-library.test.ts +0 -78
- package/src/client/__tests__/chart-renderer.test.tsx +0 -30
- package/src/client/__tests__/hooks.test.ts +0 -261
- package/src/client/block/ChartBlock.tsx +0 -24
- package/src/client/block/ChartBlockDesigner.tsx +0 -19
- package/src/client/block/ChartBlockInitializer.tsx +0 -82
- package/src/client/block/ChartConfigure.tsx +0 -446
- package/src/client/block/formatters.ts +0 -70
- package/src/client/block/index.ts +0 -4
- package/src/client/block/schemas/configure.ts +0 -504
- package/src/client/block/transformers.ts +0 -52
- package/src/client/hooks.ts +0 -239
- package/src/client/index.tsx +0 -47
- package/src/client/locale/index.ts +0 -18
- package/src/client/renderer/ChartLibrary.tsx +0 -183
- package/src/client/renderer/ChartRenderer.tsx +0 -129
- package/src/client/renderer/ChartRendererProvider.tsx +0 -123
- package/src/client/renderer/index.ts +0 -4
- package/src/client/renderer/library/AntdLibrary.tsx +0 -94
- package/src/client/renderer/library/G2PlotLibrary.tsx +0 -236
- package/src/client/renderer/library/index.tsx +0 -4
- package/src/client/utils.ts +0 -102
- package/src/index.ts +0 -1
- package/src/locale/en-US.ts +0 -23
- package/src/locale/fr-FR.ts +0 -1
- package/src/locale/ja-JP.ts +0 -1
- package/src/locale/pt-BR.ts +0 -23
- package/src/locale/ru-RU.ts +0 -1
- package/src/locale/tr-TR.ts +0 -1
- package/src/locale/zh-CN.ts +0 -72
- package/src/server/__tests__/api.test.ts +0 -102
- package/src/server/__tests__/formatter.test.ts +0 -49
- package/src/server/__tests__/query.test.ts +0 -220
- package/src/server/actions/formatter.ts +0 -49
- package/src/server/collections/.gitkeep +0 -0
- package/src/server/index.ts +0 -1
- package/src/server/plugin.ts +0 -37
- /package/{lib → dist}/client/Settings.d.ts +0 -0
- /package/{lib → dist}/client/block/ChartBlock.d.ts +0 -0
- /package/{lib → dist}/client/block/ChartBlockDesigner.d.ts +0 -0
- /package/{lib → dist}/client/block/ChartBlockInitializer.d.ts +0 -0
- /package/{lib → dist}/client/block/ChartConfigure.d.ts +0 -0
- /package/{lib → dist}/client/block/formatters.d.ts +0 -0
- /package/{lib → dist}/client/block/index.d.ts +0 -0
- /package/{lib → dist}/client/block/schemas/configure.d.ts +0 -0
- /package/{lib → dist}/client/block/transformers.d.ts +0 -0
- /package/{lib → dist}/client/locale/index.d.ts +0 -0
- /package/{lib → dist}/client/renderer/ChartRenderer.d.ts +0 -0
- /package/{lib → dist}/locale/en-US.d.ts +0 -0
- /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
- /package/{lib → dist}/locale/ja-JP.d.ts +0 -0
- /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
- /package/{lib → dist}/locale/ru-RU.d.ts +0 -0
- /package/{lib → dist}/locale/tr-TR.d.ts +0 -0
- /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
- /package/{lib → dist}/server/actions/formatter.d.ts +0 -0
- /package/{lib → dist}/server/actions/query.d.ts +0 -0
- /package/{lib → dist}/server/index.d.ts +0 -0
- /package/{lib → dist}/server/plugin.d.ts +0 -0
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import * as client from '@nocobase/client';
|
|
2
|
-
import { renderHook } from '@testing-library/react';
|
|
3
|
-
import { vi } from 'vitest';
|
|
4
|
-
import formatters from '../block/formatters';
|
|
5
|
-
import transformers from '../block/transformers';
|
|
6
|
-
import {
|
|
7
|
-
useChartFields,
|
|
8
|
-
useFieldsWithAssociation,
|
|
9
|
-
useFieldTransformer,
|
|
10
|
-
useFieldTypes,
|
|
11
|
-
useFormatters,
|
|
12
|
-
useOrderFieldsOptions,
|
|
13
|
-
useTransformers,
|
|
14
|
-
} from '../hooks';
|
|
15
|
-
|
|
16
|
-
describe('hooks', () => {
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
vi.spyOn(client, 'useCollectionManager').mockReturnValue({
|
|
19
|
-
getCollectionFields: (name: string) =>
|
|
20
|
-
({
|
|
21
|
-
orders: [
|
|
22
|
-
{
|
|
23
|
-
interface: 'string',
|
|
24
|
-
name: 'name',
|
|
25
|
-
uiSchema: {
|
|
26
|
-
title: '{{t("Name")}}',
|
|
27
|
-
},
|
|
28
|
-
type: 'string',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
interface: 'number',
|
|
32
|
-
name: 'price',
|
|
33
|
-
uiSchema: {
|
|
34
|
-
title: '{{t("Price")}}',
|
|
35
|
-
},
|
|
36
|
-
type: 'double',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
interface: 'createdAt',
|
|
40
|
-
name: 'createdAt',
|
|
41
|
-
uiSchema: {
|
|
42
|
-
title: '{{t("Created At")}}',
|
|
43
|
-
},
|
|
44
|
-
type: 'date',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
interface: 'm2o',
|
|
48
|
-
name: 'user',
|
|
49
|
-
uiSchema: {
|
|
50
|
-
title: '{{t("User")}}',
|
|
51
|
-
},
|
|
52
|
-
target: 'users',
|
|
53
|
-
type: 'belongsTo',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
users: [
|
|
57
|
-
{
|
|
58
|
-
interface: 'string',
|
|
59
|
-
name: 'name',
|
|
60
|
-
uiSchema: {
|
|
61
|
-
title: '{{t("Name")}}',
|
|
62
|
-
},
|
|
63
|
-
type: 'string',
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
}[name]),
|
|
67
|
-
} as any);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
afterEach(() => {
|
|
71
|
-
vi.restoreAllMocks();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('useFieldsWithAssociation', () => {
|
|
75
|
-
const { result } = renderHook(() => useFieldsWithAssociation('orders'));
|
|
76
|
-
expect(result.current).toMatchObject([
|
|
77
|
-
{
|
|
78
|
-
key: 'name',
|
|
79
|
-
label: 'Name',
|
|
80
|
-
value: 'name',
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
key: 'price',
|
|
84
|
-
label: 'Price',
|
|
85
|
-
value: 'price',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
key: 'createdAt',
|
|
89
|
-
label: 'Created At',
|
|
90
|
-
value: 'createdAt',
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
key: 'user',
|
|
94
|
-
label: 'User',
|
|
95
|
-
value: 'user',
|
|
96
|
-
target: 'users',
|
|
97
|
-
targetFields: [
|
|
98
|
-
{
|
|
99
|
-
key: 'user.name',
|
|
100
|
-
label: 'User / Name',
|
|
101
|
-
value: 'user.name',
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
},
|
|
105
|
-
]);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test('useChartFields', () => {
|
|
109
|
-
const fields = renderHook(() => useFieldsWithAssociation('orders')).result.current;
|
|
110
|
-
const { result } = renderHook(() => useChartFields(fields));
|
|
111
|
-
const func = result.current;
|
|
112
|
-
const field = {
|
|
113
|
-
query: () => ({
|
|
114
|
-
get: () => ({
|
|
115
|
-
measures: [
|
|
116
|
-
{
|
|
117
|
-
field: ['price'],
|
|
118
|
-
alias: 'Price Alias',
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
dimensions: [
|
|
122
|
-
{
|
|
123
|
-
field: ['user', 'name'],
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
}),
|
|
127
|
-
}),
|
|
128
|
-
dataSource: [],
|
|
129
|
-
};
|
|
130
|
-
func(field);
|
|
131
|
-
expect(field.dataSource).toMatchObject([
|
|
132
|
-
{
|
|
133
|
-
key: 'Price Alias',
|
|
134
|
-
label: 'Price Alias',
|
|
135
|
-
value: 'Price Alias',
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
key: 'user.name',
|
|
139
|
-
label: 'User / Name',
|
|
140
|
-
value: 'user.name',
|
|
141
|
-
},
|
|
142
|
-
]);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
test('useFormatters', () => {
|
|
146
|
-
const fields = renderHook(() => useFieldsWithAssociation('orders')).result.current;
|
|
147
|
-
const { result } = renderHook(() => useFormatters(fields));
|
|
148
|
-
const func = result.current;
|
|
149
|
-
const field = {
|
|
150
|
-
query: () => ({
|
|
151
|
-
get: () => 'createdAt',
|
|
152
|
-
}),
|
|
153
|
-
dataSource: [],
|
|
154
|
-
};
|
|
155
|
-
func(field);
|
|
156
|
-
expect(field.dataSource).toEqual(formatters.datetime);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test('useFieldTypes', () => {
|
|
160
|
-
const fields = renderHook(() => useFieldsWithAssociation('orders')).result.current;
|
|
161
|
-
const { result } = renderHook(() => useFieldTypes(fields));
|
|
162
|
-
const func = result.current;
|
|
163
|
-
let state1 = {};
|
|
164
|
-
let state2 = {};
|
|
165
|
-
const field = {
|
|
166
|
-
dataSource: [],
|
|
167
|
-
state: {},
|
|
168
|
-
};
|
|
169
|
-
const query = (path: string, val: string) => ({
|
|
170
|
-
get: () => {
|
|
171
|
-
if (path === 'query') {
|
|
172
|
-
return { measures: [{ field: ['price'] }, { field: ['name'] }] };
|
|
173
|
-
}
|
|
174
|
-
return val;
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
const field1 = {
|
|
178
|
-
query: (path: string) => query(path, 'price'),
|
|
179
|
-
setState: (state) => (state1 = state),
|
|
180
|
-
...field,
|
|
181
|
-
};
|
|
182
|
-
const field2 = {
|
|
183
|
-
query: (path: string) => query(path, 'name'),
|
|
184
|
-
setState: (state) => (state2 = state),
|
|
185
|
-
...field,
|
|
186
|
-
};
|
|
187
|
-
func(field1);
|
|
188
|
-
func(field2);
|
|
189
|
-
expect(field1.dataSource.map((item) => item.value)).toEqual(Object.keys(transformers));
|
|
190
|
-
expect(state1).toEqual({ value: 'number', disabled: true });
|
|
191
|
-
expect(state2).toEqual({ value: null, disabled: false });
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
test('useTransformers', () => {
|
|
195
|
-
const field = {
|
|
196
|
-
query: () => ({
|
|
197
|
-
get: () => 'datetime',
|
|
198
|
-
}),
|
|
199
|
-
dataSource: [],
|
|
200
|
-
};
|
|
201
|
-
renderHook(() => useTransformers(field));
|
|
202
|
-
expect(field.dataSource.map((item) => item.value)).toEqual(Object.keys(transformers['datetime']));
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
test('useFieldTransformers', () => {
|
|
206
|
-
const { result } = renderHook(() =>
|
|
207
|
-
useFieldTransformer([
|
|
208
|
-
{
|
|
209
|
-
field: '1',
|
|
210
|
-
type: 'datetime',
|
|
211
|
-
format: 'YYYY',
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
field: '2',
|
|
215
|
-
type: 'number',
|
|
216
|
-
format: 'YYYY',
|
|
217
|
-
},
|
|
218
|
-
]),
|
|
219
|
-
);
|
|
220
|
-
expect(result.current['1']).toBeDefined();
|
|
221
|
-
expect(result.current['2']).toBeUndefined();
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
test('useOrderFieldsOptions', () => {
|
|
225
|
-
const fields = renderHook(() => useFieldsWithAssociation('orders')).result.current;
|
|
226
|
-
const { result } = renderHook(() => useOrderFieldsOptions([], fields));
|
|
227
|
-
const func = result.current;
|
|
228
|
-
const field1 = {
|
|
229
|
-
query: () => ({
|
|
230
|
-
get: () => ({
|
|
231
|
-
measures: [{ field: ['price'] }],
|
|
232
|
-
}),
|
|
233
|
-
}),
|
|
234
|
-
dataSource: [],
|
|
235
|
-
componentProps: {
|
|
236
|
-
fieldNames: {},
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
const field2 = {
|
|
240
|
-
query: () => ({
|
|
241
|
-
get: () => ({
|
|
242
|
-
measures: [{ field: ['price'], aggregation: 'sum' }],
|
|
243
|
-
}),
|
|
244
|
-
}),
|
|
245
|
-
componentProps: {
|
|
246
|
-
fieldNames: {},
|
|
247
|
-
},
|
|
248
|
-
dataSource: [],
|
|
249
|
-
};
|
|
250
|
-
func(field1);
|
|
251
|
-
func(field2);
|
|
252
|
-
expect(field1.dataSource).toEqual([]);
|
|
253
|
-
expect(field1.componentProps.fieldNames).toEqual({
|
|
254
|
-
label: 'title',
|
|
255
|
-
value: 'name',
|
|
256
|
-
children: 'children',
|
|
257
|
-
});
|
|
258
|
-
expect(field2.dataSource).toMatchObject([{ key: 'price', value: 'price', label: 'Price' }]);
|
|
259
|
-
expect(field2.componentProps.fieldNames).toEqual({});
|
|
260
|
-
});
|
|
261
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { SchemaInitializerButtonContext, useDesignable } from '@nocobase/client';
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import { ChartRendererProvider } from '../renderer';
|
|
4
|
-
import { ChartConfigContext, ChartConfigCurrent, ChartConfigure } from './ChartConfigure';
|
|
5
|
-
|
|
6
|
-
export const ChartV2Block: React.FC = (props) => {
|
|
7
|
-
const { insertAdjacent } = useDesignable();
|
|
8
|
-
const [visible, setVisible] = useState(false);
|
|
9
|
-
const [current, setCurrent] = useState<ChartConfigCurrent>({} as any);
|
|
10
|
-
const [initialVisible, setInitialVisible] = useState(false);
|
|
11
|
-
const [searchValue, setSearchValue] = useState('');
|
|
12
|
-
return (
|
|
13
|
-
<SchemaInitializerButtonContext.Provider
|
|
14
|
-
value={{ visible: initialVisible, setVisible: setInitialVisible, searchValue, setSearchValue }}
|
|
15
|
-
>
|
|
16
|
-
<ChartConfigContext.Provider value={{ visible, setVisible, current, setCurrent }}>
|
|
17
|
-
{props.children}
|
|
18
|
-
<ChartRendererProvider {...current.field?.decoratorProps}>
|
|
19
|
-
<ChartConfigure insert={(schema, options) => insertAdjacent('beforeEnd', schema, options)} />
|
|
20
|
-
</ChartRendererProvider>
|
|
21
|
-
</ChartConfigContext.Provider>
|
|
22
|
-
</SchemaInitializerButtonContext.Provider>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { GeneralSchemaDesigner, SchemaSettings } from '@nocobase/client';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { useChartsTranslation } from '../locale';
|
|
4
|
-
|
|
5
|
-
export const ChartV2BlockDesigner: React.FC = () => {
|
|
6
|
-
const { t } = useChartsTranslation();
|
|
7
|
-
return (
|
|
8
|
-
<GeneralSchemaDesigner title={t('Charts')}>
|
|
9
|
-
<SchemaSettings.BlockTitleItem />
|
|
10
|
-
<SchemaSettings.Divider />
|
|
11
|
-
<SchemaSettings.Remove
|
|
12
|
-
removeParentsIfNoChildren
|
|
13
|
-
breakRemoveOn={{
|
|
14
|
-
'x-component': 'Grid',
|
|
15
|
-
}}
|
|
16
|
-
/>
|
|
17
|
-
</GeneralSchemaDesigner>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { LineChartOutlined } from '@ant-design/icons';
|
|
2
|
-
import { ISchema } from '@formily/react';
|
|
3
|
-
import { uid } from '@formily/shared';
|
|
4
|
-
import { SchemaInitializer, useACLRoleContext, useCollectionDataSourceItems } from '@nocobase/client';
|
|
5
|
-
import React, { useContext } from 'react';
|
|
6
|
-
import { useChartsTranslation } from '../locale';
|
|
7
|
-
import { ChartConfigContext } from './ChartConfigure';
|
|
8
|
-
|
|
9
|
-
const itemWrap = SchemaInitializer.itemWrap;
|
|
10
|
-
const ConfigureButton = itemWrap((props) => {
|
|
11
|
-
const { setVisible, setCurrent } = useContext(ChartConfigContext);
|
|
12
|
-
return (
|
|
13
|
-
<SchemaInitializer.Item
|
|
14
|
-
{...props}
|
|
15
|
-
onClick={() => {
|
|
16
|
-
setCurrent({ schema: {}, field: null, collection: props.item?.name, service: null, data: undefined });
|
|
17
|
-
setVisible(true);
|
|
18
|
-
}}
|
|
19
|
-
/>
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export const ChartInitializers = () => {
|
|
24
|
-
const { t } = useChartsTranslation();
|
|
25
|
-
const collections = useCollectionDataSourceItems('Chart');
|
|
26
|
-
const { allowAll, parseAction } = useACLRoleContext();
|
|
27
|
-
const children = collections[0].children
|
|
28
|
-
.filter((item) => {
|
|
29
|
-
if (allowAll) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
const params = parseAction(`${item.name}:list`);
|
|
33
|
-
return params;
|
|
34
|
-
})
|
|
35
|
-
.map((item) => ({
|
|
36
|
-
...item,
|
|
37
|
-
component: ConfigureButton,
|
|
38
|
-
}));
|
|
39
|
-
if (!children.length) {
|
|
40
|
-
// Leave a blank item to show the filter component
|
|
41
|
-
children.push({} as any);
|
|
42
|
-
}
|
|
43
|
-
collections[0].children = children;
|
|
44
|
-
return (
|
|
45
|
-
<SchemaInitializer.Button
|
|
46
|
-
icon={'PlusOutlined'}
|
|
47
|
-
items={collections as any}
|
|
48
|
-
dropdown={{
|
|
49
|
-
placement: 'bottomLeft',
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
{t('Add chart')}
|
|
53
|
-
</SchemaInitializer.Button>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const ChartV2BlockInitializer: React.FC<{
|
|
58
|
-
insert: (s: ISchema) => void;
|
|
59
|
-
}> = (props) => {
|
|
60
|
-
const { insert } = props;
|
|
61
|
-
return (
|
|
62
|
-
<SchemaInitializer.Item
|
|
63
|
-
{...props}
|
|
64
|
-
icon={<LineChartOutlined />}
|
|
65
|
-
onClick={() => {
|
|
66
|
-
insert({
|
|
67
|
-
type: 'void',
|
|
68
|
-
'x-component': 'CardItem',
|
|
69
|
-
'x-designer': 'ChartV2BlockDesigner',
|
|
70
|
-
properties: {
|
|
71
|
-
[uid()]: {
|
|
72
|
-
type: 'void',
|
|
73
|
-
'x-component': 'Grid',
|
|
74
|
-
'x-decorator': 'ChartV2Block',
|
|
75
|
-
'x-initializer': 'ChartInitializers',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
}}
|
|
80
|
-
/>
|
|
81
|
-
);
|
|
82
|
-
};
|