@apexcura/ui-components 0.0.16-Beta36 → 0.0.16-Beta38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -12
- package/dist/index.mjs +19 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -778,32 +778,24 @@ var import_antd11 = require("antd");
|
|
|
778
778
|
var { Sider } = import_antd11.Layout;
|
|
779
779
|
var Sidebar = (props) => {
|
|
780
780
|
const [collapsed, setCollapsed] = (0, import_react16.useState)(false);
|
|
781
|
-
const handleChange = (item) => {
|
|
782
|
-
if (props.onChange) {
|
|
783
|
-
props.onChange(item);
|
|
784
|
-
}
|
|
785
|
-
};
|
|
786
781
|
function getItem(label, key, icon, children, item) {
|
|
787
782
|
return {
|
|
788
783
|
key,
|
|
789
784
|
icon: icon ? /* @__PURE__ */ import_react16.default.createElement("span", { className: props.iconsClassName }, icon) : null,
|
|
790
785
|
children,
|
|
791
|
-
label
|
|
792
|
-
onClick: () => handleChange(item || { label, key })
|
|
786
|
+
label
|
|
793
787
|
};
|
|
794
788
|
}
|
|
795
789
|
const items = props.items?.map((eachItem, index) => {
|
|
796
790
|
return getItem(
|
|
797
791
|
eachItem.label,
|
|
798
792
|
index.toString(),
|
|
799
|
-
icons[eachItem.icon] || eachItem.icon,
|
|
800
|
-
// Handle icon URLs
|
|
793
|
+
eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: eachItem.icon, alt: eachItem.label }) : "",
|
|
801
794
|
eachItem.items?.map(
|
|
802
795
|
(child, childIndex) => getItem(
|
|
803
796
|
child.label,
|
|
804
797
|
`${index}-${childIndex}`,
|
|
805
|
-
icons[child.icon] || child.icon,
|
|
806
|
-
// Handle icon URLs
|
|
798
|
+
child.icon ? icons[child.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: child.icon, alt: child.label }) : "",
|
|
807
799
|
void 0,
|
|
808
800
|
child
|
|
809
801
|
)
|
|
@@ -811,6 +803,12 @@ var Sidebar = (props) => {
|
|
|
811
803
|
eachItem
|
|
812
804
|
);
|
|
813
805
|
});
|
|
806
|
+
const handleClick = (e) => {
|
|
807
|
+
const clickedItem = props.items?.find(
|
|
808
|
+
(item, index) => index.toString() === e.key
|
|
809
|
+
);
|
|
810
|
+
console.log("Clicked item:", clickedItem);
|
|
811
|
+
};
|
|
814
812
|
return /* @__PURE__ */ import_react16.default.createElement(import_antd11.Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
815
813
|
Sider,
|
|
816
814
|
{
|
|
@@ -819,7 +817,16 @@ var Sidebar = (props) => {
|
|
|
819
817
|
onCollapse: (value) => setCollapsed(value)
|
|
820
818
|
},
|
|
821
819
|
/* @__PURE__ */ import_react16.default.createElement("div", { className: "demo-logo-vertical" }),
|
|
822
|
-
/* @__PURE__ */ import_react16.default.createElement(
|
|
820
|
+
/* @__PURE__ */ import_react16.default.createElement(
|
|
821
|
+
import_antd11.Menu,
|
|
822
|
+
{
|
|
823
|
+
theme: "dark",
|
|
824
|
+
defaultSelectedKeys: ["0"],
|
|
825
|
+
mode: "inline",
|
|
826
|
+
items,
|
|
827
|
+
onClick: handleClick
|
|
828
|
+
}
|
|
829
|
+
)
|
|
823
830
|
));
|
|
824
831
|
};
|
|
825
832
|
|
package/dist/index.mjs
CHANGED
|
@@ -707,32 +707,24 @@ import { Layout, Menu } from "antd";
|
|
|
707
707
|
var { Sider } = Layout;
|
|
708
708
|
var Sidebar = (props) => {
|
|
709
709
|
const [collapsed, setCollapsed] = useState5(false);
|
|
710
|
-
const handleChange = (item) => {
|
|
711
|
-
if (props.onChange) {
|
|
712
|
-
props.onChange(item);
|
|
713
|
-
}
|
|
714
|
-
};
|
|
715
710
|
function getItem(label, key, icon, children, item) {
|
|
716
711
|
return {
|
|
717
712
|
key,
|
|
718
713
|
icon: icon ? /* @__PURE__ */ React15.createElement("span", { className: props.iconsClassName }, icon) : null,
|
|
719
714
|
children,
|
|
720
|
-
label
|
|
721
|
-
onClick: () => handleChange(item || { label, key })
|
|
715
|
+
label
|
|
722
716
|
};
|
|
723
717
|
}
|
|
724
718
|
const items = props.items?.map((eachItem, index) => {
|
|
725
719
|
return getItem(
|
|
726
720
|
eachItem.label,
|
|
727
721
|
index.toString(),
|
|
728
|
-
icons[eachItem.icon] || eachItem.icon,
|
|
729
|
-
// Handle icon URLs
|
|
722
|
+
eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ React15.createElement("img", { src: eachItem.icon, alt: eachItem.label }) : "",
|
|
730
723
|
eachItem.items?.map(
|
|
731
724
|
(child, childIndex) => getItem(
|
|
732
725
|
child.label,
|
|
733
726
|
`${index}-${childIndex}`,
|
|
734
|
-
icons[child.icon] || child.icon,
|
|
735
|
-
// Handle icon URLs
|
|
727
|
+
child.icon ? icons[child.icon] || /* @__PURE__ */ React15.createElement("img", { src: child.icon, alt: child.label }) : "",
|
|
736
728
|
void 0,
|
|
737
729
|
child
|
|
738
730
|
)
|
|
@@ -740,6 +732,12 @@ var Sidebar = (props) => {
|
|
|
740
732
|
eachItem
|
|
741
733
|
);
|
|
742
734
|
});
|
|
735
|
+
const handleClick = (e) => {
|
|
736
|
+
const clickedItem = props.items?.find(
|
|
737
|
+
(item, index) => index.toString() === e.key
|
|
738
|
+
);
|
|
739
|
+
console.log("Clicked item:", clickedItem);
|
|
740
|
+
};
|
|
743
741
|
return /* @__PURE__ */ React15.createElement(Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ React15.createElement(
|
|
744
742
|
Sider,
|
|
745
743
|
{
|
|
@@ -748,7 +746,16 @@ var Sidebar = (props) => {
|
|
|
748
746
|
onCollapse: (value) => setCollapsed(value)
|
|
749
747
|
},
|
|
750
748
|
/* @__PURE__ */ React15.createElement("div", { className: "demo-logo-vertical" }),
|
|
751
|
-
/* @__PURE__ */ React15.createElement(
|
|
749
|
+
/* @__PURE__ */ React15.createElement(
|
|
750
|
+
Menu,
|
|
751
|
+
{
|
|
752
|
+
theme: "dark",
|
|
753
|
+
defaultSelectedKeys: ["0"],
|
|
754
|
+
mode: "inline",
|
|
755
|
+
items,
|
|
756
|
+
onClick: handleClick
|
|
757
|
+
}
|
|
758
|
+
)
|
|
752
759
|
));
|
|
753
760
|
};
|
|
754
761
|
|