@datawheel/data-explorer 1.1.5 → 1.1.6
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/dist/main.mjs +286 -1521
- package/package.json +4 -3
package/dist/main.mjs
CHANGED
|
@@ -8,187 +8,21 @@ import { createSlice, createSelector, combineReducers, bindActionCreators, confi
|
|
|
8
8
|
import { useSelector as useSelector$1, useStore, Provider as Provider$1 } from 'react-redux';
|
|
9
9
|
import { useNavigate, BrowserRouter, useLocation } from 'react-router-dom';
|
|
10
10
|
import ISO63912 from 'iso-639-1';
|
|
11
|
-
import {
|
|
11
|
+
import { debounce, cloneDeep } from 'lodash-es';
|
|
12
12
|
import { formatAbbreviate, format } from 'd3plus-format';
|
|
13
13
|
import { QueryClient, useQuery, QueryClientProvider, keepPreviousData, useMutation } from '@tanstack/react-query';
|
|
14
|
-
import
|
|
15
|
-
import { debounce as debounce$1 } from 'lodash-es';
|
|
14
|
+
import { MRT_ProgressBar, flexRender, MRT_TableBodyCell, MRT_ToolbarAlertBanner, useMantineReactTable, MantineReactTable, MRT_TablePagination } from 'mantine-react-table';
|
|
16
15
|
import { TourProvider, useTour } from '@reactour/tour';
|
|
17
16
|
import yn from 'yn';
|
|
18
17
|
import { matchSorter } from 'match-sorter';
|
|
19
18
|
import { generateCharts } from '@datawheel/vizbuilder';
|
|
19
|
+
import cls from 'clsx';
|
|
20
|
+
import { saveElement } from 'd3plus-export';
|
|
20
21
|
import { d3plusConfigBuilder } from '@datawheel/vizbuilder/react';
|
|
22
|
+
import { assign } from 'd3plus-common';
|
|
21
23
|
import { BarChart, Geomap, Donut, LinePlot, StackedArea, Treemap } from 'd3plus-react';
|
|
22
24
|
|
|
23
|
-
var __create = Object.create;
|
|
24
|
-
var __defProp = Object.defineProperty;
|
|
25
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
26
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
27
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
28
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
29
|
-
var __esm = (fn, res) => function __init() {
|
|
30
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
31
|
-
};
|
|
32
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
33
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
34
|
-
};
|
|
35
|
-
var __copyProps = (to, from, except, desc) => {
|
|
36
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
37
|
-
for (let key of __getOwnPropNames(from))
|
|
38
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
39
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
40
|
-
}
|
|
41
|
-
return to;
|
|
42
|
-
};
|
|
43
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
44
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
45
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
46
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
47
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
48
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
49
|
-
mod
|
|
50
|
-
));
|
|
51
|
-
|
|
52
|
-
// node_modules/tsup/assets/esm_shims.js
|
|
53
|
-
var init_esm_shims = __esm({
|
|
54
|
-
"node_modules/tsup/assets/esm_shims.js"() {
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// node_modules/file-saver/FileSaver.js
|
|
59
|
-
var require_FileSaver = __commonJS({
|
|
60
|
-
"node_modules/file-saver/FileSaver.js"(exports, module) {
|
|
61
|
-
init_esm_shims();
|
|
62
|
-
var saveAs2 = saveAs2 || function(view) {
|
|
63
|
-
if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
var doc = view.document, get_URL = function() {
|
|
67
|
-
return view.URL || view.webkitURL || view;
|
|
68
|
-
}, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a"), can_use_save_link = "download" in save_link, click2 = function(node) {
|
|
69
|
-
var event = new MouseEvent("click");
|
|
70
|
-
node.dispatchEvent(event);
|
|
71
|
-
}, is_safari = /constructor/i.test(view.HTMLElement) || view.safari, is_chrome_ios = /CriOS\/[\d]+/.test(navigator.userAgent), throw_outside = function(ex) {
|
|
72
|
-
(view.setImmediate || view.setTimeout)(function() {
|
|
73
|
-
throw ex;
|
|
74
|
-
}, 0);
|
|
75
|
-
}, force_saveable_type = "application/octet-stream", arbitrary_revoke_timeout = 1e3 * 40, revoke = function(file) {
|
|
76
|
-
var revoker = function() {
|
|
77
|
-
if (typeof file === "string") {
|
|
78
|
-
get_URL().revokeObjectURL(file);
|
|
79
|
-
} else {
|
|
80
|
-
file.remove();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
setTimeout(revoker, arbitrary_revoke_timeout);
|
|
84
|
-
}, dispatch = function(filesaver, event_types, event) {
|
|
85
|
-
event_types = [].concat(event_types);
|
|
86
|
-
var i = event_types.length;
|
|
87
|
-
while (i--) {
|
|
88
|
-
var listener = filesaver["on" + event_types[i]];
|
|
89
|
-
if (typeof listener === "function") {
|
|
90
|
-
try {
|
|
91
|
-
listener.call(filesaver, event || filesaver);
|
|
92
|
-
} catch (ex) {
|
|
93
|
-
throw_outside(ex);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}, auto_bom = function(blob) {
|
|
98
|
-
if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
|
|
99
|
-
return new Blob([String.fromCharCode(65279), blob], { type: blob.type });
|
|
100
|
-
}
|
|
101
|
-
return blob;
|
|
102
|
-
}, FileSaver = function(blob, name4, no_auto_bom) {
|
|
103
|
-
if (!no_auto_bom) {
|
|
104
|
-
blob = auto_bom(blob);
|
|
105
|
-
}
|
|
106
|
-
var filesaver = this, type = blob.type, force = type === force_saveable_type, object_url, dispatch_all = function() {
|
|
107
|
-
dispatch(filesaver, "writestart progress write writeend".split(" "));
|
|
108
|
-
}, fs_error = function() {
|
|
109
|
-
if ((is_chrome_ios || force && is_safari) && view.FileReader) {
|
|
110
|
-
var reader = new FileReader();
|
|
111
|
-
reader.onloadend = function() {
|
|
112
|
-
var url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, "data:attachment/file;");
|
|
113
|
-
var popup = view.open(url, "_blank");
|
|
114
|
-
if (!popup) view.location.href = url;
|
|
115
|
-
url = void 0;
|
|
116
|
-
filesaver.readyState = filesaver.DONE;
|
|
117
|
-
dispatch_all();
|
|
118
|
-
};
|
|
119
|
-
reader.readAsDataURL(blob);
|
|
120
|
-
filesaver.readyState = filesaver.INIT;
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (!object_url) {
|
|
124
|
-
object_url = get_URL().createObjectURL(blob);
|
|
125
|
-
}
|
|
126
|
-
if (force) {
|
|
127
|
-
view.location.href = object_url;
|
|
128
|
-
} else {
|
|
129
|
-
var opened = view.open(object_url, "_blank");
|
|
130
|
-
if (!opened) {
|
|
131
|
-
view.location.href = object_url;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
filesaver.readyState = filesaver.DONE;
|
|
135
|
-
dispatch_all();
|
|
136
|
-
revoke(object_url);
|
|
137
|
-
};
|
|
138
|
-
filesaver.readyState = filesaver.INIT;
|
|
139
|
-
if (can_use_save_link) {
|
|
140
|
-
object_url = get_URL().createObjectURL(blob);
|
|
141
|
-
setTimeout(function() {
|
|
142
|
-
save_link.href = object_url;
|
|
143
|
-
save_link.download = name4;
|
|
144
|
-
click2(save_link);
|
|
145
|
-
dispatch_all();
|
|
146
|
-
revoke(object_url);
|
|
147
|
-
filesaver.readyState = filesaver.DONE;
|
|
148
|
-
});
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
fs_error();
|
|
152
|
-
}, FS_proto = FileSaver.prototype, saveAs3 = function(blob, name4, no_auto_bom) {
|
|
153
|
-
return new FileSaver(blob, name4 || blob.name || "download", no_auto_bom);
|
|
154
|
-
};
|
|
155
|
-
if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
|
|
156
|
-
return function(blob, name4, no_auto_bom) {
|
|
157
|
-
name4 = name4 || blob.name || "download";
|
|
158
|
-
if (!no_auto_bom) {
|
|
159
|
-
blob = auto_bom(blob);
|
|
160
|
-
}
|
|
161
|
-
return navigator.msSaveOrOpenBlob(blob, name4);
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
FS_proto.abort = function() {
|
|
165
|
-
};
|
|
166
|
-
FS_proto.readyState = FS_proto.INIT = 0;
|
|
167
|
-
FS_proto.WRITING = 1;
|
|
168
|
-
FS_proto.DONE = 2;
|
|
169
|
-
FS_proto.error = FS_proto.onwritestart = FS_proto.onprogress = FS_proto.onwrite = FS_proto.onabort = FS_proto.onerror = FS_proto.onwriteend = null;
|
|
170
|
-
return saveAs3;
|
|
171
|
-
}(
|
|
172
|
-
typeof self !== "undefined" && self || typeof window !== "undefined" && window || exports.content
|
|
173
|
-
);
|
|
174
|
-
if (typeof module !== "undefined" && module.exports) {
|
|
175
|
-
module.exports.saveAs = saveAs2;
|
|
176
|
-
} else if (typeof define !== "undefined" && define !== null && define.amd !== null) {
|
|
177
|
-
define("FileSaver.js", function() {
|
|
178
|
-
return saveAs2;
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// src/main.ts
|
|
185
|
-
init_esm_shims();
|
|
186
|
-
|
|
187
25
|
// src/components/DebugView.tsx
|
|
188
|
-
init_esm_shims();
|
|
189
|
-
|
|
190
|
-
// src/hooks/translation.ts
|
|
191
|
-
init_esm_shims();
|
|
192
26
|
var explorerTranslation = {
|
|
193
27
|
action_copy: "Copy",
|
|
194
28
|
action_copy_done: "Copied",
|
|
@@ -516,12 +350,6 @@ function DebugView(props) {
|
|
|
516
350
|
}, [props.result.headers, t]);
|
|
517
351
|
return /* @__PURE__ */ React13__default.createElement(Box, { id: "query-results-debug-view" }, /* @__PURE__ */ React13__default.createElement(Stack, { spacing: "md", px: "md", py: "sm" }, url && /* @__PURE__ */ React13__default.createElement(Input.Wrapper, { label: t("debug_view.url_logiclayer") }, /* @__PURE__ */ React13__default.createElement(Group, { noWrap: true, spacing: "xs" }, /* @__PURE__ */ React13__default.createElement(Input, { icon: /* @__PURE__ */ React13__default.createElement(IconWorld, null), readOnly: true, rightSectionWidth: "auto", value: url, w: "100%" }), /* @__PURE__ */ React13__default.createElement(Button.Group, null, /* @__PURE__ */ React13__default.createElement(Button, { leftIcon: /* @__PURE__ */ React13__default.createElement(IconExternalLink, null), onClick: openHandler, variant: "default" }, t("action_open")), /* @__PURE__ */ React13__default.createElement(Button, { leftIcon: /* @__PURE__ */ React13__default.createElement(IconClipboard, null), onClick: copyHandler, variant: "default" }, copied ? t("action_copy_done") : t("action_copy"))))), /* @__PURE__ */ React13__default.createElement(SimpleGrid, { cols: 2 }, headers)));
|
|
518
352
|
}
|
|
519
|
-
|
|
520
|
-
// src/components/Explorer.tsx
|
|
521
|
-
init_esm_shims();
|
|
522
|
-
|
|
523
|
-
// src/hooks/settings.tsx
|
|
524
|
-
init_esm_shims();
|
|
525
353
|
var defaultToolbarConfig = {
|
|
526
354
|
buttons: [],
|
|
527
355
|
showLabels: true
|
|
@@ -596,17 +424,7 @@ function useActions() {
|
|
|
596
424
|
return context.actions;
|
|
597
425
|
}
|
|
598
426
|
|
|
599
|
-
// src/state/index.ts
|
|
600
|
-
init_esm_shims();
|
|
601
|
-
|
|
602
|
-
// src/state/queries.ts
|
|
603
|
-
init_esm_shims();
|
|
604
|
-
|
|
605
|
-
// src/utils/array.ts
|
|
606
|
-
init_esm_shims();
|
|
607
|
-
|
|
608
427
|
// src/utils/string.js
|
|
609
|
-
init_esm_shims();
|
|
610
428
|
function randomKey() {
|
|
611
429
|
return Math.random().toString(16).slice(2);
|
|
612
430
|
}
|
|
@@ -648,11 +466,7 @@ function next(iterable, condition) {
|
|
|
648
466
|
}
|
|
649
467
|
}
|
|
650
468
|
|
|
651
|
-
// src/utils/object.ts
|
|
652
|
-
init_esm_shims();
|
|
653
|
-
|
|
654
469
|
// src/api/traverse.ts
|
|
655
|
-
init_esm_shims();
|
|
656
470
|
function entityFinder(cube, name4) {
|
|
657
471
|
const nameWithoutID = name4.replace(/\sID$/, "");
|
|
658
472
|
const nameWithID = `${nameWithoutID} ID`;
|
|
@@ -758,7 +572,6 @@ function yieldMeasures(cube) {
|
|
|
758
572
|
}
|
|
759
573
|
|
|
760
574
|
// src/utils/validation.ts
|
|
761
|
-
init_esm_shims();
|
|
762
575
|
function hasProperty(container, property) {
|
|
763
576
|
return typeof container === "object" && container != null && Object.hasOwn(container, property);
|
|
764
577
|
}
|
|
@@ -879,11 +692,7 @@ function getDomain(data, column) {
|
|
|
879
692
|
return [min, max];
|
|
880
693
|
}
|
|
881
694
|
|
|
882
|
-
// src/utils/structs.ts
|
|
883
|
-
init_esm_shims();
|
|
884
|
-
|
|
885
695
|
// src/api/enum.ts
|
|
886
|
-
init_esm_shims();
|
|
887
696
|
var Comparison = /* @__PURE__ */ ((Comparison2) => {
|
|
888
697
|
Comparison2["!="] = "neq";
|
|
889
698
|
Comparison2["<"] = "lt";
|
|
@@ -1022,9 +831,6 @@ function buildProperty(props) {
|
|
|
1022
831
|
name: props.name || ""
|
|
1023
832
|
};
|
|
1024
833
|
}
|
|
1025
|
-
|
|
1026
|
-
// src/state/server.ts
|
|
1027
|
-
init_esm_shims();
|
|
1028
834
|
var name = "explorerServer";
|
|
1029
835
|
var initialState = {
|
|
1030
836
|
cubeMap: {},
|
|
@@ -1363,17 +1169,7 @@ createSelector(
|
|
|
1363
1169
|
(params) => isValidQueryVerbose(params)
|
|
1364
1170
|
);
|
|
1365
1171
|
|
|
1366
|
-
// src/state/store.ts
|
|
1367
|
-
init_esm_shims();
|
|
1368
|
-
|
|
1369
|
-
// src/api/index.ts
|
|
1370
|
-
init_esm_shims();
|
|
1371
|
-
|
|
1372
|
-
// src/api/complexity/client.ts
|
|
1373
|
-
init_esm_shims();
|
|
1374
|
-
|
|
1375
1172
|
// src/api/tools.ts
|
|
1376
|
-
init_esm_shims();
|
|
1377
1173
|
function toPlainObject(obj) {
|
|
1378
1174
|
return Object.fromEntries(
|
|
1379
1175
|
filterMap(Object.entries(obj), (entry) => {
|
|
@@ -1451,7 +1247,6 @@ var ComplexityModuleClient = class {
|
|
|
1451
1247
|
};
|
|
1452
1248
|
|
|
1453
1249
|
// src/api/tesseract/client.ts
|
|
1454
|
-
init_esm_shims();
|
|
1455
1250
|
var TesseractModuleClient = class {
|
|
1456
1251
|
constructor(baseURL, config) {
|
|
1457
1252
|
this.baseURL = baseURL ? baseURL.replace(/\/?$/, "/") : "";
|
|
@@ -1496,9 +1291,6 @@ var TesseractModuleClient = class {
|
|
|
1496
1291
|
}).then((response) => response.json());
|
|
1497
1292
|
}
|
|
1498
1293
|
};
|
|
1499
|
-
|
|
1500
|
-
// src/api/context.tsx
|
|
1501
|
-
init_esm_shims();
|
|
1502
1294
|
var LogicLayerContext = createContext(null);
|
|
1503
1295
|
function LogicLayerProvider(props) {
|
|
1504
1296
|
const [dataLocale, setDataLocale] = useState(props.defaultDataLocale || "");
|
|
@@ -1516,9 +1308,6 @@ function useLogicLayer() {
|
|
|
1516
1308
|
}
|
|
1517
1309
|
return context;
|
|
1518
1310
|
}
|
|
1519
|
-
|
|
1520
|
-
// src/state/loading.ts
|
|
1521
|
-
init_esm_shims();
|
|
1522
1311
|
var LOADINGSTATUS = {
|
|
1523
1312
|
FETCHING: "FETCHING",
|
|
1524
1313
|
SUCCESS: "SUCCESS",
|
|
@@ -1605,12 +1394,6 @@ var useSelector = useSelector$1;
|
|
|
1605
1394
|
|
|
1606
1395
|
// src/state/index.ts
|
|
1607
1396
|
var actions = queriesActions;
|
|
1608
|
-
|
|
1609
|
-
// src/components/ExplorerContent.tsx
|
|
1610
|
-
init_esm_shims();
|
|
1611
|
-
|
|
1612
|
-
// src/components/AnimatedCube.tsx
|
|
1613
|
-
init_esm_shims();
|
|
1614
1397
|
var colorShift = keyframes({
|
|
1615
1398
|
"from, to": {
|
|
1616
1399
|
fill: "var(--anicube-color1, #5c7080)"
|
|
@@ -1676,24 +1459,73 @@ function AnimatedCube(props) {
|
|
|
1676
1459
|
);
|
|
1677
1460
|
}
|
|
1678
1461
|
AnimatedCube.displayName = "DataExplorer/Anicube";
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1462
|
+
var defaultFormatters = {
|
|
1463
|
+
undefined: (n) => n,
|
|
1464
|
+
identity: (n) => `${n}`,
|
|
1465
|
+
Decimal: new Intl.NumberFormat(void 0, { useGrouping: false }).format,
|
|
1466
|
+
Dollars: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format,
|
|
1467
|
+
Human: (n) => formatAbbreviate(n, "en-US"),
|
|
1468
|
+
Milliards: new Intl.NumberFormat(void 0, { useGrouping: true }).format,
|
|
1469
|
+
Million: new Intl.NumberFormat(void 0, { useGrouping: true }).format
|
|
1470
|
+
};
|
|
1471
|
+
var basicFormatterKeys = ["Decimal", "Milliards", "Human"];
|
|
1472
|
+
function useFormatter() {
|
|
1473
|
+
const { formatters } = useSettings();
|
|
1474
|
+
const [formatMap, setFormatMap] = useState({});
|
|
1475
|
+
const formatterMap = useRef(formatters);
|
|
1476
|
+
return useMemo(() => {
|
|
1477
|
+
return {
|
|
1478
|
+
currentFormats: formatMap,
|
|
1479
|
+
getAvailableFormats(measure) {
|
|
1480
|
+
const formatterKeys = basicFormatterKeys.slice();
|
|
1481
|
+
if (typeof measure !== "string") {
|
|
1482
|
+
const { format_template, units_of_measurement } = measure.annotations;
|
|
1483
|
+
units_of_measurement && formatterKeys.unshift(units_of_measurement);
|
|
1484
|
+
format_template && formatterKeys.unshift(format_template);
|
|
1485
|
+
}
|
|
1486
|
+
return formatterKeys;
|
|
1487
|
+
},
|
|
1488
|
+
setFormat,
|
|
1489
|
+
getFormat,
|
|
1490
|
+
getFormatter(item) {
|
|
1491
|
+
const key = typeof item === "object" ? getFormat(item) : item;
|
|
1492
|
+
let formatter2 = formatterMap.current[key] || defaultFormatters[key];
|
|
1493
|
+
if (formatter2) return formatter2;
|
|
1494
|
+
if (/^[A-Z]{3}$/.test(key)) {
|
|
1495
|
+
const formatter3 = new Intl.NumberFormat(void 0, {
|
|
1496
|
+
style: "currency",
|
|
1497
|
+
currency: key
|
|
1498
|
+
}).format;
|
|
1499
|
+
formatterMap.current[key] = formatter3;
|
|
1500
|
+
return formatter3;
|
|
1501
|
+
}
|
|
1502
|
+
try {
|
|
1503
|
+
formatter2 = format(key);
|
|
1504
|
+
} catch (e) {
|
|
1505
|
+
console.warn(`Formatter not configured: "${key}"`);
|
|
1506
|
+
formatter2 = defaultFormatters.identity;
|
|
1507
|
+
}
|
|
1508
|
+
formatterMap.current[key] = formatter2;
|
|
1509
|
+
return formatter2;
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
function setFormat(measure, format2) {
|
|
1513
|
+
const key = typeof measure === "string" ? measure : measure.name;
|
|
1514
|
+
setFormatMap((formatMap2) => ({ ...formatMap2, [key]: format2 }));
|
|
1515
|
+
}
|
|
1516
|
+
function getFormat(measure, defaultValue = "identity") {
|
|
1517
|
+
if (typeof measure === "string") return formatMap[measure] || defaultValue;
|
|
1518
|
+
const { format_template, units_of_measurement } = measure.annotations;
|
|
1519
|
+
return formatMap[measure.name] || format_template || units_of_measurement || defaultValue;
|
|
1520
|
+
}
|
|
1521
|
+
}, [formatMap]);
|
|
1522
|
+
}
|
|
1523
|
+
function useidFormatters() {
|
|
1524
|
+
const { idFormatters } = useSettings();
|
|
1525
|
+
return { idFormatters };
|
|
1526
|
+
}
|
|
1694
1527
|
|
|
1695
1528
|
// src/utils/transform.js
|
|
1696
|
-
init_esm_shims();
|
|
1697
1529
|
function identity(item) {
|
|
1698
1530
|
return `${item}`;
|
|
1699
1531
|
}
|
|
@@ -1889,8 +1721,203 @@ function useUpdateUrl() {
|
|
|
1889
1721
|
[navigate, queryItem]
|
|
1890
1722
|
);
|
|
1891
1723
|
}
|
|
1892
|
-
|
|
1893
|
-
// src/state/
|
|
1724
|
+
|
|
1725
|
+
// src/state/utils.ts
|
|
1726
|
+
function calcMaxMemberCount(lengths) {
|
|
1727
|
+
return lengths.reduce((prev, curr) => prev * curr);
|
|
1728
|
+
}
|
|
1729
|
+
function pickDefaultDrilldowns(dimensions, cube) {
|
|
1730
|
+
var _a;
|
|
1731
|
+
const levels = [];
|
|
1732
|
+
let suggestedLevels = [];
|
|
1733
|
+
for (const key in cube.annotations) {
|
|
1734
|
+
if (key === "suggested_levels") {
|
|
1735
|
+
suggestedLevels = ((_a = cube.annotations[key]) == null ? void 0 : _a.split(",")) || [];
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
const findDefaultHierarchy = (dim) => dim.hierarchies.find((h) => h.name === dim.default_hierarchy) || dim.hierarchies[0];
|
|
1739
|
+
for (const dimension of dimensions) {
|
|
1740
|
+
if (dimension.type === "time" || levels.length < 4) {
|
|
1741
|
+
const hierarchy = findDefaultHierarchy(dimension);
|
|
1742
|
+
const levelIndex = dimension.type === "geo" ? hierarchy.levels.length - 1 : 0;
|
|
1743
|
+
levels.push({ ...hierarchy.levels[levelIndex], type: dimension.type });
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
for (const suggestedLevelName of suggestedLevels) {
|
|
1747
|
+
const alreadyInLevels = levels.some((l) => l.name === suggestedLevelName);
|
|
1748
|
+
if (!alreadyInLevels) {
|
|
1749
|
+
let foundLevel = void 0;
|
|
1750
|
+
let foundType = void 0;
|
|
1751
|
+
for (const dimension of dimensions) {
|
|
1752
|
+
for (const hierarchy of dimension.hierarchies) {
|
|
1753
|
+
const level = hierarchy.levels.find((l) => l.name === suggestedLevelName);
|
|
1754
|
+
if (level) {
|
|
1755
|
+
foundLevel = level;
|
|
1756
|
+
foundType = dimension.type;
|
|
1757
|
+
break;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
if (foundLevel) break;
|
|
1761
|
+
}
|
|
1762
|
+
if (foundLevel && foundType) {
|
|
1763
|
+
levels.push({ ...foundLevel, type: foundType });
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
let totalCount = calcMaxMemberCount(levels.map((l) => l.count));
|
|
1768
|
+
while (totalCount > 5e6) {
|
|
1769
|
+
const geoIndex = levels.findIndex((level) => level.type === "geo");
|
|
1770
|
+
if (geoIndex !== -1) {
|
|
1771
|
+
levels.splice(geoIndex, 1);
|
|
1772
|
+
} else {
|
|
1773
|
+
levels.pop();
|
|
1774
|
+
}
|
|
1775
|
+
totalCount = calcMaxMemberCount(levels.map((l) => l.count));
|
|
1776
|
+
}
|
|
1777
|
+
return levels;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
// src/hooks/useQueryApi.ts
|
|
1781
|
+
function useServerSchema() {
|
|
1782
|
+
const { tesseract } = useLogicLayer();
|
|
1783
|
+
const { serverURL, defaultLocale } = useSettings();
|
|
1784
|
+
return useQuery({
|
|
1785
|
+
queryKey: ["schema", serverURL, defaultLocale],
|
|
1786
|
+
queryFn: async () => {
|
|
1787
|
+
const search = new URLSearchParams(location.search);
|
|
1788
|
+
const locale = defaultLocale || search.get("locale") || void 0;
|
|
1789
|
+
try {
|
|
1790
|
+
const schema = await tesseract.fetchSchema({ locale });
|
|
1791
|
+
const cubes = schema.cubes.filter((cube) => !cube.annotations.hide_in_ui);
|
|
1792
|
+
const cubeMap = keyBy(cubes, "name");
|
|
1793
|
+
return {
|
|
1794
|
+
cubeMap,
|
|
1795
|
+
locale: defaultLocale || schema.default_locale,
|
|
1796
|
+
localeOptions: schema.locales,
|
|
1797
|
+
online: true,
|
|
1798
|
+
url: serverURL
|
|
1799
|
+
};
|
|
1800
|
+
} catch (error) {
|
|
1801
|
+
return {
|
|
1802
|
+
cubeMap: {},
|
|
1803
|
+
locale: defaultLocale || "",
|
|
1804
|
+
localeOptions: [],
|
|
1805
|
+
online: false,
|
|
1806
|
+
url: serverURL
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
staleTime: 3e5
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
var useMeasureItems = () => {
|
|
1814
|
+
var _a;
|
|
1815
|
+
const { data: schema } = useServerSchema();
|
|
1816
|
+
const { params } = useSelector(selectCurrentQueryItem);
|
|
1817
|
+
const measures = ((_a = schema == null ? void 0 : schema.cubeMap[params.cube]) == null ? void 0 : _a.measures) || [];
|
|
1818
|
+
return measures;
|
|
1819
|
+
};
|
|
1820
|
+
var useSelectedItem = () => {
|
|
1821
|
+
const { data: schema } = useServerSchema();
|
|
1822
|
+
const { params } = useSelector(selectCurrentQueryItem);
|
|
1823
|
+
const selectedItem = schema == null ? void 0 : schema.cubeMap[params.cube];
|
|
1824
|
+
return selectedItem;
|
|
1825
|
+
};
|
|
1826
|
+
var useCubeItems = () => {
|
|
1827
|
+
const { data: schema } = useServerSchema();
|
|
1828
|
+
const cubeItems = schema == null ? void 0 : schema.cubeMap;
|
|
1829
|
+
return getValues(cubeItems || {});
|
|
1830
|
+
};
|
|
1831
|
+
var useDimensionItems = () => {
|
|
1832
|
+
var _a;
|
|
1833
|
+
const { data: schema } = useServerSchema();
|
|
1834
|
+
const { params } = useSelector(selectCurrentQueryItem);
|
|
1835
|
+
const dimensions = ((_a = schema == null ? void 0 : schema.cubeMap[params.cube]) == null ? void 0 : _a.dimensions) || [];
|
|
1836
|
+
return dimensions.map((dim) => ({
|
|
1837
|
+
item: {
|
|
1838
|
+
...dim,
|
|
1839
|
+
hierarchies: dim.hierarchies.slice().map((hierarchy) => {
|
|
1840
|
+
hierarchy.levels.slice().sort((a, b) => getOrderValue(a) - getOrderValue(b));
|
|
1841
|
+
return hierarchy;
|
|
1842
|
+
}).sort((a, b) => getOrderValue(a) - getOrderValue(b))
|
|
1843
|
+
},
|
|
1844
|
+
count: dim.hierarchies.reduce((acc, hie) => acc + hie.levels.length, 0),
|
|
1845
|
+
alpha: dim.hierarchies.reduce((acc, hie) => acc.concat(hie.name, "-"), "")
|
|
1846
|
+
})).sort(
|
|
1847
|
+
(a, b) => getOrderValue(a.item) - getOrderValue(b.item) || b.count - a.count || a.alpha.localeCompare(b.alpha)
|
|
1848
|
+
).map((i) => i.item);
|
|
1849
|
+
};
|
|
1850
|
+
function useDownloadQuery() {
|
|
1851
|
+
const { tesseract } = useLogicLayer();
|
|
1852
|
+
const { params } = useSelector(selectCurrentQueryItem);
|
|
1853
|
+
return useMutation({
|
|
1854
|
+
mutationFn: async ({ format: format2 }) => {
|
|
1855
|
+
if (!isValidQuery(params)) {
|
|
1856
|
+
throw new Error("The current query is not valid.");
|
|
1857
|
+
}
|
|
1858
|
+
const queryParams = { ...params, pagiLimit: 0, pagiOffset: 0 };
|
|
1859
|
+
const request = queryParamsToRequest(queryParams);
|
|
1860
|
+
const response = await tesseract.fetchData({
|
|
1861
|
+
request,
|
|
1862
|
+
format: format2
|
|
1863
|
+
});
|
|
1864
|
+
const blob = await response.blob();
|
|
1865
|
+
return {
|
|
1866
|
+
content: blob,
|
|
1867
|
+
extension: format2.replace(/json\w+/, "json"),
|
|
1868
|
+
name: `${params.cube}_${(/* @__PURE__ */ new Date()).toISOString()}`
|
|
1869
|
+
};
|
|
1870
|
+
},
|
|
1871
|
+
throwOnError: false
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
function useFetchQuery(queryParams, queryLink, options) {
|
|
1875
|
+
const { tesseract } = useLogicLayer();
|
|
1876
|
+
const { limit = 0, offset = 0, withoutPagination = false } = options || {};
|
|
1877
|
+
const key = withoutPagination ? ["table", queryLink, "withoutPagination"] : ["table", queryLink];
|
|
1878
|
+
const { data: schema } = useServerSchema();
|
|
1879
|
+
return useQuery({
|
|
1880
|
+
queryKey: key,
|
|
1881
|
+
queryFn: async () => {
|
|
1882
|
+
if (!isValidQuery(queryParams)) {
|
|
1883
|
+
throw new Error("Invalid query");
|
|
1884
|
+
}
|
|
1885
|
+
if (queryParams) {
|
|
1886
|
+
const request = queryParamsToRequest(queryParams);
|
|
1887
|
+
if (limit || offset) {
|
|
1888
|
+
request.limit = `${limit},${offset}`;
|
|
1889
|
+
}
|
|
1890
|
+
if (withoutPagination) {
|
|
1891
|
+
request.limit = "0,0";
|
|
1892
|
+
}
|
|
1893
|
+
const response = await tesseract.fetchData({
|
|
1894
|
+
request,
|
|
1895
|
+
format: "jsonrecords"
|
|
1896
|
+
});
|
|
1897
|
+
const content = await response.json();
|
|
1898
|
+
if (!response.ok) {
|
|
1899
|
+
throw new Error(`Backend Error: ${content.detail}`);
|
|
1900
|
+
}
|
|
1901
|
+
if (!(schema == null ? void 0 : schema.cubeMap[queryParams.cube])) {
|
|
1902
|
+
throw new Error("Cube not found");
|
|
1903
|
+
}
|
|
1904
|
+
const cubeData = schema == null ? void 0 : schema.cubeMap[queryParams.cube];
|
|
1905
|
+
return {
|
|
1906
|
+
data: content.data,
|
|
1907
|
+
page: content.page,
|
|
1908
|
+
types: describeData(cubeData, queryParams, content),
|
|
1909
|
+
headers: Object.fromEntries(response.headers),
|
|
1910
|
+
status: response.status || 200,
|
|
1911
|
+
url: response.url
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
},
|
|
1915
|
+
staleTime: 3e5,
|
|
1916
|
+
enabled: Boolean(queryLink),
|
|
1917
|
+
retry: false,
|
|
1918
|
+
placeholderData: withoutPagination ? void 0 : keepPreviousData
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1894
1921
|
var selectOlapCube = createSelector(
|
|
1895
1922
|
[selectOlapCubeMap, selectCubeName],
|
|
1896
1923
|
(cubeMap, cubeName) => cubeName in cubeMap ? cubeMap[cubeName] : void 0
|
|
@@ -1937,7 +1964,6 @@ var selectSerializedParams = createSelector(
|
|
|
1937
1964
|
);
|
|
1938
1965
|
|
|
1939
1966
|
// src/utils/format.js
|
|
1940
|
-
init_esm_shims();
|
|
1941
1967
|
function abbreviateFullName(nameParts, joint = "/") {
|
|
1942
1968
|
if (!nameParts) {
|
|
1943
1969
|
return "";
|
|
@@ -1955,80 +1981,6 @@ function abbreviateFullName(nameParts, joint = "/") {
|
|
|
1955
1981
|
}
|
|
1956
1982
|
return target.join(joint);
|
|
1957
1983
|
}
|
|
1958
|
-
|
|
1959
|
-
// src/components/TableView.tsx
|
|
1960
|
-
init_esm_shims();
|
|
1961
|
-
|
|
1962
|
-
// src/hooks/formatter.ts
|
|
1963
|
-
init_esm_shims();
|
|
1964
|
-
var defaultFormatters = {
|
|
1965
|
-
undefined: (n) => n,
|
|
1966
|
-
identity: (n) => `${n}`,
|
|
1967
|
-
Decimal: new Intl.NumberFormat(void 0, { useGrouping: false }).format,
|
|
1968
|
-
Dollars: new Intl.NumberFormat(void 0, { style: "currency", currency: "USD" }).format,
|
|
1969
|
-
Human: (n) => formatAbbreviate(n, "en-US"),
|
|
1970
|
-
Milliards: new Intl.NumberFormat(void 0, { useGrouping: true }).format,
|
|
1971
|
-
Million: new Intl.NumberFormat(void 0, { useGrouping: true }).format
|
|
1972
|
-
};
|
|
1973
|
-
var basicFormatterKeys = ["Decimal", "Milliards", "Human"];
|
|
1974
|
-
function useFormatter() {
|
|
1975
|
-
const { formatters } = useSettings();
|
|
1976
|
-
const [formatMap, setFormatMap] = useState({});
|
|
1977
|
-
const formatterMap = useRef(formatters);
|
|
1978
|
-
return useMemo(() => {
|
|
1979
|
-
return {
|
|
1980
|
-
currentFormats: formatMap,
|
|
1981
|
-
getAvailableFormats(measure) {
|
|
1982
|
-
const formatterKeys = basicFormatterKeys.slice();
|
|
1983
|
-
if (typeof measure !== "string") {
|
|
1984
|
-
const { format_template, units_of_measurement } = measure.annotations;
|
|
1985
|
-
units_of_measurement && formatterKeys.unshift(units_of_measurement);
|
|
1986
|
-
format_template && formatterKeys.unshift(format_template);
|
|
1987
|
-
}
|
|
1988
|
-
return formatterKeys;
|
|
1989
|
-
},
|
|
1990
|
-
setFormat,
|
|
1991
|
-
getFormat,
|
|
1992
|
-
getFormatter(item) {
|
|
1993
|
-
const key = typeof item === "object" ? getFormat(item) : item;
|
|
1994
|
-
let formatter2 = formatterMap.current[key] || defaultFormatters[key];
|
|
1995
|
-
if (formatter2) return formatter2;
|
|
1996
|
-
if (/^[A-Z]{3}$/.test(key)) {
|
|
1997
|
-
const formatter3 = new Intl.NumberFormat(void 0, {
|
|
1998
|
-
style: "currency",
|
|
1999
|
-
currency: key
|
|
2000
|
-
}).format;
|
|
2001
|
-
formatterMap.current[key] = formatter3;
|
|
2002
|
-
return formatter3;
|
|
2003
|
-
}
|
|
2004
|
-
try {
|
|
2005
|
-
formatter2 = format(key);
|
|
2006
|
-
} catch (e) {
|
|
2007
|
-
console.warn(`Formatter not configured: "${key}"`);
|
|
2008
|
-
formatter2 = defaultFormatters.identity;
|
|
2009
|
-
}
|
|
2010
|
-
formatterMap.current[key] = formatter2;
|
|
2011
|
-
return formatter2;
|
|
2012
|
-
}
|
|
2013
|
-
};
|
|
2014
|
-
function setFormat(measure, format2) {
|
|
2015
|
-
const key = typeof measure === "string" ? measure : measure.name;
|
|
2016
|
-
setFormatMap((formatMap2) => ({ ...formatMap2, [key]: format2 }));
|
|
2017
|
-
}
|
|
2018
|
-
function getFormat(measure, defaultValue = "identity") {
|
|
2019
|
-
if (typeof measure === "string") return formatMap[measure] || defaultValue;
|
|
2020
|
-
const { format_template, units_of_measurement } = measure.annotations;
|
|
2021
|
-
return formatMap[measure.name] || format_template || units_of_measurement || defaultValue;
|
|
2022
|
-
}
|
|
2023
|
-
}, [formatMap]);
|
|
2024
|
-
}
|
|
2025
|
-
function useidFormatters() {
|
|
2026
|
-
const { idFormatters } = useSettings();
|
|
2027
|
-
return { idFormatters };
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
// src/components/CustomActionIcon.tsx
|
|
2031
|
-
init_esm_shims();
|
|
2032
1984
|
var CustomActionIcon = ({
|
|
2033
1985
|
disabled,
|
|
2034
1986
|
showTooltip,
|
|
@@ -2063,12 +2015,6 @@ var CustomActionIcon = ({
|
|
|
2063
2015
|
)) : actionIcon;
|
|
2064
2016
|
};
|
|
2065
2017
|
var CustomActionIcon_default = CustomActionIcon;
|
|
2066
|
-
|
|
2067
|
-
// src/components/TableFooter.tsx
|
|
2068
|
-
init_esm_shims();
|
|
2069
|
-
|
|
2070
|
-
// src/hooks/useAsync.tsx
|
|
2071
|
-
init_esm_shims();
|
|
2072
2018
|
function useSafeDispatch(dispatch) {
|
|
2073
2019
|
const mounted = React13.useRef(false);
|
|
2074
2020
|
React13.useLayoutEffect(() => {
|
|
@@ -2154,184 +2100,6 @@ function useAsync(initialState4) {
|
|
|
2154
2100
|
reset
|
|
2155
2101
|
};
|
|
2156
2102
|
}
|
|
2157
|
-
|
|
2158
|
-
// src/components/CubeSource.tsx
|
|
2159
|
-
init_esm_shims();
|
|
2160
|
-
|
|
2161
|
-
// src/hooks/useQueryApi.ts
|
|
2162
|
-
init_esm_shims();
|
|
2163
|
-
|
|
2164
|
-
// src/state/utils.ts
|
|
2165
|
-
init_esm_shims();
|
|
2166
|
-
function calcMaxMemberCount(lengths) {
|
|
2167
|
-
return lengths.reduce((prev, curr) => prev * curr);
|
|
2168
|
-
}
|
|
2169
|
-
function pickDefaultDrilldowns(dimensions) {
|
|
2170
|
-
const levels = [];
|
|
2171
|
-
const findDefaultHierarchy = (dim) => dim.hierarchies.find((h) => h.name === dim.default_hierarchy) || dim.hierarchies[0];
|
|
2172
|
-
for (const dimension of dimensions) {
|
|
2173
|
-
if (dimension.type === "time" || levels.length < 4) {
|
|
2174
|
-
const hierarchy = findDefaultHierarchy(dimension);
|
|
2175
|
-
const levelIndex = dimension.type === "geo" ? hierarchy.levels.length - 1 : 0;
|
|
2176
|
-
levels.push({ ...hierarchy.levels[levelIndex], type: dimension.type });
|
|
2177
|
-
}
|
|
2178
|
-
}
|
|
2179
|
-
let totalCount = calcMaxMemberCount(levels.map((l) => l.count));
|
|
2180
|
-
while (totalCount > 5e6) {
|
|
2181
|
-
const geoIndex = levels.findIndex((level) => level.type === "geo");
|
|
2182
|
-
if (geoIndex !== -1) {
|
|
2183
|
-
levels.splice(geoIndex, 1);
|
|
2184
|
-
} else {
|
|
2185
|
-
levels.pop();
|
|
2186
|
-
}
|
|
2187
|
-
totalCount = calcMaxMemberCount(levels.map((l) => l.count));
|
|
2188
|
-
}
|
|
2189
|
-
return levels;
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
// src/hooks/useQueryApi.ts
|
|
2193
|
-
function useServerSchema() {
|
|
2194
|
-
const { tesseract } = useLogicLayer();
|
|
2195
|
-
const { serverURL, defaultLocale } = useSettings();
|
|
2196
|
-
return useQuery({
|
|
2197
|
-
queryKey: ["schema", serverURL, defaultLocale],
|
|
2198
|
-
queryFn: async () => {
|
|
2199
|
-
const search = new URLSearchParams(location.search);
|
|
2200
|
-
const locale = defaultLocale || search.get("locale") || void 0;
|
|
2201
|
-
try {
|
|
2202
|
-
const schema = await tesseract.fetchSchema({ locale });
|
|
2203
|
-
const cubes = schema.cubes.filter((cube) => !cube.annotations.hide_in_ui);
|
|
2204
|
-
const cubeMap = keyBy(cubes, "name");
|
|
2205
|
-
return {
|
|
2206
|
-
cubeMap,
|
|
2207
|
-
locale: defaultLocale || schema.default_locale,
|
|
2208
|
-
localeOptions: schema.locales,
|
|
2209
|
-
online: true,
|
|
2210
|
-
url: serverURL
|
|
2211
|
-
};
|
|
2212
|
-
} catch (error) {
|
|
2213
|
-
return {
|
|
2214
|
-
cubeMap: {},
|
|
2215
|
-
locale: defaultLocale || "",
|
|
2216
|
-
localeOptions: [],
|
|
2217
|
-
online: false,
|
|
2218
|
-
url: serverURL
|
|
2219
|
-
};
|
|
2220
|
-
}
|
|
2221
|
-
},
|
|
2222
|
-
staleTime: 3e5
|
|
2223
|
-
});
|
|
2224
|
-
}
|
|
2225
|
-
var useMeasureItems = () => {
|
|
2226
|
-
var _a;
|
|
2227
|
-
const { data: schema } = useServerSchema();
|
|
2228
|
-
const { params } = useSelector(selectCurrentQueryItem);
|
|
2229
|
-
const measures = ((_a = schema == null ? void 0 : schema.cubeMap[params.cube]) == null ? void 0 : _a.measures) || [];
|
|
2230
|
-
return measures;
|
|
2231
|
-
};
|
|
2232
|
-
var useSelectedItem = () => {
|
|
2233
|
-
const { data: schema } = useServerSchema();
|
|
2234
|
-
const { params } = useSelector(selectCurrentQueryItem);
|
|
2235
|
-
const selectedItem = schema == null ? void 0 : schema.cubeMap[params.cube];
|
|
2236
|
-
return selectedItem;
|
|
2237
|
-
};
|
|
2238
|
-
var useCubeItems = () => {
|
|
2239
|
-
const { data: schema } = useServerSchema();
|
|
2240
|
-
const cubeItems = schema == null ? void 0 : schema.cubeMap;
|
|
2241
|
-
return getValues(cubeItems || {});
|
|
2242
|
-
};
|
|
2243
|
-
var useDimensionItems = () => {
|
|
2244
|
-
var _a;
|
|
2245
|
-
const { data: schema } = useServerSchema();
|
|
2246
|
-
const { params } = useSelector(selectCurrentQueryItem);
|
|
2247
|
-
const dimensions = ((_a = schema == null ? void 0 : schema.cubeMap[params.cube]) == null ? void 0 : _a.dimensions) || [];
|
|
2248
|
-
return dimensions.map((dim) => ({
|
|
2249
|
-
item: {
|
|
2250
|
-
...dim,
|
|
2251
|
-
hierarchies: dim.hierarchies.slice().map((hierarchy) => {
|
|
2252
|
-
hierarchy.levels.slice().sort((a, b) => getOrderValue(a) - getOrderValue(b));
|
|
2253
|
-
return hierarchy;
|
|
2254
|
-
}).sort((a, b) => getOrderValue(a) - getOrderValue(b))
|
|
2255
|
-
},
|
|
2256
|
-
count: dim.hierarchies.reduce((acc, hie) => acc + hie.levels.length, 0),
|
|
2257
|
-
alpha: dim.hierarchies.reduce((acc, hie) => acc.concat(hie.name, "-"), "")
|
|
2258
|
-
})).sort(
|
|
2259
|
-
(a, b) => getOrderValue(a.item) - getOrderValue(b.item) || b.count - a.count || a.alpha.localeCompare(b.alpha)
|
|
2260
|
-
).map((i) => i.item);
|
|
2261
|
-
};
|
|
2262
|
-
function useDownloadQuery() {
|
|
2263
|
-
const { tesseract } = useLogicLayer();
|
|
2264
|
-
const { params } = useSelector(selectCurrentQueryItem);
|
|
2265
|
-
return useMutation({
|
|
2266
|
-
mutationFn: async ({ format: format2 }) => {
|
|
2267
|
-
if (!isValidQuery(params)) {
|
|
2268
|
-
throw new Error("The current query is not valid.");
|
|
2269
|
-
}
|
|
2270
|
-
const queryParams = { ...params, pagiLimit: 0, pagiOffset: 0 };
|
|
2271
|
-
const request = queryParamsToRequest(queryParams);
|
|
2272
|
-
const response = await tesseract.fetchData({
|
|
2273
|
-
request,
|
|
2274
|
-
format: format2
|
|
2275
|
-
});
|
|
2276
|
-
const blob = await response.blob();
|
|
2277
|
-
return {
|
|
2278
|
-
content: blob,
|
|
2279
|
-
extension: format2.replace(/json\w+/, "json"),
|
|
2280
|
-
name: `${params.cube}_${(/* @__PURE__ */ new Date()).toISOString()}`
|
|
2281
|
-
};
|
|
2282
|
-
},
|
|
2283
|
-
throwOnError: false
|
|
2284
|
-
});
|
|
2285
|
-
}
|
|
2286
|
-
function useFetchQuery(queryParams, queryLink, options) {
|
|
2287
|
-
const { tesseract } = useLogicLayer();
|
|
2288
|
-
const { limit = 0, offset = 0, withoutPagination = false } = options || {};
|
|
2289
|
-
const key = withoutPagination ? ["table", queryLink, "withoutPagination"] : ["table", queryLink];
|
|
2290
|
-
const { data: schema } = useServerSchema();
|
|
2291
|
-
return useQuery({
|
|
2292
|
-
queryKey: key,
|
|
2293
|
-
queryFn: async () => {
|
|
2294
|
-
if (!isValidQuery(queryParams)) {
|
|
2295
|
-
throw new Error("Invalid query");
|
|
2296
|
-
}
|
|
2297
|
-
if (queryParams) {
|
|
2298
|
-
const request = queryParamsToRequest(queryParams);
|
|
2299
|
-
if (limit || offset) {
|
|
2300
|
-
request.limit = `${limit},${offset}`;
|
|
2301
|
-
}
|
|
2302
|
-
if (withoutPagination) {
|
|
2303
|
-
request.limit = "0,0";
|
|
2304
|
-
}
|
|
2305
|
-
const response = await tesseract.fetchData({
|
|
2306
|
-
request,
|
|
2307
|
-
format: "jsonrecords"
|
|
2308
|
-
});
|
|
2309
|
-
const content = await response.json();
|
|
2310
|
-
if (!response.ok) {
|
|
2311
|
-
throw new Error(`Backend Error: ${content.detail}`);
|
|
2312
|
-
}
|
|
2313
|
-
if (!(schema == null ? void 0 : schema.cubeMap[queryParams.cube])) {
|
|
2314
|
-
throw new Error("Cube not found");
|
|
2315
|
-
}
|
|
2316
|
-
const cubeData = schema == null ? void 0 : schema.cubeMap[queryParams.cube];
|
|
2317
|
-
return {
|
|
2318
|
-
data: content.data,
|
|
2319
|
-
page: content.page,
|
|
2320
|
-
types: describeData(cubeData, queryParams, content),
|
|
2321
|
-
headers: Object.fromEntries(response.headers),
|
|
2322
|
-
status: response.status || 200,
|
|
2323
|
-
url: response.url
|
|
2324
|
-
};
|
|
2325
|
-
}
|
|
2326
|
-
},
|
|
2327
|
-
staleTime: 3e5,
|
|
2328
|
-
enabled: Boolean(queryLink),
|
|
2329
|
-
retry: false,
|
|
2330
|
-
placeholderData: withoutPagination ? void 0 : keepPreviousData
|
|
2331
|
-
});
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
|
-
// src/components/CubeSource.tsx
|
|
2335
2103
|
function CubeAnnotation(props) {
|
|
2336
2104
|
const { annotation, item, locale, ...textProps } = props;
|
|
2337
2105
|
const content = getAnnotation(item, annotation, locale);
|
|
@@ -2367,12 +2135,6 @@ function CubeSource() {
|
|
|
2367
2135
|
}
|
|
2368
2136
|
));
|
|
2369
2137
|
}
|
|
2370
|
-
|
|
2371
|
-
// src/components/LocaleSelector.tsx
|
|
2372
|
-
init_esm_shims();
|
|
2373
|
-
|
|
2374
|
-
// src/components/Select.tsx
|
|
2375
|
-
init_esm_shims();
|
|
2376
2138
|
var SelectObject = forwardRef(function(props, ref) {
|
|
2377
2139
|
var _a;
|
|
2378
2140
|
const {
|
|
@@ -2756,9 +2518,6 @@ function MenuOpts({ formats }) {
|
|
|
2756
2518
|
);
|
|
2757
2519
|
}
|
|
2758
2520
|
var TableFooter_default = TableFooter;
|
|
2759
|
-
|
|
2760
|
-
// src/components/icons/index.tsx
|
|
2761
|
-
init_esm_shims();
|
|
2762
2521
|
function DataSetSVG() {
|
|
2763
2522
|
return /* @__PURE__ */ React13__default.createElement(
|
|
2764
2523
|
"svg",
|
|
@@ -2858,6 +2617,8 @@ function FullScreenSVG() {
|
|
|
2858
2617
|
}
|
|
2859
2618
|
)), /* @__PURE__ */ React13__default.createElement("defs", null, /* @__PURE__ */ React13__default.createElement("clipPath", { id: "clip0_905_15763" }, /* @__PURE__ */ React13__default.createElement("rect", { width: "20", height: "20", fill: "white" }))));
|
|
2860
2619
|
}
|
|
2620
|
+
|
|
2621
|
+
// src/components/TableView.tsx
|
|
2861
2622
|
function isColumnSorted(column, key) {
|
|
2862
2623
|
return column == key;
|
|
2863
2624
|
}
|
|
@@ -2871,7 +2632,7 @@ var propertiesUpdateHandler = (actions2, item, activeProps) => {
|
|
|
2871
2632
|
actions2.updateDrilldown({ ...item, properties });
|
|
2872
2633
|
};
|
|
2873
2634
|
var removeColumn = (actions2, entity, measures, drilldowns, type, queryItem, updateURL) => {
|
|
2874
|
-
const newQuery = buildQuery(
|
|
2635
|
+
const newQuery = buildQuery(cloneDeep(queryItem));
|
|
2875
2636
|
if ("aggregator" in entity) {
|
|
2876
2637
|
const measure = measures.find((d) => d.name === entity.name);
|
|
2877
2638
|
if (measure) {
|
|
@@ -3143,7 +2904,7 @@ function useTable({
|
|
|
3143
2904
|
onClick: () => {
|
|
3144
2905
|
if (!isSorted) {
|
|
3145
2906
|
actions2.updateSorting({ key: entity.name, dir: "desc" });
|
|
3146
|
-
const newQuery = buildQuery(
|
|
2907
|
+
const newQuery = buildQuery(cloneDeep(queryItem));
|
|
3147
2908
|
updateURL({
|
|
3148
2909
|
...newQuery,
|
|
3149
2910
|
params: {
|
|
@@ -3155,7 +2916,7 @@ function useTable({
|
|
|
3155
2916
|
}
|
|
3156
2917
|
if (isSorted && sortDir === "desc") {
|
|
3157
2918
|
actions2.updateSorting({ key: entity.name, dir: "asc" });
|
|
3158
|
-
const newQuery = buildQuery(
|
|
2919
|
+
const newQuery = buildQuery(cloneDeep(queryItem));
|
|
3159
2920
|
updateURL({
|
|
3160
2921
|
...newQuery,
|
|
3161
2922
|
params: {
|
|
@@ -3167,7 +2928,7 @@ function useTable({
|
|
|
3167
2928
|
}
|
|
3168
2929
|
if (isSorted && sortDir === "asc") {
|
|
3169
2930
|
actions2.clearSorting();
|
|
3170
|
-
const newQuery = buildQuery(
|
|
2931
|
+
const newQuery = buildQuery(cloneDeep(queryItem));
|
|
3171
2932
|
updateURL({
|
|
3172
2933
|
...newQuery,
|
|
3173
2934
|
params: {
|
|
@@ -3535,7 +3296,7 @@ var MultiFilter = ({ header }) => {
|
|
|
3535
3296
|
onChange: (value) => {
|
|
3536
3297
|
const newCut = { ...cut, active: true };
|
|
3537
3298
|
updatecutHandler(newCut, value);
|
|
3538
|
-
const newQuery = buildQuery(
|
|
3299
|
+
const newQuery = buildQuery(cloneDeep(query));
|
|
3539
3300
|
newQuery.params.cuts[cut.key] = { ...newCut, members: value };
|
|
3540
3301
|
debouncedUpdateUrl(newQuery);
|
|
3541
3302
|
},
|
|
@@ -3561,6 +3322,8 @@ var NoRecords = React13__default.memo(() => {
|
|
|
3561
3322
|
return /* @__PURE__ */ React13__default.createElement(Center, { style: { height: "calc(100% - 210px)" } }, /* @__PURE__ */ React13__default.createElement(Text, { size: "xl", color: "gray", italic: true }, "No records to display."));
|
|
3562
3323
|
});
|
|
3563
3324
|
TableView.displayName = "TesseractExplorer:TableView";
|
|
3325
|
+
|
|
3326
|
+
// src/components/DrawerMenu.tsx
|
|
3564
3327
|
var styles = (t) => ({
|
|
3565
3328
|
header: {
|
|
3566
3329
|
background: "transparent"
|
|
@@ -3885,7 +3648,7 @@ function NumberInputComponent({ text, filter }) {
|
|
|
3885
3648
|
const updateUrl = useUpdateUrl();
|
|
3886
3649
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
3887
3650
|
const debouncedUpdateUrl = useMemo(
|
|
3888
|
-
() => debounce
|
|
3651
|
+
() => debounce((query) => {
|
|
3889
3652
|
updateUrl(query);
|
|
3890
3653
|
}, 1e3),
|
|
3891
3654
|
[]
|
|
@@ -3904,7 +3667,7 @@ function NumberInputComponent({ text, filter }) {
|
|
|
3904
3667
|
const active = !isEmpty;
|
|
3905
3668
|
const newFilter = buildFilter({ ...filter2, active, ...conditions });
|
|
3906
3669
|
actions2.updateFilter(newFilter);
|
|
3907
|
-
const newQuery = buildQuery(
|
|
3670
|
+
const newQuery = buildQuery(cloneDeep(queryItem));
|
|
3908
3671
|
newQuery.params.filters[filter2.key] = newFilter;
|
|
3909
3672
|
debouncedUpdateUrl(newQuery);
|
|
3910
3673
|
}
|
|
@@ -4077,9 +3840,6 @@ var getIconForDimensionType = (dimensionType) => {
|
|
|
4077
3840
|
}
|
|
4078
3841
|
};
|
|
4079
3842
|
var DrawerMenu_default = AddColumnsDrawer;
|
|
4080
|
-
|
|
4081
|
-
// src/components/ExplorerTabs.tsx
|
|
4082
|
-
init_esm_shims();
|
|
4083
3843
|
var tabsStyles = (t) => ({
|
|
4084
3844
|
root: {
|
|
4085
3845
|
alignSelf: "flex-end"
|
|
@@ -4114,9 +3874,6 @@ function ExplorerTabs({
|
|
|
4114
3874
|
/* @__PURE__ */ React13__default.createElement(Tabs.List, null, panels.map((panel) => /* @__PURE__ */ React13__default.createElement(Tabs.Tab, { key: panel.key, id: panel.key, value: panel.key, h: 56 }, t(panel.label))))
|
|
4115
3875
|
);
|
|
4116
3876
|
}
|
|
4117
|
-
|
|
4118
|
-
// src/components/PreviewModeSwitch.jsx
|
|
4119
|
-
init_esm_shims();
|
|
4120
3877
|
var PreviewModeSwitch = (props) => {
|
|
4121
3878
|
const withTooltip = !!props.withTooltip;
|
|
4122
3879
|
const actions2 = useActions();
|
|
@@ -4156,9 +3913,6 @@ var PreviewModeSwitch = (props) => {
|
|
|
4156
3913
|
/* @__PURE__ */ React13__default.createElement("div", null, target)
|
|
4157
3914
|
);
|
|
4158
3915
|
};
|
|
4159
|
-
|
|
4160
|
-
// src/components/Toolbar.tsx
|
|
4161
|
-
init_esm_shims();
|
|
4162
3916
|
var toolbarSx = (t) => ({
|
|
4163
3917
|
background: t.colorScheme === "dark" ? t.black : t.white,
|
|
4164
3918
|
borderRadius: t.radius.xl,
|
|
@@ -4224,9 +3978,6 @@ function Toolbar({
|
|
|
4224
3978
|
);
|
|
4225
3979
|
return smallerThanLg ? /* @__PURE__ */ React13__default.createElement(Menu, null, /* @__PURE__ */ React13__default.createElement(Menu.Target, null, /* @__PURE__ */ React13__default.createElement(ActionIcon, null, /* @__PURE__ */ React13__default.createElement(IconSettings, null))), /* @__PURE__ */ React13__default.createElement(Menu.Dropdown, null, settings)) : settings;
|
|
4226
3980
|
}
|
|
4227
|
-
|
|
4228
|
-
// src/context/query.tsx
|
|
4229
|
-
init_esm_shims();
|
|
4230
3981
|
var QueryContext = createContext(void 0);
|
|
4231
3982
|
function QueryProvider({ children, defaultCube }) {
|
|
4232
3983
|
const { tesseract } = useLogicLayer();
|
|
@@ -4353,7 +4104,7 @@ function QueryProvider({ children, defaultCube }) {
|
|
|
4353
4104
|
}
|
|
4354
4105
|
};
|
|
4355
4106
|
function setDefaultValues(cube) {
|
|
4356
|
-
const drilldowns = pickDefaultDrilldowns(cube.dimensions).map(
|
|
4107
|
+
const drilldowns = pickDefaultDrilldowns(cube.dimensions, cube).map(
|
|
4357
4108
|
(level) => buildDrilldown({
|
|
4358
4109
|
...level,
|
|
4359
4110
|
key: level.name,
|
|
@@ -4585,12 +4336,6 @@ function SuccessResult(props) {
|
|
|
4585
4336
|
)
|
|
4586
4337
|
);
|
|
4587
4338
|
}
|
|
4588
|
-
|
|
4589
|
-
// src/components/SideBar.tsx
|
|
4590
|
-
init_esm_shims();
|
|
4591
|
-
|
|
4592
|
-
// src/utils/create-context.ts
|
|
4593
|
-
init_esm_shims();
|
|
4594
4339
|
var createContext4 = (name4) => {
|
|
4595
4340
|
const Context = React13__default.createContext(void 0);
|
|
4596
4341
|
const useContext4 = () => {
|
|
@@ -4602,12 +4347,6 @@ var createContext4 = (name4) => {
|
|
|
4602
4347
|
};
|
|
4603
4348
|
return [useContext4, Context.Provider];
|
|
4604
4349
|
};
|
|
4605
|
-
|
|
4606
|
-
// src/hooks/buildGraph.tsx
|
|
4607
|
-
init_esm_shims();
|
|
4608
|
-
|
|
4609
|
-
// src/utils/graph.js
|
|
4610
|
-
init_esm_shims();
|
|
4611
4350
|
var Graph = class {
|
|
4612
4351
|
constructor() {
|
|
4613
4352
|
this.nodes = /* @__PURE__ */ new Set([]);
|
|
@@ -4782,9 +4521,6 @@ function useBuildGraph(locale) {
|
|
|
4782
4521
|
}, [items, locale]);
|
|
4783
4522
|
return graph;
|
|
4784
4523
|
}
|
|
4785
|
-
|
|
4786
|
-
// src/hooks/cubeSearch.tsx
|
|
4787
|
-
init_esm_shims();
|
|
4788
4524
|
function useCubeSearch(graph, input, locale) {
|
|
4789
4525
|
const results = useMemo(() => {
|
|
4790
4526
|
if (graph.items.length > 0) {
|
|
@@ -5003,12 +4739,6 @@ function CubeSearchInput(props) {
|
|
|
5003
4739
|
}
|
|
5004
4740
|
);
|
|
5005
4741
|
}
|
|
5006
|
-
|
|
5007
|
-
// src/components/SelectCubes.tsx
|
|
5008
|
-
init_esm_shims();
|
|
5009
|
-
|
|
5010
|
-
// src/components/Results.tsx
|
|
5011
|
-
init_esm_shims();
|
|
5012
4742
|
function Results(props) {
|
|
5013
4743
|
const { graph, selectedItem, locale, getCube: getCube2, isSelected: isSelected2 } = props;
|
|
5014
4744
|
const { classes } = useStyles3();
|
|
@@ -5340,12 +5070,6 @@ function ExplorerContent(props) {
|
|
|
5340
5070
|
}
|
|
5341
5071
|
)));
|
|
5342
5072
|
}
|
|
5343
|
-
|
|
5344
|
-
// src/components/PivotView.tsx
|
|
5345
|
-
init_esm_shims();
|
|
5346
|
-
|
|
5347
|
-
// src/vizbuilder/hooks/usePivotTableData.ts
|
|
5348
|
-
init_esm_shims();
|
|
5349
5073
|
function usePivotTableData() {
|
|
5350
5074
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
5351
5075
|
const queryLink = queryItem.link;
|
|
@@ -5355,17 +5079,7 @@ function usePivotTableData() {
|
|
|
5355
5079
|
return query;
|
|
5356
5080
|
}
|
|
5357
5081
|
|
|
5358
|
-
// src/components/PivotViewTable.tsx
|
|
5359
|
-
init_esm_shims();
|
|
5360
|
-
|
|
5361
|
-
// src/hooks/pivot.ts
|
|
5362
|
-
init_esm_shims();
|
|
5363
|
-
|
|
5364
|
-
// src/utils/pivot.worker.js
|
|
5365
|
-
init_esm_shims();
|
|
5366
|
-
|
|
5367
5082
|
// src/utils/workerify.ts
|
|
5368
|
-
init_esm_shims();
|
|
5369
5083
|
var SCRIPT_TYPE = "application/javascript";
|
|
5370
5084
|
var Worker = typeof window === "object" ? window.Worker : null;
|
|
5371
5085
|
if (Worker) {
|
|
@@ -5473,11 +5187,11 @@ function shimWorker(fn) {
|
|
|
5473
5187
|
}
|
|
5474
5188
|
|
|
5475
5189
|
// src/utils/pivot.worker.js
|
|
5476
|
-
var pivot_worker_default = shimWorker((
|
|
5477
|
-
|
|
5190
|
+
var pivot_worker_default = shimWorker((self) => {
|
|
5191
|
+
self.onmessage = function(e) {
|
|
5478
5192
|
const { data, sides } = e.data;
|
|
5479
5193
|
const result = serializeTidyToArrays(data, sides);
|
|
5480
|
-
|
|
5194
|
+
self.postMessage(result);
|
|
5481
5195
|
};
|
|
5482
5196
|
const serializeTidyToArrays = new Function("data", "sides", `
|
|
5483
5197
|
const {valProp} = sides;
|
|
@@ -5616,9 +5330,6 @@ function serializeToArray(data, sides) {
|
|
|
5616
5330
|
}
|
|
5617
5331
|
});
|
|
5618
5332
|
}
|
|
5619
|
-
|
|
5620
|
-
// src/components/ButtonDownload.jsx
|
|
5621
|
-
init_esm_shims();
|
|
5622
5333
|
var mimeTypes2 = {
|
|
5623
5334
|
csv: "text/csv",
|
|
5624
5335
|
json: "application/json",
|
|
@@ -5661,9 +5372,6 @@ var ButtonDownload2 = (props) => {
|
|
|
5661
5372
|
/* @__PURE__ */ React13__default.createElement(Text, { fz: "xs" }, props.children)
|
|
5662
5373
|
);
|
|
5663
5374
|
};
|
|
5664
|
-
|
|
5665
|
-
// src/components/NonIdealState.jsx
|
|
5666
|
-
init_esm_shims();
|
|
5667
5375
|
var NonIdealState = (props) => /* @__PURE__ */ React13__default.createElement(
|
|
5668
5376
|
Center,
|
|
5669
5377
|
{
|
|
@@ -6020,30 +5728,15 @@ function PivotView(props) {
|
|
|
6020
5728
|
}
|
|
6021
5729
|
);
|
|
6022
5730
|
}
|
|
6023
|
-
|
|
6024
|
-
// src/components/tour/ExplorerTour.tsx
|
|
6025
|
-
init_esm_shims();
|
|
6026
|
-
|
|
6027
|
-
// src/components/tour/useTourSteps.tsx
|
|
6028
|
-
init_esm_shims();
|
|
6029
|
-
|
|
6030
|
-
// src/components/tour/FirstStep.tsx
|
|
6031
|
-
init_esm_shims();
|
|
6032
5731
|
function FirstStep({ introImage }) {
|
|
6033
5732
|
const { translate: t } = useTranslation();
|
|
6034
5733
|
return /* @__PURE__ */ React13__default.createElement(Container, { className: "tour-item tour-welcome", px: 0 }, introImage && /* @__PURE__ */ React13__default.createElement("div", { className: "tour-img" }, introImage), /* @__PURE__ */ React13__default.createElement(Box, { className: "tour-text", px: "md" }, /* @__PURE__ */ React13__default.createElement("h3", null, t("tour.steps.welcome.title")), /* @__PURE__ */ React13__default.createElement("p", null, t("tour.steps.welcome.text1")), /* @__PURE__ */ React13__default.createElement("p", null, t("tour.steps.welcome.text2"))));
|
|
6035
5734
|
}
|
|
6036
|
-
|
|
6037
|
-
// src/components/tour/TourStep.tsx
|
|
6038
|
-
init_esm_shims();
|
|
6039
5735
|
function TourStep(props) {
|
|
6040
5736
|
const { title, texts } = props;
|
|
6041
5737
|
const paragraphs = Array.isArray(texts) ? texts : [texts];
|
|
6042
5738
|
return /* @__PURE__ */ React13__default.createElement(Container, { className: "tour-item tour-step", pt: "md" }, /* @__PURE__ */ React13__default.createElement("div", { className: "tour-text" }, /* @__PURE__ */ React13__default.createElement(Title, { order: 3 }, title), paragraphs.map((p, i) => /* @__PURE__ */ React13__default.createElement(Text, { component: "p", key: `p-${i + 1}` }, p))));
|
|
6043
5739
|
}
|
|
6044
|
-
|
|
6045
|
-
// src/components/tour/LastStep.tsx
|
|
6046
|
-
init_esm_shims();
|
|
6047
5740
|
function LastStep({ t }) {
|
|
6048
5741
|
return /* @__PURE__ */ React13__default.createElement(Container, { className: "tour-item tour-last", pt: "md" }, /* @__PURE__ */ React13__default.createElement("div", { className: "tour-text" }, /* @__PURE__ */ React13__default.createElement(Title, { order: 3 }, t("tour.steps.last.title")), /* @__PURE__ */ React13__default.createElement(Text, { component: "p" }, t("tour.steps.last.text"))));
|
|
6049
5742
|
}
|
|
@@ -6311,9 +6004,6 @@ function ExplorerTour({ children, tourConfig }) {
|
|
|
6311
6004
|
children
|
|
6312
6005
|
);
|
|
6313
6006
|
}
|
|
6314
|
-
|
|
6315
|
-
// src/context/index.tsx
|
|
6316
|
-
init_esm_shims();
|
|
6317
6007
|
var queryClient = new QueryClient();
|
|
6318
6008
|
function AppProviders({ children }) {
|
|
6319
6009
|
const { serverURL, defaultCube, serverConfig, defaultDataLocale, defaultLocale } = useSettings();
|
|
@@ -6446,14 +6136,7 @@ function ExplorerComponent(props) {
|
|
|
6446
6136
|
}
|
|
6447
6137
|
ExplorerComponent.displayName = "TesseractExplorer";
|
|
6448
6138
|
|
|
6449
|
-
// src/vizbuilder/index.ts
|
|
6450
|
-
init_esm_shims();
|
|
6451
|
-
|
|
6452
|
-
// src/vizbuilder/components/VizbuilderView.tsx
|
|
6453
|
-
init_esm_shims();
|
|
6454
|
-
|
|
6455
6139
|
// src/vizbuilder/tooling/columns.ts
|
|
6456
|
-
init_esm_shims();
|
|
6457
6140
|
function buildColumn(cube, name4, columns) {
|
|
6458
6141
|
const nameWithoutID = name4.replace(/\sID$/, "");
|
|
6459
6142
|
const nameWithID = `${nameWithoutID} ID`;
|
|
@@ -6500,904 +6183,6 @@ function buildColumn(cube, name4, columns) {
|
|
|
6500
6183
|
}
|
|
6501
6184
|
throw new Error(`Missing entity in cube '${cube.name}': ${nameWithoutID}`);
|
|
6502
6185
|
}
|
|
6503
|
-
|
|
6504
|
-
// src/vizbuilder/components/Vizbuilder.tsx
|
|
6505
|
-
init_esm_shims();
|
|
6506
|
-
|
|
6507
|
-
// node_modules/clsx/dist/clsx.m.js
|
|
6508
|
-
init_esm_shims();
|
|
6509
|
-
function r(e) {
|
|
6510
|
-
var t, f, n = "";
|
|
6511
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
6512
|
-
else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
6513
|
-
else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
6514
|
-
return n;
|
|
6515
|
-
}
|
|
6516
|
-
function clsx() {
|
|
6517
|
-
for (var e, t, f = 0, n = ""; f < arguments.length; ) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
6518
|
-
return n;
|
|
6519
|
-
}
|
|
6520
|
-
var clsx_m_default = clsx;
|
|
6521
|
-
|
|
6522
|
-
// src/vizbuilder/components/ChartCard.tsx
|
|
6523
|
-
init_esm_shims();
|
|
6524
|
-
|
|
6525
|
-
// node_modules/d3plus-export/es/index.js
|
|
6526
|
-
init_esm_shims();
|
|
6527
|
-
|
|
6528
|
-
// node_modules/d3plus-export/es/src/saveElement.js
|
|
6529
|
-
init_esm_shims();
|
|
6530
|
-
|
|
6531
|
-
// node_modules/html-to-image/es/index.js
|
|
6532
|
-
init_esm_shims();
|
|
6533
|
-
|
|
6534
|
-
// node_modules/html-to-image/es/clone-node.js
|
|
6535
|
-
init_esm_shims();
|
|
6536
|
-
|
|
6537
|
-
// node_modules/html-to-image/es/clone-pseudos.js
|
|
6538
|
-
init_esm_shims();
|
|
6539
|
-
|
|
6540
|
-
// node_modules/html-to-image/es/util.js
|
|
6541
|
-
init_esm_shims();
|
|
6542
|
-
function resolveUrl(url, baseUrl) {
|
|
6543
|
-
if (url.match(/^[a-z]+:\/\//i)) {
|
|
6544
|
-
return url;
|
|
6545
|
-
}
|
|
6546
|
-
if (url.match(/^\/\//)) {
|
|
6547
|
-
return window.location.protocol + url;
|
|
6548
|
-
}
|
|
6549
|
-
if (url.match(/^[a-z]+:/i)) {
|
|
6550
|
-
return url;
|
|
6551
|
-
}
|
|
6552
|
-
const doc = document.implementation.createHTMLDocument();
|
|
6553
|
-
const base = doc.createElement("base");
|
|
6554
|
-
const a = doc.createElement("a");
|
|
6555
|
-
doc.head.appendChild(base);
|
|
6556
|
-
doc.body.appendChild(a);
|
|
6557
|
-
if (baseUrl) {
|
|
6558
|
-
base.href = baseUrl;
|
|
6559
|
-
}
|
|
6560
|
-
a.href = url;
|
|
6561
|
-
return a.href;
|
|
6562
|
-
}
|
|
6563
|
-
var uuid = /* @__PURE__ */ (() => {
|
|
6564
|
-
let counter = 0;
|
|
6565
|
-
const random = () => (
|
|
6566
|
-
// eslint-disable-next-line no-bitwise
|
|
6567
|
-
`0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
|
|
6568
|
-
);
|
|
6569
|
-
return () => {
|
|
6570
|
-
counter += 1;
|
|
6571
|
-
return `u${random()}${counter}`;
|
|
6572
|
-
};
|
|
6573
|
-
})();
|
|
6574
|
-
function toArray(arrayLike) {
|
|
6575
|
-
const arr = [];
|
|
6576
|
-
for (let i = 0, l = arrayLike.length; i < l; i++) {
|
|
6577
|
-
arr.push(arrayLike[i]);
|
|
6578
|
-
}
|
|
6579
|
-
return arr;
|
|
6580
|
-
}
|
|
6581
|
-
function px(node, styleProperty) {
|
|
6582
|
-
const win = node.ownerDocument.defaultView || window;
|
|
6583
|
-
const val = win.getComputedStyle(node).getPropertyValue(styleProperty);
|
|
6584
|
-
return val ? parseFloat(val.replace("px", "")) : 0;
|
|
6585
|
-
}
|
|
6586
|
-
function getNodeWidth(node) {
|
|
6587
|
-
const leftBorder = px(node, "border-left-width");
|
|
6588
|
-
const rightBorder = px(node, "border-right-width");
|
|
6589
|
-
return node.clientWidth + leftBorder + rightBorder;
|
|
6590
|
-
}
|
|
6591
|
-
function getNodeHeight(node) {
|
|
6592
|
-
const topBorder = px(node, "border-top-width");
|
|
6593
|
-
const bottomBorder = px(node, "border-bottom-width");
|
|
6594
|
-
return node.clientHeight + topBorder + bottomBorder;
|
|
6595
|
-
}
|
|
6596
|
-
function getImageSize(targetNode, options = {}) {
|
|
6597
|
-
const width = options.width || getNodeWidth(targetNode);
|
|
6598
|
-
const height = options.height || getNodeHeight(targetNode);
|
|
6599
|
-
return { width, height };
|
|
6600
|
-
}
|
|
6601
|
-
function getPixelRatio() {
|
|
6602
|
-
let ratio;
|
|
6603
|
-
let FINAL_PROCESS;
|
|
6604
|
-
try {
|
|
6605
|
-
FINAL_PROCESS = process;
|
|
6606
|
-
} catch (e) {
|
|
6607
|
-
}
|
|
6608
|
-
const val = FINAL_PROCESS && FINAL_PROCESS.env ? FINAL_PROCESS.env.devicePixelRatio : null;
|
|
6609
|
-
if (val) {
|
|
6610
|
-
ratio = parseInt(val, 10);
|
|
6611
|
-
if (Number.isNaN(ratio)) {
|
|
6612
|
-
ratio = 1;
|
|
6613
|
-
}
|
|
6614
|
-
}
|
|
6615
|
-
return ratio || window.devicePixelRatio || 1;
|
|
6616
|
-
}
|
|
6617
|
-
var canvasDimensionLimit = 16384;
|
|
6618
|
-
function checkCanvasDimensions(canvas) {
|
|
6619
|
-
if (canvas.width > canvasDimensionLimit || canvas.height > canvasDimensionLimit) {
|
|
6620
|
-
if (canvas.width > canvasDimensionLimit && canvas.height > canvasDimensionLimit) {
|
|
6621
|
-
if (canvas.width > canvas.height) {
|
|
6622
|
-
canvas.height *= canvasDimensionLimit / canvas.width;
|
|
6623
|
-
canvas.width = canvasDimensionLimit;
|
|
6624
|
-
} else {
|
|
6625
|
-
canvas.width *= canvasDimensionLimit / canvas.height;
|
|
6626
|
-
canvas.height = canvasDimensionLimit;
|
|
6627
|
-
}
|
|
6628
|
-
} else if (canvas.width > canvasDimensionLimit) {
|
|
6629
|
-
canvas.height *= canvasDimensionLimit / canvas.width;
|
|
6630
|
-
canvas.width = canvasDimensionLimit;
|
|
6631
|
-
} else {
|
|
6632
|
-
canvas.width *= canvasDimensionLimit / canvas.height;
|
|
6633
|
-
canvas.height = canvasDimensionLimit;
|
|
6634
|
-
}
|
|
6635
|
-
}
|
|
6636
|
-
}
|
|
6637
|
-
function canvasToBlob(canvas, options = {}) {
|
|
6638
|
-
if (canvas.toBlob) {
|
|
6639
|
-
return new Promise((resolve) => {
|
|
6640
|
-
canvas.toBlob(resolve, options.type ? options.type : "image/png", options.quality ? options.quality : 1);
|
|
6641
|
-
});
|
|
6642
|
-
}
|
|
6643
|
-
return new Promise((resolve) => {
|
|
6644
|
-
const binaryString = window.atob(canvas.toDataURL(options.type ? options.type : void 0, options.quality ? options.quality : void 0).split(",")[1]);
|
|
6645
|
-
const len = binaryString.length;
|
|
6646
|
-
const binaryArray = new Uint8Array(len);
|
|
6647
|
-
for (let i = 0; i < len; i += 1) {
|
|
6648
|
-
binaryArray[i] = binaryString.charCodeAt(i);
|
|
6649
|
-
}
|
|
6650
|
-
resolve(new Blob([binaryArray], {
|
|
6651
|
-
type: options.type ? options.type : "image/png"
|
|
6652
|
-
}));
|
|
6653
|
-
});
|
|
6654
|
-
}
|
|
6655
|
-
function createImage(url) {
|
|
6656
|
-
return new Promise((resolve, reject) => {
|
|
6657
|
-
const img = new Image();
|
|
6658
|
-
img.decode = () => resolve(img);
|
|
6659
|
-
img.onload = () => resolve(img);
|
|
6660
|
-
img.onerror = reject;
|
|
6661
|
-
img.crossOrigin = "anonymous";
|
|
6662
|
-
img.decoding = "async";
|
|
6663
|
-
img.src = url;
|
|
6664
|
-
});
|
|
6665
|
-
}
|
|
6666
|
-
async function svgToDataURL(svg) {
|
|
6667
|
-
return Promise.resolve().then(() => new XMLSerializer().serializeToString(svg)).then(encodeURIComponent).then((html) => `data:image/svg+xml;charset=utf-8,${html}`);
|
|
6668
|
-
}
|
|
6669
|
-
async function nodeToDataURL(node, width, height) {
|
|
6670
|
-
const xmlns = "http://www.w3.org/2000/svg";
|
|
6671
|
-
const svg = document.createElementNS(xmlns, "svg");
|
|
6672
|
-
const foreignObject = document.createElementNS(xmlns, "foreignObject");
|
|
6673
|
-
svg.setAttribute("width", `${width}`);
|
|
6674
|
-
svg.setAttribute("height", `${height}`);
|
|
6675
|
-
svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
|
|
6676
|
-
foreignObject.setAttribute("width", "100%");
|
|
6677
|
-
foreignObject.setAttribute("height", "100%");
|
|
6678
|
-
foreignObject.setAttribute("x", "0");
|
|
6679
|
-
foreignObject.setAttribute("y", "0");
|
|
6680
|
-
foreignObject.setAttribute("externalResourcesRequired", "true");
|
|
6681
|
-
svg.appendChild(foreignObject);
|
|
6682
|
-
foreignObject.appendChild(node);
|
|
6683
|
-
return svgToDataURL(svg);
|
|
6684
|
-
}
|
|
6685
|
-
var isInstanceOfElement = (node, instance) => {
|
|
6686
|
-
if (node instanceof instance)
|
|
6687
|
-
return true;
|
|
6688
|
-
const nodePrototype = Object.getPrototypeOf(node);
|
|
6689
|
-
if (nodePrototype === null)
|
|
6690
|
-
return false;
|
|
6691
|
-
return nodePrototype.constructor.name === instance.name || isInstanceOfElement(nodePrototype, instance);
|
|
6692
|
-
};
|
|
6693
|
-
|
|
6694
|
-
// node_modules/html-to-image/es/clone-pseudos.js
|
|
6695
|
-
function formatCSSText(style) {
|
|
6696
|
-
const content = style.getPropertyValue("content");
|
|
6697
|
-
return `${style.cssText} content: '${content.replace(/'|"/g, "")}';`;
|
|
6698
|
-
}
|
|
6699
|
-
function formatCSSProperties(style) {
|
|
6700
|
-
return toArray(style).map((name4) => {
|
|
6701
|
-
const value = style.getPropertyValue(name4);
|
|
6702
|
-
const priority = style.getPropertyPriority(name4);
|
|
6703
|
-
return `${name4}: ${value}${priority ? " !important" : ""};`;
|
|
6704
|
-
}).join(" ");
|
|
6705
|
-
}
|
|
6706
|
-
function getPseudoElementStyle(className, pseudo, style) {
|
|
6707
|
-
const selector = `.${className}:${pseudo}`;
|
|
6708
|
-
const cssText = style.cssText ? formatCSSText(style) : formatCSSProperties(style);
|
|
6709
|
-
return document.createTextNode(`${selector}{${cssText}}`);
|
|
6710
|
-
}
|
|
6711
|
-
function clonePseudoElement(nativeNode, clonedNode, pseudo) {
|
|
6712
|
-
const style = window.getComputedStyle(nativeNode, pseudo);
|
|
6713
|
-
const content = style.getPropertyValue("content");
|
|
6714
|
-
if (content === "" || content === "none") {
|
|
6715
|
-
return;
|
|
6716
|
-
}
|
|
6717
|
-
const className = uuid();
|
|
6718
|
-
try {
|
|
6719
|
-
clonedNode.className = `${clonedNode.className} ${className}`;
|
|
6720
|
-
} catch (err) {
|
|
6721
|
-
return;
|
|
6722
|
-
}
|
|
6723
|
-
const styleElement = document.createElement("style");
|
|
6724
|
-
styleElement.appendChild(getPseudoElementStyle(className, pseudo, style));
|
|
6725
|
-
clonedNode.appendChild(styleElement);
|
|
6726
|
-
}
|
|
6727
|
-
function clonePseudoElements(nativeNode, clonedNode) {
|
|
6728
|
-
clonePseudoElement(nativeNode, clonedNode, ":before");
|
|
6729
|
-
clonePseudoElement(nativeNode, clonedNode, ":after");
|
|
6730
|
-
}
|
|
6731
|
-
|
|
6732
|
-
// node_modules/html-to-image/es/mimes.js
|
|
6733
|
-
init_esm_shims();
|
|
6734
|
-
var WOFF = "application/font-woff";
|
|
6735
|
-
var JPEG = "image/jpeg";
|
|
6736
|
-
var mimes = {
|
|
6737
|
-
woff: WOFF,
|
|
6738
|
-
woff2: WOFF,
|
|
6739
|
-
ttf: "application/font-truetype",
|
|
6740
|
-
eot: "application/vnd.ms-fontobject",
|
|
6741
|
-
png: "image/png",
|
|
6742
|
-
jpg: JPEG,
|
|
6743
|
-
jpeg: JPEG,
|
|
6744
|
-
gif: "image/gif",
|
|
6745
|
-
tiff: "image/tiff",
|
|
6746
|
-
svg: "image/svg+xml",
|
|
6747
|
-
webp: "image/webp"
|
|
6748
|
-
};
|
|
6749
|
-
function getExtension(url) {
|
|
6750
|
-
const match = /\.([^./]*?)$/g.exec(url);
|
|
6751
|
-
return match ? match[1] : "";
|
|
6752
|
-
}
|
|
6753
|
-
function getMimeType(url) {
|
|
6754
|
-
const extension = getExtension(url).toLowerCase();
|
|
6755
|
-
return mimes[extension] || "";
|
|
6756
|
-
}
|
|
6757
|
-
|
|
6758
|
-
// node_modules/html-to-image/es/dataurl.js
|
|
6759
|
-
init_esm_shims();
|
|
6760
|
-
function getContentFromDataUrl(dataURL) {
|
|
6761
|
-
return dataURL.split(/,/)[1];
|
|
6762
|
-
}
|
|
6763
|
-
function isDataUrl(url) {
|
|
6764
|
-
return url.search(/^(data:)/) !== -1;
|
|
6765
|
-
}
|
|
6766
|
-
function makeDataUrl(content, mimeType) {
|
|
6767
|
-
return `data:${mimeType};base64,${content}`;
|
|
6768
|
-
}
|
|
6769
|
-
async function fetchAsDataURL(url, init, process2) {
|
|
6770
|
-
const res = await fetch(url, init);
|
|
6771
|
-
if (res.status === 404) {
|
|
6772
|
-
throw new Error(`Resource "${res.url}" not found`);
|
|
6773
|
-
}
|
|
6774
|
-
const blob = await res.blob();
|
|
6775
|
-
return new Promise((resolve, reject) => {
|
|
6776
|
-
const reader = new FileReader();
|
|
6777
|
-
reader.onerror = reject;
|
|
6778
|
-
reader.onloadend = () => {
|
|
6779
|
-
try {
|
|
6780
|
-
resolve(process2({ res, result: reader.result }));
|
|
6781
|
-
} catch (error) {
|
|
6782
|
-
reject(error);
|
|
6783
|
-
}
|
|
6784
|
-
};
|
|
6785
|
-
reader.readAsDataURL(blob);
|
|
6786
|
-
});
|
|
6787
|
-
}
|
|
6788
|
-
var cache = {};
|
|
6789
|
-
function getCacheKey(url, contentType, includeQueryParams) {
|
|
6790
|
-
let key = url.replace(/\?.*/, "");
|
|
6791
|
-
if (includeQueryParams) {
|
|
6792
|
-
key = url;
|
|
6793
|
-
}
|
|
6794
|
-
if (/ttf|otf|eot|woff2?/i.test(key)) {
|
|
6795
|
-
key = key.replace(/.*\//, "");
|
|
6796
|
-
}
|
|
6797
|
-
return contentType ? `[${contentType}]${key}` : key;
|
|
6798
|
-
}
|
|
6799
|
-
async function resourceToDataURL(resourceUrl, contentType, options) {
|
|
6800
|
-
const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);
|
|
6801
|
-
if (cache[cacheKey] != null) {
|
|
6802
|
-
return cache[cacheKey];
|
|
6803
|
-
}
|
|
6804
|
-
if (options.cacheBust) {
|
|
6805
|
-
resourceUrl += (/\?/.test(resourceUrl) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime();
|
|
6806
|
-
}
|
|
6807
|
-
let dataURL;
|
|
6808
|
-
try {
|
|
6809
|
-
const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {
|
|
6810
|
-
if (!contentType) {
|
|
6811
|
-
contentType = res.headers.get("Content-Type") || "";
|
|
6812
|
-
}
|
|
6813
|
-
return getContentFromDataUrl(result);
|
|
6814
|
-
});
|
|
6815
|
-
dataURL = makeDataUrl(content, contentType);
|
|
6816
|
-
} catch (error) {
|
|
6817
|
-
dataURL = options.imagePlaceholder || "";
|
|
6818
|
-
let msg = `Failed to fetch resource: ${resourceUrl}`;
|
|
6819
|
-
if (error) {
|
|
6820
|
-
msg = typeof error === "string" ? error : error.message;
|
|
6821
|
-
}
|
|
6822
|
-
if (msg) {
|
|
6823
|
-
console.warn(msg);
|
|
6824
|
-
}
|
|
6825
|
-
}
|
|
6826
|
-
cache[cacheKey] = dataURL;
|
|
6827
|
-
return dataURL;
|
|
6828
|
-
}
|
|
6829
|
-
|
|
6830
|
-
// node_modules/html-to-image/es/clone-node.js
|
|
6831
|
-
async function cloneCanvasElement(canvas) {
|
|
6832
|
-
const dataURL = canvas.toDataURL();
|
|
6833
|
-
if (dataURL === "data:,") {
|
|
6834
|
-
return canvas.cloneNode(false);
|
|
6835
|
-
}
|
|
6836
|
-
return createImage(dataURL);
|
|
6837
|
-
}
|
|
6838
|
-
async function cloneVideoElement(video, options) {
|
|
6839
|
-
if (video.currentSrc) {
|
|
6840
|
-
const canvas = document.createElement("canvas");
|
|
6841
|
-
const ctx = canvas.getContext("2d");
|
|
6842
|
-
canvas.width = video.clientWidth;
|
|
6843
|
-
canvas.height = video.clientHeight;
|
|
6844
|
-
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
6845
|
-
const dataURL2 = canvas.toDataURL();
|
|
6846
|
-
return createImage(dataURL2);
|
|
6847
|
-
}
|
|
6848
|
-
const poster = video.poster;
|
|
6849
|
-
const contentType = getMimeType(poster);
|
|
6850
|
-
const dataURL = await resourceToDataURL(poster, contentType, options);
|
|
6851
|
-
return createImage(dataURL);
|
|
6852
|
-
}
|
|
6853
|
-
async function cloneIFrameElement(iframe) {
|
|
6854
|
-
var _a;
|
|
6855
|
-
try {
|
|
6856
|
-
if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {
|
|
6857
|
-
return await cloneNode(iframe.contentDocument.body, {}, true);
|
|
6858
|
-
}
|
|
6859
|
-
} catch (_b) {
|
|
6860
|
-
}
|
|
6861
|
-
return iframe.cloneNode(false);
|
|
6862
|
-
}
|
|
6863
|
-
async function cloneSingleNode(node, options) {
|
|
6864
|
-
if (isInstanceOfElement(node, HTMLCanvasElement)) {
|
|
6865
|
-
return cloneCanvasElement(node);
|
|
6866
|
-
}
|
|
6867
|
-
if (isInstanceOfElement(node, HTMLVideoElement)) {
|
|
6868
|
-
return cloneVideoElement(node, options);
|
|
6869
|
-
}
|
|
6870
|
-
if (isInstanceOfElement(node, HTMLIFrameElement)) {
|
|
6871
|
-
return cloneIFrameElement(node);
|
|
6872
|
-
}
|
|
6873
|
-
return node.cloneNode(false);
|
|
6874
|
-
}
|
|
6875
|
-
var isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SLOT";
|
|
6876
|
-
async function cloneChildren(nativeNode, clonedNode, options) {
|
|
6877
|
-
var _a, _b;
|
|
6878
|
-
let children = [];
|
|
6879
|
-
if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {
|
|
6880
|
-
children = toArray(nativeNode.assignedNodes());
|
|
6881
|
-
} else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
6882
|
-
children = toArray(nativeNode.contentDocument.body.childNodes);
|
|
6883
|
-
} else {
|
|
6884
|
-
children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);
|
|
6885
|
-
}
|
|
6886
|
-
if (children.length === 0 || isInstanceOfElement(nativeNode, HTMLVideoElement)) {
|
|
6887
|
-
return clonedNode;
|
|
6888
|
-
}
|
|
6889
|
-
await children.reduce((deferred, child) => deferred.then(() => cloneNode(child, options)).then((clonedChild) => {
|
|
6890
|
-
if (clonedChild) {
|
|
6891
|
-
clonedNode.appendChild(clonedChild);
|
|
6892
|
-
}
|
|
6893
|
-
}), Promise.resolve());
|
|
6894
|
-
return clonedNode;
|
|
6895
|
-
}
|
|
6896
|
-
function cloneCSSStyle(nativeNode, clonedNode) {
|
|
6897
|
-
const targetStyle = clonedNode.style;
|
|
6898
|
-
if (!targetStyle) {
|
|
6899
|
-
return;
|
|
6900
|
-
}
|
|
6901
|
-
const sourceStyle = window.getComputedStyle(nativeNode);
|
|
6902
|
-
if (sourceStyle.cssText) {
|
|
6903
|
-
targetStyle.cssText = sourceStyle.cssText;
|
|
6904
|
-
targetStyle.transformOrigin = sourceStyle.transformOrigin;
|
|
6905
|
-
} else {
|
|
6906
|
-
toArray(sourceStyle).forEach((name4) => {
|
|
6907
|
-
let value = sourceStyle.getPropertyValue(name4);
|
|
6908
|
-
if (name4 === "font-size" && value.endsWith("px")) {
|
|
6909
|
-
const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;
|
|
6910
|
-
value = `${reducedFont}px`;
|
|
6911
|
-
}
|
|
6912
|
-
if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && name4 === "display" && value === "inline") {
|
|
6913
|
-
value = "block";
|
|
6914
|
-
}
|
|
6915
|
-
if (name4 === "d" && clonedNode.getAttribute("d")) {
|
|
6916
|
-
value = `path(${clonedNode.getAttribute("d")})`;
|
|
6917
|
-
}
|
|
6918
|
-
targetStyle.setProperty(name4, value, sourceStyle.getPropertyPriority(name4));
|
|
6919
|
-
});
|
|
6920
|
-
}
|
|
6921
|
-
}
|
|
6922
|
-
function cloneInputValue(nativeNode, clonedNode) {
|
|
6923
|
-
if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) {
|
|
6924
|
-
clonedNode.innerHTML = nativeNode.value;
|
|
6925
|
-
}
|
|
6926
|
-
if (isInstanceOfElement(nativeNode, HTMLInputElement)) {
|
|
6927
|
-
clonedNode.setAttribute("value", nativeNode.value);
|
|
6928
|
-
}
|
|
6929
|
-
}
|
|
6930
|
-
function cloneSelectValue(nativeNode, clonedNode) {
|
|
6931
|
-
if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {
|
|
6932
|
-
const clonedSelect = clonedNode;
|
|
6933
|
-
const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute("value"));
|
|
6934
|
-
if (selectedOption) {
|
|
6935
|
-
selectedOption.setAttribute("selected", "");
|
|
6936
|
-
}
|
|
6937
|
-
}
|
|
6938
|
-
}
|
|
6939
|
-
function decorate(nativeNode, clonedNode) {
|
|
6940
|
-
if (isInstanceOfElement(clonedNode, Element)) {
|
|
6941
|
-
cloneCSSStyle(nativeNode, clonedNode);
|
|
6942
|
-
clonePseudoElements(nativeNode, clonedNode);
|
|
6943
|
-
cloneInputValue(nativeNode, clonedNode);
|
|
6944
|
-
cloneSelectValue(nativeNode, clonedNode);
|
|
6945
|
-
}
|
|
6946
|
-
return clonedNode;
|
|
6947
|
-
}
|
|
6948
|
-
async function ensureSVGSymbols(clone, options) {
|
|
6949
|
-
const uses = clone.querySelectorAll ? clone.querySelectorAll("use") : [];
|
|
6950
|
-
if (uses.length === 0) {
|
|
6951
|
-
return clone;
|
|
6952
|
-
}
|
|
6953
|
-
const processedDefs = {};
|
|
6954
|
-
for (let i = 0; i < uses.length; i++) {
|
|
6955
|
-
const use = uses[i];
|
|
6956
|
-
const id = use.getAttribute("xlink:href");
|
|
6957
|
-
if (id) {
|
|
6958
|
-
const exist = clone.querySelector(id);
|
|
6959
|
-
const definition = document.querySelector(id);
|
|
6960
|
-
if (!exist && definition && !processedDefs[id]) {
|
|
6961
|
-
processedDefs[id] = await cloneNode(definition, options, true);
|
|
6962
|
-
}
|
|
6963
|
-
}
|
|
6964
|
-
}
|
|
6965
|
-
const nodes = Object.values(processedDefs);
|
|
6966
|
-
if (nodes.length) {
|
|
6967
|
-
const ns = "http://www.w3.org/1999/xhtml";
|
|
6968
|
-
const svg = document.createElementNS(ns, "svg");
|
|
6969
|
-
svg.setAttribute("xmlns", ns);
|
|
6970
|
-
svg.style.position = "absolute";
|
|
6971
|
-
svg.style.width = "0";
|
|
6972
|
-
svg.style.height = "0";
|
|
6973
|
-
svg.style.overflow = "hidden";
|
|
6974
|
-
svg.style.display = "none";
|
|
6975
|
-
const defs = document.createElementNS(ns, "defs");
|
|
6976
|
-
svg.appendChild(defs);
|
|
6977
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
6978
|
-
defs.appendChild(nodes[i]);
|
|
6979
|
-
}
|
|
6980
|
-
clone.appendChild(svg);
|
|
6981
|
-
}
|
|
6982
|
-
return clone;
|
|
6983
|
-
}
|
|
6984
|
-
async function cloneNode(node, options, isRoot) {
|
|
6985
|
-
if (!isRoot && options.filter && !options.filter(node)) {
|
|
6986
|
-
return null;
|
|
6987
|
-
}
|
|
6988
|
-
return Promise.resolve(node).then((clonedNode) => cloneSingleNode(clonedNode, options)).then((clonedNode) => cloneChildren(node, clonedNode, options)).then((clonedNode) => decorate(node, clonedNode)).then((clonedNode) => ensureSVGSymbols(clonedNode, options));
|
|
6989
|
-
}
|
|
6990
|
-
|
|
6991
|
-
// node_modules/html-to-image/es/embed-images.js
|
|
6992
|
-
init_esm_shims();
|
|
6993
|
-
|
|
6994
|
-
// node_modules/html-to-image/es/embed-resources.js
|
|
6995
|
-
init_esm_shims();
|
|
6996
|
-
var URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g;
|
|
6997
|
-
var URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g;
|
|
6998
|
-
var FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
6999
|
-
function toRegex(url) {
|
|
7000
|
-
const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
7001
|
-
return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, "g");
|
|
7002
|
-
}
|
|
7003
|
-
function parseURLs(cssText) {
|
|
7004
|
-
const urls = [];
|
|
7005
|
-
cssText.replace(URL_REGEX, (raw, quotation, url) => {
|
|
7006
|
-
urls.push(url);
|
|
7007
|
-
return raw;
|
|
7008
|
-
});
|
|
7009
|
-
return urls.filter((url) => !isDataUrl(url));
|
|
7010
|
-
}
|
|
7011
|
-
async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {
|
|
7012
|
-
try {
|
|
7013
|
-
const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
|
|
7014
|
-
const contentType = getMimeType(resourceURL);
|
|
7015
|
-
let dataURL;
|
|
7016
|
-
if (getContentFromUrl) ; else {
|
|
7017
|
-
dataURL = await resourceToDataURL(resolvedURL, contentType, options);
|
|
7018
|
-
}
|
|
7019
|
-
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
|
|
7020
|
-
} catch (error) {
|
|
7021
|
-
}
|
|
7022
|
-
return cssText;
|
|
7023
|
-
}
|
|
7024
|
-
function filterPreferredFontFormat(str, { preferredFontFormat }) {
|
|
7025
|
-
return !preferredFontFormat ? str : str.replace(FONT_SRC_REGEX, (match) => {
|
|
7026
|
-
while (true) {
|
|
7027
|
-
const [src, , format2] = URL_WITH_FORMAT_REGEX.exec(match) || [];
|
|
7028
|
-
if (!format2) {
|
|
7029
|
-
return "";
|
|
7030
|
-
}
|
|
7031
|
-
if (format2 === preferredFontFormat) {
|
|
7032
|
-
return `src: ${src};`;
|
|
7033
|
-
}
|
|
7034
|
-
}
|
|
7035
|
-
});
|
|
7036
|
-
}
|
|
7037
|
-
function shouldEmbed(url) {
|
|
7038
|
-
return url.search(URL_REGEX) !== -1;
|
|
7039
|
-
}
|
|
7040
|
-
async function embedResources(cssText, baseUrl, options) {
|
|
7041
|
-
if (!shouldEmbed(cssText)) {
|
|
7042
|
-
return cssText;
|
|
7043
|
-
}
|
|
7044
|
-
const filteredCSSText = filterPreferredFontFormat(cssText, options);
|
|
7045
|
-
const urls = parseURLs(filteredCSSText);
|
|
7046
|
-
return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));
|
|
7047
|
-
}
|
|
7048
|
-
|
|
7049
|
-
// node_modules/html-to-image/es/embed-images.js
|
|
7050
|
-
async function embedProp(propName, node, options) {
|
|
7051
|
-
var _a;
|
|
7052
|
-
const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);
|
|
7053
|
-
if (propValue) {
|
|
7054
|
-
const cssString = await embedResources(propValue, null, options);
|
|
7055
|
-
node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));
|
|
7056
|
-
return true;
|
|
7057
|
-
}
|
|
7058
|
-
return false;
|
|
7059
|
-
}
|
|
7060
|
-
async function embedBackground(clonedNode, options) {
|
|
7061
|
-
if (!await embedProp("background", clonedNode, options)) {
|
|
7062
|
-
await embedProp("background-image", clonedNode, options);
|
|
7063
|
-
}
|
|
7064
|
-
if (!await embedProp("mask", clonedNode, options)) {
|
|
7065
|
-
await embedProp("mask-image", clonedNode, options);
|
|
7066
|
-
}
|
|
7067
|
-
}
|
|
7068
|
-
async function embedImageNode(clonedNode, options) {
|
|
7069
|
-
const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);
|
|
7070
|
-
if (!(isImageElement && !isDataUrl(clonedNode.src)) && !(isInstanceOfElement(clonedNode, SVGImageElement) && !isDataUrl(clonedNode.href.baseVal))) {
|
|
7071
|
-
return;
|
|
7072
|
-
}
|
|
7073
|
-
const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;
|
|
7074
|
-
const dataURL = await resourceToDataURL(url, getMimeType(url), options);
|
|
7075
|
-
await new Promise((resolve, reject) => {
|
|
7076
|
-
clonedNode.onload = resolve;
|
|
7077
|
-
clonedNode.onerror = reject;
|
|
7078
|
-
const image = clonedNode;
|
|
7079
|
-
if (image.decode) {
|
|
7080
|
-
image.decode = resolve;
|
|
7081
|
-
}
|
|
7082
|
-
if (image.loading === "lazy") {
|
|
7083
|
-
image.loading = "eager";
|
|
7084
|
-
}
|
|
7085
|
-
if (isImageElement) {
|
|
7086
|
-
clonedNode.srcset = "";
|
|
7087
|
-
clonedNode.src = dataURL;
|
|
7088
|
-
} else {
|
|
7089
|
-
clonedNode.href.baseVal = dataURL;
|
|
7090
|
-
}
|
|
7091
|
-
});
|
|
7092
|
-
}
|
|
7093
|
-
async function embedChildren(clonedNode, options) {
|
|
7094
|
-
const children = toArray(clonedNode.childNodes);
|
|
7095
|
-
const deferreds = children.map((child) => embedImages(child, options));
|
|
7096
|
-
await Promise.all(deferreds).then(() => clonedNode);
|
|
7097
|
-
}
|
|
7098
|
-
async function embedImages(clonedNode, options) {
|
|
7099
|
-
if (isInstanceOfElement(clonedNode, Element)) {
|
|
7100
|
-
await embedBackground(clonedNode, options);
|
|
7101
|
-
await embedImageNode(clonedNode, options);
|
|
7102
|
-
await embedChildren(clonedNode, options);
|
|
7103
|
-
}
|
|
7104
|
-
}
|
|
7105
|
-
|
|
7106
|
-
// node_modules/html-to-image/es/apply-style.js
|
|
7107
|
-
init_esm_shims();
|
|
7108
|
-
function applyStyle(node, options) {
|
|
7109
|
-
const { style } = node;
|
|
7110
|
-
if (options.backgroundColor) {
|
|
7111
|
-
style.backgroundColor = options.backgroundColor;
|
|
7112
|
-
}
|
|
7113
|
-
if (options.width) {
|
|
7114
|
-
style.width = `${options.width}px`;
|
|
7115
|
-
}
|
|
7116
|
-
if (options.height) {
|
|
7117
|
-
style.height = `${options.height}px`;
|
|
7118
|
-
}
|
|
7119
|
-
const manual = options.style;
|
|
7120
|
-
if (manual != null) {
|
|
7121
|
-
Object.keys(manual).forEach((key) => {
|
|
7122
|
-
style[key] = manual[key];
|
|
7123
|
-
});
|
|
7124
|
-
}
|
|
7125
|
-
return node;
|
|
7126
|
-
}
|
|
7127
|
-
|
|
7128
|
-
// node_modules/html-to-image/es/embed-webfonts.js
|
|
7129
|
-
init_esm_shims();
|
|
7130
|
-
var cssFetchCache = {};
|
|
7131
|
-
async function fetchCSS(url) {
|
|
7132
|
-
let cache2 = cssFetchCache[url];
|
|
7133
|
-
if (cache2 != null) {
|
|
7134
|
-
return cache2;
|
|
7135
|
-
}
|
|
7136
|
-
const res = await fetch(url);
|
|
7137
|
-
const cssText = await res.text();
|
|
7138
|
-
cache2 = { url, cssText };
|
|
7139
|
-
cssFetchCache[url] = cache2;
|
|
7140
|
-
return cache2;
|
|
7141
|
-
}
|
|
7142
|
-
async function embedFonts(data, options) {
|
|
7143
|
-
let cssText = data.cssText;
|
|
7144
|
-
const regexUrl = /url\(["']?([^"')]+)["']?\)/g;
|
|
7145
|
-
const fontLocs = cssText.match(/url\([^)]+\)/g) || [];
|
|
7146
|
-
const loadFonts = fontLocs.map(async (loc) => {
|
|
7147
|
-
let url = loc.replace(regexUrl, "$1");
|
|
7148
|
-
if (!url.startsWith("https://")) {
|
|
7149
|
-
url = new URL(url, data.url).href;
|
|
7150
|
-
}
|
|
7151
|
-
return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {
|
|
7152
|
-
cssText = cssText.replace(loc, `url(${result})`);
|
|
7153
|
-
return [loc, result];
|
|
7154
|
-
});
|
|
7155
|
-
});
|
|
7156
|
-
return Promise.all(loadFonts).then(() => cssText);
|
|
7157
|
-
}
|
|
7158
|
-
function parseCSS(source) {
|
|
7159
|
-
if (source == null) {
|
|
7160
|
-
return [];
|
|
7161
|
-
}
|
|
7162
|
-
const result = [];
|
|
7163
|
-
const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi;
|
|
7164
|
-
let cssText = source.replace(commentsRegex, "");
|
|
7165
|
-
const keyframesRegex = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
7166
|
-
while (true) {
|
|
7167
|
-
const matches = keyframesRegex.exec(cssText);
|
|
7168
|
-
if (matches === null) {
|
|
7169
|
-
break;
|
|
7170
|
-
}
|
|
7171
|
-
result.push(matches[0]);
|
|
7172
|
-
}
|
|
7173
|
-
cssText = cssText.replace(keyframesRegex, "");
|
|
7174
|
-
const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi;
|
|
7175
|
-
const combinedCSSRegex = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})";
|
|
7176
|
-
const unifiedRegex = new RegExp(combinedCSSRegex, "gi");
|
|
7177
|
-
while (true) {
|
|
7178
|
-
let matches = importRegex.exec(cssText);
|
|
7179
|
-
if (matches === null) {
|
|
7180
|
-
matches = unifiedRegex.exec(cssText);
|
|
7181
|
-
if (matches === null) {
|
|
7182
|
-
break;
|
|
7183
|
-
} else {
|
|
7184
|
-
importRegex.lastIndex = unifiedRegex.lastIndex;
|
|
7185
|
-
}
|
|
7186
|
-
} else {
|
|
7187
|
-
unifiedRegex.lastIndex = importRegex.lastIndex;
|
|
7188
|
-
}
|
|
7189
|
-
result.push(matches[0]);
|
|
7190
|
-
}
|
|
7191
|
-
return result;
|
|
7192
|
-
}
|
|
7193
|
-
async function getCSSRules(styleSheets, options) {
|
|
7194
|
-
const ret = [];
|
|
7195
|
-
const deferreds = [];
|
|
7196
|
-
styleSheets.forEach((sheet) => {
|
|
7197
|
-
if ("cssRules" in sheet) {
|
|
7198
|
-
try {
|
|
7199
|
-
toArray(sheet.cssRules || []).forEach((item, index) => {
|
|
7200
|
-
if (item.type === CSSRule.IMPORT_RULE) {
|
|
7201
|
-
let importIndex = index + 1;
|
|
7202
|
-
const url = item.href;
|
|
7203
|
-
const deferred = fetchCSS(url).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
|
|
7204
|
-
try {
|
|
7205
|
-
sheet.insertRule(rule, rule.startsWith("@import") ? importIndex += 1 : sheet.cssRules.length);
|
|
7206
|
-
} catch (error) {
|
|
7207
|
-
console.error("Error inserting rule from remote css", {
|
|
7208
|
-
rule,
|
|
7209
|
-
error
|
|
7210
|
-
});
|
|
7211
|
-
}
|
|
7212
|
-
})).catch((e) => {
|
|
7213
|
-
console.error("Error loading remote css", e.toString());
|
|
7214
|
-
});
|
|
7215
|
-
deferreds.push(deferred);
|
|
7216
|
-
}
|
|
7217
|
-
});
|
|
7218
|
-
} catch (e) {
|
|
7219
|
-
const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];
|
|
7220
|
-
if (sheet.href != null) {
|
|
7221
|
-
deferreds.push(fetchCSS(sheet.href).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
|
|
7222
|
-
inline.insertRule(rule, sheet.cssRules.length);
|
|
7223
|
-
})).catch((err) => {
|
|
7224
|
-
console.error("Error loading remote stylesheet", err);
|
|
7225
|
-
}));
|
|
7226
|
-
}
|
|
7227
|
-
console.error("Error inlining remote css file", e);
|
|
7228
|
-
}
|
|
7229
|
-
}
|
|
7230
|
-
});
|
|
7231
|
-
return Promise.all(deferreds).then(() => {
|
|
7232
|
-
styleSheets.forEach((sheet) => {
|
|
7233
|
-
if ("cssRules" in sheet) {
|
|
7234
|
-
try {
|
|
7235
|
-
toArray(sheet.cssRules || []).forEach((item) => {
|
|
7236
|
-
ret.push(item);
|
|
7237
|
-
});
|
|
7238
|
-
} catch (e) {
|
|
7239
|
-
console.error(`Error while reading CSS rules from ${sheet.href}`, e);
|
|
7240
|
-
}
|
|
7241
|
-
}
|
|
7242
|
-
});
|
|
7243
|
-
return ret;
|
|
7244
|
-
});
|
|
7245
|
-
}
|
|
7246
|
-
function getWebFontRules(cssRules) {
|
|
7247
|
-
return cssRules.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE).filter((rule) => shouldEmbed(rule.style.getPropertyValue("src")));
|
|
7248
|
-
}
|
|
7249
|
-
async function parseWebFontRules(node, options) {
|
|
7250
|
-
if (node.ownerDocument == null) {
|
|
7251
|
-
throw new Error("Provided element is not within a Document");
|
|
7252
|
-
}
|
|
7253
|
-
const styleSheets = toArray(node.ownerDocument.styleSheets);
|
|
7254
|
-
const cssRules = await getCSSRules(styleSheets, options);
|
|
7255
|
-
return getWebFontRules(cssRules);
|
|
7256
|
-
}
|
|
7257
|
-
async function getWebFontCSS(node, options) {
|
|
7258
|
-
const rules = await parseWebFontRules(node, options);
|
|
7259
|
-
const cssTexts = await Promise.all(rules.map((rule) => {
|
|
7260
|
-
const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;
|
|
7261
|
-
return embedResources(rule.cssText, baseUrl, options);
|
|
7262
|
-
}));
|
|
7263
|
-
return cssTexts.join("\n");
|
|
7264
|
-
}
|
|
7265
|
-
async function embedWebFonts(clonedNode, options) {
|
|
7266
|
-
const cssText = options.fontEmbedCSS != null ? options.fontEmbedCSS : options.skipFonts ? null : await getWebFontCSS(clonedNode, options);
|
|
7267
|
-
if (cssText) {
|
|
7268
|
-
const styleNode = document.createElement("style");
|
|
7269
|
-
const sytleContent = document.createTextNode(cssText);
|
|
7270
|
-
styleNode.appendChild(sytleContent);
|
|
7271
|
-
if (clonedNode.firstChild) {
|
|
7272
|
-
clonedNode.insertBefore(styleNode, clonedNode.firstChild);
|
|
7273
|
-
} else {
|
|
7274
|
-
clonedNode.appendChild(styleNode);
|
|
7275
|
-
}
|
|
7276
|
-
}
|
|
7277
|
-
}
|
|
7278
|
-
|
|
7279
|
-
// node_modules/html-to-image/es/index.js
|
|
7280
|
-
async function toSvg(node, options = {}) {
|
|
7281
|
-
const { width, height } = getImageSize(node, options);
|
|
7282
|
-
const clonedNode = await cloneNode(node, options, true);
|
|
7283
|
-
await embedWebFonts(clonedNode, options);
|
|
7284
|
-
await embedImages(clonedNode, options);
|
|
7285
|
-
applyStyle(clonedNode, options);
|
|
7286
|
-
const datauri = await nodeToDataURL(clonedNode, width, height);
|
|
7287
|
-
return datauri;
|
|
7288
|
-
}
|
|
7289
|
-
async function toCanvas(node, options = {}) {
|
|
7290
|
-
const { width, height } = getImageSize(node, options);
|
|
7291
|
-
const svg = await toSvg(node, options);
|
|
7292
|
-
const img = await createImage(svg);
|
|
7293
|
-
const canvas = document.createElement("canvas");
|
|
7294
|
-
const context = canvas.getContext("2d");
|
|
7295
|
-
const ratio = options.pixelRatio || getPixelRatio();
|
|
7296
|
-
const canvasWidth = options.canvasWidth || width;
|
|
7297
|
-
const canvasHeight = options.canvasHeight || height;
|
|
7298
|
-
canvas.width = canvasWidth * ratio;
|
|
7299
|
-
canvas.height = canvasHeight * ratio;
|
|
7300
|
-
if (!options.skipAutoScale) {
|
|
7301
|
-
checkCanvasDimensions(canvas);
|
|
7302
|
-
}
|
|
7303
|
-
canvas.style.width = `${canvasWidth}`;
|
|
7304
|
-
canvas.style.height = `${canvasHeight}`;
|
|
7305
|
-
if (options.backgroundColor) {
|
|
7306
|
-
context.fillStyle = options.backgroundColor;
|
|
7307
|
-
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
7308
|
-
}
|
|
7309
|
-
context.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
7310
|
-
return canvas;
|
|
7311
|
-
}
|
|
7312
|
-
async function toBlob(node, options = {}) {
|
|
7313
|
-
const canvas = await toCanvas(node, options);
|
|
7314
|
-
const blob = await canvasToBlob(canvas);
|
|
7315
|
-
return blob;
|
|
7316
|
-
}
|
|
7317
|
-
|
|
7318
|
-
// node_modules/d3plus-export/es/src/saveElement.js
|
|
7319
|
-
var import_file_saver = __toESM(require_FileSaver());
|
|
7320
|
-
var defaultOptions = {
|
|
7321
|
-
filename: "download",
|
|
7322
|
-
type: "png"
|
|
7323
|
-
};
|
|
7324
|
-
function saveElement_default(elem) {
|
|
7325
|
-
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
7326
|
-
var renderOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
7327
|
-
if (!elem) return;
|
|
7328
|
-
options = Object.assign({}, defaultOptions, options);
|
|
7329
|
-
renderOptions = Object.assign({
|
|
7330
|
-
backgroundColor: renderOptions.background
|
|
7331
|
-
}, renderOptions);
|
|
7332
|
-
function finish(blob) {
|
|
7333
|
-
(0, import_file_saver.saveAs)(blob, "".concat(options.filename, ".").concat(options.type));
|
|
7334
|
-
if (options.callback) options.callback();
|
|
7335
|
-
}
|
|
7336
|
-
if (options.type === "svg") {
|
|
7337
|
-
toSvg(elem, renderOptions).then(function(dataUrl) {
|
|
7338
|
-
var xhr = new XMLHttpRequest();
|
|
7339
|
-
xhr.open("GET", dataUrl);
|
|
7340
|
-
xhr.responseType = "blob";
|
|
7341
|
-
xhr.onload = function() {
|
|
7342
|
-
return finish(xhr.response);
|
|
7343
|
-
};
|
|
7344
|
-
xhr.send();
|
|
7345
|
-
});
|
|
7346
|
-
} else {
|
|
7347
|
-
toBlob(elem, renderOptions).then(finish);
|
|
7348
|
-
}
|
|
7349
|
-
}
|
|
7350
|
-
|
|
7351
|
-
// src/vizbuilder/hooks/useD3plusConfig.ts
|
|
7352
|
-
init_esm_shims();
|
|
7353
|
-
|
|
7354
|
-
// node_modules/d3plus-common/es/index.js
|
|
7355
|
-
init_esm_shims();
|
|
7356
|
-
|
|
7357
|
-
// node_modules/d3plus-common/es/src/assign.js
|
|
7358
|
-
init_esm_shims();
|
|
7359
|
-
|
|
7360
|
-
// node_modules/d3plus-common/es/src/isObject.js
|
|
7361
|
-
init_esm_shims();
|
|
7362
|
-
function _typeof(obj) {
|
|
7363
|
-
"@babel/helpers - typeof";
|
|
7364
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
7365
|
-
return typeof obj2;
|
|
7366
|
-
} : function(obj2) {
|
|
7367
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
7368
|
-
}, _typeof(obj);
|
|
7369
|
-
}
|
|
7370
|
-
function isObject_default(item) {
|
|
7371
|
-
return item && _typeof(item) === "object" && (typeof window === "undefined" || item !== window && item !== window.document && !(item instanceof Element)) && !Array.isArray(item) ? true : false;
|
|
7372
|
-
}
|
|
7373
|
-
|
|
7374
|
-
// node_modules/d3plus-common/es/src/assign.js
|
|
7375
|
-
function validObject(obj) {
|
|
7376
|
-
if (typeof window === "undefined") return true;
|
|
7377
|
-
else return obj !== window && obj !== document;
|
|
7378
|
-
}
|
|
7379
|
-
function assign() {
|
|
7380
|
-
var _arguments = arguments;
|
|
7381
|
-
var target = arguments.length <= 0 ? void 0 : arguments[0];
|
|
7382
|
-
var _loop = function _loop2() {
|
|
7383
|
-
var source = i < 0 || _arguments.length <= i ? void 0 : _arguments[i];
|
|
7384
|
-
if (!isObject_default(source)) return "continue";
|
|
7385
|
-
Object.keys(source).forEach(function(prop) {
|
|
7386
|
-
var value = source[prop];
|
|
7387
|
-
if (isObject_default(value) && validObject(value)) {
|
|
7388
|
-
if (Object.prototype.hasOwnProperty.call(target, prop) && isObject_default(target[prop])) target[prop] = assign({}, target[prop], value);
|
|
7389
|
-
else target[prop] = assign({}, value);
|
|
7390
|
-
} else if (Array.isArray(value)) target[prop] = value.slice();
|
|
7391
|
-
else target[prop] = value;
|
|
7392
|
-
});
|
|
7393
|
-
};
|
|
7394
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
7395
|
-
var _ret = _loop();
|
|
7396
|
-
if (_ret === "continue") continue;
|
|
7397
|
-
}
|
|
7398
|
-
return target;
|
|
7399
|
-
}
|
|
7400
|
-
var assign_default = assign;
|
|
7401
6186
|
var buildCommon = d3plusConfigBuilder.common;
|
|
7402
6187
|
var buildBarchart = d3plusConfigBuilder.barchart;
|
|
7403
6188
|
var buildChoropleth = d3plusConfigBuilder.choropleth;
|
|
@@ -7426,7 +6211,7 @@ function useD3plusConfig(chart, params) {
|
|
|
7426
6211
|
}
|
|
7427
6212
|
if (chart.type === "choropleth") {
|
|
7428
6213
|
const config = buildChoroplethConfig(chart, params2);
|
|
7429
|
-
if (chart.extraConfig.d3plus)
|
|
6214
|
+
if (chart.extraConfig.d3plus) assign(config, chart.extraConfig.d3plus);
|
|
7430
6215
|
return [Geomap, config];
|
|
7431
6216
|
}
|
|
7432
6217
|
if (chart.type === "donut") {
|
|
@@ -7468,9 +6253,6 @@ function buildTreemapConfig(chart, params) {
|
|
|
7468
6253
|
const config = buildTreemap(chart, params);
|
|
7469
6254
|
return config;
|
|
7470
6255
|
}
|
|
7471
|
-
|
|
7472
|
-
// src/vizbuilder/components/ErrorBoundary.tsx
|
|
7473
|
-
init_esm_shims();
|
|
7474
6256
|
var ErrorBoundary = class extends Component {
|
|
7475
6257
|
constructor() {
|
|
7476
6258
|
super(...arguments);
|
|
@@ -7569,7 +6351,7 @@ function ChartCard(props) {
|
|
|
7569
6351
|
const { current: boxElement } = nodeRef;
|
|
7570
6352
|
const svgElement = boxElement == null ? void 0 : boxElement.querySelector("svg");
|
|
7571
6353
|
if (svgElement) {
|
|
7572
|
-
|
|
6354
|
+
saveElement(
|
|
7573
6355
|
svgElement,
|
|
7574
6356
|
{ filename, type: formatLower },
|
|
7575
6357
|
{ background: getBackground(svgElement) }
|
|
@@ -7624,9 +6406,6 @@ var getBackground = (node) => {
|
|
|
7624
6406
|
const color = styles2.getPropertyValue("background-color");
|
|
7625
6407
|
return color && color !== "rgba(0, 0, 0, 0)" && color !== "transparent" ? color : getBackground(node.parentNode);
|
|
7626
6408
|
};
|
|
7627
|
-
|
|
7628
|
-
// src/vizbuilder/components/NonIdealState.tsx
|
|
7629
|
-
init_esm_shims();
|
|
7630
6409
|
function NonIdealState2(props) {
|
|
7631
6410
|
const { status } = props;
|
|
7632
6411
|
const { translate: t } = useTranslation();
|
|
@@ -7706,7 +6485,7 @@ function Vizbuilder(props) {
|
|
|
7706
6485
|
{ minWidth: "lg", cols: 3 },
|
|
7707
6486
|
{ minWidth: "xl", cols: 4 }
|
|
7708
6487
|
],
|
|
7709
|
-
className:
|
|
6488
|
+
className: cls({ unique: isSingleChart })
|
|
7710
6489
|
},
|
|
7711
6490
|
chartList.map((chart) => /* @__PURE__ */ React13__default.createElement(
|
|
7712
6491
|
ChartCard,
|
|
@@ -7747,7 +6526,7 @@ function Vizbuilder(props) {
|
|
|
7747
6526
|
}
|
|
7748
6527
|
);
|
|
7749
6528
|
}, [charts, currentChart, downloadFormats, getMeasureConfig, showConfidenceInt, userConfig]);
|
|
7750
|
-
return /* @__PURE__ */ React13__default.createElement("div", { style: { height: "100%" }, className:
|
|
6529
|
+
return /* @__PURE__ */ React13__default.createElement("div", { style: { height: "100%" }, className: cls("vb-wrapper", props.className) }, props.customHeader, content, props.customFooter, /* @__PURE__ */ React13__default.createElement(
|
|
7751
6530
|
Modal,
|
|
7752
6531
|
{
|
|
7753
6532
|
centered: true,
|
|
@@ -7764,9 +6543,6 @@ function Vizbuilder(props) {
|
|
|
7764
6543
|
focusContent
|
|
7765
6544
|
));
|
|
7766
6545
|
}
|
|
7767
|
-
|
|
7768
|
-
// src/vizbuilder/hooks/useVizbuilderData.ts
|
|
7769
|
-
init_esm_shims();
|
|
7770
6546
|
function useVizbuilderData() {
|
|
7771
6547
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
7772
6548
|
const queryLink = queryItem.link;
|
|
@@ -7775,9 +6551,6 @@ function useVizbuilderData() {
|
|
|
7775
6551
|
});
|
|
7776
6552
|
return query;
|
|
7777
6553
|
}
|
|
7778
|
-
|
|
7779
|
-
// src/components/LoadingOverlay.jsx
|
|
7780
|
-
init_esm_shims();
|
|
7781
6554
|
var LoadingOverlay3 = () => {
|
|
7782
6555
|
const { translate: t } = useTranslation();
|
|
7783
6556
|
const { loading: isLoading, message } = useSelector$1(selectLoadingState);
|
|
@@ -7841,9 +6614,6 @@ function VizbuilderView(props) {
|
|
|
7841
6614
|
}
|
|
7842
6615
|
));
|
|
7843
6616
|
}
|
|
7844
|
-
|
|
7845
|
-
// src/components/RawResponseView.tsx
|
|
7846
|
-
init_esm_shims();
|
|
7847
6617
|
function RawResponseView(props) {
|
|
7848
6618
|
const { result, isLoading, isFetching } = props;
|
|
7849
6619
|
const theme = useMantineTheme();
|
|
@@ -7910,10 +6680,5 @@ function RawResponseView(props) {
|
|
|
7910
6680
|
copied ? "Copied" : "Copy"
|
|
7911
6681
|
)))));
|
|
7912
6682
|
}
|
|
7913
|
-
/*! Bundled license information:
|
|
7914
|
-
|
|
7915
|
-
file-saver/FileSaver.js:
|
|
7916
|
-
(*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js *)
|
|
7917
|
-
*/
|
|
7918
6683
|
|
|
7919
6684
|
export { DebugView, ExplorerComponent as Explorer, PivotView, RawResponseView, SettingsConsumer, TableView, ToolbarButton, TourStep, TranslationConsumer, VizbuilderView, reducer as explorerReducer, thunkExtraArg as explorerThunkExtraArg, defaultTranslation as translationDict, useSettings, useTranslation };
|