@vuu-ui/vuu-filters 0.8.10-debug → 0.8.11-debug
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/cjs/index.js +1460 -646
- package/cjs/index.js.map +4 -4
- package/esm/index.js +1430 -581
- package/esm/index.js.map +4 -4
- package/index.css +608 -2
- package/index.css.map +3 -3
- package/package.json +10 -10
- package/types/{vuu-filters/src/filter-bar → filter-bar}/FilterBar.d.ts +1 -2
- package/types/{vuu-filters/src/filter-bar → filter-bar}/useFilterBar.d.ts +4 -3
- package/types/{vuu-filters/src/filter-bar → filter-bar}/useFilters.d.ts +1 -1
- package/types/{vuu-filters/src/filter-builder-menu → filter-builder-menu}/FilterBuilderMenu.d.ts +1 -1
- package/types/filter-clause/ExpandoCombobox.d.ts +9 -0
- package/types/{vuu-filters/src/filter-clause → filter-clause}/filterClauseTypes.d.ts +1 -1
- package/types/{vuu-filters/src/filter-clause → filter-clause}/useFilterClauseEditor.d.ts +8 -4
- package/types/vuu-filters/src/filter-clause/ExpandoCombobox.d.ts +0 -10
- package/types/vuu-popups/src/dialog/Dialog.d.ts +0 -8
- package/types/vuu-popups/src/dialog/index.d.ts +0 -1
- package/types/vuu-popups/src/index.d.ts +0 -8
- package/types/vuu-popups/src/menu/ContextMenu.d.ts +0 -16
- package/types/vuu-popups/src/menu/MenuList.d.ts +0 -43
- package/types/vuu-popups/src/menu/context-menu-provider.d.ts +0 -10
- package/types/vuu-popups/src/menu/index.d.ts +0 -4
- package/types/vuu-popups/src/menu/key-code.d.ts +0 -12
- package/types/vuu-popups/src/menu/list-dom-utils.d.ts +0 -4
- package/types/vuu-popups/src/menu/use-cascade.d.ts +0 -25
- package/types/vuu-popups/src/menu/use-items-with-ids-next.d.ts +0 -13
- package/types/vuu-popups/src/menu/use-keyboard-navigation.d.ts +0 -27
- package/types/vuu-popups/src/menu/useContextMenu.d.ts +0 -20
- package/types/vuu-popups/src/menu/utils.d.ts +0 -2
- package/types/vuu-popups/src/popup/Popup.d.ts +0 -10
- package/types/vuu-popups/src/popup/index.d.ts +0 -3
- package/types/vuu-popups/src/popup/popup-service.d.ts +0 -59
- package/types/vuu-popups/src/popup/useAnchoredPosition.d.ts +0 -12
- package/types/vuu-popups/src/popup-menu/PopupMenu.d.ts +0 -16
- package/types/vuu-popups/src/popup-menu/index.d.ts +0 -1
- package/types/vuu-popups/src/portal/Portal.d.ts +0 -30
- package/types/vuu-popups/src/portal/index.d.ts +0 -1
- package/types/vuu-popups/src/portal-deprecated/PortalDeprecated.d.ts +0 -8
- package/types/vuu-popups/src/portal-deprecated/index.d.ts +0 -3
- package/types/vuu-popups/src/portal-deprecated/portal-utils.d.ts +0 -1
- package/types/vuu-popups/src/portal-deprecated/render-portal.d.ts +0 -10
- package/types/vuu-popups/src/prompt/Prompt.d.ts +0 -14
- package/types/vuu-popups/src/prompt/index.d.ts +0 -1
- package/types/vuu-popups/src/tooltip/Tooltip.d.ts +0 -12
- package/types/vuu-popups/src/tooltip/index.d.ts +0 -2
- package/types/vuu-popups/src/tooltip/useAnchoredPosition.d.ts +0 -12
- package/types/vuu-popups/src/tooltip/useTooltip.d.ts +0 -16
- /package/types/{vuu-filters/src/column-filter → column-filter}/utils.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-bar → filter-bar}/index.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-builder-menu → filter-builder-menu}/index.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-clause → filter-clause}/CloseButton.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-clause → filter-clause}/FilterClauseEditor.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-clause → filter-clause}/FilterMenu.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-clause → filter-clause}/FilterMenuOptions.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-clause → filter-clause}/NumericInput.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-clause → filter-clause}/TextInput.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-clause → filter-clause}/index.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-clause → filter-clause}/operator-utils.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-input → filter-input}/FilterInput.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-input → filter-input}/FilterLanguage.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-input → filter-input}/filterInfo.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-input → filter-input}/highlighting.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-input → filter-input}/index.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-input → filter-input}/theme.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-input → filter-input}/useCodeMirrorEditor.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-input → filter-input}/useFilterAutoComplete.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-input → filter-input}/useFilterSuggestionProvider.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-pill → filter-pill}/FilterPill.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-pill → filter-pill}/index.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-pill-menu → filter-pill-menu}/FilterPillMenu.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-pill-menu → filter-pill-menu}/FilterPillMenuOptions.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-pill-menu → filter-pill-menu}/index.d.ts +0 -0
- /package/types/{vuu-filters/src/filter-utils.d.ts → filter-utils.d.ts} +0 -0
- /package/types/{vuu-filters/src/index.d.ts → index.d.ts} +0 -0
- /package/types/{vuu-filters/src/local-config.d.ts → local-config.d.ts} +0 -0
- /package/types/{vuu-filters/src/use-filter-config.d.ts → use-filter-config.d.ts} +0 -0
- /package/types/{vuu-filters/src/use-rest-config.d.ts → use-rest-config.d.ts} +0 -0
package/cjs/index.js
CHANGED
|
@@ -244,14 +244,14 @@ var isDrawer = (component) => component.type === Drawer_default;
|
|
|
244
244
|
var isVertical = ({ props: { position = "left" } }) => position.match(/top|bottom/);
|
|
245
245
|
var DockLayout = (props) => {
|
|
246
246
|
const { children, className: classNameProp, id, style } = props;
|
|
247
|
-
const
|
|
247
|
+
const classBase20 = "vuuDockLayout";
|
|
248
248
|
const [drawers, content] = (0, import_vuu_utils.partition)(children, isDrawer);
|
|
249
249
|
const [verticalDrawers, horizontalDrawers] = (0, import_vuu_utils.partition)(drawers, isVertical);
|
|
250
250
|
const orientation = verticalDrawers.length === 0 ? "horizontal" : horizontalDrawers.length === 0 ? "vertical" : "both";
|
|
251
|
-
const className = (0, import_classnames2.default)(
|
|
251
|
+
const className = (0, import_classnames2.default)(classBase20, classNameProp, `${classBase20}-${orientation}`);
|
|
252
252
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className, id, style, children: [
|
|
253
253
|
drawers,
|
|
254
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${classBase20}-content`, children: content })
|
|
255
255
|
] });
|
|
256
256
|
};
|
|
257
257
|
DockLayout.displayName = "DockLayout";
|
|
@@ -273,9 +273,9 @@ var import_react3 = __toESM(require("react"));
|
|
|
273
273
|
// ../vuu-layout/src/utils/propUtils.ts
|
|
274
274
|
var NO_PROPS = {};
|
|
275
275
|
var getProp = (component, propName) => {
|
|
276
|
-
var
|
|
276
|
+
var _a2;
|
|
277
277
|
const props = getProps(component);
|
|
278
|
-
return (
|
|
278
|
+
return (_a2 = props[propName]) != null ? _a2 : props[`data-${propName}`];
|
|
279
279
|
};
|
|
280
280
|
var getProps = (component) => (component == null ? void 0 : component.props) || component || NO_PROPS;
|
|
281
281
|
|
|
@@ -570,8 +570,8 @@ var DropTargetCanvas = class {
|
|
|
570
570
|
dragState
|
|
571
571
|
);
|
|
572
572
|
if (targetDropOutline) {
|
|
573
|
-
const { l, t, r, b, tabLeft, tabWidth, tabHeight, guideLines } = targetDropOutline;
|
|
574
|
-
const w =
|
|
573
|
+
const { l, t, r: r2, b, tabLeft, tabWidth, tabHeight, guideLines } = targetDropOutline;
|
|
574
|
+
const w = r2 - l;
|
|
575
575
|
const h = b - t;
|
|
576
576
|
if (this.currentPath) {
|
|
577
577
|
const path2 = document.getElementById("vuu-drop-outline");
|
|
@@ -593,7 +593,7 @@ var DropTargetCanvas = class {
|
|
|
593
593
|
var cssShiftRight = "transition:margin-left .4s ease-out;margin-left: 63px";
|
|
594
594
|
var cssShiftBack = "transition:margin-left .4s ease-out;margin-left: 0px";
|
|
595
595
|
function moveExistingTabs(dropTarget) {
|
|
596
|
-
var
|
|
596
|
+
var _a2, _b;
|
|
597
597
|
const { AFTER, BEFORE } = RelativeDropPosition;
|
|
598
598
|
const {
|
|
599
599
|
clientRect: { Stack: Stack4 },
|
|
@@ -607,7 +607,7 @@ function moveExistingTabs(dropTarget) {
|
|
|
607
607
|
if (Stack4 && tab && tab.positionRelativeToTab !== AFTER) {
|
|
608
608
|
const tabOffset = tab.positionRelativeToTab === BEFORE ? 1 : 2;
|
|
609
609
|
const selector = `:scope .hwTabstrip > .hwTabstrip-inner > .hwTab:nth-child(${tab.index + tabOffset})`;
|
|
610
|
-
tabEl = (
|
|
610
|
+
tabEl = (_a2 = document.getElementById(id)) == null ? void 0 : _a2.querySelector(selector);
|
|
611
611
|
if (tabEl) {
|
|
612
612
|
if (_shiftedTab === null || _shiftedTab !== tabEl) {
|
|
613
613
|
tabEl.style.cssText = cssShiftRight;
|
|
@@ -755,12 +755,12 @@ var Splitter = import_react6.default.memo(function Splitter2({
|
|
|
755
755
|
[column, index, onDrag]
|
|
756
756
|
);
|
|
757
757
|
const handleMouseUp = (0, import_react6.useCallback)(() => {
|
|
758
|
-
var
|
|
758
|
+
var _a2;
|
|
759
759
|
window.removeEventListener("mousemove", handleMouseMove, false);
|
|
760
760
|
window.removeEventListener("mouseup", handleMouseUp, false);
|
|
761
761
|
onDragEnd();
|
|
762
762
|
setActive(false);
|
|
763
|
-
(
|
|
763
|
+
(_a2 = rootRef.current) == null ? void 0 : _a2.focus();
|
|
764
764
|
}, [handleMouseMove, onDragEnd, setActive]);
|
|
765
765
|
const handleMouseDown = (0, import_react6.useCallback)(
|
|
766
766
|
(e) => {
|
|
@@ -774,11 +774,11 @@ var Splitter = import_react6.default.memo(function Splitter2({
|
|
|
774
774
|
[column, handleMouseMove, handleMouseUp, index, onDragStart, setActive]
|
|
775
775
|
);
|
|
776
776
|
const handleClick = () => {
|
|
777
|
-
var
|
|
777
|
+
var _a2;
|
|
778
778
|
if (ignoreClick.current) {
|
|
779
779
|
ignoreClick.current = false;
|
|
780
780
|
} else {
|
|
781
|
-
(
|
|
781
|
+
(_a2 = rootRef.current) == null ? void 0 : _a2.focus();
|
|
782
782
|
}
|
|
783
783
|
};
|
|
784
784
|
const handleBlur = () => {
|
|
@@ -853,9 +853,9 @@ var getBreakPointValues = (breakPoints2, component) => {
|
|
|
853
853
|
};
|
|
854
854
|
var gatherChildMeta = (children, dimension3, breakPoints2) => {
|
|
855
855
|
return children.map((child, index) => {
|
|
856
|
-
var
|
|
856
|
+
var _a2;
|
|
857
857
|
const resizeable = getProp(child, "resizeable");
|
|
858
|
-
const { [dimension3]: intrinsicSize } = (
|
|
858
|
+
const { [dimension3]: intrinsicSize } = (_a2 = getIntrinsicSize(child)) != null ? _a2 : NO_INTRINSIC_SIZE;
|
|
859
859
|
const flexOpen = hasUnboundedFlexStyle(child);
|
|
860
860
|
if (breakPoints2) {
|
|
861
861
|
return {
|
|
@@ -970,8 +970,8 @@ var useSplitterResizing = ({
|
|
|
970
970
|
);
|
|
971
971
|
if (participants) {
|
|
972
972
|
participants.forEach((index2) => {
|
|
973
|
-
var
|
|
974
|
-
const el = (
|
|
973
|
+
var _a2;
|
|
974
|
+
const el = (_a2 = rootRef.current) == null ? void 0 : _a2.childNodes[index2];
|
|
975
975
|
if (el) {
|
|
976
976
|
const { size, minSize } = measureElement(el, dimension3);
|
|
977
977
|
contentMeta[index2].currentSize = size;
|
|
@@ -980,8 +980,8 @@ var useSplitterResizing = ({
|
|
|
980
980
|
});
|
|
981
981
|
if (bystanders) {
|
|
982
982
|
bystanders.forEach((index2) => {
|
|
983
|
-
var
|
|
984
|
-
const el = (
|
|
983
|
+
var _a2;
|
|
984
|
+
const el = (_a2 = rootRef.current) == null ? void 0 : _a2.childNodes[index2];
|
|
985
985
|
if (el) {
|
|
986
986
|
const { [dimension3]: size } = el.getBoundingClientRect();
|
|
987
987
|
contentMeta[index2].flexBasis = size;
|
|
@@ -1760,10 +1760,10 @@ var import_react32 = require("react");
|
|
|
1760
1760
|
// ../vuu-layout/src/layout-view/useViewActionDispatcher.ts
|
|
1761
1761
|
var import_react27 = require("react");
|
|
1762
1762
|
var useViewActionDispatcher = (id, root, viewPath, dropTargets) => {
|
|
1763
|
-
var
|
|
1763
|
+
var _a2;
|
|
1764
1764
|
const { loadSessionState, purgeSessionState, purgeState, saveSessionState } = usePersistentState();
|
|
1765
1765
|
const [contributions, setContributions] = (0, import_react27.useState)(
|
|
1766
|
-
(
|
|
1766
|
+
(_a2 = loadSessionState(id, "contributions")) != null ? _a2 : []
|
|
1767
1767
|
);
|
|
1768
1768
|
const dispatchLayoutAction = useLayoutProviderDispatch();
|
|
1769
1769
|
const updateContributions = (0, import_react27.useCallback)(
|
|
@@ -1798,9 +1798,9 @@ var useViewActionDispatcher = (id, root, viewPath, dropTargets) => {
|
|
|
1798
1798
|
]);
|
|
1799
1799
|
const handleMouseDown = (0, import_react27.useCallback)(
|
|
1800
1800
|
async (evt, index, preDragActivity) => {
|
|
1801
|
-
var
|
|
1801
|
+
var _a3;
|
|
1802
1802
|
evt.stopPropagation();
|
|
1803
|
-
const dragRect = (
|
|
1803
|
+
const dragRect = (_a3 = root.current) == null ? void 0 : _a3.getBoundingClientRect();
|
|
1804
1804
|
return new Promise((resolve, reject) => {
|
|
1805
1805
|
dispatchLayoutAction({
|
|
1806
1806
|
type: "drag-start",
|
|
@@ -1818,13 +1818,13 @@ var useViewActionDispatcher = (id, root, viewPath, dropTargets) => {
|
|
|
1818
1818
|
);
|
|
1819
1819
|
const dispatchAction = (0, import_react27.useCallback)(
|
|
1820
1820
|
async (action, evt) => {
|
|
1821
|
-
var
|
|
1821
|
+
var _a3;
|
|
1822
1822
|
const { type } = action;
|
|
1823
1823
|
switch (type) {
|
|
1824
1824
|
case "maximize":
|
|
1825
1825
|
case "minimize":
|
|
1826
1826
|
case "restore":
|
|
1827
|
-
return dispatchLayoutAction({ type, path: (
|
|
1827
|
+
return dispatchLayoutAction({ type, path: (_a3 = action.path) != null ? _a3 : viewPath });
|
|
1828
1828
|
case "remove":
|
|
1829
1829
|
return handleRemove();
|
|
1830
1830
|
case "mousedown":
|
|
@@ -1880,8 +1880,8 @@ var useView = ({
|
|
|
1880
1880
|
);
|
|
1881
1881
|
const title = (0, import_react28.useMemo)(
|
|
1882
1882
|
() => {
|
|
1883
|
-
var
|
|
1884
|
-
return (
|
|
1883
|
+
var _a2;
|
|
1884
|
+
return (_a2 = loadState("view-title")) != null ? _a2 : titleProp;
|
|
1885
1885
|
},
|
|
1886
1886
|
[loadState, titleProp]
|
|
1887
1887
|
);
|
|
@@ -1984,9 +1984,9 @@ var import_react30 = __toESM(require("react"));
|
|
|
1984
1984
|
var NO_CONTEXT = { dispatch: null };
|
|
1985
1985
|
var ViewContext = import_react30.default.createContext(NO_CONTEXT);
|
|
1986
1986
|
var useViewDispatch = () => {
|
|
1987
|
-
var
|
|
1987
|
+
var _a2;
|
|
1988
1988
|
const context = (0, import_react30.useContext)(ViewContext);
|
|
1989
|
-
return (
|
|
1989
|
+
return (_a2 = context == null ? void 0 : context.dispatch) != null ? _a2 : null;
|
|
1990
1990
|
};
|
|
1991
1991
|
|
|
1992
1992
|
// ../vuu-layout/src/layout-view/View.tsx
|
|
@@ -2147,8 +2147,8 @@ var Header = ({
|
|
|
2147
2147
|
const viewDispatch = useViewDispatch();
|
|
2148
2148
|
const handleClose = (evt) => viewDispatch == null ? void 0 : viewDispatch({ type: "remove" }, evt);
|
|
2149
2149
|
const handleTitleMouseDown = () => {
|
|
2150
|
-
var
|
|
2151
|
-
(
|
|
2150
|
+
var _a2;
|
|
2151
|
+
(_a2 = labelFieldRef.current) == null ? void 0 : _a2.focus();
|
|
2152
2152
|
};
|
|
2153
2153
|
const handleButtonMouseDown = (evt) => {
|
|
2154
2154
|
evt.stopPropagation();
|
|
@@ -2168,7 +2168,7 @@ var Header = ({
|
|
|
2168
2168
|
}
|
|
2169
2169
|
};
|
|
2170
2170
|
const handleExitEditMode = (originalValue = "", finalValue = "", allowDeactivation = true, editCancelled = false) => {
|
|
2171
|
-
var
|
|
2171
|
+
var _a2;
|
|
2172
2172
|
setEditing(false);
|
|
2173
2173
|
if (editCancelled) {
|
|
2174
2174
|
setValue(originalValue);
|
|
@@ -2177,7 +2177,7 @@ var Header = ({
|
|
|
2177
2177
|
onEditTitle == null ? void 0 : onEditTitle(finalValue);
|
|
2178
2178
|
}
|
|
2179
2179
|
if (allowDeactivation === false) {
|
|
2180
|
-
(
|
|
2180
|
+
(_a2 = labelFieldRef.current) == null ? void 0 : _a2.focus();
|
|
2181
2181
|
}
|
|
2182
2182
|
};
|
|
2183
2183
|
const handleMouseDown = (e) => {
|
|
@@ -2244,15 +2244,781 @@ var Header = ({
|
|
|
2244
2244
|
);
|
|
2245
2245
|
};
|
|
2246
2246
|
|
|
2247
|
-
// ../vuu-layout/src/
|
|
2248
|
-
var
|
|
2247
|
+
// ../vuu-layout/src/layout-persistence/data.ts
|
|
2248
|
+
var defaultLayout = {
|
|
2249
|
+
type: "Stack",
|
|
2250
|
+
id: "main-tabs",
|
|
2251
|
+
props: {
|
|
2252
|
+
className: "vuuShell-mainTabs",
|
|
2253
|
+
TabstripProps: {
|
|
2254
|
+
allowAddTab: true,
|
|
2255
|
+
allowRenameTab: true,
|
|
2256
|
+
animateSelectionThumb: false,
|
|
2257
|
+
location: "main-tab",
|
|
2258
|
+
allowCloseTab: true
|
|
2259
|
+
},
|
|
2260
|
+
preserve: true,
|
|
2261
|
+
active: 0
|
|
2262
|
+
},
|
|
2263
|
+
children: [
|
|
2264
|
+
{
|
|
2265
|
+
props: {
|
|
2266
|
+
id: "tab1",
|
|
2267
|
+
className: "vuuShell-Placeholder"
|
|
2268
|
+
},
|
|
2269
|
+
type: "Placeholder"
|
|
2270
|
+
}
|
|
2271
|
+
]
|
|
2272
|
+
};
|
|
2249
2273
|
|
|
2250
|
-
// ../vuu-layout/src/
|
|
2274
|
+
// ../vuu-layout/src/layout-persistence/LocalLayoutPersistenceManager.ts
|
|
2251
2275
|
var import_vuu_utils9 = require("@vuu-ui/vuu-utils");
|
|
2276
|
+
var metadataSaveLocation = "layouts/metadata";
|
|
2277
|
+
var layoutsSaveLocation = "layouts/layouts";
|
|
2278
|
+
var LocalLayoutPersistenceManager = class {
|
|
2279
|
+
createLayout(metadata, layout) {
|
|
2280
|
+
return new Promise((resolve) => {
|
|
2281
|
+
console.log(
|
|
2282
|
+
`Saving layout as ${metadata.name} to group ${metadata.group}...`
|
|
2283
|
+
);
|
|
2284
|
+
Promise.all([this.loadLayouts(), this.loadMetadata()]).then(
|
|
2285
|
+
([existingLayouts, existingMetadata]) => {
|
|
2286
|
+
const id = (0, import_vuu_utils9.getUniqueId)();
|
|
2287
|
+
this.appendAndPersist(
|
|
2288
|
+
id,
|
|
2289
|
+
metadata,
|
|
2290
|
+
layout,
|
|
2291
|
+
existingLayouts,
|
|
2292
|
+
existingMetadata
|
|
2293
|
+
);
|
|
2294
|
+
resolve(id);
|
|
2295
|
+
}
|
|
2296
|
+
);
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2299
|
+
updateLayout(id, newMetadata, newLayout) {
|
|
2300
|
+
return new Promise((resolve, reject) => {
|
|
2301
|
+
this.validateIds(id).then(() => Promise.all([this.loadLayouts(), this.loadMetadata()])).then(([existingLayouts, existingMetadata]) => {
|
|
2302
|
+
const layouts = existingLayouts.filter((layout) => layout.id !== id);
|
|
2303
|
+
const metadata = existingMetadata.filter(
|
|
2304
|
+
(metadata2) => metadata2.id !== id
|
|
2305
|
+
);
|
|
2306
|
+
this.appendAndPersist(id, newMetadata, newLayout, layouts, metadata);
|
|
2307
|
+
resolve();
|
|
2308
|
+
}).catch((e) => reject(e));
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
deleteLayout(id) {
|
|
2312
|
+
return new Promise((resolve, reject) => {
|
|
2313
|
+
this.validateIds(id).then(() => Promise.all([this.loadLayouts(), this.loadMetadata()])).then(([existingLayouts, existingMetadata]) => {
|
|
2314
|
+
const layouts = existingLayouts.filter((layout) => layout.id !== id);
|
|
2315
|
+
const metadata = existingMetadata.filter(
|
|
2316
|
+
(metadata2) => metadata2.id !== id
|
|
2317
|
+
);
|
|
2318
|
+
this.saveLayoutsWithMetadata(layouts, metadata);
|
|
2319
|
+
resolve();
|
|
2320
|
+
}).catch((e) => reject(e));
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
loadLayout(id) {
|
|
2324
|
+
return new Promise((resolve, reject) => {
|
|
2325
|
+
this.validateId(id, "layout").then(() => this.loadLayouts()).then((existingLayouts) => {
|
|
2326
|
+
const layouts = existingLayouts.find(
|
|
2327
|
+
(layout) => layout.id === id
|
|
2328
|
+
);
|
|
2329
|
+
resolve(layouts.json);
|
|
2330
|
+
}).catch((e) => reject(e));
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
loadMetadata() {
|
|
2334
|
+
return new Promise((resolve) => {
|
|
2335
|
+
const metadata = getLocalEntity(metadataSaveLocation);
|
|
2336
|
+
resolve(metadata || []);
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
loadApplicationLayout() {
|
|
2340
|
+
return new Promise((resolve) => {
|
|
2341
|
+
const applicationLayout = getLocalEntity("api/vui");
|
|
2342
|
+
if (applicationLayout) {
|
|
2343
|
+
resolve(applicationLayout);
|
|
2344
|
+
} else {
|
|
2345
|
+
resolve(defaultLayout);
|
|
2346
|
+
}
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
saveApplicationLayout(layout) {
|
|
2350
|
+
return new Promise((resolve, reject) => {
|
|
2351
|
+
const savedLayout = saveLocalEntity("api/vui", layout);
|
|
2352
|
+
if (savedLayout) {
|
|
2353
|
+
resolve();
|
|
2354
|
+
} else {
|
|
2355
|
+
reject(new Error("Layout failed to save"));
|
|
2356
|
+
}
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
loadLayouts() {
|
|
2360
|
+
return new Promise((resolve) => {
|
|
2361
|
+
const layouts = getLocalEntity(layoutsSaveLocation);
|
|
2362
|
+
resolve(layouts || []);
|
|
2363
|
+
});
|
|
2364
|
+
}
|
|
2365
|
+
appendAndPersist(newId, newMetadata, newLayout, existingLayouts, existingMetadata) {
|
|
2366
|
+
existingLayouts.push({ id: newId, json: newLayout });
|
|
2367
|
+
existingMetadata.push({ id: newId, ...newMetadata });
|
|
2368
|
+
this.saveLayoutsWithMetadata(existingLayouts, existingMetadata);
|
|
2369
|
+
}
|
|
2370
|
+
saveLayoutsWithMetadata(layouts, metadata) {
|
|
2371
|
+
saveLocalEntity(layoutsSaveLocation, layouts);
|
|
2372
|
+
saveLocalEntity(metadataSaveLocation, metadata);
|
|
2373
|
+
}
|
|
2374
|
+
// Ensures that there is exactly one Layout entry and exactly one Metadata
|
|
2375
|
+
// entry in local storage corresponding to the provided ID.
|
|
2376
|
+
async validateIds(id) {
|
|
2377
|
+
return Promise.all([
|
|
2378
|
+
this.validateId(id, "metadata").catch((error2) => error2.message),
|
|
2379
|
+
this.validateId(id, "layout").catch((error2) => error2.message)
|
|
2380
|
+
]).then((errorMessages) => {
|
|
2381
|
+
const combinedMessage = errorMessages.filter((msg) => msg !== void 0).join("; ");
|
|
2382
|
+
if (combinedMessage) {
|
|
2383
|
+
throw new Error(combinedMessage);
|
|
2384
|
+
}
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2387
|
+
// Ensures that there is exactly one element (Layout or Metadata) in local
|
|
2388
|
+
// storage corresponding to the provided ID.
|
|
2389
|
+
validateId(id, dataType) {
|
|
2390
|
+
return new Promise((resolve, reject) => {
|
|
2391
|
+
const loadFunc = dataType === "metadata" ? this.loadMetadata : this.loadLayouts;
|
|
2392
|
+
loadFunc().then((array) => {
|
|
2393
|
+
const count = array.filter((element) => element.id === id).length;
|
|
2394
|
+
switch (count) {
|
|
2395
|
+
case 1: {
|
|
2396
|
+
resolve();
|
|
2397
|
+
break;
|
|
2398
|
+
}
|
|
2399
|
+
case 0: {
|
|
2400
|
+
reject(new Error(`No ${dataType} with ID ${id}`));
|
|
2401
|
+
break;
|
|
2402
|
+
}
|
|
2403
|
+
default:
|
|
2404
|
+
reject(new Error(`Non-unique ${dataType} with ID ${id}`));
|
|
2405
|
+
}
|
|
2406
|
+
});
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
};
|
|
2410
|
+
|
|
2411
|
+
// ../vuu-shell/src/connection-status/ConnectionStatusIcon.tsx
|
|
2412
|
+
var import_react33 = __toESM(require("react"));
|
|
2413
|
+
var import_classnames11 = __toESM(require_classnames());
|
|
2414
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2415
|
+
|
|
2416
|
+
// ../vuu-shell/src/density-switch/DensitySwitch.tsx
|
|
2417
|
+
var import_lab = require("@salt-ds/lab");
|
|
2252
2418
|
var import_react34 = require("react");
|
|
2419
|
+
var import_classnames12 = __toESM(require_classnames());
|
|
2420
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2421
|
+
|
|
2422
|
+
// ../vuu-shell/src/feature/Feature.tsx
|
|
2423
|
+
var import_react36 = __toESM(require("react"));
|
|
2424
|
+
|
|
2425
|
+
// ../vuu-shell/src/feature/FeatureErrorBoundary.tsx
|
|
2426
|
+
var import_react35 = __toESM(require("react"));
|
|
2427
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2428
|
+
var FeatureErrorBoundary = class extends import_react35.default.Component {
|
|
2429
|
+
constructor(props) {
|
|
2430
|
+
super(props);
|
|
2431
|
+
this.state = { errorMessage: null };
|
|
2432
|
+
}
|
|
2433
|
+
static getDerivedStateFromError(error2) {
|
|
2434
|
+
return { errorMessage: error2.message };
|
|
2435
|
+
}
|
|
2436
|
+
componentDidCatch(error2, errorInfo) {
|
|
2437
|
+
console.log(`error creating component at ${this.props.url}`);
|
|
2438
|
+
console.log(error2, errorInfo);
|
|
2439
|
+
}
|
|
2440
|
+
render() {
|
|
2441
|
+
if (this.state.errorMessage) {
|
|
2442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
2443
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("h1", { children: "An error occured while creating component." }),
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: this.state.errorMessage })
|
|
2445
|
+
] });
|
|
2446
|
+
}
|
|
2447
|
+
return this.props.children;
|
|
2448
|
+
}
|
|
2449
|
+
};
|
|
2450
|
+
|
|
2451
|
+
// ../vuu-shell/src/feature/Loader.tsx
|
|
2452
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2453
|
+
var Loader = () => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "hwLoader", children: "loading" });
|
|
2454
|
+
|
|
2455
|
+
// ../vuu-shell/src/feature/css-module-loader.ts
|
|
2456
|
+
var importCSS = async (path) => {
|
|
2457
|
+
const container = new CSSStyleSheet();
|
|
2458
|
+
return fetch(path).then((x) => x.text()).then((x) => container.replace(x));
|
|
2459
|
+
};
|
|
2460
|
+
|
|
2461
|
+
// ../vuu-shell/src/feature/Feature.tsx
|
|
2462
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2463
|
+
var componentsMap = /* @__PURE__ */ new Map();
|
|
2464
|
+
var useCachedFeature = (url) => {
|
|
2465
|
+
(0, import_react36.useEffect)(
|
|
2466
|
+
() => () => {
|
|
2467
|
+
componentsMap.delete(url);
|
|
2468
|
+
},
|
|
2469
|
+
[url]
|
|
2470
|
+
);
|
|
2471
|
+
if (!componentsMap.has(url)) {
|
|
2472
|
+
componentsMap.set(
|
|
2473
|
+
url,
|
|
2474
|
+
import_react36.default.lazy(() => import(
|
|
2475
|
+
/* @vite-ignore */
|
|
2476
|
+
url
|
|
2477
|
+
))
|
|
2478
|
+
);
|
|
2479
|
+
}
|
|
2480
|
+
const lazyFeature = componentsMap.get(url);
|
|
2481
|
+
if (!lazyFeature) {
|
|
2482
|
+
throw Error(`Unable to load Lazy Feature at url ${url}`);
|
|
2483
|
+
} else {
|
|
2484
|
+
return lazyFeature;
|
|
2485
|
+
}
|
|
2486
|
+
};
|
|
2487
|
+
function RawFeature({
|
|
2488
|
+
url,
|
|
2489
|
+
css,
|
|
2490
|
+
ComponentProps: params,
|
|
2491
|
+
...props
|
|
2492
|
+
}) {
|
|
2493
|
+
if (css) {
|
|
2494
|
+
importCSS(css).then((styleSheet) => {
|
|
2495
|
+
document.adoptedStyleSheets = [
|
|
2496
|
+
...document.adoptedStyleSheets,
|
|
2497
|
+
styleSheet
|
|
2498
|
+
];
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
const LazyFeature = useCachedFeature(url);
|
|
2502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FeatureErrorBoundary, { url, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react36.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Loader, {}), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LazyFeature, { ...props, ...params }) }) });
|
|
2503
|
+
}
|
|
2504
|
+
var Feature = import_react36.default.memo(RawFeature);
|
|
2505
|
+
Feature.displayName = "Feature";
|
|
2506
|
+
registerComponent("Feature", Feature, "view");
|
|
2507
|
+
|
|
2508
|
+
// ../vuu-shell/src/layout-management/SaveLayoutPanel.tsx
|
|
2509
|
+
var import_react37 = require("react");
|
|
2510
|
+
var import_core6 = require("@salt-ds/core");
|
|
2511
|
+
var import_vuu_ui_controls2 = require("@vuu-ui/vuu-ui-controls");
|
|
2512
|
+
var import_vuu_utils10 = require("@vuu-ui/vuu-utils");
|
|
2513
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2514
|
+
var classBase9 = "saveLayoutPanel";
|
|
2515
|
+
var formField = `${classBase9}-formField`;
|
|
2516
|
+
|
|
2517
|
+
// ../vuu-shell/src/layout-management/LayoutList.tsx
|
|
2518
|
+
var import_vuu_ui_controls3 = require("@vuu-ui/vuu-ui-controls");
|
|
2519
|
+
|
|
2520
|
+
// ../vuu-shell/src/layout-management/useLayoutManager.tsx
|
|
2521
|
+
var import_react38 = __toESM(require("react"));
|
|
2522
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2523
|
+
var persistenceManager = new LocalLayoutPersistenceManager();
|
|
2524
|
+
var LayoutManagementContext = import_react38.default.createContext({
|
|
2525
|
+
layoutMetadata: [],
|
|
2526
|
+
saveLayout: () => {
|
|
2527
|
+
},
|
|
2528
|
+
applicationLayout: defaultLayout,
|
|
2529
|
+
saveApplicationLayout: () => {
|
|
2530
|
+
},
|
|
2531
|
+
loadLayoutById: () => defaultLayout
|
|
2532
|
+
});
|
|
2533
|
+
|
|
2534
|
+
// ../vuu-shell/src/layout-management/LayoutList.tsx
|
|
2535
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2536
|
+
|
|
2537
|
+
// ../vuu-icons/src/VuuLogo.tsx
|
|
2538
|
+
var import_react39 = require("react");
|
|
2539
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2540
|
+
var VuuLogo = (0, import_react39.memo)(() => {
|
|
2541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2542
|
+
"svg",
|
|
2543
|
+
{
|
|
2544
|
+
width: "44",
|
|
2545
|
+
height: "45",
|
|
2546
|
+
viewBox: "0 0 44 45",
|
|
2547
|
+
fill: "none",
|
|
2548
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2549
|
+
children: [
|
|
2550
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("g", { clipPath: "url(#clip0_217_6990)", children: [
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2552
|
+
"path",
|
|
2553
|
+
{
|
|
2554
|
+
d: "M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",
|
|
2555
|
+
fill: "url(#paint0_linear_217_6990)"
|
|
2556
|
+
}
|
|
2557
|
+
),
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2559
|
+
"path",
|
|
2560
|
+
{
|
|
2561
|
+
d: "M42.6246 24.8716C41.9199 25.9157 40.9625 26.824 39.767 27.4905C38.424 28.2396 36.9563 28.597 35.5081 28.597C32.7541 28.597 30.0715 27.3094 28.4466 24.9855L15.772 3.90967L15.7655 3.9206C13.3615 0.137431 8.25372 -1.13143 4.24754 1.10507C0.178173 3.37435 -1.20852 8.39359 1.14854 12.3125L18.3445 40.9095C19.1108 42.1846 20.1816 43.1834 21.4144 43.8764C21.4241 43.8826 21.4338 43.8889 21.4435 43.8951C21.4484 43.8982 21.4549 43.9013 21.4597 43.9045C22.0332 44.2228 22.6423 44.471 23.2725 44.6536C23.3194 44.6677 23.368 44.6817 23.415 44.6942C23.6418 44.7551 23.8702 44.8097 24.1019 44.8534C24.1456 44.8612 24.1894 44.8659 24.2331 44.8737C24.4194 44.9049 24.6073 44.9314 24.7952 44.9501C24.8698 44.9579 24.9443 44.9658 25.0188 44.9704C25.2342 44.9876 25.4497 44.9985 25.6668 45.0001C25.6781 45.0001 25.6895 45.0001 25.6992 45.0001C25.7024 45.0001 25.704 45.0001 25.7073 45.0001C25.7105 45.0001 25.7121 45.0001 25.7154 45.0001C25.9503 45.0001 26.1868 44.9876 26.4217 44.9689C26.4751 44.9642 26.5286 44.9595 26.5837 44.9533C26.8137 44.9299 27.0438 44.9002 27.2738 44.8596C27.277 44.8596 27.2803 44.8596 27.2835 44.8596C27.5362 44.8144 27.7889 44.7551 28.0384 44.6864C28.0546 44.6817 28.0692 44.677 28.0854 44.6723C28.4483 44.5709 28.8063 44.4445 29.1594 44.2931C29.1659 44.29 29.174 44.2868 29.1805 44.2837C29.4494 44.1682 29.7151 44.0418 29.9759 43.8967C30.24 43.75 30.491 43.5908 30.7308 43.4206C30.9398 43.2739 31.1407 43.1179 31.3367 42.9524C31.5748 42.7495 31.8 42.5373 32.009 42.3141C32.1661 42.1471 32.3168 41.9723 32.4609 41.7913C32.5079 41.732 32.5517 41.6711 32.5954 41.6118C32.6942 41.4807 32.7882 41.3465 32.8789 41.2091C32.9259 41.1373 32.9728 41.0671 33.0182 40.9953C33.036 40.9672 33.0555 40.9407 33.0717 40.9126L42.7153 24.8763H42.6214L42.6246 24.8716Z",
|
|
2562
|
+
fill: "url(#paint1_linear_217_6990)"
|
|
2563
|
+
}
|
|
2564
|
+
),
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2566
|
+
"path",
|
|
2567
|
+
{
|
|
2568
|
+
d: "M42.8402 16.4218L42.1112 15.2232L38.9636 9.58433L37.504 7.19644C37.2286 6.56123 36.579 6.11331 35.8176 6.11331C34.8083 6.11331 33.9919 6.90147 33.9919 7.87223C33.9919 8.20154 34.0907 8.50432 34.2543 8.76808L34.2349 8.78056L39.9048 18.0808C40.5884 19.2186 40.7715 20.5437 40.4199 21.8141C40.0684 23.0845 39.226 24.1458 38.045 24.806C37.2675 25.2398 36.3846 25.4693 35.4936 25.4693C33.6727 25.4693 31.9766 24.5281 31.0662 23.0143L22.9161 9.63271H22.9323L19.4899 3.90958L19.4834 3.92051C19.4235 3.8253 19.3538 3.73947 19.2907 3.64738L19.1935 3.48663C19.1935 3.48663 19.1854 3.49131 19.1821 3.49443C17.5654 1.27666 14.9799 0.0390178 12.3118 0.00936427V0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.961 26.8255 41.9168 25.9156 42.6231 24.8731H42.717L42.6846 24.9261C43.1366 24.2347 43.4833 23.4731 43.7068 22.6615C44.2916 20.5452 43.9871 18.3352 42.8369 16.4234L42.8402 16.4218Z",
|
|
2569
|
+
fill: "#F37880"
|
|
2570
|
+
}
|
|
2571
|
+
),
|
|
2572
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("g", { opacity: "0.86", children: [
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2574
|
+
"path",
|
|
2575
|
+
{
|
|
2576
|
+
d: "M34.2332 8.78212L39.9031 18.0824C40.5868 19.2202 40.7698 20.5452 40.4183 21.8156C40.2044 22.5897 39.8059 23.2858 39.2616 23.8617C39.9744 23.2343 40.4879 22.4243 40.7423 21.5035C41.0938 20.2331 40.9107 18.908 40.2271 17.7703L34.5572 8.46998L34.5767 8.4575C34.413 8.19374 34.3142 7.89096 34.3142 7.56165C34.3142 7.15586 34.4584 6.78285 34.6982 6.48476C34.2672 6.80626 33.9902 7.30881 33.9902 7.87379C33.9902 8.2031 34.0891 8.50588 34.2527 8.76964L34.2332 8.78212Z",
|
|
2577
|
+
fill: "white"
|
|
2578
|
+
}
|
|
2579
|
+
),
|
|
2580
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2581
|
+
"path",
|
|
2582
|
+
{
|
|
2583
|
+
d: "M42.6917 24.9169L42.6863 24.9256C42.6863 24.9256 42.6899 24.9187 42.6935 24.9152C42.6935 24.9152 42.6935 24.9152 42.6935 24.9169H42.6917Z",
|
|
2584
|
+
fill: "white"
|
|
2585
|
+
}
|
|
2586
|
+
),
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2588
|
+
"path",
|
|
2589
|
+
{
|
|
2590
|
+
d: "M40.0911 27.1798C38.7481 27.9289 37.2804 28.2863 35.8322 28.2863C33.0782 28.2863 30.3955 26.9988 28.7707 24.6749L16.0961 3.59744L16.0896 3.60837C14.9281 1.78077 13.1364 0.543128 11.1422 0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.4815 27.0924 41.1084 26.6055 41.6511 26.0561C41.1862 26.479 40.6662 26.8583 40.0894 27.1798H40.0911Z",
|
|
2591
|
+
fill: "white"
|
|
2592
|
+
}
|
|
2593
|
+
)
|
|
2594
|
+
] })
|
|
2595
|
+
] }),
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("defs", { children: [
|
|
2597
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2598
|
+
"linearGradient",
|
|
2599
|
+
{
|
|
2600
|
+
id: "paint0_linear_217_6990",
|
|
2601
|
+
x1: "24.6235",
|
|
2602
|
+
y1: "18.7363",
|
|
2603
|
+
x2: "42.3152",
|
|
2604
|
+
y2: "18.7363",
|
|
2605
|
+
gradientUnits: "userSpaceOnUse",
|
|
2606
|
+
children: [
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("stop", { stopColor: "#4906A5" }),
|
|
2608
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("stop", { offset: "1", stopColor: "#D3423A" })
|
|
2609
|
+
]
|
|
2610
|
+
}
|
|
2611
|
+
),
|
|
2612
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2613
|
+
"linearGradient",
|
|
2614
|
+
{
|
|
2615
|
+
id: "paint1_linear_217_6990",
|
|
2616
|
+
x1: "-2.35794e-05",
|
|
2617
|
+
y1: "22.5009",
|
|
2618
|
+
x2: "42.7186",
|
|
2619
|
+
y2: "22.5009",
|
|
2620
|
+
gradientUnits: "userSpaceOnUse",
|
|
2621
|
+
children: [
|
|
2622
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("stop", { stopColor: "#7C06A5" }),
|
|
2623
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("stop", { offset: "1", stopColor: "#D3423A" })
|
|
2624
|
+
]
|
|
2625
|
+
}
|
|
2626
|
+
),
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("clipPath", { id: "clip0_217_6990", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { width: "44", height: "45", fill: "white" }) })
|
|
2628
|
+
] })
|
|
2629
|
+
]
|
|
2630
|
+
}
|
|
2631
|
+
);
|
|
2632
|
+
});
|
|
2633
|
+
VuuLogo.displayName = "VuuLogo";
|
|
2634
|
+
|
|
2635
|
+
// ../vuu-shell/src/left-nav/LeftNav.tsx
|
|
2636
|
+
var import_vuu_ui_controls4 = require("@vuu-ui/vuu-ui-controls");
|
|
2637
|
+
var import_classnames14 = __toESM(require_classnames());
|
|
2638
|
+
var import_react41 = require("react");
|
|
2639
|
+
|
|
2640
|
+
// ../vuu-shell/src/feature-list/FeatureList.tsx
|
|
2641
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2642
|
+
|
|
2643
|
+
// ../vuu-shell/src/theme-provider/ThemeProvider.tsx
|
|
2644
|
+
var import_react40 = require("react");
|
|
2645
|
+
var import_classnames13 = __toESM(require_classnames());
|
|
2646
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2647
|
+
var DEFAULT_DENSITY = "medium";
|
|
2648
|
+
var DEFAULT_THEME = "salt-theme";
|
|
2649
|
+
var DEFAULT_THEME_MODE = "light";
|
|
2650
|
+
var ThemeContext = (0, import_react40.createContext)({
|
|
2651
|
+
density: "high",
|
|
2652
|
+
theme: "vuu",
|
|
2653
|
+
themeMode: "light"
|
|
2654
|
+
});
|
|
2655
|
+
var createThemedChildren = (children, theme, themeMode, density) => {
|
|
2656
|
+
var _a2;
|
|
2657
|
+
if ((0, import_react40.isValidElement)(children)) {
|
|
2658
|
+
return (0, import_react40.cloneElement)(children, {
|
|
2659
|
+
className: (0, import_classnames13.default)(
|
|
2660
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2661
|
+
(_a2 = children.props) == null ? void 0 : _a2.className,
|
|
2662
|
+
`${theme}-theme`,
|
|
2663
|
+
`${theme}-density-${density}`
|
|
2664
|
+
),
|
|
2665
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2666
|
+
// @ts-expect-error
|
|
2667
|
+
"data-mode": themeMode
|
|
2668
|
+
});
|
|
2669
|
+
} else {
|
|
2670
|
+
console.warn(
|
|
2671
|
+
`
|
|
2672
|
+
ThemeProvider can only apply CSS classes for theming to a single nested child element of the ThemeProvider.
|
|
2673
|
+
Wrap elements with a single container`
|
|
2674
|
+
);
|
|
2675
|
+
return children;
|
|
2676
|
+
}
|
|
2677
|
+
};
|
|
2678
|
+
var ThemeProvider = ({
|
|
2679
|
+
applyThemeClasses = false,
|
|
2680
|
+
children,
|
|
2681
|
+
theme: themeProp,
|
|
2682
|
+
themeMode: themeModeProp,
|
|
2683
|
+
density: densityProp
|
|
2684
|
+
}) => {
|
|
2685
|
+
var _a2, _b, _c;
|
|
2686
|
+
const {
|
|
2687
|
+
density: inheritedDensity,
|
|
2688
|
+
themeMode: inheritedThemeMode,
|
|
2689
|
+
theme: inheritedTheme
|
|
2690
|
+
} = (0, import_react40.useContext)(ThemeContext);
|
|
2691
|
+
const density = (_a2 = densityProp != null ? densityProp : inheritedDensity) != null ? _a2 : DEFAULT_DENSITY;
|
|
2692
|
+
const themeMode = (_b = themeModeProp != null ? themeModeProp : inheritedThemeMode) != null ? _b : DEFAULT_THEME_MODE;
|
|
2693
|
+
const theme = (_c = themeProp != null ? themeProp : inheritedTheme) != null ? _c : DEFAULT_THEME;
|
|
2694
|
+
const themedChildren = applyThemeClasses ? createThemedChildren(children, theme, themeMode, density) : children;
|
|
2695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ThemeContext.Provider, { value: { themeMode, density, theme }, children: themedChildren });
|
|
2696
|
+
};
|
|
2697
|
+
ThemeProvider.displayName = "ThemeProvider";
|
|
2698
|
+
|
|
2699
|
+
// ../vuu-shell/src/left-nav/LeftNav.tsx
|
|
2700
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2701
|
+
|
|
2702
|
+
// ../vuu-shell/src/login/LoginPanel.tsx
|
|
2703
|
+
var import_react42 = require("react");
|
|
2704
|
+
var import_core7 = require("@salt-ds/core");
|
|
2705
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2706
|
+
|
|
2707
|
+
// ../vuu-shell/src/login/login-utils.ts
|
|
2708
|
+
var import_vuu_utils11 = require("@vuu-ui/vuu-utils");
|
|
2709
|
+
var getAuthModeFromCookies = () => {
|
|
2710
|
+
const mode = (0, import_vuu_utils11.getCookieValue)("vuu-auth-mode");
|
|
2711
|
+
return mode != null ? mode : "";
|
|
2712
|
+
};
|
|
2713
|
+
var getDefaultLoginUrl = () => {
|
|
2714
|
+
const authMode = getAuthModeFromCookies();
|
|
2715
|
+
return authMode === "login" ? "login.html" : "demo.html";
|
|
2716
|
+
};
|
|
2717
|
+
var redirectToLogin = (loginUrl = getDefaultLoginUrl()) => {
|
|
2718
|
+
window.location.href = loginUrl;
|
|
2719
|
+
};
|
|
2720
|
+
var logout = (loginUrl) => {
|
|
2721
|
+
document.cookie = "vuu-username= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
|
|
2722
|
+
document.cookie = "vuu-auth-token= ; expires = Thu, 01 Jan 1970 00:00:00 GMT";
|
|
2723
|
+
redirectToLogin(loginUrl);
|
|
2724
|
+
};
|
|
2725
|
+
|
|
2726
|
+
// ../vuu-shell/src/session-editing-form/SessionEditingForm.tsx
|
|
2727
|
+
var import_react43 = require("react");
|
|
2728
|
+
var import_classnames15 = __toESM(require_classnames());
|
|
2729
|
+
var import_core8 = require("@salt-ds/core");
|
|
2730
|
+
var import_core9 = require("@salt-ds/core");
|
|
2731
|
+
var import_vuu_data = require("@vuu-ui/vuu-data");
|
|
2732
|
+
var import_vuu_utils12 = require("@vuu-ui/vuu-utils");
|
|
2733
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2734
|
+
|
|
2735
|
+
// ../vuu-shell/src/shell.tsx
|
|
2736
|
+
var import_vuu_data2 = require("@vuu-ui/vuu-data");
|
|
2737
|
+
var import_classnames19 = __toESM(require_classnames());
|
|
2738
|
+
var import_react53 = require("react");
|
|
2739
|
+
|
|
2740
|
+
// ../vuu-shell/src/app-header/AppHeader.tsx
|
|
2741
|
+
var import_react50 = require("react");
|
|
2742
|
+
|
|
2743
|
+
// ../vuu-shell/src/user-profile/UserProfile.tsx
|
|
2744
|
+
var import_core11 = require("@salt-ds/core");
|
|
2745
|
+
var import_lab3 = require("@salt-ds/lab");
|
|
2746
|
+
|
|
2747
|
+
// ../../node_modules/@salt-ds/icons/dist-es/icon/Icon.js
|
|
2748
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2749
|
+
var import_react46 = require("react");
|
|
2750
|
+
|
|
2751
|
+
// ../../node_modules/@salt-ds/icons/node_modules/clsx/dist/clsx.mjs
|
|
2752
|
+
function r(e) {
|
|
2753
|
+
var t, f, n = "";
|
|
2754
|
+
if ("string" == typeof e || "number" == typeof e)
|
|
2755
|
+
n += e;
|
|
2756
|
+
else if ("object" == typeof e)
|
|
2757
|
+
if (Array.isArray(e))
|
|
2758
|
+
for (t = 0; t < e.length; t++)
|
|
2759
|
+
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
2760
|
+
else
|
|
2761
|
+
for (t in e)
|
|
2762
|
+
e[t] && (n && (n += " "), n += t);
|
|
2763
|
+
return n;
|
|
2764
|
+
}
|
|
2765
|
+
function clsx() {
|
|
2766
|
+
for (var e, t, f = 0, n = ""; f < arguments.length; )
|
|
2767
|
+
(e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
2768
|
+
return n;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
// ../../node_modules/@salt-ds/window/dist-es/WindowProvider.js
|
|
2772
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2773
|
+
var import_react44 = require("react");
|
|
2774
|
+
var WindowContext = (0, import_react44.createContext)(
|
|
2775
|
+
typeof window !== "undefined" ? window : null
|
|
2776
|
+
);
|
|
2777
|
+
if (true) {
|
|
2778
|
+
WindowContext.displayName = "WindowContext";
|
|
2779
|
+
}
|
|
2780
|
+
function useWindow() {
|
|
2781
|
+
return (0, import_react44.useContext)(WindowContext);
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
// ../../node_modules/@salt-ds/styles/dist-es/use-style-injection/useStyleInjection.js
|
|
2785
|
+
var React20 = __toESM(require("react"));
|
|
2786
|
+
|
|
2787
|
+
// ../../node_modules/@salt-ds/styles/dist-es/use-style-injection/InsertionPointProvider.js
|
|
2788
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2789
|
+
var import_react45 = require("react");
|
|
2790
|
+
var InsertionPointContext = (0, import_react45.createContext)(null);
|
|
2791
|
+
if (true) {
|
|
2792
|
+
InsertionPointContext.displayName = "InsertionPointContext";
|
|
2793
|
+
}
|
|
2794
|
+
function useInsertionPoint() {
|
|
2795
|
+
const value = (0, import_react45.useContext)(InsertionPointContext);
|
|
2796
|
+
return value;
|
|
2797
|
+
}
|
|
2798
|
+
|
|
2799
|
+
// ../../node_modules/@salt-ds/styles/dist-es/use-style-injection/useStyleInjection.js
|
|
2800
|
+
var _a;
|
|
2801
|
+
var maybeUseInsertionEffect = (_a = React20[`${"useInsertionEffect"}${""}`]) != null ? _a : React20.useLayoutEffect;
|
|
2802
|
+
var windowSheetsMap = /* @__PURE__ */ new WeakMap();
|
|
2803
|
+
function useComponentCssInjection({
|
|
2804
|
+
testId,
|
|
2805
|
+
css,
|
|
2806
|
+
window: targetWindow
|
|
2807
|
+
}) {
|
|
2808
|
+
const insertionPoint = useInsertionPoint();
|
|
2809
|
+
maybeUseInsertionEffect(() => {
|
|
2810
|
+
var _a2, _b;
|
|
2811
|
+
if (!targetWindow) {
|
|
2812
|
+
return;
|
|
2813
|
+
}
|
|
2814
|
+
const sheetsMap = (_a2 = windowSheetsMap.get(targetWindow)) != null ? _a2 : /* @__PURE__ */ new Map();
|
|
2815
|
+
const styleMap = (_b = sheetsMap.get(css)) != null ? _b : { styleElement: null, count: 0 };
|
|
2816
|
+
if (styleMap.styleElement == null) {
|
|
2817
|
+
styleMap.styleElement = targetWindow.document.createElement("style");
|
|
2818
|
+
styleMap.styleElement.setAttribute("type", "text/css");
|
|
2819
|
+
styleMap.styleElement.setAttribute("data-salt-style", testId || "");
|
|
2820
|
+
styleMap.styleElement.textContent = css;
|
|
2821
|
+
styleMap.count = 1;
|
|
2822
|
+
targetWindow.document.head.insertBefore(
|
|
2823
|
+
styleMap.styleElement,
|
|
2824
|
+
insertionPoint || targetWindow.document.head.firstChild
|
|
2825
|
+
);
|
|
2826
|
+
} else {
|
|
2827
|
+
styleMap.styleElement.textContent = css;
|
|
2828
|
+
styleMap.count++;
|
|
2829
|
+
}
|
|
2830
|
+
sheetsMap.set(css, styleMap);
|
|
2831
|
+
windowSheetsMap.set(targetWindow, sheetsMap);
|
|
2832
|
+
return () => {
|
|
2833
|
+
const sheetsMap2 = windowSheetsMap.get(targetWindow);
|
|
2834
|
+
const styleMap2 = sheetsMap2 == null ? void 0 : sheetsMap2.get(css);
|
|
2835
|
+
if (styleMap2 == null ? void 0 : styleMap2.styleElement) {
|
|
2836
|
+
styleMap2.count--;
|
|
2837
|
+
if (styleMap2.count < 1) {
|
|
2838
|
+
targetWindow.document.head.removeChild(styleMap2.styleElement);
|
|
2839
|
+
styleMap2.styleElement = null;
|
|
2840
|
+
sheetsMap2 == null ? void 0 : sheetsMap2.delete(css);
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
};
|
|
2844
|
+
}, [testId, css, targetWindow]);
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
// ../../node_modules/@salt-ds/icons/dist-es/icon/Icon.css.js
|
|
2848
|
+
var css_248z = "/* Style applied to the root element */\n.saltIcon {\n --icon-color: var(--saltIcon-color, var(--salt-text-secondary-foreground));\n --icon-size-multiplier: var(--saltIcon-size-multiplier, 1);\n --icon-base-size: var(--salt-icon-size-base, 12px);\n /**\n * Icon size will be the multiplier (an integer from the size prop) * the base size (set by the theme per density)\n * Icons should never be smaller than 12px for readability so we've added a max() to enforce this\n * Consumers can use --saltIcon-size variable to override this rule as an escape hatch\n */\n --icon-size: var(--saltIcon-size, max(calc(var(--icon-base-size) * var(--icon-size-multiplier)), 12px));\n}\n\n.saltIcon {\n fill: var(--saltIcon-color, var(--icon-color));\n display: inline-block;\n margin: var(--saltIcon-margin, 0);\n position: relative;\n width: var(--icon-size);\n height: var(--icon-size);\n min-width: var(--icon-size);\n min-height: var(--icon-size);\n}\n\n.saltIcon:hover {\n --icon-color: var(--saltIcon-color-hover, var(--salt-text-secondary-foreground));\n}\n\n.saltIcon:active {\n --icon-color: var(--saltIcon-color-active, var(--salt-text-secondary-foreground));\n}\n";
|
|
2849
|
+
|
|
2850
|
+
// ../../node_modules/@salt-ds/icons/dist-es/icon/Icon.js
|
|
2851
|
+
var makePrefixer = (prefix) => (...names) => [prefix, ...names].join("-");
|
|
2852
|
+
var withBaseName = makePrefixer("saltIcon");
|
|
2853
|
+
var DEFAULT_ICON_SIZE = 1;
|
|
2854
|
+
var Icon = (0, import_react46.forwardRef)(function Icon2({ children, className, size = DEFAULT_ICON_SIZE, style: styleProp, ...rest }, ref) {
|
|
2855
|
+
const targetWindow = useWindow();
|
|
2856
|
+
useComponentCssInjection({
|
|
2857
|
+
testId: "salt-icon",
|
|
2858
|
+
css: css_248z,
|
|
2859
|
+
window: targetWindow
|
|
2860
|
+
});
|
|
2861
|
+
const style = {
|
|
2862
|
+
...styleProp,
|
|
2863
|
+
"--saltIcon-size-multiplier": `${size}`
|
|
2864
|
+
};
|
|
2865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", {
|
|
2866
|
+
className: clsx(withBaseName(), className),
|
|
2867
|
+
style,
|
|
2868
|
+
role: "img",
|
|
2869
|
+
...rest,
|
|
2870
|
+
ref,
|
|
2871
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("g", {
|
|
2872
|
+
"aria-hidden": true,
|
|
2873
|
+
children
|
|
2874
|
+
})
|
|
2875
|
+
});
|
|
2876
|
+
});
|
|
2877
|
+
|
|
2878
|
+
// ../../node_modules/@salt-ds/icons/dist-es/components/Export.js
|
|
2879
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2880
|
+
var import_react47 = require("react");
|
|
2881
|
+
var ExportIcon = (0, import_react47.forwardRef)(
|
|
2882
|
+
function ExportIcon2(props, ref) {
|
|
2883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Icon, {
|
|
2884
|
+
"data-testid": "ExportIcon",
|
|
2885
|
+
"aria-label": "export",
|
|
2886
|
+
viewBox: "0 0 12 12",
|
|
2887
|
+
ref,
|
|
2888
|
+
...props,
|
|
2889
|
+
children: [
|
|
2890
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", {
|
|
2891
|
+
d: "M5 1H1v10h4v-1H2V2h3V1Z"
|
|
2892
|
+
}),
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", {
|
|
2894
|
+
d: "M3 5h5V3l4 3-4 3V7H3V5Z"
|
|
2895
|
+
})
|
|
2896
|
+
]
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
2899
|
+
);
|
|
2900
|
+
|
|
2901
|
+
// ../vuu-shell/src/user-profile/UserPanel.tsx
|
|
2902
|
+
var import_vuu_utils13 = require("@vuu-ui/vuu-utils");
|
|
2903
|
+
var import_lab2 = require("@salt-ds/lab");
|
|
2904
|
+
var import_core10 = require("@salt-ds/core");
|
|
2905
|
+
var import_react48 = require("react");
|
|
2906
|
+
|
|
2907
|
+
// ../vuu-shell/src/get-layout-history.ts
|
|
2908
|
+
var getLayoutHistory = async (user) => {
|
|
2909
|
+
const history = await fetch(`api/vui/${user.username}`, {}).then((response) => {
|
|
2910
|
+
return response.ok ? response.json() : null;
|
|
2911
|
+
}).catch(() => {
|
|
2912
|
+
console.log("error getting history");
|
|
2913
|
+
});
|
|
2914
|
+
return history;
|
|
2915
|
+
};
|
|
2916
|
+
|
|
2917
|
+
// ../vuu-shell/src/user-profile/UserPanel.tsx
|
|
2918
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2919
|
+
var byLastUpdate = ({ lastUpdate: l1 }, { lastUpdate: l2 }) => {
|
|
2920
|
+
return l2 === l1 ? 0 : l2 < l1 ? -1 : 1;
|
|
2921
|
+
};
|
|
2922
|
+
var HistoryListItem = (props) => {
|
|
2923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lab2.ListItem, { ...props });
|
|
2924
|
+
};
|
|
2925
|
+
var UserPanel = (0, import_react48.forwardRef)(function UserPanel2({ loginUrl, onNavigate, user, layoutId = "latest" }, forwardedRef) {
|
|
2926
|
+
const [history, setHistory] = (0, import_react48.useState)([]);
|
|
2927
|
+
(0, import_react48.useEffect)(() => {
|
|
2928
|
+
async function getHistory() {
|
|
2929
|
+
const history2 = await getLayoutHistory(user);
|
|
2930
|
+
const sortedHistory = history2.filter((item) => item.id !== "latest").sort(byLastUpdate).map(({ id, lastUpdate }) => ({
|
|
2931
|
+
lastUpdate,
|
|
2932
|
+
id,
|
|
2933
|
+
label: `Saved at ${(0, import_vuu_utils13.formatDate)(new Date(lastUpdate), "kk:mm:ss")}`
|
|
2934
|
+
}));
|
|
2935
|
+
console.log({ sortedHistory });
|
|
2936
|
+
setHistory(sortedHistory);
|
|
2937
|
+
}
|
|
2938
|
+
getHistory();
|
|
2939
|
+
}, [user]);
|
|
2940
|
+
const handleHisorySelected = (0, import_react48.useCallback)(
|
|
2941
|
+
(evt, selected2) => {
|
|
2942
|
+
if (selected2) {
|
|
2943
|
+
onNavigate(selected2.id);
|
|
2944
|
+
}
|
|
2945
|
+
},
|
|
2946
|
+
[onNavigate]
|
|
2947
|
+
);
|
|
2948
|
+
const handleLogout = (0, import_react48.useCallback)(() => {
|
|
2949
|
+
logout(loginUrl);
|
|
2950
|
+
}, [loginUrl]);
|
|
2951
|
+
const selected = history.length === 0 ? null : layoutId === "latest" ? history[0] : history.find((i) => i.id === layoutId);
|
|
2952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "vuuUserPanel", ref: forwardedRef, children: [
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2954
|
+
import_lab2.List,
|
|
2955
|
+
{
|
|
2956
|
+
ListItem: HistoryListItem,
|
|
2957
|
+
className: "vuuUserPanel-history",
|
|
2958
|
+
onSelect: handleHisorySelected,
|
|
2959
|
+
selected,
|
|
2960
|
+
source: history
|
|
2961
|
+
}
|
|
2962
|
+
),
|
|
2963
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "vuuUserPanel-buttonBar", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_core10.Button, { "aria-label": "logout", onClick: handleLogout, children: [
|
|
2964
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ExportIcon, {}),
|
|
2965
|
+
" Logout"
|
|
2966
|
+
] }) })
|
|
2967
|
+
] });
|
|
2968
|
+
});
|
|
2969
|
+
|
|
2970
|
+
// ../vuu-shell/src/user-profile/UserProfile.tsx
|
|
2971
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2972
|
+
|
|
2973
|
+
// ../vuu-shell/src/theme-switch/ThemeSwitch.tsx
|
|
2974
|
+
var import_classnames16 = __toESM(require_classnames());
|
|
2975
|
+
var import_core12 = require("@salt-ds/core");
|
|
2976
|
+
var import_react49 = require("react");
|
|
2977
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2978
|
+
|
|
2979
|
+
// ../vuu-shell/src/app-header/AppHeader.tsx
|
|
2980
|
+
var import_classnames17 = __toESM(require_classnames());
|
|
2981
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2982
|
+
|
|
2983
|
+
// ../vuu-shell/src/shell.tsx
|
|
2984
|
+
var import_vuu_utils14 = require("@vuu-ui/vuu-utils");
|
|
2985
|
+
|
|
2986
|
+
// ../vuu-shell/src/shell-layouts/context-panel/ContextPanel.tsx
|
|
2987
|
+
var import_core13 = require("@salt-ds/core");
|
|
2988
|
+
var import_classnames18 = __toESM(require_classnames());
|
|
2989
|
+
var import_react51 = require("react");
|
|
2990
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2991
|
+
|
|
2992
|
+
// ../vuu-shell/src/shell-layouts/useFullHeightLeftPanel.tsx
|
|
2993
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2994
|
+
|
|
2995
|
+
// ../vuu-shell/src/shell-layouts/useInlayLeftPanel.tsx
|
|
2996
|
+
var import_react52 = require("react");
|
|
2997
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2998
|
+
|
|
2999
|
+
// ../vuu-shell/src/shell.tsx
|
|
3000
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3001
|
+
var { error } = (0, import_vuu_utils14.logger)("Shell");
|
|
3002
|
+
|
|
3003
|
+
// ../vuu-shell/src/ShellContextProvider.tsx
|
|
3004
|
+
var import_react54 = require("react");
|
|
3005
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3006
|
+
var defaultConfig = {};
|
|
3007
|
+
var ShellContext = (0, import_react54.createContext)(defaultConfig);
|
|
3008
|
+
|
|
3009
|
+
// ../vuu-layout/src/layout-persistence/useLayoutContextMenuItems.tsx
|
|
3010
|
+
var import_react55 = require("react");
|
|
3011
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3012
|
+
|
|
3013
|
+
// ../vuu-layout/src/measured-container/MeasuredContainer.tsx
|
|
3014
|
+
var import_react58 = require("react");
|
|
3015
|
+
|
|
3016
|
+
// ../vuu-layout/src/measured-container/useMeasuredContainer.ts
|
|
3017
|
+
var import_vuu_utils15 = require("@vuu-ui/vuu-utils");
|
|
3018
|
+
var import_react57 = require("react");
|
|
2253
3019
|
|
|
2254
3020
|
// ../vuu-layout/src/measured-container/useResizeObserver.ts
|
|
2255
|
-
var
|
|
3021
|
+
var import_react56 = require("react");
|
|
2256
3022
|
var observedMap2 = /* @__PURE__ */ new Map();
|
|
2257
3023
|
var getTargetSize2 = (element, size, dimension3) => {
|
|
2258
3024
|
switch (dimension3) {
|
|
@@ -2303,8 +3069,8 @@ var resizeObserver2 = new ResizeObserver((entries) => {
|
|
|
2303
3069
|
}
|
|
2304
3070
|
});
|
|
2305
3071
|
function useResizeObserver2(ref, dimensions, onResize, reportInitialSize = false) {
|
|
2306
|
-
const dimensionsRef = (0,
|
|
2307
|
-
const measure = (0,
|
|
3072
|
+
const dimensionsRef = (0, import_react56.useRef)(dimensions);
|
|
3073
|
+
const measure = (0, import_react56.useCallback)((target) => {
|
|
2308
3074
|
const { width, height } = target.getBoundingClientRect();
|
|
2309
3075
|
const { clientWidth: contentWidth, clientHeight: contentHeight } = target;
|
|
2310
3076
|
return dimensionsRef.current.reduce(
|
|
@@ -2319,7 +3085,7 @@ function useResizeObserver2(ref, dimensions, onResize, reportInitialSize = false
|
|
|
2319
3085
|
{}
|
|
2320
3086
|
);
|
|
2321
3087
|
}, []);
|
|
2322
|
-
(0,
|
|
3088
|
+
(0, import_react56.useEffect)(() => {
|
|
2323
3089
|
const target = ref.current;
|
|
2324
3090
|
async function registerObserver() {
|
|
2325
3091
|
observedMap2.set(target, { measurements: {} });
|
|
@@ -2356,7 +3122,7 @@ function useResizeObserver2(ref, dimensions, onResize, reportInitialSize = false
|
|
|
2356
3122
|
}
|
|
2357
3123
|
};
|
|
2358
3124
|
}, [measure, ref]);
|
|
2359
|
-
(0,
|
|
3125
|
+
(0, import_react56.useEffect)(() => {
|
|
2360
3126
|
const target = ref.current;
|
|
2361
3127
|
const record = observedMap2.get(target);
|
|
2362
3128
|
if (record) {
|
|
@@ -2378,7 +3144,7 @@ var NO_MEASUREMENT2 = [];
|
|
|
2378
3144
|
var isNumber = (val) => Number.isFinite(val);
|
|
2379
3145
|
var FULL_SIZE = { height: "100%", width: "100%" };
|
|
2380
3146
|
var getInitialCssSize = (height, width) => {
|
|
2381
|
-
if ((0,
|
|
3147
|
+
if ((0, import_vuu_utils15.isValidNumber)(height) && (0, import_vuu_utils15.isValidNumber)(width)) {
|
|
2382
3148
|
return {
|
|
2383
3149
|
height: `${height}px`,
|
|
2384
3150
|
width: `${width}px`
|
|
@@ -2393,7 +3159,7 @@ var getInitialCssSize = (height, width) => {
|
|
|
2393
3159
|
}
|
|
2394
3160
|
};
|
|
2395
3161
|
var getInitialInnerSize = (height, width) => {
|
|
2396
|
-
if ((0,
|
|
3162
|
+
if ((0, import_vuu_utils15.isValidNumber)(height) && (0, import_vuu_utils15.isValidNumber)(width)) {
|
|
2397
3163
|
return {
|
|
2398
3164
|
height,
|
|
2399
3165
|
width
|
|
@@ -2407,8 +3173,8 @@ var useMeasuredContainer = ({
|
|
|
2407
3173
|
onResize: onResizeProp,
|
|
2408
3174
|
width
|
|
2409
3175
|
}) => {
|
|
2410
|
-
const containerRef = (0,
|
|
2411
|
-
const [size, setSize] = (0,
|
|
3176
|
+
const containerRef = (0, import_react57.useRef)(null);
|
|
3177
|
+
const [size, setSize] = (0, import_react57.useState)({
|
|
2412
3178
|
css: getInitialCssSize(height, width),
|
|
2413
3179
|
inner: getInitialInnerSize(height, width),
|
|
2414
3180
|
outer: {
|
|
@@ -2419,15 +3185,15 @@ var useMeasuredContainer = ({
|
|
|
2419
3185
|
const fixedHeight = typeof height === "number";
|
|
2420
3186
|
const fixedWidth = typeof width === "number";
|
|
2421
3187
|
const dimensions = fixedHeight && fixedWidth ? NO_MEASUREMENT2 : fixedHeight ? WidthOnly : fixedWidth ? HeightOnly : ClientWidthHeight;
|
|
2422
|
-
(0,
|
|
3188
|
+
(0, import_react57.useMemo)(() => {
|
|
2423
3189
|
setSize((currentSize) => {
|
|
2424
3190
|
const { inner, outer } = currentSize;
|
|
2425
|
-
if ((0,
|
|
3191
|
+
if ((0, import_vuu_utils15.isValidNumber)(height) && (0, import_vuu_utils15.isValidNumber)(width) && inner && outer) {
|
|
2426
3192
|
const { height: innerHeight, width: innerWidth } = inner;
|
|
2427
3193
|
const { height: outerHeight, width: outerWidth } = outer;
|
|
2428
3194
|
if (outerHeight !== height || outerWidth !== width) {
|
|
2429
|
-
const heightDiff = (0,
|
|
2430
|
-
const widthDiff = (0,
|
|
3195
|
+
const heightDiff = (0, import_vuu_utils15.isValidNumber)(outerHeight) ? outerHeight - innerHeight : 0;
|
|
3196
|
+
const widthDiff = (0, import_vuu_utils15.isValidNumber)(outerWidth) ? outerWidth - innerWidth : 0;
|
|
2431
3197
|
return {
|
|
2432
3198
|
...currentSize,
|
|
2433
3199
|
outer: { height, width },
|
|
@@ -2438,7 +3204,7 @@ var useMeasuredContainer = ({
|
|
|
2438
3204
|
return currentSize;
|
|
2439
3205
|
});
|
|
2440
3206
|
}, [height, width]);
|
|
2441
|
-
const onResize = (0,
|
|
3207
|
+
const onResize = (0, import_react57.useCallback)(
|
|
2442
3208
|
({ clientWidth, clientHeight }) => {
|
|
2443
3209
|
const { css, inner, outer } = size;
|
|
2444
3210
|
let newState = size;
|
|
@@ -2476,7 +3242,7 @@ var useMeasuredContainer = ({
|
|
|
2476
3242
|
},
|
|
2477
3243
|
[defaultHeight, defaultWidth, fixedHeight, fixedWidth, height, size, width]
|
|
2478
3244
|
);
|
|
2479
|
-
(0,
|
|
3245
|
+
(0, import_react57.useEffect)(() => {
|
|
2480
3246
|
if (size.inner) {
|
|
2481
3247
|
onResizeProp == null ? void 0 : onResizeProp(size.inner);
|
|
2482
3248
|
}
|
|
@@ -2491,11 +3257,11 @@ var useMeasuredContainer = ({
|
|
|
2491
3257
|
};
|
|
2492
3258
|
|
|
2493
3259
|
// ../vuu-layout/src/measured-container/MeasuredContainer.tsx
|
|
2494
|
-
var
|
|
2495
|
-
var
|
|
2496
|
-
var
|
|
3260
|
+
var import_core14 = require("@salt-ds/core");
|
|
3261
|
+
var import_classnames20 = __toESM(require_classnames());
|
|
3262
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2497
3263
|
var baseClass = "vuuMeasuredContainer";
|
|
2498
|
-
var MeasuredContainer = (0,
|
|
3264
|
+
var MeasuredContainer = (0, import_react58.forwardRef)(function MeasuredContainer2({
|
|
2499
3265
|
children,
|
|
2500
3266
|
className,
|
|
2501
3267
|
height,
|
|
@@ -2523,20 +3289,20 @@ var MeasuredContainer = (0, import_react35.forwardRef)(function MeasuredContaine
|
|
|
2523
3289
|
"--measured-px-width": `${innerSize == null ? void 0 : innerSize.width}px`
|
|
2524
3290
|
};
|
|
2525
3291
|
};
|
|
2526
|
-
const forkedRef = (0,
|
|
2527
|
-
return unmeasured ? /* @__PURE__ */ (0,
|
|
3292
|
+
const forkedRef = (0, import_core14.useForkRef)(containerRef, forwardedRef);
|
|
3293
|
+
return unmeasured ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2528
3294
|
"div",
|
|
2529
3295
|
{
|
|
2530
3296
|
...htmlAttributes,
|
|
2531
|
-
className: (0,
|
|
3297
|
+
className: (0, import_classnames20.default)(baseClass, `${baseClass}-ummeasured`),
|
|
2532
3298
|
style: getStyle2(),
|
|
2533
3299
|
ref: containerRef
|
|
2534
3300
|
}
|
|
2535
|
-
) : /* @__PURE__ */ (0,
|
|
3301
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2536
3302
|
"div",
|
|
2537
3303
|
{
|
|
2538
3304
|
...htmlAttributes,
|
|
2539
|
-
className: (0,
|
|
3305
|
+
className: (0, import_classnames20.default)(baseClass, className),
|
|
2540
3306
|
ref: forkedRef,
|
|
2541
3307
|
style: getStyle2(),
|
|
2542
3308
|
children
|
|
@@ -2546,16 +3312,16 @@ var MeasuredContainer = (0, import_react35.forwardRef)(function MeasuredContaine
|
|
|
2546
3312
|
|
|
2547
3313
|
// ../vuu-layout/src/overflow-container/OverflowContainer.tsx
|
|
2548
3314
|
var import_vuu_popups2 = require("@vuu-ui/vuu-popups");
|
|
2549
|
-
var
|
|
2550
|
-
var
|
|
3315
|
+
var import_classnames21 = __toESM(require_classnames());
|
|
3316
|
+
var import_react60 = __toESM(require("react"));
|
|
2551
3317
|
|
|
2552
3318
|
// ../vuu-layout/src/overflow-container/useOverflowContainer.ts
|
|
2553
|
-
var
|
|
2554
|
-
var
|
|
2555
|
-
var
|
|
3319
|
+
var import_vuu_ui_controls5 = require("@vuu-ui/vuu-ui-controls");
|
|
3320
|
+
var import_vuu_utils17 = require("@vuu-ui/vuu-utils");
|
|
3321
|
+
var import_react59 = require("react");
|
|
2556
3322
|
|
|
2557
3323
|
// ../vuu-layout/src/overflow-container/overflow-utils.ts
|
|
2558
|
-
var
|
|
3324
|
+
var import_vuu_utils16 = require("@vuu-ui/vuu-utils");
|
|
2559
3325
|
var NON_WRAPPED_ITEM = ".vuuOverflowContainer-item:not(.wrapped)";
|
|
2560
3326
|
var sortByScreenOrder = (elements) => elements.sort((e1, e2) => {
|
|
2561
3327
|
const {
|
|
@@ -2638,8 +3404,8 @@ var applyOverflowClassToWrappedItems = (container, overflowedItems) => {
|
|
|
2638
3404
|
var maxPriority = (priority, { overflowPriority }) => Math.max(priority, parseInt(overflowPriority));
|
|
2639
3405
|
var minPriority = (priority, { overflowPriority }) => Math.min(priority, parseInt(overflowPriority));
|
|
2640
3406
|
var overflowIndicatorHasWrappedButShouldNotHave = (wrappedItems) => {
|
|
2641
|
-
var
|
|
2642
|
-
return wrappedItems.length > 1 && ((
|
|
3407
|
+
var _a2;
|
|
3408
|
+
return wrappedItems.length > 1 && ((_a2 = wrappedItems.at(-1)) == null ? void 0 : _a2.index) === "overflow";
|
|
2643
3409
|
};
|
|
2644
3410
|
var getHighestPriorityItem = (overflowItems) => {
|
|
2645
3411
|
let [highestPriorityItem] = overflowItems;
|
|
@@ -2652,7 +3418,7 @@ var getHighestPriorityItem = (overflowItems) => {
|
|
|
2652
3418
|
return highestPriorityItem;
|
|
2653
3419
|
};
|
|
2654
3420
|
var highPriorityItemsHaveWrappedButShouldNotHave = (nonWrappedItems, wrappedItems) => {
|
|
2655
|
-
var
|
|
3421
|
+
var _a2;
|
|
2656
3422
|
const minNonwrappedPriority = nonWrappedItems.reduce(
|
|
2657
3423
|
minPriority,
|
|
2658
3424
|
Number.MAX_SAFE_INTEGER
|
|
@@ -2661,7 +3427,7 @@ var highPriorityItemsHaveWrappedButShouldNotHave = (nonWrappedItems, wrappedItem
|
|
|
2661
3427
|
if (maxwrappedPriority > minNonwrappedPriority) {
|
|
2662
3428
|
return true;
|
|
2663
3429
|
} else {
|
|
2664
|
-
return wrappedItems.length > 1 && ((
|
|
3430
|
+
return wrappedItems.length > 1 && ((_a2 = wrappedItems.at(-1)) == null ? void 0 : _a2.index) === "overflow";
|
|
2665
3431
|
}
|
|
2666
3432
|
};
|
|
2667
3433
|
var correctForWrappedOverflowIndicator = (container, overflowedItems) => new Promise((resolve) => {
|
|
@@ -2688,7 +3454,7 @@ var correctForWrappedHighPriorityItems = (container, nonWrapped, wrapped) => new
|
|
|
2688
3454
|
});
|
|
2689
3455
|
});
|
|
2690
3456
|
var markElementAsWrapped = (container, item) => {
|
|
2691
|
-
const el = (0,
|
|
3457
|
+
const el = (0, import_vuu_utils16.getElementByDataIndex)(container, item.index);
|
|
2692
3458
|
if (el) {
|
|
2693
3459
|
el.classList.add("wrapped");
|
|
2694
3460
|
} else {
|
|
@@ -2762,7 +3528,7 @@ var getNonwrappedItemsByPriority = (container) => Array.from(container.querySele
|
|
|
2762
3528
|
);
|
|
2763
3529
|
var switchWrappedItemIntoView = (container, overflowItem) => {
|
|
2764
3530
|
const unwrappedItems = getNonwrappedItemsByPriority(container);
|
|
2765
|
-
const targetElement = (0,
|
|
3531
|
+
const targetElement = (0, import_vuu_utils16.getElementByDataIndex)(
|
|
2766
3532
|
container,
|
|
2767
3533
|
overflowItem.index,
|
|
2768
3534
|
true
|
|
@@ -2812,10 +3578,16 @@ var useOverflowContainer = ({
|
|
|
2812
3578
|
onSwitchWrappedItemIntoView,
|
|
2813
3579
|
orientation = "horizontal"
|
|
2814
3580
|
}) => {
|
|
2815
|
-
const [container, setContainer] = (0,
|
|
2816
|
-
const wrappedItemsRef = (0,
|
|
2817
|
-
const containerRef = (0,
|
|
2818
|
-
const
|
|
3581
|
+
const [container, setContainer] = (0, import_react59.useState)(null);
|
|
3582
|
+
const wrappedItemsRef = (0, import_react59.useRef)(NO_WRAPPED_ITEMS);
|
|
3583
|
+
const containerRef = (0, import_react59.useRef)(null);
|
|
3584
|
+
const setOverflowTabIndex = (0, import_react59.useCallback)((tabIndex) => {
|
|
3585
|
+
var _a2;
|
|
3586
|
+
if (containerRef.current) {
|
|
3587
|
+
(_a2 = containerRef.current.querySelector(".vuuOverflowContainer-OverflowIndicator button")) == null ? void 0 : _a2.setAttribute("tabindex", tabIndex);
|
|
3588
|
+
}
|
|
3589
|
+
}, []);
|
|
3590
|
+
const handleResize = (0, import_react59.useCallback)(async () => {
|
|
2819
3591
|
if (container) {
|
|
2820
3592
|
let [nonWrapped, wrapped] = getNonWrappedAndWrappedItems(
|
|
2821
3593
|
container,
|
|
@@ -2837,11 +3609,16 @@ var useOverflowContainer = ({
|
|
|
2837
3609
|
wrapped = NO_WRAPPED_ITEMS;
|
|
2838
3610
|
}
|
|
2839
3611
|
}
|
|
3612
|
+
if (wrappedItemsRef.current.length === 0 && wrapped.length > 0) {
|
|
3613
|
+
setOverflowTabIndex("0");
|
|
3614
|
+
} else if (wrappedItemsRef.current.length > 0 && wrapped.length === 0) {
|
|
3615
|
+
setOverflowTabIndex("-1");
|
|
3616
|
+
}
|
|
2840
3617
|
wrappedItemsRef.current = wrapped;
|
|
2841
3618
|
}
|
|
2842
|
-
}, [container, orientation]);
|
|
3619
|
+
}, [container, orientation, setOverflowTabIndex]);
|
|
2843
3620
|
const hasOverflowItem = (opt) => typeof opt === "object" && opt !== null && "overflowItem" in opt;
|
|
2844
|
-
const [menuBuilder, menuActionHandler] = (0,
|
|
3621
|
+
const [menuBuilder, menuActionHandler] = (0, import_react59.useMemo)(() => {
|
|
2845
3622
|
return [
|
|
2846
3623
|
() => {
|
|
2847
3624
|
const { current: menuItems } = wrappedItemsRef;
|
|
@@ -2866,14 +3643,14 @@ var useOverflowContainer = ({
|
|
|
2866
3643
|
}
|
|
2867
3644
|
];
|
|
2868
3645
|
}, [container, onSwitchWrappedItemIntoView]);
|
|
2869
|
-
const resizeObserver3 = (0,
|
|
2870
|
-
const { sizeProp } =
|
|
3646
|
+
const resizeObserver3 = (0, import_react59.useMemo)(() => {
|
|
3647
|
+
const { sizeProp } = import_vuu_utils17.MEASURES[orientation];
|
|
2871
3648
|
let currentSize = 0;
|
|
2872
3649
|
return new ResizeObserver((entries) => {
|
|
2873
3650
|
for (const entry of entries) {
|
|
2874
3651
|
const { [sizeProp]: actualSize } = entry.contentRect;
|
|
2875
3652
|
const size = Math.round(actualSize);
|
|
2876
|
-
if ((0,
|
|
3653
|
+
if ((0, import_vuu_utils17.isValidNumber)(size) && currentSize !== size) {
|
|
2877
3654
|
currentSize = size;
|
|
2878
3655
|
handleResize();
|
|
2879
3656
|
}
|
|
@@ -2883,21 +3660,21 @@ var useOverflowContainer = ({
|
|
|
2883
3660
|
useLayoutEffectSkipFirst(() => {
|
|
2884
3661
|
handleResize();
|
|
2885
3662
|
}, [handleResize, itemCount]);
|
|
2886
|
-
(0,
|
|
3663
|
+
(0, import_react59.useMemo)(() => {
|
|
2887
3664
|
if (container) {
|
|
2888
3665
|
resizeObserver3.observe(container);
|
|
2889
3666
|
}
|
|
2890
3667
|
}, [container, resizeObserver3]);
|
|
2891
|
-
const callbackRef = (0,
|
|
3668
|
+
const callbackRef = (0, import_react59.useCallback)((el) => {
|
|
2892
3669
|
setContainer(containerRef.current = el);
|
|
2893
3670
|
}, []);
|
|
2894
|
-
const handleDrop = (0,
|
|
3671
|
+
const handleDrop = (0, import_react59.useCallback)(
|
|
2895
3672
|
(fromIndex, toIndex) => {
|
|
2896
3673
|
onMoveItem == null ? void 0 : onMoveItem(fromIndex, toIndex);
|
|
2897
3674
|
},
|
|
2898
3675
|
[onMoveItem]
|
|
2899
3676
|
);
|
|
2900
|
-
const { onMouseDown: dragDropHookHandleMouseDown, ...dragDropHook } = (0,
|
|
3677
|
+
const { onMouseDown: dragDropHookHandleMouseDown, ...dragDropHook } = (0, import_vuu_ui_controls5.useDragDropNext)({
|
|
2901
3678
|
allowDragDrop,
|
|
2902
3679
|
containerRef,
|
|
2903
3680
|
// this is for useDragDropNext
|
|
@@ -2917,9 +3694,9 @@ var useOverflowContainer = ({
|
|
|
2917
3694
|
};
|
|
2918
3695
|
|
|
2919
3696
|
// ../vuu-layout/src/overflow-container/OverflowContainer.tsx
|
|
2920
|
-
var
|
|
2921
|
-
var
|
|
2922
|
-
var WrapContainer =
|
|
3697
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3698
|
+
var classBase10 = "vuuOverflowContainer";
|
|
3699
|
+
var WrapContainer = import_react60.default.memo(
|
|
2923
3700
|
({
|
|
2924
3701
|
allowDragDrop,
|
|
2925
3702
|
children,
|
|
@@ -2947,16 +3724,13 @@ var WrapContainer = import_react37.default.memo(
|
|
|
2947
3724
|
onSwitchWrappedItemIntoView,
|
|
2948
3725
|
orientation
|
|
2949
3726
|
});
|
|
2950
|
-
console.log(
|
|
2951
|
-
`Overflow container WRAPPER ${import_react37.default.Children.count(children)} children`
|
|
2952
|
-
);
|
|
2953
3727
|
const height = orientation === "vertical" ? "100%" : `${heightProp}px`;
|
|
2954
3728
|
const style = {
|
|
2955
3729
|
"--overflow-container-height": `${height}`
|
|
2956
3730
|
};
|
|
2957
|
-
const className = (0,
|
|
2958
|
-
[`${
|
|
2959
|
-
[`${
|
|
3731
|
+
const className = (0, import_classnames21.default)(`${classBase10}-wrapContainer`, classNameProp, {
|
|
3732
|
+
[`${classBase10}-horizontal`]: orientation === "horizontal",
|
|
3733
|
+
[`${classBase10}-vertical`]: orientation === "vertical"
|
|
2960
3734
|
});
|
|
2961
3735
|
const content = childElements.map((childEl, i) => {
|
|
2962
3736
|
const {
|
|
@@ -2965,10 +3739,10 @@ var WrapContainer = import_react37.default.memo(
|
|
|
2965
3739
|
id: itemId = `${id}-${i}`,
|
|
2966
3740
|
label = `Item ${i + 1}`
|
|
2967
3741
|
} = childEl.props;
|
|
2968
|
-
return /* @__PURE__ */ (0,
|
|
3742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2969
3743
|
"div",
|
|
2970
3744
|
{
|
|
2971
|
-
className: (0,
|
|
3745
|
+
className: (0, import_classnames21.default)(`${classBase10}-item`, {
|
|
2972
3746
|
"vuuDraggable-dragAway": draggedItemIndex === i
|
|
2973
3747
|
}),
|
|
2974
3748
|
"data-index": i,
|
|
@@ -2982,31 +3756,32 @@ var WrapContainer = import_react37.default.memo(
|
|
|
2982
3756
|
i
|
|
2983
3757
|
);
|
|
2984
3758
|
});
|
|
2985
|
-
const overflowIndicator = /* @__PURE__ */ (0,
|
|
3759
|
+
const overflowIndicator = /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2986
3760
|
"div",
|
|
2987
3761
|
{
|
|
2988
|
-
className: `${
|
|
3762
|
+
className: `${classBase10}-OverflowIndicator`,
|
|
2989
3763
|
"data-index": "overflow",
|
|
2990
|
-
children: /* @__PURE__ */ (0,
|
|
3764
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2991
3765
|
import_vuu_popups2.PopupMenu,
|
|
2992
3766
|
{
|
|
2993
3767
|
icon: overflowIcon,
|
|
2994
3768
|
menuBuilder,
|
|
2995
|
-
menuActionHandler
|
|
3769
|
+
menuActionHandler,
|
|
3770
|
+
tabIndex: -1
|
|
2996
3771
|
}
|
|
2997
3772
|
)
|
|
2998
3773
|
},
|
|
2999
3774
|
"overflow"
|
|
3000
3775
|
);
|
|
3001
3776
|
content.push(overflowIndicator);
|
|
3002
|
-
return /* @__PURE__ */ (0,
|
|
3777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className, ref: rootRef, style, children: [
|
|
3003
3778
|
content,
|
|
3004
3779
|
draggable
|
|
3005
3780
|
] });
|
|
3006
3781
|
}
|
|
3007
3782
|
);
|
|
3008
3783
|
WrapContainer.displayName = "OverflowContainer.InnerContainer";
|
|
3009
|
-
var OverflowContainer = (0,
|
|
3784
|
+
var OverflowContainer = (0, import_react60.forwardRef)(function OverflowContainer2({
|
|
3010
3785
|
allowDragDrop = false,
|
|
3011
3786
|
children,
|
|
3012
3787
|
className,
|
|
@@ -3020,15 +3795,14 @@ var OverflowContainer = (0, import_react37.forwardRef)(function OverflowContaine
|
|
|
3020
3795
|
...htmlAttributes
|
|
3021
3796
|
}, forwardedRef) {
|
|
3022
3797
|
const id = useId(idProp);
|
|
3023
|
-
|
|
3024
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3025
3799
|
"div",
|
|
3026
3800
|
{
|
|
3027
3801
|
...htmlAttributes,
|
|
3028
|
-
className: (0,
|
|
3802
|
+
className: (0, import_classnames21.default)((0, import_classnames21.default)(classBase10, className)),
|
|
3029
3803
|
id,
|
|
3030
3804
|
ref: forwardedRef,
|
|
3031
|
-
children: /* @__PURE__ */ (0,
|
|
3805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3032
3806
|
WrapContainer,
|
|
3033
3807
|
{
|
|
3034
3808
|
allowDragDrop,
|
|
@@ -3047,18 +3821,18 @@ var OverflowContainer = (0, import_react37.forwardRef)(function OverflowContaine
|
|
|
3047
3821
|
});
|
|
3048
3822
|
|
|
3049
3823
|
// ../vuu-layout/src/palette/Palette.tsx
|
|
3050
|
-
var
|
|
3051
|
-
var
|
|
3052
|
-
var
|
|
3053
|
-
var
|
|
3054
|
-
var
|
|
3824
|
+
var import_vuu_utils18 = require("@vuu-ui/vuu-utils");
|
|
3825
|
+
var import_vuu_ui_controls6 = require("@vuu-ui/vuu-ui-controls");
|
|
3826
|
+
var import_classnames22 = __toESM(require_classnames());
|
|
3827
|
+
var import_react61 = require("react");
|
|
3828
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3055
3829
|
var clonePaletteItem = (paletteItem) => {
|
|
3056
3830
|
const dolly = paletteItem.cloneNode(true);
|
|
3057
3831
|
dolly.id = "";
|
|
3058
3832
|
delete dolly.dataset.idx;
|
|
3059
3833
|
return dolly;
|
|
3060
3834
|
};
|
|
3061
|
-
var PaletteItem = (0,
|
|
3835
|
+
var PaletteItem = (0, import_react61.memo)(
|
|
3062
3836
|
({
|
|
3063
3837
|
className,
|
|
3064
3838
|
children: component,
|
|
@@ -3068,10 +3842,10 @@ var PaletteItem = (0, import_react38.memo)(
|
|
|
3068
3842
|
closeable,
|
|
3069
3843
|
...props
|
|
3070
3844
|
}) => {
|
|
3071
|
-
return /* @__PURE__ */ (0,
|
|
3072
|
-
|
|
3845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3846
|
+
import_vuu_ui_controls6.ListItem,
|
|
3073
3847
|
{
|
|
3074
|
-
className: (0,
|
|
3848
|
+
className: (0, import_classnames22.default)("vuuPaletteItem", className),
|
|
3075
3849
|
"data-draggable": true,
|
|
3076
3850
|
"data-icon": "draggable",
|
|
3077
3851
|
...props
|
|
@@ -3089,19 +3863,19 @@ var Palette = ({
|
|
|
3089
3863
|
...props
|
|
3090
3864
|
}) => {
|
|
3091
3865
|
const dispatch = useLayoutProviderDispatch();
|
|
3092
|
-
const
|
|
3866
|
+
const classBase20 = "vuuPalette";
|
|
3093
3867
|
function handleMouseDown(evt) {
|
|
3094
|
-
var
|
|
3868
|
+
var _a2, _b;
|
|
3095
3869
|
const target = evt.target;
|
|
3096
3870
|
const listItemElement = target.closest(".vuuPaletteItem");
|
|
3097
|
-
const idx = parseInt((_b = (
|
|
3871
|
+
const idx = parseInt((_b = (_a2 = listItemElement.dataset) == null ? void 0 : _a2.index) != null ? _b : "-1");
|
|
3098
3872
|
const {
|
|
3099
3873
|
props: { caption, children: payload, template, ...props2 }
|
|
3100
3874
|
} = children[idx];
|
|
3101
3875
|
const { height, left, top, width } = listItemElement.getBoundingClientRect();
|
|
3102
|
-
const id = (0,
|
|
3876
|
+
const id = (0, import_vuu_utils18.uuid)();
|
|
3103
3877
|
const identifiers = { id, key: id };
|
|
3104
|
-
const component = template ? payload : /* @__PURE__ */ (0,
|
|
3878
|
+
const component = template ? payload : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(MemoView, { ...ViewProps2, ...identifiers, ...props2, title: props2.label, children: payload });
|
|
3105
3879
|
dispatch({
|
|
3106
3880
|
dragRect: {
|
|
3107
3881
|
left,
|
|
@@ -3125,15 +3899,15 @@ var Palette = ({
|
|
|
3125
3899
|
type: "drag-start"
|
|
3126
3900
|
});
|
|
3127
3901
|
}
|
|
3128
|
-
return /* @__PURE__ */ (0,
|
|
3129
|
-
|
|
3902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3903
|
+
import_vuu_ui_controls6.List,
|
|
3130
3904
|
{
|
|
3131
3905
|
...props,
|
|
3132
|
-
className: (0,
|
|
3906
|
+
className: (0, import_classnames22.default)(classBase20, className, `${classBase20}-${orientation}`),
|
|
3133
3907
|
itemHeight,
|
|
3134
3908
|
selected: null,
|
|
3135
3909
|
children: children.map(
|
|
3136
|
-
(child, idx) => child.type === PaletteItem ? (0,
|
|
3910
|
+
(child, idx) => child.type === PaletteItem ? (0, import_react61.cloneElement)(child, {
|
|
3137
3911
|
key: idx,
|
|
3138
3912
|
onMouseDown: handleMouseDown
|
|
3139
3913
|
}) : child
|
|
@@ -3144,20 +3918,20 @@ var Palette = ({
|
|
|
3144
3918
|
registerComponent("Palette", Palette, "view");
|
|
3145
3919
|
|
|
3146
3920
|
// ../vuu-layout/src/stack/Stack.tsx
|
|
3147
|
-
var
|
|
3148
|
-
var
|
|
3149
|
-
var
|
|
3150
|
-
var
|
|
3151
|
-
var
|
|
3921
|
+
var import_vuu_ui_controls7 = require("@vuu-ui/vuu-ui-controls");
|
|
3922
|
+
var import_classnames23 = __toESM(require_classnames());
|
|
3923
|
+
var import_react62 = __toESM(require("react"));
|
|
3924
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3925
|
+
var classBase11 = "Tabs";
|
|
3152
3926
|
var getDefaultTabIcon = () => void 0;
|
|
3153
3927
|
var getDefaultTabLabel = (component, tabIndex) => {
|
|
3154
|
-
var
|
|
3155
|
-
return (_d = (_c = (
|
|
3928
|
+
var _a2, _b, _c, _d;
|
|
3929
|
+
return (_d = (_c = (_a2 = component.props) == null ? void 0 : _a2.title) != null ? _c : (_b = component.props) == null ? void 0 : _b["data-tab-title"]) != null ? _d : `Tab ${tabIndex + 1}`;
|
|
3156
3930
|
};
|
|
3157
3931
|
var getChildElements = (children) => {
|
|
3158
3932
|
const elements = [];
|
|
3159
|
-
|
|
3160
|
-
if (
|
|
3933
|
+
import_react62.default.Children.forEach(children, (child) => {
|
|
3934
|
+
if (import_react62.default.isValidElement(child)) {
|
|
3161
3935
|
elements.push(child);
|
|
3162
3936
|
} else {
|
|
3163
3937
|
console.warn(`Stack has unexpected child element type`);
|
|
@@ -3170,7 +3944,7 @@ var DefaultTabstripProps = {
|
|
|
3170
3944
|
allowCloseTab: false,
|
|
3171
3945
|
allowRenameTab: false
|
|
3172
3946
|
};
|
|
3173
|
-
var Stack = (0,
|
|
3947
|
+
var Stack = (0, import_react62.forwardRef)(function Stack2({
|
|
3174
3948
|
active = 0,
|
|
3175
3949
|
children,
|
|
3176
3950
|
className: classNameProp,
|
|
@@ -3188,26 +3962,26 @@ var Stack = (0, import_react39.forwardRef)(function Stack2({
|
|
|
3188
3962
|
style,
|
|
3189
3963
|
TabstripProps: TabstripProps2 = DefaultTabstripProps
|
|
3190
3964
|
}, ref) {
|
|
3191
|
-
var
|
|
3965
|
+
var _a2;
|
|
3192
3966
|
const id = useId(idProp);
|
|
3193
3967
|
const {
|
|
3194
3968
|
allowCloseTab,
|
|
3195
3969
|
allowRenameTab,
|
|
3196
3970
|
className: tabstripClassName
|
|
3197
3971
|
} = TabstripProps2;
|
|
3198
|
-
const handleExitEditMode = (0,
|
|
3972
|
+
const handleExitEditMode = (0, import_react62.useCallback)(
|
|
3199
3973
|
(_oldText, newText, _allowDeactivation, tabIndex) => {
|
|
3200
3974
|
onTabEdit == null ? void 0 : onTabEdit(tabIndex, newText);
|
|
3201
3975
|
},
|
|
3202
3976
|
[onTabEdit]
|
|
3203
3977
|
);
|
|
3204
3978
|
const activeChild = () => {
|
|
3205
|
-
var
|
|
3206
|
-
if (
|
|
3979
|
+
var _a3;
|
|
3980
|
+
if (import_react62.default.isValidElement(children)) {
|
|
3207
3981
|
return children;
|
|
3208
3982
|
}
|
|
3209
3983
|
if (Array.isArray(children)) {
|
|
3210
|
-
return (
|
|
3984
|
+
return (_a3 = children[active]) != null ? _a3 : null;
|
|
3211
3985
|
}
|
|
3212
3986
|
return null;
|
|
3213
3987
|
};
|
|
@@ -3217,8 +3991,8 @@ var Stack = (0, import_react39.forwardRef)(function Stack2({
|
|
|
3217
3991
|
id: childId = `${id}-${idx}`,
|
|
3218
3992
|
"data-tab-location": tabLocation
|
|
3219
3993
|
} = child2.props;
|
|
3220
|
-
return /* @__PURE__ */ (0,
|
|
3221
|
-
|
|
3994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
3995
|
+
import_vuu_ui_controls7.Tab,
|
|
3222
3996
|
{
|
|
3223
3997
|
ariaControls: childId,
|
|
3224
3998
|
"data-icon": getTabIcon(child2, idx),
|
|
@@ -3235,24 +4009,24 @@ var Stack = (0, import_react39.forwardRef)(function Stack2({
|
|
|
3235
4009
|
const child = activeChild();
|
|
3236
4010
|
const isHorizontal = showTabs === "left" || showTabs === "right";
|
|
3237
4011
|
const tabstripOrientation = isHorizontal ? "vertical" : "horizontal";
|
|
3238
|
-
return /* @__PURE__ */ (0,
|
|
4012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
3239
4013
|
"div",
|
|
3240
4014
|
{
|
|
3241
|
-
className: (0,
|
|
3242
|
-
[`${
|
|
4015
|
+
className: (0, import_classnames23.default)(classBase11, classNameProp, {
|
|
4016
|
+
[`${classBase11}-horizontal`]: isHorizontal
|
|
3243
4017
|
}),
|
|
3244
4018
|
style,
|
|
3245
4019
|
id,
|
|
3246
4020
|
ref,
|
|
3247
4021
|
children: [
|
|
3248
|
-
showTabs ? /* @__PURE__ */ (0,
|
|
3249
|
-
|
|
4022
|
+
showTabs ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
4023
|
+
import_vuu_ui_controls7.Tabstrip,
|
|
3250
4024
|
{
|
|
3251
4025
|
...TabstripProps2,
|
|
3252
|
-
activeTabIndex: (
|
|
4026
|
+
activeTabIndex: (_a2 = TabstripProps2 == null ? void 0 : TabstripProps2.activeTabIndex) != null ? _a2 : child === null ? -1 : active,
|
|
3253
4027
|
allowDragDrop: TabstripProps2.allowDragDrop !== false,
|
|
3254
4028
|
animateSelectionThumb: true,
|
|
3255
|
-
className: (0,
|
|
4029
|
+
className: (0, import_classnames23.default)("vuuTabHeader", tabstripClassName),
|
|
3256
4030
|
keyBoardActivation,
|
|
3257
4031
|
onActiveChange: onTabSelectionChanged,
|
|
3258
4032
|
onAddTab,
|
|
@@ -3271,10 +4045,10 @@ var Stack = (0, import_react39.forwardRef)(function Stack2({
|
|
|
3271
4045
|
Stack.displayName = "Stack";
|
|
3272
4046
|
|
|
3273
4047
|
// ../vuu-layout/src/stack/StackLayout.tsx
|
|
3274
|
-
var
|
|
3275
|
-
var
|
|
3276
|
-
var
|
|
3277
|
-
var defaultCreateNewChild = (index) => /* @__PURE__ */ (0,
|
|
4048
|
+
var import_core15 = require("@salt-ds/core");
|
|
4049
|
+
var import_react63 = __toESM(require("react"));
|
|
4050
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
4051
|
+
var defaultCreateNewChild = (index) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3278
4052
|
MemoView,
|
|
3279
4053
|
{
|
|
3280
4054
|
resizeable: true,
|
|
@@ -3282,12 +4056,12 @@ var defaultCreateNewChild = (index) => /* @__PURE__ */ (0, import_jsx_runtime20.
|
|
|
3282
4056
|
style: { flexGrow: 1, flexShrink: 0, flexBasis: 0 },
|
|
3283
4057
|
header: true,
|
|
3284
4058
|
closeable: true,
|
|
3285
|
-
children: /* @__PURE__ */ (0,
|
|
4059
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Component_default, { style: { flex: 1 } })
|
|
3286
4060
|
}
|
|
3287
4061
|
);
|
|
3288
4062
|
var StackLayout = (props) => {
|
|
3289
|
-
var
|
|
3290
|
-
const ref = (0,
|
|
4063
|
+
var _a2;
|
|
4064
|
+
const ref = (0, import_react63.useRef)(null);
|
|
3291
4065
|
const dispatch = useLayoutProviderDispatch();
|
|
3292
4066
|
const { loadState } = usePersistentState();
|
|
3293
4067
|
const {
|
|
@@ -3298,17 +4072,17 @@ var StackLayout = (props) => {
|
|
|
3298
4072
|
...restProps
|
|
3299
4073
|
} = props;
|
|
3300
4074
|
const { children } = props;
|
|
3301
|
-
const id = (0,
|
|
4075
|
+
const id = (0, import_core15.useIdMemo)(idProp);
|
|
3302
4076
|
const [dispatchViewAction] = useViewActionDispatcher(id, ref, path);
|
|
3303
4077
|
const createNewChildFromContext = useLayoutCreateNewChild();
|
|
3304
|
-
const createNewChild = (
|
|
4078
|
+
const createNewChild = (_a2 = createNewChildProp != null ? createNewChildProp : createNewChildFromContext) != null ? _a2 : defaultCreateNewChild;
|
|
3305
4079
|
const handleTabSelection = (nextIdx) => {
|
|
3306
4080
|
if (path) {
|
|
3307
4081
|
dispatch({ type: "switch-tab", id, path, nextIdx });
|
|
3308
4082
|
onTabSelectionChanged == null ? void 0 : onTabSelectionChanged(nextIdx);
|
|
3309
4083
|
}
|
|
3310
4084
|
};
|
|
3311
|
-
const handleTabClose = (0,
|
|
4085
|
+
const handleTabClose = (0, import_react63.useCallback)(
|
|
3312
4086
|
(tabIndex) => {
|
|
3313
4087
|
if (Array.isArray(children)) {
|
|
3314
4088
|
const {
|
|
@@ -3319,9 +4093,9 @@ var StackLayout = (props) => {
|
|
|
3319
4093
|
},
|
|
3320
4094
|
[children, dispatch]
|
|
3321
4095
|
);
|
|
3322
|
-
const handleTabAdd = (0,
|
|
4096
|
+
const handleTabAdd = (0, import_react63.useCallback)(() => {
|
|
3323
4097
|
if (path) {
|
|
3324
|
-
const tabIndex =
|
|
4098
|
+
const tabIndex = import_react63.default.Children.count(children);
|
|
3325
4099
|
const component = createNewChild(tabIndex);
|
|
3326
4100
|
dispatch({
|
|
3327
4101
|
type: "add",
|
|
@@ -3330,7 +4104,7 @@ var StackLayout = (props) => {
|
|
|
3330
4104
|
});
|
|
3331
4105
|
}
|
|
3332
4106
|
}, [children, createNewChild, dispatch, path]);
|
|
3333
|
-
const handleMoveTab = (0,
|
|
4107
|
+
const handleMoveTab = (0, import_react63.useCallback)(
|
|
3334
4108
|
(fromIndex, toIndex) => {
|
|
3335
4109
|
if (path) {
|
|
3336
4110
|
dispatch({
|
|
@@ -3364,7 +4138,7 @@ var StackLayout = (props) => {
|
|
|
3364
4138
|
const { id: id2, title } = component.props;
|
|
3365
4139
|
return loadState(id2, "view-title") || title || `Tab ${idx + 1}`;
|
|
3366
4140
|
};
|
|
3367
|
-
return /* @__PURE__ */ (0,
|
|
4141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3368
4142
|
Stack,
|
|
3369
4143
|
{
|
|
3370
4144
|
...restProps,
|
|
@@ -3384,27 +4158,27 @@ StackLayout.displayName = "Stack";
|
|
|
3384
4158
|
registerComponent("Stack", StackLayout, "container");
|
|
3385
4159
|
|
|
3386
4160
|
// ../vuu-layout/src/toolbar/Toolbar.tsx
|
|
3387
|
-
var
|
|
3388
|
-
var
|
|
4161
|
+
var import_classnames24 = __toESM(require_classnames());
|
|
4162
|
+
var import_react67 = __toESM(require("react"));
|
|
3389
4163
|
|
|
3390
4164
|
// ../vuu-layout/src/toolbar/useToolbar.ts
|
|
3391
|
-
var
|
|
3392
|
-
var
|
|
4165
|
+
var import_vuu_utils23 = require("@vuu-ui/vuu-utils");
|
|
4166
|
+
var import_react66 = require("react");
|
|
3393
4167
|
|
|
3394
4168
|
// ../vuu-layout/src/toolbar/useKeyboardNavigation.ts
|
|
3395
|
-
var
|
|
3396
|
-
var
|
|
3397
|
-
var
|
|
3398
|
-
var
|
|
4169
|
+
var import_core16 = require("@salt-ds/core");
|
|
4170
|
+
var import_vuu_utils20 = require("@vuu-ui/vuu-utils");
|
|
4171
|
+
var import_react64 = require("react");
|
|
4172
|
+
var import_vuu_utils21 = require("@vuu-ui/vuu-utils");
|
|
3399
4173
|
|
|
3400
4174
|
// ../vuu-layout/src/toolbar/tabstrip-dom-utils.ts
|
|
3401
|
-
var
|
|
4175
|
+
var import_vuu_utils19 = require("@vuu-ui/vuu-utils");
|
|
3402
4176
|
var getIndexOfItem = (container, query) => {
|
|
3403
4177
|
if (container) {
|
|
3404
4178
|
const targetTab = container.querySelector(
|
|
3405
4179
|
`[data-index]:has(${query})`
|
|
3406
4180
|
);
|
|
3407
|
-
return (0,
|
|
4181
|
+
return (0, import_vuu_utils19.getElementDataIndex)(targetTab);
|
|
3408
4182
|
}
|
|
3409
4183
|
return -1;
|
|
3410
4184
|
};
|
|
@@ -3413,20 +4187,20 @@ var getIndexOfEditedItem = (container) => getIndexOfItem(container, ".vuuEditabl
|
|
|
3413
4187
|
// ../vuu-layout/src/toolbar/useKeyboardNavigation.ts
|
|
3414
4188
|
var navigation = {
|
|
3415
4189
|
horizontal: {
|
|
3416
|
-
[
|
|
3417
|
-
[
|
|
3418
|
-
[
|
|
3419
|
-
[
|
|
4190
|
+
[import_vuu_utils21.Home]: "start",
|
|
4191
|
+
[import_vuu_utils21.End]: "end",
|
|
4192
|
+
[import_vuu_utils21.ArrowLeft]: "bwd",
|
|
4193
|
+
[import_vuu_utils21.ArrowRight]: "fwd"
|
|
3420
4194
|
},
|
|
3421
4195
|
vertical: {
|
|
3422
|
-
[
|
|
3423
|
-
[
|
|
3424
|
-
[
|
|
3425
|
-
[
|
|
4196
|
+
[import_vuu_utils21.Home]: "start",
|
|
4197
|
+
[import_vuu_utils21.End]: "end",
|
|
4198
|
+
[import_vuu_utils21.ArrowUp]: "bwd",
|
|
4199
|
+
[import_vuu_utils21.ArrowDown]: "fwd"
|
|
3426
4200
|
}
|
|
3427
4201
|
};
|
|
3428
4202
|
var isNavigationKey = (key, orientation = "horizontal") => navigation[orientation][key] !== void 0;
|
|
3429
|
-
var isMenuActivationKey = (key) => key ===
|
|
4203
|
+
var isMenuActivationKey = (key) => key === import_vuu_utils21.ArrowDown;
|
|
3430
4204
|
function nextItemIdx(count, direction, idx) {
|
|
3431
4205
|
if (direction === "start") {
|
|
3432
4206
|
return 0;
|
|
@@ -3459,23 +4233,23 @@ var useKeyboardNavigation = ({
|
|
|
3459
4233
|
selectedIndex: selectedItemIndex = []
|
|
3460
4234
|
}) => {
|
|
3461
4235
|
const manualActivation = keyBoardActivation === "manual";
|
|
3462
|
-
const mouseClickPending = (0,
|
|
3463
|
-
const focusedRef = (0,
|
|
3464
|
-
const [hasFocus, setHasFocus] = (0,
|
|
3465
|
-
const [, forceRefresh] = (0,
|
|
3466
|
-
const [highlightedIdx, _setHighlightedIdx] = (0,
|
|
4236
|
+
const mouseClickPending = (0, import_react64.useRef)(false);
|
|
4237
|
+
const focusedRef = (0, import_react64.useRef)(-1);
|
|
4238
|
+
const [hasFocus, setHasFocus] = (0, import_react64.useState)(false);
|
|
4239
|
+
const [, forceRefresh] = (0, import_react64.useState)({});
|
|
4240
|
+
const [highlightedIdx, _setHighlightedIdx] = (0, import_core16.useControlled)({
|
|
3467
4241
|
controlled: highlightedIdxProp,
|
|
3468
4242
|
default: defaultHighlightedIdx,
|
|
3469
4243
|
name: "UseKeyboardNavigation"
|
|
3470
4244
|
});
|
|
3471
|
-
const setHighlightedIdx = (0,
|
|
4245
|
+
const setHighlightedIdx = (0, import_react64.useCallback)(
|
|
3472
4246
|
(value) => {
|
|
3473
4247
|
_setHighlightedIdx(focusedRef.current = value);
|
|
3474
4248
|
},
|
|
3475
4249
|
[_setHighlightedIdx]
|
|
3476
4250
|
);
|
|
3477
|
-
const keyboardNavigation = (0,
|
|
3478
|
-
const focusItem = (0,
|
|
4251
|
+
const keyboardNavigation = (0, import_react64.useRef)(false);
|
|
4252
|
+
const focusItem = (0, import_react64.useCallback)(
|
|
3479
4253
|
(itemIndex, immediateFocus = false, withKeyboard, delay = 70) => {
|
|
3480
4254
|
setHighlightedIdx(itemIndex);
|
|
3481
4255
|
if (withKeyboard === true && !keyboardNavigation.current) {
|
|
@@ -3484,7 +4258,7 @@ var useKeyboardNavigation = ({
|
|
|
3484
4258
|
const setFocus = () => {
|
|
3485
4259
|
const element = getElementByPosition(containerRef.current, itemIndex);
|
|
3486
4260
|
if (element) {
|
|
3487
|
-
const focussableElement = (0,
|
|
4261
|
+
const focussableElement = (0, import_vuu_utils20.getFocusableElement)(element);
|
|
3488
4262
|
focussableElement == null ? void 0 : focussableElement.focus();
|
|
3489
4263
|
}
|
|
3490
4264
|
};
|
|
@@ -3516,14 +4290,14 @@ var useKeyboardNavigation = ({
|
|
|
3516
4290
|
}
|
|
3517
4291
|
}
|
|
3518
4292
|
};
|
|
3519
|
-
const getIndexCount = (0,
|
|
4293
|
+
const getIndexCount = (0, import_react64.useCallback)(
|
|
3520
4294
|
() => {
|
|
3521
|
-
var
|
|
3522
|
-
return (_b = (
|
|
4295
|
+
var _a2, _b;
|
|
4296
|
+
return (_b = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(`[data-index]`).length) != null ? _b : 0;
|
|
3523
4297
|
},
|
|
3524
4298
|
[containerRef]
|
|
3525
4299
|
);
|
|
3526
|
-
const nextFocusableItemIdx = (0,
|
|
4300
|
+
const nextFocusableItemIdx = (0, import_react64.useCallback)(
|
|
3527
4301
|
(direction = "fwd", idx) => {
|
|
3528
4302
|
const indexCount = getIndexCount();
|
|
3529
4303
|
const index = typeof idx === "number" ? idx : indexCount;
|
|
@@ -3543,7 +4317,7 @@ var useKeyboardNavigation = ({
|
|
|
3543
4317
|
},
|
|
3544
4318
|
[containerRef, getIndexCount]
|
|
3545
4319
|
);
|
|
3546
|
-
const navigateChildItems = (0,
|
|
4320
|
+
const navigateChildItems = (0, import_react64.useCallback)(
|
|
3547
4321
|
(e, forceFocusVisible = false) => {
|
|
3548
4322
|
const direction = navigation[orientation][e.key];
|
|
3549
4323
|
const nextIdx = nextFocusableItemIdx(direction, highlightedIdx);
|
|
@@ -3565,29 +4339,29 @@ var useKeyboardNavigation = ({
|
|
|
3565
4339
|
orientation
|
|
3566
4340
|
]
|
|
3567
4341
|
);
|
|
3568
|
-
const highlightedItemHasMenu = (0,
|
|
4342
|
+
const highlightedItemHasMenu = (0, import_react64.useCallback)(() => {
|
|
3569
4343
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
3570
4344
|
if (el) {
|
|
3571
4345
|
return el.querySelector(".vuuPopupMenu") != null;
|
|
3572
4346
|
}
|
|
3573
4347
|
return false;
|
|
3574
4348
|
}, [containerRef, highlightedIdx]);
|
|
3575
|
-
const highlightedItemInEditState = (0,
|
|
4349
|
+
const highlightedItemInEditState = (0, import_react64.useCallback)(() => {
|
|
3576
4350
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
3577
4351
|
if (el) {
|
|
3578
4352
|
return el.querySelector(".vuuEditableLabel-input") != null;
|
|
3579
4353
|
}
|
|
3580
4354
|
return false;
|
|
3581
4355
|
}, [containerRef, highlightedIdx]);
|
|
3582
|
-
const activateItemMenu = (0,
|
|
4356
|
+
const activateItemMenu = (0, import_react64.useCallback)(() => {
|
|
3583
4357
|
const el = getElementByPosition(containerRef.current, highlightedIdx);
|
|
3584
4358
|
const menuEl = el == null ? void 0 : el.querySelector(".vuuPopupMenu");
|
|
3585
4359
|
if (menuEl) {
|
|
3586
|
-
(0,
|
|
4360
|
+
(0, import_vuu_utils20.dispatchMouseEvent)(menuEl, "click");
|
|
3587
4361
|
}
|
|
3588
4362
|
return false;
|
|
3589
4363
|
}, [containerRef, highlightedIdx]);
|
|
3590
|
-
const handleKeyDown = (0,
|
|
4364
|
+
const handleKeyDown = (0, import_react64.useCallback)(
|
|
3591
4365
|
(e) => {
|
|
3592
4366
|
if (getIndexCount() > 0 && isNavigationKey(e.key, orientation)) {
|
|
3593
4367
|
e.preventDefault();
|
|
@@ -3613,7 +4387,7 @@ var useKeyboardNavigation = ({
|
|
|
3613
4387
|
const handleItemClick = (_, itemIndex) => {
|
|
3614
4388
|
setHighlightedIdx(itemIndex);
|
|
3615
4389
|
};
|
|
3616
|
-
const handleFocus = (0,
|
|
4390
|
+
const handleFocus = (0, import_react64.useCallback)(() => {
|
|
3617
4391
|
if (!hasFocus) {
|
|
3618
4392
|
setHasFocus(true);
|
|
3619
4393
|
if (!mouseClickPending.current) {
|
|
@@ -3623,7 +4397,7 @@ var useKeyboardNavigation = ({
|
|
|
3623
4397
|
}
|
|
3624
4398
|
}
|
|
3625
4399
|
}, [hasFocus]);
|
|
3626
|
-
const handleContainerMouseDown = (0,
|
|
4400
|
+
const handleContainerMouseDown = (0, import_react64.useCallback)(() => {
|
|
3627
4401
|
if (!hasFocus) {
|
|
3628
4402
|
mouseClickPending.current = true;
|
|
3629
4403
|
}
|
|
@@ -3660,9 +4434,9 @@ var useKeyboardNavigation = ({
|
|
|
3660
4434
|
};
|
|
3661
4435
|
|
|
3662
4436
|
// ../vuu-layout/src/toolbar/useSelection.ts
|
|
3663
|
-
var
|
|
3664
|
-
var
|
|
3665
|
-
var
|
|
4437
|
+
var import_vuu_utils22 = require("@vuu-ui/vuu-utils");
|
|
4438
|
+
var import_vuu_ui_controls8 = require("@vuu-ui/vuu-ui-controls");
|
|
4439
|
+
var import_react65 = require("react");
|
|
3666
4440
|
var defaultSelectionKeys = ["Enter", " "];
|
|
3667
4441
|
var NO_SELECTION_HANDLERS = {};
|
|
3668
4442
|
var useSelection = ({
|
|
@@ -3674,25 +4448,25 @@ var useSelection = ({
|
|
|
3674
4448
|
selected: selectedProp,
|
|
3675
4449
|
selectionStrategy
|
|
3676
4450
|
}) => {
|
|
3677
|
-
const [selected, setSelected, isControlled] = (0,
|
|
4451
|
+
const [selected, setSelected, isControlled] = (0, import_vuu_ui_controls8.useControlled)({
|
|
3678
4452
|
controlled: selectedProp,
|
|
3679
4453
|
default: defaultSelected != null ? defaultSelected : [],
|
|
3680
4454
|
name: "useSelection",
|
|
3681
4455
|
state: "selected"
|
|
3682
4456
|
});
|
|
3683
|
-
const isSelectionEvent = (0,
|
|
4457
|
+
const isSelectionEvent = (0, import_react65.useCallback)(
|
|
3684
4458
|
(evt) => defaultSelectionKeys.includes(evt.key),
|
|
3685
4459
|
[]
|
|
3686
4460
|
);
|
|
3687
|
-
const selectItem = (0,
|
|
4461
|
+
const selectItem = (0, import_react65.useCallback)(
|
|
3688
4462
|
(itemIndex, specialKey = false) => {
|
|
3689
|
-
const newSelected = (0,
|
|
4463
|
+
const newSelected = (0, import_vuu_ui_controls8.allowMultipleSelection)(selectionStrategy, specialKey) ? selected.concat(itemIndex) : [itemIndex];
|
|
3690
4464
|
setSelected(newSelected);
|
|
3691
4465
|
onSelectionChange == null ? void 0 : onSelectionChange(newSelected);
|
|
3692
4466
|
},
|
|
3693
4467
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
3694
4468
|
);
|
|
3695
|
-
const deselectItem = (0,
|
|
4469
|
+
const deselectItem = (0, import_react65.useCallback)(
|
|
3696
4470
|
(itemIndex, specialKey = false) => {
|
|
3697
4471
|
const newSelected = selectionStrategy === "deselectable" || selectionStrategy === "multiple-special-key" && !specialKey ? [] : selected.filter((index) => index !== itemIndex);
|
|
3698
4472
|
setSelected(newSelected);
|
|
@@ -3700,14 +4474,14 @@ var useSelection = ({
|
|
|
3700
4474
|
},
|
|
3701
4475
|
[onSelectionChange, selected, selectionStrategy, setSelected]
|
|
3702
4476
|
);
|
|
3703
|
-
const handleKeyDown = (0,
|
|
4477
|
+
const handleKeyDown = (0, import_react65.useCallback)(
|
|
3704
4478
|
(e) => {
|
|
3705
|
-
if (isSelectionEvent(e) && (0,
|
|
4479
|
+
if (isSelectionEvent(e) && (0, import_vuu_utils22.isSelectableElement)(e.target)) {
|
|
3706
4480
|
if (!selected.includes(highlightedIdx)) {
|
|
3707
4481
|
e.stopPropagation();
|
|
3708
4482
|
e.preventDefault();
|
|
3709
4483
|
selectItem(highlightedIdx, e.shiftKey);
|
|
3710
|
-
} else if ((0,
|
|
4484
|
+
} else if ((0, import_vuu_ui_controls8.deselectionIsAllowed)(selectionStrategy)) {
|
|
3711
4485
|
e.stopPropagation();
|
|
3712
4486
|
e.preventDefault();
|
|
3713
4487
|
deselectItem(highlightedIdx, e.shiftKey);
|
|
@@ -3723,20 +4497,20 @@ var useSelection = ({
|
|
|
3723
4497
|
deselectItem
|
|
3724
4498
|
]
|
|
3725
4499
|
);
|
|
3726
|
-
const handleClick = (0,
|
|
4500
|
+
const handleClick = (0, import_react65.useCallback)(
|
|
3727
4501
|
(e, itemIndex) => {
|
|
3728
|
-
const element = (0,
|
|
3729
|
-
if ((0,
|
|
4502
|
+
const element = (0, import_vuu_utils22.getClosestIndexItem)(e.target);
|
|
4503
|
+
if ((0, import_vuu_utils22.isSelectableElement)(element)) {
|
|
3730
4504
|
if (!selected.includes(itemIndex)) {
|
|
3731
4505
|
selectItem(itemIndex, e.shiftKey);
|
|
3732
|
-
} else if ((0,
|
|
4506
|
+
} else if ((0, import_vuu_ui_controls8.deselectionIsAllowed)(selectionStrategy)) {
|
|
3733
4507
|
deselectItem(itemIndex, e.shiftKey);
|
|
3734
4508
|
}
|
|
3735
4509
|
}
|
|
3736
4510
|
},
|
|
3737
4511
|
[deselectItem, selectItem, selected, selectionStrategy]
|
|
3738
4512
|
);
|
|
3739
|
-
const itemHandlers = (0,
|
|
4513
|
+
const itemHandlers = (0, import_vuu_ui_controls8.selectionIsDisallowed)(selectionStrategy) ? NO_SELECTION_HANDLERS : {
|
|
3740
4514
|
onClick: handleClick,
|
|
3741
4515
|
onKeyDown: handleKeyDown
|
|
3742
4516
|
};
|
|
@@ -3758,8 +4532,8 @@ var useToolbar = ({
|
|
|
3758
4532
|
orientation,
|
|
3759
4533
|
selectionStrategy
|
|
3760
4534
|
}) => {
|
|
3761
|
-
var
|
|
3762
|
-
const lastSelection = (0,
|
|
4535
|
+
var _a2;
|
|
4536
|
+
const lastSelection = (0, import_react66.useRef)(activeItemIndexProp);
|
|
3763
4537
|
const {
|
|
3764
4538
|
focusItem: keyboardHookFocusItem,
|
|
3765
4539
|
highlightedIdx,
|
|
@@ -3771,7 +4545,7 @@ var useToolbar = ({
|
|
|
3771
4545
|
containerRef,
|
|
3772
4546
|
keyBoardActivation: "manual",
|
|
3773
4547
|
orientation,
|
|
3774
|
-
selectedIndex: (
|
|
4548
|
+
selectedIndex: (_a2 = lastSelection.current) != null ? _a2 : []
|
|
3775
4549
|
});
|
|
3776
4550
|
const {
|
|
3777
4551
|
activateItem: selectionHookActivateItem,
|
|
@@ -3787,14 +4561,14 @@ var useToolbar = ({
|
|
|
3787
4561
|
selectionStrategy
|
|
3788
4562
|
});
|
|
3789
4563
|
lastSelection.current = selectionHookSelected;
|
|
3790
|
-
const handleClick = (0,
|
|
4564
|
+
const handleClick = (0, import_react66.useCallback)(
|
|
3791
4565
|
(evt) => {
|
|
3792
|
-
var
|
|
4566
|
+
var _a3;
|
|
3793
4567
|
const target = evt.target;
|
|
3794
4568
|
const toolbarItem = target.closest("[data-index]");
|
|
3795
4569
|
if (toolbarItem) {
|
|
3796
|
-
const index = parseInt((
|
|
3797
|
-
if (index !== -1 && (0,
|
|
4570
|
+
const index = parseInt((_a3 = toolbarItem.dataset.index) != null ? _a3 : "-1");
|
|
4571
|
+
if (index !== -1 && (0, import_vuu_utils23.isValidNumber)(index)) {
|
|
3798
4572
|
keyboardHookHandleClick(evt, index);
|
|
3799
4573
|
onClick == null ? void 0 : onClick(evt, index);
|
|
3800
4574
|
}
|
|
@@ -3802,7 +4576,7 @@ var useToolbar = ({
|
|
|
3802
4576
|
},
|
|
3803
4577
|
[keyboardHookHandleClick, onClick]
|
|
3804
4578
|
);
|
|
3805
|
-
const handleKeyDown = (0,
|
|
4579
|
+
const handleKeyDown = (0, import_react66.useCallback)(
|
|
3806
4580
|
(evt) => {
|
|
3807
4581
|
keyboardHookHandleKeyDown(evt);
|
|
3808
4582
|
if (!evt.defaultPrevented) {
|
|
@@ -3811,7 +4585,7 @@ var useToolbar = ({
|
|
|
3811
4585
|
},
|
|
3812
4586
|
[keyboardHookHandleKeyDown, onKeyDown]
|
|
3813
4587
|
);
|
|
3814
|
-
const onSwitchWrappedItemIntoView = (0,
|
|
4588
|
+
const onSwitchWrappedItemIntoView = (0, import_react66.useCallback)(
|
|
3815
4589
|
(item) => {
|
|
3816
4590
|
const index = parseInt(item.index);
|
|
3817
4591
|
if (!isNaN(index)) {
|
|
@@ -3837,9 +4611,9 @@ var useToolbar = ({
|
|
|
3837
4611
|
};
|
|
3838
4612
|
|
|
3839
4613
|
// ../vuu-layout/src/toolbar/Toolbar.tsx
|
|
3840
|
-
var
|
|
3841
|
-
var
|
|
3842
|
-
var
|
|
4614
|
+
var import_vuu_ui_controls9 = require("@vuu-ui/vuu-ui-controls");
|
|
4615
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4616
|
+
var classBase12 = "vuuToolbar";
|
|
3843
4617
|
var Toolbar = ({
|
|
3844
4618
|
activeItemIndex: activeItemIndexProp,
|
|
3845
4619
|
defaultActiveItemIndex,
|
|
@@ -3851,7 +4625,7 @@ var Toolbar = ({
|
|
|
3851
4625
|
selectionStrategy = "none",
|
|
3852
4626
|
...props
|
|
3853
4627
|
}) => {
|
|
3854
|
-
const rootRef = (0,
|
|
4628
|
+
const rootRef = (0, import_react67.useRef)(null);
|
|
3855
4629
|
const { activeItemIndex, focusVisible, itemProps, ...toolbarHook } = useToolbar({
|
|
3856
4630
|
activeItemIndex: activeItemIndexProp,
|
|
3857
4631
|
defaultActiveItemIndex,
|
|
@@ -3861,8 +4635,8 @@ var Toolbar = ({
|
|
|
3861
4635
|
selectionStrategy
|
|
3862
4636
|
});
|
|
3863
4637
|
const id = useId(idProp);
|
|
3864
|
-
const className = (0,
|
|
3865
|
-
const items = (0,
|
|
4638
|
+
const className = (0, import_classnames24.default)(classBase12, `${classBase12}-${orientation}`, classNameProp);
|
|
4639
|
+
const items = (0, import_react67.useMemo)(
|
|
3866
4640
|
() => asReactElements(children).map((child, index) => {
|
|
3867
4641
|
const {
|
|
3868
4642
|
id: itemId = `${id}-tab-${index}`,
|
|
@@ -3870,9 +4644,9 @@ var Toolbar = ({
|
|
|
3870
4644
|
...ownProps
|
|
3871
4645
|
} = child.props;
|
|
3872
4646
|
const selected = activeItemIndex.includes(index);
|
|
3873
|
-
return
|
|
3874
|
-
...(0,
|
|
3875
|
-
className: (0,
|
|
4647
|
+
return import_react67.default.cloneElement(child, {
|
|
4648
|
+
...(0, import_vuu_ui_controls9.forwardCallbackProps)(ownProps, itemProps),
|
|
4649
|
+
className: (0, import_classnames24.default)("vuuToolbarItem", itemClassName, {
|
|
3876
4650
|
vuuFocusVisible: focusVisible === index
|
|
3877
4651
|
}),
|
|
3878
4652
|
"data-overflow-priority": selected ? "1" : void 0,
|
|
@@ -3884,12 +4658,12 @@ var Toolbar = ({
|
|
|
3884
4658
|
}),
|
|
3885
4659
|
[activeItemIndex, children, focusVisible, id, itemProps]
|
|
3886
4660
|
);
|
|
3887
|
-
return /* @__PURE__ */ (0,
|
|
4661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3888
4662
|
OverflowContainer,
|
|
3889
4663
|
{
|
|
3890
4664
|
...props,
|
|
3891
4665
|
...toolbarHook.containerProps,
|
|
3892
|
-
className: (0,
|
|
4666
|
+
className: (0, import_classnames24.default)(classBase12, className),
|
|
3893
4667
|
...props,
|
|
3894
4668
|
ref: rootRef,
|
|
3895
4669
|
children: items
|
|
@@ -3898,46 +4672,45 @@ var Toolbar = ({
|
|
|
3898
4672
|
};
|
|
3899
4673
|
|
|
3900
4674
|
// ../vuu-layout/src/tools/config-wrapper/ConfigWrapper.tsx
|
|
3901
|
-
var
|
|
3902
|
-
var
|
|
4675
|
+
var import_react68 = __toESM(require("react"));
|
|
4676
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3903
4677
|
|
|
3904
4678
|
// ../vuu-layout/src/tools/devtools-box/layout-configurator.jsx
|
|
3905
|
-
var
|
|
3906
|
-
var
|
|
4679
|
+
var import_core17 = require("@salt-ds/core");
|
|
4680
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3907
4681
|
var CSS_DIGIT = "(\\d+)(?:px)?";
|
|
3908
4682
|
var CSS_MEASURE = `^(?:${CSS_DIGIT}(?:\\s${CSS_DIGIT}(?:\\s${CSS_DIGIT}(?:\\s${CSS_DIGIT})?)?)?)$`;
|
|
3909
4683
|
var CSS_REX = new RegExp(CSS_MEASURE);
|
|
3910
4684
|
|
|
3911
4685
|
// ../vuu-layout/src/tools/devtools-tree/layout-tree-viewer.jsx
|
|
3912
|
-
var
|
|
3913
|
-
var
|
|
3914
|
-
var
|
|
3915
|
-
var
|
|
4686
|
+
var import_react69 = __toESM(require("react"));
|
|
4687
|
+
var import_classnames25 = __toESM(require_classnames());
|
|
4688
|
+
var import_vuu_ui_controls10 = require("@vuu-ui/vuu-ui-controls");
|
|
4689
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3916
4690
|
|
|
3917
4691
|
// src/filter-bar/FilterBar.tsx
|
|
3918
4692
|
var import_vuu_popups5 = require("@vuu-ui/vuu-popups");
|
|
3919
|
-
var
|
|
3920
|
-
var
|
|
3921
|
-
var
|
|
4693
|
+
var import_core19 = require("@salt-ds/core");
|
|
4694
|
+
var import_classnames30 = __toESM(require_classnames(), 1);
|
|
4695
|
+
var import_react80 = require("react");
|
|
3922
4696
|
|
|
3923
4697
|
// src/filter-builder-menu/FilterBuilderMenu.tsx
|
|
3924
|
-
var
|
|
4698
|
+
var import_react70 = require("react");
|
|
3925
4699
|
var import_vuu_popups3 = require("@vuu-ui/vuu-popups");
|
|
3926
|
-
var
|
|
3927
|
-
var
|
|
3928
|
-
var
|
|
4700
|
+
var import_vuu_ui_controls11 = require("@vuu-ui/vuu-ui-controls");
|
|
4701
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
4702
|
+
var classBase13 = "vuuFilterBuilderMenu";
|
|
3929
4703
|
var FilterBuilderMenu = ({ onMenuAction }) => {
|
|
3930
|
-
const ref = (0,
|
|
3931
|
-
const listRef = (0,
|
|
4704
|
+
const ref = (0, import_react70.useRef)(null);
|
|
4705
|
+
const listRef = (0, import_react70.useCallback)((el) => {
|
|
3932
4706
|
if (el) {
|
|
3933
|
-
|
|
4707
|
+
requestAnimationFrame(() => {
|
|
4708
|
+
el.focus();
|
|
4709
|
+
});
|
|
3934
4710
|
}
|
|
3935
4711
|
}, []);
|
|
3936
|
-
const handleSelect = (0,
|
|
4712
|
+
const handleSelect = (0, import_react70.useCallback)(
|
|
3937
4713
|
(evt, selected) => {
|
|
3938
|
-
console.log({
|
|
3939
|
-
selected
|
|
3940
|
-
});
|
|
3941
4714
|
const {
|
|
3942
4715
|
props: { "data-action": action }
|
|
3943
4716
|
} = selected;
|
|
@@ -3945,12 +4718,12 @@ var FilterBuilderMenu = ({ onMenuAction }) => {
|
|
|
3945
4718
|
},
|
|
3946
4719
|
[onMenuAction]
|
|
3947
4720
|
);
|
|
3948
|
-
return /* @__PURE__ */ (0,
|
|
3949
|
-
/* @__PURE__ */ (0,
|
|
3950
|
-
/* @__PURE__ */ (0,
|
|
3951
|
-
|
|
4721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
4722
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: `${classBase13}-trigger`, ref }),
|
|
4723
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_vuu_popups3.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_vuu_popups3.PopupComponent, { anchorElement: ref, placement: "right", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
4724
|
+
import_vuu_ui_controls11.List,
|
|
3952
4725
|
{
|
|
3953
|
-
className: `${
|
|
4726
|
+
className: `${classBase13}List`,
|
|
3954
4727
|
defaultHighlightedIndex: 1,
|
|
3955
4728
|
itemHeight: 22,
|
|
3956
4729
|
ref: listRef,
|
|
@@ -3958,9 +4731,9 @@ var FilterBuilderMenu = ({ onMenuAction }) => {
|
|
|
3958
4731
|
style: { position: "relative" },
|
|
3959
4732
|
width: 100,
|
|
3960
4733
|
children: [
|
|
3961
|
-
/* @__PURE__ */ (0,
|
|
3962
|
-
/* @__PURE__ */ (0,
|
|
3963
|
-
/* @__PURE__ */ (0,
|
|
4734
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_vuu_ui_controls11.ListItem, { "data-action": "apply-save", className: "vuuMenuButton", children: "APPLY AND SAVE" }),
|
|
4735
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_vuu_ui_controls11.ListItem, { "data-action": "and-clause", children: "AND" }),
|
|
4736
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_vuu_ui_controls11.ListItem, { "data-action": "or-clause", children: "OR" })
|
|
3964
4737
|
]
|
|
3965
4738
|
}
|
|
3966
4739
|
) }) })
|
|
@@ -3968,40 +4741,57 @@ var FilterBuilderMenu = ({ onMenuAction }) => {
|
|
|
3968
4741
|
};
|
|
3969
4742
|
|
|
3970
4743
|
// src/filter-clause/ExpandoCombobox.tsx
|
|
3971
|
-
var
|
|
3972
|
-
var
|
|
3973
|
-
var
|
|
3974
|
-
var
|
|
3975
|
-
var
|
|
3976
|
-
var
|
|
4744
|
+
var import_vuu_utils24 = require("@vuu-ui/vuu-utils");
|
|
4745
|
+
var import_vuu_ui_controls12 = require("@vuu-ui/vuu-ui-controls");
|
|
4746
|
+
var import_classnames26 = __toESM(require_classnames(), 1);
|
|
4747
|
+
var import_react71 = require("react");
|
|
4748
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
4749
|
+
var classBase14 = "vuuExpandoCombobox";
|
|
3977
4750
|
var NO_INPUT_PROPS = {};
|
|
3978
|
-
var ExpandoCombobox = (0,
|
|
3979
|
-
allowMultipleSelection: allowMultipleSelection2 = false,
|
|
4751
|
+
var ExpandoCombobox = (0, import_react71.forwardRef)(function ExpandoCombobox2({
|
|
3980
4752
|
className: classNameProp,
|
|
3981
4753
|
InputProps: InputPropsProp = NO_INPUT_PROPS,
|
|
3982
4754
|
ListProps: ListPropsProp,
|
|
3983
4755
|
onInputChange,
|
|
3984
4756
|
onSelectionChange,
|
|
4757
|
+
selectionStrategy,
|
|
4758
|
+
style,
|
|
3985
4759
|
value = "",
|
|
3986
4760
|
...props
|
|
3987
4761
|
}, forwardedRef) {
|
|
3988
|
-
const [text, setText] = (0,
|
|
3989
|
-
const { itemToString =
|
|
3990
|
-
const initialValue = (0,
|
|
3991
|
-
const
|
|
4762
|
+
const [text, setText] = (0, import_react71.useState)(value);
|
|
4763
|
+
const { itemToString = import_vuu_utils24.itemToString } = props;
|
|
4764
|
+
const initialValue = (0, import_react71.useRef)(value);
|
|
4765
|
+
const itemsToString = (0, import_react71.useCallback)(
|
|
4766
|
+
(items) => {
|
|
4767
|
+
const [first, ...rest] = items;
|
|
4768
|
+
if (rest.length) {
|
|
4769
|
+
return `${itemToString(first)} + ${rest.length}`;
|
|
4770
|
+
} else {
|
|
4771
|
+
return itemToString(first);
|
|
4772
|
+
}
|
|
4773
|
+
},
|
|
4774
|
+
[itemToString]
|
|
4775
|
+
);
|
|
4776
|
+
const handleInputChange = (0, import_react71.useCallback)(
|
|
3992
4777
|
(evt) => {
|
|
3993
4778
|
const { value: value2 } = evt.target;
|
|
4779
|
+
console.log(`onInputChange ${value2}`);
|
|
3994
4780
|
setText(value2);
|
|
3995
4781
|
onInputChange == null ? void 0 : onInputChange(evt);
|
|
3996
4782
|
},
|
|
3997
4783
|
[onInputChange]
|
|
3998
4784
|
);
|
|
3999
|
-
const
|
|
4785
|
+
const handleSetSelectedText = (0, import_react71.useCallback)((text2) => {
|
|
4786
|
+
console.log(`handleSetSelectedText ${text2}`);
|
|
4787
|
+
setText(text2);
|
|
4788
|
+
}, []);
|
|
4789
|
+
const [InputProps, ListProps] = (0, import_react71.useMemo)(() => {
|
|
4000
4790
|
const { inputProps, ...restInputProps } = InputPropsProp;
|
|
4001
4791
|
return [
|
|
4002
4792
|
{
|
|
4003
4793
|
...restInputProps,
|
|
4004
|
-
className: `${
|
|
4794
|
+
className: `${classBase14}-Input`,
|
|
4005
4795
|
endAdornment: null,
|
|
4006
4796
|
inputProps: {
|
|
4007
4797
|
...inputProps,
|
|
@@ -4011,7 +4801,7 @@ var ExpandoCombobox = (0, import_react48.forwardRef)(function ExpandoCombobox2({
|
|
|
4011
4801
|
},
|
|
4012
4802
|
{
|
|
4013
4803
|
...ListPropsProp,
|
|
4014
|
-
className: (0,
|
|
4804
|
+
className: (0, import_classnames26.default)("vuuMenuList", ListPropsProp == null ? void 0 : ListPropsProp.className),
|
|
4015
4805
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4016
4806
|
// @ts-ignore
|
|
4017
4807
|
"data-mode": "light",
|
|
@@ -4023,41 +4813,46 @@ var ExpandoCombobox = (0, import_react48.forwardRef)(function ExpandoCombobox2({
|
|
|
4023
4813
|
}
|
|
4024
4814
|
];
|
|
4025
4815
|
}, [InputPropsProp, handleInputChange, ListPropsProp]);
|
|
4026
|
-
const handleSelectionChange = (0,
|
|
4027
|
-
(evt,
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4816
|
+
const handleSelectionChange = (0, import_react71.useCallback)(
|
|
4817
|
+
(evt, selected) => {
|
|
4818
|
+
if (Array.isArray(selected)) {
|
|
4819
|
+
onSelectionChange == null ? void 0 : onSelectionChange(
|
|
4820
|
+
null,
|
|
4821
|
+
selected
|
|
4822
|
+
);
|
|
4823
|
+
} else if (selected) {
|
|
4824
|
+
setText(itemToString(selected));
|
|
4825
|
+
onSelectionChange == null ? void 0 : onSelectionChange(
|
|
4826
|
+
null,
|
|
4827
|
+
selected
|
|
4828
|
+
);
|
|
4829
|
+
}
|
|
4031
4830
|
},
|
|
4032
4831
|
[itemToString, onSelectionChange]
|
|
4033
4832
|
);
|
|
4034
|
-
const
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4833
|
+
const popupProps = {
|
|
4834
|
+
minWidth: 102
|
|
4835
|
+
};
|
|
4836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4039
4837
|
"div",
|
|
4040
4838
|
{
|
|
4041
|
-
className: (0,
|
|
4839
|
+
className: (0, import_classnames26.default)(classBase14, classNameProp),
|
|
4042
4840
|
"data-text": text,
|
|
4043
4841
|
ref: forwardedRef,
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
...props,
|
|
4048
|
-
defaultValue: initialValue.current,
|
|
4049
|
-
ListProps,
|
|
4050
|
-
InputProps,
|
|
4051
|
-
onSelectionChange: handleSelectionChange
|
|
4052
|
-
}
|
|
4053
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4054
|
-
import_vuu_ui_controls9.ComboBox,
|
|
4842
|
+
style,
|
|
4843
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
4844
|
+
import_vuu_ui_controls12.ComboBox,
|
|
4055
4845
|
{
|
|
4056
4846
|
...props,
|
|
4847
|
+
PopupProps: popupProps,
|
|
4057
4848
|
defaultValue: initialValue.current,
|
|
4849
|
+
fullWidth: true,
|
|
4058
4850
|
ListProps,
|
|
4059
4851
|
InputProps,
|
|
4060
|
-
|
|
4852
|
+
itemsToString,
|
|
4853
|
+
onSelectionChange: handleSelectionChange,
|
|
4854
|
+
onSetSelectedText: handleSetSelectedText,
|
|
4855
|
+
selectionStrategy
|
|
4061
4856
|
}
|
|
4062
4857
|
)
|
|
4063
4858
|
}
|
|
@@ -4065,14 +4860,14 @@ var ExpandoCombobox = (0, import_react48.forwardRef)(function ExpandoCombobox2({
|
|
|
4065
4860
|
});
|
|
4066
4861
|
|
|
4067
4862
|
// src/filter-clause/FilterClauseEditor.tsx
|
|
4068
|
-
var
|
|
4069
|
-
var
|
|
4863
|
+
var import_classnames27 = __toESM(require_classnames(), 1);
|
|
4864
|
+
var import_react75 = require("react");
|
|
4070
4865
|
|
|
4071
4866
|
// src/filter-clause/CloseButton.tsx
|
|
4072
|
-
var
|
|
4073
|
-
var
|
|
4074
|
-
var CloseButton = ({ className, onClick }) => /* @__PURE__ */ (0,
|
|
4075
|
-
|
|
4867
|
+
var import_core18 = require("@salt-ds/core");
|
|
4868
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
4869
|
+
var CloseButton = ({ className, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
4870
|
+
import_core18.Button,
|
|
4076
4871
|
{
|
|
4077
4872
|
className,
|
|
4078
4873
|
"data-icon": "close",
|
|
@@ -4082,11 +4877,11 @@ var CloseButton = ({ className, onClick }) => /* @__PURE__ */ (0, import_jsx_run
|
|
|
4082
4877
|
);
|
|
4083
4878
|
|
|
4084
4879
|
// src/filter-clause/NumericInput.tsx
|
|
4085
|
-
var
|
|
4086
|
-
var
|
|
4087
|
-
var
|
|
4088
|
-
var
|
|
4089
|
-
var NumericInput = (0,
|
|
4880
|
+
var import_react72 = require("react");
|
|
4881
|
+
var import_vuu_ui_controls13 = require("@vuu-ui/vuu-ui-controls");
|
|
4882
|
+
var import_vuu_utils25 = require("@vuu-ui/vuu-utils");
|
|
4883
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4884
|
+
var NumericInput = (0, import_react72.forwardRef)(function NumericInput2({
|
|
4090
4885
|
InputProps,
|
|
4091
4886
|
className,
|
|
4092
4887
|
column,
|
|
@@ -4095,31 +4890,31 @@ var NumericInput = (0, import_react49.forwardRef)(function NumericInput2({
|
|
|
4095
4890
|
// operator,
|
|
4096
4891
|
value: valueProp
|
|
4097
4892
|
}, forwardedRef) {
|
|
4098
|
-
const [value, setValue] = (0,
|
|
4099
|
-
(0,
|
|
4893
|
+
const [value, setValue] = (0, import_react72.useState)(
|
|
4894
|
+
(0, import_vuu_utils25.isValidNumber)(valueProp) ? valueProp.toString() : ""
|
|
4100
4895
|
);
|
|
4101
|
-
const handleChange = (0,
|
|
4896
|
+
const handleChange = (0, import_react72.useCallback)((evt) => {
|
|
4102
4897
|
const { value: value2 } = evt.target;
|
|
4103
4898
|
const numericValue = parseFloat(value2);
|
|
4104
|
-
if ((0,
|
|
4899
|
+
if ((0, import_vuu_utils25.isValidNumber)(numericValue)) {
|
|
4105
4900
|
console.log("its valid");
|
|
4106
4901
|
}
|
|
4107
4902
|
setValue(value2);
|
|
4108
4903
|
}, []);
|
|
4109
|
-
const handleKeyDown = (0,
|
|
4904
|
+
const handleKeyDown = (0, import_react72.useCallback)(
|
|
4110
4905
|
(evt) => {
|
|
4111
4906
|
if (evt.key === "Enter") {
|
|
4112
4907
|
const { value: value2 } = evt.target;
|
|
4113
4908
|
const numericValue = parseFloat(value2);
|
|
4114
|
-
if ((0,
|
|
4909
|
+
if ((0, import_vuu_utils25.isValidNumber)(numericValue)) {
|
|
4115
4910
|
onInputComplete(numericValue);
|
|
4116
4911
|
}
|
|
4117
4912
|
}
|
|
4118
4913
|
},
|
|
4119
4914
|
[onInputComplete]
|
|
4120
4915
|
);
|
|
4121
|
-
return /* @__PURE__ */ (0,
|
|
4122
|
-
|
|
4916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
4917
|
+
import_vuu_ui_controls13.ExpandoInput,
|
|
4123
4918
|
{
|
|
4124
4919
|
...InputProps,
|
|
4125
4920
|
className,
|
|
@@ -4132,13 +4927,13 @@ var NumericInput = (0, import_react49.forwardRef)(function NumericInput2({
|
|
|
4132
4927
|
});
|
|
4133
4928
|
|
|
4134
4929
|
// src/filter-clause/operator-utils.ts
|
|
4135
|
-
var
|
|
4930
|
+
var import_vuu_utils26 = require("@vuu-ui/vuu-utils");
|
|
4136
4931
|
var textOperators = ["=", "in", "!=", "starts", "ends"];
|
|
4137
4932
|
var numericperators = ["=", "!=", ">", ">=", "<", "<="];
|
|
4138
4933
|
var getOperators = (column) => {
|
|
4139
|
-
if ((0,
|
|
4934
|
+
if ((0, import_vuu_utils26.isTextColumn)(column)) {
|
|
4140
4935
|
return textOperators;
|
|
4141
|
-
} else if ((0,
|
|
4936
|
+
} else if ((0, import_vuu_utils26.isNumericColumn)(column)) {
|
|
4142
4937
|
return numericperators;
|
|
4143
4938
|
} else {
|
|
4144
4939
|
throw Error("getOperators only supports text and numeric columns");
|
|
@@ -4146,33 +4941,40 @@ var getOperators = (column) => {
|
|
|
4146
4941
|
};
|
|
4147
4942
|
|
|
4148
4943
|
// src/filter-clause/TextInput.tsx
|
|
4149
|
-
var
|
|
4944
|
+
var import_react73 = require("react");
|
|
4150
4945
|
var import_vuu_data_react = require("@vuu-ui/vuu-data-react");
|
|
4151
|
-
var
|
|
4152
|
-
var
|
|
4153
|
-
var TextInput = (0,
|
|
4946
|
+
var import_vuu_ui_controls14 = require("@vuu-ui/vuu-ui-controls");
|
|
4947
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
4948
|
+
var TextInput = (0, import_react73.forwardRef)(function TextInput2({
|
|
4154
4949
|
InputProps: InputPropsProp = {},
|
|
4155
4950
|
className,
|
|
4156
4951
|
column,
|
|
4157
|
-
filterClause,
|
|
4158
4952
|
onInputComplete,
|
|
4159
4953
|
operator,
|
|
4160
4954
|
suggestionProvider = import_vuu_data_react.useTypeaheadSuggestions,
|
|
4161
4955
|
table,
|
|
4162
4956
|
value
|
|
4163
4957
|
}, forwardedRef) {
|
|
4164
|
-
const [valueInputValue, setValueInputValue] = (0,
|
|
4165
|
-
const [typeaheadValues, setTypeaheadValues] = (0,
|
|
4958
|
+
const [valueInputValue, setValueInputValue] = (0, import_react73.useState)(value != null ? value : "");
|
|
4959
|
+
const [typeaheadValues, setTypeaheadValues] = (0, import_react73.useState)([]);
|
|
4166
4960
|
const getSuggestions = suggestionProvider();
|
|
4167
|
-
const
|
|
4961
|
+
const handleSingleValueSelectionChange = (0, import_react73.useCallback)(
|
|
4962
|
+
(evt, value2) => onInputComplete(value2),
|
|
4963
|
+
[onInputComplete]
|
|
4964
|
+
);
|
|
4965
|
+
const handleMultiValueSelectionChange = (0, import_react73.useCallback)(
|
|
4168
4966
|
(evt, value2) => {
|
|
4169
|
-
|
|
4967
|
+
if (value2.length === 1) {
|
|
4968
|
+
onInputComplete(value2[0]);
|
|
4969
|
+
} else if (value2.length > 1) {
|
|
4970
|
+
onInputComplete(value2);
|
|
4971
|
+
}
|
|
4170
4972
|
},
|
|
4171
4973
|
[onInputComplete]
|
|
4172
4974
|
);
|
|
4173
|
-
(0,
|
|
4975
|
+
(0, import_react73.useEffect)(() => {
|
|
4174
4976
|
}, [column]);
|
|
4175
|
-
(0,
|
|
4977
|
+
(0, import_react73.useEffect)(() => {
|
|
4176
4978
|
if (table) {
|
|
4177
4979
|
const params = valueInputValue ? [table, column.name, valueInputValue] : [table, column.name];
|
|
4178
4980
|
getSuggestions(params).then((suggestions) => {
|
|
@@ -4182,11 +4984,11 @@ var TextInput = (0, import_react50.forwardRef)(function TextInput2({
|
|
|
4182
4984
|
});
|
|
4183
4985
|
}
|
|
4184
4986
|
}, [table, column, valueInputValue, getSuggestions]);
|
|
4185
|
-
const handleInputChange = (0,
|
|
4987
|
+
const handleInputChange = (0, import_react73.useCallback)((evt) => {
|
|
4186
4988
|
const { value: value2 } = evt.target;
|
|
4187
4989
|
setValueInputValue(value2);
|
|
4188
4990
|
}, []);
|
|
4189
|
-
const InputProps = (0,
|
|
4991
|
+
const InputProps = (0, import_react73.useMemo)(() => {
|
|
4190
4992
|
if (operator === "starts" || operator === "ends") {
|
|
4191
4993
|
const { inputProps, ...restInputProps } = InputPropsProp;
|
|
4192
4994
|
return {
|
|
@@ -4194,13 +4996,13 @@ var TextInput = (0, import_react50.forwardRef)(function TextInput2({
|
|
|
4194
4996
|
inputProps: {
|
|
4195
4997
|
...inputProps,
|
|
4196
4998
|
onKeyDown: (evt) => {
|
|
4197
|
-
var
|
|
4999
|
+
var _a2;
|
|
4198
5000
|
if (evt.key === "Enter" && valueInputValue !== "") {
|
|
4199
5001
|
evt.stopPropagation();
|
|
4200
5002
|
evt.preventDefault();
|
|
4201
5003
|
onInputComplete(valueInputValue);
|
|
4202
5004
|
} else {
|
|
4203
|
-
(
|
|
5005
|
+
(_a2 = inputProps == null ? void 0 : inputProps.onKeyDown) == null ? void 0 : _a2.call(inputProps, evt);
|
|
4204
5006
|
}
|
|
4205
5007
|
}
|
|
4206
5008
|
}
|
|
@@ -4209,10 +5011,10 @@ var TextInput = (0, import_react50.forwardRef)(function TextInput2({
|
|
|
4209
5011
|
return InputPropsProp;
|
|
4210
5012
|
}
|
|
4211
5013
|
}, [InputPropsProp, onInputComplete, operator, valueInputValue]);
|
|
4212
|
-
const getValueInputField = (0,
|
|
5014
|
+
const getValueInputField = (0, import_react73.useCallback)(() => {
|
|
4213
5015
|
switch (operator) {
|
|
4214
5016
|
case "in":
|
|
4215
|
-
return /* @__PURE__ */ (0,
|
|
5017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4216
5018
|
ExpandoCombobox,
|
|
4217
5019
|
{
|
|
4218
5020
|
InputProps,
|
|
@@ -4220,13 +5022,14 @@ var TextInput = (0, import_react50.forwardRef)(function TextInput2({
|
|
|
4220
5022
|
initialHighlightedIndex: 0,
|
|
4221
5023
|
source: typeaheadValues,
|
|
4222
5024
|
onInputChange: handleInputChange,
|
|
4223
|
-
onSelectionChange:
|
|
5025
|
+
onSelectionChange: handleMultiValueSelectionChange,
|
|
4224
5026
|
ref: forwardedRef,
|
|
5027
|
+
selectionStrategy: "multiple",
|
|
4225
5028
|
value
|
|
4226
5029
|
}
|
|
4227
5030
|
);
|
|
4228
5031
|
case "starts":
|
|
4229
|
-
return /* @__PURE__ */ (0,
|
|
5032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4230
5033
|
ExpandoCombobox,
|
|
4231
5034
|
{
|
|
4232
5035
|
InputProps,
|
|
@@ -4239,14 +5042,14 @@ var TextInput = (0, import_react50.forwardRef)(function TextInput2({
|
|
|
4239
5042
|
initialHighlightedIndex: 0,
|
|
4240
5043
|
source: typeaheadValues,
|
|
4241
5044
|
onInputChange: handleInputChange,
|
|
4242
|
-
onSelectionChange:
|
|
5045
|
+
onSelectionChange: handleSingleValueSelectionChange,
|
|
4243
5046
|
ref: forwardedRef,
|
|
4244
5047
|
value
|
|
4245
5048
|
}
|
|
4246
5049
|
);
|
|
4247
5050
|
case "ends":
|
|
4248
|
-
return /* @__PURE__ */ (0,
|
|
4249
|
-
|
|
5051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5052
|
+
import_vuu_ui_controls14.ExpandoInput,
|
|
4250
5053
|
{
|
|
4251
5054
|
...InputProps,
|
|
4252
5055
|
className,
|
|
@@ -4256,15 +5059,16 @@ var TextInput = (0, import_react50.forwardRef)(function TextInput2({
|
|
|
4256
5059
|
}
|
|
4257
5060
|
);
|
|
4258
5061
|
default:
|
|
4259
|
-
return /* @__PURE__ */ (0,
|
|
5062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
4260
5063
|
ExpandoCombobox,
|
|
4261
5064
|
{
|
|
4262
5065
|
InputProps,
|
|
4263
5066
|
className,
|
|
4264
5067
|
initialHighlightedIndex: 0,
|
|
4265
5068
|
source: typeaheadValues,
|
|
5069
|
+
title: "value",
|
|
4266
5070
|
onInputChange: handleInputChange,
|
|
4267
|
-
onSelectionChange:
|
|
5071
|
+
onSelectionChange: handleSingleValueSelectionChange,
|
|
4268
5072
|
ref: forwardedRef,
|
|
4269
5073
|
value
|
|
4270
5074
|
}
|
|
@@ -4276,34 +5080,50 @@ var TextInput = (0, import_react50.forwardRef)(function TextInput2({
|
|
|
4276
5080
|
className,
|
|
4277
5081
|
typeaheadValues,
|
|
4278
5082
|
handleInputChange,
|
|
4279
|
-
|
|
5083
|
+
handleMultiValueSelectionChange,
|
|
4280
5084
|
forwardedRef,
|
|
4281
5085
|
value,
|
|
5086
|
+
handleSingleValueSelectionChange,
|
|
4282
5087
|
valueInputValue
|
|
4283
5088
|
]);
|
|
4284
5089
|
return getValueInputField();
|
|
4285
5090
|
});
|
|
4286
5091
|
|
|
4287
5092
|
// src/filter-clause/useFilterClauseEditor.ts
|
|
4288
|
-
var
|
|
4289
|
-
var
|
|
4290
|
-
var
|
|
5093
|
+
var import_vuu_utils27 = require("@vuu-ui/vuu-utils");
|
|
5094
|
+
var import_vuu_data3 = require("@vuu-ui/vuu-data");
|
|
5095
|
+
var import_react74 = require("react");
|
|
4291
5096
|
var cursorAtTextStart = (input) => input.selectionStart === 0;
|
|
4292
5097
|
var cursorAtTextEnd = (input) => input.selectionStart === input.value.length;
|
|
4293
5098
|
var getFieldName = (field) => (field == null ? void 0 : field.classList.contains("vuuFilterClauseColumn")) ? "column" : (field == null ? void 0 : field.classList.contains("vuuFilterClauseOperator")) ? "operator" : "value";
|
|
5099
|
+
var getFocusedField = () => {
|
|
5100
|
+
var _a2;
|
|
5101
|
+
return (_a2 = document.activeElement) == null ? void 0 : _a2.closest(".vuuFilterClauseField");
|
|
5102
|
+
};
|
|
5103
|
+
var focusNextFocusableElement = (direction = "fwd") => {
|
|
5104
|
+
var _a2;
|
|
5105
|
+
const activeField = getFocusedField();
|
|
5106
|
+
const filterClause = activeField == null ? void 0 : activeField.closest(".vuuFilterClause");
|
|
5107
|
+
if ((filterClause == null ? void 0 : filterClause.lastChild) === activeField) {
|
|
5108
|
+
requestAnimationFrame(() => {
|
|
5109
|
+
focusNextFocusableElement();
|
|
5110
|
+
});
|
|
5111
|
+
} else {
|
|
5112
|
+
const nextField = direction === "fwd" ? activeField.nextElementSibling : activeField.previousElementSibling;
|
|
5113
|
+
(_a2 = nextField == null ? void 0 : nextField.querySelector("input")) == null ? void 0 : _a2.focus();
|
|
5114
|
+
}
|
|
5115
|
+
};
|
|
4294
5116
|
var focusNextElement = () => {
|
|
4295
|
-
|
|
4296
|
-
const filterClauseField = (_a = document.activeElement) == null ? void 0 : _a.closest(
|
|
4297
|
-
".vuuFilterClauseField"
|
|
4298
|
-
);
|
|
5117
|
+
const filterClauseField = getFocusedField();
|
|
4299
5118
|
const filterClause = filterClauseField == null ? void 0 : filterClauseField.closest(".vuuFilterClause");
|
|
4300
5119
|
if (filterClause && filterClauseField) {
|
|
4301
5120
|
if (filterClauseField.classList.contains("vuuFilterClauseValue")) {
|
|
4302
|
-
console.log("focus on clear button");
|
|
4303
5121
|
const clearButton = filterClause.querySelector(
|
|
4304
5122
|
".vuuFilterClause-closeButton"
|
|
4305
5123
|
);
|
|
4306
5124
|
clearButton == null ? void 0 : clearButton.focus();
|
|
5125
|
+
} else {
|
|
5126
|
+
focusNextFocusableElement();
|
|
4307
5127
|
}
|
|
4308
5128
|
}
|
|
4309
5129
|
};
|
|
@@ -4321,6 +5141,7 @@ var navigateToNextInputIfAtBoundary = (evt) => {
|
|
|
4321
5141
|
const nextField = field.previousSibling;
|
|
4322
5142
|
const nextInput = nextField == null ? void 0 : nextField.querySelector("input");
|
|
4323
5143
|
evt.preventDefault();
|
|
5144
|
+
console.log("%cfocus nextInput", "color:green;font-weight:bold");
|
|
4324
5145
|
nextInput == null ? void 0 : nextInput.focus();
|
|
4325
5146
|
requestAnimationFrame(() => {
|
|
4326
5147
|
nextInput == null ? void 0 : nextInput.select();
|
|
@@ -4347,9 +5168,9 @@ var navigateToNextInputIfAtBoundary = (evt) => {
|
|
|
4347
5168
|
}
|
|
4348
5169
|
};
|
|
4349
5170
|
var getFilterClauseValue = (filterClause) => {
|
|
4350
|
-
if ((0,
|
|
5171
|
+
if ((0, import_vuu_utils27.isMultiValueFilter)(filterClause)) {
|
|
4351
5172
|
return filterClause.values;
|
|
4352
|
-
} else if ((0,
|
|
5173
|
+
} else if ((0, import_vuu_utils27.isSingleValueFilter)(filterClause)) {
|
|
4353
5174
|
return filterClause.value;
|
|
4354
5175
|
} else {
|
|
4355
5176
|
return void 0;
|
|
@@ -4360,43 +5181,59 @@ var useFilterClauseEditor = ({
|
|
|
4360
5181
|
onChange,
|
|
4361
5182
|
tableSchema
|
|
4362
5183
|
}) => {
|
|
4363
|
-
const
|
|
4364
|
-
const
|
|
5184
|
+
const columnRef = (0, import_react74.useRef)(null);
|
|
5185
|
+
const operatorRef = (0, import_react74.useRef)(null);
|
|
5186
|
+
const valueRef = (0, import_react74.useRef)(null);
|
|
5187
|
+
const [selectedColumn, setSelectedColumn] = (0, import_react74.useState)((0, import_vuu_data3.getColumnByName)(tableSchema, filterClause.column));
|
|
5188
|
+
const [operator, _setOperator] = (0, import_react74.useState)(
|
|
4365
5189
|
filterClause.op
|
|
4366
5190
|
);
|
|
4367
|
-
const
|
|
5191
|
+
const setOperator = (0, import_react74.useCallback)((op) => {
|
|
5192
|
+
_setOperator(op);
|
|
5193
|
+
}, []);
|
|
5194
|
+
const [value, setValue] = (0, import_react74.useState)(
|
|
4368
5195
|
getFilterClauseValue(filterClause)
|
|
4369
5196
|
);
|
|
4370
|
-
const handleSelectionChangeColumn = (0,
|
|
5197
|
+
const handleSelectionChangeColumn = (0, import_react74.useCallback)(
|
|
4371
5198
|
(evt, column) => {
|
|
4372
5199
|
setSelectedColumn(column != null ? column : void 0);
|
|
4373
5200
|
setOperator(void 0);
|
|
4374
5201
|
setValue(void 0);
|
|
5202
|
+
focusNextElement();
|
|
4375
5203
|
},
|
|
4376
|
-
[]
|
|
5204
|
+
[setOperator]
|
|
4377
5205
|
);
|
|
4378
|
-
const handleSelectionChangeOperator = (0,
|
|
4379
|
-
(evt,
|
|
4380
|
-
const op =
|
|
4381
|
-
if (op === void 0 || (0,
|
|
5206
|
+
const handleSelectionChangeOperator = (0, import_react74.useCallback)(
|
|
5207
|
+
(evt, selected) => {
|
|
5208
|
+
const op = selected;
|
|
5209
|
+
if (op === void 0 || (0, import_vuu_utils27.isValidFilterClauseOp)(op)) {
|
|
4382
5210
|
setOperator(op);
|
|
5211
|
+
focusNextElement();
|
|
4383
5212
|
} else {
|
|
4384
5213
|
throw Error(
|
|
4385
5214
|
`FilterClauseEditor, invalid value ${op} for filter clause`
|
|
4386
5215
|
);
|
|
4387
5216
|
}
|
|
4388
5217
|
},
|
|
4389
|
-
[]
|
|
5218
|
+
[setOperator]
|
|
4390
5219
|
);
|
|
4391
|
-
const handleChangeValue = (0,
|
|
5220
|
+
const handleChangeValue = (0, import_react74.useCallback)(
|
|
4392
5221
|
(value2) => {
|
|
4393
5222
|
setValue(value2);
|
|
4394
5223
|
if (value2 !== null && value2 !== "") {
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
5224
|
+
if (Array.isArray(value2)) {
|
|
5225
|
+
onChange({
|
|
5226
|
+
column: selectedColumn == null ? void 0 : selectedColumn.name,
|
|
5227
|
+
op: operator,
|
|
5228
|
+
values: value2
|
|
5229
|
+
});
|
|
5230
|
+
} else {
|
|
5231
|
+
onChange({
|
|
5232
|
+
column: selectedColumn == null ? void 0 : selectedColumn.name,
|
|
5233
|
+
op: operator,
|
|
5234
|
+
value: value2
|
|
5235
|
+
});
|
|
5236
|
+
}
|
|
4400
5237
|
requestAnimationFrame(() => {
|
|
4401
5238
|
focusNextElement();
|
|
4402
5239
|
});
|
|
@@ -4404,7 +5241,7 @@ var useFilterClauseEditor = ({
|
|
|
4404
5241
|
},
|
|
4405
5242
|
[onChange, operator, selectedColumn == null ? void 0 : selectedColumn.name]
|
|
4406
5243
|
);
|
|
4407
|
-
const handleKeyDownInput = (0,
|
|
5244
|
+
const handleKeyDownInput = (0, import_react74.useCallback)(
|
|
4408
5245
|
(evt) => {
|
|
4409
5246
|
if (["ArrowLeft", "ArrowRight"].includes(evt.key)) {
|
|
4410
5247
|
navigateToNextInputIfAtBoundary(evt);
|
|
@@ -4414,7 +5251,7 @@ var useFilterClauseEditor = ({
|
|
|
4414
5251
|
},
|
|
4415
5252
|
[operator]
|
|
4416
5253
|
);
|
|
4417
|
-
const InputProps = (0,
|
|
5254
|
+
const InputProps = (0, import_react74.useMemo)(
|
|
4418
5255
|
() => ({
|
|
4419
5256
|
inputProps: {
|
|
4420
5257
|
onKeyDown: handleKeyDownInput
|
|
@@ -4422,20 +5259,28 @@ var useFilterClauseEditor = ({
|
|
|
4422
5259
|
}),
|
|
4423
5260
|
[handleKeyDownInput]
|
|
4424
5261
|
);
|
|
5262
|
+
(0, import_react74.useEffect)(() => {
|
|
5263
|
+
var _a2;
|
|
5264
|
+
const columnInput = (_a2 = columnRef.current) == null ? void 0 : _a2.querySelector("input");
|
|
5265
|
+
columnInput == null ? void 0 : columnInput.focus();
|
|
5266
|
+
}, []);
|
|
4425
5267
|
return {
|
|
4426
5268
|
InputProps,
|
|
5269
|
+
columnRef,
|
|
4427
5270
|
onChangeValue: handleChangeValue,
|
|
4428
5271
|
onSelectionChangeColumn: handleSelectionChangeColumn,
|
|
4429
5272
|
onSelectionChangeOperator: handleSelectionChangeOperator,
|
|
4430
5273
|
operator,
|
|
5274
|
+
operatorRef,
|
|
4431
5275
|
selectedColumn,
|
|
4432
|
-
value
|
|
5276
|
+
value,
|
|
5277
|
+
valueRef
|
|
4433
5278
|
};
|
|
4434
5279
|
};
|
|
4435
5280
|
|
|
4436
5281
|
// src/filter-clause/FilterClauseEditor.tsx
|
|
4437
|
-
var
|
|
4438
|
-
var
|
|
5282
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5283
|
+
var classBase15 = "vuuFilterClause";
|
|
4439
5284
|
var FilterClauseEditor = ({
|
|
4440
5285
|
className,
|
|
4441
5286
|
onChange,
|
|
@@ -4445,53 +5290,36 @@ var FilterClauseEditor = ({
|
|
|
4445
5290
|
tableSchema,
|
|
4446
5291
|
...htmlAttributes
|
|
4447
5292
|
}) => {
|
|
4448
|
-
var
|
|
5293
|
+
var _a2;
|
|
4449
5294
|
const { table, columns } = tableSchema;
|
|
4450
|
-
const columnRef = (0, import_react52.useRef)(null);
|
|
4451
|
-
const operatorRef = (0, import_react52.useRef)(null);
|
|
4452
|
-
const valueRef = (0, import_react52.useRef)(null);
|
|
4453
5295
|
const {
|
|
4454
5296
|
InputProps,
|
|
5297
|
+
columnRef,
|
|
4455
5298
|
onChangeValue,
|
|
4456
5299
|
onSelectionChangeColumn,
|
|
4457
5300
|
onSelectionChangeOperator,
|
|
4458
5301
|
operator,
|
|
5302
|
+
operatorRef,
|
|
4459
5303
|
selectedColumn,
|
|
4460
|
-
value
|
|
5304
|
+
value,
|
|
5305
|
+
valueRef
|
|
4461
5306
|
} = useFilterClauseEditor({
|
|
4462
5307
|
filterClause,
|
|
4463
5308
|
onChange,
|
|
4464
5309
|
tableSchema
|
|
4465
5310
|
});
|
|
4466
|
-
(0,
|
|
4467
|
-
var _a2;
|
|
4468
|
-
if (selectedColumn === void 0) {
|
|
4469
|
-
const columnInput = (_a2 = columnRef.current) == null ? void 0 : _a2.querySelector("input");
|
|
4470
|
-
columnInput == null ? void 0 : columnInput.focus();
|
|
4471
|
-
} else if (selectedColumn !== void 0 && operator === void 0 && operatorRef.current) {
|
|
4472
|
-
const operatorInput = operatorRef.current.querySelector("input");
|
|
4473
|
-
operatorInput == null ? void 0 : operatorInput.focus();
|
|
4474
|
-
}
|
|
4475
|
-
}, [operator, selectedColumn]);
|
|
4476
|
-
(0, import_react52.useEffect)(() => {
|
|
4477
|
-
if (operator !== void 0 && value === void 0 && valueRef.current) {
|
|
4478
|
-
console.log(`Looks like operator has changed, is now ${operator}`);
|
|
4479
|
-
const valueInput = valueRef.current.querySelector("input");
|
|
4480
|
-
valueInput == null ? void 0 : valueInput.focus();
|
|
4481
|
-
}
|
|
4482
|
-
}, [operator, value]);
|
|
4483
|
-
const getInputElement = (0, import_react52.useCallback)(() => {
|
|
5311
|
+
const getInputElement = (0, import_react75.useCallback)(() => {
|
|
4484
5312
|
if (selectedColumn === null || operator === void 0) {
|
|
4485
5313
|
return null;
|
|
4486
5314
|
}
|
|
4487
5315
|
switch (selectedColumn == null ? void 0 : selectedColumn.serverDataType) {
|
|
4488
5316
|
case "string":
|
|
4489
5317
|
case "char":
|
|
4490
|
-
return /* @__PURE__ */ (0,
|
|
5318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4491
5319
|
TextInput,
|
|
4492
5320
|
{
|
|
4493
5321
|
InputProps,
|
|
4494
|
-
className: (0,
|
|
5322
|
+
className: (0, import_classnames27.default)(`${classBase15}Field`, `${classBase15}Value`),
|
|
4495
5323
|
column: selectedColumn,
|
|
4496
5324
|
filterClause,
|
|
4497
5325
|
onInputComplete: onChangeValue,
|
|
@@ -4505,11 +5333,11 @@ var FilterClauseEditor = ({
|
|
|
4505
5333
|
case "int":
|
|
4506
5334
|
case "long":
|
|
4507
5335
|
case "double":
|
|
4508
|
-
return /* @__PURE__ */ (0,
|
|
5336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4509
5337
|
NumericInput,
|
|
4510
5338
|
{
|
|
4511
5339
|
InputProps,
|
|
4512
|
-
className: (0,
|
|
5340
|
+
className: (0, import_classnames27.default)(`${classBase15}Field`, `${classBase15}Value`),
|
|
4513
5341
|
column: selectedColumn,
|
|
4514
5342
|
filterClause,
|
|
4515
5343
|
onInputComplete: onChangeValue,
|
|
@@ -4530,30 +5358,33 @@ var FilterClauseEditor = ({
|
|
|
4530
5358
|
InputProps,
|
|
4531
5359
|
filterClause,
|
|
4532
5360
|
onChangeValue,
|
|
5361
|
+
valueRef,
|
|
4533
5362
|
suggestionProvider,
|
|
4534
5363
|
table,
|
|
4535
5364
|
value
|
|
4536
5365
|
]);
|
|
4537
|
-
return /* @__PURE__ */ (0,
|
|
4538
|
-
/* @__PURE__ */ (0,
|
|
5366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: (0, import_classnames27.default)(classBase15, className), ...htmlAttributes, tabIndex: 0, children: [
|
|
5367
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4539
5368
|
ExpandoCombobox,
|
|
4540
5369
|
{
|
|
5370
|
+
title: "column",
|
|
4541
5371
|
InputProps,
|
|
4542
|
-
className: (0,
|
|
5372
|
+
className: (0, import_classnames27.default)(`${classBase15}Field`, `${classBase15}Column`),
|
|
4543
5373
|
initialHighlightedIndex: 0,
|
|
4544
5374
|
itemToString: (column) => column.name,
|
|
4545
5375
|
ref: columnRef,
|
|
4546
5376
|
source: columns,
|
|
4547
5377
|
onSelectionChange: onSelectionChangeColumn,
|
|
4548
|
-
value: (
|
|
5378
|
+
value: (_a2 = selectedColumn == null ? void 0 : selectedColumn.name) != null ? _a2 : ""
|
|
4549
5379
|
}
|
|
4550
5380
|
),
|
|
4551
|
-
(selectedColumn == null ? void 0 : selectedColumn.name) ? /* @__PURE__ */ (0,
|
|
5381
|
+
(selectedColumn == null ? void 0 : selectedColumn.name) ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
4552
5382
|
ExpandoCombobox,
|
|
4553
5383
|
{
|
|
5384
|
+
title: "operator",
|
|
4554
5385
|
InputProps,
|
|
4555
|
-
className: (0,
|
|
4556
|
-
[`${
|
|
5386
|
+
className: (0, import_classnames27.default)(`${classBase15}Field`, `${classBase15}Operator`, {
|
|
5387
|
+
[`${classBase15}Operator-hidden`]: selectedColumn === null
|
|
4557
5388
|
}),
|
|
4558
5389
|
initialHighlightedIndex: 0,
|
|
4559
5390
|
ref: operatorRef,
|
|
@@ -4563,20 +5394,20 @@ var FilterClauseEditor = ({
|
|
|
4563
5394
|
}
|
|
4564
5395
|
) : null,
|
|
4565
5396
|
getInputElement(),
|
|
4566
|
-
value !== void 0 ? /* @__PURE__ */ (0,
|
|
5397
|
+
value !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CloseButton, { className: `${classBase15}-closeButton`, onClick: onClose }) : null
|
|
4567
5398
|
] });
|
|
4568
5399
|
};
|
|
4569
5400
|
|
|
4570
5401
|
// src/filter-pill/FilterPill.tsx
|
|
4571
|
-
var
|
|
4572
|
-
var
|
|
4573
|
-
var
|
|
4574
|
-
var
|
|
5402
|
+
var import_vuu_ui_controls15 = require("@vuu-ui/vuu-ui-controls");
|
|
5403
|
+
var import_vuu_utils29 = require("@vuu-ui/vuu-utils");
|
|
5404
|
+
var import_classnames29 = __toESM(require_classnames(), 1);
|
|
5405
|
+
var import_react77 = require("react");
|
|
4575
5406
|
|
|
4576
5407
|
// src/filter-pill-menu/FilterPillMenu.tsx
|
|
4577
5408
|
var import_vuu_popups4 = require("@vuu-ui/vuu-popups");
|
|
4578
|
-
var
|
|
4579
|
-
var
|
|
5409
|
+
var import_react76 = require("react");
|
|
5410
|
+
var import_classnames28 = __toESM(require_classnames(), 1);
|
|
4580
5411
|
|
|
4581
5412
|
// src/filter-pill-menu/FilterPillMenuOptions.ts
|
|
4582
5413
|
var closeCommand = (options) => ({
|
|
@@ -4605,8 +5436,8 @@ var editCommand = (options) => ({
|
|
|
4605
5436
|
});
|
|
4606
5437
|
|
|
4607
5438
|
// src/filter-pill-menu/FilterPillMenu.tsx
|
|
4608
|
-
var
|
|
4609
|
-
var
|
|
5439
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
5440
|
+
var classBase16 = "vuuFilterPillMenu";
|
|
4610
5441
|
var FilterPillMenu = ({
|
|
4611
5442
|
allowClose = true,
|
|
4612
5443
|
allowDelete = true,
|
|
@@ -4617,7 +5448,7 @@ var FilterPillMenu = ({
|
|
|
4617
5448
|
onMenuAction,
|
|
4618
5449
|
onMenuClose
|
|
4619
5450
|
}) => {
|
|
4620
|
-
const [menuBuilder, menuOptions] = (0,
|
|
5451
|
+
const [menuBuilder, menuOptions] = (0, import_react76.useMemo)(
|
|
4621
5452
|
() => [
|
|
4622
5453
|
(_location, options) => {
|
|
4623
5454
|
const menuItems = [];
|
|
@@ -4641,13 +5472,13 @@ var FilterPillMenu = ({
|
|
|
4641
5472
|
],
|
|
4642
5473
|
[allowClose, allowDelete, allowEdit, allowRename, filter]
|
|
4643
5474
|
);
|
|
4644
|
-
return /* @__PURE__ */ (0,
|
|
5475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
4645
5476
|
import_vuu_popups4.PopupMenu,
|
|
4646
5477
|
{
|
|
4647
|
-
className:
|
|
5478
|
+
className: classBase16,
|
|
4648
5479
|
menuBuilder,
|
|
4649
5480
|
menuActionHandler: onMenuAction,
|
|
4650
|
-
menuLocation: (0,
|
|
5481
|
+
menuLocation: (0, import_classnames28.default)("filter", location),
|
|
4651
5482
|
menuOptions,
|
|
4652
5483
|
onMenuClose,
|
|
4653
5484
|
tabIndex: -1
|
|
@@ -4656,7 +5487,7 @@ var FilterPillMenu = ({
|
|
|
4656
5487
|
};
|
|
4657
5488
|
|
|
4658
5489
|
// src/filter-utils.ts
|
|
4659
|
-
var
|
|
5490
|
+
var import_vuu_utils28 = require("@vuu-ui/vuu-utils");
|
|
4660
5491
|
var AND = "and";
|
|
4661
5492
|
var EQUALS = "=";
|
|
4662
5493
|
var GREATER_THAN = ">";
|
|
@@ -4667,7 +5498,7 @@ var ENDS_WITH = "ends";
|
|
|
4667
5498
|
var IN = "in";
|
|
4668
5499
|
var filterClauses = (filter, clauses = []) => {
|
|
4669
5500
|
if (filter) {
|
|
4670
|
-
if ((0,
|
|
5501
|
+
if ((0, import_vuu_utils28.isMultiClauseFilter)(filter)) {
|
|
4671
5502
|
filter.filters.forEach((f) => clauses.push(...filterClauses(f)));
|
|
4672
5503
|
} else {
|
|
4673
5504
|
clauses.push(filter);
|
|
@@ -4679,8 +5510,8 @@ var DEFAULT_ADD_FILTER_OPTS = {
|
|
|
4679
5510
|
combineWith: "and"
|
|
4680
5511
|
};
|
|
4681
5512
|
var addClause = (existingFilter, clause, { combineWith = AND } = DEFAULT_ADD_FILTER_OPTS) => {
|
|
4682
|
-
if ((0,
|
|
4683
|
-
if ((0,
|
|
5513
|
+
if ((0, import_vuu_utils28.isMultiClauseFilter)(existingFilter) && existingFilter.op === combineWith) {
|
|
5514
|
+
if ((0, import_vuu_utils28.isCompleteFilter)(clause)) {
|
|
4684
5515
|
return {
|
|
4685
5516
|
...existingFilter,
|
|
4686
5517
|
filters: existingFilter.filters.concat(clause)
|
|
@@ -4698,7 +5529,7 @@ var addClause = (existingFilter, clause, { combineWith = AND } = DEFAULT_ADD_FIL
|
|
|
4698
5529
|
}
|
|
4699
5530
|
};
|
|
4700
5531
|
var replaceClause = (existingFilter, clause) => {
|
|
4701
|
-
if ((0,
|
|
5532
|
+
if ((0, import_vuu_utils28.isMultiClauseFilter)(existingFilter)) {
|
|
4702
5533
|
return {
|
|
4703
5534
|
...existingFilter,
|
|
4704
5535
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -4710,18 +5541,18 @@ var replaceClause = (existingFilter, clause) => {
|
|
|
4710
5541
|
}
|
|
4711
5542
|
};
|
|
4712
5543
|
var addFilter = (existingFilter, filter, { combineWith = AND } = DEFAULT_ADD_FILTER_OPTS) => {
|
|
4713
|
-
var
|
|
5544
|
+
var _a2;
|
|
4714
5545
|
if (includesNoValues(filter)) {
|
|
4715
|
-
if ((0,
|
|
5546
|
+
if ((0, import_vuu_utils28.isMultiClauseFilter)(filter)) {
|
|
4716
5547
|
} else {
|
|
4717
5548
|
existingFilter = removeFilterForColumn(existingFilter, {
|
|
4718
5549
|
name: filter.column
|
|
4719
5550
|
});
|
|
4720
5551
|
}
|
|
4721
5552
|
} else if (includesAllValues(filter)) {
|
|
4722
|
-
if ((0,
|
|
5553
|
+
if ((0, import_vuu_utils28.isMultiClauseFilter)(filter)) {
|
|
4723
5554
|
}
|
|
4724
|
-
return removeFilterForColumn(existingFilter, { name: (
|
|
5555
|
+
return removeFilterForColumn(existingFilter, { name: (_a2 = filter.column) != null ? _a2 : "" });
|
|
4725
5556
|
}
|
|
4726
5557
|
if (!existingFilter) {
|
|
4727
5558
|
return filter;
|
|
@@ -4754,10 +5585,10 @@ var includesNoValues = (filter) => {
|
|
|
4754
5585
|
if (!filter) {
|
|
4755
5586
|
return false;
|
|
4756
5587
|
}
|
|
4757
|
-
if ((0,
|
|
5588
|
+
if ((0, import_vuu_utils28.isInFilter)(filter) && filter.values.length === 0) {
|
|
4758
5589
|
return true;
|
|
4759
5590
|
}
|
|
4760
|
-
return (0,
|
|
5591
|
+
return (0, import_vuu_utils28.isAndFilter)(filter) && filter.filters.some((f) => includesNoValues(f));
|
|
4761
5592
|
};
|
|
4762
5593
|
var includesAllValues = (filter) => {
|
|
4763
5594
|
if (!filter) {
|
|
@@ -4775,7 +5606,7 @@ var merge = (f1, f2) => {
|
|
|
4775
5606
|
if (includesNoValues(f2)) {
|
|
4776
5607
|
return f2;
|
|
4777
5608
|
}
|
|
4778
|
-
if ((0,
|
|
5609
|
+
if ((0, import_vuu_utils28.isInFilter)(f1) && (0, import_vuu_utils28.isInFilter)(f2)) {
|
|
4779
5610
|
return {
|
|
4780
5611
|
...f1,
|
|
4781
5612
|
values: [
|
|
@@ -4785,7 +5616,7 @@ var merge = (f1, f2) => {
|
|
|
4785
5616
|
)
|
|
4786
5617
|
]
|
|
4787
5618
|
};
|
|
4788
|
-
} else if ((0,
|
|
5619
|
+
} else if ((0, import_vuu_utils28.isInFilter)(f1) && f2.op === EQUALS) {
|
|
4789
5620
|
return {
|
|
4790
5621
|
...f1,
|
|
4791
5622
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -4841,14 +5672,14 @@ var splitFilterOnColumn = (columnName, filter) => {
|
|
|
4841
5672
|
if (filter.op !== AND) {
|
|
4842
5673
|
return [void 0, filter];
|
|
4843
5674
|
}
|
|
4844
|
-
const [[columnFilter = void 0], filters] = (0,
|
|
5675
|
+
const [[columnFilter = void 0], filters] = (0, import_vuu_utils28.partition)(
|
|
4845
5676
|
filter.filters,
|
|
4846
5677
|
(f) => f.column === columnName
|
|
4847
5678
|
);
|
|
4848
5679
|
return filters.length === 1 ? [columnFilter, filters[0]] : [columnFilter, { op: AND, filters }];
|
|
4849
5680
|
};
|
|
4850
5681
|
var overrideColName = (filter, column) => {
|
|
4851
|
-
if ((0,
|
|
5682
|
+
if ((0, import_vuu_utils28.isMultiClauseFilter)(filter)) {
|
|
4852
5683
|
return {
|
|
4853
5684
|
op: filter.op,
|
|
4854
5685
|
filters: filter.filters.map((f) => overrideColName(f, column))
|
|
@@ -4877,7 +5708,7 @@ var removeFilterForColumn = (sourceFilter, column) => {
|
|
|
4877
5708
|
if (sourceFilter.column === colName) {
|
|
4878
5709
|
return void 0;
|
|
4879
5710
|
}
|
|
4880
|
-
if ((0,
|
|
5711
|
+
if ((0, import_vuu_utils28.isAndFilter)(sourceFilter) || (0, import_vuu_utils28.isOrFilter)(sourceFilter)) {
|
|
4881
5712
|
const { op } = sourceFilter;
|
|
4882
5713
|
const filters = sourceFilter.filters;
|
|
4883
5714
|
const otherColFilters = filters.filter((f) => f.column !== colName);
|
|
@@ -4909,7 +5740,7 @@ var filterEquals = (f1, f2, strict = false) => {
|
|
|
4909
5740
|
return true;
|
|
4910
5741
|
}
|
|
4911
5742
|
if (f1 && f2 && canMerge(f1, f2)) {
|
|
4912
|
-
return f1.op === f2.op && ((0,
|
|
5743
|
+
return f1.op === f2.op && ((0, import_vuu_utils28.isSingleValueFilter)(f1) && (0, import_vuu_utils28.isSingleValueFilter)(f2) && f1.value === f2.value || (0, import_vuu_utils28.isMultiValueFilter)(f1) && (0, import_vuu_utils28.isMultiValueFilter)(f2) && sameValues(f1.values, f2.values));
|
|
4913
5744
|
}
|
|
4914
5745
|
return false;
|
|
4915
5746
|
};
|
|
@@ -4926,7 +5757,7 @@ var updateFilter = (filter, newFilter, mode) => {
|
|
|
4926
5757
|
}
|
|
4927
5758
|
const { column: columnName } = newFilter;
|
|
4928
5759
|
if (columnName) {
|
|
4929
|
-
const existingClause = newFilter.column ? (0,
|
|
5760
|
+
const existingClause = newFilter.column ? (0, import_vuu_utils28.extractFilterForColumn)(filter, columnName) : void 0;
|
|
4930
5761
|
if (existingClause && columnName) {
|
|
4931
5762
|
const result = removeFilterForColumn(filter, { name: columnName });
|
|
4932
5763
|
return updateFilter(result, newFilter, "add");
|
|
@@ -4969,16 +5800,16 @@ var getNumericFilter = (column, op, value) => {
|
|
|
4969
5800
|
};
|
|
4970
5801
|
|
|
4971
5802
|
// src/filter-pill/FilterPill.tsx
|
|
4972
|
-
var
|
|
4973
|
-
var
|
|
5803
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5804
|
+
var classBase17 = "vuuFilterPill";
|
|
4974
5805
|
var getFilterLabel = (filter) => {
|
|
4975
5806
|
if (filter.name) {
|
|
4976
5807
|
return filter.name;
|
|
4977
|
-
} else if ((0,
|
|
5808
|
+
} else if ((0, import_vuu_utils29.isMultiClauseFilter)(filter)) {
|
|
4978
5809
|
const [firstClause] = filterClauses(filter);
|
|
4979
|
-
return `${(0,
|
|
5810
|
+
return `${(0, import_vuu_utils29.filterAsQuery)(firstClause)} ${filter.op} ...`;
|
|
4980
5811
|
} else {
|
|
4981
|
-
return (0,
|
|
5812
|
+
return (0, import_vuu_utils29.filterAsQuery)(filter);
|
|
4982
5813
|
}
|
|
4983
5814
|
};
|
|
4984
5815
|
var FilterPill = ({
|
|
@@ -4991,12 +5822,12 @@ var FilterPill = ({
|
|
|
4991
5822
|
showMenu = true,
|
|
4992
5823
|
...htmlAttributes
|
|
4993
5824
|
}) => {
|
|
4994
|
-
const rootRef = (0,
|
|
4995
|
-
const handleEnterEditMode = (0,
|
|
5825
|
+
const rootRef = (0, import_react77.useRef)(null);
|
|
5826
|
+
const handleEnterEditMode = (0, import_react77.useCallback)(() => {
|
|
4996
5827
|
onBeginEdit == null ? void 0 : onBeginEdit(filter);
|
|
4997
5828
|
}, [filter, onBeginEdit]);
|
|
4998
5829
|
const label = getFilterLabel(filter);
|
|
4999
|
-
const handleMenuClose = (0,
|
|
5830
|
+
const handleMenuClose = (0, import_react77.useCallback)((reason) => {
|
|
5000
5831
|
if ((reason == null ? void 0 : reason.type) === "escape") {
|
|
5001
5832
|
requestAnimationFrame(() => {
|
|
5002
5833
|
if (rootRef.current) {
|
|
@@ -5005,24 +5836,24 @@ var FilterPill = ({
|
|
|
5005
5836
|
});
|
|
5006
5837
|
}
|
|
5007
5838
|
}, []);
|
|
5008
|
-
return /* @__PURE__ */ (0,
|
|
5839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
5009
5840
|
"div",
|
|
5010
5841
|
{
|
|
5011
5842
|
...htmlAttributes,
|
|
5012
|
-
className: (0,
|
|
5843
|
+
className: (0, import_classnames29.default)(classBase17, classNameProp),
|
|
5013
5844
|
"data-text": label,
|
|
5014
5845
|
ref: rootRef,
|
|
5015
5846
|
children: [
|
|
5016
|
-
editable && onExitEditMode ? /* @__PURE__ */ (0,
|
|
5017
|
-
|
|
5847
|
+
editable && onExitEditMode ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5848
|
+
import_vuu_ui_controls15.EditableLabel,
|
|
5018
5849
|
{
|
|
5019
5850
|
defaultValue: label,
|
|
5020
5851
|
onEnterEditMode: handleEnterEditMode,
|
|
5021
5852
|
onExitEditMode
|
|
5022
5853
|
},
|
|
5023
5854
|
label
|
|
5024
|
-
) : /* @__PURE__ */ (0,
|
|
5025
|
-
showMenu && onMenuAction ? /* @__PURE__ */ (0,
|
|
5855
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: `${classBase17}-label`, children: label }),
|
|
5856
|
+
showMenu && onMenuAction ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
5026
5857
|
FilterPillMenu,
|
|
5027
5858
|
{
|
|
5028
5859
|
filter,
|
|
@@ -5036,24 +5867,24 @@ var FilterPill = ({
|
|
|
5036
5867
|
};
|
|
5037
5868
|
|
|
5038
5869
|
// src/filter-bar/useFilterBar.ts
|
|
5039
|
-
var
|
|
5040
|
-
var
|
|
5870
|
+
var import_vuu_utils30 = require("@vuu-ui/vuu-utils");
|
|
5871
|
+
var import_react79 = require("react");
|
|
5041
5872
|
|
|
5042
5873
|
// src/filter-bar/useFilters.ts
|
|
5043
|
-
var
|
|
5044
|
-
var
|
|
5874
|
+
var import_vuu_ui_controls16 = require("@vuu-ui/vuu-ui-controls");
|
|
5875
|
+
var import_react78 = require("react");
|
|
5045
5876
|
var useFilters = ({
|
|
5046
5877
|
defaultFilters,
|
|
5047
5878
|
filters: filtersProp,
|
|
5048
5879
|
onFiltersChanged
|
|
5049
5880
|
}) => {
|
|
5050
|
-
const [filters, setFilters] = (0,
|
|
5881
|
+
const [filters, setFilters] = (0, import_vuu_ui_controls16.useControlled)({
|
|
5051
5882
|
controlled: filtersProp,
|
|
5052
5883
|
default: defaultFilters != null ? defaultFilters : [],
|
|
5053
5884
|
name: "useFilters",
|
|
5054
5885
|
state: "Filters"
|
|
5055
5886
|
});
|
|
5056
|
-
const handleAddFilter = (0,
|
|
5887
|
+
const handleAddFilter = (0, import_react78.useCallback)(
|
|
5057
5888
|
(filter) => {
|
|
5058
5889
|
const index = filters.length;
|
|
5059
5890
|
const newFilters = filters.concat(filter);
|
|
@@ -5063,7 +5894,7 @@ var useFilters = ({
|
|
|
5063
5894
|
},
|
|
5064
5895
|
[filters, onFiltersChanged, setFilters]
|
|
5065
5896
|
);
|
|
5066
|
-
const handleDeleteFilter = (0,
|
|
5897
|
+
const handleDeleteFilter = (0, import_react78.useCallback)(
|
|
5067
5898
|
(filter) => {
|
|
5068
5899
|
let index = -1;
|
|
5069
5900
|
const newFilters = filters.filter((f, i) => {
|
|
@@ -5080,7 +5911,7 @@ var useFilters = ({
|
|
|
5080
5911
|
},
|
|
5081
5912
|
[filters, onFiltersChanged, setFilters]
|
|
5082
5913
|
);
|
|
5083
|
-
const handleRenameFilter = (0,
|
|
5914
|
+
const handleRenameFilter = (0, import_react78.useCallback)(
|
|
5084
5915
|
(filter, name) => {
|
|
5085
5916
|
let index = -1;
|
|
5086
5917
|
const newFilters = filters.map((f, i) => {
|
|
@@ -5097,7 +5928,7 @@ var useFilters = ({
|
|
|
5097
5928
|
},
|
|
5098
5929
|
[filters, onFiltersChanged, setFilters]
|
|
5099
5930
|
);
|
|
5100
|
-
const handleChangeFilter = (0,
|
|
5931
|
+
const handleChangeFilter = (0, import_react78.useCallback)(
|
|
5101
5932
|
(filter) => {
|
|
5102
5933
|
let index = -1;
|
|
5103
5934
|
const newFilters = filters.map((f, i) => {
|
|
@@ -5129,16 +5960,15 @@ var useFilterBar = ({
|
|
|
5129
5960
|
activeFilterIndex: activeFilterIdexProp = [],
|
|
5130
5961
|
containerRef,
|
|
5131
5962
|
filters: filtersProp,
|
|
5132
|
-
onActiveChange,
|
|
5133
5963
|
onApplyFilter,
|
|
5134
5964
|
onFiltersChanged,
|
|
5135
5965
|
showMenu: showMenuProp
|
|
5136
5966
|
}) => {
|
|
5137
|
-
const editingFilter = (0,
|
|
5138
|
-
const [activeFilterIndex, setActiveFilterIndex] = (0,
|
|
5139
|
-
const [showMenu, setShowMenu] = (0,
|
|
5140
|
-
const [editFilter, setEditFilter] = (0,
|
|
5141
|
-
const [promptProps, setPromptProps] = (0,
|
|
5967
|
+
const editingFilter = (0, import_react79.useRef)();
|
|
5968
|
+
const [activeFilterIndex, setActiveFilterIndex] = (0, import_react79.useState)(activeFilterIdexProp);
|
|
5969
|
+
const [showMenu, setShowMenu] = (0, import_react79.useState)(showMenuProp);
|
|
5970
|
+
const [editFilter, setEditFilter] = (0, import_react79.useState)();
|
|
5971
|
+
const [promptProps, setPromptProps] = (0, import_react79.useState)(null);
|
|
5142
5972
|
const {
|
|
5143
5973
|
filters,
|
|
5144
5974
|
onAddFilter,
|
|
@@ -5149,11 +5979,11 @@ var useFilterBar = ({
|
|
|
5149
5979
|
filters: filtersProp,
|
|
5150
5980
|
onFiltersChanged
|
|
5151
5981
|
});
|
|
5152
|
-
const editPillLabel = (0,
|
|
5982
|
+
const editPillLabel = (0, import_react79.useCallback)(
|
|
5153
5983
|
(index) => {
|
|
5154
5984
|
requestAnimationFrame(() => {
|
|
5155
|
-
var
|
|
5156
|
-
const pills = (
|
|
5985
|
+
var _a2;
|
|
5986
|
+
const pills = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelectorAll(
|
|
5157
5987
|
".vuuFilterPill"
|
|
5158
5988
|
);
|
|
5159
5989
|
if (pills == null ? void 0 : pills[index]) {
|
|
@@ -5161,18 +5991,18 @@ var useFilterBar = ({
|
|
|
5161
5991
|
".vuuEditableLabel"
|
|
5162
5992
|
);
|
|
5163
5993
|
if (editableLabel) {
|
|
5164
|
-
(0,
|
|
5994
|
+
(0, import_vuu_utils30.dispatchMouseEvent)(editableLabel, "dblclick");
|
|
5165
5995
|
}
|
|
5166
5996
|
}
|
|
5167
5997
|
});
|
|
5168
5998
|
},
|
|
5169
5999
|
[containerRef]
|
|
5170
6000
|
);
|
|
5171
|
-
const focusFilterClause = (0,
|
|
6001
|
+
const focusFilterClause = (0, import_react79.useCallback)(
|
|
5172
6002
|
(index = 0) => {
|
|
5173
6003
|
requestAnimationFrame(() => {
|
|
5174
|
-
var
|
|
5175
|
-
const input = (
|
|
6004
|
+
var _a2;
|
|
6005
|
+
const input = (_a2 = containerRef.current) == null ? void 0 : _a2.querySelector(
|
|
5176
6006
|
".vuuFilterClause .saltInput-input"
|
|
5177
6007
|
);
|
|
5178
6008
|
if (input) {
|
|
@@ -5182,11 +6012,11 @@ var useFilterBar = ({
|
|
|
5182
6012
|
},
|
|
5183
6013
|
[containerRef]
|
|
5184
6014
|
);
|
|
5185
|
-
const focusFilterPill = (0,
|
|
6015
|
+
const focusFilterPill = (0, import_react79.useCallback)(
|
|
5186
6016
|
(index) => {
|
|
5187
6017
|
requestAnimationFrame(() => {
|
|
5188
|
-
var
|
|
5189
|
-
const target = typeof index === "number" ? (
|
|
6018
|
+
var _a2, _b;
|
|
6019
|
+
const target = typeof index === "number" ? (_a2 = containerRef.current) == null ? void 0 : _a2.querySelector(
|
|
5190
6020
|
`.vuuOverflowContainer-item[data-index="${index}"] .vuuFilterPill`
|
|
5191
6021
|
) : (_b = containerRef.current) == null ? void 0 : _b.querySelector(
|
|
5192
6022
|
".vuuFilterPill[tabindex]"
|
|
@@ -5198,9 +6028,9 @@ var useFilterBar = ({
|
|
|
5198
6028
|
},
|
|
5199
6029
|
[containerRef]
|
|
5200
6030
|
);
|
|
5201
|
-
const applyFilter = (0,
|
|
6031
|
+
const applyFilter = (0, import_react79.useCallback)(
|
|
5202
6032
|
(filter) => {
|
|
5203
|
-
const filterQuery = filter ? (0,
|
|
6033
|
+
const filterQuery = filter ? (0, import_vuu_utils30.filterAsQuery)(filter) : "";
|
|
5204
6034
|
onApplyFilter({
|
|
5205
6035
|
filter: filterQuery,
|
|
5206
6036
|
filterStruct: filter
|
|
@@ -5208,30 +6038,7 @@ var useFilterBar = ({
|
|
|
5208
6038
|
},
|
|
5209
6039
|
[onApplyFilter]
|
|
5210
6040
|
);
|
|
5211
|
-
const
|
|
5212
|
-
(activeIndices) => {
|
|
5213
|
-
if (activeIndices.length > 0) {
|
|
5214
|
-
const activeFilters = activeIndices.map(
|
|
5215
|
-
(index) => filters[index]
|
|
5216
|
-
);
|
|
5217
|
-
if (activeFilters.length === 1) {
|
|
5218
|
-
const [filter] = activeFilters;
|
|
5219
|
-
applyFilter(filter);
|
|
5220
|
-
} else {
|
|
5221
|
-
applyFilter({
|
|
5222
|
-
op: "and",
|
|
5223
|
-
filters: activeFilters
|
|
5224
|
-
});
|
|
5225
|
-
}
|
|
5226
|
-
} else {
|
|
5227
|
-
applyFilter();
|
|
5228
|
-
}
|
|
5229
|
-
setActiveFilterIndex(activeIndices);
|
|
5230
|
-
onActiveChange == null ? void 0 : onActiveChange(activeIndices);
|
|
5231
|
-
},
|
|
5232
|
-
[applyFilter, filters, onActiveChange]
|
|
5233
|
-
);
|
|
5234
|
-
const deleteConfirmed = (0, import_react56.useCallback)(
|
|
6041
|
+
const deleteConfirmed = (0, import_react79.useCallback)(
|
|
5235
6042
|
(filter) => {
|
|
5236
6043
|
const indexOfFilter = filters.indexOf(filter);
|
|
5237
6044
|
if (activeFilterIndex.includes(indexOfFilter)) {
|
|
@@ -5241,8 +6048,8 @@ var useFilterBar = ({
|
|
|
5241
6048
|
}
|
|
5242
6049
|
const indexOfDeletedFilter = onDeleteFilter == null ? void 0 : onDeleteFilter(filter);
|
|
5243
6050
|
if (activeFilterIndex.includes(indexOfDeletedFilter)) {
|
|
5244
|
-
|
|
5245
|
-
|
|
6051
|
+
setActiveFilterIndex(
|
|
6052
|
+
(indices) => indices.filter((i) => i !== indexOfDeletedFilter)
|
|
5246
6053
|
);
|
|
5247
6054
|
}
|
|
5248
6055
|
requestAnimationFrame(() => {
|
|
@@ -5251,15 +6058,9 @@ var useFilterBar = ({
|
|
|
5251
6058
|
}
|
|
5252
6059
|
});
|
|
5253
6060
|
},
|
|
5254
|
-
[
|
|
5255
|
-
activeFilterIndex,
|
|
5256
|
-
filters,
|
|
5257
|
-
focusFilterPill,
|
|
5258
|
-
handleFilterActivation,
|
|
5259
|
-
onDeleteFilter
|
|
5260
|
-
]
|
|
6061
|
+
[activeFilterIndex, filters, focusFilterPill, onDeleteFilter]
|
|
5261
6062
|
);
|
|
5262
|
-
const getDeletePrompt = (0,
|
|
6063
|
+
const getDeletePrompt = (0, import_react79.useMemo)(
|
|
5263
6064
|
() => (filter) => {
|
|
5264
6065
|
const close = () => {
|
|
5265
6066
|
setPromptProps(null);
|
|
@@ -5281,7 +6082,7 @@ var useFilterBar = ({
|
|
|
5281
6082
|
},
|
|
5282
6083
|
[deleteConfirmed, focusFilterPill]
|
|
5283
6084
|
);
|
|
5284
|
-
const deleteFilter = (0,
|
|
6085
|
+
const deleteFilter = (0, import_react79.useCallback)(
|
|
5285
6086
|
(filter, withPrompt) => {
|
|
5286
6087
|
if (withPrompt) {
|
|
5287
6088
|
setPromptProps(getDeletePrompt(filter));
|
|
@@ -5291,10 +6092,10 @@ var useFilterBar = ({
|
|
|
5291
6092
|
},
|
|
5292
6093
|
[deleteConfirmed, getDeletePrompt]
|
|
5293
6094
|
);
|
|
5294
|
-
const handleBeginEditFilterName = (0,
|
|
6095
|
+
const handleBeginEditFilterName = (0, import_react79.useCallback)((filter) => {
|
|
5295
6096
|
editingFilter.current = filter;
|
|
5296
6097
|
}, []);
|
|
5297
|
-
const handleExitEditFilterName = (0,
|
|
6098
|
+
const handleExitEditFilterName = (0, import_react79.useCallback)(
|
|
5298
6099
|
(_, editedValue = "") => {
|
|
5299
6100
|
if (editingFilter.current) {
|
|
5300
6101
|
const indexOfEditedFilter = onRenameFilter(
|
|
@@ -5307,7 +6108,7 @@ var useFilterBar = ({
|
|
|
5307
6108
|
},
|
|
5308
6109
|
[focusFilterPill, onRenameFilter]
|
|
5309
6110
|
);
|
|
5310
|
-
const handlePillMenuAction = (0,
|
|
6111
|
+
const handlePillMenuAction = (0, import_react79.useCallback)(
|
|
5311
6112
|
({ menuId, options }) => {
|
|
5312
6113
|
switch (menuId) {
|
|
5313
6114
|
case "delete-filter": {
|
|
@@ -5334,7 +6135,7 @@ var useFilterBar = ({
|
|
|
5334
6135
|
},
|
|
5335
6136
|
[deleteFilter, editPillLabel, filters, focusFilterClause]
|
|
5336
6137
|
);
|
|
5337
|
-
const handleMenuAction = (0,
|
|
6138
|
+
const handleMenuAction = (0, import_react79.useCallback)(
|
|
5338
6139
|
({ menuId }) => {
|
|
5339
6140
|
switch (menuId) {
|
|
5340
6141
|
case "apply-save": {
|
|
@@ -5346,11 +6147,10 @@ var useFilterBar = ({
|
|
|
5346
6147
|
editPillLabel(indexOfNewFilter);
|
|
5347
6148
|
}
|
|
5348
6149
|
setEditFilter(void 0);
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
6150
|
+
setActiveFilterIndex(
|
|
6151
|
+
(indices) => indices.includes(indexOfNewFilter) ? indices : indices.concat(indexOfNewFilter)
|
|
6152
|
+
);
|
|
5352
6153
|
setShowMenu(false);
|
|
5353
|
-
applyFilter(newFilter);
|
|
5354
6154
|
return true;
|
|
5355
6155
|
}
|
|
5356
6156
|
case "and-clause":
|
|
@@ -5369,20 +6169,36 @@ var useFilterBar = ({
|
|
|
5369
6169
|
return false;
|
|
5370
6170
|
}
|
|
5371
6171
|
},
|
|
5372
|
-
[
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
6172
|
+
[editFilter, editPillLabel, onAddFilter, onChangeFilter]
|
|
6173
|
+
);
|
|
6174
|
+
(0, import_react79.useEffect)(() => {
|
|
6175
|
+
if (activeFilterIndex.length > 0) {
|
|
6176
|
+
const activeFilters = activeFilterIndex.map(
|
|
6177
|
+
(index) => filters[index]
|
|
6178
|
+
);
|
|
6179
|
+
if (activeFilters.length === 1) {
|
|
6180
|
+
const [filter] = activeFilters;
|
|
6181
|
+
applyFilter(filter);
|
|
6182
|
+
} else {
|
|
6183
|
+
applyFilter({
|
|
6184
|
+
op: "and",
|
|
6185
|
+
filters: activeFilters
|
|
6186
|
+
});
|
|
6187
|
+
}
|
|
6188
|
+
} else {
|
|
6189
|
+
applyFilter();
|
|
6190
|
+
}
|
|
6191
|
+
}, [activeFilterIndex, applyFilter, filters]);
|
|
6192
|
+
const handleChangeActiveFilterIndex = (0, import_react79.useCallback)(
|
|
6193
|
+
(itemIndex) => {
|
|
6194
|
+
setActiveFilterIndex(itemIndex);
|
|
6195
|
+
},
|
|
6196
|
+
[]
|
|
5381
6197
|
);
|
|
5382
|
-
const handleClickAddFilter = (0,
|
|
6198
|
+
const handleClickAddFilter = (0, import_react79.useCallback)(() => {
|
|
5383
6199
|
setEditFilter({});
|
|
5384
6200
|
}, []);
|
|
5385
|
-
const handleClickRemoveFilter = (0,
|
|
6201
|
+
const handleClickRemoveFilter = (0, import_react79.useCallback)(() => {
|
|
5386
6202
|
setEditFilter(void 0);
|
|
5387
6203
|
}, []);
|
|
5388
6204
|
const pillProps = {
|
|
@@ -5391,12 +6207,13 @@ var useFilterBar = ({
|
|
|
5391
6207
|
onExitEditMode: handleExitEditFilterName
|
|
5392
6208
|
};
|
|
5393
6209
|
const handleChangeFilterClause = (filterClause) => {
|
|
6210
|
+
console.log({ filterClause });
|
|
5394
6211
|
if (filterClause !== void 0) {
|
|
5395
6212
|
setEditFilter((filter) => replaceClause(filter, filterClause));
|
|
5396
6213
|
setShowMenu(true);
|
|
5397
6214
|
}
|
|
5398
6215
|
};
|
|
5399
|
-
const onKeyDown = (0,
|
|
6216
|
+
const onKeyDown = (0, import_react79.useCallback)(
|
|
5400
6217
|
(evt) => {
|
|
5401
6218
|
if (evt.key === "Escape" && editFilter !== void 0) {
|
|
5402
6219
|
setEditFilter(void 0);
|
|
@@ -5410,10 +6227,10 @@ var useFilterBar = ({
|
|
|
5410
6227
|
activeFilterIndex,
|
|
5411
6228
|
editFilter,
|
|
5412
6229
|
filters,
|
|
6230
|
+
onChangeActiveFilterIndex: handleChangeActiveFilterIndex,
|
|
5413
6231
|
onClickAddFilter: handleClickAddFilter,
|
|
5414
6232
|
onClickRemoveFilter: handleClickRemoveFilter,
|
|
5415
6233
|
onChangeFilterClause: handleChangeFilterClause,
|
|
5416
|
-
onFilterActivation: handleFilterActivation,
|
|
5417
6234
|
onKeyDown,
|
|
5418
6235
|
onMenuAction: handleMenuAction,
|
|
5419
6236
|
pillProps,
|
|
@@ -5423,22 +6240,21 @@ var useFilterBar = ({
|
|
|
5423
6240
|
};
|
|
5424
6241
|
|
|
5425
6242
|
// src/filter-bar/FilterBar.tsx
|
|
5426
|
-
var
|
|
5427
|
-
var
|
|
5428
|
-
var
|
|
6243
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6244
|
+
var import_react81 = require("react");
|
|
6245
|
+
var classBase18 = "vuuFilterBar";
|
|
5429
6246
|
var FilterBar = ({
|
|
5430
|
-
activeFilterIndex: activeFilterIndexProp,
|
|
6247
|
+
activeFilterIndex: activeFilterIndexProp = [],
|
|
5431
6248
|
FilterClauseEditorProps: FilterClauseEditorProps2,
|
|
5432
6249
|
className: classNameProp,
|
|
5433
6250
|
filters: filtersProp,
|
|
5434
|
-
onActiveChange,
|
|
5435
6251
|
onApplyFilter,
|
|
5436
6252
|
onFiltersChanged,
|
|
5437
6253
|
showMenu: showMenuProp = false,
|
|
5438
6254
|
tableSchema,
|
|
5439
6255
|
...htmlAttributes
|
|
5440
6256
|
}) => {
|
|
5441
|
-
const rootRef = (0,
|
|
6257
|
+
const rootRef = (0, import_react80.useRef)(null);
|
|
5442
6258
|
const {
|
|
5443
6259
|
activeFilterIndex,
|
|
5444
6260
|
editFilter,
|
|
@@ -5446,7 +6262,7 @@ var FilterBar = ({
|
|
|
5446
6262
|
onClickAddFilter,
|
|
5447
6263
|
onClickRemoveFilter,
|
|
5448
6264
|
onChangeFilterClause,
|
|
5449
|
-
|
|
6265
|
+
onChangeActiveFilterIndex,
|
|
5450
6266
|
onKeyDown,
|
|
5451
6267
|
onMenuAction,
|
|
5452
6268
|
pillProps,
|
|
@@ -5456,14 +6272,13 @@ var FilterBar = ({
|
|
|
5456
6272
|
activeFilterIndex: activeFilterIndexProp,
|
|
5457
6273
|
containerRef: rootRef,
|
|
5458
6274
|
filters: filtersProp,
|
|
5459
|
-
onActiveChange,
|
|
5460
6275
|
onApplyFilter,
|
|
5461
6276
|
onFiltersChanged,
|
|
5462
6277
|
showMenu: showMenuProp
|
|
5463
6278
|
});
|
|
5464
|
-
const className = (0,
|
|
5465
|
-
[`${
|
|
5466
|
-
[`${
|
|
6279
|
+
const className = (0, import_classnames30.default)(classBase18, classNameProp, {
|
|
6280
|
+
[`${classBase18}-display`]: editFilter === void 0,
|
|
6281
|
+
[`${classBase18}-edit`]: editFilter !== void 0
|
|
5467
6282
|
});
|
|
5468
6283
|
const onClose = () => console.log("Closing filter component");
|
|
5469
6284
|
const getChildren2 = () => {
|
|
@@ -5471,28 +6286,15 @@ var FilterBar = ({
|
|
|
5471
6286
|
if (editFilter === void 0) {
|
|
5472
6287
|
filters.forEach((filter, i) => {
|
|
5473
6288
|
items.push(
|
|
5474
|
-
/* @__PURE__ */ (0,
|
|
6289
|
+
/* @__PURE__ */ (0, import_react81.createElement)(FilterPill, { ...pillProps, filter, key: `filter-${i}` })
|
|
5475
6290
|
);
|
|
5476
6291
|
});
|
|
5477
|
-
items.push(
|
|
5478
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
5479
|
-
import_core11.Button,
|
|
5480
|
-
{
|
|
5481
|
-
className: `${classBase17}-add`,
|
|
5482
|
-
"data-icon": "plus",
|
|
5483
|
-
"data-selectable": false,
|
|
5484
|
-
onClick: onClickAddFilter,
|
|
5485
|
-
variant: "primary"
|
|
5486
|
-
},
|
|
5487
|
-
"filter-add"
|
|
5488
|
-
)
|
|
5489
|
-
);
|
|
5490
6292
|
return items;
|
|
5491
6293
|
} else if (editFilter) {
|
|
5492
6294
|
const filterClauses2 = filterClauses(editFilter);
|
|
5493
6295
|
filterClauses2.forEach((filterClause, i) => {
|
|
5494
6296
|
items.push(
|
|
5495
|
-
/* @__PURE__ */ (0,
|
|
6297
|
+
/* @__PURE__ */ (0, import_react81.createElement)(
|
|
5496
6298
|
FilterClauseEditor,
|
|
5497
6299
|
{
|
|
5498
6300
|
...FilterClauseEditorProps2,
|
|
@@ -5507,14 +6309,14 @@ var FilterBar = ({
|
|
|
5507
6309
|
});
|
|
5508
6310
|
if (showMenu) {
|
|
5509
6311
|
items.push(
|
|
5510
|
-
/* @__PURE__ */ (0,
|
|
6312
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(FilterBuilderMenu, { onMenuAction }, "menu")
|
|
5511
6313
|
);
|
|
5512
6314
|
}
|
|
5513
6315
|
items.push(
|
|
5514
|
-
/* @__PURE__ */ (0,
|
|
5515
|
-
|
|
6316
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6317
|
+
import_core19.Button,
|
|
5516
6318
|
{
|
|
5517
|
-
className: `${
|
|
6319
|
+
className: `${classBase18}-remove`,
|
|
5518
6320
|
"data-align": "right",
|
|
5519
6321
|
"data-icon": "cross",
|
|
5520
6322
|
onClick: onClickRemoveFilter,
|
|
@@ -5526,7 +6328,7 @@ var FilterBar = ({
|
|
|
5526
6328
|
return items;
|
|
5527
6329
|
}
|
|
5528
6330
|
};
|
|
5529
|
-
return /* @__PURE__ */ (0,
|
|
6331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
5530
6332
|
"div",
|
|
5531
6333
|
{
|
|
5532
6334
|
...htmlAttributes,
|
|
@@ -5534,18 +6336,30 @@ var FilterBar = ({
|
|
|
5534
6336
|
onKeyDown,
|
|
5535
6337
|
ref: rootRef,
|
|
5536
6338
|
children: [
|
|
5537
|
-
/* @__PURE__ */ (0,
|
|
5538
|
-
/* @__PURE__ */ (0,
|
|
6339
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: `${classBase18}-icon`, "data-icon": "tune" }),
|
|
6340
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5539
6341
|
Toolbar,
|
|
5540
6342
|
{
|
|
5541
6343
|
activeItemIndex: activeFilterIndex,
|
|
5542
6344
|
height: 26,
|
|
5543
|
-
onActiveChange:
|
|
6345
|
+
onActiveChange: onChangeActiveFilterIndex,
|
|
5544
6346
|
selectionStrategy: "multiple-special-key",
|
|
5545
6347
|
children: getChildren2()
|
|
5546
6348
|
}
|
|
5547
6349
|
),
|
|
5548
|
-
|
|
6350
|
+
editFilter === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
6351
|
+
import_core19.Button,
|
|
6352
|
+
{
|
|
6353
|
+
className: `${classBase18}-add`,
|
|
6354
|
+
"data-icon": "plus",
|
|
6355
|
+
"data-selectable": false,
|
|
6356
|
+
onClick: onClickAddFilter,
|
|
6357
|
+
tabIndex: 0,
|
|
6358
|
+
variant: "primary"
|
|
6359
|
+
},
|
|
6360
|
+
"filter-add"
|
|
6361
|
+
) : null,
|
|
6362
|
+
promptProps ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
5549
6363
|
import_vuu_popups5.Prompt,
|
|
5550
6364
|
{
|
|
5551
6365
|
...promptProps,
|
|
@@ -5562,7 +6376,7 @@ var FilterBar = ({
|
|
|
5562
6376
|
};
|
|
5563
6377
|
|
|
5564
6378
|
// src/filter-input/FilterInput.tsx
|
|
5565
|
-
var
|
|
6379
|
+
var import_core20 = require("@salt-ds/core");
|
|
5566
6380
|
|
|
5567
6381
|
// src/filter-input/useCodeMirrorEditor.ts
|
|
5568
6382
|
var import_vuu_codemirror5 = require("@vuu-ui/vuu-codemirror");
|
|
@@ -5983,7 +6797,7 @@ function enterUnfinishedNodesBefore(node, pos) {
|
|
|
5983
6797
|
return node;
|
|
5984
6798
|
}
|
|
5985
6799
|
function resolveNode(node, pos, side, overlays) {
|
|
5986
|
-
var
|
|
6800
|
+
var _a2;
|
|
5987
6801
|
while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) {
|
|
5988
6802
|
let parent = !overlays && node instanceof TreeNode && node.index < 0 ? null : node.parent;
|
|
5989
6803
|
if (!parent)
|
|
@@ -5993,7 +6807,7 @@ function resolveNode(node, pos, side, overlays) {
|
|
|
5993
6807
|
let mode = overlays ? 0 : IterMode.IgnoreOverlays;
|
|
5994
6808
|
if (overlays)
|
|
5995
6809
|
for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) {
|
|
5996
|
-
if (scan instanceof TreeNode && scan.index < 0 && ((
|
|
6810
|
+
if (scan instanceof TreeNode && scan.index < 0 && ((_a2 = parent.enter(pos, side, mode)) === null || _a2 === void 0 ? void 0 : _a2.from) != scan.from)
|
|
5997
6811
|
node = parent;
|
|
5998
6812
|
}
|
|
5999
6813
|
for (; ; ) {
|
|
@@ -6143,8 +6957,8 @@ var TreeNode = class {
|
|
|
6143
6957
|
return enterUnfinishedNodesBefore(this, pos);
|
|
6144
6958
|
}
|
|
6145
6959
|
getChild(type, before = null, after = null) {
|
|
6146
|
-
let
|
|
6147
|
-
return
|
|
6960
|
+
let r2 = getChildren(this, type, before, after);
|
|
6961
|
+
return r2.length ? r2[0] : null;
|
|
6148
6962
|
}
|
|
6149
6963
|
getChildren(type, before = null, after = null) {
|
|
6150
6964
|
return getChildren(this, type, before, after);
|
|
@@ -6322,8 +7136,8 @@ var BufferNode = class {
|
|
|
6322
7136
|
return this.context.buffer.childString(this.index);
|
|
6323
7137
|
}
|
|
6324
7138
|
getChild(type, before = null, after = null) {
|
|
6325
|
-
let
|
|
6326
|
-
return
|
|
7139
|
+
let r2 = getChildren(this, type, before, after);
|
|
7140
|
+
return r2.length ? r2[0] : null;
|
|
6327
7141
|
}
|
|
6328
7142
|
getChildren(type, before = null, after = null) {
|
|
6329
7143
|
return getChildren(this, type, before, after);
|
|
@@ -6637,7 +7451,7 @@ function hasChild(tree) {
|
|
|
6637
7451
|
return tree.children.some((ch) => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch));
|
|
6638
7452
|
}
|
|
6639
7453
|
function buildTree(data) {
|
|
6640
|
-
var
|
|
7454
|
+
var _a2;
|
|
6641
7455
|
let { buffer, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data;
|
|
6642
7456
|
let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer;
|
|
6643
7457
|
let types = nodeSet.types;
|
|
@@ -6803,7 +7617,7 @@ function buildTree(data) {
|
|
|
6803
7617
|
let children = [], positions = [];
|
|
6804
7618
|
while (cursor.pos > 0)
|
|
6805
7619
|
takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1);
|
|
6806
|
-
let length = (
|
|
7620
|
+
let length = (_a2 = data.length) !== null && _a2 !== void 0 ? _a2 : children.length ? positions[0] + children[0].length : 0;
|
|
6807
7621
|
return new Tree2(types[data.topID], children.reverse(), positions.reverse(), length);
|
|
6808
7622
|
}
|
|
6809
7623
|
var nodeSizeCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -6872,7 +7686,7 @@ var Parser = class {
|
|
|
6872
7686
|
startParse(input, fragments, ranges) {
|
|
6873
7687
|
if (typeof input == "string")
|
|
6874
7688
|
input = new StringInput(input);
|
|
6875
|
-
ranges = !ranges ? [new Range(0, input.length)] : ranges.length ? ranges.map((
|
|
7689
|
+
ranges = !ranges ? [new Range(0, input.length)] : ranges.length ? ranges.map((r2) => new Range(r2.from, r2.to)) : [new Range(0, 0)];
|
|
6876
7690
|
return this.createParse(input, fragments || [], ranges);
|
|
6877
7691
|
}
|
|
6878
7692
|
/// Run a full parse, returning the resulting tree.
|
|
@@ -6927,8 +7741,8 @@ var Stack3 = class {
|
|
|
6927
7741
|
// Start an empty stack
|
|
6928
7742
|
/// @internal
|
|
6929
7743
|
static start(p, state, pos = 0) {
|
|
6930
|
-
let
|
|
6931
|
-
return new Stack3(p, [], state, pos, pos, 0, [], 0,
|
|
7744
|
+
let cx31 = p.parser.context;
|
|
7745
|
+
return new Stack3(p, [], state, pos, pos, 0, [], 0, cx31 ? new StackContext(cx31, cx31.start) : null, 0, null);
|
|
6932
7746
|
}
|
|
6933
7747
|
/// The stack's current [context](#lr.ContextTracker) value, if
|
|
6934
7748
|
/// any. Its type will depend on the context tracker's type
|
|
@@ -6947,7 +7761,7 @@ var Stack3 = class {
|
|
|
6947
7761
|
// Apply a reduce action
|
|
6948
7762
|
/// @internal
|
|
6949
7763
|
reduce(action) {
|
|
6950
|
-
var
|
|
7764
|
+
var _a2;
|
|
6951
7765
|
let depth = action >> 19, type = action & 65535;
|
|
6952
7766
|
let { parser: parser2 } = this.p;
|
|
6953
7767
|
let dPrec = parser2.dynamicPrecedence(type);
|
|
@@ -6962,7 +7776,7 @@ var Stack3 = class {
|
|
|
6962
7776
|
}
|
|
6963
7777
|
let base = this.stack.length - (depth - 1) * 3 - (action & 262144 ? 6 : 0);
|
|
6964
7778
|
let start2 = base ? this.stack[base - 2] : this.p.ranges[0].from, size = this.reducePos - start2;
|
|
6965
|
-
if (size >= 2e3 && !((
|
|
7779
|
+
if (size >= 2e3 && !((_a2 = this.p.parser.nodeSet.types[type]) === null || _a2 === void 0 ? void 0 : _a2.isAnonymous)) {
|
|
6966
7780
|
if (start2 == this.p.lastBigReductionStart) {
|
|
6967
7781
|
this.p.bigReductionCount++;
|
|
6968
7782
|
this.p.lastBigReductionSize = size;
|
|
@@ -7621,11 +8435,11 @@ var InputStream = class {
|
|
|
7621
8435
|
if (from >= this.range.from && to <= this.range.to)
|
|
7622
8436
|
return this.input.read(from, to);
|
|
7623
8437
|
let result = "";
|
|
7624
|
-
for (let
|
|
7625
|
-
if (
|
|
8438
|
+
for (let r2 of this.ranges) {
|
|
8439
|
+
if (r2.from >= to)
|
|
7626
8440
|
break;
|
|
7627
|
-
if (
|
|
7628
|
-
result += this.input.read(Math.max(
|
|
8441
|
+
if (r2.to > from)
|
|
8442
|
+
result += this.input.read(Math.max(r2.from, from), Math.min(r2.to, to));
|
|
7629
8443
|
}
|
|
7630
8444
|
return result;
|
|
7631
8445
|
}
|
|
@@ -8256,7 +9070,7 @@ var LRParser = class extends Parser {
|
|
|
8256
9070
|
this.minRepeatTerm = nodeNames.length;
|
|
8257
9071
|
for (let i = 0; i < spec.repeatNodeCount; i++)
|
|
8258
9072
|
nodeNames.push("");
|
|
8259
|
-
let topTerms = Object.keys(spec.topRules).map((
|
|
9073
|
+
let topTerms = Object.keys(spec.topRules).map((r2) => spec.topRules[r2][1]);
|
|
8260
9074
|
let nodeProps = [];
|
|
8261
9075
|
for (let i = 0; i < nodeNames.length; i++)
|
|
8262
9076
|
nodeProps.push([]);
|
|
@@ -8436,13 +9250,13 @@ var LRParser = class extends Parser {
|
|
|
8436
9250
|
}
|
|
8437
9251
|
if (config.tokenizers)
|
|
8438
9252
|
copy.tokenizers = this.tokenizers.map((t) => {
|
|
8439
|
-
let found = config.tokenizers.find((
|
|
9253
|
+
let found = config.tokenizers.find((r2) => r2.from == t);
|
|
8440
9254
|
return found ? found.to : t;
|
|
8441
9255
|
});
|
|
8442
9256
|
if (config.specializers) {
|
|
8443
9257
|
copy.specializers = this.specializers.slice();
|
|
8444
9258
|
copy.specializerSpecs = this.specializerSpecs.map((s, i) => {
|
|
8445
|
-
let found = config.specializers.find((
|
|
9259
|
+
let found = config.specializers.find((r2) => r2.from == s.external);
|
|
8446
9260
|
if (!found)
|
|
8447
9261
|
return s;
|
|
8448
9262
|
let spec = Object.assign(Object.assign({}, s), { external: found.to });
|
|
@@ -8552,14 +9366,14 @@ var parser = LRParser.deserialize({
|
|
|
8552
9366
|
});
|
|
8553
9367
|
|
|
8554
9368
|
// ../vuu-filter-parser/src/FilterTreeWalker.ts
|
|
8555
|
-
var
|
|
9369
|
+
var import_vuu_utils31 = require("@vuu-ui/vuu-utils");
|
|
8556
9370
|
var _filter;
|
|
8557
9371
|
var FilterExpression = class {
|
|
8558
9372
|
constructor() {
|
|
8559
9373
|
__privateAdd(this, _filter, void 0);
|
|
8560
9374
|
}
|
|
8561
9375
|
setFilterCombinatorOp(op, filter = __privateGet(this, _filter)) {
|
|
8562
|
-
if ((0,
|
|
9376
|
+
if ((0, import_vuu_utils31.isMultiClauseFilter)(filter) && filter.op === op) {
|
|
8563
9377
|
return;
|
|
8564
9378
|
} else {
|
|
8565
9379
|
__privateSet(this, _filter, {
|
|
@@ -8571,14 +9385,14 @@ var FilterExpression = class {
|
|
|
8571
9385
|
add(filter) {
|
|
8572
9386
|
if (__privateGet(this, _filter) === void 0) {
|
|
8573
9387
|
__privateSet(this, _filter, filter);
|
|
8574
|
-
} else if ((0,
|
|
9388
|
+
} else if ((0, import_vuu_utils31.isMultiClauseFilter)(__privateGet(this, _filter))) {
|
|
8575
9389
|
__privateGet(this, _filter).filters.push(filter);
|
|
8576
9390
|
} else {
|
|
8577
9391
|
throw Error(`Invalid filter passed to FilterExpression`);
|
|
8578
9392
|
}
|
|
8579
9393
|
}
|
|
8580
9394
|
setColumn(column, filter = __privateGet(this, _filter)) {
|
|
8581
|
-
if ((0,
|
|
9395
|
+
if ((0, import_vuu_utils31.isMultiClauseFilter)(filter)) {
|
|
8582
9396
|
const target = filter.filters.at(-1);
|
|
8583
9397
|
if (target) {
|
|
8584
9398
|
this.setColumn(column, target);
|
|
@@ -8588,7 +9402,7 @@ var FilterExpression = class {
|
|
|
8588
9402
|
}
|
|
8589
9403
|
}
|
|
8590
9404
|
setOp(value, filter = __privateGet(this, _filter)) {
|
|
8591
|
-
if ((0,
|
|
9405
|
+
if ((0, import_vuu_utils31.isMultiClauseFilter)(filter)) {
|
|
8592
9406
|
const target = filter.filters.at(-1);
|
|
8593
9407
|
if (target) {
|
|
8594
9408
|
this.setOp(value, target);
|
|
@@ -8598,16 +9412,16 @@ var FilterExpression = class {
|
|
|
8598
9412
|
}
|
|
8599
9413
|
}
|
|
8600
9414
|
setValue(value, filter = __privateGet(this, _filter)) {
|
|
8601
|
-
var
|
|
8602
|
-
if ((0,
|
|
9415
|
+
var _a2;
|
|
9416
|
+
if ((0, import_vuu_utils31.isMultiClauseFilter)(filter)) {
|
|
8603
9417
|
const target = filter.filters.at(-1);
|
|
8604
9418
|
if (target) {
|
|
8605
9419
|
this.setValue(value, target);
|
|
8606
9420
|
}
|
|
8607
|
-
} else if ((0,
|
|
8608
|
-
(
|
|
9421
|
+
} else if ((0, import_vuu_utils31.isMultiValueFilter)(filter)) {
|
|
9422
|
+
(_a2 = filter.values) != null ? _a2 : filter.values = [];
|
|
8609
9423
|
filter.values.push(value);
|
|
8610
|
-
} else if ((0,
|
|
9424
|
+
} else if ((0, import_vuu_utils31.isSingleValueFilter)(filter)) {
|
|
8611
9425
|
filter.value = value;
|
|
8612
9426
|
}
|
|
8613
9427
|
}
|
|
@@ -8670,8 +9484,8 @@ var walkTree = (tree, source) => {
|
|
|
8670
9484
|
var strictParser = parser.configure({ strict: true });
|
|
8671
9485
|
|
|
8672
9486
|
// src/filter-input/useCodeMirrorEditor.ts
|
|
8673
|
-
var
|
|
8674
|
-
var
|
|
9487
|
+
var import_classnames31 = __toESM(require_classnames(), 1);
|
|
9488
|
+
var import_react83 = require("react");
|
|
8675
9489
|
|
|
8676
9490
|
// src/filter-input/FilterLanguage.ts
|
|
8677
9491
|
var import_vuu_codemirror = require("@vuu-ui/vuu-codemirror");
|
|
@@ -8776,7 +9590,7 @@ var vuuTheme = import_vuu_codemirror3.EditorView.theme(
|
|
|
8776
9590
|
|
|
8777
9591
|
// src/filter-input/useFilterAutoComplete.ts
|
|
8778
9592
|
var import_vuu_codemirror4 = require("@vuu-ui/vuu-codemirror");
|
|
8779
|
-
var
|
|
9593
|
+
var import_react82 = require("react");
|
|
8780
9594
|
var getOperator = (node, state) => {
|
|
8781
9595
|
let maybeColumnNode = node.prevSibling || node.parent;
|
|
8782
9596
|
while (maybeColumnNode && !["Column", "Operator", "In"].includes(maybeColumnNode.name)) {
|
|
@@ -8846,7 +9660,7 @@ var getSetValues = (node, state) => {
|
|
|
8846
9660
|
return values;
|
|
8847
9661
|
};
|
|
8848
9662
|
var useAutoComplete = (suggestionProvider, onSubmit, existingFilter) => {
|
|
8849
|
-
const makeSuggestions = (0,
|
|
9663
|
+
const makeSuggestions = (0, import_react82.useCallback)(
|
|
8850
9664
|
async (context, suggestionType, optionalArgs = {}) => {
|
|
8851
9665
|
const { startsWith = "" } = optionalArgs;
|
|
8852
9666
|
const options = await suggestionProvider.getSuggestions(
|
|
@@ -8857,11 +9671,11 @@ var useAutoComplete = (suggestionProvider, onSubmit, existingFilter) => {
|
|
|
8857
9671
|
},
|
|
8858
9672
|
[suggestionProvider]
|
|
8859
9673
|
);
|
|
8860
|
-
return (0,
|
|
9674
|
+
return (0, import_react82.useCallback)(
|
|
8861
9675
|
async (context) => {
|
|
8862
|
-
var
|
|
9676
|
+
var _a2, _b;
|
|
8863
9677
|
const { state, pos } = context;
|
|
8864
|
-
const word = (
|
|
9678
|
+
const word = (_a2 = context.matchBefore(/\w*/)) != null ? _a2 : {
|
|
8865
9679
|
from: 0,
|
|
8866
9680
|
to: 0,
|
|
8867
9681
|
text: void 0
|
|
@@ -9023,7 +9837,7 @@ var getView = (ref) => {
|
|
|
9023
9837
|
return ref.current;
|
|
9024
9838
|
};
|
|
9025
9839
|
var getOptionClass = (completion) => {
|
|
9026
|
-
return (0,
|
|
9840
|
+
return (0, import_classnames31.default)("vuuSuggestion", {
|
|
9027
9841
|
vuuIllustration: completion.isIllustration
|
|
9028
9842
|
});
|
|
9029
9843
|
};
|
|
@@ -9041,15 +9855,15 @@ var useCodeMirrorEditor = ({
|
|
|
9041
9855
|
onSubmitFilter,
|
|
9042
9856
|
suggestionProvider
|
|
9043
9857
|
}) => {
|
|
9044
|
-
const editorRef = (0,
|
|
9045
|
-
const onSubmit = (0,
|
|
9046
|
-
const viewRef = (0,
|
|
9858
|
+
const editorRef = (0, import_react83.useRef)(null);
|
|
9859
|
+
const onSubmit = (0, import_react83.useRef)(noop);
|
|
9860
|
+
const viewRef = (0, import_react83.useRef)();
|
|
9047
9861
|
const completionFn = useAutoComplete(
|
|
9048
9862
|
suggestionProvider,
|
|
9049
9863
|
onSubmit,
|
|
9050
9864
|
existingFilter
|
|
9051
9865
|
);
|
|
9052
|
-
const [createState, clearInput] = (0,
|
|
9866
|
+
const [createState, clearInput] = (0, import_react83.useMemo)(() => {
|
|
9053
9867
|
const parseFilter2 = () => {
|
|
9054
9868
|
const view = getView(viewRef);
|
|
9055
9869
|
const source = view.state.doc.toString();
|
|
@@ -9124,7 +9938,7 @@ var useCodeMirrorEditor = ({
|
|
|
9124
9938
|
};
|
|
9125
9939
|
return [createState2, clearInput2];
|
|
9126
9940
|
}, [completionFn, onSubmitFilter]);
|
|
9127
|
-
(0,
|
|
9941
|
+
(0, import_react83.useEffect)(() => {
|
|
9128
9942
|
if (!editorRef.current) {
|
|
9129
9943
|
throw Error("editor not in dom");
|
|
9130
9944
|
}
|
|
@@ -9133,16 +9947,16 @@ var useCodeMirrorEditor = ({
|
|
|
9133
9947
|
parent: editorRef.current
|
|
9134
9948
|
});
|
|
9135
9949
|
return () => {
|
|
9136
|
-
var
|
|
9137
|
-
(
|
|
9950
|
+
var _a2;
|
|
9951
|
+
(_a2 = viewRef.current) == null ? void 0 : _a2.destroy();
|
|
9138
9952
|
};
|
|
9139
9953
|
}, [completionFn, createState]);
|
|
9140
9954
|
return { editorRef, clearInput };
|
|
9141
9955
|
};
|
|
9142
9956
|
|
|
9143
9957
|
// src/filter-input/FilterInput.tsx
|
|
9144
|
-
var
|
|
9145
|
-
var
|
|
9958
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
9959
|
+
var classBase19 = "vuuFilterInput";
|
|
9146
9960
|
var FilterInput = ({
|
|
9147
9961
|
existingFilter,
|
|
9148
9962
|
iconName = "filter",
|
|
@@ -9156,20 +9970,20 @@ var FilterInput = ({
|
|
|
9156
9970
|
onSubmitFilter,
|
|
9157
9971
|
suggestionProvider
|
|
9158
9972
|
});
|
|
9159
|
-
return /* @__PURE__ */ (0,
|
|
9160
|
-
/* @__PURE__ */ (0,
|
|
9161
|
-
|
|
9973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { ...props, className: classBase19, children: [
|
|
9974
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9975
|
+
import_core20.Button,
|
|
9162
9976
|
{
|
|
9163
|
-
className: `${
|
|
9977
|
+
className: `${classBase19}-FilterButton`,
|
|
9164
9978
|
"data-icon": iconName,
|
|
9165
9979
|
tabIndex: -1
|
|
9166
9980
|
}
|
|
9167
9981
|
),
|
|
9168
|
-
/* @__PURE__ */ (0,
|
|
9169
|
-
/* @__PURE__ */ (0,
|
|
9170
|
-
|
|
9982
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: `${classBase19}-Editor`, ref: editorRef }),
|
|
9983
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9984
|
+
import_core20.Button,
|
|
9171
9985
|
{
|
|
9172
|
-
className: `${
|
|
9986
|
+
className: `${classBase19}-ClearButton`,
|
|
9173
9987
|
"data-icon": "close-circle",
|
|
9174
9988
|
onClick: clearInput
|
|
9175
9989
|
}
|
|
@@ -9180,16 +9994,16 @@ var FilterInput = ({
|
|
|
9180
9994
|
// src/filter-input/useFilterSuggestionProvider.ts
|
|
9181
9995
|
var import_vuu_codemirror6 = require("@vuu-ui/vuu-codemirror");
|
|
9182
9996
|
var import_vuu_data_react2 = require("@vuu-ui/vuu-data-react");
|
|
9183
|
-
var
|
|
9997
|
+
var import_react84 = require("react");
|
|
9184
9998
|
|
|
9185
9999
|
// src/filter-input/filterInfo.ts
|
|
9186
|
-
var
|
|
10000
|
+
var import_vuu_utils32 = require("@vuu-ui/vuu-utils");
|
|
9187
10001
|
var filterInfo = (filterName, filterQuery) => {
|
|
9188
|
-
const rootElement = (0,
|
|
9189
|
-
const headingElement = (0,
|
|
9190
|
-
const nameElement = (0,
|
|
10002
|
+
const rootElement = (0, import_vuu_utils32.createEl)("div", "vuuFunctionDoc");
|
|
10003
|
+
const headingElement = (0, import_vuu_utils32.createEl)("div", "function-heading");
|
|
10004
|
+
const nameElement = (0, import_vuu_utils32.createEl)("span", "function-name", filterName);
|
|
9191
10005
|
headingElement.appendChild(nameElement);
|
|
9192
|
-
const child2 = (0,
|
|
10006
|
+
const child2 = (0, import_vuu_utils32.createEl)("p", void 0, filterQuery);
|
|
9193
10007
|
rootElement.appendChild(headingElement);
|
|
9194
10008
|
rootElement.appendChild(child2);
|
|
9195
10009
|
return rootElement;
|
|
@@ -9276,9 +10090,9 @@ var useFilterSuggestionProvider = ({
|
|
|
9276
10090
|
table,
|
|
9277
10091
|
typeaheadHook: useTypeahead = import_vuu_data_react2.useTypeaheadSuggestions
|
|
9278
10092
|
}) => {
|
|
9279
|
-
const latestSuggestionsRef = (0,
|
|
10093
|
+
const latestSuggestionsRef = (0, import_react84.useRef)();
|
|
9280
10094
|
const getTypeaheadSuggestions = useTypeahead();
|
|
9281
|
-
const getSuggestions = (0,
|
|
10095
|
+
const getSuggestions = (0, import_react84.useCallback)(
|
|
9282
10096
|
async (suggestionType, options = NONE) => {
|
|
9283
10097
|
const {
|
|
9284
10098
|
columnName,
|
|
@@ -9368,7 +10182,7 @@ var useFilterSuggestionProvider = ({
|
|
|
9368
10182
|
},
|
|
9369
10183
|
[columns, getTypeaheadSuggestions, namedFilters, saveOptions, table]
|
|
9370
10184
|
);
|
|
9371
|
-
const isPartialMatch = (0,
|
|
10185
|
+
const isPartialMatch = (0, import_react84.useCallback)(
|
|
9372
10186
|
async (valueType, columnName, pattern) => {
|
|
9373
10187
|
const suggestions = (
|
|
9374
10188
|
// latestSuggestions && latestSuggestions.length > 0
|