@nocobase/plugin-data-visualization 0.14.0-alpha.6 → 0.14.0-alpha.8

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,20 +1,20 @@
1
1
  module.exports = {
2
- "@ant-design/icons": "5.1.4",
3
- "@formily/antd-v5": "1.1.0",
4
- "@nocobase/client": "0.14.0-alpha.6",
5
- "antd": "5.8.6",
2
+ "@nocobase/client": "0.14.0-alpha.8",
6
3
  "react": "18.2.0",
7
4
  "@formily/react": "2.2.27",
8
5
  "@formily/shared": "2.2.27",
9
- "@nocobase/cache": "0.14.0-alpha.6",
10
- "@nocobase/server": "0.14.0-alpha.6",
6
+ "@nocobase/cache": "0.14.0-alpha.8",
7
+ "@nocobase/server": "0.14.0-alpha.8",
8
+ "@ant-design/icons": "5.1.4",
11
9
  "dayjs": "1.11.9",
10
+ "@formily/antd-v5": "1.1.7",
12
11
  "@formily/core": "2.2.27",
12
+ "antd": "5.8.6",
13
13
  "lodash": "4.17.21",
14
+ "@emotion/css": "11.11.2",
14
15
  "react-i18next": "11.18.6",
15
16
  "ahooks": "3.7.8",
16
- "@emotion/css": "11.11.2",
17
- "@nocobase/actions": "0.14.0-alpha.6",
18
- "@nocobase/database": "0.14.0-alpha.6",
19
- "@nocobase/utils": "0.14.0-alpha.6"
17
+ "@nocobase/actions": "0.14.0-alpha.8",
18
+ "@nocobase/database": "0.14.0-alpha.8",
19
+ "@nocobase/utils": "0.14.0-alpha.8"
20
20
  };
@@ -1 +1 @@
1
- {"name":"koa-compose","description":"compose Koa middleware","repository":"koajs/compose","version":"4.1.0","keywords":["koa","middleware","compose"],"files":["index.js"],"dependencies":{},"devDependencies":{"codecov":"^3.0.0","jest":"^21.0.0","matcha":"^0.7.0","standard":"^10.0.3"},"scripts":{"bench":"matcha bench/bench.js","lint":"standard --fix .","test":"jest --forceExit --coverage"},"jest":{"testEnvironment":"node"},"license":"MIT","_lastModified":"2023-09-22T08:35:25.495Z"}
1
+ {"name":"koa-compose","description":"compose Koa middleware","repository":"koajs/compose","version":"4.1.0","keywords":["koa","middleware","compose"],"files":["index.js"],"dependencies":{},"devDependencies":{"codecov":"^3.0.0","jest":"^21.0.0","matcha":"^0.7.0","standard":"^10.0.3"},"scripts":{"bench":"matcha bench/bench.js","lint":"standard --fix .","test":"jest --forceExit --coverage"},"jest":{"testEnvironment":"node"},"license":"MIT","_lastModified":"2023-11-01T02:12:00.125Z"}
@@ -133,7 +133,8 @@ const parseBuilder = async (ctx, next) => {
133
133
  include,
134
134
  group,
135
135
  order,
136
- limit: limit > 2e3 ? 2e3 : limit,
136
+ limit: limit || 2e3,
137
+ subQuery: false,
137
138
  raw: true
138
139
  },
139
140
  fieldMap
@@ -144,7 +145,7 @@ const parseFieldAndAssociations = async (ctx, next) => {
144
145
  const { collection: collectionName, measures, dimensions, orders, filter } = ctx.action.params.values;
145
146
  const collection = ctx.db.getCollection(collectionName);
146
147
  const fields = collection.fields;
147
- const underscored = ctx.db.options.underscored;
148
+ const underscored = collection.options.underscored;
148
149
  const models = {};
149
150
  const parseField = (selected) => {
150
151
  var _a, _b, _c;
@@ -272,9 +273,7 @@ const cacheMiddleware = async (ctx, next) => {
272
273
  }
273
274
  await next();
274
275
  if (useCache) {
275
- console.log(uid, ctx.body);
276
276
  await cache.set(uid, ctx.body, (cacheConfig == null ? void 0 : cacheConfig.ttl) || 30);
277
- console.log(cache.get(uid));
278
277
  }
279
278
  };
280
279
  const checkPermission = (ctx, next) => {
@@ -296,13 +295,11 @@ const query = async (ctx, next) => {
296
295
  parseBuilder,
297
296
  queryData,
298
297
  postProcess
299
- ])(ctx, async () => {
300
- });
298
+ ])(ctx, next);
301
299
  } catch (err) {
302
300
  ctx.app.logger.error("charts query: ", err);
303
301
  ctx.throw(500, err);
304
302
  }
305
- await next();
306
303
  };
307
304
  // Annotate the CommonJS export names for ESM import in node:
308
305
  0 && (module.exports = {
@@ -0,0 +1,4 @@
1
+ import { Migration } from '@nocobase/server';
2
+ export default class RenameChartTypeMigration extends Migration {
3
+ up(): Promise<void>;
4
+ }
@@ -0,0 +1,50 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var rename_charttype_exports = {};
19
+ __export(rename_charttype_exports, {
20
+ default: () => RenameChartTypeMigration
21
+ });
22
+ module.exports = __toCommonJS(rename_charttype_exports);
23
+ var import_server = require("@nocobase/server");
24
+ class RenameChartTypeMigration extends import_server.Migration {
25
+ async up() {
26
+ const result = await this.app.version.satisfies("<=0.14.0-alpha.7");
27
+ if (!result) {
28
+ return;
29
+ }
30
+ const r = this.db.getRepository("uiSchemas");
31
+ const items = await r.find({
32
+ filter: {
33
+ "schema.x-decorator": "ChartRendererProvider"
34
+ }
35
+ });
36
+ await this.db.sequelize.transaction(async (transaction) => {
37
+ var _a, _b;
38
+ for (const item of items) {
39
+ const schema = item.schema;
40
+ const chartType = (_b = (_a = schema["x-decorator-props"]) == null ? void 0 : _a.config) == null ? void 0 : _b.chartType;
41
+ if (!chartType || chartType.startsWith("Built-in.")) {
42
+ continue;
43
+ }
44
+ schema["x-decorator-props"].config.chartType = `Built-in.${chartType}`;
45
+ item.set("schema", schema);
46
+ await item.save({ transaction });
47
+ }
48
+ });
49
+ }
50
+ }
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(plugin_exports);
24
24
  var import_cache = require("@nocobase/cache");
25
25
  var import_server = require("@nocobase/server");
26
26
  var import_query = require("./actions/query");
27
+ var import_path = require("path");
27
28
  class DataVisualizationPlugin extends import_server.Plugin {
28
29
  cache;
29
30
  afterAdd() {
@@ -38,6 +39,13 @@ class DataVisualizationPlugin extends import_server.Plugin {
38
39
  this.app.acl.allow("charts", "query", "loggedIn");
39
40
  }
40
41
  async load() {
42
+ this.db.addMigrations({
43
+ namespace: "data-visulization",
44
+ directory: (0, import_path.resolve)(__dirname, "migrations"),
45
+ context: {
46
+ plugin: this
47
+ }
48
+ });
41
49
  this.cache = (0, import_cache.createCache)({
42
50
  ttl: 30,
43
51
  // seconds
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-visualization",
3
- "version": "0.14.0-alpha.6",
3
+ "version": "0.14.0-alpha.8",
4
4
  "displayName": "Data Visualization",
5
5
  "displayName.zh-CN": "数据可视化",
6
6
  "description": "Provides business intelligence and data visualization features",
@@ -33,5 +33,5 @@
33
33
  "@nocobase/test": "0.x",
34
34
  "@nocobase/utils": "0.x"
35
35
  },
36
- "gitHead": "7f2858222231c207030b57704a0bb6ebc98e4e45"
36
+ "gitHead": "59c82fef6e34707802b5841f5ec4d9b3b6b68abb"
37
37
  }
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const Settings: () => React.JSX.Element;
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import { ChartType } from './chart';
3
- export type ChartLibraries = {
4
- [library: string]: {
5
- enabled: boolean;
6
- charts: ChartType[];
7
- };
8
- };
9
- export declare const ChartLibraryContext: React.Context<ChartLibraries>;
10
- export declare const useCharts: () => {
11
- [name: string]: ChartType;
12
- };
13
- export declare const useChartTypes: () => {
14
- label: string;
15
- children: {
16
- key: string;
17
- label: string;
18
- value: string;
19
- }[];
20
- }[];
21
- export declare const useDefaultChartType: () => string;
22
- export declare const useToggleChartLibrary: () => {
23
- toggle: (library: string) => void;
24
- };
25
- export declare const ChartLibraryProvider: React.FC<{
26
- name: string;
27
- charts: ChartType[];
28
- }>;