@nocobase/plugin-data-visualization 0.10.1-alpha.1
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/LICENSE +661 -0
- package/README.md +88 -0
- package/client.d.ts +3 -0
- package/client.js +65 -0
- package/lib/client/Settings.d.ts +2 -0
- package/lib/client/Settings.js +81 -0
- package/lib/client/block/ChartBlock.d.ts +2 -0
- package/lib/client/block/ChartBlock.js +73 -0
- package/lib/client/block/ChartBlockDesigner.d.ts +2 -0
- package/lib/client/block/ChartBlockDesigner.js +35 -0
- package/lib/client/block/ChartBlockInitializer.d.ts +6 -0
- package/lib/client/block/ChartBlockInitializer.js +114 -0
- package/lib/client/block/ChartConfigure.d.ts +33 -0
- package/lib/client/block/ChartConfigure.js +501 -0
- package/lib/client/block/formatters.d.ts +15 -0
- package/lib/client/block/formatters.js +58 -0
- package/lib/client/block/index.d.ts +4 -0
- package/lib/client/block/index.js +49 -0
- package/lib/client/block/schemas/configure.d.ts +4 -0
- package/lib/client/block/schemas/configure.js +492 -0
- package/lib/client/block/transformers.d.ts +6 -0
- package/lib/client/block/transformers.js +69 -0
- package/lib/client/hooks.d.ts +312 -0
- package/lib/client/hooks.js +275 -0
- package/lib/client/index.d.ts +5 -0
- package/lib/client/index.js +70 -0
- package/lib/client/locale/en-US.d.ts +23 -0
- package/lib/client/locale/en-US.js +29 -0
- package/lib/client/locale/index.d.ts +3 -0
- package/lib/client/locale/index.js +39 -0
- package/lib/client/locale/ja-JP.d.ts +2 -0
- package/lib/client/locale/ja-JP.js +8 -0
- package/lib/client/locale/pt-BR.d.ts +23 -0
- package/lib/client/locale/pt-BR.js +29 -0
- package/lib/client/locale/ru-RU.d.ts +2 -0
- package/lib/client/locale/ru-RU.js +8 -0
- package/lib/client/locale/tr-TR.d.ts +2 -0
- package/lib/client/locale/tr-TR.js +8 -0
- package/lib/client/locale/zh-CN.d.ts +70 -0
- package/lib/client/locale/zh-CN.js +76 -0
- package/lib/client/renderer/ChartLibrary.d.ts +71 -0
- package/lib/client/renderer/ChartLibrary.js +140 -0
- package/lib/client/renderer/ChartRenderer.d.ts +7 -0
- package/lib/client/renderer/ChartRenderer.js +258 -0
- package/lib/client/renderer/ChartRendererProvider.d.ts +43 -0
- package/lib/client/renderer/ChartRendererProvider.js +38 -0
- package/lib/client/renderer/index.d.ts +4 -0
- package/lib/client/renderer/index.js +49 -0
- package/lib/client/renderer/library/AntdLibrary.d.ts +2 -0
- package/lib/client/renderer/library/AntdLibrary.js +123 -0
- package/lib/client/renderer/library/G2PlotLibrary.d.ts +2 -0
- package/lib/client/renderer/library/G2PlotLibrary.js +288 -0
- package/lib/client/renderer/library/index.d.ts +3 -0
- package/lib/client/renderer/library/index.js +15 -0
- package/lib/client/utils.d.ts +96 -0
- package/lib/client/utils.js +137 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +13 -0
- package/lib/server/actions/formatter.d.ts +3 -0
- package/lib/server/actions/formatter.js +44 -0
- package/lib/server/actions/query.d.ts +86 -0
- package/lib/server/actions/query.js +326 -0
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +13 -0
- package/lib/server/plugin.d.ts +13 -0
- package/lib/server/plugin.js +64 -0
- package/package.json +23 -0
- package/server.d.ts +3 -0
- package/server.js +65 -0
- package/src/client/Settings.tsx +43 -0
- package/src/client/__tests__/chart-configure.test.tsx +14 -0
- package/src/client/__tests__/chart-library.test.ts +78 -0
- package/src/client/__tests__/chart-renderer.test.tsx +30 -0
- package/src/client/__tests__/hooks.test.ts +261 -0
- package/src/client/block/ChartBlock.tsx +22 -0
- package/src/client/block/ChartBlockDesigner.tsx +19 -0
- package/src/client/block/ChartBlockInitializer.tsx +83 -0
- package/src/client/block/ChartConfigure.tsx +450 -0
- package/src/client/block/formatters.ts +70 -0
- package/src/client/block/index.ts +4 -0
- package/src/client/block/schemas/configure.ts +474 -0
- package/src/client/block/transformers.ts +52 -0
- package/src/client/hooks.ts +239 -0
- package/src/client/index.tsx +41 -0
- package/src/client/locale/en-US.ts +23 -0
- package/src/client/locale/index.ts +19 -0
- package/src/client/locale/ja-JP.ts +1 -0
- package/src/client/locale/pt-BR.ts +23 -0
- package/src/client/locale/ru-RU.ts +1 -0
- package/src/client/locale/tr-TR.ts +1 -0
- package/src/client/locale/zh-CN.ts +71 -0
- package/src/client/renderer/ChartLibrary.tsx +178 -0
- package/src/client/renderer/ChartRenderer.tsx +201 -0
- package/src/client/renderer/ChartRendererProvider.tsx +58 -0
- package/src/client/renderer/index.ts +4 -0
- package/src/client/renderer/library/AntdLibrary.tsx +94 -0
- package/src/client/renderer/library/G2PlotLibrary.tsx +236 -0
- package/src/client/renderer/library/index.tsx +4 -0
- package/src/client/utils.ts +102 -0
- package/src/index.ts +1 -0
- package/src/server/__tests__/api.test.ts +105 -0
- package/src/server/__tests__/formatter.test.ts +49 -0
- package/src/server/__tests__/query.test.ts +220 -0
- package/src/server/actions/formatter.ts +49 -0
- package/src/server/actions/query.ts +285 -0
- package/src/server/collections/.gitkeep +0 -0
- package/src/server/index.ts +1 -0
- package/src/server/plugin.ts +37 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { ArrayField } from '@formily/core';
|
|
2
|
+
import { ISchema } from '@formily/react';
|
|
3
|
+
import { ChartRendererProps } from './renderer';
|
|
4
|
+
export declare type FieldOption = {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
key: string;
|
|
8
|
+
alias?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
interface?: string;
|
|
12
|
+
uiSchema?: ISchema;
|
|
13
|
+
target?: string;
|
|
14
|
+
targetFields?: FieldOption[];
|
|
15
|
+
};
|
|
16
|
+
export declare const useFields: (collection?: string) => {
|
|
17
|
+
key: any;
|
|
18
|
+
label: any;
|
|
19
|
+
value: any;
|
|
20
|
+
name?: any;
|
|
21
|
+
collectionName?: string;
|
|
22
|
+
sourceKey?: string;
|
|
23
|
+
uiSchema?: import("@formily/react").Stringify<{
|
|
24
|
+
[key: symbol]: any;
|
|
25
|
+
[key: `x-${string}`]: any;
|
|
26
|
+
[key: `x-${number}`]: any;
|
|
27
|
+
version?: string;
|
|
28
|
+
name?: import("@formily/react").SchemaKey;
|
|
29
|
+
title?: any;
|
|
30
|
+
description?: any;
|
|
31
|
+
default?: any;
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
writeOnly?: boolean;
|
|
34
|
+
type?: import("@formily/react").SchemaTypes;
|
|
35
|
+
enum?: import("@formily/react").SchemaEnum<any>;
|
|
36
|
+
const?: any;
|
|
37
|
+
multipleOf?: number;
|
|
38
|
+
maximum?: number;
|
|
39
|
+
exclusiveMaximum?: number;
|
|
40
|
+
minimum?: number;
|
|
41
|
+
exclusiveMinimum?: number;
|
|
42
|
+
maxLength?: number;
|
|
43
|
+
minLength?: number;
|
|
44
|
+
pattern?: string | RegExp;
|
|
45
|
+
maxItems?: number;
|
|
46
|
+
minItems?: number;
|
|
47
|
+
uniqueItems?: boolean;
|
|
48
|
+
maxProperties?: number;
|
|
49
|
+
minProperties?: number;
|
|
50
|
+
required?: string | boolean | string[];
|
|
51
|
+
format?: string;
|
|
52
|
+
$ref?: string;
|
|
53
|
+
$namespace?: string; /**
|
|
54
|
+
* useFieldTypes
|
|
55
|
+
* Get field types for using transformers
|
|
56
|
+
* Only supported types will be displayed
|
|
57
|
+
* Some interfaces and types will be mapped to supported types
|
|
58
|
+
*/
|
|
59
|
+
definitions?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
60
|
+
properties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
61
|
+
items?: import("@formily/react").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
62
|
+
additionalItems?: import("@formily/react").Stringify<any>;
|
|
63
|
+
patternProperties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
64
|
+
additionalProperties?: import("@formily/react").Stringify<any>;
|
|
65
|
+
"x-value"?: any;
|
|
66
|
+
"x-index"?: number;
|
|
67
|
+
"x-pattern"?: any;
|
|
68
|
+
"x-display"?: any;
|
|
69
|
+
"x-validator"?: any;
|
|
70
|
+
"x-decorator"?: any;
|
|
71
|
+
"x-decorator-props"?: any;
|
|
72
|
+
"x-component"?: any;
|
|
73
|
+
"x-component-props"?: any;
|
|
74
|
+
"x-reactions"?: import("@formily/react").SchemaReactions<any>;
|
|
75
|
+
"x-content"?: any;
|
|
76
|
+
"x-data"?: any;
|
|
77
|
+
"x-visible"?: boolean;
|
|
78
|
+
"x-hidden"?: boolean;
|
|
79
|
+
"x-disabled"?: boolean;
|
|
80
|
+
"x-editable"?: boolean;
|
|
81
|
+
"x-read-only"?: boolean;
|
|
82
|
+
"x-read-pretty"?: boolean;
|
|
83
|
+
"x-compile-omitted"?: string[];
|
|
84
|
+
}>;
|
|
85
|
+
target?: string;
|
|
86
|
+
}[];
|
|
87
|
+
export declare const useFieldsWithAssociation: (collection?: string) => ({
|
|
88
|
+
label: any;
|
|
89
|
+
key: any;
|
|
90
|
+
value: any;
|
|
91
|
+
name?: any;
|
|
92
|
+
collectionName?: string;
|
|
93
|
+
sourceKey?: string;
|
|
94
|
+
uiSchema?: import("@formily/react").Stringify<{
|
|
95
|
+
[key: symbol]: any;
|
|
96
|
+
[key: `x-${string}`]: any;
|
|
97
|
+
[key: `x-${number}`]: any;
|
|
98
|
+
version?: string;
|
|
99
|
+
name?: import("@formily/react").SchemaKey;
|
|
100
|
+
title?: any;
|
|
101
|
+
description?: any;
|
|
102
|
+
default?: any;
|
|
103
|
+
readOnly?: boolean;
|
|
104
|
+
writeOnly?: boolean;
|
|
105
|
+
type?: import("@formily/react").SchemaTypes;
|
|
106
|
+
enum?: import("@formily/react").SchemaEnum<any>;
|
|
107
|
+
const?: any;
|
|
108
|
+
multipleOf?: number;
|
|
109
|
+
maximum?: number;
|
|
110
|
+
exclusiveMaximum?: number;
|
|
111
|
+
minimum?: number;
|
|
112
|
+
exclusiveMinimum?: number;
|
|
113
|
+
maxLength?: number;
|
|
114
|
+
minLength?: number;
|
|
115
|
+
pattern?: string | RegExp;
|
|
116
|
+
maxItems?: number;
|
|
117
|
+
minItems?: number;
|
|
118
|
+
uniqueItems?: boolean;
|
|
119
|
+
maxProperties?: number;
|
|
120
|
+
minProperties?: number;
|
|
121
|
+
required?: string | boolean | string[];
|
|
122
|
+
format?: string;
|
|
123
|
+
$ref?: string;
|
|
124
|
+
$namespace?: string; /**
|
|
125
|
+
* useFieldTypes
|
|
126
|
+
* Get field types for using transformers
|
|
127
|
+
* Only supported types will be displayed
|
|
128
|
+
* Some interfaces and types will be mapped to supported types
|
|
129
|
+
*/
|
|
130
|
+
definitions?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
131
|
+
properties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
132
|
+
items?: import("@formily/react").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
133
|
+
additionalItems?: import("@formily/react").Stringify<any>;
|
|
134
|
+
patternProperties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
135
|
+
additionalProperties?: import("@formily/react").Stringify<any>;
|
|
136
|
+
"x-value"?: any;
|
|
137
|
+
"x-index"?: number;
|
|
138
|
+
"x-pattern"?: any;
|
|
139
|
+
"x-display"?: any;
|
|
140
|
+
"x-validator"?: any;
|
|
141
|
+
"x-decorator"?: any;
|
|
142
|
+
"x-decorator-props"?: any;
|
|
143
|
+
"x-component"?: any;
|
|
144
|
+
"x-component-props"?: any;
|
|
145
|
+
"x-reactions"?: import("@formily/react").SchemaReactions<any>;
|
|
146
|
+
"x-content"?: any;
|
|
147
|
+
"x-data"?: any;
|
|
148
|
+
"x-visible"?: boolean;
|
|
149
|
+
"x-hidden"?: boolean;
|
|
150
|
+
"x-disabled"?: boolean;
|
|
151
|
+
"x-editable"?: boolean;
|
|
152
|
+
"x-read-only"?: boolean;
|
|
153
|
+
"x-read-pretty"?: boolean;
|
|
154
|
+
"x-compile-omitted"?: string[];
|
|
155
|
+
}>;
|
|
156
|
+
target?: string;
|
|
157
|
+
} | {
|
|
158
|
+
label: any;
|
|
159
|
+
targetFields: {
|
|
160
|
+
key: string;
|
|
161
|
+
label: string;
|
|
162
|
+
value: string;
|
|
163
|
+
name?: any;
|
|
164
|
+
collectionName?: string;
|
|
165
|
+
sourceKey?: string;
|
|
166
|
+
uiSchema?: import("@formily/react").Stringify<{
|
|
167
|
+
[key: symbol]: any;
|
|
168
|
+
[key: `x-${string}`]: any;
|
|
169
|
+
[key: `x-${number}`]: any;
|
|
170
|
+
version?: string;
|
|
171
|
+
name?: import("@formily/react").SchemaKey;
|
|
172
|
+
title?: any;
|
|
173
|
+
description?: any;
|
|
174
|
+
default?: any;
|
|
175
|
+
readOnly?: boolean;
|
|
176
|
+
writeOnly?: boolean;
|
|
177
|
+
type?: import("@formily/react").SchemaTypes;
|
|
178
|
+
enum?: import("@formily/react").SchemaEnum<any>;
|
|
179
|
+
const?: any;
|
|
180
|
+
multipleOf?: number;
|
|
181
|
+
maximum?: number;
|
|
182
|
+
exclusiveMaximum?: number;
|
|
183
|
+
minimum?: number;
|
|
184
|
+
exclusiveMinimum?: number;
|
|
185
|
+
maxLength?: number;
|
|
186
|
+
minLength?: number;
|
|
187
|
+
pattern?: string | RegExp;
|
|
188
|
+
maxItems?: number;
|
|
189
|
+
minItems?: number;
|
|
190
|
+
uniqueItems?: boolean;
|
|
191
|
+
maxProperties?: number;
|
|
192
|
+
minProperties?: number;
|
|
193
|
+
required?: string | boolean | string[];
|
|
194
|
+
format?: string;
|
|
195
|
+
$ref?: string;
|
|
196
|
+
$namespace?: string; /**
|
|
197
|
+
* useFieldTypes
|
|
198
|
+
* Get field types for using transformers
|
|
199
|
+
* Only supported types will be displayed
|
|
200
|
+
* Some interfaces and types will be mapped to supported types
|
|
201
|
+
*/
|
|
202
|
+
definitions?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
203
|
+
properties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
204
|
+
items?: import("@formily/react").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
205
|
+
additionalItems?: import("@formily/react").Stringify<any>;
|
|
206
|
+
patternProperties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
207
|
+
additionalProperties?: import("@formily/react").Stringify<any>;
|
|
208
|
+
"x-value"?: any;
|
|
209
|
+
"x-index"?: number;
|
|
210
|
+
"x-pattern"?: any;
|
|
211
|
+
"x-display"?: any;
|
|
212
|
+
"x-validator"?: any;
|
|
213
|
+
"x-decorator"?: any;
|
|
214
|
+
"x-decorator-props"?: any;
|
|
215
|
+
"x-component"?: any;
|
|
216
|
+
"x-component-props"?: any;
|
|
217
|
+
"x-reactions"?: import("@formily/react").SchemaReactions<any>;
|
|
218
|
+
"x-content"?: any;
|
|
219
|
+
"x-data"?: any;
|
|
220
|
+
"x-visible"?: boolean;
|
|
221
|
+
"x-hidden"?: boolean;
|
|
222
|
+
"x-disabled"?: boolean;
|
|
223
|
+
"x-editable"?: boolean;
|
|
224
|
+
"x-read-only"?: boolean;
|
|
225
|
+
"x-read-pretty"?: boolean;
|
|
226
|
+
"x-compile-omitted"?: string[];
|
|
227
|
+
}>;
|
|
228
|
+
target?: string;
|
|
229
|
+
}[];
|
|
230
|
+
key: any;
|
|
231
|
+
value: any;
|
|
232
|
+
name?: any;
|
|
233
|
+
collectionName?: string;
|
|
234
|
+
sourceKey?: string;
|
|
235
|
+
uiSchema?: import("@formily/react").Stringify<{
|
|
236
|
+
[key: symbol]: any;
|
|
237
|
+
[key: `x-${string}`]: any;
|
|
238
|
+
[key: `x-${number}`]: any;
|
|
239
|
+
version?: string;
|
|
240
|
+
name?: import("@formily/react").SchemaKey;
|
|
241
|
+
title?: any;
|
|
242
|
+
description?: any;
|
|
243
|
+
default?: any;
|
|
244
|
+
readOnly?: boolean;
|
|
245
|
+
writeOnly?: boolean;
|
|
246
|
+
type?: import("@formily/react").SchemaTypes;
|
|
247
|
+
enum?: import("@formily/react").SchemaEnum<any>;
|
|
248
|
+
const?: any;
|
|
249
|
+
multipleOf?: number;
|
|
250
|
+
maximum?: number;
|
|
251
|
+
exclusiveMaximum?: number;
|
|
252
|
+
minimum?: number;
|
|
253
|
+
exclusiveMinimum?: number;
|
|
254
|
+
maxLength?: number;
|
|
255
|
+
minLength?: number;
|
|
256
|
+
pattern?: string | RegExp;
|
|
257
|
+
maxItems?: number;
|
|
258
|
+
minItems?: number;
|
|
259
|
+
uniqueItems?: boolean;
|
|
260
|
+
maxProperties?: number;
|
|
261
|
+
minProperties?: number;
|
|
262
|
+
required?: string | boolean | string[];
|
|
263
|
+
format?: string;
|
|
264
|
+
$ref?: string;
|
|
265
|
+
$namespace?: string; /**
|
|
266
|
+
* useFieldTypes
|
|
267
|
+
* Get field types for using transformers
|
|
268
|
+
* Only supported types will be displayed
|
|
269
|
+
* Some interfaces and types will be mapped to supported types
|
|
270
|
+
*/
|
|
271
|
+
definitions?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
272
|
+
properties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
273
|
+
items?: import("@formily/react").SchemaItems<any, any, any, any, any, any, any, any>;
|
|
274
|
+
additionalItems?: import("@formily/react").Stringify<any>;
|
|
275
|
+
patternProperties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
276
|
+
additionalProperties?: import("@formily/react").Stringify<any>;
|
|
277
|
+
"x-value"?: any;
|
|
278
|
+
"x-index"?: number;
|
|
279
|
+
"x-pattern"?: any;
|
|
280
|
+
"x-display"?: any;
|
|
281
|
+
"x-validator"?: any;
|
|
282
|
+
"x-decorator"?: any;
|
|
283
|
+
"x-decorator-props"?: any;
|
|
284
|
+
"x-component"?: any;
|
|
285
|
+
"x-component-props"?: any;
|
|
286
|
+
"x-reactions"?: import("@formily/react").SchemaReactions<any>;
|
|
287
|
+
"x-content"?: any;
|
|
288
|
+
"x-data"?: any;
|
|
289
|
+
"x-visible"?: boolean;
|
|
290
|
+
"x-hidden"?: boolean;
|
|
291
|
+
"x-disabled"?: boolean;
|
|
292
|
+
"x-editable"?: boolean;
|
|
293
|
+
"x-read-only"?: boolean;
|
|
294
|
+
"x-read-pretty"?: boolean;
|
|
295
|
+
"x-compile-omitted"?: string[];
|
|
296
|
+
}>;
|
|
297
|
+
target?: string;
|
|
298
|
+
})[];
|
|
299
|
+
export declare const useChartFields: (fields: FieldOption[]) => (field: any) => void;
|
|
300
|
+
export declare const useFormatters: (fields: FieldOption[]) => (field: any) => void;
|
|
301
|
+
export declare const useCollectionOptions: () => any;
|
|
302
|
+
/**
|
|
303
|
+
* useFieldTypes
|
|
304
|
+
* Get field types for using transformers
|
|
305
|
+
* Only supported types will be displayed
|
|
306
|
+
* Some interfaces and types will be mapped to supported types
|
|
307
|
+
*/
|
|
308
|
+
export declare const useFieldTypes: (fields: FieldOption[]) => (field: any) => void;
|
|
309
|
+
export declare const useTransformers: (field: any) => void;
|
|
310
|
+
export declare const useFieldTransformer: (transform: ChartRendererProps['transform'], locale?: string) => {};
|
|
311
|
+
export declare const useOrderFieldsOptions: (defaultOptions: any[], fields: FieldOption[]) => (field: any) => void;
|
|
312
|
+
export declare const useOrderReaction: (defaultOptions: any[], fields: FieldOption[]) => (field: ArrayField) => void;
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTransformers = exports.useOrderReaction = exports.useOrderFieldsOptions = exports.useFormatters = exports.useFieldsWithAssociation = exports.useFields = exports.useFieldTypes = exports.useFieldTransformer = exports.useCollectionOptions = exports.useChartFields = void 0;
|
|
7
|
+
function _react() {
|
|
8
|
+
const data = require("@formily/react");
|
|
9
|
+
_react = function _react() {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _client() {
|
|
15
|
+
const data = require("@nocobase/client");
|
|
16
|
+
_client = function _client() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _react2() {
|
|
22
|
+
const data = require("react");
|
|
23
|
+
_react2 = function _react2() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
function _reactI18next() {
|
|
29
|
+
const data = require("react-i18next");
|
|
30
|
+
_reactI18next = function _reactI18next() {
|
|
31
|
+
return data;
|
|
32
|
+
};
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
var _ChartConfigure = require("./block/ChartConfigure");
|
|
36
|
+
var _formatters = _interopRequireDefault(require("./block/formatters"));
|
|
37
|
+
var _transformers = _interopRequireDefault(require("./block/transformers"));
|
|
38
|
+
var _locale = require("./locale");
|
|
39
|
+
var _utils = require("./utils");
|
|
40
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
44
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
45
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
46
|
+
const useFields = collection => {
|
|
47
|
+
const _useContext = (0, _react2().useContext)(_ChartConfigure.ChartConfigContext),
|
|
48
|
+
current = _useContext.current;
|
|
49
|
+
if (!collection) {
|
|
50
|
+
collection = (current === null || current === void 0 ? void 0 : current.collection) || '';
|
|
51
|
+
}
|
|
52
|
+
const _useCollectionManager = (0, _client().useCollectionManager)(),
|
|
53
|
+
getCollectionFields = _useCollectionManager.getCollectionFields;
|
|
54
|
+
const fields = (getCollectionFields(collection) || []).filter(field => {
|
|
55
|
+
return field.interface;
|
|
56
|
+
}).map(field => {
|
|
57
|
+
var _field$uiSchema;
|
|
58
|
+
return _objectSpread(_objectSpread({}, field), {}, {
|
|
59
|
+
key: field.name,
|
|
60
|
+
label: ((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title) || field.name,
|
|
61
|
+
value: field.name
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
return fields;
|
|
65
|
+
};
|
|
66
|
+
exports.useFields = useFields;
|
|
67
|
+
const useFieldsWithAssociation = collection => {
|
|
68
|
+
const _useCollectionManager2 = (0, _client().useCollectionManager)(),
|
|
69
|
+
getCollectionFields = _useCollectionManager2.getCollectionFields;
|
|
70
|
+
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
71
|
+
t = _useTranslation.t;
|
|
72
|
+
const fields = useFields(collection);
|
|
73
|
+
return fields.map(field => {
|
|
74
|
+
var _field$uiSchema2;
|
|
75
|
+
const label = _react().Schema.compile(((_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2.title) || field.name, {
|
|
76
|
+
t
|
|
77
|
+
});
|
|
78
|
+
if (!field.target) {
|
|
79
|
+
return _objectSpread(_objectSpread({}, field), {}, {
|
|
80
|
+
label
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const targetFields = (getCollectionFields(field.target) || []).filter(targetField => {
|
|
84
|
+
return targetField.interface;
|
|
85
|
+
}).map(targetField => {
|
|
86
|
+
var _targetField$uiSchema;
|
|
87
|
+
return _objectSpread(_objectSpread({}, targetField), {}, {
|
|
88
|
+
key: `${field.name}.${targetField.name}`,
|
|
89
|
+
label: `${label} / ${_react().Schema.compile(((_targetField$uiSchema = targetField.uiSchema) === null || _targetField$uiSchema === void 0 ? void 0 : _targetField$uiSchema.title) || targetField.name, {
|
|
90
|
+
t
|
|
91
|
+
})}`,
|
|
92
|
+
value: `${field.name}.${targetField.name}`
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
return _objectSpread(_objectSpread({}, field), {}, {
|
|
96
|
+
label,
|
|
97
|
+
targetFields
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
exports.useFieldsWithAssociation = useFieldsWithAssociation;
|
|
102
|
+
const useChartFields = fields => field => {
|
|
103
|
+
const query = field.query('query').get('value') || {};
|
|
104
|
+
const selectedFields = (0, _utils.getSelectedFields)(fields, query);
|
|
105
|
+
field.dataSource = selectedFields;
|
|
106
|
+
};
|
|
107
|
+
exports.useChartFields = useChartFields;
|
|
108
|
+
const useFormatters = fields => field => {
|
|
109
|
+
var _getField;
|
|
110
|
+
const selectedField = field.query('.field').get('value');
|
|
111
|
+
if (!selectedField) {
|
|
112
|
+
field.dataSource = [];
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let options = [];
|
|
116
|
+
const fieldInterface = (_getField = (0, _utils.getField)(fields, selectedField)) === null || _getField === void 0 ? void 0 : _getField.interface;
|
|
117
|
+
switch (fieldInterface) {
|
|
118
|
+
case 'datetime':
|
|
119
|
+
case 'createdAt':
|
|
120
|
+
case 'updatedAt':
|
|
121
|
+
options = _formatters.default.datetime;
|
|
122
|
+
break;
|
|
123
|
+
case 'date':
|
|
124
|
+
options = _formatters.default.date;
|
|
125
|
+
break;
|
|
126
|
+
case 'time':
|
|
127
|
+
options = _formatters.default.time;
|
|
128
|
+
break;
|
|
129
|
+
default:
|
|
130
|
+
options = [];
|
|
131
|
+
}
|
|
132
|
+
field.dataSource = options;
|
|
133
|
+
};
|
|
134
|
+
exports.useFormatters = useFormatters;
|
|
135
|
+
const useCollectionOptions = () => {
|
|
136
|
+
const _useTranslation2 = (0, _reactI18next().useTranslation)(),
|
|
137
|
+
t = _useTranslation2.t;
|
|
138
|
+
const _useCollectionManager3 = (0, _client().useCollectionManager)(),
|
|
139
|
+
collections = _useCollectionManager3.collections;
|
|
140
|
+
const _useACLRoleContext = (0, _client().useACLRoleContext)(),
|
|
141
|
+
allowAll = _useACLRoleContext.allowAll,
|
|
142
|
+
parseAction = _useACLRoleContext.parseAction;
|
|
143
|
+
const options = collections.filter(collection => {
|
|
144
|
+
if (allowAll) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
const params = parseAction(`${collection.name}:list`);
|
|
148
|
+
return params;
|
|
149
|
+
}).map(collection => ({
|
|
150
|
+
label: collection.title,
|
|
151
|
+
value: collection.name,
|
|
152
|
+
key: collection.name
|
|
153
|
+
}));
|
|
154
|
+
return _react().Schema.compile(options, {
|
|
155
|
+
t
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* useFieldTypes
|
|
160
|
+
* Get field types for using transformers
|
|
161
|
+
* Only supported types will be displayed
|
|
162
|
+
* Some interfaces and types will be mapped to supported types
|
|
163
|
+
*/
|
|
164
|
+
exports.useCollectionOptions = useCollectionOptions;
|
|
165
|
+
const useFieldTypes = fields => field => {
|
|
166
|
+
const selectedField = field.query('.field').get('value');
|
|
167
|
+
const query = field.query('query').get('value') || {};
|
|
168
|
+
const selectedFields = (0, _utils.getSelectedFields)(fields, query);
|
|
169
|
+
const fieldProps = selectedFields.find(field => field.value === selectedField);
|
|
170
|
+
const supports = Object.keys(_transformers.default);
|
|
171
|
+
field.dataSource = supports.map(key => ({
|
|
172
|
+
label: (0, _locale.lang)(key),
|
|
173
|
+
value: key
|
|
174
|
+
}));
|
|
175
|
+
const map = {
|
|
176
|
+
createdAt: 'datetime',
|
|
177
|
+
updatedAt: 'datetime',
|
|
178
|
+
double: 'number',
|
|
179
|
+
integer: 'number',
|
|
180
|
+
percent: 'number'
|
|
181
|
+
};
|
|
182
|
+
const fieldInterface = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.interface;
|
|
183
|
+
const fieldType = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.type;
|
|
184
|
+
const key = map[fieldInterface] || map[fieldType] || fieldType;
|
|
185
|
+
if (supports.includes(key)) {
|
|
186
|
+
field.setState({
|
|
187
|
+
value: key,
|
|
188
|
+
disabled: true
|
|
189
|
+
});
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
field.setState({
|
|
193
|
+
value: null,
|
|
194
|
+
disabled: false
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
exports.useFieldTypes = useFieldTypes;
|
|
198
|
+
const useTransformers = field => {
|
|
199
|
+
const selectedType = field.query('.type').get('value');
|
|
200
|
+
if (!selectedType) {
|
|
201
|
+
field.dataSource = [];
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const options = Object.keys(_transformers.default[selectedType] || {}).map(key => ({
|
|
205
|
+
label: (0, _locale.lang)(key),
|
|
206
|
+
value: key
|
|
207
|
+
}));
|
|
208
|
+
field.dataSource = options;
|
|
209
|
+
};
|
|
210
|
+
exports.useTransformers = useTransformers;
|
|
211
|
+
const useFieldTransformer = (transform, locale = 'en-US') => {
|
|
212
|
+
return (transform || []).filter(item => item.field && item.type && item.format).reduce((mp, item) => {
|
|
213
|
+
const transformer = _transformers.default[item.type][item.format];
|
|
214
|
+
if (!transformer) {
|
|
215
|
+
return mp;
|
|
216
|
+
}
|
|
217
|
+
mp[item.field] = val => transformer(val, locale);
|
|
218
|
+
return mp;
|
|
219
|
+
}, {});
|
|
220
|
+
};
|
|
221
|
+
exports.useFieldTransformer = useFieldTransformer;
|
|
222
|
+
const useOrderFieldsOptions = (defaultOptions, fields) => field => {
|
|
223
|
+
const query = field.query('query').get('value') || {};
|
|
224
|
+
const _query$measures = query.measures,
|
|
225
|
+
measures = _query$measures === void 0 ? [] : _query$measures;
|
|
226
|
+
const hasAgg = measures.some(measure => measure.aggregation);
|
|
227
|
+
if (!hasAgg) {
|
|
228
|
+
field.componentProps.fieldNames = {
|
|
229
|
+
label: 'title',
|
|
230
|
+
value: 'name',
|
|
231
|
+
children: 'children'
|
|
232
|
+
};
|
|
233
|
+
field.dataSource = defaultOptions;
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const selectedFields = (0, _utils.getSelectedFields)(fields, query);
|
|
237
|
+
field.componentProps.fieldNames = {};
|
|
238
|
+
field.dataSource = selectedFields;
|
|
239
|
+
};
|
|
240
|
+
exports.useOrderFieldsOptions = useOrderFieldsOptions;
|
|
241
|
+
const useOrderReaction = (defaultOptions, fields) => field => {
|
|
242
|
+
const query = field.query('query').get('value') || {};
|
|
243
|
+
const _query$measures2 = query.measures,
|
|
244
|
+
measures = _query$measures2 === void 0 ? [] : _query$measures2;
|
|
245
|
+
const hasAgg = measures.some(measure => measure.aggregation);
|
|
246
|
+
let dataSource = defaultOptions;
|
|
247
|
+
const allValues = [];
|
|
248
|
+
if (hasAgg) {
|
|
249
|
+
dataSource = (0, _utils.getSelectedFields)(fields, query);
|
|
250
|
+
dataSource.forEach(field => {
|
|
251
|
+
allValues.push(field.value);
|
|
252
|
+
});
|
|
253
|
+
} else {
|
|
254
|
+
dataSource.forEach(field => {
|
|
255
|
+
const children = field.children || [];
|
|
256
|
+
if (!children.length) {
|
|
257
|
+
allValues.push(field.value || field.name);
|
|
258
|
+
}
|
|
259
|
+
children.forEach(child => {
|
|
260
|
+
allValues.push(`${field.name}.${child.name}`);
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
const orders = field.value || [];
|
|
265
|
+
const newOrders = orders.reduce((newOrders, item) => {
|
|
266
|
+
const _parseField = (0, _utils.parseField)(item.field),
|
|
267
|
+
alias = _parseField.alias;
|
|
268
|
+
if (!item.field || allValues.includes(alias)) {
|
|
269
|
+
newOrders.push(item);
|
|
270
|
+
}
|
|
271
|
+
return newOrders;
|
|
272
|
+
}, []);
|
|
273
|
+
field.setValue(newOrders);
|
|
274
|
+
};
|
|
275
|
+
exports.useOrderReaction = useOrderReaction;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ChartLibraryProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _ChartLibrary.ChartLibraryProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.default = void 0;
|
|
13
|
+
function _client() {
|
|
14
|
+
const data = require("@nocobase/client");
|
|
15
|
+
_client = function _client() {
|
|
16
|
+
return data;
|
|
17
|
+
};
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
function _react() {
|
|
21
|
+
const data = _interopRequireWildcard(require("react"));
|
|
22
|
+
_react = function _react() {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
var _block = require("./block");
|
|
28
|
+
var _locale = require("./locale");
|
|
29
|
+
var _renderer = require("./renderer");
|
|
30
|
+
var _ChartLibrary = require("./renderer/ChartLibrary");
|
|
31
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
36
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
37
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
38
|
+
const Chart = props => {
|
|
39
|
+
const _useChartsTranslation = (0, _locale.useChartsTranslation)(),
|
|
40
|
+
t = _useChartsTranslation.t;
|
|
41
|
+
const initializers = (0, _react().useContext)(_client().SchemaInitializerContext);
|
|
42
|
+
const children = initializers.BlockInitializers.items[0].children;
|
|
43
|
+
const has = children.some(initializer => initializer.component === 'ChartV2BlockInitializer');
|
|
44
|
+
if (!has) {
|
|
45
|
+
children.push({
|
|
46
|
+
key: 'chart-v2',
|
|
47
|
+
type: 'item',
|
|
48
|
+
title: t('Chart'),
|
|
49
|
+
component: 'ChartV2BlockInitializer'
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return _react().default.createElement(_client().SchemaComponentOptions, {
|
|
53
|
+
components: {
|
|
54
|
+
ChartV2BlockInitializer: _block.ChartV2BlockInitializer,
|
|
55
|
+
ChartRenderer: _renderer.ChartRenderer,
|
|
56
|
+
ChartV2BlockDesigner: _block.ChartV2BlockDesigner,
|
|
57
|
+
ChartV2Block: _block.ChartV2Block,
|
|
58
|
+
ChartRendererProvider: _renderer.ChartRendererProvider
|
|
59
|
+
}
|
|
60
|
+
}, _react().default.createElement(_client().SchemaInitializerProvider, {
|
|
61
|
+
initializers: _objectSpread(_objectSpread({}, initializers), {}, {
|
|
62
|
+
ChartInitializers: _block.ChartInitializers
|
|
63
|
+
})
|
|
64
|
+
}, _react().default.createElement(_ChartLibrary.ChartLibraryProvider, {
|
|
65
|
+
name: "Built-in",
|
|
66
|
+
charts: _renderer.InternalLibrary
|
|
67
|
+
}, props.children)));
|
|
68
|
+
};
|
|
69
|
+
var _default = Chart;
|
|
70
|
+
exports.default = _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
Edit: string;
|
|
3
|
+
Delete: string;
|
|
4
|
+
Cancel: string;
|
|
5
|
+
Submit: string;
|
|
6
|
+
Actions: string;
|
|
7
|
+
Title: string;
|
|
8
|
+
Enable: string;
|
|
9
|
+
'SAML manager': string;
|
|
10
|
+
'SAML Providers': string;
|
|
11
|
+
'Redirect url': string;
|
|
12
|
+
'SP entity id': string;
|
|
13
|
+
'Add provider': string;
|
|
14
|
+
'Edit provider': string;
|
|
15
|
+
'Client id': string;
|
|
16
|
+
'Entity id or issuer': string;
|
|
17
|
+
'Login Url': string;
|
|
18
|
+
'Public cert': string;
|
|
19
|
+
'Delete provider': string;
|
|
20
|
+
'Are you sure you want to delete it?': string;
|
|
21
|
+
'Sign in button name, which will be displayed on the sign in page': string;
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|