@layerfi/components 0.1.50 → 0.1.51

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
@@ -4813,25 +4813,20 @@ var allCategoriesDivider = [
4813
4813
  }
4814
4814
  ];
4815
4815
  function flattenCategories2(categories) {
4816
- const categoryOptions = (categories || []).flatMap((category) => {
4817
- if (category?.subCategories && category?.subCategories?.length > 0) {
4818
- if (category?.subCategories?.every((c) => c.subCategories === void 0)) {
4819
- return [
4820
- {
4821
- label: category.display_name,
4822
- options: category.subCategories.map((x) => mapCategoryToOption2(x))
4823
- }
4824
- ];
4825
- }
4826
- return flattenCategories2(category.subCategories);
4816
+ function getLeafCategories(category) {
4817
+ if (!category.subCategories || category.subCategories.length === 0) {
4818
+ return [category];
4827
4819
  }
4828
- const resultOption = {
4829
- label: category.display_name,
4830
- options: [mapCategoryToOption2(category)]
4831
- };
4832
- return [resultOption];
4833
- });
4834
- return categoryOptions;
4820
+ return category.subCategories.flatMap((subCategory) => getLeafCategories(subCategory));
4821
+ }
4822
+ return categories.map(
4823
+ (category) => {
4824
+ return {
4825
+ label: category.display_name,
4826
+ options: getLeafCategories(category).map((x) => mapCategoryToOption2(x))
4827
+ };
4828
+ }
4829
+ );
4835
4830
  }
4836
4831
  var CategorySelect = ({
4837
4832
  bankTransaction,
@@ -11300,7 +11295,7 @@ var ProfitAndLossTableComponent = ({
11300
11295
  void 0,
11301
11296
  void 0,
11302
11297
  "summation"
11303
- ), data.other_outflows || data.personal_expenses ? /* @__PURE__ */ import_react116.default.createElement(import_react116.default.Fragment, null, renderLineItem(data.other_outflows, 0, "other_outflows", 6), renderLineItem(data.personal_expenses, 0, "personal_expenses", 7)) : null));
11298
+ ), data.personal_expenses ? /* @__PURE__ */ import_react116.default.createElement(import_react116.default.Fragment, null, renderLineItem(data.personal_expenses, 0, "personal_expenses", 7)) : null, data.other_outflows ? /* @__PURE__ */ import_react116.default.createElement(import_react116.default.Fragment, null, renderLineItem(data.other_outflows, 0, "other_outflows", 6)) : null));
11304
11299
  };
11305
11300
 
11306
11301
  // src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx