@apexcura/ui-components 0.0.16-Beta43 → 0.0.16-Beta45
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 +15 -20
- package/dist/index.mjs +15 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -779,7 +779,6 @@ var { Sider } = import_antd11.Layout;
|
|
|
779
779
|
var Sidebar = (props) => {
|
|
780
780
|
const [collapsed, setCollapsed] = (0, import_react16.useState)(false);
|
|
781
781
|
const handleChange = (item) => {
|
|
782
|
-
console.log(item);
|
|
783
782
|
if (props.onChange) {
|
|
784
783
|
props.onChange(item);
|
|
785
784
|
}
|
|
@@ -787,30 +786,26 @@ var Sidebar = (props) => {
|
|
|
787
786
|
function getItem(label, key, icon, children, item) {
|
|
788
787
|
return {
|
|
789
788
|
key,
|
|
790
|
-
icon: icon ? /* @__PURE__ */ import_react16.default.createElement("span", { className: props.iconsClassName
|
|
789
|
+
icon: icon ? /* @__PURE__ */ import_react16.default.createElement("span", { className: props.iconsClassName }, icon) : null,
|
|
791
790
|
children,
|
|
792
791
|
label,
|
|
793
792
|
onClick: () => handleChange(item)
|
|
794
793
|
};
|
|
795
794
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
childItems,
|
|
811
|
-
eachItem
|
|
812
|
-
);
|
|
813
|
-
});
|
|
795
|
+
function mapItems(items2, parentKey = "") {
|
|
796
|
+
return items2.map((eachItem, index) => {
|
|
797
|
+
const key = parentKey ? `${parentKey}-${index}` : index.toString();
|
|
798
|
+
const childItems = eachItem.items ? mapItems(eachItem.items, key) : void 0;
|
|
799
|
+
return getItem(
|
|
800
|
+
eachItem.label,
|
|
801
|
+
key,
|
|
802
|
+
eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: eachItem.icon, alt: "" }) : null,
|
|
803
|
+
childItems,
|
|
804
|
+
eachItem
|
|
805
|
+
);
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
const items = props.items ? mapItems(props.items) : [];
|
|
814
809
|
return /* @__PURE__ */ import_react16.default.createElement(import_antd11.Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ import_react16.default.createElement(
|
|
815
810
|
Sider,
|
|
816
811
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -708,7 +708,6 @@ var { Sider } = Layout;
|
|
|
708
708
|
var Sidebar = (props) => {
|
|
709
709
|
const [collapsed, setCollapsed] = useState5(false);
|
|
710
710
|
const handleChange = (item) => {
|
|
711
|
-
console.log(item);
|
|
712
711
|
if (props.onChange) {
|
|
713
712
|
props.onChange(item);
|
|
714
713
|
}
|
|
@@ -716,30 +715,26 @@ var Sidebar = (props) => {
|
|
|
716
715
|
function getItem(label, key, icon, children, item) {
|
|
717
716
|
return {
|
|
718
717
|
key,
|
|
719
|
-
icon: icon ? /* @__PURE__ */ React15.createElement("span", { className: props.iconsClassName
|
|
718
|
+
icon: icon ? /* @__PURE__ */ React15.createElement("span", { className: props.iconsClassName }, icon) : null,
|
|
720
719
|
children,
|
|
721
720
|
label,
|
|
722
721
|
onClick: () => handleChange(item)
|
|
723
722
|
};
|
|
724
723
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
childItems,
|
|
740
|
-
eachItem
|
|
741
|
-
);
|
|
742
|
-
});
|
|
724
|
+
function mapItems(items2, parentKey = "") {
|
|
725
|
+
return items2.map((eachItem, index) => {
|
|
726
|
+
const key = parentKey ? `${parentKey}-${index}` : index.toString();
|
|
727
|
+
const childItems = eachItem.items ? mapItems(eachItem.items, key) : void 0;
|
|
728
|
+
return getItem(
|
|
729
|
+
eachItem.label,
|
|
730
|
+
key,
|
|
731
|
+
eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ React15.createElement("img", { src: eachItem.icon, alt: "" }) : null,
|
|
732
|
+
childItems,
|
|
733
|
+
eachItem
|
|
734
|
+
);
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
const items = props.items ? mapItems(props.items) : [];
|
|
743
738
|
return /* @__PURE__ */ React15.createElement(Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ React15.createElement(
|
|
744
739
|
Sider,
|
|
745
740
|
{
|