@hitachivantara/uikit-react-lab 5.16.5 → 5.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/components/Dashboard/Dashboard.cjs +68 -0
  2. package/dist/cjs/components/Dashboard/Dashboard.cjs.map +1 -0
  3. package/dist/cjs/components/Dashboard/Dashboard.styles.cjs +15 -0
  4. package/dist/cjs/components/Dashboard/Dashboard.styles.cjs.map +1 -0
  5. package/dist/cjs/components/Flow/Node/BaseNode.cjs +29 -22
  6. package/dist/cjs/components/Flow/Node/BaseNode.cjs.map +1 -1
  7. package/dist/cjs/components/Flow/Node/Node.cjs +1 -3
  8. package/dist/cjs/components/Flow/Node/Node.cjs.map +1 -1
  9. package/dist/cjs/components/Flow/Node/Parameters/Select.cjs +2 -2
  10. package/dist/cjs/components/Flow/Node/Parameters/Select.cjs.map +1 -1
  11. package/dist/cjs/components/Flow/hooks/useFlowNode.cjs +26 -18
  12. package/dist/cjs/components/Flow/hooks/useFlowNode.cjs.map +1 -1
  13. package/dist/cjs/components/Flow/hooks/useFlowNodeMeta.cjs +11 -0
  14. package/dist/cjs/components/Flow/hooks/useFlowNodeMeta.cjs.map +1 -0
  15. package/dist/cjs/index.cjs +36 -26
  16. package/dist/cjs/index.cjs.map +1 -1
  17. package/dist/esm/components/Dashboard/Dashboard.js +69 -0
  18. package/dist/esm/components/Dashboard/Dashboard.js.map +1 -0
  19. package/dist/esm/components/Dashboard/Dashboard.styles.js +15 -0
  20. package/dist/esm/components/Dashboard/Dashboard.styles.js.map +1 -0
  21. package/dist/esm/components/Flow/Node/BaseNode.js +30 -23
  22. package/dist/esm/components/Flow/Node/BaseNode.js.map +1 -1
  23. package/dist/esm/components/Flow/Node/Node.js +1 -3
  24. package/dist/esm/components/Flow/Node/Node.js.map +1 -1
  25. package/dist/esm/components/Flow/Node/Parameters/Select.js +2 -2
  26. package/dist/esm/components/Flow/Node/Parameters/Select.js.map +1 -1
  27. package/dist/esm/components/Flow/hooks/useFlowNode.js +28 -20
  28. package/dist/esm/components/Flow/hooks/useFlowNode.js.map +1 -1
  29. package/dist/esm/components/Flow/hooks/useFlowNodeMeta.js +11 -0
  30. package/dist/esm/components/Flow/hooks/useFlowNodeMeta.js.map +1 -0
  31. package/dist/esm/index.js +40 -30
  32. package/dist/esm/index.js.map +1 -1
  33. package/dist/types/index.d.ts +132 -77
  34. package/package.json +6 -5
@@ -0,0 +1,69 @@
1
+ import { jsxs, Fragment, jsx } from "@emotion/react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { Global } from "@emotion/react";
4
+ import { WidthProvider, Responsive } from "react-grid-layout";
5
+ import { useDefaultProps, useTheme } from "@hitachivantara/uikit-react-core";
6
+ import { useClasses, gridStyles } from "./Dashboard.styles.js";
7
+ import { staticClasses } from "./Dashboard.styles.js";
8
+ const GridLayout = WidthProvider(Responsive);
9
+ const defaultCols = {
10
+ xs: 12,
11
+ sm: 12,
12
+ md: 12,
13
+ lg: 12,
14
+ xl: 12
15
+ };
16
+ const HvDashboard = (props) => {
17
+ const {
18
+ children,
19
+ className,
20
+ layout,
21
+ cols: colsProp,
22
+ layouts: layoutsProp,
23
+ classes: classesProp,
24
+ ...others
25
+ } = useDefaultProps("HvDashboard", props);
26
+ const {
27
+ classes,
28
+ cx
29
+ } = useClasses(classesProp);
30
+ const {
31
+ activeTheme
32
+ } = useTheme();
33
+ const layouts = useMemo(() => {
34
+ if (layoutsProp)
35
+ return layoutsProp;
36
+ if (!layout)
37
+ return {};
38
+ return {
39
+ xs: layout,
40
+ sm: layout,
41
+ md: layout,
42
+ lg: layout,
43
+ xl: layout
44
+ };
45
+ }, [layoutsProp, layout]);
46
+ const cols = useMemo(() => {
47
+ if (!colsProp)
48
+ return defaultCols;
49
+ if (typeof colsProp === "number") {
50
+ return {
51
+ xs: colsProp,
52
+ sm: colsProp,
53
+ md: colsProp,
54
+ lg: colsProp,
55
+ xl: colsProp
56
+ };
57
+ }
58
+ return colsProp;
59
+ }, [colsProp]);
60
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
61
+ /* @__PURE__ */ jsx(Global, { styles: gridStyles }),
62
+ /* @__PURE__ */ jsx(GridLayout, { className: cx(classes.root, className), breakpoints: activeTheme?.breakpoints.values, cols, layouts, ...others, children })
63
+ ] });
64
+ };
65
+ export {
66
+ HvDashboard,
67
+ staticClasses as dashboardClasses
68
+ };
69
+ //# sourceMappingURL=Dashboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dashboard.js","sources":["../../../../src/components/Dashboard/Dashboard.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { Global } from \"@emotion/react\";\nimport {\n Responsive as ResponsiveGrid,\n ResponsiveProps,\n ReactGridLayoutProps,\n Layouts,\n WidthProvider,\n} from \"react-grid-layout\";\nimport {\n ExtractNames,\n useDefaultProps,\n useTheme,\n} from \"@hitachivantara/uikit-react-core\";\n\nimport { gridStyles, staticClasses, useClasses } from \"./Dashboard.styles\";\n\nconst GridLayout = WidthProvider(ResponsiveGrid);\n\n/** Default column breakpoints. For now, use always 12-column */\nconst defaultCols: HvDashboardProps[\"cols\"] = {\n xs: 12,\n sm: 12,\n md: 12,\n lg: 12,\n xl: 12,\n};\n\nexport { staticClasses as dashboardClasses };\n\nexport type HvDashboardClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDashboardProps extends Omit<ResponsiveProps, \"cols\"> {\n /** Dashboard items. Each node must be `key`'ed */\n children: React.ReactNode;\n /** An object used to override or extend the styles applied. */\n classes?: HvDashboardClasses;\n /**\n * Layout is an array of object with the format:\n *\n * `{i: string, x: number, y: number, w: number, h: number}`\n *\n * The `i` must match the key used on each item component.\n */\n layout?: ReactGridLayoutProps[\"layout\"];\n /** Number of grid columns or an object of breakpoint -> #columns */\n cols?: number | ResponsiveProps[\"cols\"];\n}\n\n/**\n * A Dashboard grid layout component, based on `react-grid-layout`.\n * The children elements are grid items and must be `key`ed.\n *\n * @see https://github.com/react-grid-layout/react-grid-layout?tab=readme-ov-file#grid-layout-props\n *\n * DISCLAIMER: This component is a work in progress and there might be breaking changes.\n */\nexport const HvDashboard = (props: HvDashboardProps) => {\n const {\n children,\n className,\n layout,\n cols: colsProp,\n layouts: layoutsProp,\n classes: classesProp,\n ...others\n } = useDefaultProps(\"HvDashboard\", props);\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const layouts = useMemo<Layouts>(() => {\n if (layoutsProp) return layoutsProp;\n if (!layout) return {};\n\n return { xs: layout, sm: layout, md: layout, lg: layout, xl: layout };\n }, [layoutsProp, layout]);\n\n const cols = useMemo<ResponsiveProps[\"cols\"]>(() => {\n if (!colsProp) return defaultCols;\n\n if (typeof colsProp === \"number\") {\n return {\n xs: colsProp,\n sm: colsProp,\n md: colsProp,\n lg: colsProp,\n xl: colsProp,\n };\n }\n\n return colsProp;\n }, [colsProp]);\n\n return (\n <>\n <Global styles={gridStyles} />\n <GridLayout\n className={cx(classes.root, className)}\n breakpoints={activeTheme?.breakpoints.values}\n cols={cols}\n layouts={layouts}\n {...others}\n >\n {children}\n </GridLayout>\n </>\n );\n};\n"],"names":["GridLayout","WidthProvider","ResponsiveGrid","defaultCols","xs","sm","md","lg","xl","HvDashboard","props","children","className","layout","cols","colsProp","layouts","layoutsProp","classes","classesProp","others","useDefaultProps","cx","useClasses","activeTheme","useTheme","useMemo","gridStyles","root","breakpoints","values"],"mappings":";;;;;;;AAiBA,MAAMA,aAAaC,cAAcC,UAAc;AAG/C,MAAMC,cAAwC;AAAA,EAC5CC,IAAI;AAAA,EACJC,IAAI;AAAA,EACJC,IAAI;AAAA,EACJC,IAAI;AAAA,EACJC,IAAI;AACN;AA+BaC,MAAAA,cAAcA,CAACC,UAA4B;AAChD,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,MAAMC;AAAAA,IACNC,SAASC;AAAAA,IACTC,SAASC;AAAAA,IACT,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,eAAeX,KAAK;AAClC,QAAA;AAAA,IAAEQ;AAAAA,IAASI;AAAAA,EAAAA,IAAOC,WAAWJ,WAAW;AACxC,QAAA;AAAA,IAAEK;AAAAA,MAAgBC,SAAS;AAE3BT,QAAAA,UAAUU,QAAiB,MAAM;AACjCT,QAAAA;AAAoBA,aAAAA;AACxB,QAAI,CAACJ;AAAQ,aAAO;AAEb,WAAA;AAAA,MAAET,IAAIS;AAAAA,MAAQR,IAAIQ;AAAAA,MAAQP,IAAIO;AAAAA,MAAQN,IAAIM;AAAAA,MAAQL,IAAIK;AAAAA,IAAAA;AAAAA,EAAO,GACnE,CAACI,aAAaJ,MAAM,CAAC;AAElBC,QAAAA,OAAOY,QAAiC,MAAM;AAClD,QAAI,CAACX;AAAiBZ,aAAAA;AAElB,QAAA,OAAOY,aAAa,UAAU;AACzB,aAAA;AAAA,QACLX,IAAIW;AAAAA,QACJV,IAAIU;AAAAA,QACJT,IAAIS;AAAAA,QACJR,IAAIQ;AAAAA,QACJP,IAAIO;AAAAA,MAAAA;AAAAA,IAER;AAEOA,WAAAA;AAAAA,EAAAA,GACN,CAACA,QAAQ,CAAC;AAEb,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAC,oBAAA,QAAA,EAAO,QAAQY,WAAW,CAAA;AAAA,wBAC1B,YACC,EAAA,WAAWL,GAAGJ,QAAQU,MAAMhB,SAAS,GACrC,aAAaY,aAAaK,YAAYC,QACtC,MACA,SACA,GAAIV,QAEHT,UACH;AAAA,EACF,EAAA,CAAA;AAEJ;"}
@@ -0,0 +1,15 @@
1
+ import { css } from "@emotion/react";
2
+ import { createClasses, theme } from "@hitachivantara/uikit-react-core";
3
+ const {
4
+ staticClasses,
5
+ useClasses
6
+ } = createClasses("HvDashboard", {
7
+ root: {}
8
+ });
9
+ const gridStyles = /* @__PURE__ */ css(".react-grid-layout{position:relative;transition:height 200ms ease;}.react-grid-item{transition:all 200ms ease;transition-property:left,top,width,height;}.react-grid-item img{pointer-events:none;user-select:none;}.react-grid-item.cssTransforms{transition-property:transform,width,height;}.react-grid-item.resizing{transition:none;z-index:1;will-change:width,height;}.react-grid-item.react-draggable-dragging{transition:none;z-index:3;will-change:transform;}.react-grid-item.dropping{visibility:hidden;}.react-grid-item.react-grid-placeholder{background:", theme.colors.primary_20, ';transition-duration:100ms;z-index:2;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;}.react-grid-item.react-grid-placeholder.placeholder-resizing{transition:none;}.react-grid-item>.react-resizable-handle{position:absolute;width:20px;height:20px;}.react-grid-item>.react-resizable-handle::after{content:"";position:absolute;right:3px;bottom:3px;width:5px;height:5px;border-right:2px solid rgba(0, 0, 0, 0.4);border-bottom:2px solid rgba(0, 0, 0, 0.4);}.react-resizable-hide>.react-resizable-handle{display:none;}.react-grid-item>.react-resizable-handle.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg);}.react-grid-item>.react-resizable-handle.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize;}.react-grid-item>.react-resizable-handle.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg);}.react-grid-item>.react-resizable-handle.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg);}.react-grid-item>.react-resizable-handle.react-resizable-handle-w,.react-grid-item>.react-resizable-handle.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize;}.react-grid-item>.react-resizable-handle.react-resizable-handle-w{left:0;transform:rotate(135deg);}.react-grid-item>.react-resizable-handle.react-resizable-handle-e{right:0;transform:rotate(315deg);}.react-grid-item>.react-resizable-handle.react-resizable-handle-n,.react-grid-item>.react-resizable-handle.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize;}.react-grid-item>.react-resizable-handle.react-resizable-handle-n{top:0;transform:rotate(225deg);}.react-grid-item>.react-resizable-handle.react-resizable-handle-s{bottom:0;transform:rotate(45deg);}.react-resizable{position:relative;}.react-resizable-handle{position:absolute;width:20px;height:20px;background-repeat:no-repeat;background-origin:content-box;box-sizing:border-box;background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+");background-position:bottom right;padding:0 3px 3px 0;}.react-resizable-handle-sw{bottom:0;left:0;cursor:sw-resize;transform:rotate(90deg);}.react-resizable-handle-se{bottom:0;right:0;cursor:se-resize;}.react-resizable-handle-nw{top:0;left:0;cursor:nw-resize;transform:rotate(180deg);}.react-resizable-handle-ne{top:0;right:0;cursor:ne-resize;transform:rotate(270deg);}.react-resizable-handle-w,.react-resizable-handle-e{top:50%;margin-top:-10px;cursor:ew-resize;}.react-resizable-handle-w{left:0;transform:rotate(135deg);}.react-resizable-handle-e{right:0;transform:rotate(315deg);}.react-resizable-handle-n,.react-resizable-handle-s{left:50%;margin-left:-10px;cursor:ns-resize;}.react-resizable-handle-n{top:0;transform:rotate(225deg);}.react-resizable-handle-s{bottom:0;transform:rotate(45deg);}' + (process.env.NODE_ENV === "production" ? "" : ";label:gridStyles;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2h2LXVpa2l0LXJlYWN0L2h2LXVpa2l0LXJlYWN0L3BhY2thZ2VzL2xhYi9zcmMvY29tcG9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biAgLnJlYWN0LXJlc2l6YWJsZS1oYW5kbGUtdyB7XG4gICAgbGVmdDogMDtcbiAgICB0cmFuc2Zvcm06IHJvdGF0ZSgxMzVkZWcpO1xuICB9XG4gIC5yZWFjdC1yZXNpemFibGUtaGFuZGxlLWUge1xuICAgIHJpZ2h0OiAwO1xuICAgIHRyYW5zZm9ybTogcm90YXRlKDMxNWRlZyk7XG4gIH1cbiAgLnJlYWN0LXJlc2l6YWJsZS1oYW5kbGUtbixcbiAgLnJlYWN0LXJlc2l6YWJsZS1oYW5kbGUtcyB7XG4gICAgbGVmdDogNTAlO1xuICAgIG1hcmdpbi1sZWZ0OiAtMTBweDtcbiAgICBjdXJzb3I6IG5zLXJlc2l6ZTtcbiAgfVxuICAucmVhY3QtcmVzaXphYmxlLWhhbmRsZS1uIHtcbiAgICB0b3A6IDA7XG4gICAgdHJhbnNmb3JtOiByb3RhdGUoMjI1ZGVnKTtcbiAgfVxuICAucmVhY3QtcmVzaXphYmxlLWhhbmRsZS1zIHtcbiAgICBib3R0b206IDA7XG4gICAgdHJhbnNmb3JtOiByb3RhdGUoNDVkZWcpO1xuICB9XG5gO1xuIl19 */");
10
+ export {
11
+ gridStyles,
12
+ staticClasses,
13
+ useClasses
14
+ };
15
+ //# sourceMappingURL=Dashboard.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dashboard.styles.js","sources":["../../../../src/components/Dashboard/Dashboard.styles.ts"],"sourcesContent":["import { css } from \"@emotion/react\";\nimport { createClasses, theme } from \"@hitachivantara/uikit-react-core\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvDashboard\", {\n root: {},\n});\n\nexport const gridStyles = css`\n .react-grid-layout {\n position: relative;\n transition: height 200ms ease;\n }\n .react-grid-item {\n transition: all 200ms ease;\n transition-property: left, top, width, height;\n }\n .react-grid-item img {\n pointer-events: none;\n user-select: none;\n }\n .react-grid-item.cssTransforms {\n transition-property: transform, width, height;\n }\n .react-grid-item.resizing {\n transition: none;\n z-index: 1;\n will-change: width, height;\n }\n\n .react-grid-item.react-draggable-dragging {\n transition: none;\n z-index: 3;\n will-change: transform;\n }\n\n .react-grid-item.dropping {\n visibility: hidden;\n }\n\n .react-grid-item.react-grid-placeholder {\n background: ${theme.colors.primary_20};\n transition-duration: 100ms;\n z-index: 2;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n }\n\n .react-grid-item.react-grid-placeholder.placeholder-resizing {\n transition: none;\n }\n\n .react-grid-item > .react-resizable-handle {\n position: absolute;\n width: 20px;\n height: 20px;\n }\n\n .react-grid-item > .react-resizable-handle::after {\n content: \"\";\n position: absolute;\n right: 3px;\n bottom: 3px;\n width: 5px;\n height: 5px;\n border-right: 2px solid rgba(0, 0, 0, 0.4);\n border-bottom: 2px solid rgba(0, 0, 0, 0.4);\n }\n\n .react-resizable-hide > .react-resizable-handle {\n display: none;\n }\n\n .react-grid-item > .react-resizable-handle.react-resizable-handle-sw {\n bottom: 0;\n left: 0;\n cursor: sw-resize;\n transform: rotate(90deg);\n }\n .react-grid-item > .react-resizable-handle.react-resizable-handle-se {\n bottom: 0;\n right: 0;\n cursor: se-resize;\n }\n .react-grid-item > .react-resizable-handle.react-resizable-handle-nw {\n top: 0;\n left: 0;\n cursor: nw-resize;\n transform: rotate(180deg);\n }\n .react-grid-item > .react-resizable-handle.react-resizable-handle-ne {\n top: 0;\n right: 0;\n cursor: ne-resize;\n transform: rotate(270deg);\n }\n .react-grid-item > .react-resizable-handle.react-resizable-handle-w,\n .react-grid-item > .react-resizable-handle.react-resizable-handle-e {\n top: 50%;\n margin-top: -10px;\n cursor: ew-resize;\n }\n .react-grid-item > .react-resizable-handle.react-resizable-handle-w {\n left: 0;\n transform: rotate(135deg);\n }\n .react-grid-item > .react-resizable-handle.react-resizable-handle-e {\n right: 0;\n transform: rotate(315deg);\n }\n .react-grid-item > .react-resizable-handle.react-resizable-handle-n,\n .react-grid-item > .react-resizable-handle.react-resizable-handle-s {\n left: 50%;\n margin-left: -10px;\n cursor: ns-resize;\n }\n .react-grid-item > .react-resizable-handle.react-resizable-handle-n {\n top: 0;\n transform: rotate(225deg);\n }\n .react-grid-item > .react-resizable-handle.react-resizable-handle-s {\n bottom: 0;\n transform: rotate(45deg);\n }\n\n .react-resizable {\n position: relative;\n }\n .react-resizable-handle {\n position: absolute;\n width: 20px;\n height: 20px;\n background-repeat: no-repeat;\n background-origin: content-box;\n box-sizing: border-box;\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+\");\n background-position: bottom right;\n padding: 0 3px 3px 0;\n }\n .react-resizable-handle-sw {\n bottom: 0;\n left: 0;\n cursor: sw-resize;\n transform: rotate(90deg);\n }\n .react-resizable-handle-se {\n bottom: 0;\n right: 0;\n cursor: se-resize;\n }\n .react-resizable-handle-nw {\n top: 0;\n left: 0;\n cursor: nw-resize;\n transform: rotate(180deg);\n }\n .react-resizable-handle-ne {\n top: 0;\n right: 0;\n cursor: ne-resize;\n transform: rotate(270deg);\n }\n .react-resizable-handle-w,\n .react-resizable-handle-e {\n top: 50%;\n margin-top: -10px;\n cursor: ew-resize;\n }\n .react-resizable-handle-w {\n left: 0;\n transform: rotate(135deg);\n }\n .react-resizable-handle-e {\n right: 0;\n transform: rotate(315deg);\n }\n .react-resizable-handle-n,\n .react-resizable-handle-s {\n left: 50%;\n margin-left: -10px;\n cursor: ns-resize;\n }\n .react-resizable-handle-n {\n top: 0;\n transform: rotate(225deg);\n }\n .react-resizable-handle-s {\n bottom: 0;\n transform: rotate(45deg);\n }\n`;\n"],"names":["staticClasses","useClasses","createClasses","root","gridStyles","theme","colors","primary_20","process","env","NODE_ENV"],"mappings":";;AAGa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,eAAe;AAAA,EACxEC,MAAM,CAAC;AACT,CAAC;AAEM,MAAMC,6kBAiCKC,MAAMC,OAAOC,YAAU,+lGAAAC,QAAAC,IAAAC,aAAA,eAAA,KAAA,uBAAAF,QAAAC,IAAAC,aAwJxC,eAAA,KAAA,6lOAAA;"}
@@ -1,19 +1,20 @@
1
1
  import { jsxs, jsx, Fragment } from "@emotion/react/jsx-runtime";
2
2
  import { useEffect, useState, useCallback, isValidElement } from "react";
3
- import { useReactFlow, useEdges, useNodes, NodeToolbar, Handle, Position } from "reactflow";
3
+ import { useReactFlow, NodeToolbar, Handle, Position } from "reactflow";
4
4
  import { uid } from "uid";
5
5
  import { HvButton, HvTypography } from "@hitachivantara/uikit-react-core";
6
6
  import { Delete, Duplicate } from "@hitachivantara/uikit-react-icons";
7
7
  import { theme, getColor } from "@hitachivantara/uikit-styles";
8
+ import { useFlowNode, useFlowNodeInputEdges, useFlowNodeOutputEdges } from "../hooks/useFlowNode.js";
8
9
  import { useNodeMetaRegistry } from "../FlowContext/NodeMetaContext.js";
9
10
  import { useClasses } from "./BaseNode.styles.js";
10
11
  import { staticClasses } from "./BaseNode.styles.js";
11
- const isInputConnected = (id, type, idx, edges) => {
12
+ const isInputConnected = (id, type, handleId, edges) => {
12
13
  if (type === "target") {
13
- return edges.some((e) => e.target === id && e.targetHandle === idx.toString());
14
+ return edges.some((e) => e.target === id && e.targetHandle === handleId);
14
15
  }
15
16
  if (type === "source") {
16
- return edges.some((e) => e.source === id && e.sourceHandle === idx.toString());
17
+ return edges.some((e) => e.source === id && e.sourceHandle === handleId);
17
18
  }
18
19
  return false;
19
20
  };
@@ -59,9 +60,9 @@ const HvFlowBaseNode = ({
59
60
  cx,
60
61
  css
61
62
  } = useClasses(classesProp);
62
- const edges = useEdges();
63
- const nodes = useNodes();
64
- const node = nodes.find((n) => n.id === id);
63
+ const node = useFlowNode(id);
64
+ const inputEdges = useFlowNodeInputEdges(id);
65
+ const outputEdges = useFlowNodeOutputEdges(id);
65
66
  const handleDefaultAction = useCallback((action) => {
66
67
  if (!node)
67
68
  return;
@@ -121,25 +122,31 @@ const HvFlowBaseNode = ({
121
122
  children && /* @__PURE__ */ jsx("div", { className: classes.contentContainer, children }),
122
123
  inputs && inputs.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
123
124
  /* @__PURE__ */ jsx("div", { className: classes.inputsTitleContainer, children: /* @__PURE__ */ jsx(HvTypography, { children: "Inputs" }) }),
124
- /* @__PURE__ */ jsx("div", { className: classes.inputsContainer, children: inputs?.map((input, idx) => /* @__PURE__ */ jsxs("div", { className: classes.inputContainer, children: [
125
- /* @__PURE__ */ jsx(Handle, { type: "target", isConnectableStart: false, id: `${idx}`, position: Position.Left, style: {
126
- top: "auto",
127
- bottom: (outputs?.length ? 80 : 18) + (outputs?.length || 0) * 29 + 29 * idx
128
- } }),
129
- /* @__PURE__ */ jsx(HvTypography, { children: input.label }),
130
- input.isMandatory && !isInputConnected(id, "target", idx, edges) && /* @__PURE__ */ jsx("div", { className: classes.mandatory })
131
- ] }, idx)) })
125
+ /* @__PURE__ */ jsx("div", { className: classes.inputsContainer, children: inputs?.map((input, idx) => {
126
+ const handleId = input.id ?? idx.toString();
127
+ return /* @__PURE__ */ jsxs("div", { className: classes.inputContainer, children: [
128
+ /* @__PURE__ */ jsx(Handle, { type: "target", isConnectableStart: false, id: handleId, position: Position.Left, style: {
129
+ top: "auto",
130
+ bottom: (outputs?.length ? 80 : 18) + (outputs?.length || 0) * 29 + 29 * idx
131
+ } }),
132
+ /* @__PURE__ */ jsx(HvTypography, { children: input.label }),
133
+ input.isMandatory && !isInputConnected(id, "target", handleId, inputEdges) && /* @__PURE__ */ jsx("div", { className: classes.mandatory })
134
+ ] }, idx);
135
+ }) })
132
136
  ] }),
133
137
  outputs && outputs.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
134
138
  /* @__PURE__ */ jsx("div", { className: classes.outputsTitleContainer, children: /* @__PURE__ */ jsx(HvTypography, { children: "Outputs" }) }),
135
- /* @__PURE__ */ jsx("div", { className: classes.outputsContainer, children: outputs?.map((output, idx) => /* @__PURE__ */ jsxs("div", { className: classes.outputContainer, children: [
136
- /* @__PURE__ */ jsx(Handle, { type: "source", isConnectableEnd: false, id: `${idx}`, position: Position.Right, style: {
137
- bottom: -10 + 29 * (outputs.length - idx),
138
- top: "auto"
139
- } }),
140
- output.isMandatory && !isInputConnected(id, "source", idx, edges) && /* @__PURE__ */ jsx("div", { className: classes.mandatory }),
141
- /* @__PURE__ */ jsx(HvTypography, { children: output.label })
142
- ] }, idx)) })
139
+ /* @__PURE__ */ jsx("div", { className: classes.outputsContainer, children: outputs?.map((output, idx) => {
140
+ const handleId = output.id ?? idx.toString();
141
+ return /* @__PURE__ */ jsxs("div", { className: classes.outputContainer, children: [
142
+ /* @__PURE__ */ jsx(Handle, { type: "source", isConnectableEnd: false, id: handleId, position: Position.Right, style: {
143
+ bottom: -10 + 29 * (outputs.length - idx),
144
+ top: "auto"
145
+ } }),
146
+ output.isMandatory && !isInputConnected(id, "source", handleId, outputEdges) && /* @__PURE__ */ jsx("div", { className: classes.mandatory }),
147
+ /* @__PURE__ */ jsx(HvTypography, { children: output.label })
148
+ ] }, idx);
149
+ }) })
143
150
  ] })
144
151
  ] });
145
152
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BaseNode.js","sources":["../../../../../src/components/Flow/Node/BaseNode.tsx"],"sourcesContent":["import { isValidElement, useCallback, useEffect, useState } from \"react\";\nimport {\n Edge,\n Handle,\n NodeProps,\n NodeToolbar,\n Position,\n useEdges,\n useNodes,\n useReactFlow,\n} from \"reactflow\";\nimport { uid } from \"uid\";\nimport {\n ExtractNames,\n HvActionGeneric,\n HvBaseProps,\n HvButton,\n HvTypography,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Delete, Duplicate } from \"@hitachivantara/uikit-react-icons\";\nimport { HvColorAny, getColor, theme } from \"@hitachivantara/uikit-styles\";\n\nimport {\n HvFlowNodeAction,\n HvFlowBuiltInActions,\n HvFlowNodeInput,\n HvFlowNodeOutput,\n} from \"../types\";\nimport { useNodeMetaRegistry } from \"../FlowContext/NodeMetaContext\";\nimport { staticClasses, useClasses } from \"./BaseNode.styles\";\n\nexport { staticClasses as flowBaseNodeClasses };\n\nexport type HvFlowBaseNodeClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvFlowBaseNodeProps<T = any>\n extends Omit<HvBaseProps, \"id\">,\n NodeProps<T> {\n /** Header title */\n title?: string;\n /** Header icon */\n icon?: React.ReactNode;\n /** Header color */\n color?: HvColorAny;\n /** Header items */\n headerItems?: React.ReactNode;\n /** Node inputs */\n inputs?: HvFlowNodeInput[];\n /** Node outputs */\n outputs?: HvFlowNodeOutput[];\n /** Node actions */\n nodeActions?: HvFlowNodeAction[];\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvFlowBaseNodeClasses;\n}\n\nconst isInputConnected = (\n id: string,\n type: \"target\" | \"source\",\n idx: number,\n edges: Edge[]\n) => {\n if (type === \"target\") {\n return edges.some(\n (e) => e.target === id && e.targetHandle === idx.toString()\n );\n }\n if (type === \"source\") {\n return edges.some(\n (e) => e.source === id && e.sourceHandle === idx.toString()\n );\n }\n\n return false;\n};\n\nconst defaultActions: HvFlowBuiltInActions[] = [\n { id: \"delete\", label: \"Delete\", icon: <Delete /> },\n { id: \"duplicate\", label: \"Duplicate\", icon: <Duplicate /> },\n];\n\nconst renderedIcon = (actionIcon: HvActionGeneric[\"icon\"]) =>\n isValidElement(actionIcon) ? actionIcon : (actionIcon as Function)?.();\n\nexport const HvFlowBaseNode = ({\n id,\n title,\n headerItems,\n icon,\n color: colorProp,\n inputs,\n outputs,\n nodeActions = defaultActions,\n classes: classesProp,\n className,\n children,\n}: HvFlowBaseNodeProps<unknown>) => {\n const { registerNode, unregisterNode } = useNodeMetaRegistry();\n useEffect(() => {\n registerNode(id, { label: title || \"\", inputs, outputs });\n return () => unregisterNode(id);\n }, [id, title, inputs, outputs, registerNode, unregisterNode]);\n\n const [showActions, setShowActions] = useState(false);\n const reactFlowInstance = useReactFlow();\n\n const { classes, cx, css } = useClasses(classesProp);\n\n const edges = useEdges();\n const nodes = useNodes();\n\n const node = nodes.find((n) => n.id === id);\n\n const handleDefaultAction = useCallback(\n (action: HvFlowNodeAction) => {\n if (!node) return;\n\n if (action.callback) {\n action.callback(node);\n return;\n }\n\n // built-in actions\n switch (action.id) {\n case \"delete\":\n reactFlowInstance.deleteElements({ nodes: [node] });\n break;\n case \"duplicate\":\n reactFlowInstance.addNodes([\n {\n ...node,\n id: uid(),\n position: {\n x: node.position.x,\n y: node.position.y + (node.height || 0) + 20,\n },\n selected: false,\n zIndex: Number(theme.zIndices.overlay),\n },\n ]);\n break;\n default:\n break;\n }\n },\n [node, reactFlowInstance]\n );\n\n if (!node) return null;\n\n const color = getColor(colorProp);\n const iconColor = isValidElement(icon)\n ? getColor(icon.props.color || \"base_dark\")\n : getColor(\"base_dark\");\n\n return (\n <div\n className={cx(\n \"nowheel\", // Disables the default canvas pan behaviour when scrolling inside the node\n css({ border: `1px solid ${color}` }),\n classes.root,\n className\n )}\n onMouseEnter={() => setShowActions(true)}\n onMouseLeave={() => setShowActions(false)}\n >\n <NodeToolbar isVisible={showActions} offset={0}>\n {nodeActions?.map((action) => (\n <HvButton\n key={action.id}\n icon\n onClick={() => handleDefaultAction(action)}\n >\n {renderedIcon(action.icon)}\n </HvButton>\n ))}\n </NodeToolbar>\n <div\n className={cx(css({ backgroundColor: color }), classes.headerContainer)}\n >\n <div\n className={cx(\n classes.titleContainer,\n css({ \"& svg *.color0\": { fill: iconColor } })\n )}\n >\n {icon}\n <HvTypography\n component=\"p\"\n variant=\"title4\"\n className={classes.title}\n >\n {title}\n </HvTypography>\n </div>\n {headerItems && <div style={{ display: \"flex\" }}>{headerItems}</div>}\n </div>\n {children && <div className={classes.contentContainer}>{children}</div>}\n {inputs && inputs.length > 0 && (\n <>\n <div className={classes.inputsTitleContainer}>\n <HvTypography>Inputs</HvTypography>\n </div>\n\n <div className={classes.inputsContainer}>\n {inputs?.map((input, idx) => (\n <div className={classes.inputContainer} key={idx}>\n <Handle\n type=\"target\"\n isConnectableStart={false}\n id={`${idx}`}\n position={Position.Left}\n style={{\n top: \"auto\",\n bottom:\n (outputs?.length ? 80 : 18) +\n (outputs?.length || 0) * 29 +\n 29 * idx,\n }}\n />\n <HvTypography>{input.label}</HvTypography>\n {input.isMandatory &&\n !isInputConnected(id, \"target\", idx, edges) && (\n <div className={classes.mandatory} />\n )}\n </div>\n ))}\n </div>\n </>\n )}\n {outputs && outputs.length > 0 && (\n <>\n <div className={classes.outputsTitleContainer}>\n <HvTypography>Outputs</HvTypography>\n </div>\n <div className={classes.outputsContainer}>\n {outputs?.map((output, idx) => (\n <div className={classes.outputContainer} key={idx}>\n <Handle\n type=\"source\"\n isConnectableEnd={false}\n id={`${idx}`}\n position={Position.Right}\n style={{\n bottom: -10 + 29 * (outputs.length - idx),\n top: \"auto\",\n }}\n />\n {output.isMandatory &&\n !isInputConnected(id, \"source\", idx, edges) && (\n <div className={classes.mandatory} />\n )}\n <HvTypography>{output.label}</HvTypography>\n </div>\n ))}\n </div>\n </>\n )}\n </div>\n );\n};\n"],"names":["isInputConnected","id","type","idx","edges","some","e","target","targetHandle","toString","source","sourceHandle","defaultActions","label","icon","renderedIcon","actionIcon","isValidElement","HvFlowBaseNode","title","headerItems","color","colorProp","inputs","outputs","nodeActions","classes","classesProp","className","children","registerNode","unregisterNode","useNodeMetaRegistry","useEffect","showActions","setShowActions","useState","reactFlowInstance","useReactFlow","cx","css","useClasses","useEdges","nodes","useNodes","node","find","n","handleDefaultAction","useCallback","action","callback","deleteElements","addNodes","uid","position","x","y","height","selected","zIndex","Number","theme","zIndices","overlay","getColor","iconColor","props","border","root","map","backgroundColor","headerContainer","titleContainer","fill","display","contentContainer","length","inputsTitleContainer","inputsContainer","input","inputContainer","Position","Left","top","bottom","isMandatory","mandatory","outputsTitleContainer","outputsContainer","output","outputContainer","Right"],"mappings":";;;;;;;;;;AAwDA,MAAMA,mBAAmBA,CACvBC,IACAC,MACAC,KACAC,UACG;AACH,MAAIF,SAAS,UAAU;AACdE,WAAAA,MAAMC,KACVC,CAAAA,MAAMA,EAAEC,WAAWN,MAAMK,EAAEE,iBAAiBL,IAAIM,SACnD,CAAA;AAAA,EACF;AACA,MAAIP,SAAS,UAAU;AACdE,WAAAA,MAAMC,KACVC,CAAAA,MAAMA,EAAEI,WAAWT,MAAMK,EAAEK,iBAAiBR,IAAIM,SACnD,CAAA;AAAA,EACF;AAEO,SAAA;AACT;AAEA,MAAMG,iBAAyC,CAC7C;AAAA,EAAEX,IAAI;AAAA,EAAUY,OAAO;AAAA,EAAUC,0BAAO,QAAM,EAAA;AAAI,GAClD;AAAA,EAAEb,IAAI;AAAA,EAAaY,OAAO;AAAA,EAAaC,0BAAO,WAAS,EAAA;AAAI,CAAC;AAG9D,MAAMC,eAAeA,CAACC,eACpBC,eAAeD,UAAU,IAAIA,aAAcA;AAEtC,MAAME,iBAAiBA,CAAC;AAAA,EAC7BjB;AAAAA,EACAkB;AAAAA,EACAC;AAAAA,EACAN;AAAAA,EACAO,OAAOC;AAAAA,EACPC;AAAAA,EACAC;AAAAA,EACAC,cAAcb;AAAAA,EACdc,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAC4B,MAAM;AAC5B,QAAA;AAAA,IAAEC;AAAAA,IAAcC;AAAAA,MAAmBC,oBAAoB;AAC7DC,YAAU,MAAM;AACdH,iBAAa7B,IAAI;AAAA,MAAEY,OAAOM,SAAS;AAAA,MAAII;AAAAA,MAAQC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B,QAAQ6D,UACzB,CAAA;AAAA,QACH,oBAAC,cAAcG,EAAAA,UAAAA,OAAO7E,MAAM,CAAA;AAAA,MAAA,KAfgBV,GAgB9C,CACD,GACH;AAAA,IAAA,GACF;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"BaseNode.js","sources":["../../../../../src/components/Flow/Node/BaseNode.tsx"],"sourcesContent":["import { isValidElement, useCallback, useEffect, useState } from \"react\";\nimport {\n Edge,\n Handle,\n NodeProps,\n NodeToolbar,\n Position,\n useReactFlow,\n} from \"reactflow\";\nimport { uid } from \"uid\";\nimport {\n ExtractNames,\n HvActionGeneric,\n HvBaseProps,\n HvButton,\n HvTypography,\n} from \"@hitachivantara/uikit-react-core\";\nimport { Delete, Duplicate } from \"@hitachivantara/uikit-react-icons\";\nimport { HvColorAny, getColor, theme } from \"@hitachivantara/uikit-styles\";\n\nimport {\n HvFlowNodeAction,\n HvFlowBuiltInActions,\n HvFlowNodeInput,\n HvFlowNodeOutput,\n} from \"../types\";\nimport {\n useFlowNode,\n useFlowNodeInputEdges,\n useFlowNodeOutputEdges,\n} from \"../hooks/useFlowNode\";\nimport { useNodeMetaRegistry } from \"../FlowContext/NodeMetaContext\";\nimport { staticClasses, useClasses } from \"./BaseNode.styles\";\n\nexport { staticClasses as flowBaseNodeClasses };\n\nexport type HvFlowBaseNodeClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvFlowBaseNodeProps<T = any>\n extends Omit<HvBaseProps, \"id\">,\n NodeProps<T> {\n /** Header title */\n title?: string;\n /** Header icon */\n icon?: React.ReactNode;\n /** Header color */\n color?: HvColorAny;\n /** Header items */\n headerItems?: React.ReactNode;\n /** Node inputs */\n inputs?: HvFlowNodeInput[];\n /** Node outputs */\n outputs?: HvFlowNodeOutput[];\n /** Node actions */\n nodeActions?: HvFlowNodeAction[];\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvFlowBaseNodeClasses;\n}\n\nconst isInputConnected = (\n id: string,\n type: \"target\" | \"source\",\n handleId: string,\n edges: Edge[]\n) => {\n if (type === \"target\") {\n return edges.some((e) => e.target === id && e.targetHandle === handleId);\n }\n if (type === \"source\") {\n return edges.some((e) => e.source === id && e.sourceHandle === handleId);\n }\n\n return false;\n};\n\nconst defaultActions: HvFlowBuiltInActions[] = [\n { id: \"delete\", label: \"Delete\", icon: <Delete /> },\n { id: \"duplicate\", label: \"Duplicate\", icon: <Duplicate /> },\n];\n\nconst renderedIcon = (actionIcon: HvActionGeneric[\"icon\"]) =>\n isValidElement(actionIcon) ? actionIcon : (actionIcon as Function)?.();\n\nexport const HvFlowBaseNode = ({\n id,\n title,\n headerItems,\n icon,\n color: colorProp,\n inputs,\n outputs,\n nodeActions = defaultActions,\n classes: classesProp,\n className,\n children,\n}: HvFlowBaseNodeProps<unknown>) => {\n const { registerNode, unregisterNode } = useNodeMetaRegistry();\n useEffect(() => {\n registerNode(id, { label: title || \"\", inputs, outputs });\n return () => unregisterNode(id);\n }, [id, title, inputs, outputs, registerNode, unregisterNode]);\n\n const [showActions, setShowActions] = useState(false);\n const reactFlowInstance = useReactFlow();\n\n const { classes, cx, css } = useClasses(classesProp);\n\n const node = useFlowNode(id);\n const inputEdges = useFlowNodeInputEdges(id);\n const outputEdges = useFlowNodeOutputEdges(id);\n\n const handleDefaultAction = useCallback(\n (action: HvFlowNodeAction) => {\n if (!node) return;\n\n if (action.callback) {\n action.callback(node);\n return;\n }\n\n // built-in actions\n switch (action.id) {\n case \"delete\":\n reactFlowInstance.deleteElements({ nodes: [node] });\n break;\n case \"duplicate\":\n reactFlowInstance.addNodes([\n {\n ...node,\n id: uid(),\n position: {\n x: node.position.x,\n y: node.position.y + (node.height || 0) + 20,\n },\n selected: false,\n zIndex: Number(theme.zIndices.overlay),\n },\n ]);\n break;\n default:\n break;\n }\n },\n [node, reactFlowInstance]\n );\n\n if (!node) return null;\n\n const color = getColor(colorProp);\n const iconColor = isValidElement(icon)\n ? getColor(icon.props.color || \"base_dark\")\n : getColor(\"base_dark\");\n\n return (\n <div\n className={cx(\n \"nowheel\", // Disables the default canvas pan behaviour when scrolling inside the node\n css({ border: `1px solid ${color}` }),\n classes.root,\n className\n )}\n onMouseEnter={() => setShowActions(true)}\n onMouseLeave={() => setShowActions(false)}\n >\n <NodeToolbar isVisible={showActions} offset={0}>\n {nodeActions?.map((action) => (\n <HvButton\n key={action.id}\n icon\n onClick={() => handleDefaultAction(action)}\n >\n {renderedIcon(action.icon)}\n </HvButton>\n ))}\n </NodeToolbar>\n <div\n className={cx(css({ backgroundColor: color }), classes.headerContainer)}\n >\n <div\n className={cx(\n classes.titleContainer,\n css({ \"& svg *.color0\": { fill: iconColor } })\n )}\n >\n {icon}\n <HvTypography\n component=\"p\"\n variant=\"title4\"\n className={classes.title}\n >\n {title}\n </HvTypography>\n </div>\n {headerItems && <div style={{ display: \"flex\" }}>{headerItems}</div>}\n </div>\n {children && <div className={classes.contentContainer}>{children}</div>}\n {inputs && inputs.length > 0 && (\n <>\n <div className={classes.inputsTitleContainer}>\n <HvTypography>Inputs</HvTypography>\n </div>\n\n <div className={classes.inputsContainer}>\n {inputs?.map((input, idx) => {\n const handleId = input.id ?? idx.toString();\n return (\n <div className={classes.inputContainer} key={idx}>\n <Handle\n type=\"target\"\n isConnectableStart={false}\n id={handleId}\n position={Position.Left}\n style={{\n top: \"auto\",\n bottom:\n (outputs?.length ? 80 : 18) +\n (outputs?.length || 0) * 29 +\n 29 * idx,\n }}\n />\n <HvTypography>{input.label}</HvTypography>\n {input.isMandatory &&\n !isInputConnected(id, \"target\", handleId, inputEdges) && (\n <div className={classes.mandatory} />\n )}\n </div>\n );\n })}\n </div>\n </>\n )}\n {outputs && outputs.length > 0 && (\n <>\n <div className={classes.outputsTitleContainer}>\n <HvTypography>Outputs</HvTypography>\n </div>\n <div className={classes.outputsContainer}>\n {outputs?.map((output, idx) => {\n const handleId = output.id ?? idx.toString();\n return (\n <div className={classes.outputContainer} key={idx}>\n <Handle\n type=\"source\"\n isConnectableEnd={false}\n id={handleId}\n position={Position.Right}\n style={{\n bottom: -10 + 29 * (outputs.length - idx),\n top: \"auto\",\n }}\n />\n {output.isMandatory &&\n !isInputConnected(id, \"source\", handleId, outputEdges) && (\n <div className={classes.mandatory} />\n )}\n <HvTypography>{output.label}</HvTypography>\n </div>\n );\n })}\n </div>\n </>\n )}\n </div>\n );\n};\n"],"names":["isInputConnected","id","type","handleId","edges","some","e","target","targetHandle","source","sourceHandle","defaultActions","label","icon","renderedIcon","actionIcon","isValidElement","HvFlowBaseNode","title","headerItems","color","colorProp","inputs","outputs","nodeActions","classes","classesProp","className","children","registerNode","unregisterNode","useNodeMetaRegistry","useEffect","showActions","setShowActions","useState","reactFlowInstance","useReactFlow","cx","css","useClasses","node","useFlowNode","inputEdges","useFlowNodeInputEdges","outputEdges","useFlowNodeOutputEdges","handleDefaultAction","useCallback","action","callback","deleteElements","nodes","addNodes","uid","position","x","y","height","selected","zIndex","Number","theme","zIndices","overlay","getColor","iconColor","props","border","root","map","backgroundColor","headerContainer","titleContainer","fill","display","contentContainer","length","inputsTitleContainer","inputsContainer","input","idx","toString","inputContainer","Position","Left","top","bottom","isMandatory","mandatory","outputsTitleContainer","outputsContainer","output","outputContainer","Right"],"mappings":";;;;;;;;;;;AA2DA,MAAMA,mBAAmBA,CACvBC,IACAC,MACAC,UACAC,UACG;AACH,MAAIF,SAAS,UAAU;AACdE,WAAAA,MAAMC,KAAMC,CAAMA,MAAAA,EAAEC,WAAWN,MAAMK,EAAEE,iBAAiBL,QAAQ;AAAA,EACzE;AACA,MAAID,SAAS,UAAU;AACdE,WAAAA,MAAMC,KAAMC,CAAMA,MAAAA,EAAEG,WAAWR,MAAMK,EAAEI,iBAAiBP,QAAQ;AAAA,EACzE;AAEO,SAAA;AACT;AAEA,MAAMQ,iBAAyC,CAC7C;AAAA,EAAEV,IAAI;AAAA,EAAUW,OAAO;AAAA,EAAUC,0BAAO,QAAM,EAAA;AAAI,GAClD;AAAA,EAAEZ,IAA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zB,qBAAA,UAAA,EAAA,UAAA;AAAA,MAAA,oBAAC,SAAI,WAAWpD,QAAQiE,uBACtB,UAAC,oBAAA,cAAA,EAAa,qBAAO,EACvB,CAAA;AAAA,MACA,oBAAC,SAAI,WAAWjE,QAAQkE,kBACrBpE,UAAS+C,SAAAA,IAAI,CAACsB,QAAQX,QAAQ;AAC7B,cAAM9E,WAAWyF,OAAO3F,MAAMgF,IAAIC,SAAS;AAC3C,eACG,qBAAA,OAAA,EAAI,WAAWzD,QAAQoE,iBACtB,UAAA;AAAA,UAAC,oBAAA,QAAA,EACC,MAAK,UACL,kBAAkB,OAClB,IAAI1F,UACJ,UAAUiF,SAASU,OACnB,OAAO;AAAA,YACLP,QAAQ,MAAM,MAAMhE,QAAQsD,SAASI;AAAAA,YACrCK,KAAK;AAAA,UAAA,GACL;AAAA,UAEHM,OAAOJ,eACN,CAACxF,iBAAiBC,IAAI,UAAUE,UAAU0C,WAAW,KACnD,oBAAC,OAAI,EAAA,WAAWpB,QAAQgE,UACzB,CAAA;AAAA,UACH,oBAAC,cAAcG,EAAAA,UAAAA,OAAOhF,MAAM,CAAA;AAAA,QAAA,EAAA,GAfgBqE,GAgB9C;AAAA,MAEH,CAAA,GACH;AAAA,IAAA,GACF;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
@@ -30,9 +30,7 @@ const HvFlowNode = ({
30
30
  classes
31
31
  } = useClasses(classesProp);
32
32
  const [showParams, setShowParams] = useState(expanded);
33
- const {
34
- node
35
- } = useFlowNode(id);
33
+ const node = useFlowNode(id);
36
34
  const {
37
35
  nodeGroups,
38
36
  nodeTypes,
@@ -1 +1 @@
1
- {"version":3,"file":"Node.js","sources":["../../../../../src/components/Flow/Node/Node.tsx"],"sourcesContent":["import React, { isValidElement, useState } from \"react\";\n\nimport {\n ExtractNames,\n HvActionGeneric,\n HvActionsGenericProps,\n HvButton,\n HvButtonProps,\n HvDropDownMenu,\n HvTooltip,\n HvTypography,\n} from \"@hitachivantara/uikit-react-core\";\nimport { getColor } from \"@hitachivantara/uikit-styles\";\nimport { Down, Info, Up } from \"@hitachivantara/uikit-react-icons\";\n\nimport { useFlowContext, useFlowNode } from \"../hooks/index\";\nimport { HvFlowNodeParam } from \"../types/index\";\nimport { staticClasses, useClasses } from \"./Node.styles\";\nimport ParamRenderer from \"./Parameters/ParamRenderer\";\nimport { HvFlowBaseNode, HvFlowBaseNodeProps } from \"./BaseNode\";\n\nexport { staticClasses as flowNodeClasses };\n// TODO How to include here the types from the parent component?\nexport type HvFlowNodeClasses = ExtractNames<typeof useClasses>;\n\nexport type HvFlowNodeDefaults = {\n title?: string;\n subTitle?: string;\n color?: string;\n icon?: React.ReactNode;\n};\n\nexport interface HvFlowNodeProps<T = any>\n extends Omit<HvFlowBaseNodeProps<T>, \"classes\"> {\n /** Node description */\n description?: string;\n /** Node actions */\n actions?: HvActionGeneric[]; // HvFlowNodeActions[];\n /** Node action callback */\n actionCallback?: HvActionsGenericProps[\"actionsCallback\"];\n /** Node maximum number of actions visible */\n maxVisibleActions?: number;\n /** Node expanded */\n expanded?: boolean;\n /** Node parameters */\n params?: HvFlowNodeParam[];\n /** A set of node default values for when there are no groups to fetch this data from. */\n nodeDefaults?: HvFlowNodeDefaults;\n /** Props to be passed to the expand parameters button. */\n expandParamsButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvFlowNodeClasses | HvFlowBaseNodeProps<T>[\"classes\"];\n}\n\nconst renderedIcon = (actionIcon: HvActionGeneric[\"icon\"]) =>\n isValidElement(actionIcon) ? actionIcon : (actionIcon as Function)?.();\n\nexport const HvFlowNode = ({\n id,\n type,\n headerItems,\n description,\n actions,\n actionCallback,\n maxVisibleActions = 1,\n expanded = false,\n params,\n nodeDefaults,\n classes: classesProp,\n children,\n expandParamsButtonProps,\n ...props\n}: HvFlowNodeProps<unknown>) => {\n const { classes } = useClasses(classesProp as HvFlowNodeClasses);\n const [showParams, setShowParams] = useState(expanded);\n const { node } = useFlowNode(id);\n\n const { nodeGroups, nodeTypes, defaultActions } = useFlowContext();\n const groupId = nodeTypes?.[type].meta?.groupId;\n const subtitle = nodeTypes?.[type].meta?.label || nodeDefaults?.subTitle;\n const groupLabel =\n (groupId && nodeGroups && nodeGroups[groupId].label) || nodeDefaults?.title;\n\n const inputs = nodeTypes?.[type]?.meta?.inputs;\n const outputs = nodeTypes?.[type]?.meta?.outputs;\n const icon =\n (groupId && nodeGroups && nodeGroups[groupId].icon) || nodeDefaults?.icon;\n const colorProp =\n (groupId && nodeGroups && nodeGroups[groupId].color) || nodeDefaults?.color;\n const color = getColor(colorProp);\n\n const actsVisible = actions?.slice(0, maxVisibleActions);\n const actsDropdown = actions?.slice(maxVisibleActions);\n\n const hasParams = !!(params && params.length > 0);\n\n return (\n <HvFlowBaseNode\n id={id}\n type={type}\n title={groupLabel}\n icon={icon}\n color={color}\n inputs={inputs}\n outputs={outputs}\n nodeActions={defaultActions}\n classes={classesProp as HvFlowBaseNodeProps<unknown>[\"classes\"]}\n headerItems={\n <>\n {headerItems}\n {description && (\n <HvTooltip title={<HvTypography>{description}</HvTypography>}>\n <div>\n <Info color=\"base_dark\" />\n </div>\n </HvTooltip>\n )}\n {hasParams && (\n <HvButton\n icon\n overrideIconColors={false}\n onClick={() => setShowParams((p) => !p)}\n aria-label={showParams ? \"Collapse\" : \"Expand\"}\n {...expandParamsButtonProps}\n >\n {showParams ? (\n <Up role=\"none\" color=\"base_dark\" />\n ) : (\n <Down role=\"none\" color=\"base_dark\" />\n )}\n </HvButton>\n )}\n </>\n }\n {...props}\n >\n {(subtitle || actsVisible?.length || actsDropdown?.length) && (\n <div className={classes.subtitleContainer}>\n {subtitle && (\n <div>\n <HvTypography>{subtitle}</HvTypography>\n </div>\n )}\n <div className={classes.actions}>\n {actions?.length && actions?.length > 0 && (\n <>\n {actsVisible?.map((action) => (\n <HvTooltip key={action.id} title={action.label}>\n <HvButton\n icon\n onClick={(event) => {\n actionCallback?.(event, id, action);\n }}\n aria-label={action.label}\n >\n {renderedIcon(action.icon)}\n </HvButton>\n </HvTooltip>\n ))}\n\n {actsDropdown && actsDropdown.length > 0 && (\n <HvDropDownMenu\n keepOpened={false}\n dataList={actsDropdown?.map((action) => ({\n id: action.id,\n label: action.label,\n }))}\n onClick={(event, action) => {\n actionCallback?.(event, id, action as HvActionGeneric);\n }}\n />\n )}\n </>\n )}\n </div>\n </div>\n )}\n {children}\n {showParams && params && (\n <div className={classes.paramsContainer}>\n <ParamRenderer nodeId={id} params={params} data={node?.data} />\n </div>\n )}\n </HvFlowBaseNode>\n );\n};\n"],"names":["renderedIcon","actionIcon","isValidElement","HvFlowNode","id","type","headerItems","description","actions","actionCallback","maxVisibleActions","expanded","params","nodeDefaults","classes","classesProp","children","expandParamsButtonProps","props","useClasses","showParams","setShowParams","useState","node","useFlowNode","nodeGroups","nodeTypes","defaultActions","useFlowContext","groupId","meta","subtitle","label","subTitle","groupLabel","title","inputs","outputs","icon","colorProp","color","getColor","actsVisible","slice","actsDropdown","hasParams","length","p","subtitleContainer","map","action","event","paramsContainer","data"],"mappings":";;;;;;;;;;;AAsDA,MAAMA,eAAeA,CAACC,eACpBC,eAAeD,UAAU,IAAIA,aAAcA;AAEtC,MAAME,aAAaA,CAAC;AAAA,EACzBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,oBAAoB;AAAA,EACpBC,WAAW;AAAA,EACXC;AAAAA,EACAC;AAAAA,EACAC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACA,GAAGC;AACqB,MAAM;AACxB,QAAA;AAAA,IAAEJ;AAAAA,EAAAA,IAAYK,WAAWJ,WAAiC;AAChE,QAAM,CAACK,YAAYC,aAAa,IAAIC,SAASX,QAAQ;AAC/C,QAAA;AAAA,IAAEY;AAAAA,EAAAA,IAASC,YAAYpB,EAAE;AAEzB,QAAA;AAAA,IAAEqB;AAAAA,IAAYC;AAAAA,IAAWC;AAAAA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esContent":["import React, { isValidElement, useState } from \"react\";\n\nimport {\n ExtractNames,\n HvActionGeneric,\n HvActionsGenericProps,\n HvButton,\n HvButtonProps,\n HvDropDownMenu,\n HvTooltip,\n HvTypography,\n} from \"@hitachivantara/uikit-react-core\";\nimport { getColor } from \"@hitachivantara/uikit-styles\";\nimport { Down, Info, Up } from \"@hitachivantara/uikit-react-icons\";\n\nimport { useFlowContext, useFlowNode } from \"../hooks/index\";\nimport { HvFlowNodeParam } from \"../types/index\";\nimport { staticClasses, useClasses } from \"./Node.styles\";\nimport ParamRenderer from \"./Parameters/ParamRenderer\";\nimport { HvFlowBaseNode, HvFlowBaseNodeProps } from \"./BaseNode\";\n\nexport { staticClasses as flowNodeClasses };\n// TODO How to include here the types from the parent component?\nexport type HvFlowNodeClasses = ExtractNames<typeof useClasses>;\n\nexport type HvFlowNodeDefaults = {\n title?: string;\n subTitle?: string;\n color?: string;\n icon?: React.ReactNode;\n};\n\nexport interface HvFlowNodeProps<T = any>\n extends Omit<HvFlowBaseNodeProps<T>, \"classes\"> {\n /** Node description */\n description?: string;\n /** Node actions */\n actions?: HvActionGeneric[]; // HvFlowNodeActions[];\n /** Node action callback */\n actionCallback?: HvActionsGenericProps[\"actionsCallback\"];\n /** Node maximum number of actions visible */\n maxVisibleActions?: number;\n /** Node expanded */\n expanded?: boolean;\n /** Node parameters */\n params?: HvFlowNodeParam[];\n /** A set of node default values for when there are no groups to fetch this data from. */\n nodeDefaults?: HvFlowNodeDefaults;\n /** Props to be passed to the expand parameters button. */\n expandParamsButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvFlowNodeClasses | HvFlowBaseNodeProps<T>[\"classes\"];\n}\n\nconst renderedIcon = (actionIcon: HvActionGeneric[\"icon\"]) =>\n isValidElement(actionIcon) ? actionIcon : (actionIcon as Function)?.();\n\nexport const HvFlowNode = ({\n id,\n type,\n headerItems,\n description,\n actions,\n actionCallback,\n maxVisibleActions = 1,\n expanded = false,\n params,\n nodeDefaults,\n classes: classesProp,\n children,\n expandParamsButtonProps,\n ...props\n}: HvFlowNodeProps<unknown>) => {\n const { classes } = useClasses(classesProp as HvFlowNodeClasses);\n const [showParams, setShowParams] = useState(expanded);\n const node = useFlowNode(id);\n\n const { nodeGroups, nodeTypes, defaultActions } = useFlowContext();\n const groupId = nodeTypes?.[type].meta?.groupId;\n const subtitle = nodeTypes?.[type].meta?.label || nodeDefaults?.subTitle;\n const groupLabel =\n (groupId && nodeGroups && nodeGroups[groupId].label) || nodeDefaults?.title;\n\n const inputs = nodeTypes?.[type]?.meta?.inputs;\n const outputs = nodeTypes?.[type]?.meta?.outputs;\n const icon =\n (groupId && nodeGroups && nodeGroups[groupId].icon) || nodeDefaults?.icon;\n const colorProp =\n (groupId && nodeGroups && nodeGroups[groupId].color) || nodeDefaults?.color;\n const color = getColor(colorProp);\n\n const actsVisible = actions?.slice(0, maxVisibleActions);\n const actsDropdown = actions?.slice(maxVisibleActions);\n\n const hasParams = !!(params && params.length > 0);\n\n return (\n <HvFlowBaseNode\n id={id}\n type={type}\n title={groupLabel}\n icon={icon}\n color={color}\n inputs={inputs}\n outputs={outputs}\n nodeActions={defaultActions}\n classes={classesProp as HvFlowBaseNodeProps<unknown>[\"classes\"]}\n headerItems={\n <>\n {headerItems}\n {description && (\n <HvTooltip title={<HvTypography>{description}</HvTypography>}>\n <div>\n <Info color=\"base_dark\" />\n </div>\n </HvTooltip>\n )}\n {hasParams && (\n <HvButton\n icon\n overrideIconColors={false}\n onClick={() => setShowParams((p) => !p)}\n aria-label={showParams ? \"Collapse\" : \"Expand\"}\n {...expandParamsButtonProps}\n >\n {showParams ? (\n <Up role=\"none\" color=\"base_dark\" />\n ) : (\n <Down role=\"none\" color=\"base_dark\" />\n )}\n </HvButton>\n )}\n </>\n }\n {...props}\n >\n {(subtitle || actsVisible?.length || actsDropdown?.length) && (\n <div className={classes.subtitleContainer}>\n {subtitle && (\n <div>\n <HvTypography>{subtitle}</HvTypography>\n </div>\n )}\n <div className={classes.actions}>\n {actions?.length && actions?.length > 0 && (\n <>\n {actsVisible?.map((action) => (\n <HvTooltip key={action.id} title={action.label}>\n <HvButton\n icon\n onClick={(event) => {\n actionCallback?.(event, id, action);\n }}\n aria-label={action.label}\n >\n {renderedIcon(action.icon)}\n </HvButton>\n </HvTooltip>\n ))}\n\n {actsDropdown && actsDropdown.length > 0 && (\n <HvDropDownMenu\n keepOpened={false}\n dataList={actsDropdown?.map((action) => ({\n id: action.id,\n label: action.label,\n }))}\n onClick={(event, action) => {\n actionCallback?.(event, id, action as HvActionGeneric);\n }}\n />\n )}\n </>\n )}\n </div>\n </div>\n )}\n {children}\n {showParams && params && (\n <div className={classes.paramsContainer}>\n <ParamRenderer nodeId={id} params={params} data={node?.data} />\n </div>\n )}\n </HvFlowBaseNode>\n );\n};\n"],"names":["renderedIcon","actionIcon","isValidElement","HvFlowNode","id","type","headerItems","description","actions","actionCallback","maxVisibleActions","expanded","params","nodeDefaults","classes","classesProp","children","expandParamsButtonProps","props","useClasses","showParams","setShowParams","useState","node","useFlowNode","nodeGroups","nodeTypes","defaultActions","useFlowContext","groupId","meta","subtitle","label","subTitle","groupLabel","title","inputs","outputs","icon","colorProp","color","getColor","actsVisible","slice","actsDropdown","hasParams","length","p","subtitleContainer","map","action","event","paramsContainer","data"],"mappings":";;;;;;;;;;;AAsDA,MAAMA,eAAeA,CAACC,eACpBC,eAAeD,UAAU,IAAIA,aAAcA;AAEtC,MAAME,aAAaA,CAAC;AAAA,EACzBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,oBAAoB;AAAA,EACpBC,WAAW;AAAA,EACXC;AAAAA,EACAC;AAAAA,EACAC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACA,GAAGC;AACqB,MAAM;AACxB,QAAA;AAAA,IAAEJ;AAAAA,EAAAA,IAAYK,WAAWJ,WAAiC;AAChE,QAAM,CAACK,YA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MmB,MAAM8B,KAAK,CAAA,GAC9D;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
@@ -17,7 +17,7 @@ const Select = ({
17
17
  const [opts, setOpts] = useState(data[id] ? Array.isArray(data[id]) ? data[id] : [data[id]] : void 0);
18
18
  const onSelectChange = (item) => {
19
19
  const nodes = reactFlowInstance.getNodes();
20
- const newOpts = Array.isArray(item) ? item.map((x) => x.label) : item?.label ? [item.label] : void 0;
20
+ const newOpts = Array.isArray(item) ? item.map((x) => x.label) : item?.label ?? void 0;
21
21
  const newNodes = nodes.map((node) => {
22
22
  if (node.id === nodeId) {
23
23
  node.data = {
@@ -28,7 +28,7 @@ const Select = ({
28
28
  return node;
29
29
  });
30
30
  reactFlowInstance.setNodes(newNodes);
31
- setOpts(newOpts);
31
+ setOpts(newOpts ? Array.isArray(newOpts) ? newOpts : [newOpts] : void 0);
32
32
  };
33
33
  return /* @__PURE__ */ jsx(
34
34
  HvDropdown,
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../../../../src/components/Flow/Node/Parameters/Select.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { HvDropdown, HvDropdownProps } from \"@hitachivantara/uikit-react-core\";\nimport { useReactFlow } from \"reactflow\";\n\nimport { HvFlowNodeSelectParam } from \"../../types\";\n\ninterface SelectProps {\n nodeId: string;\n param: Omit<HvFlowNodeSelectParam, \"type\">;\n data: any;\n}\n\nconst Select = ({ nodeId, param, data }: SelectProps) => {\n const { id, label, multiple = false, options } = param;\n\n const reactFlowInstance = useReactFlow();\n\n const [opts, setOpts] = useState<string[] | undefined>(\n data[id] ? (Array.isArray(data[id]) ? data[id] : [data[id]]) : undefined\n );\n\n const onSelectChange: HvDropdownProps[\"onChange\"] = (item) => {\n const nodes = reactFlowInstance.getNodes();\n\n const newOpts = Array.isArray(item)\n ? item.map((x) => x.label as string)\n : item?.label\n ? [item.label as string]\n : undefined;\n\n const newNodes = nodes.map((node) => {\n if (node.id === nodeId) {\n node.data = {\n ...node.data,\n [id]: newOpts,\n };\n }\n return node;\n });\n\n reactFlowInstance.setNodes(newNodes);\n setOpts(newOpts);\n };\n\n return (\n <HvDropdown\n className=\"nodrag\" // Prevents dragging within the select field\n disablePortal\n label={label}\n values={options?.map((o) => {\n return { id: o, label: o, selected: !!opts?.find((opt) => opt === o) };\n })}\n onChange={onSelectChange}\n maxHeight={100}\n multiSelect={multiple}\n />\n );\n};\n\nexport default Select;\n"],"names":["Select","nodeId","param","data","id","label","multiple","options","reactFlowInstance","useReactFlow","opts","setOpts","useState","Array","isArray","undefined","onSelectChange","item","nodes","getNodes","newOpts","map","x","newNodes","node","setNodes","o","selected","find","opt"],"mappings":";;;;AAYA,MAAMA,SAASA,CAAC;AAAA,EAAEC;AAAAA,EAAQC;AAAAA,EAAOC;AAAkB,MAAM;AACjD,QAAA;AAAA,IAAEC;AAAAA,IAAIC;AAAAA,IAAOC,WAAW;AAAA,IAAOC;AAAAA,EAAYL,IAAAA;AAEjD,QAAMM,oBAAoBC;AAEpB,QAAA,CAACC,MAAMC,OAAO,IAAIC,SACtBT,KAAKC,EAAE,IAAKS,MAAMC,QAAQX,KAAKC,EAAE,CAAC,IAAID,KAAKC,EAAE,IAAI,CAACD,KAAKC,EAAE,CAAC,IAAKW,MACjE;AAEA,QAAMC,iBAA+CC,CAAS,SAAA;AACtDC,UAAAA,QAAQV,kBAAkBW;AAEhC,UAAMC,UAAUP,MAAMC,QAAQG,IAAI,IAC9BA,KAAKI,IAAKC,CAAAA,MAAMA,EAAEjB,KAAe,IACjCY,MAAMZ,QACN,CAACY,KAAKZ,KAAe,IACrBU;AAEEQ,UAAAA,WAAWL,MAAMG,IAAKG,CAAS,SAAA;AAC/BA,UAAAA,KAAKpB,OAAOH,QAAQ;AACtBuB,aAAKrB,OAAO;AAAA,UACV,GAAGqB,KAAKrB;AAAAA,UACR,CAACC,EAAE,GAAGgB;AAAAA,QAAAA;AAAAA,MAEV;AACOI,aAAAA;AAAAA,IAAAA,CACR;AAEDhB,sBAAkBiB,SAASF,QAAQ;AACnCZ,YAAQS,OAAO;AAAA,EAAA;AAIf,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,eAAa;AAAA,MACb;AAAA,MACA,QAAQb,SAASc,IAAKK,CAAM,MAAA;AACnB,eAAA;AAAA,UAAEtB,IAAIsB;AAAAA,UAAGrB,OAAOqB;AAAAA,UAAGC,UAAU,CAAC,CAACjB,MAAMkB,KAAMC,CAAAA,QAAQA,QAAQH,CAAC;AAAA,QAAA;AAAA,MAAE,CACtE;AAAA,MACD,UAAUV;AAAAA,MACV,WAAW;AAAA,MACX,aAAaV;AAAAA,IAAAA;AAAAA,EAAAA;AAGnB;AAEA,MAAA,WAAeN;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../../../../src/components/Flow/Node/Parameters/Select.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { HvDropdown, HvDropdownProps } from \"@hitachivantara/uikit-react-core\";\nimport { useReactFlow } from \"reactflow\";\n\nimport { HvFlowNodeSelectParam } from \"../../types\";\n\ninterface SelectProps {\n nodeId: string;\n param: Omit<HvFlowNodeSelectParam, \"type\">;\n data: any;\n}\n\nconst Select = ({ nodeId, param, data }: SelectProps) => {\n const { id, label, multiple = false, options } = param;\n\n const reactFlowInstance = useReactFlow();\n\n const [opts, setOpts] = useState<string[] | undefined>(\n data[id] ? (Array.isArray(data[id]) ? data[id] : [data[id]]) : undefined\n );\n\n const onSelectChange: HvDropdownProps[\"onChange\"] = (item) => {\n const nodes = reactFlowInstance.getNodes();\n\n const newOpts = Array.isArray(item)\n ? item.map((x) => x.label as string)\n : (item?.label as string) ?? undefined;\n\n const newNodes = nodes.map((node) => {\n if (node.id === nodeId) {\n node.data = {\n ...node.data,\n [id]: newOpts,\n };\n }\n return node;\n });\n\n reactFlowInstance.setNodes(newNodes);\n setOpts(\n newOpts ? (Array.isArray(newOpts) ? newOpts : [newOpts]) : undefined\n );\n };\n\n return (\n <HvDropdown\n className=\"nodrag\" // Prevents dragging within the select field\n disablePortal\n label={label}\n values={options?.map((o) => {\n return { id: o, label: o, selected: !!opts?.find((opt) => opt === o) };\n })}\n onChange={onSelectChange}\n maxHeight={100}\n multiSelect={multiple}\n />\n );\n};\n\nexport default Select;\n"],"names":["Select","nodeId","param","data","id","label","multiple","options","reactFlowInstance","useReactFlow","opts","setOpts","useState","Array","isArray","undefined","onSelectChange","item","nodes","getNodes","newOpts","map","x","newNodes","node","setNodes","o","selected","find","opt"],"mappings":";;;;AAYA,MAAMA,SAASA,CAAC;AAAA,EAAEC;AAAAA,EAAQC;AAAAA,EAAOC;AAAkB,MAAM;AACjD,QAAA;AAAA,IAAEC;AAAAA,IAAIC;AAAAA,IAAOC,WAAW;AAAA,IAAOC;AAAAA,EAAYL,IAAAA;AAEjD,QAAMM,oBAAoBC;AAEpB,QAAA,CAACC,MAAMC,OAAO,IAAIC,SACtBT,KAAKC,EAAE,IAAKS,MAAMC,QAAQX,KAAKC,EAAE,CAAC,IAAID,KAAKC,EAAE,IAAI,CAACD,KAAKC,EAAE,CAAC,IAAKW,MACjE;AAEA,QAAMC,iBAA+CC,CAAS,SAAA;AACtDC,UAAAA,QAAQV,kBAAkBW;AAEhC,UAAMC,UAAUP,MAAMC,QAAQG,IAAI,IAC9BA,KAAKI,IAAKC,CAAAA,MAAMA,EAAEjB,KAAgB,IACjCY,MAAMZ,SAAoBU;AAEzBQ,UAAAA,WAAWL,MAAMG,IAAKG,CAAS,SAAA;AAC/BA,UAAAA,KAAKpB,OAAOH,QAAQ;AACtBuB,aAAKrB,OAAO;AAAA,UACV,GAAGqB,KAAKrB;AAAAA,UACR,CAACC,EAAE,GAAGgB;AAAAA,QAAAA;AAAAA,MAEV;AACOI,aAAAA;AAAAA,IAAAA,CACR;AAEDhB,sBAAkBiB,SAASF,QAAQ;AAEjCH,YAAAA,UAAWP,MAAMC,QAAQM,OAAO,IAAIA,UAAU,CAACA,OAAO,IAAKL,MAC7D;AAAA,EAAA;AAIA,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,eAAa;AAAA,MACb;AAAA,MACA,QAAQR,SAASc,IAAKK,CAAM,MAAA;AACnB,eAAA;AAAA,UAAEtB,IAAIsB;AAAAA,UAAGrB,OAAOqB;AAAAA,UAAGC,UAAU,CAAC,CAACjB,MAAMkB,KAAMC,CAAAA,QAAQA,QAAQH,CAAC;AAAA,QAAA;AAAA,MAAE,CACtE;AAAA,MACD,UAAUV;AAAAA,MACV,WAAW;AAAA,MACX,aAAaV;AAAAA,IAAAA;AAAAA,EAAAA;AAGnB;AAEA,MAAA,WAAeN;"}
@@ -1,25 +1,33 @@
1
- import { useNodes, useEdges } from "reactflow";
1
+ import { useCallback } from "react";
2
+ import { useStore } from "reactflow";
2
3
  function useFlowNode(id) {
3
- const nodes = useNodes();
4
- const edges = useEdges();
5
- return {
6
- // self node
7
- get node() {
8
- const self = nodes.find((n) => n.id === id);
9
- return self;
10
- },
11
- // parent nodes
12
- get parentNodes() {
13
- const connectedEdges = edges.filter((e) => e.target === id);
14
- const parentNodeArray = connectedEdges.map((e) => {
15
- const parentNode = nodes.find((n) => n.id === e.source);
16
- return parentNode;
17
- });
18
- return parentNodeArray;
19
- }
20
- };
4
+ const nodeSelector = useCallback((state) => state.getNodes().find((n) => n.id === id), [id]);
5
+ return useStore(nodeSelector);
6
+ }
7
+ function useFlowNodeInputEdges(id) {
8
+ const inputEdgesSelector = useCallback((state) => state.edges.filter((e) => e.target === id), [id]);
9
+ return useStore(inputEdgesSelector);
10
+ }
11
+ function useFlowNodeOutputEdges(id) {
12
+ const outputEdgesSelector = useCallback((state) => state.edges.filter((e) => e.source === id), [id]);
13
+ return useStore(outputEdgesSelector);
14
+ }
15
+ function useFlowNodeEdges(id) {
16
+ const edgesSelector = useCallback((state) => state.edges.filter((e) => e.source === id || e.target === id), [id]);
17
+ return useStore(edgesSelector);
18
+ }
19
+ function useFlowNodeParents(id) {
20
+ const inputEdges = useFlowNodeInputEdges(id);
21
+ const parentNodesSelector = useCallback((state) => {
22
+ return inputEdges.map((e) => state.getNodes().find((n) => n.id === e.source)).filter((n) => n !== null);
23
+ }, [inputEdges]);
24
+ return useStore(parentNodesSelector);
21
25
  }
22
26
  export {
23
- useFlowNode
27
+ useFlowNode,
28
+ useFlowNodeEdges,
29
+ useFlowNodeInputEdges,
30
+ useFlowNodeOutputEdges,
31
+ useFlowNodeParents
24
32
  };
25
33
  //# sourceMappingURL=useFlowNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFlowNode.js","sources":["../../../../../src/components/Flow/hooks/useFlowNode.ts"],"sourcesContent":["import { Edge, Node, useEdges, useNodes } from \"reactflow\";\n\nexport function useFlowNode<T = any>(id: string) {\n const nodes = useNodes<T>();\n const edges = useEdges();\n\n return {\n // self node\n get node() {\n const self = nodes.find((n: Node) => n.id === id);\n return self;\n },\n\n // parent nodes\n get parentNodes() {\n const connectedEdges = edges.filter((e: Edge) => e.target === id);\n const parentNodeArray = connectedEdges.map((e) => {\n const parentNode = nodes.find((n: Node) => n.id === e.source) as Node;\n return parentNode;\n });\n return parentNodeArray;\n },\n };\n}\n"],"names":["useFlowNode","id","nodes","useNodes","edges","useEdges","node","self","find","n","parentNodes","connectedEdges","filter","e","target","parentNodeArray","map","parentNode","source"],"mappings":";AAEO,SAASA,YAAqBC,IAAY;AAC/C,QAAMC,QAAQC;AACd,QAAMC,QAAQC;AAEP,SAAA;AAAA;AAAA,IAEL,IAAIC,OAAO;AACT,YAAMC,OAAOL,MAAMM,KAAK,CAACC,MAAYA,EAAER,OAAOA,EAAE;AACzCM,aAAAA;AAAAA,IACT;AAAA;AAAA,IAGA,IAAIG,cAAc;AAChB,YAAMC,iBAAiBP,MAAMQ,OAAO,CAACC,MAAYA,EAAEC,WAAWb,EAAE;AAC1Dc,YAAAA,kBAAkBJ,eAAeK,IAAKH,CAAM,MAAA;AAC1CI,cAAAA,aAAaf,MAAMM,KAAK,CAACC,MAAYA,EAAER,OAAOY,EAAEK,MAAM;AACrDD,eAAAA;AAAAA,MAAAA,CACR;AACMF,aAAAA;AAAAA,IACT;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"useFlowNode.js","sources":["../../../../../src/components/Flow/hooks/useFlowNode.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport { Node, Edge, ReactFlowState, useStore } from \"reactflow\";\n\nexport function useFlowNode<T extends Node = Node>(id: string) {\n const nodeSelector = useCallback(\n (state: ReactFlowState) =>\n state.getNodes().find((n: Node): n is T => n.id === id),\n [id]\n );\n return useStore<T | undefined>(nodeSelector);\n}\n\nexport function useFlowNodeInputEdges(id: string) {\n const inputEdgesSelector = useCallback(\n (state: ReactFlowState) => state.edges.filter((e: Edge) => e.target === id),\n [id]\n );\n return useStore(inputEdgesSelector);\n}\n\nexport function useFlowNodeOutputEdges(id: string) {\n const outputEdgesSelector = useCallback(\n (state: ReactFlowState) => state.edges.filter((e: Edge) => e.source === id),\n [id]\n );\n return useStore(outputEdgesSelector);\n}\n\nexport function useFlowNodeEdges(id: string) {\n const edgesSelector = useCallback(\n (state: ReactFlowState) =>\n state.edges.filter((e: Edge) => e.source === id || e.target === id),\n [id]\n );\n return useStore(edgesSelector);\n}\n\nexport function useFlowNodeParents(id: string) {\n const inputEdges = useFlowNodeInputEdges(id);\n const parentNodesSelector = useCallback(\n (state: ReactFlowState) => {\n return inputEdges\n .map((e) => state.getNodes().find((n: Node) => n.id === e.source))\n .filter((n): n is Node => n !== null);\n },\n [inputEdges]\n );\n return useStore(parentNodesSelector);\n}\n"],"names":["useFlowNode","id","nodeSelector","useCallback","state","getNodes","find","n","useStore","useFlowNodeInputEdges","inputEdgesSelector","edges","filter","e","target","useFlowNodeOutputEdges","outputEdgesSelector","source","useFlowNodeEdges","edgesSelector","useFlowNodeParents","inputEdges","parentNodesSelector","map"],"mappings":";;AAGO,SAASA,YAAmCC,IAAY;AAC7D,QAAMC,eAAeC,YACnB,CAACC,UACCA,MAAMC,WAAWC,KAAK,CAACC,MAAoBA,EAAEN,OAAOA,EAAE,GACxD,CAACA,EAAE,CACL;AACA,SAAOO,SAAwBN,YAAY;AAC7C;AAEO,SAASO,sBAAsBR,IAAY;AAChD,QAAMS,qBAAqBP,YACzB,CAACC,UAA0BA,MAAMO,MAAMC,OAAO,CAACC,MAAYA,EAAEC,WAAWb,EAAE,GAC1E,CAACA,EAAE,CACL;AACA,SAAOO,SAASE,kBAAkB;AACpC;AAEO,SAASK,uBAAuBd,IAAY;AACjD,QAAMe,sBAAsBb,YAC1B,CAACC,UAA0BA,MAAMO,MAAMC,OAAO,CAACC,MAAYA,EAAEI,WAAWhB,EAAE,GAC1E,CAACA,EAAE,CACL;AACA,SAAOO,SAASQ,mBAAmB;AACrC;AAEO,SAASE,iBAAiBjB,IAAY;AAC3C,QAAMkB,gBAAgBhB,YACpB,CAACC,UACCA,MAAMO,MAAMC,OAAO,CAACC,MAAYA,EAAEI,WAAWhB,MAAMY,EAAEC,WAAWb,EAAE,GACpE,CAACA,EAAE,CACL;AACA,SAAOO,SAASW,aAAa;AAC/B;AAEO,SAASC,mBAAmBnB,IAAY;AACvCoB,QAAAA,aAAaZ,sBAAsBR,EAAE;AACrCqB,QAAAA,sBAAsBnB,YAC1B,CAACC,UAA0B;AACzB,WAAOiB,WACJE,IAAKV,CAAAA,MAAMT,MAAMC,SAAS,EAAEC,KAAK,CAACC,MAAYA,EAAEN,OAAOY,EAAEI,MAAM,CAAC,EAChEL,OAAO,CAACL,MAAiBA,MAAM,IAAI;AAAA,EAAA,GAExC,CAACc,UAAU,CACb;AACA,SAAOb,SAASc,mBAAmB;AACrC;"}
@@ -0,0 +1,11 @@
1
+ import { useNodeMetaRegistry } from "../FlowContext/NodeMetaContext.js";
2
+ function useFlowNodeMeta(id) {
3
+ const {
4
+ registry
5
+ } = useNodeMetaRegistry();
6
+ return registry[id];
7
+ }
8
+ export {
9
+ useFlowNodeMeta
10
+ };
11
+ //# sourceMappingURL=useFlowNodeMeta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFlowNodeMeta.js","sources":["../../../../../src/components/Flow/hooks/useFlowNodeMeta.ts"],"sourcesContent":["import { useNodeMetaRegistry } from \"../FlowContext/NodeMetaContext\";\n\nexport function useFlowNodeMeta(id: string) {\n const { registry } = useNodeMetaRegistry();\n\n return registry[id];\n}\n"],"names":["useFlowNodeMeta","id","registry","useNodeMetaRegistry"],"mappings":";AAEO,SAASA,gBAAgBC,IAAY;AACpC,QAAA;AAAA,IAAEC;AAAAA,MAAaC,oBAAoB;AAEzC,SAAOD,SAASD,EAAE;AACpB;"}
package/dist/esm/index.js CHANGED
@@ -1,32 +1,36 @@
1
- import { staticClasses } from "./components/StepNavigation/StepNavigation.styles.js";
2
- import { HvStepNavigation } from "./components/StepNavigation/StepNavigation.js";
3
- import { staticClasses as staticClasses2 } from "./components/Wizard/Wizard.styles.js";
4
- import { HvWizard } from "./components/Wizard/Wizard.js";
5
- import { staticClasses as staticClasses3 } from "./components/Wizard/WizardActions/WizardActions.styles.js";
6
- import { HvWizardActions } from "./components/Wizard/WizardActions/WizardActions.js";
7
- import { staticClasses as staticClasses4 } from "./components/Wizard/WizardContainer/WizardContainer.styles.js";
8
- import { HvWizardContainer } from "./components/Wizard/WizardContainer/WizardContainer.js";
9
- import { staticClasses as staticClasses5 } from "./components/Wizard/WizardContent/WizardContent.styles.js";
10
- import { HvWizardContent } from "./components/Wizard/WizardContent/WizardContent.js";
11
- import { default as default2 } from "./components/Wizard/WizardContext/WizardContext.js";
12
- import { staticClasses as staticClasses6 } from "./components/Wizard/WizardTitle/WizardTitle.styles.js";
13
- import { HvWizardTitle } from "./components/Wizard/WizardTitle/WizardTitle.js";
14
- import { staticClasses as staticClasses7 } from "./components/Flow/Flow.styles.js";
1
+ import { staticClasses } from "./components/Dashboard/Dashboard.styles.js";
2
+ import { HvDashboard } from "./components/Dashboard/Dashboard.js";
3
+ import { staticClasses as staticClasses2 } from "./components/Flow/Flow.styles.js";
15
4
  import { HvFlowBackground } from "./components/Flow/Background/Background.js";
16
5
  import { HvFlowControls } from "./components/Flow/Controls/Controls.js";
17
- import { staticClasses as staticClasses8 } from "./components/Flow/Minimap/Minimap.styles.js";
6
+ import { staticClasses as staticClasses3 } from "./components/Flow/Minimap/Minimap.styles.js";
18
7
  import { HvFlowMinimap } from "./components/Flow/Minimap/Minimap.js";
19
- import { staticClasses as staticClasses9 } from "./components/Flow/Sidebar/Sidebar.styles.js";
8
+ import { staticClasses as staticClasses4 } from "./components/Flow/Sidebar/Sidebar.styles.js";
20
9
  import { HvFlowSidebar } from "./components/Flow/Sidebar/Sidebar.js";
21
10
  import { HvFlowEmpty } from "./components/Flow/Empty/Empty.js";
22
11
  import { HvFlow } from "./components/Flow/Flow.js";
23
- import { staticClasses as staticClasses10 } from "./components/Flow/Node/BaseNode.styles.js";
12
+ import { staticClasses as staticClasses5 } from "./components/Flow/Node/BaseNode.styles.js";
24
13
  import { HvFlowBaseNode } from "./components/Flow/Node/BaseNode.js";
25
- import { staticClasses as staticClasses11 } from "./components/Flow/Node/Node.styles.js";
14
+ import { staticClasses as staticClasses6 } from "./components/Flow/Node/Node.styles.js";
26
15
  import { HvFlowNode } from "./components/Flow/Node/Node.js";
27
- import { useFlowNode } from "./components/Flow/hooks/useFlowNode.js";
16
+ import { useFlowNode, useFlowNodeEdges, useFlowNodeInputEdges, useFlowNodeOutputEdges, useFlowNodeParents } from "./components/Flow/hooks/useFlowNode.js";
28
17
  import { useFlowContext } from "./components/Flow/hooks/useFlowContext.js";
18
+ import { useFlowNodeMeta } from "./components/Flow/hooks/useFlowNodeMeta.js";
19
+ import { staticClasses as staticClasses7 } from "./components/StepNavigation/StepNavigation.styles.js";
20
+ import { HvStepNavigation } from "./components/StepNavigation/StepNavigation.js";
21
+ import { staticClasses as staticClasses8 } from "./components/Wizard/Wizard.styles.js";
22
+ import { HvWizard } from "./components/Wizard/Wizard.js";
23
+ import { staticClasses as staticClasses9 } from "./components/Wizard/WizardActions/WizardActions.styles.js";
24
+ import { HvWizardActions } from "./components/Wizard/WizardActions/WizardActions.js";
25
+ import { staticClasses as staticClasses10 } from "./components/Wizard/WizardContainer/WizardContainer.styles.js";
26
+ import { HvWizardContainer } from "./components/Wizard/WizardContainer/WizardContainer.js";
27
+ import { staticClasses as staticClasses11 } from "./components/Wizard/WizardContent/WizardContent.styles.js";
28
+ import { HvWizardContent } from "./components/Wizard/WizardContent/WizardContent.js";
29
+ import { default as default2 } from "./components/Wizard/WizardContext/WizardContext.js";
30
+ import { staticClasses as staticClasses12 } from "./components/Wizard/WizardTitle/WizardTitle.styles.js";
31
+ import { HvWizardTitle } from "./components/Wizard/WizardTitle/WizardTitle.js";
29
32
  export {
33
+ HvDashboard,
30
34
  HvFlow,
31
35
  HvFlowBackground,
32
36
  HvFlowBaseNode,
@@ -42,18 +46,24 @@ export {
42
46
  HvWizardContent,
43
47
  default2 as HvWizardContext,
44
48
  HvWizardTitle,
45
- staticClasses10 as flowBaseNodeClasses,
46
- staticClasses7 as flowClasses,
47
- staticClasses8 as flowMinimapClasses,
48
- staticClasses11 as flowNodeClasses,
49
- staticClasses9 as flowSidebarClasses,
50
- staticClasses as stepNavigationClasses,
49
+ staticClasses as dashboardClasses,
50
+ staticClasses5 as flowBaseNodeClasses,
51
+ staticClasses2 as flowClasses,
52
+ staticClasses3 as flowMinimapClasses,
53
+ staticClasses6 as flowNodeClasses,
54
+ staticClasses4 as flowSidebarClasses,
55
+ staticClasses7 as stepNavigationClasses,
51
56
  useFlowContext,
52
57
  useFlowNode,
53
- staticClasses3 as wizardActionsClasses,
54
- staticClasses2 as wizardClasses,
55
- staticClasses4 as wizardContainerClasses,
56
- staticClasses5 as wizardContentClasses,
57
- staticClasses6 as wizardTitleClasses
58
+ useFlowNodeEdges,
59
+ useFlowNodeInputEdges,
60
+ useFlowNodeMeta,
61
+ useFlowNodeOutputEdges,
62
+ useFlowNodeParents,
63
+ staticClasses9 as wizardActionsClasses,
64
+ staticClasses8 as wizardClasses,
65
+ staticClasses10 as wizardContainerClasses,
66
+ staticClasses11 as wizardContentClasses,
67
+ staticClasses12 as wizardTitleClasses
58
68
  };
59
69
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}