@nocobase/plugin-charts 0.9.1-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/client.d.ts +4 -0
- package/client.js +30 -0
- package/lib/client/ChartBlockEngine.d.ts +27 -0
- package/lib/client/ChartBlockEngine.js +201 -0
- package/lib/client/ChartBlockEngineDesigner.d.ts +3 -0
- package/lib/client/ChartBlockEngineDesigner.js +348 -0
- package/lib/client/ChartBlockInitializer.d.ts +3 -0
- package/lib/client/ChartBlockInitializer.js +324 -0
- package/lib/client/ChartQueryBlockInitializer.d.ts +9 -0
- package/lib/client/ChartQueryBlockInitializer.js +230 -0
- package/lib/client/ChartQueryMetadataProvider.d.ts +10 -0
- package/lib/client/ChartQueryMetadataProvider.js +118 -0
- package/lib/client/DataSetPreviewTable.d.ts +5 -0
- package/lib/client/DataSetPreviewTable.js +127 -0
- package/lib/client/Icons.d.ts +1 -0
- package/lib/client/Icons.js +226 -0
- package/lib/client/chartRenderComponents/index.d.ts +2 -0
- package/lib/client/chartRenderComponents/index.js +26 -0
- package/lib/client/hooks/index.d.ts +4 -0
- package/lib/client/hooks/index.js +52 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +161 -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 +46 -0
- package/lib/client/locale/ja-JP.d.ts +2 -0
- package/lib/client/locale/ja-JP.js +8 -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 +61 -0
- package/lib/client/locale/zh-CN.js +67 -0
- package/lib/client/select/CustomSelect.d.ts +11 -0
- package/lib/client/select/CustomSelect.js +193 -0
- package/lib/client/select/ReadPretty.d.ts +2 -0
- package/lib/client/select/ReadPretty.js +102 -0
- package/lib/client/select/index.d.ts +2 -0
- package/lib/client/select/index.js +31 -0
- package/lib/client/select/shared.d.ts +7 -0
- package/lib/client/select/shared.js +86 -0
- package/lib/client/settings/AddNewQuery.d.ts +2 -0
- package/lib/client/settings/AddNewQuery.js +321 -0
- package/lib/client/settings/ConfigureFields.d.ts +1 -0
- package/lib/client/settings/ConfigureFields.js +51 -0
- package/lib/client/settings/QueriesTable.d.ts +1 -0
- package/lib/client/settings/QueriesTable.js +108 -0
- package/lib/client/settings/queryTypes.d.ts +5 -0
- package/lib/client/settings/queryTypes.js +85 -0
- package/lib/client/settings/schemas/chartsQueries.d.ts +8 -0
- package/lib/client/settings/schemas/chartsQueries.js +378 -0
- package/lib/client/templates/AreaTemplate.d.ts +65 -0
- package/lib/client/templates/AreaTemplate.js +86 -0
- package/lib/client/templates/BarTemplate.d.ts +80 -0
- package/lib/client/templates/BarTemplate.js +103 -0
- package/lib/client/templates/ColumnTemplate.d.ts +80 -0
- package/lib/client/templates/ColumnTemplate.js +103 -0
- package/lib/client/templates/FunnelTemplate.d.ts +66 -0
- package/lib/client/templates/FunnelTemplate.js +87 -0
- package/lib/client/templates/LineTemplate.d.ts +67 -0
- package/lib/client/templates/LineTemplate.js +92 -0
- package/lib/client/templates/PieTemplate.d.ts +71 -0
- package/lib/client/templates/PieTemplate.js +92 -0
- package/lib/client/templates/RadarTemplate.d.ts +71 -0
- package/lib/client/templates/RadarTemplate.js +93 -0
- package/lib/client/templates/ScatterTemplate.d.ts +91 -0
- package/lib/client/templates/ScatterTemplate.js +112 -0
- package/lib/client/templates/TableTemplate.d.ts +28 -0
- package/lib/client/templates/TableTemplate.js +54 -0
- package/lib/client/templates/index.d.ts +1 -0
- package/lib/client/templates/index.js +33 -0
- package/lib/client/utils.d.ts +3 -0
- package/lib/client/utils.js +66 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +15 -0
- package/lib/server/actions/chartsQueries.d.ts +3 -0
- package/lib/server/actions/chartsQueries.js +104 -0
- package/lib/server/actions/index.d.ts +1 -0
- package/lib/server/actions/index.js +1 -0
- package/lib/server/collections/chartsQueries.d.ts +2 -0
- package/lib/server/collections/chartsQueries.js +36 -0
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +15 -0
- package/lib/server/plugin.d.ts +14 -0
- package/lib/server/plugin.js +142 -0
- package/lib/server/query.d.ts +12 -0
- package/lib/server/query.js +91 -0
- package/lib/server/shared/index.d.ts +2 -0
- package/lib/server/shared/index.js +8 -0
- package/package.json +14 -0
- package/server.d.ts +4 -0
- package/server.js +30 -0
- package/src/client/ChartBlockEngine.tsx +120 -0
- package/src/client/ChartBlockEngineDesigner.tsx +238 -0
- package/src/client/ChartBlockInitializer.tsx +216 -0
- package/src/client/ChartQueryBlockInitializer.tsx +136 -0
- package/src/client/ChartQueryMetadataProvider.tsx +62 -0
- package/src/client/DataSetPreviewTable.tsx +73 -0
- package/src/client/Icons.tsx +99 -0
- package/src/client/chartRenderComponents/index.ts +7 -0
- package/src/client/hooks/index.ts +19 -0
- package/src/client/index.tsx +101 -0
- package/src/client/locale/en-US.ts +23 -0
- package/src/client/locale/index.ts +18 -0
- package/src/client/locale/ja-JP.ts +1 -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 +63 -0
- package/src/client/select/CustomSelect.tsx +127 -0
- package/src/client/select/ReadPretty.tsx +36 -0
- package/src/client/select/index.md +38 -0
- package/src/client/select/index.ts +2 -0
- package/src/client/select/shared.ts +36 -0
- package/src/client/settings/AddNewQuery.tsx +161 -0
- package/src/client/settings/ConfigureFields.tsx +18 -0
- package/src/client/settings/QueriesTable.tsx +26 -0
- package/src/client/settings/queryTypes.ts +64 -0
- package/src/client/settings/schemas/chartsQueries.ts +319 -0
- package/src/client/templates/AreaTemplate.tsx +64 -0
- package/src/client/templates/BarTemplate.tsx +80 -0
- package/src/client/templates/ColumnTemplate.tsx +81 -0
- package/src/client/templates/FunnelTemplate.tsx +65 -0
- package/src/client/templates/LineTemplate.tsx +72 -0
- package/src/client/templates/PieTemplate.tsx +68 -0
- package/src/client/templates/RadarTemplate.tsx +71 -0
- package/src/client/templates/ScatterTemplate.tsx +90 -0
- package/src/client/templates/TableTemplate.tsx +48 -0
- package/src/client/templates/index.ts +21 -0
- package/src/client/utils.ts +39 -0
- package/src/index.ts +1 -0
- package/src/server/actions/chartsQueries.ts +44 -0
- package/src/server/actions/index.ts +0 -0
- package/src/server/collections/.gitkeep +0 -0
- package/src/server/collections/chartsQueries.ts +24 -0
- package/src/server/index.ts +1 -0
- package/src/server/plugin.ts +61 -0
- package/src/server/query.ts +39 -0
- package/src/server/shared/index.ts +2 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _core() {
|
|
9
|
+
const data = require("@formily/core");
|
|
10
|
+
|
|
11
|
+
_core = function _core() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _client() {
|
|
19
|
+
const data = require("@nocobase/client");
|
|
20
|
+
|
|
21
|
+
_client = function _client() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _json() {
|
|
29
|
+
const data = _interopRequireDefault(require("json5"));
|
|
30
|
+
|
|
31
|
+
_json = function _json() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _react() {
|
|
39
|
+
const data = _interopRequireWildcard(require("react"));
|
|
40
|
+
|
|
41
|
+
_react = function _react() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var _ChartBlockEngine = require("./ChartBlockEngine");
|
|
49
|
+
|
|
50
|
+
var _ChartBlockInitializer = require("./ChartBlockInitializer");
|
|
51
|
+
|
|
52
|
+
var _ChartQueryMetadataProvider = require("./ChartQueryMetadataProvider");
|
|
53
|
+
|
|
54
|
+
require("./Icons");
|
|
55
|
+
|
|
56
|
+
var _locale = require("./locale");
|
|
57
|
+
|
|
58
|
+
var _select = require("./select");
|
|
59
|
+
|
|
60
|
+
var _QueriesTable = require("./settings/QueriesTable");
|
|
61
|
+
|
|
62
|
+
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); }
|
|
63
|
+
|
|
64
|
+
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; }
|
|
65
|
+
|
|
66
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
67
|
+
|
|
68
|
+
(0, _core().registerValidateRules)({
|
|
69
|
+
json5: (value, rule) => {
|
|
70
|
+
if (!value) {
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const val = _json().default.parse(value);
|
|
76
|
+
|
|
77
|
+
if (!isNaN(val)) {
|
|
78
|
+
return {
|
|
79
|
+
type: 'error',
|
|
80
|
+
message: (0, _locale.lang)('Invalid JSON format')
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return '';
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error(error);
|
|
87
|
+
return {
|
|
88
|
+
type: 'error',
|
|
89
|
+
message: (0, _locale.lang)('Invalid JSON format')
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
var _default = _react().default.memo(props => {
|
|
96
|
+
const api = (0, _client().useAPIClient)();
|
|
97
|
+
const items = (0, _react().useContext)(_client().SchemaInitializerContext);
|
|
98
|
+
const children = items.BlockInitializers.items[0].children;
|
|
99
|
+
|
|
100
|
+
if (children) {
|
|
101
|
+
const hasChartItem = children.some(child => (child === null || child === void 0 ? void 0 : child.component) === 'ChartBlockInitializer');
|
|
102
|
+
|
|
103
|
+
if (!hasChartItem) {
|
|
104
|
+
children.push({
|
|
105
|
+
key: 'chart',
|
|
106
|
+
type: 'item',
|
|
107
|
+
icon: 'PieChartOutlined',
|
|
108
|
+
title: '{{t("Chart",{ns:"charts"})}}',
|
|
109
|
+
component: 'ChartBlockInitializer'
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const validateSQL = sql => {
|
|
115
|
+
return new Promise(resolve => {
|
|
116
|
+
api.request({
|
|
117
|
+
url: 'chartsQueries:validate',
|
|
118
|
+
method: 'post',
|
|
119
|
+
data: {
|
|
120
|
+
sql
|
|
121
|
+
}
|
|
122
|
+
}).then(({
|
|
123
|
+
data
|
|
124
|
+
}) => {
|
|
125
|
+
var _data$data;
|
|
126
|
+
|
|
127
|
+
resolve(data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.errorMessage);
|
|
128
|
+
}).catch(() => {
|
|
129
|
+
resolve('Invalid SQL');
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return _react().default.createElement(_ChartQueryMetadataProvider.ChartQueryMetadataProvider, null, _react().default.createElement(_client().SettingsCenterProvider, {
|
|
135
|
+
settings: {
|
|
136
|
+
charts: {
|
|
137
|
+
title: '{{t("Charts", {ns:"charts"})}}',
|
|
138
|
+
icon: 'PieChartOutlined',
|
|
139
|
+
tabs: {
|
|
140
|
+
queries: {
|
|
141
|
+
title: '{{t("Queries", {ns:"charts"})}}',
|
|
142
|
+
component: _QueriesTable.QueriesTable
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, _react().default.createElement(_client().SchemaComponentOptions, {
|
|
148
|
+
scope: {
|
|
149
|
+
validateSQL
|
|
150
|
+
},
|
|
151
|
+
components: {
|
|
152
|
+
CustomSelect: _select.CustomSelect,
|
|
153
|
+
ChartBlockInitializer: _ChartBlockInitializer.ChartBlockInitializer,
|
|
154
|
+
ChartBlockEngine: _ChartBlockEngine.ChartBlockEngine
|
|
155
|
+
}
|
|
156
|
+
}, _react().default.createElement(_client().SchemaInitializerContext.Provider, {
|
|
157
|
+
value: items
|
|
158
|
+
}, props.children))));
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
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;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
Edit: 'Edit',
|
|
9
|
+
Delete: 'Delete',
|
|
10
|
+
Cancel: 'Cancel',
|
|
11
|
+
Submit: 'Submit',
|
|
12
|
+
Actions: 'Actions',
|
|
13
|
+
Title: 'Title',
|
|
14
|
+
Enable: 'Enable',
|
|
15
|
+
'SAML manager': 'SAML manager',
|
|
16
|
+
'SAML Providers': 'SAML Providers',
|
|
17
|
+
'Redirect url': 'Redirect url',
|
|
18
|
+
'SP entity id': 'SP entity id',
|
|
19
|
+
'Add provider': 'Add',
|
|
20
|
+
'Edit provider': 'Edit',
|
|
21
|
+
'Client id': 'Client id',
|
|
22
|
+
'Entity id or issuer': 'Entity id or issuer',
|
|
23
|
+
'Login Url': 'Login Url',
|
|
24
|
+
'Public cert': 'Public cert',
|
|
25
|
+
'Delete provider': 'Delete',
|
|
26
|
+
'Are you sure you want to delete it?': 'Are you sure you want to delete it?',
|
|
27
|
+
'Sign in button name, which will be displayed on the sign in page': 'Sign in button name, which will be displayed on the sign in page'
|
|
28
|
+
};
|
|
29
|
+
exports.default = _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NAMESPACE = void 0;
|
|
7
|
+
exports.lang = lang;
|
|
8
|
+
exports.useChartsTranslation = useChartsTranslation;
|
|
9
|
+
|
|
10
|
+
function _client() {
|
|
11
|
+
const data = require("@nocobase/client");
|
|
12
|
+
|
|
13
|
+
_client = function _client() {
|
|
14
|
+
return data;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function _reactI18next() {
|
|
21
|
+
const data = require("react-i18next");
|
|
22
|
+
|
|
23
|
+
_reactI18next = function _reactI18next() {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const NAMESPACE = 'charts'; // i18n.addResources('zh-CN', NAMESPACE, zhCN);
|
|
31
|
+
// i18n.addResources('en-US', NAMESPACE, enUS);
|
|
32
|
+
// i18n.addResources('ja-JP', NAMESPACE, jaJP);
|
|
33
|
+
// i18n.addResources('ru-RU', NAMESPACE, ruRU);
|
|
34
|
+
// i18n.addResources('tr-TR', NAMESPACE, trTR);
|
|
35
|
+
|
|
36
|
+
exports.NAMESPACE = NAMESPACE;
|
|
37
|
+
|
|
38
|
+
function lang(key) {
|
|
39
|
+
return _client().i18n.t(key, {
|
|
40
|
+
ns: NAMESPACE
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function useChartsTranslation() {
|
|
45
|
+
return (0, _reactI18next().useTranslation)(NAMESPACE);
|
|
46
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
Chart: string;
|
|
10
|
+
Charts: string;
|
|
11
|
+
Queries: string;
|
|
12
|
+
'Select chart query': string;
|
|
13
|
+
'Select query data': string;
|
|
14
|
+
Type: string;
|
|
15
|
+
'Chart type': string;
|
|
16
|
+
'Chart title': string;
|
|
17
|
+
'Basic charts': string;
|
|
18
|
+
'More charts': string;
|
|
19
|
+
'Chart config': string;
|
|
20
|
+
'Add query': string;
|
|
21
|
+
'Edit query': string;
|
|
22
|
+
'Invalid JSON format,must be an object array.': string;
|
|
23
|
+
Area: string;
|
|
24
|
+
Bar: string;
|
|
25
|
+
Column: string;
|
|
26
|
+
Funnel: string;
|
|
27
|
+
Line: string;
|
|
28
|
+
Pie: string;
|
|
29
|
+
Radar: string;
|
|
30
|
+
Scatter: string;
|
|
31
|
+
'Edit chart block': string;
|
|
32
|
+
'Chart preview': string;
|
|
33
|
+
'Delete queries': string;
|
|
34
|
+
'Delete query': string;
|
|
35
|
+
'Add chart query': string;
|
|
36
|
+
'Add SQL query': string;
|
|
37
|
+
'Add JSON query': string;
|
|
38
|
+
'Data preview': string;
|
|
39
|
+
'Category axis / Dimension': string;
|
|
40
|
+
'Value axis / Metrics': string;
|
|
41
|
+
'JSON config': string;
|
|
42
|
+
'Json config references': string;
|
|
43
|
+
'Create chart block': string;
|
|
44
|
+
'Invalid JSON format': string;
|
|
45
|
+
'Json config references: ': string;
|
|
46
|
+
'Sector Angle / Metric': string;
|
|
47
|
+
'Sector label / Dimensional': string;
|
|
48
|
+
'Color legend / Dimensional': string;
|
|
49
|
+
'Funnel Layer Width/Metrics': string;
|
|
50
|
+
'Branch Tags/Dimensions': string;
|
|
51
|
+
'Branch Length/Metrics': string;
|
|
52
|
+
'Please check the chart config': string;
|
|
53
|
+
'1 \u300Ctime\u300Dor \u300COrdered Noun\u300D field,1 \u300CNumerical\u300D field,1 \u300CUnordered Noun\u300D field (optional)': string;
|
|
54
|
+
'1 \u300Ctime\u300D or \u300Cordered noun\u300D field, 1 \u300Cvalue\u300D field, 0~ 1 \u300Cunordered noun\u300D': string;
|
|
55
|
+
'1 \u300Ctime\u300D or \u300Cordered noun\u300D field, 1 \u300Cvalue\u300D field, 0 to 1 \u300Cunordered noun\u300D': string;
|
|
56
|
+
'1 \u300CUnordered Noun\u300D field, 1 \u300CNumeric\u300D field': string;
|
|
57
|
+
'1 \u300CTime\u300D or \u300COrder Noun\u300D field, 1 \u300CValue\u300D field': string;
|
|
58
|
+
'1~ 2 \u300CUnordered Noun\u300D fields, 1 \u300CNumeric\u300D field': string;
|
|
59
|
+
'1 \u300CNumeric\u300D field, 0~ 1 \u300CUnordered Noun\u300D field': string;
|
|
60
|
+
};
|
|
61
|
+
export default _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
Edit: '编辑',
|
|
9
|
+
Delete: '删除',
|
|
10
|
+
Cancel: '取消',
|
|
11
|
+
Submit: '提交',
|
|
12
|
+
Actions: '操作',
|
|
13
|
+
Title: '名称',
|
|
14
|
+
Enable: '启用',
|
|
15
|
+
Chart: '图表',
|
|
16
|
+
Charts: '图表',
|
|
17
|
+
Queries: '查询列表',
|
|
18
|
+
'Select chart query': '选择图表数据',
|
|
19
|
+
'Select query data': '选择查询数据',
|
|
20
|
+
Type: '类型',
|
|
21
|
+
'Chart type': '图表类型',
|
|
22
|
+
'Chart title': '图表标题',
|
|
23
|
+
'Basic charts': '基础图表',
|
|
24
|
+
'More charts': '更多图表',
|
|
25
|
+
'Chart config': '图表配置',
|
|
26
|
+
'Add query': '添加查询',
|
|
27
|
+
'Edit query': '编辑查询',
|
|
28
|
+
'Invalid JSON format,must be an object array.': '无效的JSON格式,必须是对象数组。',
|
|
29
|
+
Area: '面积图',
|
|
30
|
+
Bar: '条形图',
|
|
31
|
+
Column: '柱状图',
|
|
32
|
+
Funnel: '漏斗图',
|
|
33
|
+
Line: '折线图',
|
|
34
|
+
Pie: '饼图',
|
|
35
|
+
Radar: '雷达图',
|
|
36
|
+
Scatter: '散点图',
|
|
37
|
+
'Edit chart block': '编辑图表区块',
|
|
38
|
+
'Chart preview': '图表预览',
|
|
39
|
+
'Delete queries': '删除查询列表',
|
|
40
|
+
'Delete query': '删除查询',
|
|
41
|
+
'Add chart query': '添加图表查询',
|
|
42
|
+
'Add SQL query': '添加SQL查询',
|
|
43
|
+
'Add JSON query': '添加JSON查询',
|
|
44
|
+
'Data preview': '数据预览',
|
|
45
|
+
'Category axis / Dimension': '类别轴 / 维度',
|
|
46
|
+
'Value axis / Metrics': '值轴 / 度量',
|
|
47
|
+
'JSON config': 'JSON 配置',
|
|
48
|
+
'Json config references': 'JSON配置参考',
|
|
49
|
+
'Create chart block': '创建图表区块',
|
|
50
|
+
'Invalid JSON format': '无效的JSON格式',
|
|
51
|
+
'Json config references: ': 'JSON配置参考: ',
|
|
52
|
+
'Sector Angle / Metric': '扇形角 / 度量',
|
|
53
|
+
'Sector label / Dimensional': '扇形标签 / 维度',
|
|
54
|
+
'Color legend / Dimensional': '颜色系列 / 维度',
|
|
55
|
+
'Funnel Layer Width/Metrics': '漏斗层宽度 / 度量',
|
|
56
|
+
'Branch Tags/Dimensions': '分支标签 / 维度',
|
|
57
|
+
'Branch Length/Metrics': '分支长度 / 度量',
|
|
58
|
+
'Please check the chart config': '请检查图表配置',
|
|
59
|
+
'1 「time」or 「Ordered Noun」 field,1 「Numerical」 field,1 「Unordered Noun」 field (optional)': '1 个「时间」或「有序名词」字段,1 个「数值」字段,1 个「无序名词」字段(可选)',
|
|
60
|
+
'1 「time」 or 「ordered noun」 field, 1 「value」 field, 0~ 1 「unordered noun」': '1 个「时间」或「有序名词」字段,1 个「数值」字段,0 ~ 1 个「无序名词」',
|
|
61
|
+
'1 「time」 or 「ordered noun」 field, 1 「value」 field, 0 to 1 「unordered noun」': '1 个「时间」或「有序名词」字段,1 个「数值」字段,0 ~ 1 个「无序名词」',
|
|
62
|
+
'1 「Unordered Noun」 field, 1 「Numeric」 field': '1 个「无序名词」字段,1 个「数值」字段',
|
|
63
|
+
'1 「Time」 or 「Order Noun」 field, 1 「Value」 field': '1 个「时间」或「有序名词」字段,1 个「数值」字段',
|
|
64
|
+
'1~ 2 「Unordered Noun」 fields, 1 「Numeric」 field': '1 ~ 2 个「无序名词」字段,1 个「数值」字段',
|
|
65
|
+
'1 「Numeric」 field, 0~ 1 「Unordered Noun」 field': '1 个「数值」字段,0 ~ 1 个「无序名词」字段'
|
|
66
|
+
};
|
|
67
|
+
exports.default = _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SelectProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ReadPretty } from './ReadPretty';
|
|
4
|
+
export declare const CustomSelect: React.ForwardRefExoticComponent<Partial<SelectProps<any, any> & {
|
|
5
|
+
objectValue?: boolean;
|
|
6
|
+
onChange?: (v: any) => void;
|
|
7
|
+
multiple: boolean;
|
|
8
|
+
}> & React.RefAttributes<unknown>> & {
|
|
9
|
+
ReadPretty: typeof ReadPretty;
|
|
10
|
+
};
|
|
11
|
+
export default CustomSelect;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.CustomSelect = void 0;
|
|
7
|
+
|
|
8
|
+
function _icons() {
|
|
9
|
+
const data = require("@ant-design/icons");
|
|
10
|
+
|
|
11
|
+
_icons = function _icons() {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _css() {
|
|
19
|
+
const data = require("@emotion/css");
|
|
20
|
+
|
|
21
|
+
_css = function _css() {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _react() {
|
|
29
|
+
const data = require("@formily/react");
|
|
30
|
+
|
|
31
|
+
_react = function _react() {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function _shared() {
|
|
39
|
+
const data = require("@formily/shared");
|
|
40
|
+
|
|
41
|
+
_shared = function _shared() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _client() {
|
|
49
|
+
const data = require("@nocobase/client");
|
|
50
|
+
|
|
51
|
+
_client = function _client() {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _antd() {
|
|
59
|
+
const data = require("antd");
|
|
60
|
+
|
|
61
|
+
_antd = function _antd() {
|
|
62
|
+
return data;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function _react2() {
|
|
69
|
+
const data = _interopRequireDefault(require("react"));
|
|
70
|
+
|
|
71
|
+
_react2 = function _react2() {
|
|
72
|
+
return data;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return data;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var _locale = require("../locale");
|
|
79
|
+
|
|
80
|
+
var _ReadPretty = require("./ReadPretty");
|
|
81
|
+
|
|
82
|
+
const _excluded = ["options"];
|
|
83
|
+
|
|
84
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
85
|
+
|
|
86
|
+
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; }
|
|
87
|
+
|
|
88
|
+
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; }
|
|
89
|
+
|
|
90
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
91
|
+
|
|
92
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
93
|
+
|
|
94
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
95
|
+
|
|
96
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
97
|
+
|
|
98
|
+
const isEmptyObject = val => !(0, _shared().isValid)(val) || typeof val === 'object' && Object.keys(val).length === 0;
|
|
99
|
+
|
|
100
|
+
const Option = _antd().Select.Option,
|
|
101
|
+
OptGroup = _antd().Select.OptGroup;
|
|
102
|
+
|
|
103
|
+
const filterOption = (input, option) => {
|
|
104
|
+
var _option$label;
|
|
105
|
+
|
|
106
|
+
return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : '').toLowerCase().includes((input || '').toLowerCase());
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const InternalSelect = (0, _react().connect)(props => {
|
|
110
|
+
const others = _extends({}, props);
|
|
111
|
+
|
|
112
|
+
const _others = _objectSpread({}, others),
|
|
113
|
+
options = _others.options,
|
|
114
|
+
othersProps = _objectWithoutProperties(_others, _excluded);
|
|
115
|
+
|
|
116
|
+
const mode = props.mode || props.multiple ? 'multiple' : undefined;
|
|
117
|
+
const group1 = options.filter(option => option.group === 2);
|
|
118
|
+
const group2 = options.filter(option => option.group === 1);
|
|
119
|
+
return _react2().default.createElement(_antd().Select, _objectSpread(_objectSpread({
|
|
120
|
+
showSearch: true,
|
|
121
|
+
filterOption: filterOption,
|
|
122
|
+
allowClear: true
|
|
123
|
+
}, othersProps), {}, {
|
|
124
|
+
onChange: changed => {
|
|
125
|
+
var _props$onChange;
|
|
126
|
+
|
|
127
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, changed === undefined ? null : changed);
|
|
128
|
+
},
|
|
129
|
+
mode: mode
|
|
130
|
+
}), _react2().default.createElement(OptGroup, {
|
|
131
|
+
label: (0, _locale.lang)('Basic charts')
|
|
132
|
+
}, group1.map(option => _react2().default.createElement(Option, {
|
|
133
|
+
value: option.key,
|
|
134
|
+
label: (0, _locale.lang)(option.title)
|
|
135
|
+
}, _react2().default.createElement(_antd().Popover, {
|
|
136
|
+
placement: 'right',
|
|
137
|
+
zIndex: 99999999999,
|
|
138
|
+
content: () => {
|
|
139
|
+
var _lang;
|
|
140
|
+
|
|
141
|
+
return _react2().default.createElement("span", null, (_lang = (0, _locale.lang)(option === null || option === void 0 ? void 0 : option.description)) === null || _lang === void 0 ? void 0 : _lang.split(',').map(item => _react2().default.createElement("div", null, item)));
|
|
142
|
+
},
|
|
143
|
+
trigger: "hover"
|
|
144
|
+
}, _react2().default.createElement("div", {
|
|
145
|
+
className: (0, _css().css)`
|
|
146
|
+
display: flex;
|
|
147
|
+
gap: 4px;
|
|
148
|
+
align-items: center;
|
|
149
|
+
`
|
|
150
|
+
}, _react2().default.createElement(_client().Icon, {
|
|
151
|
+
type: option.iconId
|
|
152
|
+
}), _react2().default.createElement("span", {
|
|
153
|
+
role: "img",
|
|
154
|
+
"aria-label": (0, _locale.lang)(option.title)
|
|
155
|
+
}, (0, _locale.lang)(option.title))))))), _react2().default.createElement(OptGroup, {
|
|
156
|
+
label: (0, _locale.lang)('More charts')
|
|
157
|
+
}, group2.map(option => _react2().default.createElement(Option, {
|
|
158
|
+
value: option.key,
|
|
159
|
+
label: (0, _locale.lang)(option.title)
|
|
160
|
+
}, _react2().default.createElement(_antd().Popover, {
|
|
161
|
+
placement: 'right',
|
|
162
|
+
zIndex: 99999999999,
|
|
163
|
+
content: () => {
|
|
164
|
+
var _lang2;
|
|
165
|
+
|
|
166
|
+
return _react2().default.createElement("span", null, (_lang2 = (0, _locale.lang)(option === null || option === void 0 ? void 0 : option.description)) === null || _lang2 === void 0 ? void 0 : _lang2.split(',').map(item => _react2().default.createElement("div", null, item)));
|
|
167
|
+
},
|
|
168
|
+
trigger: "hover"
|
|
169
|
+
}, _react2().default.createElement("div", {
|
|
170
|
+
className: (0, _css().css)`
|
|
171
|
+
display: flex;
|
|
172
|
+
gap: 4px;
|
|
173
|
+
align-items: center;
|
|
174
|
+
`
|
|
175
|
+
}, _react2().default.createElement(_client().Icon, {
|
|
176
|
+
type: option.iconId
|
|
177
|
+
}), _react2().default.createElement("span", {
|
|
178
|
+
role: "img",
|
|
179
|
+
"aria-label": (0, _locale.lang)(option.title)
|
|
180
|
+
}, (0, _locale.lang)(option.title))))))));
|
|
181
|
+
}, (0, _react().mapProps)({
|
|
182
|
+
dataSource: 'options',
|
|
183
|
+
loading: true
|
|
184
|
+
}, (props, field) => {
|
|
185
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
186
|
+
suffixIcon: (field === null || field === void 0 ? void 0 : field['loading']) || (field === null || field === void 0 ? void 0 : field['validating']) ? _react2().default.createElement(_icons().LoadingOutlined, null) : props === null || props === void 0 ? void 0 : props.suffixIcon
|
|
187
|
+
});
|
|
188
|
+
}), (0, _react().mapReadPretty)(_ReadPretty.ReadPretty));
|
|
189
|
+
const CustomSelect = InternalSelect;
|
|
190
|
+
exports.CustomSelect = CustomSelect;
|
|
191
|
+
CustomSelect.ReadPretty = _ReadPretty.ReadPretty;
|
|
192
|
+
var _default = CustomSelect;
|
|
193
|
+
exports.default = _default;
|