@nocobase/plugin-data-visualization 0.11.1-alpha.1 → 0.11.1-alpha.3

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 (28) hide show
  1. package/lib/client/block/ChartConfigure.js +20 -37
  2. package/lib/client/renderer/ChartRenderer.js +1 -3
  3. package/lib/locale/tr-TR.d.ts +2 -0
  4. package/lib/locale/tr-TR.js +8 -0
  5. package/lib/server/actions/query.js +1 -5
  6. package/package.json +9 -9
  7. package/src/client/block/ChartConfigure.tsx +76 -101
  8. package/src/client/renderer/ChartRenderer.tsx +1 -5
  9. package/src/locale/tr-TR.ts +1 -0
  10. package/src/server/actions/query.ts +1 -5
  11. /package/lib/{client/locale → locale}/en-US.d.ts +0 -0
  12. /package/lib/{client/locale → locale}/en-US.js +0 -0
  13. /package/lib/{client/locale/ja-JP.d.ts → locale/fr-FR.d.ts} +0 -0
  14. /package/lib/{client/locale/ja-JP.js → locale/fr-FR.js} +0 -0
  15. /package/lib/{client/locale/ru-RU.d.ts → locale/ja-JP.d.ts} +0 -0
  16. /package/lib/{client/locale/ru-RU.js → locale/ja-JP.js} +0 -0
  17. /package/lib/{client/locale → locale}/pt-BR.d.ts +0 -0
  18. /package/lib/{client/locale → locale}/pt-BR.js +0 -0
  19. /package/lib/{client/locale/tr-TR.d.ts → locale/ru-RU.d.ts} +0 -0
  20. /package/lib/{client/locale/tr-TR.js → locale/ru-RU.js} +0 -0
  21. /package/lib/{client/locale → locale}/zh-CN.d.ts +0 -0
  22. /package/lib/{client/locale → locale}/zh-CN.js +0 -0
  23. /package/src/{client/locale → locale}/en-US.ts +0 -0
  24. /package/src/{client/locale/ja-JP.ts → locale/fr-FR.ts} +0 -0
  25. /package/src/{client/locale/ru-RU.ts → locale/ja-JP.ts} +0 -0
  26. /package/src/{client/locale → locale}/pt-BR.ts +0 -0
  27. /package/src/{client/locale/tr-TR.ts → locale/ru-RU.ts} +0 -0
  28. /package/src/{client/locale → locale}/zh-CN.ts +0 -0
@@ -157,23 +157,19 @@ const ChartConfigure = props => {
157
157
  setDimensions((0, _lodash().cloneDeep)(currentDimensions));
158
158
  };
159
159
  const chartType = (0, _renderer.useDefaultChartType)();
160
- const form = (0, _react2().useMemo)(() => {
161
- return (0, _core().createForm)({
162
- values: _objectSpread(_objectSpread({
163
- config: {
164
- chartType
165
- }
166
- }, initialValues || (field === null || field === void 0 ? void 0 : field.decoratorProps)), {}, {
167
- collection
168
- }),
169
- effects: form => {
170
- (0, _core().onFieldChange)('config.chartType', () => initChart(true));
171
- (0, _core().onFormInit)(() => {
172
- queryReact(form);
173
- });
160
+ const form = (0, _react2().useMemo)(() => (0, _core().createForm)({
161
+ values: _objectSpread(_objectSpread({
162
+ config: {
163
+ chartType
174
164
  }
175
- });
176
- },
165
+ }, initialValues || (field === null || field === void 0 ? void 0 : field.decoratorProps)), {}, {
166
+ collection
167
+ }),
168
+ effects: form => {
169
+ (0, _core().onFieldChange)('config.chartType', () => initChart(true));
170
+ (0, _core().onFormInit)(() => queryReact(form));
171
+ }
172
+ }),
177
173
  // visible, collection added here to re-initialize form when visible, collection change
178
174
  // eslint-disable-next-line react-hooks/exhaustive-deps
179
175
  [field, visible, collection]);
@@ -238,9 +234,8 @@ const ChartConfigure = props => {
238
234
  afterSave();
239
235
  return;
240
236
  }
241
- insert((0, _utils.createRendererSchema)(rendererProps), {
242
- onSuccess: afterSave,
243
- wrap: _client().gridRowColWrap
237
+ insert((0, _client().gridRowColWrap)((0, _utils.createRendererSchema)(rendererProps)), {
238
+ onSuccess: afterSave
244
239
  });
245
240
  },
246
241
  onCancel: () => {
@@ -262,9 +257,10 @@ const ChartConfigure = props => {
262
257
  bodyStyle: {
263
258
  background: 'rgba(128, 128, 128, 0.08)'
264
259
  }
265
- }, _react2().default.createElement(_antdV().Form, {
266
- layout: "vertical",
260
+ }, _react2().default.createElement(_client().FormProvider, {
267
261
  form: form
262
+ }, _react2().default.createElement(_antdV().FormLayout, {
263
+ layout: "vertical"
268
264
  }, _react2().default.createElement(_antd().Row, {
269
265
  gutter: 8
270
266
  }, _react2().default.createElement(_antd().Col, {
@@ -312,7 +308,7 @@ const ChartConfigure = props => {
312
308
  style: {
313
309
  margin: '12px 12px 12px 0'
314
310
  }
315
- }, _react2().default.createElement(ChartConfigure.Renderer, null))))));
311
+ }, _react2().default.createElement(ChartConfigure.Renderer, null)))))));
316
312
  };
317
313
  exports.ChartConfigure = ChartConfigure;
318
314
  ChartConfigure.Renderer = function Renderer(props) {
@@ -396,19 +392,10 @@ ChartConfigure.Query = function Query() {
396
392
  ArrayItems: _antdV().ArrayItems,
397
393
  Editable: _antdV().Editable,
398
394
  FormCollapse: _antdV().FormCollapse,
399
- Card: _antd().Card,
400
- Switch: _antdV().Switch,
401
- Select: _client().Select,
402
- Input: _client().Input,
403
- InputNumber: _client().InputNumber,
404
395
  FormItem: _antdV().FormItem,
405
- Radio: _client().Radio,
406
396
  Space: _antd().Space,
407
- Filter: _client().Filter,
408
- DatePicker: _client().DatePicker,
409
- Text,
410
- FromSql,
411
- Cascader: _client().Cascader
397
+ Switch: _antdV().Switch,
398
+ FromSql
412
399
  }
413
400
  });
414
401
  };
@@ -445,9 +432,6 @@ ChartConfigure.Config = function Config() {
445
432
  getReference
446
433
  },
447
434
  components: {
448
- Card: _antd().Card,
449
- Select: _client().Select,
450
- Input: _client().Input,
451
435
  FormItem: _antdV().FormItem,
452
436
  ArrayItems: _antdV().ArrayItems,
453
437
  Space: _antd().Space,
@@ -465,7 +449,6 @@ ChartConfigure.Transform = function Transform() {
465
449
  return _react2().default.createElement(_client().SchemaComponent, {
466
450
  schema: _configure.transformSchema,
467
451
  components: {
468
- Select: _client().Select,
469
452
  FormItem: _antdV().FormItem,
470
453
  ArrayItems: _antdV().ArrayItems,
471
454
  Space: _antd().Space
@@ -146,9 +146,7 @@ ChartRenderer.Designer = function Designer() {
146
146
  }
147
147
  }, t('Configure')), _react2().default.createElement(_client().SchemaSettings.Item, {
148
148
  key: "duplicate",
149
- onClick: () => insertAdjacent('afterEnd', (0, _utils.createRendererSchema)(schema === null || schema === void 0 ? void 0 : schema['x-decorator-props']), {
150
- wrap: _client().gridRowColWrap
151
- })
149
+ onClick: () => insertAdjacent('afterEnd', (0, _client().gridRowColWrap)((0, _utils.createRendererSchema)(schema === null || schema === void 0 ? void 0 : schema['x-decorator-props'])))
152
150
  }, t('Duplicate')), _react2().default.createElement(_client().SchemaSettings.BlockTitleItem, null), _react2().default.createElement(_client().SchemaSettings.Divider, null), _react2().default.createElement(_client().SchemaSettings.Remove
153
151
  // removeParentsIfNoChildren
154
152
  , {
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {};
8
+ exports.default = _default;
@@ -161,11 +161,7 @@ const parseBuilder = (ctx, builder) => {
161
161
  fieldMap[alias || field] = dimension;
162
162
  });
163
163
  orders.forEach(item => {
164
- const dialect = sequelize.getDialect();
165
- let alias = `"${item.alias}"`;
166
- if (dialect === 'mysql') {
167
- alias = `\`${item.alias}\``;
168
- }
164
+ const alias = sequelize.getQueryInterface().quoteIdentifier(item.alias);
169
165
  const name = hasAgg ? sequelize.literal(alias) : sequelize.col(item.field);
170
166
  order.push([name, item.order || 'ASC']);
171
167
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-visualization",
3
- "version": "0.11.1-alpha.1",
3
+ "version": "0.11.1-alpha.3",
4
4
  "displayName": "Data Visualization",
5
5
  "displayName.zh-CN": "数据可视化",
6
6
  "description": "Provides business intelligence and data visualization features",
@@ -17,13 +17,13 @@
17
17
  "@formily/core": "2.2.26",
18
18
  "@formily/react": "2.2.26",
19
19
  "@formily/shared": "2.2.26",
20
- "@nocobase/actions": "0.11.1-alpha.1",
21
- "@nocobase/cache": "0.11.1-alpha.1",
22
- "@nocobase/client": "0.11.1-alpha.1",
23
- "@nocobase/database": "0.11.1-alpha.1",
24
- "@nocobase/server": "0.11.1-alpha.1",
25
- "@nocobase/test": "0.11.1-alpha.1",
26
- "@nocobase/utils": "0.11.1-alpha.1",
20
+ "@nocobase/actions": "0.11.1-alpha.3",
21
+ "@nocobase/cache": "0.11.1-alpha.3",
22
+ "@nocobase/client": "0.11.1-alpha.3",
23
+ "@nocobase/database": "0.11.1-alpha.3",
24
+ "@nocobase/server": "0.11.1-alpha.3",
25
+ "@nocobase/test": "0.11.1-alpha.3",
26
+ "@nocobase/utils": "0.11.1-alpha.3",
27
27
  "@testing-library/react": "^12.1.5",
28
28
  "antd": "^5.6.4",
29
29
  "lodash": "^4.17.21",
@@ -31,5 +31,5 @@
31
31
  "react-i18next": "^11.15.1",
32
32
  "vitest": "^0.33.0"
33
33
  },
34
- "gitHead": "9ed1dba520bc5f3a7cb1255ea8d92ccbefc11bc8"
34
+ "gitHead": "5ed3bd7d5b16bd38d268961b34875d5cd45799ef"
35
35
  }
@@ -1,17 +1,11 @@
1
1
  import { RightSquareOutlined } from '@ant-design/icons';
2
- import { ArrayItems, Editable, Form, FormCollapse, FormItem, Switch } from '@formily/antd-v5';
2
+ import { ArrayItems, Editable, FormCollapse, FormItem, FormLayout, Switch } from '@formily/antd-v5';
3
3
  import { Form as FormType, ObjectField, createForm, onFieldChange, onFormInit } from '@formily/core';
4
4
  import { FormConsumer, ISchema, Schema } from '@formily/react';
5
5
  import {
6
6
  AutoComplete,
7
- Cascader,
8
- DatePicker,
9
- Filter,
10
- Input,
11
- InputNumber,
12
- Radio,
7
+ FormProvider,
13
8
  SchemaComponent,
14
- Select,
15
9
  gridRowColWrap,
16
10
  useCollectionFieldsOptions,
17
11
  useCollectionFilterOptions,
@@ -126,17 +120,14 @@ export const ChartConfigure: React.FC<{
126
120
  };
127
121
  const chartType = useDefaultChartType();
128
122
  const form = useMemo(
129
- () => {
130
- return createForm({
123
+ () =>
124
+ createForm({
131
125
  values: { config: { chartType }, ...(initialValues || field?.decoratorProps), collection },
132
126
  effects: (form) => {
133
127
  onFieldChange('config.chartType', () => initChart(true));
134
- onFormInit(() => {
135
- queryReact(form);
136
- });
128
+ onFormInit(() => queryReact(form));
137
129
  },
138
- });
139
- },
130
+ }),
140
131
  // visible, collection added here to re-initialize form when visible, collection change
141
132
  // eslint-disable-next-line react-hooks/exhaustive-deps
142
133
  [field, visible, collection],
@@ -199,9 +190,8 @@ export const ChartConfigure: React.FC<{
199
190
  afterSave();
200
191
  return;
201
192
  }
202
- insert(createRendererSchema(rendererProps), {
193
+ insert(gridRowColWrap(createRendererSchema(rendererProps)), {
203
194
  onSuccess: afterSave,
204
- wrap: gridRowColWrap,
205
195
  });
206
196
  }}
207
197
  onCancel={() => {
@@ -224,70 +214,72 @@ export const ChartConfigure: React.FC<{
224
214
  background: 'rgba(128, 128, 128, 0.08)',
225
215
  }}
226
216
  >
227
- <Form layout="vertical" form={form}>
228
- <Row gutter={8}>
229
- <Col span={7}>
230
- <Card
231
- style={{
232
- height: 'calc(100vh - 300px)',
233
- overflow: 'auto',
234
- margin: '12px 0 12px 12px',
235
- }}
236
- ref={queryRef}
237
- >
238
- <Tabs
239
- tabBarExtraContent={<RunButton />}
240
- items={[
241
- {
242
- label: t('Query'),
243
- key: 'query',
244
- children: <ChartConfigure.Query />,
245
- },
246
- {
247
- label: t('Data'),
248
- key: 'data',
249
- children: <ChartConfigure.Data />,
250
- },
251
- ]}
252
- />
253
- </Card>
254
- </Col>
255
- <Col span={6}>
256
- <Card
257
- style={{
258
- height: 'calc(100vh - 300px)',
259
- overflow: 'auto',
260
- margin: '12px 3px 12px 3px',
261
- }}
262
- ref={configRef}
263
- >
264
- <Tabs
265
- items={[
266
- {
267
- label: t('Chart'),
268
- key: 'chart',
269
- children: <ChartConfigure.Config />,
270
- },
271
- {
272
- label: t('Transform'),
273
- key: 'transform',
274
- children: <ChartConfigure.Transform />,
275
- },
276
- ]}
277
- />
278
- </Card>
279
- </Col>
280
- <Col span={11}>
281
- <Card
282
- style={{
283
- margin: '12px 12px 12px 0',
284
- }}
285
- >
286
- <ChartConfigure.Renderer />
287
- </Card>
288
- </Col>
289
- </Row>
290
- </Form>
217
+ <FormProvider form={form}>
218
+ <FormLayout layout="vertical">
219
+ <Row gutter={8}>
220
+ <Col span={7}>
221
+ <Card
222
+ style={{
223
+ height: 'calc(100vh - 300px)',
224
+ overflow: 'auto',
225
+ margin: '12px 0 12px 12px',
226
+ }}
227
+ ref={queryRef}
228
+ >
229
+ <Tabs
230
+ tabBarExtraContent={<RunButton />}
231
+ items={[
232
+ {
233
+ label: t('Query'),
234
+ key: 'query',
235
+ children: <ChartConfigure.Query />,
236
+ },
237
+ {
238
+ label: t('Data'),
239
+ key: 'data',
240
+ children: <ChartConfigure.Data />,
241
+ },
242
+ ]}
243
+ />
244
+ </Card>
245
+ </Col>
246
+ <Col span={6}>
247
+ <Card
248
+ style={{
249
+ height: 'calc(100vh - 300px)',
250
+ overflow: 'auto',
251
+ margin: '12px 3px 12px 3px',
252
+ }}
253
+ ref={configRef}
254
+ >
255
+ <Tabs
256
+ items={[
257
+ {
258
+ label: t('Chart'),
259
+ key: 'chart',
260
+ children: <ChartConfigure.Config />,
261
+ },
262
+ {
263
+ label: t('Transform'),
264
+ key: 'transform',
265
+ children: <ChartConfigure.Transform />,
266
+ },
267
+ ]}
268
+ />
269
+ </Card>
270
+ </Col>
271
+ <Col span={11}>
272
+ <Card
273
+ style={{
274
+ margin: '12px 12px 12px 0',
275
+ }}
276
+ >
277
+ <ChartConfigure.Renderer />
278
+ </Card>
279
+ </Col>
280
+ </Row>
281
+ </FormLayout>
282
+ </FormProvider>
291
283
  </Modal>
292
284
  );
293
285
  };
@@ -359,24 +351,7 @@ ChartConfigure.Query = function Query() {
359
351
  collection: current?.collection,
360
352
  useOrderReaction: useOrderReaction(compiledFieldOptions, fields),
361
353
  }}
362
- components={{
363
- ArrayItems,
364
- Editable,
365
- FormCollapse,
366
- Card,
367
- Switch,
368
- Select,
369
- Input,
370
- InputNumber,
371
- FormItem,
372
- Radio,
373
- Space,
374
- Filter,
375
- DatePicker,
376
- Text,
377
- FromSql,
378
- Cascader,
379
- }}
354
+ components={{ ArrayItems, Editable, FormCollapse, FormItem, Space, Switch, FromSql }}
380
355
  />
381
356
  );
382
357
  };
@@ -411,7 +386,7 @@ ChartConfigure.Config = function Config() {
411
386
  <SchemaComponent
412
387
  schema={getConfigSchema(schema)}
413
388
  scope={{ t, chartTypes, useChartFields: getChartFields, getReference }}
414
- components={{ Card, Select, Input, FormItem, ArrayItems, Space, AutoComplete }}
389
+ components={{ FormItem, ArrayItems, Space, AutoComplete }}
415
390
  />
416
391
  );
417
392
  }}
@@ -427,7 +402,7 @@ ChartConfigure.Transform = function Transform() {
427
402
  return (
428
403
  <SchemaComponent
429
404
  schema={transformSchema}
430
- components={{ Select, FormItem, ArrayItems, Space }}
405
+ components={{ FormItem, ArrayItems, Space }}
431
406
  scope={{ useChartFields: getChartFields, useFieldTypeOptions, useTransformers, t }}
432
407
  />
433
408
  );
@@ -96,11 +96,7 @@ ChartRenderer.Designer = function Designer() {
96
96
  </SchemaSettings.Item>
97
97
  <SchemaSettings.Item
98
98
  key="duplicate"
99
- onClick={() =>
100
- insertAdjacent('afterEnd', createRendererSchema(schema?.['x-decorator-props']), {
101
- wrap: gridRowColWrap,
102
- })
103
- }
99
+ onClick={() => insertAdjacent('afterEnd', gridRowColWrap(createRendererSchema(schema?.['x-decorator-props'])))}
104
100
  >
105
101
  {t('Duplicate')}
106
102
  </SchemaSettings.Item>
@@ -0,0 +1 @@
1
+ export default {};
@@ -161,11 +161,7 @@ export const parseBuilder = (ctx: Context, builder: QueryParams) => {
161
161
  });
162
162
 
163
163
  orders.forEach((item: OrderProps) => {
164
- const dialect = sequelize.getDialect();
165
- let alias = `"${item.alias}"`;
166
- if (dialect === 'mysql') {
167
- alias = `\`${item.alias}\``;
168
- }
164
+ const alias = sequelize.getQueryInterface().quoteIdentifier(item.alias);
169
165
  const name = hasAgg ? sequelize.literal(alias) : sequelize.col(item.field as string);
170
166
  order.push([name, item.order || 'ASC']);
171
167
  });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes