@nocobase/plugin-data-visualization 2.1.0-alpha.12 → 2.1.0-alpha.14

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 (57) hide show
  1. package/dist/client/flow/models/ChartBlockModel.d.ts +1 -0
  2. package/dist/client/flow/models/ChartOptionsBuilder.d.ts +4 -0
  3. package/dist/client/flow/models/QueryBuilder.d.ts +1 -4
  4. package/dist/client/flow/resources/ChartResource.d.ts +1 -0
  5. package/dist/client/index.js +1 -1
  6. package/dist/externalVersion.js +12 -11
  7. package/dist/node_modules/koa-compose/package.json +1 -1
  8. package/dist/server/actions/query.d.ts +2 -4
  9. package/dist/server/actions/query.js +48 -183
  10. package/dist/server/plugin.d.ts +0 -2
  11. package/dist/server/plugin.js +2 -6
  12. package/dist/server/types.d.ts +3 -0
  13. package/package.json +4 -2
  14. package/dist/client/flow/components/AntdFilterSelector.d.ts +0 -35
  15. package/dist/node_modules/moment-timezone/LICENSE +0 -20
  16. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.js +0 -1548
  17. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.min.js +0 -1
  18. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.js +0 -1548
  19. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.min.js +0 -1
  20. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.js +0 -1560
  21. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.min.js +0 -1
  22. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.js +0 -1548
  23. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.min.js +0 -1
  24. package/dist/node_modules/moment-timezone/builds/moment-timezone.min.js +0 -1
  25. package/dist/node_modules/moment-timezone/composer.json +0 -43
  26. package/dist/node_modules/moment-timezone/data/meta/latest.json +0 -5889
  27. package/dist/node_modules/moment-timezone/data/packed/latest.json +0 -852
  28. package/dist/node_modules/moment-timezone/index.d.ts +0 -78
  29. package/dist/node_modules/moment-timezone/index.js +0 -15
  30. package/dist/node_modules/moment-timezone/moment-timezone-utils.d.ts +0 -70
  31. package/dist/node_modules/moment-timezone/moment-timezone-utils.js +0 -339
  32. package/dist/node_modules/moment-timezone/moment-timezone.js +0 -696
  33. package/dist/node_modules/moment-timezone/package.json +0 -1
  34. package/dist/server/flow-schema-contributions/index.d.ts +0 -10
  35. package/dist/server/flow-schema-contributions/index.js +0 -240
  36. package/dist/server/formatter/formatter.d.ts +0 -27
  37. package/dist/server/formatter/formatter.js +0 -85
  38. package/dist/server/formatter/mysql-formatter.d.ts +0 -14
  39. package/dist/server/formatter/mysql-formatter.js +0 -93
  40. package/dist/server/formatter/oracle-formatter.d.ts +0 -14
  41. package/dist/server/formatter/oracle-formatter.js +0 -74
  42. package/dist/server/formatter/postgres-formatter.d.ts +0 -14
  43. package/dist/server/formatter/postgres-formatter.js +0 -74
  44. package/dist/server/formatter/sqlite-formatter.d.ts +0 -15
  45. package/dist/server/formatter/sqlite-formatter.js +0 -83
  46. package/dist/server/query-parser/index.d.ts +0 -11
  47. package/dist/server/query-parser/index.js +0 -56
  48. package/dist/server/query-parser/mysql-query-parser.d.ts +0 -15
  49. package/dist/server/query-parser/mysql-query-parser.js +0 -43
  50. package/dist/server/query-parser/oracle-query-parser.d.ts +0 -18
  51. package/dist/server/query-parser/oracle-query-parser.js +0 -60
  52. package/dist/server/query-parser/postgres-query-parser.d.ts +0 -15
  53. package/dist/server/query-parser/postgres-query-parser.js +0 -43
  54. package/dist/server/query-parser/query-parser.d.ts +0 -31
  55. package/dist/server/query-parser/query-parser.js +0 -146
  56. package/dist/server/query-parser/sqlite-query-parser.d.ts +0 -15
  57. package/dist/server/query-parser/sqlite-query-parser.js +0 -43
@@ -8,18 +8,18 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.12",
11
+ "@nocobase/client": "2.1.0-alpha.14",
12
12
  "@formily/react": "2.3.7",
13
- "@nocobase/plugin-ai": "2.1.0-alpha.12",
14
- "@nocobase/flow-engine": "2.1.0-alpha.12",
13
+ "@nocobase/plugin-ai": "2.1.0-alpha.14",
14
+ "@nocobase/flow-engine": "2.1.0-alpha.14",
15
15
  "react-i18next": "11.18.6",
16
16
  "dayjs": "1.11.13",
17
17
  "@formily/shared": "2.3.7",
18
18
  "lodash": "4.17.21",
19
- "@nocobase/cache": "2.1.0-alpha.12",
20
- "@nocobase/server": "2.1.0-alpha.12",
21
- "@nocobase/test": "2.1.0-alpha.12",
22
- "@nocobase/utils": "2.1.0-alpha.12",
19
+ "@nocobase/cache": "2.1.0-alpha.14",
20
+ "@nocobase/server": "2.1.0-alpha.14",
21
+ "@nocobase/test": "2.1.0-alpha.14",
22
+ "@nocobase/utils": "2.1.0-alpha.14",
23
23
  "react": "18.2.0",
24
24
  "@emotion/css": "11.13.0",
25
25
  "@ant-design/icons": "5.6.1",
@@ -27,9 +27,10 @@ module.exports = {
27
27
  "antd": "5.24.2",
28
28
  "@formily/antd-v5": "1.2.3",
29
29
  "@formily/core": "2.3.7",
30
- "@nocobase/actions": "2.1.0-alpha.12",
31
- "@nocobase/database": "2.1.0-alpha.12",
32
- "@nocobase/acl": "2.1.0-alpha.12",
33
- "sequelize": "6.35.2",
30
+ "@nocobase/actions": "2.1.0-alpha.14",
31
+ "@nocobase/acl": "2.1.0-alpha.14",
32
+ "@nocobase/plugin-acl": "2.1.0-alpha.14",
33
+ "@nocobase/plugin-flow-engine": "2.1.0-alpha.14",
34
+ "@nocobase/database": "2.1.0-alpha.14",
34
35
  "@formily/reactive": "2.3.7"
35
36
  };
@@ -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":"2026-03-25T14:11:41.249Z"}
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":"2026-04-07T15:55:45.644Z"}
@@ -7,10 +7,8 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { Context, Next } from '@nocobase/actions';
10
- export declare const postProcess: (ctx: Context, next: Next) => Promise<void>;
10
+ export declare const checkPermission: (ctx: Context, next: Next) => Promise<void>;
11
11
  export declare const queryData: (ctx: Context, next: Next) => Promise<void>;
12
- export declare const parseFieldAndAssociations: (ctx: Context, next: Next) => Promise<void>;
13
12
  export declare const parseVariables: (ctx: Context, next: Next) => Promise<void>;
14
13
  export declare const cacheMiddleware: (ctx: Context, next: Next) => Promise<void>;
15
- export declare const checkPermission: (ctx: Context, next: Next) => Promise<any>;
16
- export declare const query: (ctx: Context, next: Next) => Promise<void>;
14
+ export declare const queryDataAction: (ctx: Context, next: Next) => Promise<void>;
@@ -38,164 +38,69 @@ var query_exports = {};
38
38
  __export(query_exports, {
39
39
  cacheMiddleware: () => cacheMiddleware,
40
40
  checkPermission: () => checkPermission,
41
- parseFieldAndAssociations: () => parseFieldAndAssociations,
42
41
  parseVariables: () => parseVariables,
43
- postProcess: () => postProcess,
44
- query: () => query,
45
- queryData: () => queryData
42
+ queryData: () => queryData,
43
+ queryDataAction: () => queryDataAction
46
44
  });
47
45
  module.exports = __toCommonJS(query_exports);
48
- var import_database = require("@nocobase/database");
49
46
  var import_koa_compose = __toESM(require("koa-compose"));
50
- var import_server = require("@nocobase/server");
51
- var import_query_parser = require("../query-parser");
52
- var import_utils = require("@nocobase/utils");
53
47
  var import_acl = require("@nocobase/acl");
48
+ var import_plugin_acl = require("@nocobase/plugin-acl");
49
+ var import_server = require("@nocobase/server");
50
+ var import_plugin_flow_engine = require("@nocobase/plugin-flow-engine");
54
51
  const getDB = (ctx, dataSource) => {
55
52
  const ds = ctx.app.dataSourceManager.dataSources.get(dataSource);
56
53
  return ds == null ? void 0 : ds.collectionManager.db;
57
54
  };
58
- const postProcess = async (ctx, next) => {
59
- const { data, fieldMap } = ctx.action.params.values;
60
- ctx.body = data.map((record) => {
61
- Object.entries(record).forEach(([key, value]) => {
62
- if (!value) {
63
- return;
64
- }
65
- const { type } = fieldMap[key] || {};
66
- switch (type) {
67
- case "bigInt":
68
- case "integer":
69
- case "float":
70
- case "double":
71
- case "decimal":
72
- record[key] = Number(value);
73
- break;
74
- }
55
+ const getTimezone = (ctx) => {
56
+ var _a, _b, _c, _d, _e, _f;
57
+ return ((_b = (_a = ctx == null ? void 0 : ctx.request) == null ? void 0 : _a.get) == null ? void 0 : _b.call(_a, "x-timezone")) ?? ((_d = (_c = ctx == null ? void 0 : ctx.request) == null ? void 0 : _c.header) == null ? void 0 : _d["x-timezone"]) ?? ((_f = (_e = ctx == null ? void 0 : ctx.req) == null ? void 0 : _e.headers) == null ? void 0 : _f["x-timezone"]);
58
+ };
59
+ const checkPermission = async (ctx, next) => {
60
+ var _a, _b, _c, _d;
61
+ const values = ctx.action.params.values || {};
62
+ const acl = ((_a = ctx.app.dataSourceManager.get(values.dataSource)) == null ? void 0 : _a.acl) || ctx.app.acl;
63
+ try {
64
+ const result = await (0, import_plugin_acl.applyQueryPermission)({
65
+ acl,
66
+ db: getDB(ctx, values.dataSource) || ctx.db,
67
+ resourceName: values.collection,
68
+ query: values,
69
+ currentUser: (_b = ctx.state) == null ? void 0 : _b.currentUser,
70
+ currentRole: (_c = ctx.state) == null ? void 0 : _c.currentRole,
71
+ currentRoles: (_d = ctx.state) == null ? void 0 : _d.currentRoles,
72
+ timezone: getTimezone(ctx),
73
+ state: ctx.state
75
74
  });
76
- return record;
77
- });
75
+ ctx.action.params.values = result.query;
76
+ } catch (err) {
77
+ if (!(err instanceof import_acl.NoPermissionError)) {
78
+ throw err;
79
+ }
80
+ ctx.throw(403, "No permissions");
81
+ }
78
82
  await next();
79
83
  };
80
84
  const queryData = async (ctx, next) => {
81
- const { dataSource, collection, queryParams, fieldMap } = ctx.action.params.values;
82
- const db = getDB(ctx, dataSource) || ctx.db;
83
- const model = db.getModel(collection);
84
- const data = await model.findAll(queryParams);
85
- ctx.action.params.values = {
86
- data,
87
- fieldMap
88
- };
89
- await next();
90
- };
91
- const parseFieldAndAssociations = async (ctx, next) => {
92
85
  var _a;
93
- const {
94
- dataSource,
95
- collection: collectionName,
96
- measures,
97
- dimensions,
98
- orders,
99
- filter
100
- } = ctx.action.params.values;
86
+ const { dataSource, collection, ...queryOptions } = ctx.action.params.values;
101
87
  const db = getDB(ctx, dataSource) || ctx.db;
102
- const collection = db.getCollection(collectionName);
103
- const fields = collection.fields;
104
- const associations = collection.model.associations;
105
- const models = {};
106
- const parseField = (selected) => {
107
- var _a2, _b, _c, _d, _e, _f;
108
- let target;
109
- let name;
110
- if (!Array.isArray(selected.field)) {
111
- name = selected.field;
112
- } else if (selected.field.length === 1) {
113
- name = selected.field[0];
114
- } else if (selected.field.length > 1) {
115
- [target, name] = selected.field;
116
- }
117
- const rawAttributes = collection.model.getAttributes();
118
- let field = ((_a2 = rawAttributes[name]) == null ? void 0 : _a2.field) || name;
119
- let fieldType = (_b = fields.get(name)) == null ? void 0 : _b.type;
120
- let fieldOptions = (_c = fields.get(name)) == null ? void 0 : _c.options;
121
- if (target) {
122
- const targetField = fields.get(target);
123
- const targetCollection = db.getCollection(targetField.target);
124
- const targetFields = targetCollection.fields;
125
- fieldType = (_d = targetFields.get(name)) == null ? void 0 : _d.type;
126
- fieldOptions = (_e = targetFields.get(name)) == null ? void 0 : _e.options;
127
- field = `${target}.${field}`;
128
- name = `${target}.${name}`;
129
- const targetType = (_f = fields.get(target)) == null ? void 0 : _f.type;
130
- if (!models[target]) {
131
- models[target] = { type: targetType };
132
- }
133
- } else {
134
- field = `${collectionName}.${field}`;
135
- }
136
- return {
137
- ...selected,
138
- field,
139
- name,
140
- type: fieldType,
141
- options: fieldOptions,
142
- alias: selected.alias || name
143
- };
144
- };
145
- const parsedMeasures = (measures == null ? void 0 : measures.map(parseField)) || [];
146
- const parsedDimensions = (dimensions == null ? void 0 : dimensions.map(parseField)) || [];
147
- const parsedOrders = (orders == null ? void 0 : orders.map(parseField)) || [];
148
- const include = Object.entries(models).map(([target, { type }]) => {
149
- let options = {
150
- association: target,
151
- attributes: []
152
- };
153
- if (type === "belongsToMany") {
154
- options["through"] = { attributes: [] };
155
- }
156
- if (type === "belongsToArray") {
157
- const association = associations[target];
158
- if (association) {
159
- options = {
160
- ...options,
161
- ...association.generateInclude()
162
- };
163
- }
164
- }
165
- return options;
166
- });
167
- const filterParser = new import_database.FilterParser(filter, {
168
- collection
88
+ const repository = db.getRepository(collection);
89
+ ctx.body = await repository.query({
90
+ ...queryOptions,
91
+ timezone: (_a = ctx.get) == null ? void 0 : _a.call(ctx, "x-timezone")
169
92
  });
170
- const { where, include: filterInclude } = filterParser.toSequelizeParams();
171
- if (filterInclude) {
172
- const stack = [...filterInclude];
173
- while (stack.length) {
174
- const item = stack.pop();
175
- const parentCollection = db.getCollection(item.parentCollection || collectionName);
176
- const field = parentCollection.fields.get(item.association);
177
- if ((field == null ? void 0 : field.type) === "belongsToMany") {
178
- item.through = { attributes: [] };
179
- }
180
- if ((field == null ? void 0 : field.target) && ((_a = item.include) == null ? void 0 : _a.length)) {
181
- for (const child of item.include) {
182
- child.parentCollection = field.target;
183
- stack.push(child);
184
- }
185
- }
186
- }
187
- }
188
- ctx.action.params.values = {
189
- ...ctx.action.params.values,
190
- where,
191
- measures: parsedMeasures,
192
- dimensions: parsedDimensions,
193
- orders: parsedOrders,
194
- include: [...include, ...filterInclude || []]
195
- };
196
93
  await next();
197
94
  };
198
95
  const parseVariables = async (ctx, next) => {
96
+ const { mode, contextParams, ...values } = ctx.action.params.values;
97
+ if (mode !== "sql") {
98
+ const resolvedValues = await (0, import_plugin_flow_engine.resolveVariablesTemplate)(ctx, values, contextParams || {});
99
+ ctx.action.params.values = {
100
+ ...ctx.action.params.values,
101
+ ...resolvedValues
102
+ };
103
+ }
199
104
  const { filter } = ctx.action.params.values;
200
105
  ctx.action.params.filter = filter;
201
106
  await import_server.middlewares.parseVariables(ctx, async () => {
@@ -219,47 +124,9 @@ const cacheMiddleware = async (ctx, next) => {
219
124
  await cache.set(uid, ctx.body, (cacheConfig == null ? void 0 : cacheConfig.ttl) * 1e3);
220
125
  }
221
126
  };
222
- const checkPermission = async (ctx, next) => {
223
- var _a, _b, _c;
224
- const { collection, dataSource } = ctx.action.params.values;
225
- const roleNames = ctx.state.currentRoles || ["anonymous"];
226
- const acl = ((_a = ctx.app.dataSourceManager.get(dataSource)) == null ? void 0 : _a.acl) || ctx.app.acl;
227
- const can = acl.can({ roles: roleNames, resource: collection, action: "list" });
228
- if (!can && !roleNames.includes("root")) {
229
- ctx.throw(403, "No permissions");
230
- }
231
- if ((_b = can == null ? void 0 : can.params) == null ? void 0 : _b.filter) {
232
- try {
233
- (0, import_acl.checkFilterParams)(ctx.database.getCollection(collection), (_c = can.params) == null ? void 0 : _c.filter);
234
- } catch (e) {
235
- if (e instanceof import_acl.NoPermissionError) {
236
- ctx.throw(403, "No permissions");
237
- }
238
- }
239
- const filter = ctx.action.params.values.filter || {};
240
- ctx.action.params.values = {
241
- ...ctx.action.params.values,
242
- filter: (0, import_utils.assign)(filter, can == null ? void 0 : can.params.filter, {
243
- filter: "andMerge"
244
- })
245
- };
246
- }
247
- return next();
248
- };
249
- const query = async (ctx, next) => {
250
- const { dataSource } = ctx.action.params.values;
251
- const db = getDB(ctx, dataSource) || ctx.db;
252
- const queryParser = (0, import_query_parser.createQueryParser)(db);
127
+ const queryDataAction = async (ctx, next) => {
253
128
  try {
254
- await (0, import_koa_compose.default)([
255
- checkPermission,
256
- cacheMiddleware,
257
- parseVariables,
258
- parseFieldAndAssociations,
259
- queryParser.parse(),
260
- queryData,
261
- postProcess
262
- ])(ctx, next);
129
+ await (0, import_koa_compose.default)([checkPermission, cacheMiddleware, parseVariables, queryData])(ctx, next);
263
130
  } catch (err) {
264
131
  ctx.throw(500, err);
265
132
  }
@@ -268,9 +135,7 @@ const query = async (ctx, next) => {
268
135
  0 && (module.exports = {
269
136
  cacheMiddleware,
270
137
  checkPermission,
271
- parseFieldAndAssociations,
272
138
  parseVariables,
273
- postProcess,
274
- query,
275
- queryData
139
+ queryData,
140
+ queryDataAction
276
141
  });
@@ -7,11 +7,9 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { Cache } from '@nocobase/cache';
10
- import type { FlowSchemaContribution } from '@nocobase/flow-engine';
11
10
  import { InstallOptions, Plugin } from '@nocobase/server';
12
11
  export declare class PluginDataVisualizationServer extends Plugin {
13
12
  cache: Cache;
14
- getFlowSchemaContributions(): FlowSchemaContribution;
15
13
  afterAdd(): void;
16
14
  beforeLoad(): void;
17
15
  load(): Promise<void>;
@@ -32,22 +32,18 @@ __export(plugin_exports, {
32
32
  module.exports = __toCommonJS(plugin_exports);
33
33
  var import_server = require("@nocobase/server");
34
34
  var import_query = require("./actions/query");
35
- var import_flow_schema_contributions = require("./flow-schema-contributions");
36
35
  class PluginDataVisualizationServer extends import_server.Plugin {
37
36
  cache;
38
- getFlowSchemaContributions() {
39
- return import_flow_schema_contributions.flowSchemaContribution;
40
- }
41
37
  afterAdd() {
42
38
  }
43
39
  beforeLoad() {
44
40
  this.app.resourceManager.define({
45
41
  name: "charts",
46
42
  actions: {
47
- query: import_query.query
43
+ queryData: import_query.queryDataAction
48
44
  }
49
45
  });
50
- this.app.acl.allow("charts", "query", "loggedIn");
46
+ this.app.acl.allow("charts", "queryData", "loggedIn");
51
47
  }
52
48
  async load() {
53
49
  this.cache = await this.app.cacheManager.createCache({
@@ -28,12 +28,15 @@ export type OrderProps = {
28
28
  };
29
29
  export type QueryParams = Partial<{
30
30
  uid: string;
31
+ mode: 'builder' | 'sql';
31
32
  dataSource: string;
32
33
  collection: string;
33
34
  measures: MeasureProps[];
34
35
  dimensions: DimensionProps[];
35
36
  orders: OrderProps[];
36
37
  filter: any;
38
+ having: any;
39
+ contextParams: Record<string, unknown>;
37
40
  limit: number;
38
41
  offset: number;
39
42
  sql: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-visualization",
3
- "version": "2.1.0-alpha.12",
3
+ "version": "2.1.0-alpha.14",
4
4
  "displayName": "Data visualization",
5
5
  "displayName.ru-RU": "Визуализация данных",
6
6
  "displayName.zh-CN": "数据可视化",
@@ -40,13 +40,15 @@
40
40
  "@nocobase/cache": "2.x",
41
41
  "@nocobase/client": "2.x",
42
42
  "@nocobase/database": "2.x",
43
+ "@nocobase/plugin-acl": "2.x",
43
44
  "@nocobase/plugin-ai": "2.x",
44
45
  "@nocobase/plugin-data-source-main": "2.x",
46
+ "@nocobase/plugin-flow-engine": "2.x",
45
47
  "@nocobase/server": "2.x",
46
48
  "@nocobase/test": "2.x",
47
49
  "@nocobase/utils": "2.x"
48
50
  },
49
- "gitHead": "f12c4a75470590b1670ce54510b96ef94c2cd7a2",
51
+ "gitHead": "d8735b541de0ff9557bba704de49c799b4962672",
50
52
  "keywords": [
51
53
  "Blocks"
52
54
  ],
@@ -1,35 +0,0 @@
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;
@@ -1,20 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) JS Foundation and other contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.