@nocobase/plugin-charts 0.9.1-alpha.2 → 0.9.2-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/lib/client/ChartBlockEngine.js +17 -71
- package/lib/client/ChartBlockEngineDesigner.js +13 -73
- package/lib/client/ChartBlockInitializer.js +16 -72
- package/lib/client/ChartQueryBlockInitializer.js +18 -65
- package/lib/client/ChartQueryMetadataProvider.js +1 -28
- package/lib/client/DataSetPreviewTable.js +14 -28
- package/lib/client/Icons.js +3 -19
- package/lib/client/chartRenderComponents/index.js +0 -6
- package/lib/client/hooks/index.js +4 -18
- package/lib/client/index.js +0 -33
- package/lib/client/locale/index.js +2 -11
- package/lib/client/locale/pt-BR.d.ts +23 -0
- package/lib/client/locale/pt-BR.js +29 -0
- package/lib/client/select/CustomSelect.js +9 -47
- package/lib/client/select/ReadPretty.js +3 -30
- package/lib/client/select/index.js +0 -4
- package/lib/client/select/shared.js +4 -24
- package/lib/client/settings/AddNewQuery.js +22 -81
- package/lib/client/settings/ConfigureFields.js +0 -12
- package/lib/client/settings/QueriesTable.js +5 -36
- package/lib/client/settings/queryTypes.js +0 -7
- package/lib/client/settings/schemas/chartsQueries.js +12 -37
- package/lib/client/templates/AreaTemplate.js +0 -5
- package/lib/client/templates/BarTemplate.js +0 -5
- package/lib/client/templates/ColumnTemplate.js +0 -5
- package/lib/client/templates/FunnelTemplate.js +0 -5
- package/lib/client/templates/LineTemplate.js +4 -7
- package/lib/client/templates/PieTemplate.js +0 -5
- package/lib/client/templates/RadarTemplate.js +0 -5
- package/lib/client/templates/ScatterTemplate.js +0 -5
- package/lib/client/templates/index.js +2 -10
- package/lib/client/utils.js +0 -16
- package/lib/index.js +0 -2
- package/lib/server/actions/chartsQueries.js +16 -31
- package/lib/server/collections/chartsQueries.js +2 -5
- package/lib/server/index.js +0 -2
- package/lib/server/plugin.js +0 -36
- package/lib/server/query.js +5 -25
- package/package.json +5 -5
- package/src/client/DataSetPreviewTable.tsx +8 -1
- package/src/client/locale/pt-BR.ts +23 -0
- package/src/server/actions/chartsQueries.ts +11 -6
- package/src/server/collections/chartsQueries.ts +2 -0
|
@@ -4,29 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getCurrentOptions = exports.defaultFieldNames = void 0;
|
|
7
|
-
|
|
8
7
|
function _lodash() {
|
|
9
8
|
const data = require("lodash");
|
|
10
|
-
|
|
11
9
|
_lodash = function _lodash() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
19
|
-
|
|
20
15
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
-
|
|
22
16
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
23
|
-
|
|
24
17
|
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; }
|
|
25
|
-
|
|
26
18
|
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; }
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
19
|
+
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; }
|
|
20
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
21
|
+
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); }
|
|
30
22
|
const defaultFieldNames = {
|
|
31
23
|
label: 'label',
|
|
32
24
|
value: 'value',
|
|
@@ -34,34 +26,25 @@ const defaultFieldNames = {
|
|
|
34
26
|
options: 'children'
|
|
35
27
|
};
|
|
36
28
|
exports.defaultFieldNames = defaultFieldNames;
|
|
37
|
-
|
|
38
29
|
const getCurrentOptions = (values, dataSource, fieldNames) => {
|
|
39
30
|
function flatData(data) {
|
|
40
31
|
let newArr = [];
|
|
41
|
-
|
|
42
32
|
for (let i = 0; i < data.length; i++) {
|
|
43
33
|
const children = data[i][fieldNames.options];
|
|
44
|
-
|
|
45
34
|
if (Array.isArray(children)) {
|
|
46
35
|
newArr.push(...flatData(children));
|
|
47
36
|
}
|
|
48
|
-
|
|
49
37
|
newArr.push(_objectSpread({}, data[i]));
|
|
50
38
|
}
|
|
51
|
-
|
|
52
39
|
return newArr;
|
|
53
40
|
}
|
|
54
|
-
|
|
55
41
|
const result = flatData(dataSource);
|
|
56
42
|
values = (0, _lodash().castArray)(values).filter(item => item != null).map(val => typeof val === 'object' ? val[fieldNames.value] : val);
|
|
57
|
-
|
|
58
43
|
const findOptions = options => {
|
|
59
44
|
if (!options) return [];
|
|
60
45
|
let current = [];
|
|
61
|
-
|
|
62
46
|
var _iterator = _createForOfIteratorHelper(values),
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
_step;
|
|
65
48
|
try {
|
|
66
49
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
67
50
|
const value = _step.value;
|
|
@@ -76,11 +59,8 @@ const getCurrentOptions = (values, dataSource, fieldNames) => {
|
|
|
76
59
|
} finally {
|
|
77
60
|
_iterator.f();
|
|
78
61
|
}
|
|
79
|
-
|
|
80
62
|
return current;
|
|
81
63
|
};
|
|
82
|
-
|
|
83
64
|
return findOptions(result);
|
|
84
65
|
};
|
|
85
|
-
|
|
86
66
|
exports.getCurrentOptions = getCurrentOptions;
|
|
@@ -4,115 +4,76 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.EditQuery = exports.AddNewQuery = void 0;
|
|
7
|
-
|
|
8
7
|
function _icons() {
|
|
9
8
|
const data = require("@ant-design/icons");
|
|
10
|
-
|
|
11
9
|
_icons = function _icons() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _core() {
|
|
19
15
|
const data = require("@formily/core");
|
|
20
|
-
|
|
21
16
|
_core = function _core() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _react() {
|
|
29
22
|
const data = require("@formily/react");
|
|
30
|
-
|
|
31
23
|
_react = function _react() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _shared() {
|
|
39
29
|
const data = require("@formily/shared");
|
|
40
|
-
|
|
41
30
|
_shared = function _shared() {
|
|
42
31
|
return data;
|
|
43
32
|
};
|
|
44
|
-
|
|
45
33
|
return data;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
function _client() {
|
|
49
36
|
const data = require("@nocobase/client");
|
|
50
|
-
|
|
51
37
|
_client = function _client() {
|
|
52
38
|
return data;
|
|
53
39
|
};
|
|
54
|
-
|
|
55
40
|
return data;
|
|
56
41
|
}
|
|
57
|
-
|
|
58
42
|
function _antd() {
|
|
59
43
|
const data = require("antd");
|
|
60
|
-
|
|
61
44
|
_antd = function _antd() {
|
|
62
45
|
return data;
|
|
63
46
|
};
|
|
64
|
-
|
|
65
47
|
return data;
|
|
66
48
|
}
|
|
67
|
-
|
|
68
49
|
function _react2() {
|
|
69
50
|
const data = _interopRequireWildcard(require("react"));
|
|
70
|
-
|
|
71
51
|
_react2 = function _react2() {
|
|
72
52
|
return data;
|
|
73
53
|
};
|
|
74
|
-
|
|
75
54
|
return data;
|
|
76
55
|
}
|
|
77
|
-
|
|
78
56
|
var _ChartQueryMetadataProvider = require("../ChartQueryMetadataProvider");
|
|
79
|
-
|
|
80
57
|
var _queryTypes = require("./queryTypes");
|
|
81
|
-
|
|
82
58
|
var _locale = require("../locale");
|
|
83
|
-
|
|
84
59
|
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); }
|
|
85
|
-
|
|
86
60
|
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; }
|
|
87
|
-
|
|
88
61
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
89
|
-
|
|
90
62
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
91
|
-
|
|
92
63
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
93
|
-
|
|
94
64
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
95
|
-
|
|
96
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
97
|
-
|
|
65
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
98
66
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
99
|
-
|
|
100
67
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
101
|
-
|
|
102
68
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
103
|
-
|
|
104
69
|
const useCreateAction = () => {
|
|
105
70
|
const _useActionContext = (0, _client().useActionContext)(),
|
|
106
|
-
|
|
107
|
-
|
|
71
|
+
setVisible = _useActionContext.setVisible;
|
|
108
72
|
const form = (0, _react().useForm)();
|
|
109
|
-
|
|
110
73
|
const _useResourceActionCon = (0, _client().useResourceActionContext)(),
|
|
111
|
-
|
|
112
|
-
|
|
74
|
+
refresh = _useResourceActionCon.refresh;
|
|
113
75
|
const _useResourceContext = (0, _client().useResourceContext)(),
|
|
114
|
-
|
|
115
|
-
|
|
76
|
+
resource = _useResourceContext.resource;
|
|
116
77
|
const ctx = (0, _ChartQueryMetadataProvider.useChartQueryMetadataContext)();
|
|
117
78
|
return {
|
|
118
79
|
run() {
|
|
@@ -127,26 +88,19 @@ const useCreateAction = () => {
|
|
|
127
88
|
ctx.refresh();
|
|
128
89
|
})();
|
|
129
90
|
}
|
|
130
|
-
|
|
131
91
|
};
|
|
132
92
|
};
|
|
133
|
-
|
|
134
93
|
const useUpdateAction = () => {
|
|
135
94
|
const _useActionContext2 = (0, _client().useActionContext)(),
|
|
136
|
-
|
|
137
|
-
|
|
95
|
+
setVisible = _useActionContext2.setVisible;
|
|
138
96
|
const form = (0, _react().useForm)();
|
|
139
|
-
|
|
140
97
|
const _useResourceActionCon2 = (0, _client().useResourceActionContext)(),
|
|
141
|
-
|
|
142
|
-
|
|
98
|
+
refresh = _useResourceActionCon2.refresh;
|
|
143
99
|
const _useResourceContext2 = (0, _client().useResourceContext)(),
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
100
|
+
resource = _useResourceContext2.resource,
|
|
101
|
+
targetKey = _useResourceContext2.targetKey;
|
|
147
102
|
const _useRecord = (0, _client().useRecord)(),
|
|
148
|
-
|
|
149
|
-
|
|
103
|
+
filterByTk = _useRecord[targetKey];
|
|
150
104
|
const ctx = (0, _ChartQueryMetadataProvider.useChartQueryMetadataContext)();
|
|
151
105
|
return {
|
|
152
106
|
run() {
|
|
@@ -162,24 +116,19 @@ const useUpdateAction = () => {
|
|
|
162
116
|
ctx.refresh();
|
|
163
117
|
})();
|
|
164
118
|
}
|
|
165
|
-
|
|
166
119
|
};
|
|
167
120
|
};
|
|
168
|
-
|
|
169
121
|
const useCloseAction = () => {
|
|
170
122
|
const _useActionContext3 = (0, _client().useActionContext)(),
|
|
171
|
-
|
|
172
|
-
|
|
123
|
+
setVisible = _useActionContext3.setVisible;
|
|
173
124
|
return {
|
|
174
125
|
run() {
|
|
175
126
|
return _asyncToGenerator(function* () {
|
|
176
127
|
setVisible(false);
|
|
177
128
|
})();
|
|
178
129
|
}
|
|
179
|
-
|
|
180
130
|
};
|
|
181
131
|
};
|
|
182
|
-
|
|
183
132
|
const getSchema = (initialValue, {
|
|
184
133
|
form,
|
|
185
134
|
isNewRecord
|
|
@@ -191,9 +140,10 @@ const getSchema = (initialValue, {
|
|
|
191
140
|
'x-component': 'Action.Drawer',
|
|
192
141
|
'x-decorator': 'Form',
|
|
193
142
|
'x-decorator-props': {
|
|
194
|
-
form
|
|
195
|
-
|
|
143
|
+
form
|
|
144
|
+
// initialValue: JSON.parse(JSON.stringify(initialValue)),
|
|
196
145
|
},
|
|
146
|
+
|
|
197
147
|
title: isNewRecord ? (0, _locale.lang)('Add query') : (0, _locale.lang)('Edit query'),
|
|
198
148
|
properties: {
|
|
199
149
|
title: {
|
|
@@ -228,20 +178,16 @@ const getSchema = (initialValue, {
|
|
|
228
178
|
};
|
|
229
179
|
return schema;
|
|
230
180
|
};
|
|
231
|
-
|
|
232
181
|
const AddNewQuery = () => {
|
|
233
182
|
const _useState = (0, _react2().useState)(false),
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
183
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
184
|
+
visible = _useState2[0],
|
|
185
|
+
setVisible = _useState2[1];
|
|
238
186
|
const _useState3 = (0, _react2().useState)({}),
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
187
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
188
|
+
schema = _useState4[0],
|
|
189
|
+
setSchema = _useState4[1];
|
|
243
190
|
const form = (0, _react2().useMemo)(() => (0, _core().createForm)(), []);
|
|
244
|
-
|
|
245
191
|
const menu = _react2().default.createElement(_antd().Menu, {
|
|
246
192
|
onClick: info => {
|
|
247
193
|
setVisible(true);
|
|
@@ -265,7 +211,6 @@ const AddNewQuery = () => {
|
|
|
265
211
|
}, "API"), _react2().default.createElement(_antd().Menu.Item, {
|
|
266
212
|
disabled: true
|
|
267
213
|
}, "Collection"));
|
|
268
|
-
|
|
269
214
|
return _react2().default.createElement(_client().ActionContext.Provider, {
|
|
270
215
|
value: {
|
|
271
216
|
visible,
|
|
@@ -284,15 +229,12 @@ const AddNewQuery = () => {
|
|
|
284
229
|
}
|
|
285
230
|
}));
|
|
286
231
|
};
|
|
287
|
-
|
|
288
232
|
exports.AddNewQuery = AddNewQuery;
|
|
289
|
-
|
|
290
233
|
const EditQuery = () => {
|
|
291
234
|
const _useState5 = (0, _react2().useState)(false),
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
235
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
236
|
+
visible = _useState6[0],
|
|
237
|
+
setVisible = _useState6[1];
|
|
296
238
|
const record = (0, _client().useRecord)();
|
|
297
239
|
const form = (0, _react2().useMemo)(() => (0, _core().createForm)(), []);
|
|
298
240
|
const schema = getSchema(record, {
|
|
@@ -317,5 +259,4 @@ const EditQuery = () => {
|
|
|
317
259
|
}
|
|
318
260
|
}));
|
|
319
261
|
};
|
|
320
|
-
|
|
321
262
|
exports.EditQuery = EditQuery;
|
|
@@ -4,39 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ConfigureFields = void 0;
|
|
7
|
-
|
|
8
7
|
function _client() {
|
|
9
8
|
const data = require("@nocobase/client");
|
|
10
|
-
|
|
11
9
|
_client = function _client() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _antd() {
|
|
19
15
|
const data = require("antd");
|
|
20
|
-
|
|
21
16
|
_antd = function _antd() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _react() {
|
|
29
22
|
const data = _interopRequireDefault(require("react"));
|
|
30
|
-
|
|
31
23
|
_react = function _react() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
|
-
|
|
40
29
|
const ConfigureFields = () => {
|
|
41
30
|
const record = (0, _client().useRecord)();
|
|
42
31
|
return _react().default.createElement(_antd().Table, {
|
|
@@ -47,5 +36,4 @@ const ConfigureFields = () => {
|
|
|
47
36
|
dataSource: record.fields || []
|
|
48
37
|
});
|
|
49
38
|
};
|
|
50
|
-
|
|
51
39
|
exports.ConfigureFields = ConfigureFields;
|
|
@@ -4,90 +4,60 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.QueriesTable = void 0;
|
|
7
|
-
|
|
8
7
|
function _client() {
|
|
9
8
|
const data = require("@nocobase/client");
|
|
10
|
-
|
|
11
9
|
_client = function _client() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _antd() {
|
|
19
15
|
const data = require("antd");
|
|
20
|
-
|
|
21
16
|
_antd = function _antd() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function _react() {
|
|
29
22
|
const data = _interopRequireWildcard(require("react"));
|
|
30
|
-
|
|
31
23
|
_react = function _react() {
|
|
32
24
|
return data;
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
return data;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
function _reactI18next() {
|
|
39
29
|
const data = require("react-i18next");
|
|
40
|
-
|
|
41
30
|
_reactI18next = function _reactI18next() {
|
|
42
31
|
return data;
|
|
43
32
|
};
|
|
44
|
-
|
|
45
33
|
return data;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
var _AddNewQuery = require("./AddNewQuery");
|
|
49
|
-
|
|
50
36
|
var _ConfigureFields = require("./ConfigureFields");
|
|
51
|
-
|
|
52
37
|
var _chartsQueries = require("./schemas/chartsQueries");
|
|
53
|
-
|
|
54
38
|
function _json() {
|
|
55
39
|
const data = _interopRequireDefault(require("json5"));
|
|
56
|
-
|
|
57
40
|
_json = function _json() {
|
|
58
41
|
return data;
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
return data;
|
|
62
44
|
}
|
|
63
|
-
|
|
64
45
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
65
|
-
|
|
66
46
|
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); }
|
|
67
|
-
|
|
68
47
|
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; }
|
|
69
|
-
|
|
70
48
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
71
|
-
|
|
72
49
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
73
|
-
|
|
74
50
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
75
|
-
|
|
76
51
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
77
|
-
|
|
78
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
79
|
-
|
|
52
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
80
53
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
81
|
-
|
|
82
54
|
const QueriesTable = () => {
|
|
83
55
|
const _useState = (0, _react().useState)(false),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
+
visible = _useState2[0],
|
|
58
|
+
setVisible = _useState2[1];
|
|
88
59
|
const _useTranslation = (0, _reactI18next().useTranslation)(),
|
|
89
|
-
|
|
90
|
-
|
|
60
|
+
t = _useTranslation.t;
|
|
91
61
|
return _react().default.createElement(_antd().Card, {
|
|
92
62
|
bordered: false
|
|
93
63
|
}, _react().default.createElement(_client().SchemaComponent, {
|
|
@@ -104,5 +74,4 @@ const QueriesTable = () => {
|
|
|
104
74
|
}
|
|
105
75
|
}));
|
|
106
76
|
};
|
|
107
|
-
|
|
108
77
|
exports.QueriesTable = QueriesTable;
|
|
@@ -4,19 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.sql = exports.json = exports.getQueryTypeSchema = exports.api = void 0;
|
|
7
|
-
|
|
8
7
|
function _cloneDeep() {
|
|
9
8
|
const data = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
10
|
-
|
|
11
9
|
_cloneDeep = function _cloneDeep() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
15
|
const json = {
|
|
21
16
|
type: 'object',
|
|
22
17
|
properties: {
|
|
@@ -77,9 +72,7 @@ const types = {
|
|
|
77
72
|
sql,
|
|
78
73
|
api
|
|
79
74
|
};
|
|
80
|
-
|
|
81
75
|
const getQueryTypeSchema = type => {
|
|
82
76
|
return (0, _cloneDeep().default)(types[type]);
|
|
83
77
|
};
|
|
84
|
-
|
|
85
78
|
exports.getQueryTypeSchema = getQueryTypeSchema;
|
|
@@ -4,39 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useDestroyQueryItemAction = exports.useDestroyAllSelectedQueriesAction = exports.chartsQueriesSchema = void 0;
|
|
7
|
-
|
|
8
7
|
function _shared() {
|
|
9
8
|
const data = require("@formily/shared");
|
|
10
|
-
|
|
11
9
|
_shared = function _shared() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _client() {
|
|
19
15
|
const data = require("@nocobase/client");
|
|
20
|
-
|
|
21
16
|
_client = function _client() {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
var _ChartQueryMetadataProvider = require("../../ChartQueryMetadataProvider");
|
|
29
|
-
|
|
30
22
|
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; }
|
|
31
|
-
|
|
32
23
|
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; }
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
24
|
+
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; }
|
|
25
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
26
|
+
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); }
|
|
36
27
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
37
|
-
|
|
38
28
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
39
|
-
|
|
40
29
|
const collection = {
|
|
41
30
|
name: 'chartsQueries',
|
|
42
31
|
fields: [{
|
|
@@ -71,20 +60,15 @@ const collection = {
|
|
|
71
60
|
}
|
|
72
61
|
}]
|
|
73
62
|
};
|
|
74
|
-
|
|
75
63
|
const useDestroyQueryItemAction = () => {
|
|
76
64
|
const ctx = (0, _ChartQueryMetadataProvider.useChartQueryMetadataContext)();
|
|
77
|
-
|
|
78
65
|
const _useResourceActionCon = (0, _client().useResourceActionContext)(),
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
refresh = _useResourceActionCon.refresh;
|
|
81
67
|
const _useResourceContext = (0, _client().useResourceContext)(),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
resource = _useResourceContext.resource,
|
|
69
|
+
targetKey = _useResourceContext.targetKey;
|
|
85
70
|
const _useRecord = (0, _client().useRecord)(),
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
filterByTk = _useRecord[targetKey];
|
|
88
72
|
return {
|
|
89
73
|
run() {
|
|
90
74
|
return _asyncToGenerator(function* () {
|
|
@@ -95,24 +79,18 @@ const useDestroyQueryItemAction = () => {
|
|
|
95
79
|
ctx.refresh();
|
|
96
80
|
})();
|
|
97
81
|
}
|
|
98
|
-
|
|
99
82
|
};
|
|
100
83
|
};
|
|
101
|
-
|
|
102
84
|
exports.useDestroyQueryItemAction = useDestroyQueryItemAction;
|
|
103
|
-
|
|
104
85
|
const useDestroyAllSelectedQueriesAction = () => {
|
|
105
86
|
const ctx = (0, _ChartQueryMetadataProvider.useChartQueryMetadataContext)();
|
|
106
|
-
|
|
107
87
|
const _useResourceActionCon2 = (0, _client().useResourceActionContext)(),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
88
|
+
state = _useResourceActionCon2.state,
|
|
89
|
+
setState = _useResourceActionCon2.setState,
|
|
90
|
+
refresh = _useResourceActionCon2.refresh;
|
|
112
91
|
const _useResourceContext2 = (0, _client().useResourceContext)(),
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
92
|
+
resource = _useResourceContext2.resource,
|
|
93
|
+
targetKey = _useResourceContext2.targetKey;
|
|
116
94
|
return {
|
|
117
95
|
run() {
|
|
118
96
|
return _asyncToGenerator(function* () {
|
|
@@ -126,10 +104,8 @@ const useDestroyAllSelectedQueriesAction = () => {
|
|
|
126
104
|
ctx.refresh();
|
|
127
105
|
})();
|
|
128
106
|
}
|
|
129
|
-
|
|
130
107
|
};
|
|
131
108
|
};
|
|
132
|
-
|
|
133
109
|
exports.useDestroyAllSelectedQueriesAction = useDestroyAllSelectedQueriesAction;
|
|
134
110
|
const chartsQueriesSchema = {
|
|
135
111
|
type: 'object',
|
|
@@ -199,7 +175,6 @@ const chartsQueriesSchema = {
|
|
|
199
175
|
refreshDeps: [ctx.visible]
|
|
200
176
|
}));
|
|
201
177
|
}
|
|
202
|
-
|
|
203
178
|
},
|
|
204
179
|
title: '{{t("Add query",{ns:"charts"})}}',
|
|
205
180
|
properties: {
|
|
@@ -4,19 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.areaTemplate = void 0;
|
|
7
|
-
|
|
8
7
|
function _json() {
|
|
9
8
|
const data = _interopRequireDefault(require("json5"));
|
|
10
|
-
|
|
11
9
|
_json = function _json() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
15
|
const chartConfig = {
|
|
21
16
|
yField: '{{metric}}',
|
|
22
17
|
xField: '{{dimension}}',
|
|
@@ -4,19 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.barTemplate = void 0;
|
|
7
|
-
|
|
8
7
|
function _json() {
|
|
9
8
|
const data = _interopRequireDefault(require("json5"));
|
|
10
|
-
|
|
11
9
|
_json = function _json() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
15
|
const chartConfig = {
|
|
21
16
|
appendPadding: 10,
|
|
22
17
|
isGroup: true,
|