@apexcura/ui-components 0.0.16-Beta44 → 0.0.16-Beta46

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 CHANGED
@@ -793,24 +793,20 @@ var Sidebar = (props) => {
793
793
  onClick: () => handleChange(item)
794
794
  };
795
795
  }
796
- const items = props.items?.map((eachItem, index) => {
797
- const childItems = eachItem.items?.map(
798
- (child, childIndex) => getItem(
799
- child.label,
800
- `${index}-${childIndex}`,
801
- child.icon ? icons[child.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: child.icon, alt: "" }) : null,
802
- void 0,
803
- child
804
- )
805
- );
806
- return getItem(
807
- eachItem.label,
808
- index.toString(),
809
- eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: eachItem.icon, alt: "" }) : null,
810
- childItems,
811
- eachItem
812
- );
813
- });
796
+ function mapItems(items2, parentKey = "") {
797
+ return items2.map((eachItem, index) => {
798
+ const key = parentKey ? `${parentKey}-${index}` : index.toString();
799
+ const childItems = eachItem.items ? mapItems(eachItem.items, key) : void 0;
800
+ return getItem(
801
+ eachItem.label,
802
+ key,
803
+ eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ import_react16.default.createElement("img", { src: eachItem.icon, alt: "" }) : null,
804
+ childItems,
805
+ eachItem
806
+ );
807
+ });
808
+ }
809
+ const items = props.items ? mapItems(props.items) : [];
814
810
  return /* @__PURE__ */ import_react16.default.createElement(import_antd11.Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ import_react16.default.createElement(
815
811
  Sider,
816
812
  {
package/dist/index.mjs CHANGED
@@ -722,24 +722,20 @@ var Sidebar = (props) => {
722
722
  onClick: () => handleChange(item)
723
723
  };
724
724
  }
725
- const items = props.items?.map((eachItem, index) => {
726
- const childItems = eachItem.items?.map(
727
- (child, childIndex) => getItem(
728
- child.label,
729
- `${index}-${childIndex}`,
730
- child.icon ? icons[child.icon] || /* @__PURE__ */ React15.createElement("img", { src: child.icon, alt: "" }) : null,
731
- void 0,
732
- child
733
- )
734
- );
735
- return getItem(
736
- eachItem.label,
737
- index.toString(),
738
- eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ React15.createElement("img", { src: eachItem.icon, alt: "" }) : null,
739
- childItems,
740
- eachItem
741
- );
742
- });
725
+ function mapItems(items2, parentKey = "") {
726
+ return items2.map((eachItem, index) => {
727
+ const key = parentKey ? `${parentKey}-${index}` : index.toString();
728
+ const childItems = eachItem.items ? mapItems(eachItem.items, key) : void 0;
729
+ return getItem(
730
+ eachItem.label,
731
+ key,
732
+ eachItem.icon ? icons[eachItem.icon] || /* @__PURE__ */ React15.createElement("img", { src: eachItem.icon, alt: "" }) : null,
733
+ childItems,
734
+ eachItem
735
+ );
736
+ });
737
+ }
738
+ const items = props.items ? mapItems(props.items) : [];
743
739
  return /* @__PURE__ */ React15.createElement(Layout, { style: { minHeight: "100vh" } }, /* @__PURE__ */ React15.createElement(
744
740
  Sider,
745
741
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.16-Beta44",
3
+ "version": "0.0.16-Beta46",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",