@meridian-ui/meridian 1.0.5 → 1.1.0
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/cjs/index.cjs +281 -95
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/meridian.css +1 -1
- package/dist/esm/index.js +273 -87
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/meridian.css +1 -1
- package/dist/index.d.ts +9 -0
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var reactGoogleMaps = require('@vis.gl/react-google-maps');
|
|
6
6
|
|
|
@@ -105,15 +105,15 @@ var hasRequiredUseSyncExternalStoreShim_production;
|
|
|
105
105
|
function requireUseSyncExternalStoreShim_production () {
|
|
106
106
|
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
107
107
|
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
108
|
-
var React =
|
|
108
|
+
var React$1 = React;
|
|
109
109
|
function is(x, y) {
|
|
110
110
|
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
111
111
|
}
|
|
112
112
|
var objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
113
|
-
useState = React.useState,
|
|
114
|
-
useEffect = React.useEffect,
|
|
115
|
-
useLayoutEffect = React.useLayoutEffect,
|
|
116
|
-
useDebugValue = React.useDebugValue;
|
|
113
|
+
useState = React$1.useState,
|
|
114
|
+
useEffect = React$1.useEffect,
|
|
115
|
+
useLayoutEffect = React$1.useLayoutEffect,
|
|
116
|
+
useDebugValue = React$1.useDebugValue;
|
|
117
117
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
118
118
|
var value = getSnapshot(),
|
|
119
119
|
_useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
|
|
@@ -159,7 +159,7 @@ function requireUseSyncExternalStoreShim_production () {
|
|
|
159
159
|
? useSyncExternalStore$1
|
|
160
160
|
: useSyncExternalStore$2;
|
|
161
161
|
useSyncExternalStoreShim_production.useSyncExternalStore =
|
|
162
|
-
void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
162
|
+
void 0 !== React$1.useSyncExternalStore ? React$1.useSyncExternalStore : shim;
|
|
163
163
|
return useSyncExternalStoreShim_production;
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -187,7 +187,7 @@ function requireUseSyncExternalStoreShim_development () {
|
|
|
187
187
|
}
|
|
188
188
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
189
189
|
didWarnOld18Alpha ||
|
|
190
|
-
void 0 === React.startTransition ||
|
|
190
|
+
void 0 === React$1.startTransition ||
|
|
191
191
|
((didWarnOld18Alpha = true),
|
|
192
192
|
console.error(
|
|
193
193
|
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
@@ -243,12 +243,12 @@ function requireUseSyncExternalStoreShim_development () {
|
|
|
243
243
|
"function" ===
|
|
244
244
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
|
|
245
245
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
246
|
-
var React =
|
|
246
|
+
var React$1 = React,
|
|
247
247
|
objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
248
|
-
useState = React.useState,
|
|
249
|
-
useEffect = React.useEffect,
|
|
250
|
-
useLayoutEffect = React.useLayoutEffect,
|
|
251
|
-
useDebugValue = React.useDebugValue,
|
|
248
|
+
useState = React$1.useState,
|
|
249
|
+
useEffect = React$1.useEffect,
|
|
250
|
+
useLayoutEffect = React$1.useLayoutEffect,
|
|
251
|
+
useDebugValue = React$1.useDebugValue,
|
|
252
252
|
didWarnOld18Alpha = false,
|
|
253
253
|
didWarnUncachedGetSnapshot = false,
|
|
254
254
|
shim =
|
|
@@ -258,7 +258,7 @@ function requireUseSyncExternalStoreShim_development () {
|
|
|
258
258
|
? useSyncExternalStore$1
|
|
259
259
|
: useSyncExternalStore$2;
|
|
260
260
|
useSyncExternalStoreShim_development.useSyncExternalStore =
|
|
261
|
-
void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
261
|
+
void 0 !== React$1.useSyncExternalStore ? React$1.useSyncExternalStore : shim;
|
|
262
262
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
|
|
263
263
|
"function" ===
|
|
264
264
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
|
|
@@ -296,17 +296,17 @@ var hasRequiredWithSelector_production;
|
|
|
296
296
|
function requireWithSelector_production () {
|
|
297
297
|
if (hasRequiredWithSelector_production) return withSelector_production;
|
|
298
298
|
hasRequiredWithSelector_production = 1;
|
|
299
|
-
var React =
|
|
299
|
+
var React$1 = React,
|
|
300
300
|
shim = requireShim();
|
|
301
301
|
function is(x, y) {
|
|
302
302
|
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
|
|
303
303
|
}
|
|
304
304
|
var objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
305
305
|
useSyncExternalStore = shim.useSyncExternalStore,
|
|
306
|
-
useRef = React.useRef,
|
|
307
|
-
useEffect = React.useEffect,
|
|
308
|
-
useMemo = React.useMemo,
|
|
309
|
-
useDebugValue = React.useDebugValue;
|
|
306
|
+
useRef = React$1.useRef,
|
|
307
|
+
useEffect = React$1.useEffect,
|
|
308
|
+
useMemo = React$1.useMemo,
|
|
309
|
+
useDebugValue = React$1.useDebugValue;
|
|
310
310
|
withSelector_production.useSyncExternalStoreWithSelector = function (
|
|
311
311
|
subscribe,
|
|
312
312
|
getSnapshot,
|
|
@@ -399,14 +399,14 @@ function requireWithSelector_development () {
|
|
|
399
399
|
"function" ===
|
|
400
400
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
|
|
401
401
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
402
|
-
var React =
|
|
402
|
+
var React$1 = React,
|
|
403
403
|
shim = requireShim(),
|
|
404
404
|
objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
405
405
|
useSyncExternalStore = shim.useSyncExternalStore,
|
|
406
|
-
useRef = React.useRef,
|
|
407
|
-
useEffect = React.useEffect,
|
|
408
|
-
useMemo = React.useMemo,
|
|
409
|
-
useDebugValue = React.useDebugValue;
|
|
406
|
+
useRef = React$1.useRef,
|
|
407
|
+
useEffect = React$1.useEffect,
|
|
408
|
+
useMemo = React$1.useMemo,
|
|
409
|
+
useDebugValue = React$1.useDebugValue;
|
|
410
410
|
withSelector_development.useSyncExternalStoreWithSelector = function (
|
|
411
411
|
subscribe,
|
|
412
412
|
getSnapshot,
|
|
@@ -496,7 +496,7 @@ function requireWithSelector () {
|
|
|
496
496
|
var withSelectorExports = requireWithSelector();
|
|
497
497
|
var useSyncExternalStoreExports = /*@__PURE__*/getDefaultExportFromCjs(withSelectorExports);
|
|
498
498
|
|
|
499
|
-
const { useDebugValue } =
|
|
499
|
+
const { useDebugValue } = React;
|
|
500
500
|
const { useSyncExternalStoreWithSelector } = useSyncExternalStoreExports;
|
|
501
501
|
let didWarnAboutEqualityFn = false;
|
|
502
502
|
const identity = (arg) => arg;
|
|
@@ -1138,7 +1138,7 @@ var Attribute = function (_a) {
|
|
|
1138
1138
|
.map(function (attributeSet, index) { return (jsxRuntime.jsx(Attribute, { className: classNameString, options: options, attribute: attributeSet, children: children }, index)); }) }));
|
|
1139
1139
|
}
|
|
1140
1140
|
else if (attribute.type === "element" ||
|
|
1141
|
-
|
|
1141
|
+
React.isValidElement(attribute.value)) {
|
|
1142
1142
|
return (jsxRuntime.jsx("div", { className: classNameString, style: styleObject, children: attribute.value }));
|
|
1143
1143
|
}
|
|
1144
1144
|
else if (attribute.type === "image") {
|
|
@@ -1910,66 +1910,133 @@ var uuid = function () {
|
|
|
1910
1910
|
});
|
|
1911
1911
|
};
|
|
1912
1912
|
|
|
1913
|
-
var
|
|
1914
|
-
var
|
|
1915
|
-
var
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1913
|
+
var MalleabilityOvervewTabs = function () {
|
|
1914
|
+
var _a, _b, _c, _d, _e;
|
|
1915
|
+
var _f = useODI(), odi = _f.odi, activeOverview = _f.activeOverview, setActiveOverview = _f.setActiveOverview, addNewOverview = _f.addNewOverview, removeOverview = _f.removeOverview, setLayoutOverview = _f.setLayoutOverview, setMalleabilityConsoleOpen = _f.setMalleabilityConsoleOpen, customLayouts = _f.customLayouts, highlightAttributes = _f.highlightAttributes, setHighlightAttributes = _f.setHighlightAttributes, enabledMalleableContent = _f.enabledMalleableContent;
|
|
1916
|
+
var _g = React.useState(null), hoveredOverview = _g[0], setHoveredOverview = _g[1];
|
|
1917
|
+
var _h = React.useState("tabs"), viewMode = _h[0]; _h[1];
|
|
1918
|
+
var _j = React.useState(false); _j[0]; _j[1];
|
|
1919
|
+
var _k = React.useState(false), showOverviewLayoutsDropdown = _k[0], setShowOverviewLayoutsDropdown = _k[1];
|
|
1920
|
+
var overviewLayoutsDropdownRef = React.useRef(null);
|
|
1921
|
+
// Close overview layouts dropdown when clicking outside
|
|
1922
|
+
React.useEffect(function () {
|
|
1920
1923
|
var handleClickOutside = function (event) {
|
|
1921
|
-
if (
|
|
1922
|
-
!
|
|
1923
|
-
|
|
1924
|
+
if (overviewLayoutsDropdownRef.current &&
|
|
1925
|
+
!overviewLayoutsDropdownRef.current.contains(event.target)) {
|
|
1926
|
+
setShowOverviewLayoutsDropdown(false);
|
|
1924
1927
|
}
|
|
1925
1928
|
};
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
+
if (showOverviewLayoutsDropdown) {
|
|
1930
|
+
document.addEventListener("mouseup", handleClickOutside);
|
|
1931
|
+
}
|
|
1929
1932
|
return function () {
|
|
1930
1933
|
document.removeEventListener("mouseup", handleClickOutside);
|
|
1931
1934
|
};
|
|
1932
|
-
}, []);
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
var
|
|
1943
|
-
|
|
1944
|
-
var
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1935
|
+
}, [showOverviewLayoutsDropdown]);
|
|
1936
|
+
// Default layouts (hardcoded)
|
|
1937
|
+
var defaultLayoutTypes = ["list", "grid", "table", "map"];
|
|
1938
|
+
// Get all available overview types from the map
|
|
1939
|
+
var allOverviewTypes = Object.keys(overviewTypesMap);
|
|
1940
|
+
// Get custom layout IDs from UI (stored in localStorage)
|
|
1941
|
+
var uiCustomLayoutIds = (customLayouts === null || customLayouts === void 0 ? void 0 : customLayouts.map(function (l) { return l.id; })) || [];
|
|
1942
|
+
// Separate default layouts from custom overview types
|
|
1943
|
+
var defaultLayouts = allOverviewTypes.filter(function (type) { return defaultLayoutTypes.includes(type); });
|
|
1944
|
+
// Custom overview types from config (exclude UI-created ones to avoid duplicates)
|
|
1945
|
+
var configCustomOverviewTypes = allOverviewTypes.filter(function (type) { return !defaultLayoutTypes.includes(type) && !uiCustomLayoutIds.includes(type); });
|
|
1946
|
+
// Get icon for overview type (matching HTML toolbar icons)
|
|
1947
|
+
var getOverviewIcon = function (type) {
|
|
1948
|
+
switch (type) {
|
|
1949
|
+
case "map":
|
|
1950
|
+
return (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: jsxRuntime.jsx("path", { d: "M2 4L6 2L10 4L14 2V12L10 14L6 12L2 14V4Z", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }) }));
|
|
1951
|
+
case "grid":
|
|
1952
|
+
return (jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [jsxRuntime.jsx("rect", { x: "2", y: "2", width: "5", height: "5", rx: "1", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntime.jsx("rect", { x: "9", y: "2", width: "5", height: "5", rx: "1", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntime.jsx("rect", { x: "2", y: "9", width: "5", height: "5", rx: "1", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntime.jsx("rect", { x: "9", y: "9", width: "5", height: "5", rx: "1", stroke: "currentColor", strokeWidth: "1.5" })] }));
|
|
1953
|
+
case "list":
|
|
1954
|
+
return (jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [jsxRuntime.jsx("rect", { x: "2", y: "3", width: "12", height: "2", rx: "1", fill: "currentColor" }), jsxRuntime.jsx("rect", { x: "2", y: "7", width: "12", height: "2", rx: "1", fill: "currentColor" }), jsxRuntime.jsx("rect", { x: "2", y: "11", width: "12", height: "2", rx: "1", fill: "currentColor" })] }));
|
|
1955
|
+
case "table":
|
|
1956
|
+
return (jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [jsxRuntime.jsx("rect", { x: "2", y: "2", width: "12", height: "12", rx: "1", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntime.jsx("line", { x1: "8", y1: "2", x2: "8", y2: "14", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntime.jsx("line", { x1: "2", y1: "8", x2: "14", y2: "8", stroke: "currentColor", strokeWidth: "1.5" })] }));
|
|
1957
|
+
default:
|
|
1958
|
+
// Custom layout icon (star)
|
|
1959
|
+
return (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: jsxRuntime.jsx("path", { d: "M8 2L10 6L14 7L11 10L12 14L8 12L4 14L5 10L2 7L6 6L8 2Z", fill: "currentColor", stroke: "currentColor", strokeWidth: "0.5" }) }));
|
|
1960
|
+
}
|
|
1948
1961
|
};
|
|
1949
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "overview-tabs-container", children: jsxRuntime.
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
var _a;
|
|
1958
|
-
e.stopPropagation();
|
|
1959
|
-
if (clickedOverview !== overview.id) {
|
|
1960
|
-
setClickedOverview((_a = overview.id) !== null && _a !== void 0 ? _a : "");
|
|
1961
|
-
}
|
|
1962
|
-
else {
|
|
1963
|
-
setClickedOverview(null);
|
|
1964
|
-
}
|
|
1965
|
-
}, children: jsxRuntime.jsx("div", { className: "chevron ".concat(clickedOverview === overview.id ? "clicked" : ""), children: jsxRuntime.jsxs("svg", { width: "6", height: "10", viewBox: "0 0 6 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M1 9L5 5", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round" }), jsxRuntime.jsx("path", { d: "M1 1L5 5", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round" })] }) }) }), jsxRuntime.jsx("span", { className: "", children: toTitleCase(overview.type) }), odi.overviews.length > 1 ? (jsxRuntime.jsx("button", { className: "overview-tab-delete-button", onClick: function (e) {
|
|
1966
|
-
var _a;
|
|
1967
|
-
e.stopPropagation();
|
|
1968
|
-
removeOverview((_a = overview.id) !== null && _a !== void 0 ? _a : "");
|
|
1969
|
-
}, children: jsxRuntime.jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.46967 6.46967C0.176777 6.76256 0.176777 7.23744 0.46967 7.53033C0.762563 7.82322 1.23744 7.82322 1.53033 7.53033L3.99902 5.06164L6.46967 7.53228C6.76256 7.82518 7.23744 7.82518 7.53033 7.53228C7.82322 7.23939 7.82322 6.76452 7.53033 6.47162L5.05968 4.00098L7.53033 1.53033C7.82322 1.23744 7.82322 0.762563 7.53033 0.46967C7.23744 0.176777 6.76256 0.176776 6.46967 0.46967L3.99902 2.94032L1.53033 0.471623C1.23744 0.17873 0.762563 0.17873 0.46967 0.471623C0.176777 0.764517 0.176777 1.23939 0.46967 1.53228L2.93836 4.00098L0.46967 6.46967Z", fill: "black" }) }) })) : (jsxRuntime.jsx("div", { className: "w-[4px]" })), clickedOverview === overview.id && (jsxRuntime.jsx("div", { className: "dropdown-menu", children: jsxRuntime.jsx(DropdownMenu, { items: Object.keys(overviewTypesMap), onSelectItem: function (item) {
|
|
1962
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx("div", { className: "overview-tabs-container", children: jsxRuntime.jsx("div", { className: "overview-tabs overview-".concat(viewMode), children: jsxRuntime.jsxs("div", { className: "toolbar-content", children: [odi === null || odi === void 0 ? void 0 : odi.overviews.map(function (overview, index) { return (jsxRuntime.jsxs("div", { className: "overview-tab toolbar-item ".concat(activeOverview === overview.id
|
|
1963
|
+
? "overview-tab-active"
|
|
1964
|
+
: "overview-tab-inactive"), onMouseEnter: function () { var _a; return setHoveredOverview((_a = overview.id) !== null && _a !== void 0 ? _a : null); }, onMouseLeave: function () { return setHoveredOverview(null); }, onClick: function () {
|
|
1965
|
+
var _a;
|
|
1966
|
+
if (activeOverview !== overview.id) {
|
|
1967
|
+
setActiveOverview((_a = overview.id) !== null && _a !== void 0 ? _a : "");
|
|
1968
|
+
}
|
|
1969
|
+
}, children: [jsxRuntime.jsx("span", { className: "", children: toTitleCase(overview.type) }), odi.overviews.length > 1 ? (jsxRuntime.jsx("button", { className: "overview-tab-delete-button", onClick: function (e) {
|
|
1970
1970
|
var _a;
|
|
1971
|
-
|
|
1972
|
-
|
|
1971
|
+
e.stopPropagation();
|
|
1972
|
+
removeOverview((_a = overview.id) !== null && _a !== void 0 ? _a : "");
|
|
1973
|
+
}, children: jsxRuntime.jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M0.46967 6.46967C0.176777 6.76256 0.176777 7.23744 0.46967 7.53033C0.762563 7.82322 1.23744 7.82322 1.53033 7.53033L3.99902 5.06164L6.46967 7.53228C6.76256 7.82518 7.23744 7.82518 7.53033 7.53228C7.82322 7.23939 7.82322 6.76452 7.53033 6.47162L5.05968 4.00098L7.53033 1.53033C7.82322 1.23744 7.82322 0.762563 7.53033 0.46967C7.23744 0.176777 6.76256 0.176776 6.46967 0.46967L3.99902 2.94032L1.53033 0.471623C1.23744 0.17873 0.762563 0.17873 0.46967 0.471623C0.176777 0.764517 0.176777 1.23939 0.46967 1.53228L2.93836 4.00098L0.46967 6.46967Z", fill: "black" }) }) })) : (jsxRuntime.jsx("div", { className: "w-[4px]" })), hoveredOverview === overview.id && (jsxRuntime.jsxs("div", { className: "overview-hover-dropdown", children: [jsxRuntime.jsxs("div", { className: "dropdown-section", children: [jsxRuntime.jsx("div", { className: "dropdown-section-label", children: "Default Layouts" }), defaultLayouts.map(function (overviewType) {
|
|
1974
|
+
var isSelected = overview.type === overviewType;
|
|
1975
|
+
return (jsxRuntime.jsxs("button", { className: "dropdown-item ".concat(isSelected ? "active" : ""), onClick: function (e) {
|
|
1976
|
+
var _a;
|
|
1977
|
+
e.stopPropagation();
|
|
1978
|
+
if (!isSelected) {
|
|
1979
|
+
setLayoutOverview((_a = overview.id) !== null && _a !== void 0 ? _a : "", overviewType);
|
|
1980
|
+
}
|
|
1981
|
+
setHoveredOverview(null);
|
|
1982
|
+
}, children: [getOverviewIcon(overviewType), jsxRuntime.jsx("span", { children: toTitleCase(overviewType) })] }, overviewType));
|
|
1983
|
+
})] }), (configCustomOverviewTypes.length > 0 || (customLayouts && customLayouts.length > 0)) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "dropdown-divider", style: { height: "1px", background: "#e0e0e0", margin: "4px 0" } }), jsxRuntime.jsxs("div", { className: "dropdown-section", children: [jsxRuntime.jsx("div", { className: "dropdown-section-label", children: "Custom Layouts" }), configCustomOverviewTypes.map(function (overviewType) {
|
|
1984
|
+
var isSelected = overview.type === overviewType;
|
|
1985
|
+
var configType = overviewTypesMap[overviewType];
|
|
1986
|
+
var displayName = (configType === null || configType === void 0 ? void 0 : configType.type) ? toTitleCase(configType.type) : toTitleCase(overviewType);
|
|
1987
|
+
return (jsxRuntime.jsxs("button", { className: "dropdown-item custom-layout-item ".concat(isSelected ? "active" : ""), onClick: function (e) {
|
|
1988
|
+
var _a;
|
|
1989
|
+
e.stopPropagation();
|
|
1990
|
+
if (!isSelected) {
|
|
1991
|
+
setLayoutOverview((_a = overview.id) !== null && _a !== void 0 ? _a : "", overviewType);
|
|
1992
|
+
}
|
|
1993
|
+
setHoveredOverview(null);
|
|
1994
|
+
}, children: [getOverviewIcon(overviewType), jsxRuntime.jsx("span", { children: displayName })] }, overviewType));
|
|
1995
|
+
}), customLayouts && customLayouts.map(function (layout) {
|
|
1996
|
+
var isSelected = overview.type === layout.id;
|
|
1997
|
+
return (jsxRuntime.jsxs("button", { className: "dropdown-item custom-layout-item ".concat(isSelected ? "active" : ""), onClick: function (e) {
|
|
1998
|
+
var _a;
|
|
1999
|
+
e.stopPropagation();
|
|
2000
|
+
if (!isSelected) {
|
|
2001
|
+
setLayoutOverview((_a = overview.id) !== null && _a !== void 0 ? _a : "", layout.id);
|
|
2002
|
+
}
|
|
2003
|
+
setHoveredOverview(null);
|
|
2004
|
+
}, children: [getOverviewIcon(layout.id), jsxRuntime.jsx("span", { children: layout.name })] }, layout.id));
|
|
2005
|
+
})] })] }))] }))] }, "".concat(overview.id, "-").concat(index))); }), jsxRuntime.jsx("div", { className: "toolbar-item", children: jsxRuntime.jsx("button", { onClick: function () { return addNewOverview(); }, className: "toolbar-btn overview-tab-add-button", title: "Add new overview", children: jsxRuntime.jsxs("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M6 1L6 11", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }), jsxRuntime.jsx("path", { d: "M1 6L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }) }) }), jsxRuntime.jsxs("div", { className: "toolbar-item", id: "overviewLayouts", ref: overviewLayoutsDropdownRef, children: [jsxRuntime.jsxs("button", { className: "toolbar-btn", onClick: function () { return setShowOverviewLayoutsDropdown(!showOverviewLayoutsDropdown); }, title: "Overview Layouts", children: [jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("rect", { x: "2", y: "2", width: "7", height: "7", rx: "1", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntime.jsx("rect", { x: "11", y: "2", width: "7", height: "7", rx: "1", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntime.jsx("rect", { x: "2", y: "11", width: "7", height: "7", rx: "1", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntime.jsx("rect", { x: "11", y: "11", width: "7", height: "7", rx: "1", stroke: "currentColor", strokeWidth: "1.5" })] }), jsxRuntime.jsx("span", { children: "Overview Layouts" })] }), showOverviewLayoutsDropdown && (jsxRuntime.jsxs("div", { className: "dropdown-menu", id: "layoutsDropdown", children: [jsxRuntime.jsxs("div", { className: "dropdown-section", children: [jsxRuntime.jsx("div", { className: "dropdown-section-label", children: "Default Layouts" }), defaultLayouts.map(function (overviewType) {
|
|
2006
|
+
var activeOverviewData = odi === null || odi === void 0 ? void 0 : odi.overviews.find(function (ov) { return ov.id === activeOverview; });
|
|
2007
|
+
var isSelected = (activeOverviewData === null || activeOverviewData === void 0 ? void 0 : activeOverviewData.type) === overviewType;
|
|
2008
|
+
return (jsxRuntime.jsxs("button", { className: "dropdown-item ".concat(isSelected ? "active" : ""), onClick: function (e) {
|
|
2009
|
+
e.stopPropagation();
|
|
2010
|
+
if (activeOverview) {
|
|
2011
|
+
setLayoutOverview(activeOverview, overviewType);
|
|
2012
|
+
}
|
|
2013
|
+
setShowOverviewLayoutsDropdown(false);
|
|
2014
|
+
}, children: [getOverviewIcon(overviewType), jsxRuntime.jsx("span", { children: toTitleCase(overviewType) })] }, overviewType));
|
|
2015
|
+
})] }), (configCustomOverviewTypes.length > 0 || (customLayouts && customLayouts.length > 0)) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "dropdown-divider", style: { height: "1px", background: "#e0e0e0", margin: "4px 0" } }), jsxRuntime.jsxs("div", { className: "dropdown-section", children: [jsxRuntime.jsx("div", { className: "dropdown-section-label", children: "Custom Layouts" }), configCustomOverviewTypes.map(function (overviewType) {
|
|
2016
|
+
var activeOverviewData = odi === null || odi === void 0 ? void 0 : odi.overviews.find(function (ov) { return ov.id === activeOverview; });
|
|
2017
|
+
var isSelected = (activeOverviewData === null || activeOverviewData === void 0 ? void 0 : activeOverviewData.type) === overviewType;
|
|
2018
|
+
var configType = overviewTypesMap[overviewType];
|
|
2019
|
+
var displayName = (configType === null || configType === void 0 ? void 0 : configType.type) ? toTitleCase(configType.type) : toTitleCase(overviewType);
|
|
2020
|
+
return (jsxRuntime.jsxs("button", { className: "dropdown-item custom-layout-item ".concat(isSelected ? "active" : ""), onClick: function (e) {
|
|
2021
|
+
e.stopPropagation();
|
|
2022
|
+
if (activeOverview) {
|
|
2023
|
+
setLayoutOverview(activeOverview, overviewType);
|
|
2024
|
+
}
|
|
2025
|
+
setShowOverviewLayoutsDropdown(false);
|
|
2026
|
+
}, children: [getOverviewIcon(overviewType), jsxRuntime.jsx("span", { children: displayName })] }, overviewType));
|
|
2027
|
+
}), customLayouts && customLayouts.map(function (layout) {
|
|
2028
|
+
var activeOverviewData = odi === null || odi === void 0 ? void 0 : odi.overviews.find(function (ov) { return ov.id === activeOverview; });
|
|
2029
|
+
var isSelected = (activeOverviewData === null || activeOverviewData === void 0 ? void 0 : activeOverviewData.type) === layout.id;
|
|
2030
|
+
return (jsxRuntime.jsxs("button", { className: "dropdown-item custom-layout-item ".concat(isSelected ? "active" : ""), onClick: function (e) {
|
|
2031
|
+
e.stopPropagation();
|
|
2032
|
+
if (activeOverview) {
|
|
2033
|
+
setLayoutOverview(activeOverview, layout.id);
|
|
2034
|
+
}
|
|
2035
|
+
setShowOverviewLayoutsDropdown(false);
|
|
2036
|
+
}, children: [getOverviewIcon(layout.id), jsxRuntime.jsx("span", { children: layout.name })] }, layout.id));
|
|
2037
|
+
})] })] }))] }))] }), enabledMalleableContent() &&
|
|
2038
|
+
!((_b = (_a = odi === null || odi === void 0 ? void 0 : odi.malleability) === null || _a === void 0 ? void 0 : _a.content) === null || _b === void 0 ? void 0 : _b.disabled) &&
|
|
2039
|
+
((_e = (_d = (_c = odi === null || odi === void 0 ? void 0 : odi.malleability) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.types) === null || _e === void 0 ? void 0 : _e.includes("toggle")) && (jsxRuntime.jsx("div", { className: "toolbar-item", children: jsxRuntime.jsxs("button", { className: "toolbar-btn ".concat(highlightAttributes ? "active" : ""), onClick: function () { return setHighlightAttributes(!highlightAttributes); }, title: highlightAttributes ? "Turn off content customization" : "Customize Content", children: [jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M11.25 3.75L16.25 8.75L6.25 18.75H1.25V13.75L11.25 3.75Z", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M14.25 1.25L18.75 5.75", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }), jsxRuntime.jsx("span", { children: highlightAttributes ? "Customizing" : "Customize Content" })] }) })), jsxRuntime.jsx("div", { className: "toolbar-item", children: jsxRuntime.jsxs("button", { className: "toolbar-btn more-settings-button", onClick: function () { return setMalleabilityConsoleOpen(true); }, title: "Meridian UI Settings", children: [jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("circle", { cx: "10", cy: "10", r: "2.5", stroke: "currentColor", strokeWidth: "1.5" }), jsxRuntime.jsx("path", { d: "M10 2.5V5M10 15V17.5M17.5 10H15M5 10H2.5M15.303 4.697L13.536 6.464M6.464 13.536L4.697 15.303M15.303 15.303L13.536 13.536M6.464 6.464L4.697 4.697", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }), jsxRuntime.jsx("span", { children: "Meridian UI Settings" })] }) })] }) }) }) }));
|
|
1973
2040
|
};
|
|
1974
2041
|
|
|
1975
2042
|
// const ODIRenderer: React.FC<{ odi: BookingODI }> = ({ odi }) => {
|
|
@@ -1998,7 +2065,7 @@ var MeridianOverview = function (_a) {
|
|
|
1998
2065
|
var overview = findOverviewById(odi, overviewIdToShow);
|
|
1999
2066
|
if (overview) {
|
|
2000
2067
|
var OverviewComponent = (_c = (_b = overviewTypesMap[overview.type]) === null || _b === void 0 ? void 0 : _b.view) !== null && _c !== void 0 ? _c : OverviewBasicList;
|
|
2001
|
-
var OverviewWrapper =
|
|
2068
|
+
var OverviewWrapper = React.Fragment;
|
|
2002
2069
|
var items = [];
|
|
2003
2070
|
if (attribute) {
|
|
2004
2071
|
var attributeItems = ((_e = (_d = getAttributeDataBindingById(odi, overview.bindingId, attribute)) === null || _d === void 0 ? void 0 : _d.attributes) !== null && _e !== void 0 ? _e : []);
|
|
@@ -2015,8 +2082,8 @@ var MeridianOverview = function (_a) {
|
|
|
2015
2082
|
return (jsxRuntime.jsxs(OverviewWrapper, { children: [!attribute && enabledMalleableContent() && (jsxRuntime.jsx(MalleabilityAttributesToggle, {})), jsxRuntime.jsx(OverviewComponent, { overview: overview, items: items, viewType: "overview", onOpenDetailNewPage: onOpenDetailNewPage !== null && onOpenDetailNewPage !== void 0 ? onOpenDetailNewPage : (function () { }), onOpenOverviewNewPage: onOpenOverviewNewPage !== null && onOpenOverviewNewPage !== void 0 ? onOpenOverviewNewPage : (function () { }) })] }, "".concat(overview.id, "-").concat(0)));
|
|
2016
2083
|
}
|
|
2017
2084
|
}
|
|
2018
|
-
console.log("bbbb", odi);
|
|
2019
|
-
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "flex flex-col", children: [malleableCompositionSetting().includes("tabs") && (jsxRuntime.jsx(MalleabilityOvervewTabs, {})), enabledMalleableContent() && jsxRuntime.jsx(MalleabilityAttributesToggle, {})] }), odi.overviews
|
|
2085
|
+
// console.log("bbbb", odi);
|
|
2086
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: "flex flex-col", children: [malleableCompositionSetting().includes("tabs") && (jsxRuntime.jsx(MalleabilityOvervewTabs, {})), enabledMalleableContent() && !malleableCompositionSetting().includes("tabs") && jsxRuntime.jsx(MalleabilityAttributesToggle, {})] }), odi.overviews
|
|
2020
2087
|
.filter(function (overview) {
|
|
2021
2088
|
return !malleableCompositionSetting().includes("tabs") ||
|
|
2022
2089
|
activeOverview === overview.id;
|
|
@@ -2024,7 +2091,7 @@ var MeridianOverview = function (_a) {
|
|
|
2024
2091
|
.map(function (overview, index) {
|
|
2025
2092
|
var _a, _b;
|
|
2026
2093
|
var OverviewComponent = (_b = (_a = overviewTypesMap[overview.type]) === null || _a === void 0 ? void 0 : _a.view) !== null && _b !== void 0 ? _b : OverviewBasicList;
|
|
2027
|
-
var OverviewWrapper =
|
|
2094
|
+
var OverviewWrapper = React.Fragment;
|
|
2028
2095
|
var items = filterItemAttributes(getDataBindingById(odi, overview.bindingId).items, overview.shownAttributes, overview.hiddenAttributes);
|
|
2029
2096
|
return (jsxRuntime.jsx(OverviewWrapper, { children: jsxRuntime.jsx(OverviewComponent, { overview: overview, items: items, viewType: "overview", onOpenDetailNewPage: onOpenDetailNewPage !== null && onOpenDetailNewPage !== void 0 ? onOpenDetailNewPage : (function () { }), onOpenOverviewNewPage: onOpenOverviewNewPage !== null && onOpenOverviewNewPage !== void 0 ? onOpenOverviewNewPage : (function () { }) }) }, "".concat(overview.id, "-").concat(index)));
|
|
2030
2097
|
}),
|
|
@@ -2066,7 +2133,7 @@ var MeridianDetail = function (_a) {
|
|
|
2066
2133
|
var fetchedODI = _a.odi, dataLists = _a.dataLists, itemId = _a.itemId, detailId = _a.detailId; _a.onAction;
|
|
2067
2134
|
var _g = useODI(), odi = _g.odi, setODI = _g.setODI, setOriginalODI = _g.setOriginalODI, selectedItemEntity = _g.selectedItemEntity, setSelectedItemEntity = _g.setSelectedItemEntity, getSelectedAttributeSet = _g.getSelectedAttributeSet; _g.setOnOpenNewPage;
|
|
2068
2135
|
// Only set the ODI from the imported spec variable if DNE in the store.
|
|
2069
|
-
|
|
2136
|
+
React.useEffect(function () {
|
|
2070
2137
|
if (fetchedODI && !odi && dataLists) {
|
|
2071
2138
|
if (fetchedODI) {
|
|
2072
2139
|
setODI(denormalizeODI(fetchedODI));
|
|
@@ -2075,7 +2142,7 @@ var MeridianDetail = function (_a) {
|
|
|
2075
2142
|
}
|
|
2076
2143
|
}, [fetchedODI]);
|
|
2077
2144
|
// Get default overview and detail view if selected detail content isn't found in the store.
|
|
2078
|
-
|
|
2145
|
+
React.useEffect(function () {
|
|
2079
2146
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2080
2147
|
if (!selectedItemEntity && odi) {
|
|
2081
2148
|
if (detailId) {
|
|
@@ -2189,7 +2256,7 @@ var OverviewBasicMap = function (options) {
|
|
|
2189
2256
|
if (!(coordinates === null || coordinates === void 0 ? void 0 : coordinates.every(function (p) { return p && p.lat && p.lng; }))) {
|
|
2190
2257
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: "No positions" });
|
|
2191
2258
|
}
|
|
2192
|
-
var _e =
|
|
2259
|
+
var _e = React.useState(""), hoveredItemId = _e[0], setHoveredItemId = _e[1];
|
|
2193
2260
|
var _f = calculateMapBounds(coordinates), defaultCenter = _f.defaultCenter, defaultZoom = _f.defaultZoom;
|
|
2194
2261
|
// Find the detail view that should open from clicking this attribute
|
|
2195
2262
|
var detailToOpen = (_b = mapOverview.detailViews) === null || _b === void 0 ? void 0 : _b.find(function (detail) { var _a; return typeof detail === "object" && ((_a = detail.openFrom) === null || _a === void 0 ? void 0 : _a.includes("item")); });
|
|
@@ -2357,7 +2424,7 @@ var ItemCompact = function (_a) {
|
|
|
2357
2424
|
? "image"
|
|
2358
2425
|
: "non-image"), options: options, attribute: attribute }));
|
|
2359
2426
|
};
|
|
2360
|
-
console.log(unlabeledAttributes);
|
|
2427
|
+
// console.log(unlabeledAttributes);
|
|
2361
2428
|
return (jsxRuntime.jsxs("div", { className: "item-compact ".concat(className), style: style, children: [labeledAttributes.map(function (attribute) { return (jsxRuntime.jsx(CompactAttribute, { attribute: attribute }, attribute === null || attribute === void 0 ? void 0 : attribute.id)); }), unlabeledAttributes.slice(0, sliceMax).map(function (attribute) { return (jsxRuntime.jsx(CompactAttribute, { attribute: attribute }, attribute === null || attribute === void 0 ? void 0 : attribute.id)); })] }));
|
|
2362
2429
|
};
|
|
2363
2430
|
|
|
@@ -2633,6 +2700,88 @@ var getFirstOverview = function (odi) {
|
|
|
2633
2700
|
return (_a = odi.overviews.find(function (overview) { return overview; })) !== null && _a !== void 0 ? _a : defaultOverview;
|
|
2634
2701
|
};
|
|
2635
2702
|
|
|
2703
|
+
var OverviewCustom = function (options) {
|
|
2704
|
+
var customLayouts = useODI().customLayouts;
|
|
2705
|
+
var overview = options.overview; options.items;
|
|
2706
|
+
// Find the custom layout by the overview type
|
|
2707
|
+
var customLayout = customLayouts.find(function (layout) { return layout.id === overview.type; });
|
|
2708
|
+
if (!customLayout) {
|
|
2709
|
+
return (jsxRuntime.jsxs("div", { style: { padding: "24px", textAlign: "center", color: "#999" }, children: [jsxRuntime.jsxs("p", { children: ["Custom layout \"", overview.type, "\" not found."] }), jsxRuntime.jsx("p", { style: { fontSize: "12px", marginTop: "8px" }, children: "Please check your custom layouts in Meridian UI Settings." })] }));
|
|
2710
|
+
}
|
|
2711
|
+
// Try to execute the custom layout code
|
|
2712
|
+
try {
|
|
2713
|
+
// Create a function that returns the component
|
|
2714
|
+
// Note: This uses Function constructor which has security implications
|
|
2715
|
+
// In production, you might want to use a code sandbox or server-side rendering
|
|
2716
|
+
var CustomComponent = React.useMemo(function () {
|
|
2717
|
+
try {
|
|
2718
|
+
// Create a function that executes the code in a scope with React available
|
|
2719
|
+
var codeWithWrapper = "\n (function(React) {\n ".concat(customLayout.code, "\n return typeof CustomLayoutView !== 'undefined' ? CustomLayoutView : \n (typeof exports !== 'undefined' && exports.default) ? exports.default :\n (typeof module !== 'undefined' && module.exports) ? module.exports :\n null;\n })\n ");
|
|
2720
|
+
// Use Function constructor to create the component factory
|
|
2721
|
+
var ComponentFactory = new Function('React', "return ".concat(codeWithWrapper))(React);
|
|
2722
|
+
var Component_1 = ComponentFactory(React);
|
|
2723
|
+
if (!Component_1 || typeof Component_1 !== 'function') {
|
|
2724
|
+
throw new Error("Component not found. Make sure your code defines a component named 'CustomLayoutView'.");
|
|
2725
|
+
}
|
|
2726
|
+
// Return a wrapper component that passes props correctly
|
|
2727
|
+
return function (props) {
|
|
2728
|
+
try {
|
|
2729
|
+
return React.createElement(Component_1, props);
|
|
2730
|
+
}
|
|
2731
|
+
catch (error) {
|
|
2732
|
+
console.error("Error rendering custom component:", error);
|
|
2733
|
+
return React.createElement('div', { style: { padding: '24px', color: '#c33' } }, 'Error rendering custom layout: ' + (error instanceof Error ? error.message : 'Unknown error'));
|
|
2734
|
+
}
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2737
|
+
catch (error) {
|
|
2738
|
+
console.error("Error loading custom layout:", error);
|
|
2739
|
+
return null;
|
|
2740
|
+
}
|
|
2741
|
+
}, [customLayout.code]);
|
|
2742
|
+
if (!CustomComponent) {
|
|
2743
|
+
throw new Error("Failed to load custom component");
|
|
2744
|
+
}
|
|
2745
|
+
return jsxRuntime.jsx(CustomComponent, __assign({}, options));
|
|
2746
|
+
}
|
|
2747
|
+
catch (error) {
|
|
2748
|
+
return (jsxRuntime.jsxs("div", { style: { padding: "24px", background: "#fee", border: "1px solid #fcc", borderRadius: "8px", color: "#c33" }, children: [jsxRuntime.jsx("p", { style: { fontWeight: 600, marginBottom: "8px" }, children: "Error rendering custom layout:" }), jsxRuntime.jsx("p", { style: { fontSize: "14px", marginBottom: "12px" }, children: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error" }), jsxRuntime.jsx("p", { style: { fontSize: "12px", color: "#999" }, children: "Please check your custom layout code in Meridian UI Settings." })] }));
|
|
2749
|
+
}
|
|
2750
|
+
};
|
|
2751
|
+
|
|
2752
|
+
var CUSTOM_LAYOUTS_STORAGE_KEY = "meridian-custom-layouts";
|
|
2753
|
+
var loadCustomLayouts = function () {
|
|
2754
|
+
if (typeof window === "undefined")
|
|
2755
|
+
return [];
|
|
2756
|
+
try {
|
|
2757
|
+
var stored = localStorage.getItem(CUSTOM_LAYOUTS_STORAGE_KEY);
|
|
2758
|
+
var layouts = stored ? JSON.parse(stored) : [];
|
|
2759
|
+
// Register all custom layouts with overviewTypesMap
|
|
2760
|
+
layouts.forEach(function (layout) {
|
|
2761
|
+
if (!overviewTypesMap[layout.id]) {
|
|
2762
|
+
addOverviewType({
|
|
2763
|
+
type: layout.id,
|
|
2764
|
+
view: OverviewCustom,
|
|
2765
|
+
defaultSpec: {},
|
|
2766
|
+
});
|
|
2767
|
+
}
|
|
2768
|
+
});
|
|
2769
|
+
return layouts;
|
|
2770
|
+
}
|
|
2771
|
+
catch (_a) {
|
|
2772
|
+
return [];
|
|
2773
|
+
}
|
|
2774
|
+
};
|
|
2775
|
+
var saveCustomLayouts = function (layouts) {
|
|
2776
|
+
if (typeof window === "undefined")
|
|
2777
|
+
return;
|
|
2778
|
+
try {
|
|
2779
|
+
localStorage.setItem(CUSTOM_LAYOUTS_STORAGE_KEY, JSON.stringify(layouts));
|
|
2780
|
+
}
|
|
2781
|
+
catch (error) {
|
|
2782
|
+
console.error("Failed to save custom layouts:", error);
|
|
2783
|
+
}
|
|
2784
|
+
};
|
|
2636
2785
|
// Add this helper function before the useODIMalleability definition
|
|
2637
2786
|
var createNewOverview = function (odi, activeOverviewId, customOverview, newId) {
|
|
2638
2787
|
// Find the active overview to copy
|
|
@@ -2693,11 +2842,13 @@ var createODIMalleabilityStore = function (set, get) { return ({
|
|
|
2693
2842
|
id: "",
|
|
2694
2843
|
},
|
|
2695
2844
|
setLastSelected: function (x, y, view, id) { return set({ lastSelected: { position: { x: x, y: y }, view: view, id: id } }); },
|
|
2696
|
-
clearSelection: function () { return set({
|
|
2845
|
+
clearSelection: function () { return set({
|
|
2846
|
+
selectedAttributes: [], lastSelected: {
|
|
2697
2847
|
position: { x: 0, y: 0 },
|
|
2698
2848
|
view: "overview",
|
|
2699
2849
|
id: "",
|
|
2700
|
-
}
|
|
2850
|
+
}
|
|
2851
|
+
}); },
|
|
2701
2852
|
// ---- COMPOSITION: STATE ----
|
|
2702
2853
|
activeOverview: "0",
|
|
2703
2854
|
setActiveOverview: function (overviewId) { return set({ activeOverview: overviewId }); },
|
|
@@ -2849,6 +3000,41 @@ var createODIMalleabilityStore = function (set, get) { return ({
|
|
|
2849
3000
|
setItemViewStyle: function (style) {
|
|
2850
3001
|
return set({ itemViewStyle: style });
|
|
2851
3002
|
},
|
|
3003
|
+
// ---- CUSTOM LAYOUTS ----
|
|
3004
|
+
customLayouts: loadCustomLayouts(),
|
|
3005
|
+
getCustomLayouts: function () {
|
|
3006
|
+
var customLayouts = get().customLayouts;
|
|
3007
|
+
return customLayouts;
|
|
3008
|
+
},
|
|
3009
|
+
addCustomLayout: function (name, id, code) {
|
|
3010
|
+
// Validate ID
|
|
3011
|
+
if (!/^[a-z0-9-]+$/.test(id)) {
|
|
3012
|
+
return false;
|
|
3013
|
+
}
|
|
3014
|
+
var customLayouts = get().customLayouts;
|
|
3015
|
+
// Check if ID already exists in custom layouts or in overviewTypesMap (including config-based custom overview types)
|
|
3016
|
+
if (customLayouts.find(function (l) { return l.id === id; }) || overviewTypesMap[id]) {
|
|
3017
|
+
return false;
|
|
3018
|
+
}
|
|
3019
|
+
// Register the custom layout with overviewTypesMap
|
|
3020
|
+
addOverviewType({
|
|
3021
|
+
type: id,
|
|
3022
|
+
view: OverviewCustom,
|
|
3023
|
+
defaultSpec: {},
|
|
3024
|
+
});
|
|
3025
|
+
var newLayouts = __spreadArray(__spreadArray([], customLayouts, true), [{ name: name, id: id, code: code }], false);
|
|
3026
|
+
saveCustomLayouts(newLayouts);
|
|
3027
|
+
set({ customLayouts: newLayouts });
|
|
3028
|
+
return true;
|
|
3029
|
+
},
|
|
3030
|
+
removeCustomLayout: function (id) {
|
|
3031
|
+
var customLayouts = get().customLayouts;
|
|
3032
|
+
var newLayouts = customLayouts.filter(function (l) { return l.id !== id; });
|
|
3033
|
+
saveCustomLayouts(newLayouts);
|
|
3034
|
+
// Note: We don't remove from overviewTypesMap to avoid breaking existing overviews
|
|
3035
|
+
// The component will handle missing layouts gracefully
|
|
3036
|
+
set({ customLayouts: newLayouts });
|
|
3037
|
+
},
|
|
2852
3038
|
}); };
|
|
2853
3039
|
// getSelectedAttributeSet: () => AttributeSet | undefined;
|
|
2854
3040
|
|
|
@@ -2996,9 +3182,9 @@ var skeletonODI = {
|
|
|
2996
3182
|
|
|
2997
3183
|
var SettingComponent = function (_a) {
|
|
2998
3184
|
var title = _a.title, values = _a.values, options = _a.options, onChange = _a.onChange, _b = _a.mode, mode = _b === void 0 ? "single" : _b, _c = _a.toggleOptions, toggleOptions = _c === void 0 ? { on: "on", off: "off" } : _c;
|
|
2999
|
-
var _d =
|
|
3000
|
-
var dropdownRef =
|
|
3001
|
-
|
|
3185
|
+
var _d = React.useState(false), isOpen = _d[0], setIsOpen = _d[1];
|
|
3186
|
+
var dropdownRef = React.useRef(null);
|
|
3187
|
+
React.useEffect(function () {
|
|
3002
3188
|
var handleClickOutside = function (event) {
|
|
3003
3189
|
if (dropdownRef.current &&
|
|
3004
3190
|
!dropdownRef.current.contains(event.target)) {
|
|
@@ -3305,11 +3491,11 @@ var SettingsPanel = function () {
|
|
|
3305
3491
|
var MeridianWrapper = function (_a) {
|
|
3306
3492
|
var children = _a.children, dataInitial = _a.data, odiInitial = _a.odi, customOverviewTypes = _a.customOverviewTypes, customItemViewTypes = _a.customItemViewTypes, customDetailViewTypes = _a.customDetailViewTypes, customAttributeTypes = _a.customAttributeTypes, onOpenDetailNewPage = _a.onOpenDetailNewPage, onOpenOverviewNewPage = _a.onOpenOverviewNewPage; _a.onAction; _a.isNewPage;
|
|
3307
3493
|
var _b = useODI(), selectedItemEntity = _b.selectedItemEntity, clearSelectedItemEntity = _b.clearSelectedItemEntity, odi = _b.odi, selectedAttributes = _b.selectedAttributes; _b.getSelectedAttributeSet; var lastSelected = _b.lastSelected, clearSelection = _b.clearSelection, setSpecShownAttributes = _b.setSpecShownAttributes; _b.highlightAttributes; var setHighlightAttributes = _b.setHighlightAttributes, closeDetail = _b.closeDetail, malleabilityConsoleOpen = _b.malleabilityConsoleOpen, setMalleabilityConsoleOpen = _b.setMalleabilityConsoleOpen, initialize = _b.initialize;
|
|
3308
|
-
console.log("wrapper: odi", odi);
|
|
3309
|
-
console.log("wrapper: odiInitial", odiInitial);
|
|
3310
|
-
console.log("wrapper: selectedItemEntity", selectedItemEntity);
|
|
3494
|
+
// console.log("wrapper: odi", odi);
|
|
3495
|
+
// console.log("wrapper: odiInitial", odiInitial);
|
|
3496
|
+
// console.log("wrapper: selectedItemEntity", selectedItemEntity);
|
|
3311
3497
|
// Initialize Meridian with all data and configuration
|
|
3312
|
-
|
|
3498
|
+
React.useEffect(function () {
|
|
3313
3499
|
console.log("====: initialize");
|
|
3314
3500
|
initialize(dataInitial, odiInitial !== null && odiInitial !== void 0 ? odiInitial : skeletonODI, {
|
|
3315
3501
|
customOverviewTypes: customOverviewTypes,
|