@apexcura/ui-components 0.0.16-Beta37 → 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 +12 -11
- package/dist/index.mjs +12 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -778,30 +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] || /* @__PURE__ */ import_react16.default.createElement("img", { src: eachItem.icon }),
|
|
793
|
+
eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: eachItem.icon, alt: eachItem.label }) : "",
|
|
800
794
|
eachItem.items?.map(
|
|
801
795
|
(child, childIndex) => getItem(
|
|
802
796
|
child.label,
|
|
803
797
|
`${index}-${childIndex}`,
|
|
804
|
-
icons[child.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: child.icon }),
|
|
798
|
+
child.icon ? icons[child.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: child.icon, alt: child.label }) : "",
|
|
805
799
|
void 0,
|
|
806
800
|
child
|
|
807
801
|
)
|
|
@@ -809,6 +803,12 @@ var Sidebar = (props) => {
|
|
|
809
803
|
eachItem
|
|
810
804
|
);
|
|
811
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
|
+
};
|
|
812
812
|
return /* @__PURE__ */ import_react16.default.createElement(import_antd11.Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
813
813
|
Sider,
|
|
814
814
|
{
|
|
@@ -821,9 +821,10 @@ var Sidebar = (props) => {
|
|
|
821
821
|
import_antd11.Menu,
|
|
822
822
|
{
|
|
823
823
|
theme: "dark",
|
|
824
|
-
defaultSelectedKeys: ["
|
|
824
|
+
defaultSelectedKeys: ["0"],
|
|
825
825
|
mode: "inline",
|
|
826
|
-
items
|
|
826
|
+
items,
|
|
827
|
+
onClick: handleClick
|
|
827
828
|
}
|
|
828
829
|
)
|
|
829
830
|
));
|
package/dist/index.mjs
CHANGED
|
@@ -707,30 +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] || /* @__PURE__ */ React15.createElement("img", { src: eachItem.icon }),
|
|
722
|
+
eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ React15.createElement("img", { src: eachItem.icon, alt: eachItem.label }) : "",
|
|
729
723
|
eachItem.items?.map(
|
|
730
724
|
(child, childIndex) => getItem(
|
|
731
725
|
child.label,
|
|
732
726
|
`${index}-${childIndex}`,
|
|
733
|
-
icons[child.icon] || /* @__PURE__ */ React15.createElement("img", { src: child.icon }),
|
|
727
|
+
child.icon ? icons[child.icon] || /* @__PURE__ */ React15.createElement("img", { src: child.icon, alt: child.label }) : "",
|
|
734
728
|
void 0,
|
|
735
729
|
child
|
|
736
730
|
)
|
|
@@ -738,6 +732,12 @@ var Sidebar = (props) => {
|
|
|
738
732
|
eachItem
|
|
739
733
|
);
|
|
740
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
|
+
};
|
|
741
741
|
return /* @__PURE__ */ React15.createElement(Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ React15.createElement(
|
|
742
742
|
Sider,
|
|
743
743
|
{
|
|
@@ -750,9 +750,10 @@ var Sidebar = (props) => {
|
|
|
750
750
|
Menu,
|
|
751
751
|
{
|
|
752
752
|
theme: "dark",
|
|
753
|
-
defaultSelectedKeys: ["
|
|
753
|
+
defaultSelectedKeys: ["0"],
|
|
754
754
|
mode: "inline",
|
|
755
|
-
items
|
|
755
|
+
items,
|
|
756
|
+
onClick: handleClick
|
|
756
757
|
}
|
|
757
758
|
)
|
|
758
759
|
));
|