@nocobase/plugin-charts 0.11.1-alpha.4 → 0.12.0-alpha.1
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 +2 -3
- package/client.js +1 -1
- package/{lib → dist}/client/index.d.ts +1 -0
- package/dist/client/index.js +3234 -0
- package/{lib → dist}/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/locale/en-US.js +26 -0
- package/{src/locale/es-ES.ts → dist/locale/es-ES.js} +22 -18
- package/dist/locale/fr-FR.js +5 -0
- package/dist/locale/ja-JP.js +5 -0
- package/dist/locale/pt-BR.js +26 -0
- package/dist/locale/ru-RU.js +5 -0
- package/dist/locale/tr-TR.js +5 -0
- package/dist/locale/zh-CN.js +65 -0
- package/dist/node_modules/json5/dist/index.js +1737 -0
- package/dist/node_modules/json5/dist/index.min.js +1 -0
- package/dist/node_modules/json5/lib/cli.js +152 -0
- package/dist/node_modules/json5/lib/index.d.ts +4 -0
- package/dist/node_modules/json5/lib/index.js +1 -0
- package/dist/node_modules/json5/lib/parse.d.ts +15 -0
- package/dist/node_modules/json5/lib/parse.js +1114 -0
- package/dist/node_modules/json5/lib/register.js +13 -0
- package/dist/node_modules/json5/lib/require.js +4 -0
- package/dist/node_modules/json5/lib/stringify.d.ts +89 -0
- package/dist/node_modules/json5/lib/stringify.js +261 -0
- package/dist/node_modules/json5/lib/unicode.d.ts +3 -0
- package/dist/node_modules/json5/lib/unicode.js +4 -0
- package/dist/node_modules/json5/lib/util.d.ts +5 -0
- package/dist/node_modules/json5/lib/util.js +35 -0
- package/dist/node_modules/json5/package.json +1 -0
- package/dist/server/actions/chartsQueries.js +57 -0
- package/dist/server/actions/index.js +2 -0
- package/dist/server/collections/chartsQueries.js +30 -0
- package/dist/server/index.js +11 -0
- package/dist/server/plugin.js +66 -0
- package/dist/server/query.js +39 -0
- package/dist/server/shared/index.js +5 -0
- package/package.json +17 -28
- package/server.d.ts +2 -3
- package/server.js +1 -1
- package/lib/client/ChartBlockEngine.js +0 -146
- package/lib/client/ChartBlockEngineDesigner.js +0 -293
- package/lib/client/ChartBlockInitializer.js +0 -263
- package/lib/client/ChartQueryBlockInitializer.js +0 -191
- package/lib/client/ChartQueryMetadataProvider.js +0 -91
- package/lib/client/DataSetPreviewTable.js +0 -113
- package/lib/client/Icons.js +0 -210
- package/lib/client/chartRenderComponents/index.js +0 -20
- package/lib/client/hooks/index.js +0 -38
- package/lib/client/index.js +0 -143
- package/lib/client/locale/index.js +0 -37
- package/lib/client/select/CustomSelect.js +0 -148
- package/lib/client/select/ReadPretty.js +0 -77
- package/lib/client/select/index.js +0 -27
- package/lib/client/select/shared.js +0 -66
- package/lib/client/settings/AddNewQuery.js +0 -270
- package/lib/client/settings/ConfigureFields.js +0 -39
- package/lib/client/settings/QueriesTable.js +0 -77
- package/lib/client/settings/queryTypes.js +0 -77
- package/lib/client/settings/schemas/chartsQueries.js +0 -353
- package/lib/client/templates/AreaTemplate.js +0 -81
- package/lib/client/templates/BarTemplate.js +0 -98
- package/lib/client/templates/ColumnTemplate.js +0 -98
- package/lib/client/templates/FunnelTemplate.js +0 -82
- package/lib/client/templates/LineTemplate.js +0 -89
- package/lib/client/templates/PieTemplate.js +0 -87
- package/lib/client/templates/RadarTemplate.js +0 -88
- package/lib/client/templates/ScatterTemplate.js +0 -107
- package/lib/client/templates/TableTemplate.js +0 -54
- package/lib/client/templates/index.js +0 -25
- package/lib/client/utils.js +0 -50
- package/lib/index.js +0 -13
- package/lib/locale/en-US.js +0 -29
- package/lib/locale/es-ES.js +0 -59
- package/lib/locale/fr-FR.js +0 -8
- package/lib/locale/ja-JP.js +0 -8
- package/lib/locale/pt-BR.js +0 -29
- package/lib/locale/ru-RU.js +0 -8
- package/lib/locale/tr-TR.js +0 -8
- package/lib/locale/zh-CN.js +0 -68
- package/lib/server/actions/chartsQueries.js +0 -89
- package/lib/server/actions/index.js +0 -1
- package/lib/server/collections/chartsQueries.js +0 -33
- package/lib/server/index.js +0 -13
- package/lib/server/plugin.js +0 -106
- package/lib/server/query.js +0 -71
- package/lib/server/shared/index.js +0 -8
- package/src/client/ChartBlockEngine.tsx +0 -121
- package/src/client/ChartBlockEngineDesigner.tsx +0 -248
- package/src/client/ChartBlockInitializer.tsx +0 -223
- package/src/client/ChartQueryBlockInitializer.tsx +0 -156
- package/src/client/ChartQueryMetadataProvider.tsx +0 -64
- package/src/client/DataSetPreviewTable.tsx +0 -71
- package/src/client/Icons.tsx +0 -99
- package/src/client/chartRenderComponents/index.ts +0 -7
- package/src/client/hooks/index.ts +0 -19
- package/src/client/index.tsx +0 -115
- package/src/client/locale/index.ts +0 -18
- package/src/client/select/CustomSelect.tsx +0 -126
- package/src/client/select/ReadPretty.tsx +0 -39
- package/src/client/select/index.md +0 -31
- package/src/client/select/index.ts +0 -2
- package/src/client/select/shared.ts +0 -37
- package/src/client/settings/AddNewQuery.tsx +0 -176
- package/src/client/settings/ConfigureFields.tsx +0 -18
- package/src/client/settings/QueriesTable.tsx +0 -26
- package/src/client/settings/queryTypes.ts +0 -65
- package/src/client/settings/schemas/chartsQueries.ts +0 -319
- package/src/client/templates/AreaTemplate.tsx +0 -64
- package/src/client/templates/BarTemplate.tsx +0 -80
- package/src/client/templates/ColumnTemplate.tsx +0 -81
- package/src/client/templates/FunnelTemplate.tsx +0 -65
- package/src/client/templates/LineTemplate.tsx +0 -72
- package/src/client/templates/PieTemplate.tsx +0 -68
- package/src/client/templates/RadarTemplate.tsx +0 -71
- package/src/client/templates/ScatterTemplate.tsx +0 -90
- package/src/client/templates/TableTemplate.tsx +0 -48
- package/src/client/templates/index.ts +0 -21
- package/src/client/utils.ts +0 -39
- package/src/index.ts +0 -1
- package/src/locale/en-US.ts +0 -23
- package/src/locale/fr-FR.ts +0 -1
- package/src/locale/ja-JP.ts +0 -1
- package/src/locale/pt-BR.ts +0 -23
- package/src/locale/ru-RU.ts +0 -1
- package/src/locale/tr-TR.ts +0 -1
- package/src/locale/zh-CN.ts +0 -64
- package/src/server/actions/chartsQueries.ts +0 -49
- package/src/server/actions/index.ts +0 -0
- package/src/server/collections/.gitkeep +0 -0
- package/src/server/collections/chartsQueries.ts +0 -26
- package/src/server/index.ts +0 -1
- package/src/server/plugin.ts +0 -61
- package/src/server/query.ts +0 -39
- package/src/server/shared/index.ts +0 -2
- /package/{lib → dist}/client/ChartBlockEngine.d.ts +0 -0
- /package/{lib → dist}/client/ChartBlockEngineDesigner.d.ts +0 -0
- /package/{lib → dist}/client/ChartBlockInitializer.d.ts +0 -0
- /package/{lib → dist}/client/ChartQueryBlockInitializer.d.ts +0 -0
- /package/{lib → dist}/client/ChartQueryMetadataProvider.d.ts +0 -0
- /package/{lib → dist}/client/DataSetPreviewTable.d.ts +0 -0
- /package/{lib → dist}/client/Icons.d.ts +0 -0
- /package/{lib → dist}/client/chartRenderComponents/index.d.ts +0 -0
- /package/{lib → dist}/client/hooks/index.d.ts +0 -0
- /package/{lib → dist}/client/locale/index.d.ts +0 -0
- /package/{lib → dist}/client/select/CustomSelect.d.ts +0 -0
- /package/{lib → dist}/client/select/ReadPretty.d.ts +0 -0
- /package/{lib → dist}/client/select/index.d.ts +0 -0
- /package/{lib → dist}/client/select/shared.d.ts +0 -0
- /package/{lib → dist}/client/settings/AddNewQuery.d.ts +0 -0
- /package/{lib → dist}/client/settings/ConfigureFields.d.ts +0 -0
- /package/{lib → dist}/client/settings/QueriesTable.d.ts +0 -0
- /package/{lib → dist}/client/settings/queryTypes.d.ts +0 -0
- /package/{lib → dist}/client/settings/schemas/chartsQueries.d.ts +0 -0
- /package/{lib → dist}/client/templates/AreaTemplate.d.ts +0 -0
- /package/{lib → dist}/client/templates/BarTemplate.d.ts +0 -0
- /package/{lib → dist}/client/templates/ColumnTemplate.d.ts +0 -0
- /package/{lib → dist}/client/templates/FunnelTemplate.d.ts +0 -0
- /package/{lib → dist}/client/templates/LineTemplate.d.ts +0 -0
- /package/{lib → dist}/client/templates/PieTemplate.d.ts +0 -0
- /package/{lib → dist}/client/templates/RadarTemplate.d.ts +0 -0
- /package/{lib → dist}/client/templates/ScatterTemplate.d.ts +0 -0
- /package/{lib → dist}/client/templates/TableTemplate.d.ts +0 -0
- /package/{lib → dist}/client/templates/index.d.ts +0 -0
- /package/{lib → dist}/client/utils.d.ts +0 -0
- /package/{lib → dist}/locale/en-US.d.ts +0 -0
- /package/{lib → dist}/locale/es-ES.d.ts +0 -0
- /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
- /package/{lib → dist}/locale/ja-JP.d.ts +0 -0
- /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
- /package/{lib → dist}/locale/ru-RU.d.ts +0 -0
- /package/{lib → dist}/locale/tr-TR.d.ts +0 -0
- /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
- /package/{lib → dist}/server/actions/chartsQueries.d.ts +0 -0
- /package/{lib → dist}/server/actions/index.d.ts +0 -0
- /package/{lib → dist}/server/collections/chartsQueries.d.ts +0 -0
- /package/{lib → dist}/server/index.d.ts +0 -0
- /package/{lib → dist}/server/plugin.d.ts +0 -0
- /package/{lib → dist}/server/query.d.ts +0 -0
- /package/{lib → dist}/server/shared/index.d.ts +0 -0
|
@@ -0,0 +1,3234 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@formily/core"), require("@nocobase/client"), require("antd"), require("@formily/antd-v5"), require("@formily/react"), require("@nocobase/utils/client"), require("react-i18next"), require("@ant-design/icons"), require("react-router-dom"), require("lodash"), require("@formily/shared")) : typeof define === "function" && define.amd ? define(["exports", "react", "@formily/core", "@nocobase/client", "antd", "@formily/antd-v5", "@formily/react", "@nocobase/utils/client", "react-i18next", "@ant-design/icons", "react-router-dom", "lodash", "@formily/shared"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nocobase/plugin-charts"] = {}, global.react, global["@formily/core"], global["@nocobase/client"], global.antd, global["@formily/antd-v5"], global["@formily/react"], global["@nocobase/utils"], global["react-i18next"], global["@ant-design/icons"], global["react-router-dom"], global.lodash, global["@formily/shared"]));
|
|
3
|
+
})(this, function(exports2, require$$0, core, client, antd, antdV5, react, client$1, reactI18next, icons, reactRouterDom, lodash, shared) {
|
|
4
|
+
"use strict";
|
|
5
|
+
var jsxRuntime = { exports: {} };
|
|
6
|
+
var reactJsxRuntime_production_min = {};
|
|
7
|
+
/**
|
|
8
|
+
* @license React
|
|
9
|
+
* react-jsx-runtime.production.min.js
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
17
|
+
function q(c2, a, g) {
|
|
18
|
+
var b, d = {}, e = null, h = null;
|
|
19
|
+
void 0 !== g && (e = "" + g);
|
|
20
|
+
void 0 !== a.key && (e = "" + a.key);
|
|
21
|
+
void 0 !== a.ref && (h = a.ref);
|
|
22
|
+
for (b in a)
|
|
23
|
+
m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
24
|
+
if (c2 && c2.defaultProps)
|
|
25
|
+
for (b in a = c2.defaultProps, a)
|
|
26
|
+
void 0 === d[b] && (d[b] = a[b]);
|
|
27
|
+
return { $$typeof: k, type: c2, key: e, ref: h, props: d, _owner: n.current };
|
|
28
|
+
}
|
|
29
|
+
reactJsxRuntime_production_min.Fragment = l;
|
|
30
|
+
reactJsxRuntime_production_min.jsx = q;
|
|
31
|
+
reactJsxRuntime_production_min.jsxs = q;
|
|
32
|
+
{
|
|
33
|
+
jsxRuntime.exports = reactJsxRuntime_production_min;
|
|
34
|
+
}
|
|
35
|
+
var jsxRuntimeExports = jsxRuntime.exports;
|
|
36
|
+
var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
|
37
|
+
var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
|
|
38
|
+
var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
|
|
39
|
+
var unicode = {
|
|
40
|
+
Space_Separator,
|
|
41
|
+
ID_Start,
|
|
42
|
+
ID_Continue
|
|
43
|
+
};
|
|
44
|
+
var util = {
|
|
45
|
+
isSpaceSeparator(c2) {
|
|
46
|
+
return typeof c2 === "string" && unicode.Space_Separator.test(c2);
|
|
47
|
+
},
|
|
48
|
+
isIdStartChar(c2) {
|
|
49
|
+
return typeof c2 === "string" && (c2 >= "a" && c2 <= "z" || c2 >= "A" && c2 <= "Z" || c2 === "$" || c2 === "_" || unicode.ID_Start.test(c2));
|
|
50
|
+
},
|
|
51
|
+
isIdContinueChar(c2) {
|
|
52
|
+
return typeof c2 === "string" && (c2 >= "a" && c2 <= "z" || c2 >= "A" && c2 <= "Z" || c2 >= "0" && c2 <= "9" || c2 === "$" || c2 === "_" || c2 === "" || c2 === "" || unicode.ID_Continue.test(c2));
|
|
53
|
+
},
|
|
54
|
+
isDigit(c2) {
|
|
55
|
+
return typeof c2 === "string" && /[0-9]/.test(c2);
|
|
56
|
+
},
|
|
57
|
+
isHexDigit(c2) {
|
|
58
|
+
return typeof c2 === "string" && /[0-9A-Fa-f]/.test(c2);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
let source;
|
|
62
|
+
let parseState;
|
|
63
|
+
let stack;
|
|
64
|
+
let pos;
|
|
65
|
+
let line;
|
|
66
|
+
let column;
|
|
67
|
+
let token;
|
|
68
|
+
let key;
|
|
69
|
+
let root;
|
|
70
|
+
var parse = function parse2(text, reviver) {
|
|
71
|
+
source = String(text);
|
|
72
|
+
parseState = "start";
|
|
73
|
+
stack = [];
|
|
74
|
+
pos = 0;
|
|
75
|
+
line = 1;
|
|
76
|
+
column = 0;
|
|
77
|
+
token = void 0;
|
|
78
|
+
key = void 0;
|
|
79
|
+
root = void 0;
|
|
80
|
+
do {
|
|
81
|
+
token = lex();
|
|
82
|
+
parseStates[parseState]();
|
|
83
|
+
} while (token.type !== "eof");
|
|
84
|
+
if (typeof reviver === "function") {
|
|
85
|
+
return internalize({ "": root }, "", reviver);
|
|
86
|
+
}
|
|
87
|
+
return root;
|
|
88
|
+
};
|
|
89
|
+
function internalize(holder, name, reviver) {
|
|
90
|
+
const value = holder[name];
|
|
91
|
+
if (value != null && typeof value === "object") {
|
|
92
|
+
if (Array.isArray(value)) {
|
|
93
|
+
for (let i = 0; i < value.length; i++) {
|
|
94
|
+
const key2 = String(i);
|
|
95
|
+
const replacement = internalize(value, key2, reviver);
|
|
96
|
+
if (replacement === void 0) {
|
|
97
|
+
delete value[key2];
|
|
98
|
+
} else {
|
|
99
|
+
Object.defineProperty(value, key2, {
|
|
100
|
+
value: replacement,
|
|
101
|
+
writable: true,
|
|
102
|
+
enumerable: true,
|
|
103
|
+
configurable: true
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
for (const key2 in value) {
|
|
109
|
+
const replacement = internalize(value, key2, reviver);
|
|
110
|
+
if (replacement === void 0) {
|
|
111
|
+
delete value[key2];
|
|
112
|
+
} else {
|
|
113
|
+
Object.defineProperty(value, key2, {
|
|
114
|
+
value: replacement,
|
|
115
|
+
writable: true,
|
|
116
|
+
enumerable: true,
|
|
117
|
+
configurable: true
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return reviver.call(holder, name, value);
|
|
124
|
+
}
|
|
125
|
+
let lexState;
|
|
126
|
+
let buffer;
|
|
127
|
+
let doubleQuote;
|
|
128
|
+
let sign;
|
|
129
|
+
let c;
|
|
130
|
+
function lex() {
|
|
131
|
+
lexState = "default";
|
|
132
|
+
buffer = "";
|
|
133
|
+
doubleQuote = false;
|
|
134
|
+
sign = 1;
|
|
135
|
+
for (; ; ) {
|
|
136
|
+
c = peek();
|
|
137
|
+
const token2 = lexStates[lexState]();
|
|
138
|
+
if (token2) {
|
|
139
|
+
return token2;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function peek() {
|
|
144
|
+
if (source[pos]) {
|
|
145
|
+
return String.fromCodePoint(source.codePointAt(pos));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function read() {
|
|
149
|
+
const c2 = peek();
|
|
150
|
+
if (c2 === "\n") {
|
|
151
|
+
line++;
|
|
152
|
+
column = 0;
|
|
153
|
+
} else if (c2) {
|
|
154
|
+
column += c2.length;
|
|
155
|
+
} else {
|
|
156
|
+
column++;
|
|
157
|
+
}
|
|
158
|
+
if (c2) {
|
|
159
|
+
pos += c2.length;
|
|
160
|
+
}
|
|
161
|
+
return c2;
|
|
162
|
+
}
|
|
163
|
+
const lexStates = {
|
|
164
|
+
default() {
|
|
165
|
+
switch (c) {
|
|
166
|
+
case " ":
|
|
167
|
+
case "\v":
|
|
168
|
+
case "\f":
|
|
169
|
+
case " ":
|
|
170
|
+
case " ":
|
|
171
|
+
case "\uFEFF":
|
|
172
|
+
case "\n":
|
|
173
|
+
case "\r":
|
|
174
|
+
case "\u2028":
|
|
175
|
+
case "\u2029":
|
|
176
|
+
read();
|
|
177
|
+
return;
|
|
178
|
+
case "/":
|
|
179
|
+
read();
|
|
180
|
+
lexState = "comment";
|
|
181
|
+
return;
|
|
182
|
+
case void 0:
|
|
183
|
+
read();
|
|
184
|
+
return newToken("eof");
|
|
185
|
+
}
|
|
186
|
+
if (util.isSpaceSeparator(c)) {
|
|
187
|
+
read();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
return lexStates[parseState]();
|
|
191
|
+
},
|
|
192
|
+
comment() {
|
|
193
|
+
switch (c) {
|
|
194
|
+
case "*":
|
|
195
|
+
read();
|
|
196
|
+
lexState = "multiLineComment";
|
|
197
|
+
return;
|
|
198
|
+
case "/":
|
|
199
|
+
read();
|
|
200
|
+
lexState = "singleLineComment";
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
throw invalidChar(read());
|
|
204
|
+
},
|
|
205
|
+
multiLineComment() {
|
|
206
|
+
switch (c) {
|
|
207
|
+
case "*":
|
|
208
|
+
read();
|
|
209
|
+
lexState = "multiLineCommentAsterisk";
|
|
210
|
+
return;
|
|
211
|
+
case void 0:
|
|
212
|
+
throw invalidChar(read());
|
|
213
|
+
}
|
|
214
|
+
read();
|
|
215
|
+
},
|
|
216
|
+
multiLineCommentAsterisk() {
|
|
217
|
+
switch (c) {
|
|
218
|
+
case "*":
|
|
219
|
+
read();
|
|
220
|
+
return;
|
|
221
|
+
case "/":
|
|
222
|
+
read();
|
|
223
|
+
lexState = "default";
|
|
224
|
+
return;
|
|
225
|
+
case void 0:
|
|
226
|
+
throw invalidChar(read());
|
|
227
|
+
}
|
|
228
|
+
read();
|
|
229
|
+
lexState = "multiLineComment";
|
|
230
|
+
},
|
|
231
|
+
singleLineComment() {
|
|
232
|
+
switch (c) {
|
|
233
|
+
case "\n":
|
|
234
|
+
case "\r":
|
|
235
|
+
case "\u2028":
|
|
236
|
+
case "\u2029":
|
|
237
|
+
read();
|
|
238
|
+
lexState = "default";
|
|
239
|
+
return;
|
|
240
|
+
case void 0:
|
|
241
|
+
read();
|
|
242
|
+
return newToken("eof");
|
|
243
|
+
}
|
|
244
|
+
read();
|
|
245
|
+
},
|
|
246
|
+
value() {
|
|
247
|
+
switch (c) {
|
|
248
|
+
case "{":
|
|
249
|
+
case "[":
|
|
250
|
+
return newToken("punctuator", read());
|
|
251
|
+
case "n":
|
|
252
|
+
read();
|
|
253
|
+
literal("ull");
|
|
254
|
+
return newToken("null", null);
|
|
255
|
+
case "t":
|
|
256
|
+
read();
|
|
257
|
+
literal("rue");
|
|
258
|
+
return newToken("boolean", true);
|
|
259
|
+
case "f":
|
|
260
|
+
read();
|
|
261
|
+
literal("alse");
|
|
262
|
+
return newToken("boolean", false);
|
|
263
|
+
case "-":
|
|
264
|
+
case "+":
|
|
265
|
+
if (read() === "-") {
|
|
266
|
+
sign = -1;
|
|
267
|
+
}
|
|
268
|
+
lexState = "sign";
|
|
269
|
+
return;
|
|
270
|
+
case ".":
|
|
271
|
+
buffer = read();
|
|
272
|
+
lexState = "decimalPointLeading";
|
|
273
|
+
return;
|
|
274
|
+
case "0":
|
|
275
|
+
buffer = read();
|
|
276
|
+
lexState = "zero";
|
|
277
|
+
return;
|
|
278
|
+
case "1":
|
|
279
|
+
case "2":
|
|
280
|
+
case "3":
|
|
281
|
+
case "4":
|
|
282
|
+
case "5":
|
|
283
|
+
case "6":
|
|
284
|
+
case "7":
|
|
285
|
+
case "8":
|
|
286
|
+
case "9":
|
|
287
|
+
buffer = read();
|
|
288
|
+
lexState = "decimalInteger";
|
|
289
|
+
return;
|
|
290
|
+
case "I":
|
|
291
|
+
read();
|
|
292
|
+
literal("nfinity");
|
|
293
|
+
return newToken("numeric", Infinity);
|
|
294
|
+
case "N":
|
|
295
|
+
read();
|
|
296
|
+
literal("aN");
|
|
297
|
+
return newToken("numeric", NaN);
|
|
298
|
+
case '"':
|
|
299
|
+
case "'":
|
|
300
|
+
doubleQuote = read() === '"';
|
|
301
|
+
buffer = "";
|
|
302
|
+
lexState = "string";
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
throw invalidChar(read());
|
|
306
|
+
},
|
|
307
|
+
identifierNameStartEscape() {
|
|
308
|
+
if (c !== "u") {
|
|
309
|
+
throw invalidChar(read());
|
|
310
|
+
}
|
|
311
|
+
read();
|
|
312
|
+
const u = unicodeEscape();
|
|
313
|
+
switch (u) {
|
|
314
|
+
case "$":
|
|
315
|
+
case "_":
|
|
316
|
+
break;
|
|
317
|
+
default:
|
|
318
|
+
if (!util.isIdStartChar(u)) {
|
|
319
|
+
throw invalidIdentifier();
|
|
320
|
+
}
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
buffer += u;
|
|
324
|
+
lexState = "identifierName";
|
|
325
|
+
},
|
|
326
|
+
identifierName() {
|
|
327
|
+
switch (c) {
|
|
328
|
+
case "$":
|
|
329
|
+
case "_":
|
|
330
|
+
case "":
|
|
331
|
+
case "":
|
|
332
|
+
buffer += read();
|
|
333
|
+
return;
|
|
334
|
+
case "\\":
|
|
335
|
+
read();
|
|
336
|
+
lexState = "identifierNameEscape";
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (util.isIdContinueChar(c)) {
|
|
340
|
+
buffer += read();
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
return newToken("identifier", buffer);
|
|
344
|
+
},
|
|
345
|
+
identifierNameEscape() {
|
|
346
|
+
if (c !== "u") {
|
|
347
|
+
throw invalidChar(read());
|
|
348
|
+
}
|
|
349
|
+
read();
|
|
350
|
+
const u = unicodeEscape();
|
|
351
|
+
switch (u) {
|
|
352
|
+
case "$":
|
|
353
|
+
case "_":
|
|
354
|
+
case "":
|
|
355
|
+
case "":
|
|
356
|
+
break;
|
|
357
|
+
default:
|
|
358
|
+
if (!util.isIdContinueChar(u)) {
|
|
359
|
+
throw invalidIdentifier();
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
buffer += u;
|
|
364
|
+
lexState = "identifierName";
|
|
365
|
+
},
|
|
366
|
+
sign() {
|
|
367
|
+
switch (c) {
|
|
368
|
+
case ".":
|
|
369
|
+
buffer = read();
|
|
370
|
+
lexState = "decimalPointLeading";
|
|
371
|
+
return;
|
|
372
|
+
case "0":
|
|
373
|
+
buffer = read();
|
|
374
|
+
lexState = "zero";
|
|
375
|
+
return;
|
|
376
|
+
case "1":
|
|
377
|
+
case "2":
|
|
378
|
+
case "3":
|
|
379
|
+
case "4":
|
|
380
|
+
case "5":
|
|
381
|
+
case "6":
|
|
382
|
+
case "7":
|
|
383
|
+
case "8":
|
|
384
|
+
case "9":
|
|
385
|
+
buffer = read();
|
|
386
|
+
lexState = "decimalInteger";
|
|
387
|
+
return;
|
|
388
|
+
case "I":
|
|
389
|
+
read();
|
|
390
|
+
literal("nfinity");
|
|
391
|
+
return newToken("numeric", sign * Infinity);
|
|
392
|
+
case "N":
|
|
393
|
+
read();
|
|
394
|
+
literal("aN");
|
|
395
|
+
return newToken("numeric", NaN);
|
|
396
|
+
}
|
|
397
|
+
throw invalidChar(read());
|
|
398
|
+
},
|
|
399
|
+
zero() {
|
|
400
|
+
switch (c) {
|
|
401
|
+
case ".":
|
|
402
|
+
buffer += read();
|
|
403
|
+
lexState = "decimalPoint";
|
|
404
|
+
return;
|
|
405
|
+
case "e":
|
|
406
|
+
case "E":
|
|
407
|
+
buffer += read();
|
|
408
|
+
lexState = "decimalExponent";
|
|
409
|
+
return;
|
|
410
|
+
case "x":
|
|
411
|
+
case "X":
|
|
412
|
+
buffer += read();
|
|
413
|
+
lexState = "hexadecimal";
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
return newToken("numeric", sign * 0);
|
|
417
|
+
},
|
|
418
|
+
decimalInteger() {
|
|
419
|
+
switch (c) {
|
|
420
|
+
case ".":
|
|
421
|
+
buffer += read();
|
|
422
|
+
lexState = "decimalPoint";
|
|
423
|
+
return;
|
|
424
|
+
case "e":
|
|
425
|
+
case "E":
|
|
426
|
+
buffer += read();
|
|
427
|
+
lexState = "decimalExponent";
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (util.isDigit(c)) {
|
|
431
|
+
buffer += read();
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
return newToken("numeric", sign * Number(buffer));
|
|
435
|
+
},
|
|
436
|
+
decimalPointLeading() {
|
|
437
|
+
if (util.isDigit(c)) {
|
|
438
|
+
buffer += read();
|
|
439
|
+
lexState = "decimalFraction";
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
throw invalidChar(read());
|
|
443
|
+
},
|
|
444
|
+
decimalPoint() {
|
|
445
|
+
switch (c) {
|
|
446
|
+
case "e":
|
|
447
|
+
case "E":
|
|
448
|
+
buffer += read();
|
|
449
|
+
lexState = "decimalExponent";
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if (util.isDigit(c)) {
|
|
453
|
+
buffer += read();
|
|
454
|
+
lexState = "decimalFraction";
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
return newToken("numeric", sign * Number(buffer));
|
|
458
|
+
},
|
|
459
|
+
decimalFraction() {
|
|
460
|
+
switch (c) {
|
|
461
|
+
case "e":
|
|
462
|
+
case "E":
|
|
463
|
+
buffer += read();
|
|
464
|
+
lexState = "decimalExponent";
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if (util.isDigit(c)) {
|
|
468
|
+
buffer += read();
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
return newToken("numeric", sign * Number(buffer));
|
|
472
|
+
},
|
|
473
|
+
decimalExponent() {
|
|
474
|
+
switch (c) {
|
|
475
|
+
case "+":
|
|
476
|
+
case "-":
|
|
477
|
+
buffer += read();
|
|
478
|
+
lexState = "decimalExponentSign";
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
if (util.isDigit(c)) {
|
|
482
|
+
buffer += read();
|
|
483
|
+
lexState = "decimalExponentInteger";
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
throw invalidChar(read());
|
|
487
|
+
},
|
|
488
|
+
decimalExponentSign() {
|
|
489
|
+
if (util.isDigit(c)) {
|
|
490
|
+
buffer += read();
|
|
491
|
+
lexState = "decimalExponentInteger";
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
throw invalidChar(read());
|
|
495
|
+
},
|
|
496
|
+
decimalExponentInteger() {
|
|
497
|
+
if (util.isDigit(c)) {
|
|
498
|
+
buffer += read();
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
return newToken("numeric", sign * Number(buffer));
|
|
502
|
+
},
|
|
503
|
+
hexadecimal() {
|
|
504
|
+
if (util.isHexDigit(c)) {
|
|
505
|
+
buffer += read();
|
|
506
|
+
lexState = "hexadecimalInteger";
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
throw invalidChar(read());
|
|
510
|
+
},
|
|
511
|
+
hexadecimalInteger() {
|
|
512
|
+
if (util.isHexDigit(c)) {
|
|
513
|
+
buffer += read();
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
return newToken("numeric", sign * Number(buffer));
|
|
517
|
+
},
|
|
518
|
+
string() {
|
|
519
|
+
switch (c) {
|
|
520
|
+
case "\\":
|
|
521
|
+
read();
|
|
522
|
+
buffer += escape();
|
|
523
|
+
return;
|
|
524
|
+
case '"':
|
|
525
|
+
if (doubleQuote) {
|
|
526
|
+
read();
|
|
527
|
+
return newToken("string", buffer);
|
|
528
|
+
}
|
|
529
|
+
buffer += read();
|
|
530
|
+
return;
|
|
531
|
+
case "'":
|
|
532
|
+
if (!doubleQuote) {
|
|
533
|
+
read();
|
|
534
|
+
return newToken("string", buffer);
|
|
535
|
+
}
|
|
536
|
+
buffer += read();
|
|
537
|
+
return;
|
|
538
|
+
case "\n":
|
|
539
|
+
case "\r":
|
|
540
|
+
throw invalidChar(read());
|
|
541
|
+
case "\u2028":
|
|
542
|
+
case "\u2029":
|
|
543
|
+
separatorChar(c);
|
|
544
|
+
break;
|
|
545
|
+
case void 0:
|
|
546
|
+
throw invalidChar(read());
|
|
547
|
+
}
|
|
548
|
+
buffer += read();
|
|
549
|
+
},
|
|
550
|
+
start() {
|
|
551
|
+
switch (c) {
|
|
552
|
+
case "{":
|
|
553
|
+
case "[":
|
|
554
|
+
return newToken("punctuator", read());
|
|
555
|
+
}
|
|
556
|
+
lexState = "value";
|
|
557
|
+
},
|
|
558
|
+
beforePropertyName() {
|
|
559
|
+
switch (c) {
|
|
560
|
+
case "$":
|
|
561
|
+
case "_":
|
|
562
|
+
buffer = read();
|
|
563
|
+
lexState = "identifierName";
|
|
564
|
+
return;
|
|
565
|
+
case "\\":
|
|
566
|
+
read();
|
|
567
|
+
lexState = "identifierNameStartEscape";
|
|
568
|
+
return;
|
|
569
|
+
case "}":
|
|
570
|
+
return newToken("punctuator", read());
|
|
571
|
+
case '"':
|
|
572
|
+
case "'":
|
|
573
|
+
doubleQuote = read() === '"';
|
|
574
|
+
lexState = "string";
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
if (util.isIdStartChar(c)) {
|
|
578
|
+
buffer += read();
|
|
579
|
+
lexState = "identifierName";
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
throw invalidChar(read());
|
|
583
|
+
},
|
|
584
|
+
afterPropertyName() {
|
|
585
|
+
if (c === ":") {
|
|
586
|
+
return newToken("punctuator", read());
|
|
587
|
+
}
|
|
588
|
+
throw invalidChar(read());
|
|
589
|
+
},
|
|
590
|
+
beforePropertyValue() {
|
|
591
|
+
lexState = "value";
|
|
592
|
+
},
|
|
593
|
+
afterPropertyValue() {
|
|
594
|
+
switch (c) {
|
|
595
|
+
case ",":
|
|
596
|
+
case "}":
|
|
597
|
+
return newToken("punctuator", read());
|
|
598
|
+
}
|
|
599
|
+
throw invalidChar(read());
|
|
600
|
+
},
|
|
601
|
+
beforeArrayValue() {
|
|
602
|
+
if (c === "]") {
|
|
603
|
+
return newToken("punctuator", read());
|
|
604
|
+
}
|
|
605
|
+
lexState = "value";
|
|
606
|
+
},
|
|
607
|
+
afterArrayValue() {
|
|
608
|
+
switch (c) {
|
|
609
|
+
case ",":
|
|
610
|
+
case "]":
|
|
611
|
+
return newToken("punctuator", read());
|
|
612
|
+
}
|
|
613
|
+
throw invalidChar(read());
|
|
614
|
+
},
|
|
615
|
+
end() {
|
|
616
|
+
throw invalidChar(read());
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
function newToken(type, value) {
|
|
620
|
+
return {
|
|
621
|
+
type,
|
|
622
|
+
value,
|
|
623
|
+
line,
|
|
624
|
+
column
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
function literal(s) {
|
|
628
|
+
for (const c2 of s) {
|
|
629
|
+
const p2 = peek();
|
|
630
|
+
if (p2 !== c2) {
|
|
631
|
+
throw invalidChar(read());
|
|
632
|
+
}
|
|
633
|
+
read();
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
function escape() {
|
|
637
|
+
const c2 = peek();
|
|
638
|
+
switch (c2) {
|
|
639
|
+
case "b":
|
|
640
|
+
read();
|
|
641
|
+
return "\b";
|
|
642
|
+
case "f":
|
|
643
|
+
read();
|
|
644
|
+
return "\f";
|
|
645
|
+
case "n":
|
|
646
|
+
read();
|
|
647
|
+
return "\n";
|
|
648
|
+
case "r":
|
|
649
|
+
read();
|
|
650
|
+
return "\r";
|
|
651
|
+
case "t":
|
|
652
|
+
read();
|
|
653
|
+
return " ";
|
|
654
|
+
case "v":
|
|
655
|
+
read();
|
|
656
|
+
return "\v";
|
|
657
|
+
case "0":
|
|
658
|
+
read();
|
|
659
|
+
if (util.isDigit(peek())) {
|
|
660
|
+
throw invalidChar(read());
|
|
661
|
+
}
|
|
662
|
+
return "\0";
|
|
663
|
+
case "x":
|
|
664
|
+
read();
|
|
665
|
+
return hexEscape();
|
|
666
|
+
case "u":
|
|
667
|
+
read();
|
|
668
|
+
return unicodeEscape();
|
|
669
|
+
case "\n":
|
|
670
|
+
case "\u2028":
|
|
671
|
+
case "\u2029":
|
|
672
|
+
read();
|
|
673
|
+
return "";
|
|
674
|
+
case "\r":
|
|
675
|
+
read();
|
|
676
|
+
if (peek() === "\n") {
|
|
677
|
+
read();
|
|
678
|
+
}
|
|
679
|
+
return "";
|
|
680
|
+
case "1":
|
|
681
|
+
case "2":
|
|
682
|
+
case "3":
|
|
683
|
+
case "4":
|
|
684
|
+
case "5":
|
|
685
|
+
case "6":
|
|
686
|
+
case "7":
|
|
687
|
+
case "8":
|
|
688
|
+
case "9":
|
|
689
|
+
throw invalidChar(read());
|
|
690
|
+
case void 0:
|
|
691
|
+
throw invalidChar(read());
|
|
692
|
+
}
|
|
693
|
+
return read();
|
|
694
|
+
}
|
|
695
|
+
function hexEscape() {
|
|
696
|
+
let buffer2 = "";
|
|
697
|
+
let c2 = peek();
|
|
698
|
+
if (!util.isHexDigit(c2)) {
|
|
699
|
+
throw invalidChar(read());
|
|
700
|
+
}
|
|
701
|
+
buffer2 += read();
|
|
702
|
+
c2 = peek();
|
|
703
|
+
if (!util.isHexDigit(c2)) {
|
|
704
|
+
throw invalidChar(read());
|
|
705
|
+
}
|
|
706
|
+
buffer2 += read();
|
|
707
|
+
return String.fromCodePoint(parseInt(buffer2, 16));
|
|
708
|
+
}
|
|
709
|
+
function unicodeEscape() {
|
|
710
|
+
let buffer2 = "";
|
|
711
|
+
let count = 4;
|
|
712
|
+
while (count-- > 0) {
|
|
713
|
+
const c2 = peek();
|
|
714
|
+
if (!util.isHexDigit(c2)) {
|
|
715
|
+
throw invalidChar(read());
|
|
716
|
+
}
|
|
717
|
+
buffer2 += read();
|
|
718
|
+
}
|
|
719
|
+
return String.fromCodePoint(parseInt(buffer2, 16));
|
|
720
|
+
}
|
|
721
|
+
const parseStates = {
|
|
722
|
+
start() {
|
|
723
|
+
if (token.type === "eof") {
|
|
724
|
+
throw invalidEOF();
|
|
725
|
+
}
|
|
726
|
+
push();
|
|
727
|
+
},
|
|
728
|
+
beforePropertyName() {
|
|
729
|
+
switch (token.type) {
|
|
730
|
+
case "identifier":
|
|
731
|
+
case "string":
|
|
732
|
+
key = token.value;
|
|
733
|
+
parseState = "afterPropertyName";
|
|
734
|
+
return;
|
|
735
|
+
case "punctuator":
|
|
736
|
+
pop();
|
|
737
|
+
return;
|
|
738
|
+
case "eof":
|
|
739
|
+
throw invalidEOF();
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
afterPropertyName() {
|
|
743
|
+
if (token.type === "eof") {
|
|
744
|
+
throw invalidEOF();
|
|
745
|
+
}
|
|
746
|
+
parseState = "beforePropertyValue";
|
|
747
|
+
},
|
|
748
|
+
beforePropertyValue() {
|
|
749
|
+
if (token.type === "eof") {
|
|
750
|
+
throw invalidEOF();
|
|
751
|
+
}
|
|
752
|
+
push();
|
|
753
|
+
},
|
|
754
|
+
beforeArrayValue() {
|
|
755
|
+
if (token.type === "eof") {
|
|
756
|
+
throw invalidEOF();
|
|
757
|
+
}
|
|
758
|
+
if (token.type === "punctuator" && token.value === "]") {
|
|
759
|
+
pop();
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
push();
|
|
763
|
+
},
|
|
764
|
+
afterPropertyValue() {
|
|
765
|
+
if (token.type === "eof") {
|
|
766
|
+
throw invalidEOF();
|
|
767
|
+
}
|
|
768
|
+
switch (token.value) {
|
|
769
|
+
case ",":
|
|
770
|
+
parseState = "beforePropertyName";
|
|
771
|
+
return;
|
|
772
|
+
case "}":
|
|
773
|
+
pop();
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
afterArrayValue() {
|
|
777
|
+
if (token.type === "eof") {
|
|
778
|
+
throw invalidEOF();
|
|
779
|
+
}
|
|
780
|
+
switch (token.value) {
|
|
781
|
+
case ",":
|
|
782
|
+
parseState = "beforeArrayValue";
|
|
783
|
+
return;
|
|
784
|
+
case "]":
|
|
785
|
+
pop();
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
end() {
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
function push() {
|
|
792
|
+
let value;
|
|
793
|
+
switch (token.type) {
|
|
794
|
+
case "punctuator":
|
|
795
|
+
switch (token.value) {
|
|
796
|
+
case "{":
|
|
797
|
+
value = {};
|
|
798
|
+
break;
|
|
799
|
+
case "[":
|
|
800
|
+
value = [];
|
|
801
|
+
break;
|
|
802
|
+
}
|
|
803
|
+
break;
|
|
804
|
+
case "null":
|
|
805
|
+
case "boolean":
|
|
806
|
+
case "numeric":
|
|
807
|
+
case "string":
|
|
808
|
+
value = token.value;
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
if (root === void 0) {
|
|
812
|
+
root = value;
|
|
813
|
+
} else {
|
|
814
|
+
const parent = stack[stack.length - 1];
|
|
815
|
+
if (Array.isArray(parent)) {
|
|
816
|
+
parent.push(value);
|
|
817
|
+
} else {
|
|
818
|
+
Object.defineProperty(parent, key, {
|
|
819
|
+
value,
|
|
820
|
+
writable: true,
|
|
821
|
+
enumerable: true,
|
|
822
|
+
configurable: true
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
if (value !== null && typeof value === "object") {
|
|
827
|
+
stack.push(value);
|
|
828
|
+
if (Array.isArray(value)) {
|
|
829
|
+
parseState = "beforeArrayValue";
|
|
830
|
+
} else {
|
|
831
|
+
parseState = "beforePropertyName";
|
|
832
|
+
}
|
|
833
|
+
} else {
|
|
834
|
+
const current = stack[stack.length - 1];
|
|
835
|
+
if (current == null) {
|
|
836
|
+
parseState = "end";
|
|
837
|
+
} else if (Array.isArray(current)) {
|
|
838
|
+
parseState = "afterArrayValue";
|
|
839
|
+
} else {
|
|
840
|
+
parseState = "afterPropertyValue";
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
function pop() {
|
|
845
|
+
stack.pop();
|
|
846
|
+
const current = stack[stack.length - 1];
|
|
847
|
+
if (current == null) {
|
|
848
|
+
parseState = "end";
|
|
849
|
+
} else if (Array.isArray(current)) {
|
|
850
|
+
parseState = "afterArrayValue";
|
|
851
|
+
} else {
|
|
852
|
+
parseState = "afterPropertyValue";
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
function invalidChar(c2) {
|
|
856
|
+
if (c2 === void 0) {
|
|
857
|
+
return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
|
|
858
|
+
}
|
|
859
|
+
return syntaxError(`JSON5: invalid character '${formatChar(c2)}' at ${line}:${column}`);
|
|
860
|
+
}
|
|
861
|
+
function invalidEOF() {
|
|
862
|
+
return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
|
|
863
|
+
}
|
|
864
|
+
function invalidIdentifier() {
|
|
865
|
+
column -= 5;
|
|
866
|
+
return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`);
|
|
867
|
+
}
|
|
868
|
+
function separatorChar(c2) {
|
|
869
|
+
console.warn(`JSON5: '${formatChar(c2)}' in strings is not valid ECMAScript; consider escaping`);
|
|
870
|
+
}
|
|
871
|
+
function formatChar(c2) {
|
|
872
|
+
const replacements = {
|
|
873
|
+
"'": "\\'",
|
|
874
|
+
'"': '\\"',
|
|
875
|
+
"\\": "\\\\",
|
|
876
|
+
"\b": "\\b",
|
|
877
|
+
"\f": "\\f",
|
|
878
|
+
"\n": "\\n",
|
|
879
|
+
"\r": "\\r",
|
|
880
|
+
" ": "\\t",
|
|
881
|
+
"\v": "\\v",
|
|
882
|
+
"\0": "\\0",
|
|
883
|
+
"\u2028": "\\u2028",
|
|
884
|
+
"\u2029": "\\u2029"
|
|
885
|
+
};
|
|
886
|
+
if (replacements[c2]) {
|
|
887
|
+
return replacements[c2];
|
|
888
|
+
}
|
|
889
|
+
if (c2 < " ") {
|
|
890
|
+
const hexString = c2.charCodeAt(0).toString(16);
|
|
891
|
+
return "\\x" + ("00" + hexString).substring(hexString.length);
|
|
892
|
+
}
|
|
893
|
+
return c2;
|
|
894
|
+
}
|
|
895
|
+
function syntaxError(message) {
|
|
896
|
+
const err = new SyntaxError(message);
|
|
897
|
+
err.lineNumber = line;
|
|
898
|
+
err.columnNumber = column;
|
|
899
|
+
return err;
|
|
900
|
+
}
|
|
901
|
+
var stringify = function stringify2(value, replacer, space) {
|
|
902
|
+
const stack2 = [];
|
|
903
|
+
let indent = "";
|
|
904
|
+
let propertyList;
|
|
905
|
+
let replacerFunc;
|
|
906
|
+
let gap = "";
|
|
907
|
+
let quote;
|
|
908
|
+
if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) {
|
|
909
|
+
space = replacer.space;
|
|
910
|
+
quote = replacer.quote;
|
|
911
|
+
replacer = replacer.replacer;
|
|
912
|
+
}
|
|
913
|
+
if (typeof replacer === "function") {
|
|
914
|
+
replacerFunc = replacer;
|
|
915
|
+
} else if (Array.isArray(replacer)) {
|
|
916
|
+
propertyList = [];
|
|
917
|
+
for (const v of replacer) {
|
|
918
|
+
let item;
|
|
919
|
+
if (typeof v === "string") {
|
|
920
|
+
item = v;
|
|
921
|
+
} else if (typeof v === "number" || v instanceof String || v instanceof Number) {
|
|
922
|
+
item = String(v);
|
|
923
|
+
}
|
|
924
|
+
if (item !== void 0 && propertyList.indexOf(item) < 0) {
|
|
925
|
+
propertyList.push(item);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
if (space instanceof Number) {
|
|
930
|
+
space = Number(space);
|
|
931
|
+
} else if (space instanceof String) {
|
|
932
|
+
space = String(space);
|
|
933
|
+
}
|
|
934
|
+
if (typeof space === "number") {
|
|
935
|
+
if (space > 0) {
|
|
936
|
+
space = Math.min(10, Math.floor(space));
|
|
937
|
+
gap = " ".substr(0, space);
|
|
938
|
+
}
|
|
939
|
+
} else if (typeof space === "string") {
|
|
940
|
+
gap = space.substr(0, 10);
|
|
941
|
+
}
|
|
942
|
+
return serializeProperty("", { "": value });
|
|
943
|
+
function serializeProperty(key2, holder) {
|
|
944
|
+
let value2 = holder[key2];
|
|
945
|
+
if (value2 != null) {
|
|
946
|
+
if (typeof value2.toJSON5 === "function") {
|
|
947
|
+
value2 = value2.toJSON5(key2);
|
|
948
|
+
} else if (typeof value2.toJSON === "function") {
|
|
949
|
+
value2 = value2.toJSON(key2);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
if (replacerFunc) {
|
|
953
|
+
value2 = replacerFunc.call(holder, key2, value2);
|
|
954
|
+
}
|
|
955
|
+
if (value2 instanceof Number) {
|
|
956
|
+
value2 = Number(value2);
|
|
957
|
+
} else if (value2 instanceof String) {
|
|
958
|
+
value2 = String(value2);
|
|
959
|
+
} else if (value2 instanceof Boolean) {
|
|
960
|
+
value2 = value2.valueOf();
|
|
961
|
+
}
|
|
962
|
+
switch (value2) {
|
|
963
|
+
case null:
|
|
964
|
+
return "null";
|
|
965
|
+
case true:
|
|
966
|
+
return "true";
|
|
967
|
+
case false:
|
|
968
|
+
return "false";
|
|
969
|
+
}
|
|
970
|
+
if (typeof value2 === "string") {
|
|
971
|
+
return quoteString(value2);
|
|
972
|
+
}
|
|
973
|
+
if (typeof value2 === "number") {
|
|
974
|
+
return String(value2);
|
|
975
|
+
}
|
|
976
|
+
if (typeof value2 === "object") {
|
|
977
|
+
return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
|
|
978
|
+
}
|
|
979
|
+
return void 0;
|
|
980
|
+
}
|
|
981
|
+
function quoteString(value2) {
|
|
982
|
+
const quotes = {
|
|
983
|
+
"'": 0.1,
|
|
984
|
+
'"': 0.2
|
|
985
|
+
};
|
|
986
|
+
const replacements = {
|
|
987
|
+
"'": "\\'",
|
|
988
|
+
'"': '\\"',
|
|
989
|
+
"\\": "\\\\",
|
|
990
|
+
"\b": "\\b",
|
|
991
|
+
"\f": "\\f",
|
|
992
|
+
"\n": "\\n",
|
|
993
|
+
"\r": "\\r",
|
|
994
|
+
" ": "\\t",
|
|
995
|
+
"\v": "\\v",
|
|
996
|
+
"\0": "\\0",
|
|
997
|
+
"\u2028": "\\u2028",
|
|
998
|
+
"\u2029": "\\u2029"
|
|
999
|
+
};
|
|
1000
|
+
let product = "";
|
|
1001
|
+
for (let i = 0; i < value2.length; i++) {
|
|
1002
|
+
const c2 = value2[i];
|
|
1003
|
+
switch (c2) {
|
|
1004
|
+
case "'":
|
|
1005
|
+
case '"':
|
|
1006
|
+
quotes[c2]++;
|
|
1007
|
+
product += c2;
|
|
1008
|
+
continue;
|
|
1009
|
+
case "\0":
|
|
1010
|
+
if (util.isDigit(value2[i + 1])) {
|
|
1011
|
+
product += "\\x00";
|
|
1012
|
+
continue;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
if (replacements[c2]) {
|
|
1016
|
+
product += replacements[c2];
|
|
1017
|
+
continue;
|
|
1018
|
+
}
|
|
1019
|
+
if (c2 < " ") {
|
|
1020
|
+
let hexString = c2.charCodeAt(0).toString(16);
|
|
1021
|
+
product += "\\x" + ("00" + hexString).substring(hexString.length);
|
|
1022
|
+
continue;
|
|
1023
|
+
}
|
|
1024
|
+
product += c2;
|
|
1025
|
+
}
|
|
1026
|
+
const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
|
|
1027
|
+
product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
|
|
1028
|
+
return quoteChar + product + quoteChar;
|
|
1029
|
+
}
|
|
1030
|
+
function serializeObject(value2) {
|
|
1031
|
+
if (stack2.indexOf(value2) >= 0) {
|
|
1032
|
+
throw TypeError("Converting circular structure to JSON5");
|
|
1033
|
+
}
|
|
1034
|
+
stack2.push(value2);
|
|
1035
|
+
let stepback = indent;
|
|
1036
|
+
indent = indent + gap;
|
|
1037
|
+
let keys = propertyList || Object.keys(value2);
|
|
1038
|
+
let partial = [];
|
|
1039
|
+
for (const key2 of keys) {
|
|
1040
|
+
const propertyString = serializeProperty(key2, value2);
|
|
1041
|
+
if (propertyString !== void 0) {
|
|
1042
|
+
let member = serializeKey(key2) + ":";
|
|
1043
|
+
if (gap !== "") {
|
|
1044
|
+
member += " ";
|
|
1045
|
+
}
|
|
1046
|
+
member += propertyString;
|
|
1047
|
+
partial.push(member);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
let final;
|
|
1051
|
+
if (partial.length === 0) {
|
|
1052
|
+
final = "{}";
|
|
1053
|
+
} else {
|
|
1054
|
+
let properties;
|
|
1055
|
+
if (gap === "") {
|
|
1056
|
+
properties = partial.join(",");
|
|
1057
|
+
final = "{" + properties + "}";
|
|
1058
|
+
} else {
|
|
1059
|
+
let separator = ",\n" + indent;
|
|
1060
|
+
properties = partial.join(separator);
|
|
1061
|
+
final = "{\n" + indent + properties + ",\n" + stepback + "}";
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
stack2.pop();
|
|
1065
|
+
indent = stepback;
|
|
1066
|
+
return final;
|
|
1067
|
+
}
|
|
1068
|
+
function serializeKey(key2) {
|
|
1069
|
+
if (key2.length === 0) {
|
|
1070
|
+
return quoteString(key2);
|
|
1071
|
+
}
|
|
1072
|
+
const firstChar = String.fromCodePoint(key2.codePointAt(0));
|
|
1073
|
+
if (!util.isIdStartChar(firstChar)) {
|
|
1074
|
+
return quoteString(key2);
|
|
1075
|
+
}
|
|
1076
|
+
for (let i = firstChar.length; i < key2.length; i++) {
|
|
1077
|
+
if (!util.isIdContinueChar(String.fromCodePoint(key2.codePointAt(i)))) {
|
|
1078
|
+
return quoteString(key2);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
return key2;
|
|
1082
|
+
}
|
|
1083
|
+
function serializeArray(value2) {
|
|
1084
|
+
if (stack2.indexOf(value2) >= 0) {
|
|
1085
|
+
throw TypeError("Converting circular structure to JSON5");
|
|
1086
|
+
}
|
|
1087
|
+
stack2.push(value2);
|
|
1088
|
+
let stepback = indent;
|
|
1089
|
+
indent = indent + gap;
|
|
1090
|
+
let partial = [];
|
|
1091
|
+
for (let i = 0; i < value2.length; i++) {
|
|
1092
|
+
const propertyString = serializeProperty(String(i), value2);
|
|
1093
|
+
partial.push(propertyString !== void 0 ? propertyString : "null");
|
|
1094
|
+
}
|
|
1095
|
+
let final;
|
|
1096
|
+
if (partial.length === 0) {
|
|
1097
|
+
final = "[]";
|
|
1098
|
+
} else {
|
|
1099
|
+
if (gap === "") {
|
|
1100
|
+
let properties = partial.join(",");
|
|
1101
|
+
final = "[" + properties + "]";
|
|
1102
|
+
} else {
|
|
1103
|
+
let separator = ",\n" + indent;
|
|
1104
|
+
let properties = partial.join(separator);
|
|
1105
|
+
final = "[\n" + indent + properties + ",\n" + stepback + "]";
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
stack2.pop();
|
|
1109
|
+
indent = stepback;
|
|
1110
|
+
return final;
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
const JSON5 = {
|
|
1114
|
+
parse,
|
|
1115
|
+
stringify
|
|
1116
|
+
};
|
|
1117
|
+
var lib = JSON5;
|
|
1118
|
+
const ChartQueryMetadataContext = require$$0.createContext({
|
|
1119
|
+
refresh: () => {
|
|
1120
|
+
},
|
|
1121
|
+
data: []
|
|
1122
|
+
});
|
|
1123
|
+
const ChartQueryMetadataProvider = (props) => {
|
|
1124
|
+
var _a;
|
|
1125
|
+
const api2 = client.useAPIClient();
|
|
1126
|
+
const options = {
|
|
1127
|
+
resource: "chartsQueries",
|
|
1128
|
+
action: "listMetadata",
|
|
1129
|
+
params: {
|
|
1130
|
+
paginate: false,
|
|
1131
|
+
sort: ["-id"]
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
const location = reactRouterDom.useLocation();
|
|
1135
|
+
const service = client.useRequest(options, {
|
|
1136
|
+
manual: true
|
|
1137
|
+
});
|
|
1138
|
+
const isAdminPage = location.pathname.startsWith("/admin");
|
|
1139
|
+
const token2 = api2.auth.getToken() || "";
|
|
1140
|
+
require$$0.useEffect(() => {
|
|
1141
|
+
if (isAdminPage && token2) {
|
|
1142
|
+
service.run();
|
|
1143
|
+
}
|
|
1144
|
+
}, [isAdminPage, token2]);
|
|
1145
|
+
const refresh = async () => {
|
|
1146
|
+
const { data } = await api2.request(options);
|
|
1147
|
+
service.mutate(data);
|
|
1148
|
+
return (data == null ? void 0 : data.data) || [];
|
|
1149
|
+
};
|
|
1150
|
+
if (service.loading) {
|
|
1151
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Spin, {});
|
|
1152
|
+
}
|
|
1153
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1154
|
+
ChartQueryMetadataContext.Provider,
|
|
1155
|
+
{
|
|
1156
|
+
value: {
|
|
1157
|
+
refresh,
|
|
1158
|
+
data: (_a = service.data) == null ? void 0 : _a.data
|
|
1159
|
+
},
|
|
1160
|
+
children: props.children
|
|
1161
|
+
}
|
|
1162
|
+
);
|
|
1163
|
+
};
|
|
1164
|
+
const useChartQueryMetadataContext = () => {
|
|
1165
|
+
return require$$0.useContext(ChartQueryMetadataContext);
|
|
1166
|
+
};
|
|
1167
|
+
const NAMESPACE = "charts";
|
|
1168
|
+
function lang(key2) {
|
|
1169
|
+
return client.i18n.t(key2, { ns: NAMESPACE });
|
|
1170
|
+
}
|
|
1171
|
+
const json = {
|
|
1172
|
+
type: "object",
|
|
1173
|
+
properties: {
|
|
1174
|
+
data: {
|
|
1175
|
+
title: "JSON",
|
|
1176
|
+
required: true,
|
|
1177
|
+
"x-component": "Input.TextArea",
|
|
1178
|
+
"x-validator": { json5: true },
|
|
1179
|
+
"x-component-props": {
|
|
1180
|
+
autoSize: {
|
|
1181
|
+
maxRows: 20,
|
|
1182
|
+
minRows: 10
|
|
1183
|
+
}
|
|
1184
|
+
},
|
|
1185
|
+
"x-decorator": "FormItem"
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1189
|
+
const sql = {
|
|
1190
|
+
type: "object",
|
|
1191
|
+
properties: {
|
|
1192
|
+
sql: {
|
|
1193
|
+
title: "SQL",
|
|
1194
|
+
required: true,
|
|
1195
|
+
"x-component": "Input.TextArea",
|
|
1196
|
+
"x-decorator": "FormItem",
|
|
1197
|
+
"x-validator": {
|
|
1198
|
+
triggerType: "onBlur",
|
|
1199
|
+
validator: "{{validateSQL}}"
|
|
1200
|
+
},
|
|
1201
|
+
"x-component-props": {
|
|
1202
|
+
autoSize: {
|
|
1203
|
+
maxRows: 20,
|
|
1204
|
+
minRows: 10
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
const api = {
|
|
1211
|
+
type: "object",
|
|
1212
|
+
properties: {
|
|
1213
|
+
api: {
|
|
1214
|
+
title: "API",
|
|
1215
|
+
required: true,
|
|
1216
|
+
"x-component": "Input",
|
|
1217
|
+
"x-decorator": "FormItem"
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
const types = {
|
|
1222
|
+
json,
|
|
1223
|
+
sql,
|
|
1224
|
+
api
|
|
1225
|
+
};
|
|
1226
|
+
const getQueryTypeSchema = (type) => {
|
|
1227
|
+
return lodash.cloneDeep(types[type]);
|
|
1228
|
+
};
|
|
1229
|
+
const ChartQueryBlockInitializer = (props) => {
|
|
1230
|
+
const { templateWrap, onCreateBlockSchema, componentType, createBlockSchema, insert, ...others } = props;
|
|
1231
|
+
const { setVisible } = require$$0.useContext(client.SchemaInitializerButtonContext);
|
|
1232
|
+
const apiClient = client.useAPIClient();
|
|
1233
|
+
const ctx = useChartQueryMetadataContext();
|
|
1234
|
+
const options = require$$0.useContext(react.SchemaOptionsContext);
|
|
1235
|
+
const { theme } = client.useGlobalTheme();
|
|
1236
|
+
const onAddQuery = require$$0.useCallback(
|
|
1237
|
+
(info) => {
|
|
1238
|
+
client.FormDialog(
|
|
1239
|
+
{
|
|
1240
|
+
sql: lang("Add SQL query"),
|
|
1241
|
+
json: lang("Add JSON query")
|
|
1242
|
+
}[info.key],
|
|
1243
|
+
() => {
|
|
1244
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponentOptions, { scope: options.scope, components: { ...options.components }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(antdV5.FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1245
|
+
client.SchemaComponent,
|
|
1246
|
+
{
|
|
1247
|
+
schema: {
|
|
1248
|
+
type: "object",
|
|
1249
|
+
properties: {
|
|
1250
|
+
title: {
|
|
1251
|
+
title: lang("Title"),
|
|
1252
|
+
required: true,
|
|
1253
|
+
"x-component": "Input",
|
|
1254
|
+
"x-decorator": "FormItem"
|
|
1255
|
+
},
|
|
1256
|
+
options: getQueryTypeSchema(info.key)
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
) }) }) });
|
|
1261
|
+
},
|
|
1262
|
+
theme
|
|
1263
|
+
).open({
|
|
1264
|
+
initialValues: {
|
|
1265
|
+
type: info.key
|
|
1266
|
+
}
|
|
1267
|
+
}).then(async (values) => {
|
|
1268
|
+
var _a;
|
|
1269
|
+
try {
|
|
1270
|
+
if ((_a = apiClient.resource("chartsQueries")) == null ? void 0 : _a.create) {
|
|
1271
|
+
const { data } = await apiClient.resource("chartsQueries").create({ values });
|
|
1272
|
+
const items2 = await ctx.refresh();
|
|
1273
|
+
const item = items2.find((item2) => {
|
|
1274
|
+
var _a2;
|
|
1275
|
+
return item2.id === ((_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.id);
|
|
1276
|
+
});
|
|
1277
|
+
onCreateBlockSchema({ item });
|
|
1278
|
+
}
|
|
1279
|
+
setVisible(false);
|
|
1280
|
+
} catch (err) {
|
|
1281
|
+
client$1.error(err);
|
|
1282
|
+
}
|
|
1283
|
+
}).catch((err) => {
|
|
1284
|
+
client$1.error(err);
|
|
1285
|
+
});
|
|
1286
|
+
},
|
|
1287
|
+
[apiClient, ctx, onCreateBlockSchema, options.components, options.scope, setVisible]
|
|
1288
|
+
);
|
|
1289
|
+
const items = require$$0.useMemo(() => {
|
|
1290
|
+
const defaultItems = [
|
|
1291
|
+
{
|
|
1292
|
+
type: "itemGroup",
|
|
1293
|
+
title: lang("Select query data"),
|
|
1294
|
+
children: []
|
|
1295
|
+
}
|
|
1296
|
+
];
|
|
1297
|
+
const chartQueryMetadata = ctx.data;
|
|
1298
|
+
if (chartQueryMetadata && Array.isArray(chartQueryMetadata)) {
|
|
1299
|
+
const item1 = chartQueryMetadata.length > 0 ? {
|
|
1300
|
+
type: "itemGroup",
|
|
1301
|
+
title: '{{t("Select chart query", {ns: "charts"})}}',
|
|
1302
|
+
children: chartQueryMetadata
|
|
1303
|
+
} : null;
|
|
1304
|
+
const item2 = chartQueryMetadata.length > 0 ? {
|
|
1305
|
+
type: "divider"
|
|
1306
|
+
} : null;
|
|
1307
|
+
return [
|
|
1308
|
+
item1,
|
|
1309
|
+
item2,
|
|
1310
|
+
{
|
|
1311
|
+
type: "subMenu",
|
|
1312
|
+
title: lang("Add chart query"),
|
|
1313
|
+
// component: AddChartQuery,
|
|
1314
|
+
children: [
|
|
1315
|
+
{
|
|
1316
|
+
key: "sql",
|
|
1317
|
+
type: "item",
|
|
1318
|
+
title: "SQL",
|
|
1319
|
+
onClick: onAddQuery
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
key: "json",
|
|
1323
|
+
type: "item",
|
|
1324
|
+
title: "JSON",
|
|
1325
|
+
onClick: onAddQuery
|
|
1326
|
+
}
|
|
1327
|
+
]
|
|
1328
|
+
}
|
|
1329
|
+
].filter(Boolean);
|
|
1330
|
+
}
|
|
1331
|
+
return defaultItems;
|
|
1332
|
+
}, [ctx.data, onAddQuery]);
|
|
1333
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1334
|
+
client.SchemaInitializer.Item,
|
|
1335
|
+
{
|
|
1336
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.TableOutlined, {}),
|
|
1337
|
+
...others,
|
|
1338
|
+
onClick: async ({ item }) => {
|
|
1339
|
+
onCreateBlockSchema({ item });
|
|
1340
|
+
setVisible(false);
|
|
1341
|
+
},
|
|
1342
|
+
items
|
|
1343
|
+
}
|
|
1344
|
+
);
|
|
1345
|
+
};
|
|
1346
|
+
const DataSetPreviewTable = ({ queryId, fields }) => {
|
|
1347
|
+
const { dataSet, loading, error } = useGetDataSet(queryId);
|
|
1348
|
+
const columns = {};
|
|
1349
|
+
if (fields) {
|
|
1350
|
+
for (const field of fields) {
|
|
1351
|
+
columns[field.name] = {
|
|
1352
|
+
type: "void",
|
|
1353
|
+
title: field.name,
|
|
1354
|
+
"x-component": "TableV2.Column",
|
|
1355
|
+
"x-component-props": {
|
|
1356
|
+
// width: 200,
|
|
1357
|
+
},
|
|
1358
|
+
properties: {
|
|
1359
|
+
[field.name]: {
|
|
1360
|
+
type: "string",
|
|
1361
|
+
"x-component": "Input",
|
|
1362
|
+
"x-read-pretty": true
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
const schema = {
|
|
1369
|
+
type: "void",
|
|
1370
|
+
properties: {
|
|
1371
|
+
input: {
|
|
1372
|
+
type: "array",
|
|
1373
|
+
"x-component": "TableV2",
|
|
1374
|
+
"x-component-props": {
|
|
1375
|
+
scroll: { y: 300 }
|
|
1376
|
+
},
|
|
1377
|
+
default: dataSet,
|
|
1378
|
+
properties: columns
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
};
|
|
1382
|
+
if (error) {
|
|
1383
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Empty, { description: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "May be this chart block's query data has been deleted,please check!" }) }) });
|
|
1384
|
+
}
|
|
1385
|
+
if (loading)
|
|
1386
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Spin, {}) });
|
|
1387
|
+
dataSet.forEach((item) => {
|
|
1388
|
+
for (const key2 in item) {
|
|
1389
|
+
if (item[key2] && item[key2] instanceof Object) {
|
|
1390
|
+
item[key2] = JSON.stringify(item[key2]);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1394
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponentProvider, { scope: { dataSet }, components: { TableV2: client.TableV2, Input: client.Input, FormItem: client.FormItem }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponent, { schema }) });
|
|
1395
|
+
};
|
|
1396
|
+
const chartConfig$7 = {
|
|
1397
|
+
appendPadding: 10,
|
|
1398
|
+
angleField: "{{metric}}",
|
|
1399
|
+
colorField: "{{dimension}}",
|
|
1400
|
+
radius: 0.9,
|
|
1401
|
+
label: {
|
|
1402
|
+
type: "inner",
|
|
1403
|
+
offset: "-30%",
|
|
1404
|
+
content: "{{({percent}) => `${(percent * 100).toFixed(0)}%`}}",
|
|
1405
|
+
style: {
|
|
1406
|
+
fontSize: 14,
|
|
1407
|
+
textAlign: "center"
|
|
1408
|
+
}
|
|
1409
|
+
},
|
|
1410
|
+
interactions: [{ type: "element-active" }]
|
|
1411
|
+
};
|
|
1412
|
+
const pieTemplate = {
|
|
1413
|
+
description: "1 「Time」 or 「Order Noun」 field, 1 「Value」 field",
|
|
1414
|
+
title: "Pie",
|
|
1415
|
+
type: "Pie",
|
|
1416
|
+
iconId: "icon-pie",
|
|
1417
|
+
group: 2,
|
|
1418
|
+
renderComponent: "G2Plot",
|
|
1419
|
+
defaultChartOptions: chartConfig$7,
|
|
1420
|
+
configurableProperties: {
|
|
1421
|
+
type: "void",
|
|
1422
|
+
properties: {
|
|
1423
|
+
dimension: {
|
|
1424
|
+
required: true,
|
|
1425
|
+
type: "string",
|
|
1426
|
+
title: '{{t("Sector label / Dimensional",{ns:"charts"})}}',
|
|
1427
|
+
"x-decorator": "FormItem",
|
|
1428
|
+
"x-component": "Select",
|
|
1429
|
+
enum: "{{dataSource}}"
|
|
1430
|
+
},
|
|
1431
|
+
metric: {
|
|
1432
|
+
required: true,
|
|
1433
|
+
type: "string",
|
|
1434
|
+
title: '{{t("Sector Angle / Metric",{ns:"charts"})}}',
|
|
1435
|
+
"x-decorator": "FormItem",
|
|
1436
|
+
"x-component": "Select",
|
|
1437
|
+
enum: "{{dataSource}}"
|
|
1438
|
+
},
|
|
1439
|
+
jsonConfig: {
|
|
1440
|
+
type: "void",
|
|
1441
|
+
"x-component": "div",
|
|
1442
|
+
properties: {
|
|
1443
|
+
template: {
|
|
1444
|
+
required: true,
|
|
1445
|
+
title: '{{t("JSON config",{ns:"charts"})}}',
|
|
1446
|
+
type: "string",
|
|
1447
|
+
default: lib.stringify(chartConfig$7, null, 2),
|
|
1448
|
+
"x-decorator": "FormItem",
|
|
1449
|
+
"x-component": "Input.TextArea",
|
|
1450
|
+
"x-component-props": {
|
|
1451
|
+
autoSize: { minRows: 8, maxRows: 16 }
|
|
1452
|
+
},
|
|
1453
|
+
description: '{{jsonConfigDesc("Pie | G2Plot","https://g2plot.antv.antgroup.com/api/plots/pie")}}',
|
|
1454
|
+
"x-validator": { json5: true }
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1461
|
+
const chartConfig$6 = {
|
|
1462
|
+
appendPadding: 10,
|
|
1463
|
+
isGroup: true,
|
|
1464
|
+
yField: "{{dimension}}",
|
|
1465
|
+
xField: "{{metric}}",
|
|
1466
|
+
seriesField: "{{category}}",
|
|
1467
|
+
label: {
|
|
1468
|
+
// 可手动配置 label 数据标签位置
|
|
1469
|
+
position: "middle",
|
|
1470
|
+
// 'top', 'bottom', 'middle',
|
|
1471
|
+
// 配置样式
|
|
1472
|
+
style: {
|
|
1473
|
+
fill: "#FFFFFF",
|
|
1474
|
+
opacity: 0.6
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
xAxis: {
|
|
1478
|
+
label: {
|
|
1479
|
+
autoHide: true,
|
|
1480
|
+
autoRotate: false
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
const barTemplate = {
|
|
1485
|
+
description: "1 「time」 or 「ordered noun」 field, 1 「value」 field, 0~ 1 「unordered noun」",
|
|
1486
|
+
type: "Bar",
|
|
1487
|
+
title: "Bar",
|
|
1488
|
+
iconId: "icon-bar",
|
|
1489
|
+
group: 2,
|
|
1490
|
+
renderComponent: "G2Plot",
|
|
1491
|
+
defaultChartOptions: chartConfig$6,
|
|
1492
|
+
configurableProperties: {
|
|
1493
|
+
type: "void",
|
|
1494
|
+
properties: {
|
|
1495
|
+
dimension: {
|
|
1496
|
+
required: true,
|
|
1497
|
+
type: "string",
|
|
1498
|
+
title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
|
|
1499
|
+
"x-decorator": "FormItem",
|
|
1500
|
+
"x-component": "Select",
|
|
1501
|
+
enum: "{{dataSource}}"
|
|
1502
|
+
},
|
|
1503
|
+
metric: {
|
|
1504
|
+
required: true,
|
|
1505
|
+
type: "string",
|
|
1506
|
+
title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
|
|
1507
|
+
"x-decorator": "FormItem",
|
|
1508
|
+
"x-component": "Select",
|
|
1509
|
+
enum: "{{dataSource}}"
|
|
1510
|
+
},
|
|
1511
|
+
category: {
|
|
1512
|
+
type: "string",
|
|
1513
|
+
title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
|
|
1514
|
+
"x-decorator": "FormItem",
|
|
1515
|
+
"x-component": "Select",
|
|
1516
|
+
enum: "{{dataSource}}"
|
|
1517
|
+
},
|
|
1518
|
+
jsonConfig: {
|
|
1519
|
+
type: "void",
|
|
1520
|
+
"x-component": "div",
|
|
1521
|
+
properties: {
|
|
1522
|
+
template: {
|
|
1523
|
+
required: true,
|
|
1524
|
+
title: '{{t("JSON config",{ns:"charts"})}}',
|
|
1525
|
+
type: "string",
|
|
1526
|
+
default: lib.stringify(chartConfig$6, null, 2),
|
|
1527
|
+
"x-decorator": "FormItem",
|
|
1528
|
+
"x-component": "Input.TextArea",
|
|
1529
|
+
"x-component-props": {
|
|
1530
|
+
autoSize: { minRows: 8, maxRows: 16 }
|
|
1531
|
+
},
|
|
1532
|
+
description: '{{jsonConfigDesc("Bar | G2Plot","https://g2plot.antv.antgroup.com/api/plots/bar")}}',
|
|
1533
|
+
"x-validator": { json5: true }
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
const chartConfig$5 = {
|
|
1541
|
+
appendPadding: 10,
|
|
1542
|
+
isGroup: true,
|
|
1543
|
+
yField: "{{metric}}",
|
|
1544
|
+
xField: "{{dimension}}",
|
|
1545
|
+
seriesField: "{{category}}",
|
|
1546
|
+
label: {
|
|
1547
|
+
// 可手动配置 label 数据标签位置
|
|
1548
|
+
position: "middle",
|
|
1549
|
+
// 'top', 'bottom', 'middle',
|
|
1550
|
+
// 配置样式
|
|
1551
|
+
style: {
|
|
1552
|
+
fill: "#FFFFFF",
|
|
1553
|
+
opacity: 0.6
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
xAxis: {
|
|
1557
|
+
label: {
|
|
1558
|
+
autoHide: true,
|
|
1559
|
+
autoRotate: false
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
const columnTemplate = {
|
|
1564
|
+
description: "1 「time」 or 「ordered noun」 field, 1 「value」 field, 0 to 1 「unordered noun」",
|
|
1565
|
+
type: "Column",
|
|
1566
|
+
title: "Column",
|
|
1567
|
+
iconId: "icon-column",
|
|
1568
|
+
group: 2,
|
|
1569
|
+
renderComponent: "G2Plot",
|
|
1570
|
+
defaultChartOptions: chartConfig$5,
|
|
1571
|
+
configurableProperties: {
|
|
1572
|
+
type: "void",
|
|
1573
|
+
properties: {
|
|
1574
|
+
dimension: {
|
|
1575
|
+
required: true,
|
|
1576
|
+
type: "string",
|
|
1577
|
+
title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
|
|
1578
|
+
"x-decorator": "FormItem",
|
|
1579
|
+
"x-component": "Select",
|
|
1580
|
+
enum: "{{dataSource}}"
|
|
1581
|
+
},
|
|
1582
|
+
metric: {
|
|
1583
|
+
required: true,
|
|
1584
|
+
type: "string",
|
|
1585
|
+
title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
|
|
1586
|
+
"x-decorator": "FormItem",
|
|
1587
|
+
"x-component": "Select",
|
|
1588
|
+
enum: "{{dataSource}}"
|
|
1589
|
+
},
|
|
1590
|
+
category: {
|
|
1591
|
+
type: "string",
|
|
1592
|
+
title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
|
|
1593
|
+
"x-decorator": "FormItem",
|
|
1594
|
+
"x-component": "Select",
|
|
1595
|
+
enum: "{{dataSource}}"
|
|
1596
|
+
},
|
|
1597
|
+
jsonConfig: {
|
|
1598
|
+
type: "void",
|
|
1599
|
+
"x-component": "div",
|
|
1600
|
+
properties: {
|
|
1601
|
+
template: {
|
|
1602
|
+
required: true,
|
|
1603
|
+
title: '{{t("JSON config",{ns:"charts"})}}',
|
|
1604
|
+
type: "string",
|
|
1605
|
+
default: lib.stringify(chartConfig$5, null, 2),
|
|
1606
|
+
"x-decorator": "FormItem",
|
|
1607
|
+
"x-component": "Input.TextArea",
|
|
1608
|
+
"x-component-props": {
|
|
1609
|
+
autoSize: { minRows: 8, maxRows: 16 }
|
|
1610
|
+
},
|
|
1611
|
+
description: '{{jsonConfigDesc("Column | G2Plot","https://g2plot.antv.antgroup.com/api/plots/column")}}',
|
|
1612
|
+
"x-validator": { json5: true }
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
const chartConfig$4 = {
|
|
1620
|
+
yField: "{{metric}}",
|
|
1621
|
+
xField: "{{dimension}}",
|
|
1622
|
+
seriesField: "{{category}}",
|
|
1623
|
+
xAxis: {
|
|
1624
|
+
//type: 'time',
|
|
1625
|
+
},
|
|
1626
|
+
yAxis: {
|
|
1627
|
+
// label: {
|
|
1628
|
+
// formatter: '{{(v) => `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)}}',
|
|
1629
|
+
// },
|
|
1630
|
+
}
|
|
1631
|
+
};
|
|
1632
|
+
const lineTemplate = {
|
|
1633
|
+
description: "1 「Time」 or 「Order Noun」 field, 1 「Value」 field",
|
|
1634
|
+
type: "Line",
|
|
1635
|
+
title: "Line",
|
|
1636
|
+
iconId: "icon-line",
|
|
1637
|
+
group: 2,
|
|
1638
|
+
renderComponent: "G2Plot",
|
|
1639
|
+
defaultChartOptions: chartConfig$4,
|
|
1640
|
+
configurableProperties: {
|
|
1641
|
+
type: "void",
|
|
1642
|
+
properties: {
|
|
1643
|
+
dimension: {
|
|
1644
|
+
required: true,
|
|
1645
|
+
type: "string",
|
|
1646
|
+
title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
|
|
1647
|
+
"x-decorator": "FormItem",
|
|
1648
|
+
"x-component": "Select",
|
|
1649
|
+
enum: "{{dataSource}}"
|
|
1650
|
+
},
|
|
1651
|
+
metric: {
|
|
1652
|
+
required: true,
|
|
1653
|
+
type: "string",
|
|
1654
|
+
title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
|
|
1655
|
+
"x-decorator": "FormItem",
|
|
1656
|
+
"x-component": "Select",
|
|
1657
|
+
enum: "{{dataSource}}"
|
|
1658
|
+
},
|
|
1659
|
+
category: {
|
|
1660
|
+
type: "string",
|
|
1661
|
+
title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
|
|
1662
|
+
"x-decorator": "FormItem",
|
|
1663
|
+
"x-component": "Select",
|
|
1664
|
+
enum: "{{dataSource}}"
|
|
1665
|
+
},
|
|
1666
|
+
jsonConfig: {
|
|
1667
|
+
type: "void",
|
|
1668
|
+
"x-component": "div",
|
|
1669
|
+
properties: {
|
|
1670
|
+
template: {
|
|
1671
|
+
required: true,
|
|
1672
|
+
title: '{{t("JSON config",{ns:"charts"})}}',
|
|
1673
|
+
type: "string",
|
|
1674
|
+
default: lib.stringify(chartConfig$4, null, 2),
|
|
1675
|
+
"x-decorator": "FormItem",
|
|
1676
|
+
"x-component": "Input.TextArea",
|
|
1677
|
+
"x-component-props": {
|
|
1678
|
+
autoSize: { minRows: 8, maxRows: 16 }
|
|
1679
|
+
},
|
|
1680
|
+
description: '{{jsonConfigDesc("Line | G2Plot","https://g2plot.antv.antgroup.com/api/plots/line")}}',
|
|
1681
|
+
"x-validator": { json5: true }
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
};
|
|
1688
|
+
const chartConfig$3 = {
|
|
1689
|
+
yField: "{{metric}}",
|
|
1690
|
+
xField: "{{dimension}}",
|
|
1691
|
+
seriesField: "{{category}}"
|
|
1692
|
+
};
|
|
1693
|
+
const areaTemplate = {
|
|
1694
|
+
description: "1 「time」or 「Ordered Noun」 field,1 「Numerical」 field,1 「Unordered Noun」 field (optional)",
|
|
1695
|
+
type: "Area",
|
|
1696
|
+
title: "Area",
|
|
1697
|
+
iconId: "icon-area",
|
|
1698
|
+
group: 2,
|
|
1699
|
+
renderComponent: "G2Plot",
|
|
1700
|
+
defaultChartOptions: chartConfig$3,
|
|
1701
|
+
configurableProperties: {
|
|
1702
|
+
type: "void",
|
|
1703
|
+
properties: {
|
|
1704
|
+
dimension: {
|
|
1705
|
+
required: true,
|
|
1706
|
+
type: "string",
|
|
1707
|
+
title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
|
|
1708
|
+
"x-decorator": "FormItem",
|
|
1709
|
+
"x-component": "Select",
|
|
1710
|
+
enum: "{{dataSource}}"
|
|
1711
|
+
},
|
|
1712
|
+
metric: {
|
|
1713
|
+
required: true,
|
|
1714
|
+
type: "string",
|
|
1715
|
+
title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
|
|
1716
|
+
"x-decorator": "FormItem",
|
|
1717
|
+
"x-component": "Select",
|
|
1718
|
+
enum: "{{dataSource}}"
|
|
1719
|
+
},
|
|
1720
|
+
category: {
|
|
1721
|
+
type: "string",
|
|
1722
|
+
title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
|
|
1723
|
+
"x-decorator": "FormItem",
|
|
1724
|
+
"x-component": "Select",
|
|
1725
|
+
enum: "{{dataSource}}"
|
|
1726
|
+
},
|
|
1727
|
+
jsonConfig: {
|
|
1728
|
+
type: "void",
|
|
1729
|
+
"x-component": "div",
|
|
1730
|
+
properties: {
|
|
1731
|
+
template: {
|
|
1732
|
+
required: true,
|
|
1733
|
+
title: '{{t("JSON config",{ns:"charts"})}}',
|
|
1734
|
+
type: "string",
|
|
1735
|
+
default: lib.stringify(chartConfig$3, null, 2),
|
|
1736
|
+
"x-decorator": "FormItem",
|
|
1737
|
+
"x-component": "Input.TextArea",
|
|
1738
|
+
"x-component-props": {
|
|
1739
|
+
autoSize: { minRows: 8, maxRows: 16 }
|
|
1740
|
+
},
|
|
1741
|
+
description: '{{jsonConfigDesc("Area | G2Plot","https://g2plot.antv.antgroup.com/api/plots/area")}}',
|
|
1742
|
+
"x-validator": { json5: true }
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
};
|
|
1749
|
+
const chartConfig$2 = {
|
|
1750
|
+
appendPadding: 10,
|
|
1751
|
+
xField: "{{metric}}",
|
|
1752
|
+
yField: "{{dimension}}",
|
|
1753
|
+
colorField: "{{category}}",
|
|
1754
|
+
shape: "circle",
|
|
1755
|
+
size: 4,
|
|
1756
|
+
yAxis: {
|
|
1757
|
+
nice: true,
|
|
1758
|
+
line: {
|
|
1759
|
+
style: {
|
|
1760
|
+
stroke: "#aaa"
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
},
|
|
1764
|
+
xAxis: {
|
|
1765
|
+
min: -100,
|
|
1766
|
+
grid: {
|
|
1767
|
+
line: {
|
|
1768
|
+
style: {
|
|
1769
|
+
stroke: "#eee"
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
},
|
|
1773
|
+
line: {
|
|
1774
|
+
style: {
|
|
1775
|
+
stroke: "#aaa"
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
};
|
|
1780
|
+
const scatterTemplate = {
|
|
1781
|
+
description: "1 「Numeric」 field, 0~ 1 「Unordered Noun」 field",
|
|
1782
|
+
type: "Scatter",
|
|
1783
|
+
title: "Scatter",
|
|
1784
|
+
iconId: "icon-scatter",
|
|
1785
|
+
group: 2,
|
|
1786
|
+
renderComponent: "G2Plot",
|
|
1787
|
+
defaultChartOptions: chartConfig$2,
|
|
1788
|
+
configurableProperties: {
|
|
1789
|
+
type: "void",
|
|
1790
|
+
properties: {
|
|
1791
|
+
dimension: {
|
|
1792
|
+
required: true,
|
|
1793
|
+
type: "string",
|
|
1794
|
+
title: '{{t("Category axis / Dimension",{ns:"charts"})}}',
|
|
1795
|
+
"x-decorator": "FormItem",
|
|
1796
|
+
"x-component": "Select",
|
|
1797
|
+
enum: "{{dataSource}}"
|
|
1798
|
+
},
|
|
1799
|
+
metric: {
|
|
1800
|
+
required: true,
|
|
1801
|
+
type: "string",
|
|
1802
|
+
title: '{{t("Value axis / Metrics",{ns:"charts"})}}',
|
|
1803
|
+
"x-decorator": "FormItem",
|
|
1804
|
+
"x-component": "Select",
|
|
1805
|
+
enum: "{{dataSource}}"
|
|
1806
|
+
},
|
|
1807
|
+
category: {
|
|
1808
|
+
type: "string",
|
|
1809
|
+
title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
|
|
1810
|
+
"x-decorator": "FormItem",
|
|
1811
|
+
"x-component": "Select",
|
|
1812
|
+
enum: "{{dataSource}}"
|
|
1813
|
+
},
|
|
1814
|
+
jsonConfig: {
|
|
1815
|
+
type: "void",
|
|
1816
|
+
"x-component": "div",
|
|
1817
|
+
properties: {
|
|
1818
|
+
template: {
|
|
1819
|
+
required: true,
|
|
1820
|
+
title: '{{t("JSON config",{ns:"charts"})}}',
|
|
1821
|
+
type: "string",
|
|
1822
|
+
default: lib.stringify(chartConfig$2, null, 2),
|
|
1823
|
+
"x-decorator": "FormItem",
|
|
1824
|
+
"x-component": "Input.TextArea",
|
|
1825
|
+
"x-component-props": {
|
|
1826
|
+
autoSize: { minRows: 8, maxRows: 16 }
|
|
1827
|
+
},
|
|
1828
|
+
description: '{{jsonConfigDesc("Scatter | G2Plot","https://g2plot.antv.antgroup.com/api/plots/scatter")}}',
|
|
1829
|
+
"x-validator": { json5: true }
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
};
|
|
1836
|
+
const chartConfig$1 = {
|
|
1837
|
+
xField: "{{dimension}}",
|
|
1838
|
+
yField: "{{metric}}",
|
|
1839
|
+
appendPadding: [0, 10, 0, 10],
|
|
1840
|
+
xAxis: {
|
|
1841
|
+
tickLine: null
|
|
1842
|
+
},
|
|
1843
|
+
yAxis: {
|
|
1844
|
+
label: false,
|
|
1845
|
+
grid: {
|
|
1846
|
+
alternateColor: "rgba(0, 0, 0, 0.04)"
|
|
1847
|
+
}
|
|
1848
|
+
},
|
|
1849
|
+
// 开启辅助点
|
|
1850
|
+
point: {
|
|
1851
|
+
size: 2
|
|
1852
|
+
},
|
|
1853
|
+
area: {}
|
|
1854
|
+
};
|
|
1855
|
+
const radarTemplate = {
|
|
1856
|
+
description: "1~ 2 「Unordered Noun」 fields, 1 「Numeric」 field",
|
|
1857
|
+
type: "Radar",
|
|
1858
|
+
title: "Radar",
|
|
1859
|
+
iconId: "icon-radar",
|
|
1860
|
+
group: 1,
|
|
1861
|
+
renderComponent: "G2Plot",
|
|
1862
|
+
defaultChartOptions: chartConfig$1,
|
|
1863
|
+
configurableProperties: {
|
|
1864
|
+
type: "void",
|
|
1865
|
+
properties: {
|
|
1866
|
+
dimension: {
|
|
1867
|
+
required: true,
|
|
1868
|
+
type: "string",
|
|
1869
|
+
title: '{{t("Branch Tags/Dimensions",{ns:"charts"})}}',
|
|
1870
|
+
"x-decorator": "FormItem",
|
|
1871
|
+
"x-component": "Select",
|
|
1872
|
+
enum: "{{dataSource}}"
|
|
1873
|
+
},
|
|
1874
|
+
metric: {
|
|
1875
|
+
required: true,
|
|
1876
|
+
type: "string",
|
|
1877
|
+
title: '{{t("Branch Length/Metrics",{ns:"charts"})}}',
|
|
1878
|
+
"x-decorator": "FormItem",
|
|
1879
|
+
"x-component": "Select",
|
|
1880
|
+
enum: "{{dataSource}}"
|
|
1881
|
+
},
|
|
1882
|
+
jsonConfig: {
|
|
1883
|
+
type: "void",
|
|
1884
|
+
"x-component": "div",
|
|
1885
|
+
properties: {
|
|
1886
|
+
template: {
|
|
1887
|
+
required: true,
|
|
1888
|
+
title: '{{t("JSON config",{ns:"charts"})}}',
|
|
1889
|
+
type: "string",
|
|
1890
|
+
default: lib.stringify(chartConfig$1, null, 2),
|
|
1891
|
+
"x-decorator": "FormItem",
|
|
1892
|
+
"x-component": "Input.TextArea",
|
|
1893
|
+
"x-component-props": {
|
|
1894
|
+
autoSize: { minRows: 8, maxRows: 16 }
|
|
1895
|
+
},
|
|
1896
|
+
description: '{{jsonConfigDesc("Radar | G2Plot","https://g2plot.antv.antgroup.com/api/plots/radar")}}',
|
|
1897
|
+
"x-validator": { json5: true }
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
1904
|
+
const chartConfig = {
|
|
1905
|
+
xField: "{{dimension}}",
|
|
1906
|
+
yField: "{{metric}}",
|
|
1907
|
+
seriesField: "{{category}}",
|
|
1908
|
+
legend: false
|
|
1909
|
+
};
|
|
1910
|
+
const funnelTemplate = {
|
|
1911
|
+
description: "1 「Unordered Noun」 field, 1 「Numeric」 field",
|
|
1912
|
+
type: "Funnel",
|
|
1913
|
+
title: "Funnel",
|
|
1914
|
+
iconId: "icon-funnel",
|
|
1915
|
+
group: 1,
|
|
1916
|
+
renderComponent: "G2Plot",
|
|
1917
|
+
defaultChartOptions: chartConfig,
|
|
1918
|
+
configurableProperties: {
|
|
1919
|
+
type: "void",
|
|
1920
|
+
properties: {
|
|
1921
|
+
dimension: {
|
|
1922
|
+
required: true,
|
|
1923
|
+
type: "string",
|
|
1924
|
+
title: '{{t("Sector label / Dimensional",{ns:"charts"})}}',
|
|
1925
|
+
"x-decorator": "FormItem",
|
|
1926
|
+
"x-component": "Select",
|
|
1927
|
+
enum: "{{dataSource}}"
|
|
1928
|
+
},
|
|
1929
|
+
metric: {
|
|
1930
|
+
required: true,
|
|
1931
|
+
type: "string",
|
|
1932
|
+
title: '{{t("Funnel Layer Width/Metrics",{ns:"charts"})}}',
|
|
1933
|
+
"x-decorator": "FormItem",
|
|
1934
|
+
"x-component": "Select",
|
|
1935
|
+
enum: "{{dataSource}}"
|
|
1936
|
+
},
|
|
1937
|
+
category: {
|
|
1938
|
+
type: "string",
|
|
1939
|
+
title: '{{t("Color legend / Dimensional",{ns:"charts"})}}',
|
|
1940
|
+
"x-decorator": "FormItem",
|
|
1941
|
+
"x-component": "Select",
|
|
1942
|
+
enum: "{{dataSource}}"
|
|
1943
|
+
},
|
|
1944
|
+
jsonConfig: {
|
|
1945
|
+
type: "void",
|
|
1946
|
+
"x-component": "div",
|
|
1947
|
+
properties: {
|
|
1948
|
+
template: {
|
|
1949
|
+
required: true,
|
|
1950
|
+
title: '{{t("JSON config",{ns:"charts"})}}',
|
|
1951
|
+
type: "string",
|
|
1952
|
+
default: lib.stringify(chartConfig, null, 2),
|
|
1953
|
+
"x-decorator": "FormItem",
|
|
1954
|
+
"x-component": "Input.TextArea",
|
|
1955
|
+
"x-component-props": {
|
|
1956
|
+
autoSize: { minRows: 8, maxRows: 16 }
|
|
1957
|
+
},
|
|
1958
|
+
description: '{{jsonConfigDesc("Funnel | G2Plot","https://g2plot.antv.antgroup.com/api/plots/funnel")}}',
|
|
1959
|
+
"x-validator": { json5: true }
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
};
|
|
1966
|
+
const templates = /* @__PURE__ */ new Map();
|
|
1967
|
+
templates.set("Pie", pieTemplate);
|
|
1968
|
+
templates.set("Line", lineTemplate);
|
|
1969
|
+
templates.set("Area", areaTemplate);
|
|
1970
|
+
templates.set("Bar", barTemplate);
|
|
1971
|
+
templates.set("Column", columnTemplate);
|
|
1972
|
+
templates.set("Scatter", scatterTemplate);
|
|
1973
|
+
templates.set("Radar", radarTemplate);
|
|
1974
|
+
templates.set("Funnel", funnelTemplate);
|
|
1975
|
+
const Options = react.observer(
|
|
1976
|
+
(props) => {
|
|
1977
|
+
const form = react.useForm();
|
|
1978
|
+
react.useField();
|
|
1979
|
+
const [s, setSchema] = require$$0.useState(new react.Schema({}));
|
|
1980
|
+
const [chartType, setChartType] = require$$0.useState(form.values.type);
|
|
1981
|
+
require$$0.useEffect(() => {
|
|
1982
|
+
var _a, _b;
|
|
1983
|
+
setChartType((_a = form == null ? void 0 : form.values) == null ? void 0 : _a.type);
|
|
1984
|
+
if (chartType !== ((_b = form == null ? void 0 : form.values) == null ? void 0 : _b.type)) {
|
|
1985
|
+
form.clearFormGraph("options.*");
|
|
1986
|
+
}
|
|
1987
|
+
if (form.values.type) {
|
|
1988
|
+
const template = templates.get(form.values.type);
|
|
1989
|
+
setSchema(new react.Schema(template.configurableProperties || {}));
|
|
1990
|
+
}
|
|
1991
|
+
}, [form.values.type]);
|
|
1992
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(react.RecursionField, { schema: s });
|
|
1993
|
+
},
|
|
1994
|
+
{ displayName: "Options" }
|
|
1995
|
+
);
|
|
1996
|
+
const ChartBlockInitializer = (props) => {
|
|
1997
|
+
const { insert } = props;
|
|
1998
|
+
const options = require$$0.useContext(react.SchemaOptionsContext);
|
|
1999
|
+
const api2 = client.useAPIClient();
|
|
2000
|
+
const compile = client.useCompile();
|
|
2001
|
+
const { theme } = client.useGlobalTheme();
|
|
2002
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2003
|
+
ChartQueryBlockInitializer,
|
|
2004
|
+
{
|
|
2005
|
+
...props,
|
|
2006
|
+
componentType: "Charts",
|
|
2007
|
+
onCreateBlockSchema: async ({ item: chartQueryMetadata }) => {
|
|
2008
|
+
const dataSource = chartQueryMetadata == null ? void 0 : chartQueryMetadata.fields.map((field) => {
|
|
2009
|
+
return {
|
|
2010
|
+
label: field.name,
|
|
2011
|
+
value: field.name
|
|
2012
|
+
};
|
|
2013
|
+
});
|
|
2014
|
+
const values = await client.FormDialog(
|
|
2015
|
+
{
|
|
2016
|
+
okText: compile('{{t("Submit")}}'),
|
|
2017
|
+
title: lang("Create chart block"),
|
|
2018
|
+
width: 1200,
|
|
2019
|
+
bodyStyle: { background: "var(--nb-box-bg)", maxHeight: "65vh", overflow: "auto" }
|
|
2020
|
+
},
|
|
2021
|
+
function Com() {
|
|
2022
|
+
var _a, _b;
|
|
2023
|
+
const form = react.useForm();
|
|
2024
|
+
const [chartBlockEngineMetaData, setChartBlockEngineMetaData] = require$$0.useState(null);
|
|
2025
|
+
require$$0.useEffect(() => {
|
|
2026
|
+
const chartBlockEngineMetaData2 = {
|
|
2027
|
+
query: {
|
|
2028
|
+
id: chartQueryMetadata == null ? void 0 : chartQueryMetadata.id
|
|
2029
|
+
},
|
|
2030
|
+
chart: form.values
|
|
2031
|
+
//TODO
|
|
2032
|
+
};
|
|
2033
|
+
setChartBlockEngineMetaData(chartBlockEngineMetaData2);
|
|
2034
|
+
}, [form.values.type]);
|
|
2035
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(client.APIClientProvider, { apiClient: api2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponentOptions, { scope: options.scope, components: { ...options.components }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2036
|
+
"section",
|
|
2037
|
+
{
|
|
2038
|
+
className: client.css`
|
|
2039
|
+
display: flex;
|
|
2040
|
+
gap: 24px;
|
|
2041
|
+
`,
|
|
2042
|
+
children: [
|
|
2043
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2044
|
+
antd.Card,
|
|
2045
|
+
{
|
|
2046
|
+
title: lang("Chart config"),
|
|
2047
|
+
size: "default",
|
|
2048
|
+
className: client.css`
|
|
2049
|
+
flex: 1;
|
|
2050
|
+
`,
|
|
2051
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.FormProvider, { form, children: /* @__PURE__ */ jsxRuntimeExports.jsx(antdV5.FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2052
|
+
client.SchemaComponent,
|
|
2053
|
+
{
|
|
2054
|
+
scope: { dataSource, JSON5: lib, jsonConfigDesc },
|
|
2055
|
+
components: { Options },
|
|
2056
|
+
schema: {
|
|
2057
|
+
properties: {
|
|
2058
|
+
// title: {
|
|
2059
|
+
// title: lang('Chart title'),
|
|
2060
|
+
// 'x-component': 'Input',
|
|
2061
|
+
// 'x-decorator': 'FormItem',
|
|
2062
|
+
// },
|
|
2063
|
+
type: {
|
|
2064
|
+
title: lang("Chart type"),
|
|
2065
|
+
required: true,
|
|
2066
|
+
"x-component": "CustomSelect",
|
|
2067
|
+
"x-decorator": "FormItem",
|
|
2068
|
+
enum: [...templates.values()].map((template) => {
|
|
2069
|
+
return {
|
|
2070
|
+
title: template.title,
|
|
2071
|
+
key: template.type,
|
|
2072
|
+
description: template.description,
|
|
2073
|
+
group: template.group,
|
|
2074
|
+
iconId: template.iconId
|
|
2075
|
+
};
|
|
2076
|
+
})
|
|
2077
|
+
},
|
|
2078
|
+
options: {
|
|
2079
|
+
type: "void",
|
|
2080
|
+
"x-component": "Options"
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
) }) })
|
|
2086
|
+
}
|
|
2087
|
+
),
|
|
2088
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2089
|
+
"div",
|
|
2090
|
+
{
|
|
2091
|
+
className: client.css`
|
|
2092
|
+
flex: 1;
|
|
2093
|
+
min-width: 600px;
|
|
2094
|
+
`,
|
|
2095
|
+
children: [
|
|
2096
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(antd.Card, { size: "default", title: lang("Chart preview"), children: chartBlockEngineMetaData && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2097
|
+
client.SchemaComponent,
|
|
2098
|
+
{
|
|
2099
|
+
schema: {
|
|
2100
|
+
properties: {
|
|
2101
|
+
chartPreview: {
|
|
2102
|
+
type: "void",
|
|
2103
|
+
"x-decorator": "CardItem",
|
|
2104
|
+
"x-component": "ChartBlockEngine",
|
|
2105
|
+
"x-component-props": {
|
|
2106
|
+
chartBlockEngineMetaData
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
) }) }),
|
|
2113
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2114
|
+
antd.Card,
|
|
2115
|
+
{
|
|
2116
|
+
size: "default",
|
|
2117
|
+
title: lang("Data preview"),
|
|
2118
|
+
className: client.css`
|
|
2119
|
+
margin-top: 24px;
|
|
2120
|
+
overflow: scroll;
|
|
2121
|
+
`,
|
|
2122
|
+
children: ((_a = chartBlockEngineMetaData == null ? void 0 : chartBlockEngineMetaData.query) == null ? void 0 : _a.id) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2123
|
+
DataSetPreviewTable,
|
|
2124
|
+
{
|
|
2125
|
+
queryId: (_b = chartBlockEngineMetaData == null ? void 0 : chartBlockEngineMetaData.query) == null ? void 0 : _b.id,
|
|
2126
|
+
fields: chartQueryMetadata == null ? void 0 : chartQueryMetadata.fields
|
|
2127
|
+
}
|
|
2128
|
+
)
|
|
2129
|
+
}
|
|
2130
|
+
)
|
|
2131
|
+
]
|
|
2132
|
+
}
|
|
2133
|
+
)
|
|
2134
|
+
]
|
|
2135
|
+
}
|
|
2136
|
+
) }) });
|
|
2137
|
+
},
|
|
2138
|
+
theme
|
|
2139
|
+
).open({
|
|
2140
|
+
initialValues: {}
|
|
2141
|
+
});
|
|
2142
|
+
if (values) {
|
|
2143
|
+
const chartBlockEngineMetaData = {
|
|
2144
|
+
query: {
|
|
2145
|
+
id: chartQueryMetadata.id
|
|
2146
|
+
},
|
|
2147
|
+
chart: values
|
|
2148
|
+
};
|
|
2149
|
+
insert({
|
|
2150
|
+
type: "void",
|
|
2151
|
+
title: values == null ? void 0 : values.title,
|
|
2152
|
+
"x-designer": "ChartBlockEngine.Designer",
|
|
2153
|
+
"x-decorator": "CardItem",
|
|
2154
|
+
"x-component": "ChartBlockEngine",
|
|
2155
|
+
"x-component-props": {
|
|
2156
|
+
chartBlockEngineMetaData
|
|
2157
|
+
}
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
);
|
|
2163
|
+
};
|
|
2164
|
+
const useFieldsById = (queryId) => {
|
|
2165
|
+
const [fields, setFields] = require$$0.useState([]);
|
|
2166
|
+
const ctx = useChartQueryMetadataContext();
|
|
2167
|
+
require$$0.useEffect(() => {
|
|
2168
|
+
const chartQueryList = ctx == null ? void 0 : ctx.data;
|
|
2169
|
+
if (chartQueryList && Array.isArray(chartQueryList)) {
|
|
2170
|
+
const currentQuery = chartQueryList.find((chartQuery) => chartQuery.id === queryId);
|
|
2171
|
+
setFields((currentQuery == null ? void 0 : currentQuery.fields) || []);
|
|
2172
|
+
}
|
|
2173
|
+
}, [queryId]);
|
|
2174
|
+
return {
|
|
2175
|
+
fields
|
|
2176
|
+
};
|
|
2177
|
+
};
|
|
2178
|
+
const jsonConfigDesc = (title, link) => {
|
|
2179
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
2180
|
+
lang("Json config references: "),
|
|
2181
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: link, target: "_blank", rel: "noreferrer", children: lang(title) })
|
|
2182
|
+
] });
|
|
2183
|
+
};
|
|
2184
|
+
const ChartBlockEngineDesigner = () => {
|
|
2185
|
+
const fieldSchema = react.useFieldSchema();
|
|
2186
|
+
const { chartBlockEngineMetaData } = fieldSchema == null ? void 0 : fieldSchema["x-component-props"];
|
|
2187
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(client.GeneralSchemaDesigner, { children: [
|
|
2188
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ChartBlockEngineDesignerInitializer, { chartBlockEngineMetaData }),
|
|
2189
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaSettings.Divider, {}),
|
|
2190
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2191
|
+
client.SchemaSettings.Remove,
|
|
2192
|
+
{
|
|
2193
|
+
removeParentsIfNoChildren: true,
|
|
2194
|
+
breakRemoveOn: {
|
|
2195
|
+
"x-component": "Grid"
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
)
|
|
2199
|
+
] });
|
|
2200
|
+
};
|
|
2201
|
+
const ChartBlockEngineDesignerInitializer = (props) => {
|
|
2202
|
+
const { chartBlockEngineMetaData } = props;
|
|
2203
|
+
const { t } = reactI18next.useTranslation();
|
|
2204
|
+
const options = require$$0.useContext(react.SchemaOptionsContext);
|
|
2205
|
+
const { dn } = client.useDesignable();
|
|
2206
|
+
const fieldSchema = react.useFieldSchema();
|
|
2207
|
+
const api2 = client.useAPIClient();
|
|
2208
|
+
const field = react.useField();
|
|
2209
|
+
const compile = client.useCompile();
|
|
2210
|
+
const { chart, query } = chartBlockEngineMetaData;
|
|
2211
|
+
const { fields } = useFieldsById(query.id);
|
|
2212
|
+
const { theme } = client.useGlobalTheme();
|
|
2213
|
+
const dataSource = fields.map((field2) => {
|
|
2214
|
+
return {
|
|
2215
|
+
label: field2.name,
|
|
2216
|
+
value: field2.name
|
|
2217
|
+
};
|
|
2218
|
+
});
|
|
2219
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2220
|
+
client.SchemaSettings.Item,
|
|
2221
|
+
{
|
|
2222
|
+
onClick: async () => {
|
|
2223
|
+
client.FormDialog(
|
|
2224
|
+
{
|
|
2225
|
+
okText: compile('{{t("Submit")}}'),
|
|
2226
|
+
title: lang("Edit chart block"),
|
|
2227
|
+
width: 1200,
|
|
2228
|
+
bodyStyle: { background: "var(--nb-box-bg)", maxHeight: "65vh", overflow: "auto" }
|
|
2229
|
+
},
|
|
2230
|
+
function Com(form) {
|
|
2231
|
+
var _a, _b;
|
|
2232
|
+
const [chartBlockEngineMetaData2, setChartBlockEngineMetaData] = require$$0.useState(null);
|
|
2233
|
+
require$$0.useEffect(() => {
|
|
2234
|
+
const chartBlockEngineMetaData3 = {
|
|
2235
|
+
query: {
|
|
2236
|
+
id: query == null ? void 0 : query.id
|
|
2237
|
+
},
|
|
2238
|
+
chart: form.values
|
|
2239
|
+
//TODO
|
|
2240
|
+
};
|
|
2241
|
+
setChartBlockEngineMetaData(chartBlockEngineMetaData3);
|
|
2242
|
+
}, [form.values.type]);
|
|
2243
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(client.APIClientProvider, { apiClient: api2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponentOptions, { scope: options.scope, components: { ...options.components }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2244
|
+
"section",
|
|
2245
|
+
{
|
|
2246
|
+
className: client.css`
|
|
2247
|
+
display: flex;
|
|
2248
|
+
gap: 24px;
|
|
2249
|
+
`,
|
|
2250
|
+
children: [
|
|
2251
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2252
|
+
antd.Card,
|
|
2253
|
+
{
|
|
2254
|
+
bordered: false,
|
|
2255
|
+
title: client.i18n.t("Chart config"),
|
|
2256
|
+
size: "default",
|
|
2257
|
+
className: client.css`
|
|
2258
|
+
flex: 1;
|
|
2259
|
+
`,
|
|
2260
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(antdV5.FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2261
|
+
client.SchemaComponent,
|
|
2262
|
+
{
|
|
2263
|
+
scope: { dataSource, JSON5: lib, jsonConfigDesc },
|
|
2264
|
+
components: { Options },
|
|
2265
|
+
schema: {
|
|
2266
|
+
properties: {
|
|
2267
|
+
// title: {
|
|
2268
|
+
// title: lang('Chart title'),
|
|
2269
|
+
// 'x-component': 'Input',
|
|
2270
|
+
// 'x-decorator': 'FormItem',
|
|
2271
|
+
// },
|
|
2272
|
+
type: {
|
|
2273
|
+
title: t("Chart type"),
|
|
2274
|
+
required: true,
|
|
2275
|
+
"x-component": "CustomSelect",
|
|
2276
|
+
"x-decorator": "FormItem",
|
|
2277
|
+
enum: [...templates.values()].map((template) => {
|
|
2278
|
+
return {
|
|
2279
|
+
title: template.title,
|
|
2280
|
+
key: template.type,
|
|
2281
|
+
description: template.description,
|
|
2282
|
+
group: template.group,
|
|
2283
|
+
iconId: template.iconId
|
|
2284
|
+
};
|
|
2285
|
+
})
|
|
2286
|
+
},
|
|
2287
|
+
options: {
|
|
2288
|
+
type: "void",
|
|
2289
|
+
"x-component": "Options"
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
) })
|
|
2295
|
+
}
|
|
2296
|
+
),
|
|
2297
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2298
|
+
"div",
|
|
2299
|
+
{
|
|
2300
|
+
className: client.css`
|
|
2301
|
+
flex: 1;
|
|
2302
|
+
min-width: 600px;
|
|
2303
|
+
`,
|
|
2304
|
+
children: [
|
|
2305
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(antd.Card, { size: "default", title: lang("Chart preview"), children: chartBlockEngineMetaData2 && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2306
|
+
client.SchemaComponent,
|
|
2307
|
+
{
|
|
2308
|
+
schema: {
|
|
2309
|
+
properties: {
|
|
2310
|
+
chartPreview: {
|
|
2311
|
+
type: "void",
|
|
2312
|
+
"x-decorator": "CardItem",
|
|
2313
|
+
"x-component": "ChartBlockEngine",
|
|
2314
|
+
"x-component-props": {
|
|
2315
|
+
chartBlockEngineMetaData: chartBlockEngineMetaData2
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
) }) }),
|
|
2322
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2323
|
+
antd.Card,
|
|
2324
|
+
{
|
|
2325
|
+
size: "default",
|
|
2326
|
+
title: lang("Data preview"),
|
|
2327
|
+
className: client.css`
|
|
2328
|
+
margin-top: 24px;
|
|
2329
|
+
overflow: scroll;
|
|
2330
|
+
`,
|
|
2331
|
+
children: ((_a = chartBlockEngineMetaData2 == null ? void 0 : chartBlockEngineMetaData2.query) == null ? void 0 : _a.id) && /* @__PURE__ */ jsxRuntimeExports.jsx(DataSetPreviewTable, { queryId: (_b = chartBlockEngineMetaData2 == null ? void 0 : chartBlockEngineMetaData2.query) == null ? void 0 : _b.id, fields })
|
|
2332
|
+
}
|
|
2333
|
+
)
|
|
2334
|
+
]
|
|
2335
|
+
}
|
|
2336
|
+
)
|
|
2337
|
+
]
|
|
2338
|
+
}
|
|
2339
|
+
) }) });
|
|
2340
|
+
},
|
|
2341
|
+
theme
|
|
2342
|
+
).open({
|
|
2343
|
+
initialValues: { ...chart }
|
|
2344
|
+
//reset before chartBlockMetaData
|
|
2345
|
+
}).then((values) => {
|
|
2346
|
+
values = {
|
|
2347
|
+
query,
|
|
2348
|
+
chart: values
|
|
2349
|
+
};
|
|
2350
|
+
field.title = values.chart.title;
|
|
2351
|
+
fieldSchema["title"] = values.chart.title;
|
|
2352
|
+
field.componentProps.chartBlockEngineMetaData = values;
|
|
2353
|
+
fieldSchema["x-component-props"].chartBlockEngineMetaData = values;
|
|
2354
|
+
dn.emit("patch", {
|
|
2355
|
+
schema: {
|
|
2356
|
+
"x-uid": fieldSchema["x-uid"],
|
|
2357
|
+
"x-component-props": fieldSchema["x-component-props"]
|
|
2358
|
+
}
|
|
2359
|
+
});
|
|
2360
|
+
dn.refresh();
|
|
2361
|
+
}).catch((err) => {
|
|
2362
|
+
client$1.error(err);
|
|
2363
|
+
});
|
|
2364
|
+
},
|
|
2365
|
+
children: props.children || props.title || lang("Edit chart block")
|
|
2366
|
+
}
|
|
2367
|
+
);
|
|
2368
|
+
};
|
|
2369
|
+
const chartRenderComponentsMap = /* @__PURE__ */ new Map();
|
|
2370
|
+
chartRenderComponentsMap.set("G2Plot", client.G2Plot);
|
|
2371
|
+
chartRenderComponentsMap.set("DataSetPreviewTable", DataSetPreviewTable);
|
|
2372
|
+
const ChartRenderComponent = ({
|
|
2373
|
+
chartBlockEngineMetaData
|
|
2374
|
+
}) => {
|
|
2375
|
+
var _a, _b;
|
|
2376
|
+
const compile = client.useCompile();
|
|
2377
|
+
const chartType = chartBlockEngineMetaData.chart.type;
|
|
2378
|
+
const renderComponent = (_a = templates.get(chartType)) == null ? void 0 : _a.renderComponent;
|
|
2379
|
+
const RenderComponent = chartRenderComponentsMap.get(renderComponent);
|
|
2380
|
+
const chartConfig2 = chartBlockEngineMetaData.chart;
|
|
2381
|
+
const { loading, dataSet, error } = useGetDataSet(chartBlockEngineMetaData.query.id);
|
|
2382
|
+
const [currentConfig, setCurrentConfig] = require$$0.useState({});
|
|
2383
|
+
require$$0.useEffect(() => {
|
|
2384
|
+
setCurrentConfig(chartConfig2);
|
|
2385
|
+
}, [JSON.stringify(chartConfig2)]);
|
|
2386
|
+
if (error) {
|
|
2387
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Empty, { description: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: `May be this chart block's query data has been deleted,please check!` }) }) });
|
|
2388
|
+
}
|
|
2389
|
+
if (currentConfig.type !== chartConfig2.type) {
|
|
2390
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
2391
|
+
}
|
|
2392
|
+
switch (renderComponent) {
|
|
2393
|
+
case "G2Plot": {
|
|
2394
|
+
const finalChartOptions = (_b = templates.get(chartType)) == null ? void 0 : _b.defaultChartOptions;
|
|
2395
|
+
let template;
|
|
2396
|
+
try {
|
|
2397
|
+
template = lib.parse(chartConfig2 == null ? void 0 : chartConfig2.template);
|
|
2398
|
+
} catch (e) {
|
|
2399
|
+
template = {};
|
|
2400
|
+
}
|
|
2401
|
+
const config = compile(
|
|
2402
|
+
{
|
|
2403
|
+
...finalChartOptions,
|
|
2404
|
+
...template,
|
|
2405
|
+
data: dataSet
|
|
2406
|
+
},
|
|
2407
|
+
{ ...chartConfig2, category: (chartConfig2 == null ? void 0 : chartConfig2.category) ?? "" }
|
|
2408
|
+
);
|
|
2409
|
+
if (config && chartConfig2) {
|
|
2410
|
+
const { dimension, metric, category } = chartConfig2;
|
|
2411
|
+
if (!metric || !dimension) {
|
|
2412
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: lang("Please check the chart config") });
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Spin, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(RenderComponent, { plot: chartConfig2.type, config }) });
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
2419
|
+
};
|
|
2420
|
+
const useGetDataSet = (chartQueryId) => {
|
|
2421
|
+
const { data, loading, error } = client.useRequest({
|
|
2422
|
+
url: `/chartsQueries:getData/${chartQueryId}`
|
|
2423
|
+
});
|
|
2424
|
+
const dataSet = data == null ? void 0 : data.data;
|
|
2425
|
+
return {
|
|
2426
|
+
loading,
|
|
2427
|
+
dataSet,
|
|
2428
|
+
error
|
|
2429
|
+
};
|
|
2430
|
+
};
|
|
2431
|
+
const ChartBlockEngine = ({ chartBlockEngineMetaData }) => {
|
|
2432
|
+
var _a, _b;
|
|
2433
|
+
let renderComponent;
|
|
2434
|
+
const chartType = (_a = chartBlockEngineMetaData == null ? void 0 : chartBlockEngineMetaData.chart) == null ? void 0 : _a.type;
|
|
2435
|
+
if (chartType) {
|
|
2436
|
+
renderComponent = (_b = templates.get(chartType)) == null ? void 0 : _b.renderComponent;
|
|
2437
|
+
}
|
|
2438
|
+
if (!chartType || !renderComponent) {
|
|
2439
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: lang("Please check the chart config") });
|
|
2440
|
+
}
|
|
2441
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChartRenderComponent, { chartBlockEngineMetaData }) });
|
|
2442
|
+
};
|
|
2443
|
+
ChartBlockEngine.Designer = ChartBlockEngineDesigner;
|
|
2444
|
+
const RadarChart = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", focusable: "false", viewBox: "0 0 1024 1024", children: [
|
|
2445
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M523 573.5c-3.9 0.7-7.9 1.1-12 1.1-5.3 0-10.4-0.6-15.2-1.8l-62.2 189.7 167.4-76L523 573.5z" }),
|
|
2446
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M398.3 767.3l68.9-210.1c-6.4-6-11.5-13.3-15-21.4l-192.6 52.7L398.3 767.3z" }),
|
|
2447
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M528 448.9c4.1 1.1 8 2.6 11.7 4.5l72.5-61.8L528 263.7 528 448.9z" }),
|
|
2448
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M259.6 555.4 447.3 504c0.4-4.2 1.3-8.3 2.5-12.2L270.9 373.4 259.6 555.4z" }),
|
|
2449
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M655.5 396.7l208.3 185.7 30.2 4.8c4.8-24.6 7.4-49.9 7.4-75.9 0-95.9-34.6-183.7-92-251.6L655.5 396.7z" }),
|
|
2450
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M794.4 563.4 630.9 417.7l-67 57.1c5.6 8.3 9.3 18 10.6 28.4L794.4 563.4z" }),
|
|
2451
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M496 448.4 496 239.6l-218.8 99.6 189.4 125.4C474.7 456.8 484.8 451.1 496 448.4z" }),
|
|
2452
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M619.3 713.3 420 803.8l-19.1 81.6c35 10.3 72.1 15.9 110.4 15.9 74.4 0 143.9-20.8 203-56.9L619.3 713.3z" }),
|
|
2453
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M648.7 699.5l92.3 127.2c63.3-46.2 112.2-111 138.6-186.4L648.7 699.5z" }),
|
|
2454
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M386.2 804 226.1 597.7l-87.9 27.4c34.9 114.7 121.3 207 232.2 250L386.2 804z" }),
|
|
2455
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M226.9 564.3 240.2 353l-64.4-40.5c-34.6 58.2-54.4 126.2-54.4 198.8 0 28.4 3 56.2 8.8 82.9L226.9 564.3z" }),
|
|
2456
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M842.8 609.8l-272.7-74.7c-4 9.5-10.1 17.9-17.9 24.4l77.3 112.1L842.8 609.8z" }),
|
|
2457
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M528 205.4l108.8 165.2 151-134.5c-67-67.3-158.4-110.2-259.7-114.5L528.1 205.4z" }),
|
|
2458
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M245.7 318.4l250.3-114 0-82.8c-125 4.8-234.8 68.5-302.8 164L245.7 318.4z" })
|
|
2459
|
+
] });
|
|
2460
|
+
const FunnelChart = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", focusable: "false", viewBox: "0 0 1024 1024", children: [
|
|
2461
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M533.6 784.5c6.6 16.4-1.3 35-17.6 41.7l0 0c-16.4 6.6-35-1.3-41.7-17.6L129.9 236c-6.6-16.4 1.3-35 17.6-41.7l0 0c16.4-6.6 35 1.3 41.7 17.6L533.6 784.5z" }),
|
|
2462
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M536 812.2c-6.9 16.3-25.7 23.9-41.9 17l0 0c-16.3-6.9-23.9-25.7-17-41.9l357.6-575.7c6.9-16.3 25.7-23.9 41.9-17l0 0c16.3 6.9 23.9 25.7 17 41.9L536 812.2z" }),
|
|
2463
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M895.4 224c0 17.7-14.3 32-32 32l-704 0c-17.7 0-32-14.3-32-32l0 0c0-17.7 14.3-32 32-32l704 0C881 192 895.4 206.3 895.4 224L895.4 224z" }),
|
|
2464
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M278.6 384l465 0 0 64-465 0 0-64Z" }),
|
|
2465
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M391.6 576l232.5 0 0 64-232.5 0 0-64Z" })
|
|
2466
|
+
] });
|
|
2467
|
+
const ScatterChart = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", focusable: "false", viewBox: "0 0 1024 1024", children: [
|
|
2468
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M191 864c0 17.7-14.3 32-32 32l0 0c-17.7 0-32-14.3-32-32L127 160c0-17.7 14.3-32 32-32l0 0c17.7 0 32 14.3 32 32L191 864z" }),
|
|
2469
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M159 896c-17.7 0-32-14.3-32-32l0 0c0-17.7 14.3-32 32-32l712 0c17.7 0 32 14.3 32 32l0 0c0 17.7-14.3 32-32 32L159 896z" }),
|
|
2470
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M745.6 765.9" }),
|
|
2471
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M307.6 244.3m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" }),
|
|
2472
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M560 479.2m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" }),
|
|
2473
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M391.9 387.7m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" }),
|
|
2474
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M540.4 244.3m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" }),
|
|
2475
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M732.9 292.3m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" }),
|
|
2476
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M792.9 717.9m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" }),
|
|
2477
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M307.6 527.2m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" }),
|
|
2478
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M439.9 662.4m-48 0a48 48 0 1 0 96 0 48 48 0 1 0-96 0Z" })
|
|
2479
|
+
] });
|
|
2480
|
+
const ColumnChart = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", focusable: "false", viewBox: "0 0 1024 1024", children: [
|
|
2481
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M191 864c0 17.7-14.3 32-32 32l0 0c-17.7 0-32-14.3-32-32L127 160c0-17.7 14.3-32 32-32l0 0c17.7 0 32 14.3 32 32L191 864z" }),
|
|
2482
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M159 896c-17.7 0-32-14.3-32-32l0 0c0-17.7 14.3-32 32-32l712 0c17.7 0 32 14.3 32 32l0 0c0 17.7-14.3 32-32 32L159 896z" }),
|
|
2483
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M745.6 765.9" }),
|
|
2484
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M342.1 734.3c0 17.5-14.2 31.7-31.7 31.7l0 0c-17.5 0-31.7-14.2-31.7-31.7L278.7 489c0-17.5 14.2-31.7 31.7-31.7l0 0c17.5 0 31.7 14.2 31.7 31.7L342.1 734.3z" }),
|
|
2485
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M493.8 734.3c0 17.5-14.2 31.7-31.7 31.7l0 0c-17.5 0-31.7-14.2-31.7-31.7L430.4 387c0-17.5 14.2-31.7 31.7-31.7l0 0c17.5 0 31.7 14.2 31.7 31.7L493.8 734.3z" }),
|
|
2486
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M797.3 734.3c0 17.5-14.2 31.7-31.7 31.7l0 0c-17.5 0-31.7-14.2-31.7-31.7L733.9 234.5c0-17.5 14.2-31.7 31.7-31.7l0 0c17.5 0 31.7 14.2 31.7 31.7L797.3 734.3z" }),
|
|
2487
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M645.5 734.3c0 17.5-14.2 31.7-31.7 31.7l0 0c-17.5 0-31.7-14.2-31.7-31.7l0-97.2c0-17.5 14.2-31.7 31.7-31.7l0 0c17.5 0 31.7 14.2 31.7 31.7L645.5 734.3z" })
|
|
2488
|
+
] });
|
|
2489
|
+
const BarChart = () => /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", focusable: "false", viewBox: "0 0 1024 1024", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M131.072 156.16c0-17.92 14.336-31.744 31.744-31.744 17.92 0 31.744 14.336 31.744 31.744v712.192c0 17.92-14.336 31.744-31.744 31.744-17.92 0-31.744-14.336-31.744-31.744V156.16zM292.864 338.944c-17.408 0-31.744-14.336-31.744-31.744 0-17.408 14.336-31.744 31.744-31.744h245.248c17.408 0 31.744 14.336 31.744 31.744 0 17.408-14.336 31.744-31.744 31.744h-245.248zM292.864 490.496c-17.408 0-31.744-14.336-31.744-31.744 0-17.408 14.336-31.744 31.744-31.744H640c17.408 0 31.744 14.336 31.744 31.744 0 17.408-14.336 31.744-31.744 31.744h-347.136zM292.864 794.112c-17.408 0-31.744-14.336-31.744-31.744 0-17.408 14.336-31.744 31.744-31.744h499.712c17.408 0 31.744 14.336 31.744 31.744 0 17.408-14.336 31.744-31.744 31.744h-499.712zM292.864 642.56c-17.408 0-31.744-14.336-31.744-31.744 0-17.408 14.336-31.744 31.744-31.744h97.28c17.408 0 31.744 14.336 31.744 31.744 0 17.408-14.336 31.744-31.744 31.744h-97.28z" }) });
|
|
2490
|
+
const LineChart = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", focusable: "false", viewBox: "0 0 1024 1024", children: [
|
|
2491
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M191 864c0 17.7-14.3 32-32 32l0 0c-17.7 0-32-14.3-32-32L127 160c0-17.7 14.3-32 32-32l0 0c17.7 0 32 14.3 32 32L191 864z" }),
|
|
2492
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M159 896c-17.7 0-32-14.3-32-32l0 0c0-17.7 14.3-32 32-32l712 0c17.7 0 32 14.3 32 32l0 0c0 17.7-14.3 32-32 32L159 896z" }),
|
|
2493
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M307.1 686.3c-12.4 12.4-32.4 12.4-44.8 0l0 0c-12.4-12.4-12.4-32.4 0-44.8l173.4-173.4c12.4-12.4 32.4-12.4 44.8 0l0 0c12.4 12.4 12.4 32.4 0 44.8L307.1 686.3z" }),
|
|
2494
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M608.8 640c-12.4 12.4-32.4 12.4-44.8 0l0 0c-12.4-12.4-12.4-32.4 0-44.8l212.7-212.7c12.4-12.4 32.4-12.4 44.8 0l0 0c12.4 12.4 12.4 32.4 0 44.8L608.8 640z" }),
|
|
2495
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M608 595.3c12.4 12.4 12.4 32.4 0 44.8l0 0c-12.4 12.4-32.4 12.4-44.8 0L436 512.8c-12.4-12.4-12.4-32.4 0-44.8l0 0c12.4-12.4 32.4-12.4 44.8 0L608 595.3z" })
|
|
2496
|
+
] });
|
|
2497
|
+
const PieChart = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", focusable: "false", viewBox: "0 0 1024 1024", children: [
|
|
2498
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M489.7 511 489 511 489 126.9c-201 12.3-360.1 179.2-360.1 383.3 0 212.1 171.9 384 384 384 106.5 0 202.9-43.4 272.5-113.4L489.7 511z" }),
|
|
2499
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M773.1 237.2l6-6c-62.7-59.6-143.5-95.8-228.2-104l0 304.7L773.1 237.2z" }),
|
|
2500
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M819.5 281.6 564.1 505.1 822 739c3-4 5.9-8.1 8.7-12.3 41.4-61.3 65.6-135.2 65.6-214.7C896.3 425.6 867.7 345.8 819.5 281.6z" })
|
|
2501
|
+
] });
|
|
2502
|
+
const AreaChart = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", focusable: "false", viewBox: "0 0 1024 1024", children: [
|
|
2503
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M191 864c0 17.7-14.3 32-32 32l0 0c-17.7 0-32-14.3-32-32L127 160c0-17.7 14.3-32 32-32l0 0c17.7 0 32 14.3 32 32L191 864z" }),
|
|
2504
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M159 896c-17.7 0-32-14.3-32-32l0 0c0-17.7 14.3-32 32-32l712 0c17.7 0 32 14.3 32 32l0 0c0 17.7-14.3 32-32 32L159 896z" }),
|
|
2505
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M830.6 338.2 830.6 338.2c0.9-9.2-2.1-18.6-9.1-25.7-12.4-12.4-32.4-12.4-44.8 0L586 503.3 480.8 398.1c-6.2-6.2-14.4-9.3-22.5-9.3-8.1 0-16.3 3.1-22.5 9.3L262.4 571.5c-6 6-9.1 13.8-9.3 21.6 0 0.1 0 0.1 0 0.2l0 111.8c0 35.3 28.7 64 64 64l449.7 0c33.8 0 61.4-26.1 63.8-59.3l0 0 0-0.2c0.1-1.5 0.2-3 0.2-4.5L830.8 593.3c0-0.3-0.1-0.7-0.2-1L830.6 338.2z" })
|
|
2506
|
+
] });
|
|
2507
|
+
client.Icon.register({
|
|
2508
|
+
"icon-area": (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { component: AreaChart, ...props }),
|
|
2509
|
+
"icon-pie": (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { component: PieChart, ...props }),
|
|
2510
|
+
"icon-radar": (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { component: RadarChart, ...props }),
|
|
2511
|
+
"icon-funnel": (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { component: FunnelChart, ...props }),
|
|
2512
|
+
"icon-line": (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { component: LineChart, ...props }),
|
|
2513
|
+
"icon-bar": (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { component: BarChart, ...props }),
|
|
2514
|
+
"icon-column": (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { component: ColumnChart, ...props }),
|
|
2515
|
+
"icon-scatter": (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { component: ScatterChart, ...props })
|
|
2516
|
+
});
|
|
2517
|
+
const defaultFieldNames = {
|
|
2518
|
+
label: "label",
|
|
2519
|
+
value: "value",
|
|
2520
|
+
color: "color",
|
|
2521
|
+
options: "children"
|
|
2522
|
+
};
|
|
2523
|
+
const getCurrentOptions = (values, dataSource, fieldNames) => {
|
|
2524
|
+
function flatData(data) {
|
|
2525
|
+
const newArr = [];
|
|
2526
|
+
for (let i = 0; i < data.length; i++) {
|
|
2527
|
+
const children = data[i][fieldNames.options];
|
|
2528
|
+
if (Array.isArray(children)) {
|
|
2529
|
+
newArr.push(...flatData(children));
|
|
2530
|
+
}
|
|
2531
|
+
newArr.push({ ...data[i] });
|
|
2532
|
+
}
|
|
2533
|
+
return newArr;
|
|
2534
|
+
}
|
|
2535
|
+
const result = flatData(dataSource);
|
|
2536
|
+
values = lodash.castArray(values).filter((item) => item != null).map((val) => typeof val === "object" ? val[fieldNames.value] : val);
|
|
2537
|
+
const findOptions = (options) => {
|
|
2538
|
+
if (!options)
|
|
2539
|
+
return [];
|
|
2540
|
+
const current = [];
|
|
2541
|
+
for (const value of values) {
|
|
2542
|
+
const option = options.find((v) => v[fieldNames.value] === value) || { value, label: value };
|
|
2543
|
+
current.push(option);
|
|
2544
|
+
}
|
|
2545
|
+
return current;
|
|
2546
|
+
};
|
|
2547
|
+
return findOptions(result);
|
|
2548
|
+
};
|
|
2549
|
+
const ReadPretty = react.observer(
|
|
2550
|
+
(props) => {
|
|
2551
|
+
var _a;
|
|
2552
|
+
const fieldNames = { ...defaultFieldNames, ...props.fieldNames };
|
|
2553
|
+
const field = react.useField();
|
|
2554
|
+
const compile = client.useCompile();
|
|
2555
|
+
if (!shared.isValid(props.value)) {
|
|
2556
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {});
|
|
2557
|
+
}
|
|
2558
|
+
if (core.isArrayField(field) && ((_a = field == null ? void 0 : field.value) == null ? void 0 : _a.length) === 0) {
|
|
2559
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {});
|
|
2560
|
+
}
|
|
2561
|
+
const dataSource = field.dataSource || props.options || [];
|
|
2562
|
+
const options = getCurrentOptions(field.value, dataSource, fieldNames);
|
|
2563
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: options.map((option, key2) => /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color: option[fieldNames.color], icon: option.icon, children: compile(option[fieldNames.label]) }, key2)) });
|
|
2564
|
+
},
|
|
2565
|
+
{ displayName: "ReadPretty" }
|
|
2566
|
+
);
|
|
2567
|
+
const { Option, OptGroup } = antd.Select;
|
|
2568
|
+
const filterOption = (input, option) => ((option == null ? void 0 : option.label) ?? "").toLowerCase().includes((input || "").toLowerCase());
|
|
2569
|
+
const InternalSelect = react.connect(
|
|
2570
|
+
(props) => {
|
|
2571
|
+
const { ...others } = props;
|
|
2572
|
+
const { options, ...othersProps } = { ...others };
|
|
2573
|
+
const mode = props.mode || props.multiple ? "multiple" : void 0;
|
|
2574
|
+
const group1 = options.filter((option) => option.group === 2);
|
|
2575
|
+
const group2 = options.filter((option) => option.group === 1);
|
|
2576
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2577
|
+
antd.Select,
|
|
2578
|
+
{
|
|
2579
|
+
showSearch: true,
|
|
2580
|
+
filterOption,
|
|
2581
|
+
allowClear: true,
|
|
2582
|
+
...othersProps,
|
|
2583
|
+
onChange: (changed) => {
|
|
2584
|
+
var _a;
|
|
2585
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, changed === void 0 ? null : changed);
|
|
2586
|
+
},
|
|
2587
|
+
mode,
|
|
2588
|
+
children: [
|
|
2589
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(OptGroup, { label: lang("Basic charts"), children: group1.map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx(Option, { value: option.key, label: lang(option.title), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2590
|
+
antd.Popover,
|
|
2591
|
+
{
|
|
2592
|
+
placement: "right",
|
|
2593
|
+
zIndex: 99999999999,
|
|
2594
|
+
content: () => {
|
|
2595
|
+
var _a;
|
|
2596
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (_a = lang(option == null ? void 0 : option.description)) == null ? void 0 : _a.split(",").map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: item })) });
|
|
2597
|
+
},
|
|
2598
|
+
trigger: "hover",
|
|
2599
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2600
|
+
"div",
|
|
2601
|
+
{
|
|
2602
|
+
className: client.css`
|
|
2603
|
+
display: flex;
|
|
2604
|
+
gap: 4px;
|
|
2605
|
+
align-items: center;
|
|
2606
|
+
`,
|
|
2607
|
+
children: [
|
|
2608
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { type: option.iconId }),
|
|
2609
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { role: "img", "aria-label": lang(option.title), children: lang(option.title) })
|
|
2610
|
+
]
|
|
2611
|
+
}
|
|
2612
|
+
)
|
|
2613
|
+
}
|
|
2614
|
+
) })) }),
|
|
2615
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(OptGroup, { label: lang("More charts"), children: group2.map((option) => /* @__PURE__ */ jsxRuntimeExports.jsx(Option, { value: option.key, label: lang(option.title), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2616
|
+
antd.Popover,
|
|
2617
|
+
{
|
|
2618
|
+
placement: "right",
|
|
2619
|
+
zIndex: 99999999999,
|
|
2620
|
+
content: () => {
|
|
2621
|
+
var _a;
|
|
2622
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (_a = lang(option == null ? void 0 : option.description)) == null ? void 0 : _a.split(",").map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: item })) });
|
|
2623
|
+
},
|
|
2624
|
+
trigger: "hover",
|
|
2625
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2626
|
+
"div",
|
|
2627
|
+
{
|
|
2628
|
+
className: client.css`
|
|
2629
|
+
display: flex;
|
|
2630
|
+
gap: 4px;
|
|
2631
|
+
align-items: center;
|
|
2632
|
+
`,
|
|
2633
|
+
children: [
|
|
2634
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(client.Icon, { type: option.iconId }),
|
|
2635
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { role: "img", "aria-label": lang(option.title), children: lang(option.title) })
|
|
2636
|
+
]
|
|
2637
|
+
}
|
|
2638
|
+
)
|
|
2639
|
+
}
|
|
2640
|
+
) })) })
|
|
2641
|
+
]
|
|
2642
|
+
}
|
|
2643
|
+
);
|
|
2644
|
+
},
|
|
2645
|
+
react.mapProps(
|
|
2646
|
+
{
|
|
2647
|
+
dataSource: "options",
|
|
2648
|
+
loading: true
|
|
2649
|
+
},
|
|
2650
|
+
(props, field) => {
|
|
2651
|
+
return {
|
|
2652
|
+
...props,
|
|
2653
|
+
suffixIcon: (field == null ? void 0 : field["loading"]) || (field == null ? void 0 : field["validating"]) ? /* @__PURE__ */ jsxRuntimeExports.jsx(icons.LoadingOutlined, {}) : props == null ? void 0 : props.suffixIcon
|
|
2654
|
+
};
|
|
2655
|
+
}
|
|
2656
|
+
),
|
|
2657
|
+
react.mapReadPretty(ReadPretty)
|
|
2658
|
+
);
|
|
2659
|
+
const CustomSelect = InternalSelect;
|
|
2660
|
+
CustomSelect.ReadPretty = ReadPretty;
|
|
2661
|
+
const useCreateAction = () => {
|
|
2662
|
+
const { setVisible } = client.useActionContext();
|
|
2663
|
+
const form = react.useForm();
|
|
2664
|
+
const { refresh } = client.useResourceActionContext();
|
|
2665
|
+
const { resource } = client.useResourceContext();
|
|
2666
|
+
const ctx = useChartQueryMetadataContext();
|
|
2667
|
+
return {
|
|
2668
|
+
async run() {
|
|
2669
|
+
await form.submit();
|
|
2670
|
+
await resource.create({ values: form.values });
|
|
2671
|
+
setVisible(false);
|
|
2672
|
+
await form.reset();
|
|
2673
|
+
refresh();
|
|
2674
|
+
ctx.refresh();
|
|
2675
|
+
}
|
|
2676
|
+
};
|
|
2677
|
+
};
|
|
2678
|
+
const useUpdateAction = () => {
|
|
2679
|
+
const { setVisible } = client.useActionContext();
|
|
2680
|
+
const form = react.useForm();
|
|
2681
|
+
const { refresh } = client.useResourceActionContext();
|
|
2682
|
+
const { resource, targetKey } = client.useResourceContext();
|
|
2683
|
+
const { [targetKey]: filterByTk } = client.useRecord();
|
|
2684
|
+
const ctx = useChartQueryMetadataContext();
|
|
2685
|
+
return {
|
|
2686
|
+
async run() {
|
|
2687
|
+
await form.submit();
|
|
2688
|
+
await resource.update({ filterByTk, values: form.values });
|
|
2689
|
+
setVisible(false);
|
|
2690
|
+
await form.reset();
|
|
2691
|
+
refresh();
|
|
2692
|
+
ctx.refresh();
|
|
2693
|
+
}
|
|
2694
|
+
};
|
|
2695
|
+
};
|
|
2696
|
+
const useCloseAction = () => {
|
|
2697
|
+
const { setVisible } = client.useActionContext();
|
|
2698
|
+
return {
|
|
2699
|
+
async run() {
|
|
2700
|
+
setVisible(false);
|
|
2701
|
+
}
|
|
2702
|
+
};
|
|
2703
|
+
};
|
|
2704
|
+
const getSchema = (initialValue, { form, isNewRecord }) => {
|
|
2705
|
+
const type = initialValue.type;
|
|
2706
|
+
const schema = {
|
|
2707
|
+
type: "void",
|
|
2708
|
+
name: shared.uid(),
|
|
2709
|
+
"x-component": "Action.Drawer",
|
|
2710
|
+
"x-decorator": "Form",
|
|
2711
|
+
"x-decorator-props": {
|
|
2712
|
+
form
|
|
2713
|
+
// initialValue: JSON.parse(JSON.stringify(initialValue)),
|
|
2714
|
+
},
|
|
2715
|
+
title: isNewRecord ? lang("Add query") : lang("Edit query"),
|
|
2716
|
+
properties: {
|
|
2717
|
+
title: {
|
|
2718
|
+
title: lang("Title"),
|
|
2719
|
+
required: true,
|
|
2720
|
+
"x-component": "Input",
|
|
2721
|
+
"x-decorator": "FormItem"
|
|
2722
|
+
},
|
|
2723
|
+
options: getQueryTypeSchema(type),
|
|
2724
|
+
footer: {
|
|
2725
|
+
type: "void",
|
|
2726
|
+
"x-component": "Action.Drawer.Footer",
|
|
2727
|
+
properties: {
|
|
2728
|
+
cancel: {
|
|
2729
|
+
"x-component": "Action",
|
|
2730
|
+
title: lang("Cancel"),
|
|
2731
|
+
"x-component-props": {
|
|
2732
|
+
useAction: "{{ useCloseAction }}"
|
|
2733
|
+
}
|
|
2734
|
+
},
|
|
2735
|
+
submit: {
|
|
2736
|
+
"x-component": "Action",
|
|
2737
|
+
title: lang("Submit"),
|
|
2738
|
+
"x-component-props": {
|
|
2739
|
+
type: "primary",
|
|
2740
|
+
useAction: "{{ useSubmitAction }}"
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
};
|
|
2747
|
+
return schema;
|
|
2748
|
+
};
|
|
2749
|
+
const AddNewQuery = () => {
|
|
2750
|
+
const [visible, setVisible] = require$$0.useState(false);
|
|
2751
|
+
const [schema, setSchema] = require$$0.useState({});
|
|
2752
|
+
const form = require$$0.useMemo(() => core.createForm(), []);
|
|
2753
|
+
const menu = require$$0.useMemo(() => {
|
|
2754
|
+
return {
|
|
2755
|
+
onClick: (info) => {
|
|
2756
|
+
setVisible(true);
|
|
2757
|
+
form.setValues({ type: info.key });
|
|
2758
|
+
setSchema(getSchema({ type: info.key }, { form, isNewRecord: true }));
|
|
2759
|
+
},
|
|
2760
|
+
items: [
|
|
2761
|
+
{
|
|
2762
|
+
key: "json",
|
|
2763
|
+
label: "JSON"
|
|
2764
|
+
},
|
|
2765
|
+
{
|
|
2766
|
+
key: "sql",
|
|
2767
|
+
label: "SQL"
|
|
2768
|
+
},
|
|
2769
|
+
{
|
|
2770
|
+
key: "api",
|
|
2771
|
+
label: "API",
|
|
2772
|
+
disabled: true
|
|
2773
|
+
},
|
|
2774
|
+
{
|
|
2775
|
+
key: "collection",
|
|
2776
|
+
label: "Collection",
|
|
2777
|
+
disabled: true
|
|
2778
|
+
}
|
|
2779
|
+
]
|
|
2780
|
+
};
|
|
2781
|
+
}, [form]);
|
|
2782
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(client.ActionContextProvider, { value: { visible, setVisible }, children: [
|
|
2783
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(antd.Dropdown, { menu, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Button, { icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.PlusOutlined, {}), type: "primary", children: [
|
|
2784
|
+
lang("Add query"),
|
|
2785
|
+
" ",
|
|
2786
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(icons.DownOutlined, {})
|
|
2787
|
+
] }) }),
|
|
2788
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponent, { schema, scope: { useCloseAction, useSubmitAction: useCreateAction } })
|
|
2789
|
+
] });
|
|
2790
|
+
};
|
|
2791
|
+
const EditQuery = () => {
|
|
2792
|
+
const [visible, setVisible] = require$$0.useState(false);
|
|
2793
|
+
const record = client.useRecord();
|
|
2794
|
+
const form = require$$0.useMemo(() => core.createForm(), []);
|
|
2795
|
+
const schema = getSchema(record, { form, isNewRecord: false });
|
|
2796
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(client.ActionContextProvider, { value: { visible, setVisible }, children: [
|
|
2797
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2798
|
+
"a",
|
|
2799
|
+
{
|
|
2800
|
+
onClick: () => {
|
|
2801
|
+
form.setValues(record);
|
|
2802
|
+
setVisible(true);
|
|
2803
|
+
},
|
|
2804
|
+
children: lang("Edit")
|
|
2805
|
+
}
|
|
2806
|
+
),
|
|
2807
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaComponent, { schema, scope: { useCloseAction, useSubmitAction: useUpdateAction } })
|
|
2808
|
+
] });
|
|
2809
|
+
};
|
|
2810
|
+
const ConfigureFields = () => {
|
|
2811
|
+
const record = client.useRecord();
|
|
2812
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2813
|
+
antd.Table,
|
|
2814
|
+
{
|
|
2815
|
+
columns: [
|
|
2816
|
+
{
|
|
2817
|
+
title: "字段标识",
|
|
2818
|
+
dataIndex: "name"
|
|
2819
|
+
}
|
|
2820
|
+
],
|
|
2821
|
+
dataSource: record.fields || []
|
|
2822
|
+
}
|
|
2823
|
+
);
|
|
2824
|
+
};
|
|
2825
|
+
const collection = {
|
|
2826
|
+
name: "chartsQueries",
|
|
2827
|
+
fields: [
|
|
2828
|
+
{
|
|
2829
|
+
type: "integer",
|
|
2830
|
+
name: "title",
|
|
2831
|
+
interface: "input",
|
|
2832
|
+
uiSchema: {
|
|
2833
|
+
title: '{{t("Title",{ns:"charts"})}}',
|
|
2834
|
+
type: "string",
|
|
2835
|
+
"x-component": "Input",
|
|
2836
|
+
required: true
|
|
2837
|
+
}
|
|
2838
|
+
},
|
|
2839
|
+
{
|
|
2840
|
+
type: "string",
|
|
2841
|
+
name: "type",
|
|
2842
|
+
interface: "select",
|
|
2843
|
+
uiSchema: {
|
|
2844
|
+
title: '{{t("Type",{ns:"charts"})}}',
|
|
2845
|
+
type: "string",
|
|
2846
|
+
"x-component": "Select",
|
|
2847
|
+
required: true,
|
|
2848
|
+
enum: [
|
|
2849
|
+
{ label: '{{t("API")}}', value: "api" },
|
|
2850
|
+
{ label: '{{t("SQL")}}', value: "sql" },
|
|
2851
|
+
{ label: '{{t("JSON")}}', value: "json" }
|
|
2852
|
+
]
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
]
|
|
2856
|
+
};
|
|
2857
|
+
const useDestroyQueryItemAction = () => {
|
|
2858
|
+
const ctx = useChartQueryMetadataContext();
|
|
2859
|
+
const { refresh } = client.useResourceActionContext();
|
|
2860
|
+
const { resource, targetKey } = client.useResourceContext();
|
|
2861
|
+
const { [targetKey]: filterByTk } = client.useRecord();
|
|
2862
|
+
return {
|
|
2863
|
+
async run() {
|
|
2864
|
+
await resource.destroy({ filterByTk });
|
|
2865
|
+
refresh();
|
|
2866
|
+
ctx.refresh();
|
|
2867
|
+
}
|
|
2868
|
+
};
|
|
2869
|
+
};
|
|
2870
|
+
const useDestroyAllSelectedQueriesAction = () => {
|
|
2871
|
+
const ctx = useChartQueryMetadataContext();
|
|
2872
|
+
const { state, setState, refresh } = client.useResourceActionContext();
|
|
2873
|
+
const { resource, targetKey } = client.useResourceContext();
|
|
2874
|
+
return {
|
|
2875
|
+
async run() {
|
|
2876
|
+
await resource.destroy({
|
|
2877
|
+
filterByTk: (state == null ? void 0 : state.selectedRowKeys) || []
|
|
2878
|
+
});
|
|
2879
|
+
setState == null ? void 0 : setState({ selectedRowKeys: [] });
|
|
2880
|
+
refresh();
|
|
2881
|
+
ctx.refresh();
|
|
2882
|
+
}
|
|
2883
|
+
};
|
|
2884
|
+
};
|
|
2885
|
+
const chartsQueriesSchema = {
|
|
2886
|
+
type: "object",
|
|
2887
|
+
properties: {
|
|
2888
|
+
[shared.uid()]: {
|
|
2889
|
+
type: "void",
|
|
2890
|
+
"x-decorator": "ResourceActionProvider",
|
|
2891
|
+
"x-decorator-props": {
|
|
2892
|
+
collection,
|
|
2893
|
+
resourceName: "chartsQueries",
|
|
2894
|
+
request: {
|
|
2895
|
+
resource: "chartsQueries",
|
|
2896
|
+
action: "list",
|
|
2897
|
+
params: {
|
|
2898
|
+
pageSize: 50,
|
|
2899
|
+
sort: ["-id"],
|
|
2900
|
+
appends: []
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
},
|
|
2904
|
+
"x-component": "CollectionProvider",
|
|
2905
|
+
"x-component-props": {
|
|
2906
|
+
collection
|
|
2907
|
+
},
|
|
2908
|
+
properties: {
|
|
2909
|
+
actions: {
|
|
2910
|
+
type: "void",
|
|
2911
|
+
"x-component": "ActionBar",
|
|
2912
|
+
"x-component-props": {
|
|
2913
|
+
style: {
|
|
2914
|
+
marginBottom: 16
|
|
2915
|
+
}
|
|
2916
|
+
},
|
|
2917
|
+
properties: {
|
|
2918
|
+
delete: {
|
|
2919
|
+
type: "void",
|
|
2920
|
+
title: '{{ t("Delete") }}',
|
|
2921
|
+
"x-component": "Action",
|
|
2922
|
+
"x-component-props": {
|
|
2923
|
+
useAction: "{{ useDestroyAllSelectedQueriesAction }}",
|
|
2924
|
+
confirm: {
|
|
2925
|
+
title: '{{t("Delete queries",{ns:"charts"})}}',
|
|
2926
|
+
content: "{{t('Are you sure you want to delete it?')}}"
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
},
|
|
2930
|
+
create: {
|
|
2931
|
+
type: "void",
|
|
2932
|
+
title: '{{t("Add query")}}',
|
|
2933
|
+
"x-component": "AddNewQuery",
|
|
2934
|
+
"x-component-props": {
|
|
2935
|
+
type: "primary"
|
|
2936
|
+
},
|
|
2937
|
+
properties: {
|
|
2938
|
+
drawer: {
|
|
2939
|
+
type: "void",
|
|
2940
|
+
"x-component": "Action.Drawer",
|
|
2941
|
+
"x-decorator": "Form",
|
|
2942
|
+
"x-decorator-props": {
|
|
2943
|
+
useValues(options) {
|
|
2944
|
+
const ctx = client.useActionContext();
|
|
2945
|
+
return client.useRequest(
|
|
2946
|
+
() => Promise.resolve({
|
|
2947
|
+
data: {
|
|
2948
|
+
name: `s_${shared.uid()}`
|
|
2949
|
+
}
|
|
2950
|
+
}),
|
|
2951
|
+
{ ...options, refreshDeps: [ctx.visible] }
|
|
2952
|
+
);
|
|
2953
|
+
}
|
|
2954
|
+
},
|
|
2955
|
+
title: '{{t("Add query",{ns:"charts"})}}',
|
|
2956
|
+
properties: {
|
|
2957
|
+
title: {
|
|
2958
|
+
"x-component": "CollectionField",
|
|
2959
|
+
"x-decorator": "FormItem"
|
|
2960
|
+
},
|
|
2961
|
+
type: {
|
|
2962
|
+
"x-component": "CollectionField",
|
|
2963
|
+
"x-decorator": "FormItem"
|
|
2964
|
+
},
|
|
2965
|
+
footer: {
|
|
2966
|
+
type: "void",
|
|
2967
|
+
"x-component": "Action.Drawer.Footer",
|
|
2968
|
+
properties: {
|
|
2969
|
+
cancel: {
|
|
2970
|
+
title: '{{t("Cancel",{ns:"charts"})}}',
|
|
2971
|
+
"x-component": "Action",
|
|
2972
|
+
"x-component-props": {
|
|
2973
|
+
useAction: "{{ cm.useCancelAction }}"
|
|
2974
|
+
}
|
|
2975
|
+
},
|
|
2976
|
+
submit: {
|
|
2977
|
+
title: '{{t("Submit",{ns:"charts"})}}',
|
|
2978
|
+
"x-component": "Action",
|
|
2979
|
+
"x-component-props": {
|
|
2980
|
+
type: "primary",
|
|
2981
|
+
useAction: "{{ cm.useCreateAction }}"
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
},
|
|
2992
|
+
table: {
|
|
2993
|
+
type: "void",
|
|
2994
|
+
"x-uid": "input",
|
|
2995
|
+
"x-component": "Table.Void",
|
|
2996
|
+
"x-component-props": {
|
|
2997
|
+
rowKey: "id",
|
|
2998
|
+
rowSelection: {
|
|
2999
|
+
type: "checkbox"
|
|
3000
|
+
},
|
|
3001
|
+
useDataSource: "{{ cm.useDataSourceFromRAC }}"
|
|
3002
|
+
},
|
|
3003
|
+
properties: {
|
|
3004
|
+
title: {
|
|
3005
|
+
type: "void",
|
|
3006
|
+
"x-decorator": "Table.Column.Decorator",
|
|
3007
|
+
"x-component": "Table.Column",
|
|
3008
|
+
properties: {
|
|
3009
|
+
title: {
|
|
3010
|
+
type: "number",
|
|
3011
|
+
"x-component": "CollectionField",
|
|
3012
|
+
"x-read-pretty": true
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
},
|
|
3016
|
+
type: {
|
|
3017
|
+
type: "void",
|
|
3018
|
+
"x-decorator": "Table.Column.Decorator",
|
|
3019
|
+
"x-component": "Table.Column",
|
|
3020
|
+
properties: {
|
|
3021
|
+
type: {
|
|
3022
|
+
type: "string",
|
|
3023
|
+
"x-component": "CollectionField",
|
|
3024
|
+
"x-read-pretty": true
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
},
|
|
3028
|
+
actions: {
|
|
3029
|
+
type: "void",
|
|
3030
|
+
title: '{{t("Actions")}}',
|
|
3031
|
+
"x-component": "Table.Column",
|
|
3032
|
+
properties: {
|
|
3033
|
+
actions: {
|
|
3034
|
+
type: "void",
|
|
3035
|
+
"x-component": "Space",
|
|
3036
|
+
"x-component-props": {
|
|
3037
|
+
split: "|"
|
|
3038
|
+
},
|
|
3039
|
+
properties: {
|
|
3040
|
+
fields: {
|
|
3041
|
+
type: "void",
|
|
3042
|
+
title: '{{t("Configure fields")}}',
|
|
3043
|
+
"x-component": "Action.Link",
|
|
3044
|
+
"x-component-props": {
|
|
3045
|
+
type: "primary"
|
|
3046
|
+
},
|
|
3047
|
+
properties: {
|
|
3048
|
+
drawer: {
|
|
3049
|
+
type: "void",
|
|
3050
|
+
"x-component": "Action.Drawer",
|
|
3051
|
+
title: '{{t("Configure fields")}}',
|
|
3052
|
+
properties: {
|
|
3053
|
+
configure: {
|
|
3054
|
+
type: "void",
|
|
3055
|
+
"x-component": "ConfigureFields"
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
}
|
|
3060
|
+
},
|
|
3061
|
+
update: {
|
|
3062
|
+
type: "void",
|
|
3063
|
+
title: '{{t("Edit")}}',
|
|
3064
|
+
"x-component": "EditQuery",
|
|
3065
|
+
"x-component-props": {
|
|
3066
|
+
type: "primary"
|
|
3067
|
+
},
|
|
3068
|
+
properties: {
|
|
3069
|
+
drawer: {
|
|
3070
|
+
type: "void",
|
|
3071
|
+
"x-component": "Action.Drawer",
|
|
3072
|
+
"x-decorator": "Form",
|
|
3073
|
+
"x-decorator-props": {
|
|
3074
|
+
useValues: "{{ cm.useValuesFromRecord }}"
|
|
3075
|
+
},
|
|
3076
|
+
title: '{{t("Edit")}}',
|
|
3077
|
+
properties: {
|
|
3078
|
+
title: {
|
|
3079
|
+
"x-component": "CollectionField",
|
|
3080
|
+
"x-decorator": "FormItem"
|
|
3081
|
+
},
|
|
3082
|
+
footer: {
|
|
3083
|
+
type: "void",
|
|
3084
|
+
"x-component": "Action.Drawer.Footer",
|
|
3085
|
+
properties: {
|
|
3086
|
+
cancel: {
|
|
3087
|
+
title: '{{t("Cancel",{ns:"charts"})}}',
|
|
3088
|
+
"x-component": "Action",
|
|
3089
|
+
"x-component-props": {
|
|
3090
|
+
useAction: "{{ cm.useCancelAction }}"
|
|
3091
|
+
}
|
|
3092
|
+
},
|
|
3093
|
+
submit: {
|
|
3094
|
+
title: '{{t("Submit",{ns:"charts"})}}',
|
|
3095
|
+
"x-component": "Action",
|
|
3096
|
+
"x-component-props": {
|
|
3097
|
+
type: "primary",
|
|
3098
|
+
useAction: "{{ cm.useUpdateAction }}"
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
},
|
|
3107
|
+
delete: {
|
|
3108
|
+
type: "void",
|
|
3109
|
+
title: '{{ t("Delete") }}',
|
|
3110
|
+
"x-component": "Action.Link",
|
|
3111
|
+
"x-component-props": {
|
|
3112
|
+
confirm: {
|
|
3113
|
+
title: '{{t("Delete query",{ns:"charts"})}}',
|
|
3114
|
+
content: "{{t('Are you sure you want to delete it?')}}"
|
|
3115
|
+
},
|
|
3116
|
+
useAction: "{{ useDestroyQueryItemAction }}"
|
|
3117
|
+
}
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
};
|
|
3129
|
+
const QueriesTable = () => {
|
|
3130
|
+
require$$0.useState(false);
|
|
3131
|
+
reactI18next.useTranslation();
|
|
3132
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Card, { bordered: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3133
|
+
client.SchemaComponent,
|
|
3134
|
+
{
|
|
3135
|
+
scope: { JSON5: lib, useDestroyQueryItemAction, useDestroyAllSelectedQueriesAction },
|
|
3136
|
+
schema: chartsQueriesSchema,
|
|
3137
|
+
components: { AddNewQuery, EditQuery, ConfigureFields }
|
|
3138
|
+
}
|
|
3139
|
+
) });
|
|
3140
|
+
};
|
|
3141
|
+
core.registerValidateRules({
|
|
3142
|
+
json5: (value, rule) => {
|
|
3143
|
+
if (!value) {
|
|
3144
|
+
return "";
|
|
3145
|
+
}
|
|
3146
|
+
try {
|
|
3147
|
+
const val = lib.parse(value);
|
|
3148
|
+
if (!isNaN(val)) {
|
|
3149
|
+
return {
|
|
3150
|
+
type: "error",
|
|
3151
|
+
message: lang("Invalid JSON format")
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
return "";
|
|
3155
|
+
} catch (error) {
|
|
3156
|
+
console.error(error);
|
|
3157
|
+
return {
|
|
3158
|
+
type: "error",
|
|
3159
|
+
message: lang("Invalid JSON format")
|
|
3160
|
+
};
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
});
|
|
3164
|
+
const ChartsProvider = require$$0.memo((props) => {
|
|
3165
|
+
const api2 = client.useAPIClient();
|
|
3166
|
+
const items = require$$0.useContext(client.SchemaInitializerContext);
|
|
3167
|
+
const children = items.BlockInitializers.items[0].children;
|
|
3168
|
+
if (children) {
|
|
3169
|
+
const hasChartItem = children.some((child) => (child == null ? void 0 : child.component) === "ChartBlockInitializer");
|
|
3170
|
+
if (!hasChartItem) {
|
|
3171
|
+
children.push({
|
|
3172
|
+
key: "chart",
|
|
3173
|
+
type: "item",
|
|
3174
|
+
icon: "PieChartOutlined",
|
|
3175
|
+
title: '{{t("Chart (Old)",{ns:"charts"})}}',
|
|
3176
|
+
component: "ChartBlockInitializer"
|
|
3177
|
+
});
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
const validateSQL = (sql2) => {
|
|
3181
|
+
return new Promise((resolve) => {
|
|
3182
|
+
api2.request({
|
|
3183
|
+
url: "chartsQueries:validate",
|
|
3184
|
+
method: "post",
|
|
3185
|
+
data: {
|
|
3186
|
+
sql: sql2
|
|
3187
|
+
}
|
|
3188
|
+
}).then(({ data }) => {
|
|
3189
|
+
var _a;
|
|
3190
|
+
resolve((_a = data == null ? void 0 : data.data) == null ? void 0 : _a.errorMessage);
|
|
3191
|
+
}).catch(() => {
|
|
3192
|
+
resolve("Invalid SQL");
|
|
3193
|
+
});
|
|
3194
|
+
});
|
|
3195
|
+
};
|
|
3196
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ChartQueryMetadataProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3197
|
+
client.SettingsCenterProvider,
|
|
3198
|
+
{
|
|
3199
|
+
settings: {
|
|
3200
|
+
charts: {
|
|
3201
|
+
title: '{{t("Charts", {ns:"charts"})}}',
|
|
3202
|
+
icon: "PieChartOutlined",
|
|
3203
|
+
tabs: {
|
|
3204
|
+
queries: {
|
|
3205
|
+
title: '{{t("Queries", {ns:"charts"})}}',
|
|
3206
|
+
component: QueriesTable
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
},
|
|
3211
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3212
|
+
client.SchemaComponentOptions,
|
|
3213
|
+
{
|
|
3214
|
+
scope: { validateSQL },
|
|
3215
|
+
components: { CustomSelect, ChartBlockInitializer, ChartBlockEngine },
|
|
3216
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(client.SchemaInitializerContext.Provider, { value: items, children: props.children })
|
|
3217
|
+
}
|
|
3218
|
+
)
|
|
3219
|
+
}
|
|
3220
|
+
) });
|
|
3221
|
+
});
|
|
3222
|
+
ChartsProvider.displayName = "ChartsProvider";
|
|
3223
|
+
class ChartsPlugin extends client.Plugin {
|
|
3224
|
+
async afterAdd() {
|
|
3225
|
+
this.app.pm.add(client.BlockSchemaComponentPlugin);
|
|
3226
|
+
}
|
|
3227
|
+
async load() {
|
|
3228
|
+
this.app.use(ChartsProvider);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
exports2.ChartsPlugin = ChartsPlugin;
|
|
3232
|
+
exports2.default = ChartsPlugin;
|
|
3233
|
+
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3234
|
+
});
|