@datawheel/data-explorer 1.1.5 → 1.1.7
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 +329 -1547
- 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
|
}
|
|
@@ -1873,301 +1705,36 @@ function parsePermalink(cube, value) {
|
|
|
1873
1705
|
chart: search.get("chart") || "",
|
|
1874
1706
|
params
|
|
1875
1707
|
});
|
|
1876
|
-
}
|
|
1877
|
-
function useUpdateUrl() {
|
|
1878
|
-
const navigate = useNavigate();
|
|
1879
|
-
const queryItem = useSelector(selectCurrentQueryItem);
|
|
1880
|
-
return useCallback(
|
|
1881
|
-
(query) => {
|
|
1882
|
-
const currPermalink = window.location.search.slice(1);
|
|
1883
|
-
const q = query != null ? query : queryItem;
|
|
1884
|
-
const nextPermalink = serializePermalink(q);
|
|
1885
|
-
if (currPermalink !== nextPermalink) {
|
|
1886
|
-
navigate(`?${nextPermalink}`, { replace: true });
|
|
1887
|
-
}
|
|
1888
|
-
},
|
|
1889
|
-
[navigate, queryItem]
|
|
1890
|
-
);
|
|
1891
|
-
}
|
|
1892
|
-
|
|
1893
|
-
// src/state/selectors.ts
|
|
1894
|
-
var selectOlapCube = createSelector(
|
|
1895
|
-
[selectOlapCubeMap, selectCubeName],
|
|
1896
|
-
(cubeMap, cubeName) => cubeName in cubeMap ? cubeMap[cubeName] : void 0
|
|
1897
|
-
);
|
|
1898
|
-
var selectOlapMeasureItems = createSelector(
|
|
1899
|
-
selectOlapCube,
|
|
1900
|
-
(cube) => cube ? cube.measures : []
|
|
1901
|
-
);
|
|
1902
|
-
createSelector(
|
|
1903
|
-
selectOlapMeasureItems,
|
|
1904
|
-
(measures) => Object.fromEntries(measures.map((item) => [item.name, item]))
|
|
1905
|
-
);
|
|
1906
|
-
var selectOlapDimensionItems = createSelector(
|
|
1907
|
-
selectOlapCube,
|
|
1908
|
-
(cube) => !cube ? [] : cube.dimensions.map((dim) => ({
|
|
1909
|
-
item: {
|
|
1910
|
-
...dim,
|
|
1911
|
-
hierarchies: dim.hierarchies.slice().map((hierarchy) => {
|
|
1912
|
-
hierarchy.levels.slice().sort((a, b) => getOrderValue(a) - getOrderValue(b));
|
|
1913
|
-
return hierarchy;
|
|
1914
|
-
}).sort((a, b) => getOrderValue(a) - getOrderValue(b))
|
|
1915
|
-
},
|
|
1916
|
-
count: dim.hierarchies.reduce((acc, hie) => acc + hie.levels.length, 0),
|
|
1917
|
-
alpha: dim.hierarchies.reduce((acc, hie) => acc.concat(hie.name, "-"), "")
|
|
1918
|
-
})).sort(
|
|
1919
|
-
(a, b) => getOrderValue(a.item) - getOrderValue(b.item) || b.count - a.count || a.alpha.localeCompare(b.alpha)
|
|
1920
|
-
).map((i) => i.item)
|
|
1921
|
-
);
|
|
1922
|
-
createSelector(
|
|
1923
|
-
selectOlapDimensionItems,
|
|
1924
|
-
(dimensions) => Object.fromEntries(dimensions.map((item) => [item.name, item]))
|
|
1925
|
-
);
|
|
1926
|
-
var selectLevelTriadMap = createSelector(
|
|
1927
|
-
selectOlapCube,
|
|
1928
|
-
(cube) => cube ? mapDimensionHierarchyLevels(cube) : {}
|
|
1929
|
-
);
|
|
1930
|
-
createSelector(
|
|
1931
|
-
selectOlapDimensionItems,
|
|
1932
|
-
(dimensions) => dimensions.find((d) => d.type === "time" || d.name === "Year" || d.name === "Date")
|
|
1933
|
-
);
|
|
1934
|
-
var selectSerializedParams = createSelector(
|
|
1935
|
-
selectCurrentQueryItem,
|
|
1936
|
-
(queryItem) => serializePermalink(queryItem)
|
|
1937
|
-
);
|
|
1938
|
-
|
|
1939
|
-
// src/utils/format.js
|
|
1940
|
-
init_esm_shims();
|
|
1941
|
-
function abbreviateFullName(nameParts, joint = "/") {
|
|
1942
|
-
if (!nameParts) {
|
|
1943
|
-
return "";
|
|
1944
|
-
}
|
|
1945
|
-
if (typeof nameParts === "string") {
|
|
1946
|
-
nameParts = splitName(nameParts);
|
|
1947
|
-
}
|
|
1948
|
-
const target = [];
|
|
1949
|
-
let n = nameParts.length;
|
|
1950
|
-
while (n--) {
|
|
1951
|
-
const token = nameParts[n];
|
|
1952
|
-
if (target.indexOf(token) === -1) {
|
|
1953
|
-
target.unshift(token);
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
return target.join(joint);
|
|
1957
|
-
}
|
|
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
|
-
var CustomActionIcon = ({
|
|
2033
|
-
disabled,
|
|
2034
|
-
showTooltip,
|
|
2035
|
-
onClick,
|
|
2036
|
-
children,
|
|
2037
|
-
label
|
|
2038
|
-
}) => {
|
|
2039
|
-
const [popoverOpened, setPopoverOpened] = React13__default.useState(false);
|
|
2040
|
-
const actionIcon = /* @__PURE__ */ React13__default.createElement(ActionIcon, { disabled, size: 25, ml: 5, onClick }, children);
|
|
2041
|
-
return showTooltip ? /* @__PURE__ */ React13__default.createElement("div", { onMouseEnter: () => setPopoverOpened(true), onMouseLeave: () => setPopoverOpened(false) }, /* @__PURE__ */ React13__default.createElement(
|
|
2042
|
-
Popover,
|
|
2043
|
-
{
|
|
2044
|
-
width: 200,
|
|
2045
|
-
position: "left",
|
|
2046
|
-
withArrow: true,
|
|
2047
|
-
opened: popoverOpened,
|
|
2048
|
-
styles: (theme) => ({
|
|
2049
|
-
dropdown: {
|
|
2050
|
-
backgroundColor: theme.colors.dark[6],
|
|
2051
|
-
border: `1px solid ${theme.colors.gray[2]}`,
|
|
2052
|
-
borderRadius: theme.radius.sm,
|
|
2053
|
-
padding: theme.spacing.xs,
|
|
2054
|
-
color: theme.white
|
|
2055
|
-
},
|
|
2056
|
-
arrow: {
|
|
2057
|
-
backgroundColor: theme.colors.dark[6]
|
|
2058
|
-
}
|
|
2059
|
-
})
|
|
2060
|
-
},
|
|
2061
|
-
/* @__PURE__ */ React13__default.createElement(Popover.Target, null, actionIcon),
|
|
2062
|
-
/* @__PURE__ */ React13__default.createElement(Popover.Dropdown, null, /* @__PURE__ */ React13__default.createElement(Text, { size: "xs" }, label))
|
|
2063
|
-
)) : actionIcon;
|
|
2064
|
-
};
|
|
2065
|
-
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
|
-
function useSafeDispatch(dispatch) {
|
|
2073
|
-
const mounted = React13.useRef(false);
|
|
2074
|
-
React13.useLayoutEffect(() => {
|
|
2075
|
-
mounted.current = true;
|
|
2076
|
-
return () => {
|
|
2077
|
-
mounted.current = false;
|
|
2078
|
-
};
|
|
2079
|
-
}, []);
|
|
2080
|
-
return React13.useCallback(
|
|
2081
|
-
(...args) => {
|
|
2082
|
-
if (mounted.current) {
|
|
2083
|
-
dispatch(...args);
|
|
2084
|
-
}
|
|
2085
|
-
},
|
|
2086
|
-
[dispatch]
|
|
2087
|
-
);
|
|
2088
|
-
}
|
|
2089
|
-
var defaultInitialState = { status: "idle", data: null, error: null };
|
|
2090
|
-
function useAsync(initialState4) {
|
|
2091
|
-
const initialStateRef = React13.useRef({
|
|
2092
|
-
...defaultInitialState,
|
|
2093
|
-
...initialState4
|
|
2094
|
-
});
|
|
2095
|
-
const [state, dispatch] = React13.useReducer(
|
|
2096
|
-
(state2, action) => {
|
|
2097
|
-
switch (action.type) {
|
|
2098
|
-
case "idle":
|
|
2099
|
-
return { ...state2, status: "idle", data: null, error: null };
|
|
2100
|
-
case "pending":
|
|
2101
|
-
return { ...state2, status: "pending" };
|
|
2102
|
-
case "resolved":
|
|
2103
|
-
return { ...state2, status: "resolved", data: action.data };
|
|
2104
|
-
case "rejected":
|
|
2105
|
-
return { ...state2, status: "rejected", error: action.error };
|
|
2106
|
-
default:
|
|
2107
|
-
return state2;
|
|
2108
|
-
}
|
|
2109
|
-
},
|
|
2110
|
-
initialStateRef.current
|
|
2111
|
-
);
|
|
2112
|
-
const safeDispatch = useSafeDispatch(dispatch);
|
|
2113
|
-
const setData = React13.useCallback(
|
|
2114
|
-
(data) => safeDispatch({ type: "resolved", data }),
|
|
2115
|
-
[safeDispatch]
|
|
2116
|
-
);
|
|
2117
|
-
const setError = React13.useCallback(
|
|
2118
|
-
(error) => safeDispatch({ type: "rejected", error }),
|
|
2119
|
-
[safeDispatch]
|
|
2120
|
-
);
|
|
2121
|
-
const reset = React13.useCallback(() => safeDispatch({ type: "idle" }), [safeDispatch]);
|
|
2122
|
-
const run = React13.useCallback(
|
|
2123
|
-
(promise) => {
|
|
2124
|
-
if (!promise || !promise.then) {
|
|
2125
|
-
throw new Error(
|
|
2126
|
-
"The argument passed to useAsync().run must be a promise. Maybe a function that's passed isn't returning anything?"
|
|
2127
|
-
);
|
|
1708
|
+
}
|
|
1709
|
+
function useUpdateUrl() {
|
|
1710
|
+
const navigate = useNavigate();
|
|
1711
|
+
const queryItem = useSelector(selectCurrentQueryItem);
|
|
1712
|
+
return useCallback(
|
|
1713
|
+
(query) => {
|
|
1714
|
+
const currPermalink = window.location.search.slice(1);
|
|
1715
|
+
const q = query != null ? query : queryItem;
|
|
1716
|
+
const nextPermalink = serializePermalink(q);
|
|
1717
|
+
if (currPermalink !== nextPermalink) {
|
|
1718
|
+
navigate(`?${nextPermalink}`, { replace: true });
|
|
2128
1719
|
}
|
|
2129
|
-
safeDispatch({ type: "pending" });
|
|
2130
|
-
return promise.then(
|
|
2131
|
-
(data) => {
|
|
2132
|
-
setData(data);
|
|
2133
|
-
return data;
|
|
2134
|
-
},
|
|
2135
|
-
(error) => {
|
|
2136
|
-
setError(error);
|
|
2137
|
-
return Promise.reject(error);
|
|
2138
|
-
}
|
|
2139
|
-
);
|
|
2140
1720
|
},
|
|
2141
|
-
[
|
|
1721
|
+
[navigate, queryItem]
|
|
2142
1722
|
);
|
|
2143
|
-
return {
|
|
2144
|
-
isIdle: state.status === "idle",
|
|
2145
|
-
isLoading: state.status === "pending",
|
|
2146
|
-
isError: state.status === "rejected",
|
|
2147
|
-
isSuccess: state.status === "resolved",
|
|
2148
|
-
setData,
|
|
2149
|
-
setError,
|
|
2150
|
-
error: state.error,
|
|
2151
|
-
status: state.status,
|
|
2152
|
-
data: state.data,
|
|
2153
|
-
run,
|
|
2154
|
-
reset
|
|
2155
|
-
};
|
|
2156
1723
|
}
|
|
2157
1724
|
|
|
2158
|
-
// src/components/CubeSource.tsx
|
|
2159
|
-
init_esm_shims();
|
|
2160
|
-
|
|
2161
|
-
// src/hooks/useQueryApi.ts
|
|
2162
|
-
init_esm_shims();
|
|
2163
|
-
|
|
2164
1725
|
// src/state/utils.ts
|
|
2165
|
-
init_esm_shims();
|
|
2166
1726
|
function calcMaxMemberCount(lengths) {
|
|
2167
1727
|
return lengths.reduce((prev, curr) => prev * curr);
|
|
2168
1728
|
}
|
|
2169
|
-
function pickDefaultDrilldowns(dimensions) {
|
|
1729
|
+
function pickDefaultDrilldowns(dimensions, cube) {
|
|
1730
|
+
var _a;
|
|
2170
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
|
+
}
|
|
2171
1738
|
const findDefaultHierarchy = (dim) => dim.hierarchies.find((h) => h.name === dim.default_hierarchy) || dim.hierarchies[0];
|
|
2172
1739
|
for (const dimension of dimensions) {
|
|
2173
1740
|
if (dimension.type === "time" || levels.length < 4) {
|
|
@@ -2176,6 +1743,27 @@ function pickDefaultDrilldowns(dimensions) {
|
|
|
2176
1743
|
levels.push({ ...hierarchy.levels[levelIndex], type: dimension.type });
|
|
2177
1744
|
}
|
|
2178
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
|
+
}
|
|
2179
1767
|
let totalCount = calcMaxMemberCount(levels.map((l) => l.count));
|
|
2180
1768
|
while (totalCount > 5e6) {
|
|
2181
1769
|
const geoIndex = levels.findIndex((level) => level.type === "geo");
|
|
@@ -2330,8 +1918,188 @@ function useFetchQuery(queryParams, queryLink, options) {
|
|
|
2330
1918
|
placeholderData: withoutPagination ? void 0 : keepPreviousData
|
|
2331
1919
|
});
|
|
2332
1920
|
}
|
|
1921
|
+
var selectOlapCube = createSelector(
|
|
1922
|
+
[selectOlapCubeMap, selectCubeName],
|
|
1923
|
+
(cubeMap, cubeName) => cubeName in cubeMap ? cubeMap[cubeName] : void 0
|
|
1924
|
+
);
|
|
1925
|
+
var selectOlapMeasureItems = createSelector(
|
|
1926
|
+
selectOlapCube,
|
|
1927
|
+
(cube) => cube ? cube.measures : []
|
|
1928
|
+
);
|
|
1929
|
+
createSelector(
|
|
1930
|
+
selectOlapMeasureItems,
|
|
1931
|
+
(measures) => Object.fromEntries(measures.map((item) => [item.name, item]))
|
|
1932
|
+
);
|
|
1933
|
+
var selectOlapDimensionItems = createSelector(
|
|
1934
|
+
selectOlapCube,
|
|
1935
|
+
(cube) => !cube ? [] : cube.dimensions.map((dim) => ({
|
|
1936
|
+
item: {
|
|
1937
|
+
...dim,
|
|
1938
|
+
hierarchies: dim.hierarchies.slice().map((hierarchy) => {
|
|
1939
|
+
hierarchy.levels.slice().sort((a, b) => getOrderValue(a) - getOrderValue(b));
|
|
1940
|
+
return hierarchy;
|
|
1941
|
+
}).sort((a, b) => getOrderValue(a) - getOrderValue(b))
|
|
1942
|
+
},
|
|
1943
|
+
count: dim.hierarchies.reduce((acc, hie) => acc + hie.levels.length, 0),
|
|
1944
|
+
alpha: dim.hierarchies.reduce((acc, hie) => acc.concat(hie.name, "-"), "")
|
|
1945
|
+
})).sort(
|
|
1946
|
+
(a, b) => getOrderValue(a.item) - getOrderValue(b.item) || b.count - a.count || a.alpha.localeCompare(b.alpha)
|
|
1947
|
+
).map((i) => i.item)
|
|
1948
|
+
);
|
|
1949
|
+
createSelector(
|
|
1950
|
+
selectOlapDimensionItems,
|
|
1951
|
+
(dimensions) => Object.fromEntries(dimensions.map((item) => [item.name, item]))
|
|
1952
|
+
);
|
|
1953
|
+
var selectLevelTriadMap = createSelector(
|
|
1954
|
+
selectOlapCube,
|
|
1955
|
+
(cube) => cube ? mapDimensionHierarchyLevels(cube) : {}
|
|
1956
|
+
);
|
|
1957
|
+
createSelector(
|
|
1958
|
+
selectOlapDimensionItems,
|
|
1959
|
+
(dimensions) => dimensions.find((d) => d.type === "time" || d.name === "Year" || d.name === "Date")
|
|
1960
|
+
);
|
|
1961
|
+
var selectSerializedParams = createSelector(
|
|
1962
|
+
selectCurrentQueryItem,
|
|
1963
|
+
(queryItem) => serializePermalink(queryItem)
|
|
1964
|
+
);
|
|
2333
1965
|
|
|
2334
|
-
// src/
|
|
1966
|
+
// src/utils/format.js
|
|
1967
|
+
function abbreviateFullName(nameParts, joint = "/") {
|
|
1968
|
+
if (!nameParts) {
|
|
1969
|
+
return "";
|
|
1970
|
+
}
|
|
1971
|
+
if (typeof nameParts === "string") {
|
|
1972
|
+
nameParts = splitName(nameParts);
|
|
1973
|
+
}
|
|
1974
|
+
const target = [];
|
|
1975
|
+
let n = nameParts.length;
|
|
1976
|
+
while (n--) {
|
|
1977
|
+
const token = nameParts[n];
|
|
1978
|
+
if (target.indexOf(token) === -1) {
|
|
1979
|
+
target.unshift(token);
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
return target.join(joint);
|
|
1983
|
+
}
|
|
1984
|
+
var CustomActionIcon = ({
|
|
1985
|
+
disabled,
|
|
1986
|
+
showTooltip,
|
|
1987
|
+
onClick,
|
|
1988
|
+
children,
|
|
1989
|
+
label
|
|
1990
|
+
}) => {
|
|
1991
|
+
const [popoverOpened, setPopoverOpened] = React13__default.useState(false);
|
|
1992
|
+
const actionIcon = /* @__PURE__ */ React13__default.createElement(ActionIcon, { disabled, size: 25, ml: 5, onClick }, children);
|
|
1993
|
+
return showTooltip ? /* @__PURE__ */ React13__default.createElement("div", { onMouseEnter: () => setPopoverOpened(true), onMouseLeave: () => setPopoverOpened(false) }, /* @__PURE__ */ React13__default.createElement(
|
|
1994
|
+
Popover,
|
|
1995
|
+
{
|
|
1996
|
+
width: 200,
|
|
1997
|
+
position: "left",
|
|
1998
|
+
withArrow: true,
|
|
1999
|
+
opened: popoverOpened,
|
|
2000
|
+
styles: (theme) => ({
|
|
2001
|
+
dropdown: {
|
|
2002
|
+
backgroundColor: theme.colors.dark[6],
|
|
2003
|
+
border: `1px solid ${theme.colors.gray[2]}`,
|
|
2004
|
+
borderRadius: theme.radius.sm,
|
|
2005
|
+
padding: theme.spacing.xs,
|
|
2006
|
+
color: theme.white
|
|
2007
|
+
},
|
|
2008
|
+
arrow: {
|
|
2009
|
+
backgroundColor: theme.colors.dark[6]
|
|
2010
|
+
}
|
|
2011
|
+
})
|
|
2012
|
+
},
|
|
2013
|
+
/* @__PURE__ */ React13__default.createElement(Popover.Target, null, actionIcon),
|
|
2014
|
+
/* @__PURE__ */ React13__default.createElement(Popover.Dropdown, null, /* @__PURE__ */ React13__default.createElement(Text, { size: "xs" }, label))
|
|
2015
|
+
)) : actionIcon;
|
|
2016
|
+
};
|
|
2017
|
+
var CustomActionIcon_default = CustomActionIcon;
|
|
2018
|
+
function useSafeDispatch(dispatch) {
|
|
2019
|
+
const mounted = React13.useRef(false);
|
|
2020
|
+
React13.useLayoutEffect(() => {
|
|
2021
|
+
mounted.current = true;
|
|
2022
|
+
return () => {
|
|
2023
|
+
mounted.current = false;
|
|
2024
|
+
};
|
|
2025
|
+
}, []);
|
|
2026
|
+
return React13.useCallback(
|
|
2027
|
+
(...args) => {
|
|
2028
|
+
if (mounted.current) {
|
|
2029
|
+
dispatch(...args);
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
[dispatch]
|
|
2033
|
+
);
|
|
2034
|
+
}
|
|
2035
|
+
var defaultInitialState = { status: "idle", data: null, error: null };
|
|
2036
|
+
function useAsync(initialState4) {
|
|
2037
|
+
const initialStateRef = React13.useRef({
|
|
2038
|
+
...defaultInitialState,
|
|
2039
|
+
...initialState4
|
|
2040
|
+
});
|
|
2041
|
+
const [state, dispatch] = React13.useReducer(
|
|
2042
|
+
(state2, action) => {
|
|
2043
|
+
switch (action.type) {
|
|
2044
|
+
case "idle":
|
|
2045
|
+
return { ...state2, status: "idle", data: null, error: null };
|
|
2046
|
+
case "pending":
|
|
2047
|
+
return { ...state2, status: "pending" };
|
|
2048
|
+
case "resolved":
|
|
2049
|
+
return { ...state2, status: "resolved", data: action.data };
|
|
2050
|
+
case "rejected":
|
|
2051
|
+
return { ...state2, status: "rejected", error: action.error };
|
|
2052
|
+
default:
|
|
2053
|
+
return state2;
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
initialStateRef.current
|
|
2057
|
+
);
|
|
2058
|
+
const safeDispatch = useSafeDispatch(dispatch);
|
|
2059
|
+
const setData = React13.useCallback(
|
|
2060
|
+
(data) => safeDispatch({ type: "resolved", data }),
|
|
2061
|
+
[safeDispatch]
|
|
2062
|
+
);
|
|
2063
|
+
const setError = React13.useCallback(
|
|
2064
|
+
(error) => safeDispatch({ type: "rejected", error }),
|
|
2065
|
+
[safeDispatch]
|
|
2066
|
+
);
|
|
2067
|
+
const reset = React13.useCallback(() => safeDispatch({ type: "idle" }), [safeDispatch]);
|
|
2068
|
+
const run = React13.useCallback(
|
|
2069
|
+
(promise) => {
|
|
2070
|
+
if (!promise || !promise.then) {
|
|
2071
|
+
throw new Error(
|
|
2072
|
+
"The argument passed to useAsync().run must be a promise. Maybe a function that's passed isn't returning anything?"
|
|
2073
|
+
);
|
|
2074
|
+
}
|
|
2075
|
+
safeDispatch({ type: "pending" });
|
|
2076
|
+
return promise.then(
|
|
2077
|
+
(data) => {
|
|
2078
|
+
setData(data);
|
|
2079
|
+
return data;
|
|
2080
|
+
},
|
|
2081
|
+
(error) => {
|
|
2082
|
+
setError(error);
|
|
2083
|
+
return Promise.reject(error);
|
|
2084
|
+
}
|
|
2085
|
+
);
|
|
2086
|
+
},
|
|
2087
|
+
[safeDispatch, setData, setError]
|
|
2088
|
+
);
|
|
2089
|
+
return {
|
|
2090
|
+
isIdle: state.status === "idle",
|
|
2091
|
+
isLoading: state.status === "pending",
|
|
2092
|
+
isError: state.status === "rejected",
|
|
2093
|
+
isSuccess: state.status === "resolved",
|
|
2094
|
+
setData,
|
|
2095
|
+
setError,
|
|
2096
|
+
error: state.error,
|
|
2097
|
+
status: state.status,
|
|
2098
|
+
data: state.data,
|
|
2099
|
+
run,
|
|
2100
|
+
reset
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
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
|
}
|
|
@@ -3922,11 +3685,28 @@ function NumberInputComponent({ text, filter }) {
|
|
|
3922
3685
|
}
|
|
3923
3686
|
var MinMax = ({ filter, hideControls, ...rest }) => {
|
|
3924
3687
|
const actions2 = useActions();
|
|
3688
|
+
const updateUrl = useUpdateUrl();
|
|
3689
|
+
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
3690
|
+
const debouncedUpdateUrl = useMemo(
|
|
3691
|
+
() => debounce((query) => {
|
|
3692
|
+
updateUrl(query);
|
|
3693
|
+
}, 1e3),
|
|
3694
|
+
[]
|
|
3695
|
+
);
|
|
3696
|
+
useEffect(() => {
|
|
3697
|
+
return () => {
|
|
3698
|
+
debouncedUpdateUrl.cancel();
|
|
3699
|
+
};
|
|
3700
|
+
}, [debouncedUpdateUrl]);
|
|
3925
3701
|
function onInputChangeMinMax(props) {
|
|
3926
3702
|
const { filter: filter2, min: min2, max: max2 } = props;
|
|
3927
3703
|
const conditions = getFiltersConditions(getFilterFn(filter2) || "greaterThan", [Number(min2), Number(max2)]) || {};
|
|
3928
3704
|
const active = Boolean(min2) && Boolean(max2);
|
|
3929
|
-
|
|
3705
|
+
const newFilter = buildFilter({ ...filter2, active, ...conditions });
|
|
3706
|
+
actions2.updateFilter(newFilter);
|
|
3707
|
+
const newQuery = buildQuery(cloneDeep(queryItem));
|
|
3708
|
+
newQuery.params.filters[filter2.key] = newFilter;
|
|
3709
|
+
debouncedUpdateUrl(newQuery);
|
|
3930
3710
|
}
|
|
3931
3711
|
function getFilterValue(condition) {
|
|
3932
3712
|
if (condition) {
|
|
@@ -4077,9 +3857,6 @@ var getIconForDimensionType = (dimensionType) => {
|
|
|
4077
3857
|
}
|
|
4078
3858
|
};
|
|
4079
3859
|
var DrawerMenu_default = AddColumnsDrawer;
|
|
4080
|
-
|
|
4081
|
-
// src/components/ExplorerTabs.tsx
|
|
4082
|
-
init_esm_shims();
|
|
4083
3860
|
var tabsStyles = (t) => ({
|
|
4084
3861
|
root: {
|
|
4085
3862
|
alignSelf: "flex-end"
|
|
@@ -4114,9 +3891,6 @@ function ExplorerTabs({
|
|
|
4114
3891
|
/* @__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
3892
|
);
|
|
4116
3893
|
}
|
|
4117
|
-
|
|
4118
|
-
// src/components/PreviewModeSwitch.jsx
|
|
4119
|
-
init_esm_shims();
|
|
4120
3894
|
var PreviewModeSwitch = (props) => {
|
|
4121
3895
|
const withTooltip = !!props.withTooltip;
|
|
4122
3896
|
const actions2 = useActions();
|
|
@@ -4156,9 +3930,6 @@ var PreviewModeSwitch = (props) => {
|
|
|
4156
3930
|
/* @__PURE__ */ React13__default.createElement("div", null, target)
|
|
4157
3931
|
);
|
|
4158
3932
|
};
|
|
4159
|
-
|
|
4160
|
-
// src/components/Toolbar.tsx
|
|
4161
|
-
init_esm_shims();
|
|
4162
3933
|
var toolbarSx = (t) => ({
|
|
4163
3934
|
background: t.colorScheme === "dark" ? t.black : t.white,
|
|
4164
3935
|
borderRadius: t.radius.xl,
|
|
@@ -4224,9 +3995,6 @@ function Toolbar({
|
|
|
4224
3995
|
);
|
|
4225
3996
|
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
3997
|
}
|
|
4227
|
-
|
|
4228
|
-
// src/context/query.tsx
|
|
4229
|
-
init_esm_shims();
|
|
4230
3998
|
var QueryContext = createContext(void 0);
|
|
4231
3999
|
function QueryProvider({ children, defaultCube }) {
|
|
4232
4000
|
const { tesseract } = useLogicLayer();
|
|
@@ -4353,7 +4121,7 @@ function QueryProvider({ children, defaultCube }) {
|
|
|
4353
4121
|
}
|
|
4354
4122
|
};
|
|
4355
4123
|
function setDefaultValues(cube) {
|
|
4356
|
-
const drilldowns = pickDefaultDrilldowns(cube.dimensions).map(
|
|
4124
|
+
const drilldowns = pickDefaultDrilldowns(cube.dimensions, cube).map(
|
|
4357
4125
|
(level) => buildDrilldown({
|
|
4358
4126
|
...level,
|
|
4359
4127
|
key: level.name,
|
|
@@ -4585,12 +4353,6 @@ function SuccessResult(props) {
|
|
|
4585
4353
|
)
|
|
4586
4354
|
);
|
|
4587
4355
|
}
|
|
4588
|
-
|
|
4589
|
-
// src/components/SideBar.tsx
|
|
4590
|
-
init_esm_shims();
|
|
4591
|
-
|
|
4592
|
-
// src/utils/create-context.ts
|
|
4593
|
-
init_esm_shims();
|
|
4594
4356
|
var createContext4 = (name4) => {
|
|
4595
4357
|
const Context = React13__default.createContext(void 0);
|
|
4596
4358
|
const useContext4 = () => {
|
|
@@ -4602,12 +4364,6 @@ var createContext4 = (name4) => {
|
|
|
4602
4364
|
};
|
|
4603
4365
|
return [useContext4, Context.Provider];
|
|
4604
4366
|
};
|
|
4605
|
-
|
|
4606
|
-
// src/hooks/buildGraph.tsx
|
|
4607
|
-
init_esm_shims();
|
|
4608
|
-
|
|
4609
|
-
// src/utils/graph.js
|
|
4610
|
-
init_esm_shims();
|
|
4611
4367
|
var Graph = class {
|
|
4612
4368
|
constructor() {
|
|
4613
4369
|
this.nodes = /* @__PURE__ */ new Set([]);
|
|
@@ -4782,9 +4538,6 @@ function useBuildGraph(locale) {
|
|
|
4782
4538
|
}, [items, locale]);
|
|
4783
4539
|
return graph;
|
|
4784
4540
|
}
|
|
4785
|
-
|
|
4786
|
-
// src/hooks/cubeSearch.tsx
|
|
4787
|
-
init_esm_shims();
|
|
4788
4541
|
function useCubeSearch(graph, input, locale) {
|
|
4789
4542
|
const results = useMemo(() => {
|
|
4790
4543
|
if (graph.items.length > 0) {
|
|
@@ -5003,12 +4756,6 @@ function CubeSearchInput(props) {
|
|
|
5003
4756
|
}
|
|
5004
4757
|
);
|
|
5005
4758
|
}
|
|
5006
|
-
|
|
5007
|
-
// src/components/SelectCubes.tsx
|
|
5008
|
-
init_esm_shims();
|
|
5009
|
-
|
|
5010
|
-
// src/components/Results.tsx
|
|
5011
|
-
init_esm_shims();
|
|
5012
4759
|
function Results(props) {
|
|
5013
4760
|
const { graph, selectedItem, locale, getCube: getCube2, isSelected: isSelected2 } = props;
|
|
5014
4761
|
const { classes } = useStyles3();
|
|
@@ -5340,12 +5087,6 @@ function ExplorerContent(props) {
|
|
|
5340
5087
|
}
|
|
5341
5088
|
)));
|
|
5342
5089
|
}
|
|
5343
|
-
|
|
5344
|
-
// src/components/PivotView.tsx
|
|
5345
|
-
init_esm_shims();
|
|
5346
|
-
|
|
5347
|
-
// src/vizbuilder/hooks/usePivotTableData.ts
|
|
5348
|
-
init_esm_shims();
|
|
5349
5090
|
function usePivotTableData() {
|
|
5350
5091
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
5351
5092
|
const queryLink = queryItem.link;
|
|
@@ -5355,17 +5096,7 @@ function usePivotTableData() {
|
|
|
5355
5096
|
return query;
|
|
5356
5097
|
}
|
|
5357
5098
|
|
|
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
5099
|
// src/utils/workerify.ts
|
|
5368
|
-
init_esm_shims();
|
|
5369
5100
|
var SCRIPT_TYPE = "application/javascript";
|
|
5370
5101
|
var Worker = typeof window === "object" ? window.Worker : null;
|
|
5371
5102
|
if (Worker) {
|
|
@@ -5473,11 +5204,11 @@ function shimWorker(fn) {
|
|
|
5473
5204
|
}
|
|
5474
5205
|
|
|
5475
5206
|
// src/utils/pivot.worker.js
|
|
5476
|
-
var pivot_worker_default = shimWorker((
|
|
5477
|
-
|
|
5207
|
+
var pivot_worker_default = shimWorker((self) => {
|
|
5208
|
+
self.onmessage = function(e) {
|
|
5478
5209
|
const { data, sides } = e.data;
|
|
5479
5210
|
const result = serializeTidyToArrays(data, sides);
|
|
5480
|
-
|
|
5211
|
+
self.postMessage(result);
|
|
5481
5212
|
};
|
|
5482
5213
|
const serializeTidyToArrays = new Function("data", "sides", `
|
|
5483
5214
|
const {valProp} = sides;
|
|
@@ -5616,9 +5347,6 @@ function serializeToArray(data, sides) {
|
|
|
5616
5347
|
}
|
|
5617
5348
|
});
|
|
5618
5349
|
}
|
|
5619
|
-
|
|
5620
|
-
// src/components/ButtonDownload.jsx
|
|
5621
|
-
init_esm_shims();
|
|
5622
5350
|
var mimeTypes2 = {
|
|
5623
5351
|
csv: "text/csv",
|
|
5624
5352
|
json: "application/json",
|
|
@@ -5661,9 +5389,6 @@ var ButtonDownload2 = (props) => {
|
|
|
5661
5389
|
/* @__PURE__ */ React13__default.createElement(Text, { fz: "xs" }, props.children)
|
|
5662
5390
|
);
|
|
5663
5391
|
};
|
|
5664
|
-
|
|
5665
|
-
// src/components/NonIdealState.jsx
|
|
5666
|
-
init_esm_shims();
|
|
5667
5392
|
var NonIdealState = (props) => /* @__PURE__ */ React13__default.createElement(
|
|
5668
5393
|
Center,
|
|
5669
5394
|
{
|
|
@@ -6020,30 +5745,15 @@ function PivotView(props) {
|
|
|
6020
5745
|
}
|
|
6021
5746
|
);
|
|
6022
5747
|
}
|
|
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
5748
|
function FirstStep({ introImage }) {
|
|
6033
5749
|
const { translate: t } = useTranslation();
|
|
6034
5750
|
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
5751
|
}
|
|
6036
|
-
|
|
6037
|
-
// src/components/tour/TourStep.tsx
|
|
6038
|
-
init_esm_shims();
|
|
6039
5752
|
function TourStep(props) {
|
|
6040
5753
|
const { title, texts } = props;
|
|
6041
5754
|
const paragraphs = Array.isArray(texts) ? texts : [texts];
|
|
6042
5755
|
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
5756
|
}
|
|
6044
|
-
|
|
6045
|
-
// src/components/tour/LastStep.tsx
|
|
6046
|
-
init_esm_shims();
|
|
6047
5757
|
function LastStep({ t }) {
|
|
6048
5758
|
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
5759
|
}
|
|
@@ -6311,9 +6021,6 @@ function ExplorerTour({ children, tourConfig }) {
|
|
|
6311
6021
|
children
|
|
6312
6022
|
);
|
|
6313
6023
|
}
|
|
6314
|
-
|
|
6315
|
-
// src/context/index.tsx
|
|
6316
|
-
init_esm_shims();
|
|
6317
6024
|
var queryClient = new QueryClient();
|
|
6318
6025
|
function AppProviders({ children }) {
|
|
6319
6026
|
const { serverURL, defaultCube, serverConfig, defaultDataLocale, defaultLocale } = useSettings();
|
|
@@ -6446,14 +6153,7 @@ function ExplorerComponent(props) {
|
|
|
6446
6153
|
}
|
|
6447
6154
|
ExplorerComponent.displayName = "TesseractExplorer";
|
|
6448
6155
|
|
|
6449
|
-
// src/vizbuilder/index.ts
|
|
6450
|
-
init_esm_shims();
|
|
6451
|
-
|
|
6452
|
-
// src/vizbuilder/components/VizbuilderView.tsx
|
|
6453
|
-
init_esm_shims();
|
|
6454
|
-
|
|
6455
6156
|
// src/vizbuilder/tooling/columns.ts
|
|
6456
|
-
init_esm_shims();
|
|
6457
6157
|
function buildColumn(cube, name4, columns) {
|
|
6458
6158
|
const nameWithoutID = name4.replace(/\sID$/, "");
|
|
6459
6159
|
const nameWithID = `${nameWithoutID} ID`;
|
|
@@ -6500,904 +6200,6 @@ function buildColumn(cube, name4, columns) {
|
|
|
6500
6200
|
}
|
|
6501
6201
|
throw new Error(`Missing entity in cube '${cube.name}': ${nameWithoutID}`);
|
|
6502
6202
|
}
|
|
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
6203
|
var buildCommon = d3plusConfigBuilder.common;
|
|
7402
6204
|
var buildBarchart = d3plusConfigBuilder.barchart;
|
|
7403
6205
|
var buildChoropleth = d3plusConfigBuilder.choropleth;
|
|
@@ -7426,7 +6228,7 @@ function useD3plusConfig(chart, params) {
|
|
|
7426
6228
|
}
|
|
7427
6229
|
if (chart.type === "choropleth") {
|
|
7428
6230
|
const config = buildChoroplethConfig(chart, params2);
|
|
7429
|
-
if (chart.extraConfig.d3plus)
|
|
6231
|
+
if (chart.extraConfig.d3plus) assign(config, chart.extraConfig.d3plus);
|
|
7430
6232
|
return [Geomap, config];
|
|
7431
6233
|
}
|
|
7432
6234
|
if (chart.type === "donut") {
|
|
@@ -7468,9 +6270,6 @@ function buildTreemapConfig(chart, params) {
|
|
|
7468
6270
|
const config = buildTreemap(chart, params);
|
|
7469
6271
|
return config;
|
|
7470
6272
|
}
|
|
7471
|
-
|
|
7472
|
-
// src/vizbuilder/components/ErrorBoundary.tsx
|
|
7473
|
-
init_esm_shims();
|
|
7474
6273
|
var ErrorBoundary = class extends Component {
|
|
7475
6274
|
constructor() {
|
|
7476
6275
|
super(...arguments);
|
|
@@ -7569,7 +6368,7 @@ function ChartCard(props) {
|
|
|
7569
6368
|
const { current: boxElement } = nodeRef;
|
|
7570
6369
|
const svgElement = boxElement == null ? void 0 : boxElement.querySelector("svg");
|
|
7571
6370
|
if (svgElement) {
|
|
7572
|
-
|
|
6371
|
+
saveElement(
|
|
7573
6372
|
svgElement,
|
|
7574
6373
|
{ filename, type: formatLower },
|
|
7575
6374
|
{ background: getBackground(svgElement) }
|
|
@@ -7624,9 +6423,6 @@ var getBackground = (node) => {
|
|
|
7624
6423
|
const color = styles2.getPropertyValue("background-color");
|
|
7625
6424
|
return color && color !== "rgba(0, 0, 0, 0)" && color !== "transparent" ? color : getBackground(node.parentNode);
|
|
7626
6425
|
};
|
|
7627
|
-
|
|
7628
|
-
// src/vizbuilder/components/NonIdealState.tsx
|
|
7629
|
-
init_esm_shims();
|
|
7630
6426
|
function NonIdealState2(props) {
|
|
7631
6427
|
const { status } = props;
|
|
7632
6428
|
const { translate: t } = useTranslation();
|
|
@@ -7706,7 +6502,7 @@ function Vizbuilder(props) {
|
|
|
7706
6502
|
{ minWidth: "lg", cols: 3 },
|
|
7707
6503
|
{ minWidth: "xl", cols: 4 }
|
|
7708
6504
|
],
|
|
7709
|
-
className:
|
|
6505
|
+
className: cls({ unique: isSingleChart })
|
|
7710
6506
|
},
|
|
7711
6507
|
chartList.map((chart) => /* @__PURE__ */ React13__default.createElement(
|
|
7712
6508
|
ChartCard,
|
|
@@ -7747,7 +6543,7 @@ function Vizbuilder(props) {
|
|
|
7747
6543
|
}
|
|
7748
6544
|
);
|
|
7749
6545
|
}, [charts, currentChart, downloadFormats, getMeasureConfig, showConfidenceInt, userConfig]);
|
|
7750
|
-
return /* @__PURE__ */ React13__default.createElement("div", { style: { height: "100%" }, className:
|
|
6546
|
+
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
6547
|
Modal,
|
|
7752
6548
|
{
|
|
7753
6549
|
centered: true,
|
|
@@ -7764,9 +6560,6 @@ function Vizbuilder(props) {
|
|
|
7764
6560
|
focusContent
|
|
7765
6561
|
));
|
|
7766
6562
|
}
|
|
7767
|
-
|
|
7768
|
-
// src/vizbuilder/hooks/useVizbuilderData.ts
|
|
7769
|
-
init_esm_shims();
|
|
7770
6563
|
function useVizbuilderData() {
|
|
7771
6564
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
7772
6565
|
const queryLink = queryItem.link;
|
|
@@ -7775,9 +6568,6 @@ function useVizbuilderData() {
|
|
|
7775
6568
|
});
|
|
7776
6569
|
return query;
|
|
7777
6570
|
}
|
|
7778
|
-
|
|
7779
|
-
// src/components/LoadingOverlay.jsx
|
|
7780
|
-
init_esm_shims();
|
|
7781
6571
|
var LoadingOverlay3 = () => {
|
|
7782
6572
|
const { translate: t } = useTranslation();
|
|
7783
6573
|
const { loading: isLoading, message } = useSelector$1(selectLoadingState);
|
|
@@ -7841,9 +6631,6 @@ function VizbuilderView(props) {
|
|
|
7841
6631
|
}
|
|
7842
6632
|
));
|
|
7843
6633
|
}
|
|
7844
|
-
|
|
7845
|
-
// src/components/RawResponseView.tsx
|
|
7846
|
-
init_esm_shims();
|
|
7847
6634
|
function RawResponseView(props) {
|
|
7848
6635
|
const { result, isLoading, isFetching } = props;
|
|
7849
6636
|
const theme = useMantineTheme();
|
|
@@ -7910,10 +6697,5 @@ function RawResponseView(props) {
|
|
|
7910
6697
|
copied ? "Copied" : "Copy"
|
|
7911
6698
|
)))));
|
|
7912
6699
|
}
|
|
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
6700
|
|
|
7919
6701
|
export { DebugView, ExplorerComponent as Explorer, PivotView, RawResponseView, SettingsConsumer, TableView, ToolbarButton, TourStep, TranslationConsumer, VizbuilderView, reducer as explorerReducer, thunkExtraArg as explorerThunkExtraArg, defaultTranslation as translationDict, useSettings, useTranslation };
|