@littlebox/strapi-suite 1.0.40 → 1.0.42

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.
@@ -2,12 +2,12 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useNavigate, useParams, Routes, Route } from "react-router-dom";
3
3
  import React__default, { useState, useEffect, createContext, useContext, Fragment as Fragment$1, useRef } from "react";
4
4
  import { Box, Loader, Main, Typography, Button, Flex, Breadcrumbs, Crumb, CrumbLink, CardBody, CardContent, CardTitle, CardBadge, CardSubtitle, Card as Card$1, Dialog, IconButton, Toggle, SingleSelect, SingleSelectOption, SearchForm, Searchbar, Table, Thead, Tr, Th, Checkbox, VisuallyHidden, Tbody, Td, EmptyStateLayout, TextInput, Field, Tooltip } from "@strapi/design-system";
5
- import { R as Registry, F as FetchSettings, g as getTranslation, c as config, S as SLUG_LANGUAGE_STRATEGY, a as SLUG_CONTENT_STRATEGY, b as FetchSlugs, f as fetchTemplates } from "./index-DmkEUACh.mjs";
5
+ import { R as Registry, F as FetchSettings, g as getTranslation, c as config, S as SLUG_LANGUAGE_STRATEGY, a as SLUG_CONTENT_STRATEGY, b as FetchSlugs, f as fetchTemplates } from "./index-B77yEKma.mjs";
6
6
  import { ArrowLeft, ExternalLink, WarningCircle, Cross, BulletList, Pencil, Trash, Plus, Duplicate, Drag, Check } from "@strapi/icons";
7
7
  import { useIntl } from "react-intl";
8
8
  import styled, { useTheme } from "styled-components";
9
9
  import { EmptyDocuments } from "@strapi/icons/symbols";
10
- import { F as FetchLocales, c as convertToSlug } from "./convertToSlug-q9_W-VMA.mjs";
10
+ import { F as FetchLocales, c as convertToSlug } from "./convertToSlug-B8n8-z6F.mjs";
11
11
  import { DndContext, DragOverlay, pointerWithin, rectIntersection } from "@dnd-kit/core";
12
12
  import { useSortable, SortableContext, verticalListSortingStrategy, arrayMove } from "@dnd-kit/sortable";
13
13
  import { restrictToVerticalAxis, restrictToParentElement } from "@dnd-kit/modifiers";
@@ -716,7 +716,7 @@ const HomePage = () => {
716
716
  variant: "tertiary",
717
717
  style: { marginRight: "10px" },
718
718
  endIcon: /* @__PURE__ */ jsx(ExternalLink, {}),
719
- onClick: () => window.open("https://strapi.littlebox.pt", "_blank"),
719
+ onClick: () => window.open("https://strapi-suite.littlebox.pt", "_blank"),
720
720
  children: formatMessage({ id: getTranslation("app.documentation") })
721
721
  }
722
722
  ),
@@ -4,12 +4,12 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const reactRouterDom = require("react-router-dom");
5
5
  const React = require("react");
6
6
  const designSystem = require("@strapi/design-system");
7
- const index = require("./index-Pylfg-hk.js");
7
+ const index = require("./index-DykVJfCn.js");
8
8
  const icons = require("@strapi/icons");
9
9
  const reactIntl = require("react-intl");
10
10
  const styled = require("styled-components");
11
11
  const symbols = require("@strapi/icons/symbols");
12
- const convertToSlug = require("./convertToSlug-Btfca6aI.js");
12
+ const convertToSlug = require("./convertToSlug-M7bBnlxy.js");
13
13
  const core = require("@dnd-kit/core");
14
14
  const sortable = require("@dnd-kit/sortable");
15
15
  const modifiers = require("@dnd-kit/modifiers");
@@ -721,7 +721,7 @@ const HomePage = () => {
721
721
  variant: "tertiary",
722
722
  style: { marginRight: "10px" },
723
723
  endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ExternalLink, {}),
724
- onClick: () => window.open("https://strapi.littlebox.pt", "_blank"),
724
+ onClick: () => window.open("https://strapi-suite.littlebox.pt", "_blank"),
725
725
  children: formatMessage({ id: index.getTranslation("app.documentation") })
726
726
  }
727
727
  ),
@@ -6,8 +6,8 @@ import { useComposedRefs, Field, Box, Typography, TextInput, IconButton, Button
6
6
  import { Pin, Cross } from "@strapi/icons";
7
7
  import { useFocusInputField, unstable_useContentManagerContext } from "@strapi/strapi/admin";
8
8
  import styled from "styled-components";
9
- import { R as Registry, P as PageAttributeUpdated, D as DocumentCustomFieldStarted, d as PluginIcon, g as getTranslation, c as config, e as FetchModuleSettings } from "./index-DmkEUACh.mjs";
10
- import { c as convertToSlug, F as FetchLocales } from "./convertToSlug-q9_W-VMA.mjs";
9
+ import { R as Registry, P as PageAttributeUpdated, D as DocumentCustomFieldStarted, d as PluginIcon, g as getTranslation, c as config, e as FetchModuleSettings } from "./index-B77yEKma.mjs";
10
+ import { c as convertToSlug, F as FetchLocales } from "./convertToSlug-B8n8-z6F.mjs";
11
11
  const BoxInput = styled(Box)`
12
12
  & > div {
13
13
  width: 100%;
@@ -8,8 +8,8 @@ const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
9
  const admin = require("@strapi/strapi/admin");
10
10
  const styled = require("styled-components");
11
- const index = require("./index-Pylfg-hk.js");
12
- const convertToSlug = require("./convertToSlug-Btfca6aI.js");
11
+ const index = require("./index-DykVJfCn.js");
12
+ const convertToSlug = require("./convertToSlug-M7bBnlxy.js");
13
13
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
14
  function _interopNamespace(e) {
15
15
  if (e && e.__esModule) return e;
@@ -1,4 +1,4 @@
1
- import { R as Registry } from "./index-DmkEUACh.mjs";
1
+ import { R as Registry } from "./index-B77yEKma.mjs";
2
2
  class FetchLocales {
3
3
  localeGateway;
4
4
  constructor() {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const index = require("./index-Pylfg-hk.js");
2
+ const index = require("./index-DykVJfCn.js");
3
3
  class FetchLocales {
4
4
  localeGateway;
5
5
  constructor() {
@@ -3303,7 +3303,7 @@ const index = {
3303
3303
  defaultMessage: config.pluginId
3304
3304
  },
3305
3305
  position: 999,
3306
- Component: () => import("./App-2SwRpCFC.mjs")
3306
+ Component: () => import("./App-CPtEzTxB.mjs")
3307
3307
  });
3308
3308
  app.customFields.register({
3309
3309
  name: "ltbslug",
@@ -3321,7 +3321,7 @@ const index = {
3321
3321
  components: {
3322
3322
  Input: async () => import(
3323
3323
  /* webpackChunkName: "input-slug-component" */
3324
- "./SlugInput-BcUe-oCY.mjs"
3324
+ "./SlugInput-CfdpwmaN.mjs"
3325
3325
  )
3326
3326
  },
3327
3327
  options: {
@@ -3306,7 +3306,7 @@ const index = {
3306
3306
  defaultMessage: config.pluginId
3307
3307
  },
3308
3308
  position: 999,
3309
- Component: () => Promise.resolve().then(() => require("./App-DBXgA-D1.js"))
3309
+ Component: () => Promise.resolve().then(() => require("./App-Cp8XmCTY.js"))
3310
3310
  });
3311
3311
  app.customFields.register({
3312
3312
  name: "ltbslug",
@@ -3324,7 +3324,7 @@ const index = {
3324
3324
  components: {
3325
3325
  Input: async () => Promise.resolve().then(() => require(
3326
3326
  /* webpackChunkName: "input-slug-component" */
3327
- "./SlugInput-CVnNz0al.js"
3327
+ "./SlugInput-DlNZvvV5.js"
3328
3328
  ))
3329
3329
  },
3330
3330
  options: {
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-Pylfg-hk.js");
2
+ const index = require("../_chunks/index-DykVJfCn.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-DmkEUACh.mjs";
1
+ import { i } from "../_chunks/index-B77yEKma.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -1731,36 +1731,44 @@ async function buildBreadcrumbs(params) {
1731
1731
  }, []);
1732
1732
  return mappedResult;
1733
1733
  }
1734
- function handleAttributes(attributes2) {
1734
+ function handleAttributes(attributes2, level) {
1735
1735
  const query = {};
1736
1736
  Object.keys(attributes2).forEach((key) => {
1737
1737
  switch (attributes2[key]["type"]) {
1738
1738
  case "component":
1739
1739
  const componentData = strapi.components[attributes2[key]["component"]];
1740
- query[key] = { populate: handleAttributes(componentData.attributes) };
1740
+ query[key] = { populate: handleAttributes(componentData.attributes, level) };
1741
1741
  break;
1742
1742
  case "media":
1743
1743
  query[key] = { populate: "*" };
1744
1744
  break;
1745
1745
  case "relation":
1746
1746
  if (key === "roles" || key === "users" || key === "createdBy" || key === "updatedBy") break;
1747
- query[key] = key === "localizations" ? { populate: "*" } : { populate: populateQueryFromContentType(strapi, attributes2[key]["target"]) };
1747
+ query[key] = key === "localizations" ? { populate: "*" } : level === 3 ? { populate: "*" } : {
1748
+ populate: populateQueryFromContentType(
1749
+ strapi,
1750
+ attributes2[key]["target"],
1751
+ level + 1
1752
+ )
1753
+ };
1748
1754
  break;
1749
1755
  case "dynamiczone":
1750
1756
  const components = attributes2[key]["components"];
1751
1757
  query[key] = { on: {} };
1752
1758
  components.forEach((component) => {
1753
1759
  const componentData2 = strapi.components[component];
1754
- query[key]["on"][component] = { populate: handleAttributes(componentData2.attributes) };
1760
+ query[key]["on"][component] = {
1761
+ populate: handleAttributes(componentData2.attributes, level)
1762
+ };
1755
1763
  });
1756
1764
  break;
1757
1765
  }
1758
1766
  });
1759
1767
  return Object.keys(query).length === 0 ? "*" : query;
1760
1768
  }
1761
- function populateQueryFromContentType(strapi2, contentType) {
1769
+ function populateQueryFromContentType(strapi2, contentType, level = 1) {
1762
1770
  const attributes2 = strapi2.contentTypes[contentType]["attributes"];
1763
- const query = handleAttributes(attributes2);
1771
+ const query = handleAttributes(attributes2, level);
1764
1772
  return query;
1765
1773
  }
1766
1774
  const SlugModuleService = ({ strapi: strapi2 }) => ({
@@ -1730,36 +1730,44 @@ async function buildBreadcrumbs(params) {
1730
1730
  }, []);
1731
1731
  return mappedResult;
1732
1732
  }
1733
- function handleAttributes(attributes2) {
1733
+ function handleAttributes(attributes2, level) {
1734
1734
  const query = {};
1735
1735
  Object.keys(attributes2).forEach((key) => {
1736
1736
  switch (attributes2[key]["type"]) {
1737
1737
  case "component":
1738
1738
  const componentData = strapi.components[attributes2[key]["component"]];
1739
- query[key] = { populate: handleAttributes(componentData.attributes) };
1739
+ query[key] = { populate: handleAttributes(componentData.attributes, level) };
1740
1740
  break;
1741
1741
  case "media":
1742
1742
  query[key] = { populate: "*" };
1743
1743
  break;
1744
1744
  case "relation":
1745
1745
  if (key === "roles" || key === "users" || key === "createdBy" || key === "updatedBy") break;
1746
- query[key] = key === "localizations" ? { populate: "*" } : { populate: populateQueryFromContentType(strapi, attributes2[key]["target"]) };
1746
+ query[key] = key === "localizations" ? { populate: "*" } : level === 3 ? { populate: "*" } : {
1747
+ populate: populateQueryFromContentType(
1748
+ strapi,
1749
+ attributes2[key]["target"],
1750
+ level + 1
1751
+ )
1752
+ };
1747
1753
  break;
1748
1754
  case "dynamiczone":
1749
1755
  const components = attributes2[key]["components"];
1750
1756
  query[key] = { on: {} };
1751
1757
  components.forEach((component) => {
1752
1758
  const componentData2 = strapi.components[component];
1753
- query[key]["on"][component] = { populate: handleAttributes(componentData2.attributes) };
1759
+ query[key]["on"][component] = {
1760
+ populate: handleAttributes(componentData2.attributes, level)
1761
+ };
1754
1762
  });
1755
1763
  break;
1756
1764
  }
1757
1765
  });
1758
1766
  return Object.keys(query).length === 0 ? "*" : query;
1759
1767
  }
1760
- function populateQueryFromContentType(strapi2, contentType) {
1768
+ function populateQueryFromContentType(strapi2, contentType, level = 1) {
1761
1769
  const attributes2 = strapi2.contentTypes[contentType]["attributes"];
1762
- const query = handleAttributes(attributes2);
1770
+ const query = handleAttributes(attributes2, level);
1763
1771
  return query;
1764
1772
  }
1765
1773
  const SlugModuleService = ({ strapi: strapi2 }) => ({
@@ -1,2 +1,2 @@
1
1
  import type { Core } from '@strapi/strapi';
2
- export declare function populateQueryFromContentType(strapi: Core.Strapi, contentType: string): any;
2
+ export declare function populateQueryFromContentType(strapi: Core.Strapi, contentType: string, level?: number): any;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.40",
2
+ "version": "1.0.42",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi plugin",