@mattisvensson/strapi-plugin-webatlas 0.9.6 → 0.10.0
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/README.md +24 -36
- package/dist/_chunks/{SettingTitle-77mvMRg_.mjs → SettingTitle-CdR3SVn_.mjs} +1 -1
- package/dist/_chunks/{SettingTitle-DLj_Wwqy.js → SettingTitle-RU1azFIM.js} +1 -1
- package/dist/_chunks/{de-C-uxto84.mjs → de-B5pRvs13.mjs} +13 -7
- package/dist/_chunks/{de-CGXL_3o_.js → de-CqU1FU8C.js} +13 -7
- package/dist/_chunks/{en-B1CHnIH7.mjs → en-BE-zzIv8.mjs} +13 -7
- package/dist/_chunks/{en-DWEd5BXK.js → en-C7I90FwV.js} +13 -7
- package/dist/_chunks/{index-DwaKIwAz.mjs → index-B07UVUOa.mjs} +387 -229
- package/dist/_chunks/{index-3pYLMhui.mjs → index-BmyxSosC.mjs} +3 -3
- package/dist/_chunks/{index-Dt-AXdaw.js → index-BucL4va6.js} +38 -82
- package/dist/_chunks/{index-BRKi-K-v.mjs → index-BvcX9hcc.mjs} +61 -24
- package/dist/_chunks/{index-COfk3YSm.js → index-BxpDM360.js} +386 -228
- package/dist/_chunks/{index-5OG4i6qO.mjs → index-CIM-JzLK.mjs} +38 -82
- package/dist/_chunks/{index-BWzalvVi.mjs → index-CNKWb8pn.mjs} +614 -320
- package/dist/_chunks/{index-VXuAEnpX.js → index-D-vJE_K8.js} +3 -3
- package/dist/_chunks/{index-BOtvXSPU.js → index-IRSCe8PX.js} +609 -315
- package/dist/_chunks/{index-DTsHvlTa.js → index-d09V61nm.js} +61 -24
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/CMEditViewAside/NewPathInfo.d.ts +2 -0
- package/dist/admin/src/components/CMEditViewAside/OverrideCheckbox.d.ts +7 -0
- package/dist/admin/src/components/CMEditViewAside/Panel.d.ts +5 -0
- package/dist/admin/src/components/CMEditViewAside/PathInput.d.ts +11 -0
- package/dist/admin/src/components/CMEditViewAside/RouteStructure.d.ts +3 -0
- package/dist/admin/src/components/CMEditViewAside/UidPathDisplay.d.ts +4 -0
- package/dist/admin/src/components/PathInfo.d.ts +2 -3
- package/dist/admin/src/components/modals/externalItem/index.d.ts +1 -1
- package/dist/admin/src/components/modals/internalItem/ItemDetails.d.ts +13 -0
- package/dist/admin/src/components/modals/internalItem/internalItemCreate.d.ts +1 -1
- package/dist/admin/src/components/modals/internalItem/internalItemEdit.d.ts +1 -1
- package/dist/admin/src/components/modals/useModalSharedLogic.d.ts +1 -1
- package/dist/admin/src/components/modals/wrapperItem/index.d.ts +1 -1
- package/dist/admin/src/hooks/useApi.d.ts +4 -3
- package/dist/admin/src/pages/Navigation/RouteItem.d.ts +1 -15
- package/dist/admin/src/pages/Navigation/RouteItemBadge.d.ts +4 -0
- package/dist/admin/src/pages/Navigation/RouteItemIcon.d.ts +5 -0
- package/dist/admin/src/pages/Navigation/RouteItemMenu.d.ts +10 -0
- package/dist/admin/src/pages/Navigation/RouteItemStatus.d.ts +5 -0
- package/dist/admin/src/pages/Navigation/SortableRouteItem.d.ts +1 -1
- package/dist/admin/src/types/index.d.ts +3 -0
- package/dist/admin/src/types/modal.d.ts +56 -0
- package/dist/admin/src/types/navigation.d.ts +18 -0
- package/dist/admin/src/types/panel.d.ts +41 -0
- package/dist/admin/src/types/route.d.ts +1 -1
- package/dist/admin/src/utils/buildBreadcrumbString.d.ts +16 -0
- package/dist/admin/src/utils/createTempNavItemObject.d.ts +6 -8
- package/dist/admin/src/utils/duplicateCheck.d.ts +10 -4
- package/dist/admin/src/utils/findParentNavItem.d.ts +13 -0
- package/dist/admin/src/utils/index.d.ts +3 -2
- package/dist/server/index.js +630 -200
- package/dist/server/index.mjs +630 -200
- package/dist/server/src/content-types/index.d.ts +18 -0
- package/dist/server/src/content-types/route/index.d.ts +18 -0
- package/dist/server/src/content-types/route/schema.d.ts +18 -0
- package/dist/server/src/controllers/admin.d.ts +3 -2
- package/dist/server/src/controllers/index.d.ts +3 -2
- package/dist/server/src/index.d.ts +24 -4
- package/dist/server/src/migrations/001-canonical-path.d.ts +7 -0
- package/dist/server/src/migrations/index.d.ts +3 -0
- package/dist/server/src/services/admin.d.ts +3 -2
- package/dist/server/src/services/index.d.ts +3 -2
- package/dist/server/src/utils/buildCanonicalPath.d.ts +1 -0
- package/dist/server/src/utils/buildNavigationPath.d.ts +5 -0
- package/dist/server/src/utils/cascadeCanonicalPathUpdates.d.ts +1 -0
- package/dist/server/src/utils/getNonInternalRouteIds.d.ts +1 -0
- package/dist/server/src/utils/getRouteAncestors.d.ts +1 -0
- package/dist/server/src/utils/getRouteDescendants.d.ts +1 -0
- package/dist/server/src/utils/index.d.ts +10 -2
- package/dist/server/src/utils/navigationItemStructure.d.ts +27 -0
- package/dist/server/src/utils/routeHandler.d.ts +4 -2
- package/dist/server/src/utils/validateRouteDependencies.d.ts +4 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/navigation.d.ts +13 -12
- package/dist/types/route.d.ts +7 -2
- package/dist/types/strapi.d.ts +1 -2
- package/dist/utils/index.d.ts +1 -2
- package/package.json +1 -1
- package/dist/admin/src/components/CMEditViewAside/Path.d.ts +0 -5
- package/dist/admin/src/utils/countChildren.d.ts +0 -2
- package/dist/types/modal.d.ts +0 -36
- package/dist/utils/getPath.d.ts +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const index = require("./index-
|
|
5
|
+
const index = require("./index-BxpDM360.js");
|
|
6
6
|
const admin = require("@strapi/strapi/admin");
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
require("@strapi/icons/symbols");
|
|
@@ -41,6 +41,15 @@ function compareBy(field, direction) {
|
|
|
41
41
|
return (a, b) => {
|
|
42
42
|
const aValue = a[field];
|
|
43
43
|
const bValue = b[field];
|
|
44
|
+
if (aValue == null && bValue == null) {
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
if (aValue == null) {
|
|
48
|
+
return direction === "asc" ? 1 : -1;
|
|
49
|
+
}
|
|
50
|
+
if (bValue == null) {
|
|
51
|
+
return direction === "asc" ? -1 : 1;
|
|
52
|
+
}
|
|
44
53
|
if (typeof aValue === "string" && typeof bValue === "string") {
|
|
45
54
|
return direction === "asc" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
|
|
46
55
|
}
|
|
@@ -88,6 +97,13 @@ function TableHeader({
|
|
|
88
97
|
}) }),
|
|
89
98
|
sortKey === "title" && /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDown, {})
|
|
90
99
|
] }),
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Th, { onClick: () => handleSort("canonicalPath"), cursor: "pointer", children: [
|
|
101
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
102
|
+
id: index.getTranslation("canonicalPath"),
|
|
103
|
+
defaultMessage: "Canonical Path"
|
|
104
|
+
}) }),
|
|
105
|
+
sortKey === "canonicalPath" && /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDown, {})
|
|
106
|
+
] }),
|
|
91
107
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Th, { onClick: () => handleSort("path"), cursor: "pointer", children: [
|
|
92
108
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
93
109
|
id: index.getTranslation("path"),
|
|
@@ -111,12 +127,25 @@ function TableHeader({
|
|
|
111
127
|
function TableRow({ route }) {
|
|
112
128
|
const { formatMessage } = reactIntl.useIntl();
|
|
113
129
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
114
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
130
|
+
[route.title, route.canonicalPath, route.path].map((field, index2) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
+
designSystem.Typography,
|
|
132
|
+
{
|
|
133
|
+
title: field,
|
|
134
|
+
textColor: "neutral800",
|
|
135
|
+
children: field || "-"
|
|
136
|
+
}
|
|
137
|
+
) }, index2)),
|
|
138
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
139
|
+
designSystem.Typography,
|
|
140
|
+
{
|
|
141
|
+
title: route.type,
|
|
142
|
+
textColor: "neutral800",
|
|
143
|
+
children: formatMessage({
|
|
144
|
+
id: index.getTranslation(`path.type.${route.type}`),
|
|
145
|
+
defaultMessage: "-"
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
) }),
|
|
120
149
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, justifyContent: "end", children: route.type === "internal" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
121
150
|
designSystem.LinkButton,
|
|
122
151
|
{
|
|
@@ -137,22 +166,30 @@ function PathTable({
|
|
|
137
166
|
handleSort
|
|
138
167
|
}) {
|
|
139
168
|
const { formatMessage } = reactIntl.useIntl();
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
169
|
+
const TABLE_COL_COUNT = 5;
|
|
170
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
171
|
+
designSystem.Table,
|
|
172
|
+
{
|
|
173
|
+
colCount: TABLE_COL_COUNT,
|
|
174
|
+
rowCount: routes.length,
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader, { sortKey, handleSort }),
|
|
177
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: routes.length > 0 ? routes.map((route) => /* @__PURE__ */ jsxRuntime.jsx(TableRow, { route }, route.id)) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: TABLE_COL_COUNT, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
178
|
+
designSystem.EmptyStateLayout,
|
|
179
|
+
{
|
|
180
|
+
content: formatMessage({
|
|
181
|
+
id: index.getTranslation("paths.page.emptyPaths"),
|
|
182
|
+
defaultMessage: "No paths found"
|
|
183
|
+
}),
|
|
184
|
+
shadow: false
|
|
185
|
+
}
|
|
186
|
+
) }) }) })
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
);
|
|
153
190
|
}
|
|
154
191
|
const Paths = () => {
|
|
155
|
-
const {
|
|
192
|
+
const { getAllRoutes } = index.useApi();
|
|
156
193
|
const { formatMessage } = reactIntl.useIntl();
|
|
157
194
|
const { toggleNotification } = admin.useNotification();
|
|
158
195
|
const [allRoutes, setAllRoutes] = React.useState([]);
|
|
@@ -161,7 +198,7 @@ const Paths = () => {
|
|
|
161
198
|
const [searchParams, setSearchParams] = reactRouterDom.useSearchParams();
|
|
162
199
|
const initialQuery = searchParams.get("search") || "";
|
|
163
200
|
const [searchQuery, setSearchQuery] = React.useState(initialQuery);
|
|
164
|
-
const [sortKey, setSortKey] = React.useState("
|
|
201
|
+
const [sortKey, setSortKey] = React.useState("canonicalPath");
|
|
165
202
|
const [sortDirection, setSortDirection] = React.useState("asc");
|
|
166
203
|
React.useEffect(() => {
|
|
167
204
|
const query = searchQuery.toLowerCase();
|
|
@@ -185,11 +222,11 @@ const Paths = () => {
|
|
|
185
222
|
React.useEffect(() => {
|
|
186
223
|
async function fetchRoutes() {
|
|
187
224
|
try {
|
|
188
|
-
const data = await
|
|
225
|
+
const data = await getAllRoutes();
|
|
189
226
|
setAllRoutes(data);
|
|
190
227
|
setRoutes(data);
|
|
191
228
|
} catch (err) {
|
|
192
|
-
|
|
229
|
+
strapi.log.error("Failed to fetch paths:", err);
|
|
193
230
|
toggleNotification({
|
|
194
231
|
type: "danger",
|
|
195
232
|
message: formatMessage({
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type OverrideCheckboxProps = {
|
|
2
|
+
isOverride: boolean;
|
|
3
|
+
setIsOverride: (value: boolean) => void;
|
|
4
|
+
disabledCondition?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare function OverrideCheckbox({ isOverride, setIsOverride, disabledCondition }: OverrideCheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default OverrideCheckbox;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ConfigContentType } from '../../../../types';
|
|
3
|
+
import type { PanelAction, PanelPathState } from '../../types';
|
|
4
|
+
type PathInputProps = {
|
|
5
|
+
path: PanelPathState;
|
|
6
|
+
dispatchPath: React.Dispatch<PanelAction>;
|
|
7
|
+
isOverride: boolean;
|
|
8
|
+
config: ConfigContentType;
|
|
9
|
+
};
|
|
10
|
+
declare function PathInput({ path, dispatchPath, isOverride, config }: PathInputProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default PathInput;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
interface PathProps {
|
|
2
2
|
validationState: 'initial' | 'checking' | 'done';
|
|
3
|
-
replacement: string;
|
|
4
|
-
setUrlStatus?: (isValid: 'valid' | 'invalid') => void;
|
|
3
|
+
replacement: string | null;
|
|
5
4
|
}
|
|
6
|
-
export default function PathInfo({ validationState, replacement
|
|
5
|
+
export default function PathInfo({ validationState, replacement }: PathProps): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export {};
|
|
@@ -2,7 +2,7 @@ import { NestedNavItem } from '../../../../../types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
type externalCreateProps = {
|
|
4
4
|
variant: 'ExternalCreate';
|
|
5
|
-
|
|
5
|
+
actionItemParentId?: string;
|
|
6
6
|
onCreate: (newItem: NestedNavItem) => void;
|
|
7
7
|
};
|
|
8
8
|
type externalEditProps = {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Route, NestedNavItem, NestedNavigation } from '../../../../../types';
|
|
2
|
+
import type { ModalItem_VariantCreate } from '../../../types';
|
|
3
|
+
import { useModalSharedLogic } from '../useModalSharedLogic';
|
|
4
|
+
type ItemDetailsProps = Pick<ModalItem_VariantCreate & ReturnType<typeof useModalSharedLogic>, 'navItemState' | 'dispatchNavItemState' | 'path' | 'dispatchPath' | 'validationState' | 'debouncedCheckUrl'> & {
|
|
5
|
+
route: Route;
|
|
6
|
+
parentNavItem?: NestedNavItem | null;
|
|
7
|
+
navigationItems?: NestedNavItem[] | null;
|
|
8
|
+
navigations?: NestedNavigation[] | null;
|
|
9
|
+
item?: NestedNavItem;
|
|
10
|
+
modalVariant: 'create' | 'edit';
|
|
11
|
+
};
|
|
12
|
+
export default function ItemDetails({ navItemState, dispatchNavItemState, path, dispatchPath, validationState, parentNavItem, navigationItems, navigations, debouncedCheckUrl, item, route, modalVariant, }: ItemDetailsProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { modalSharedLogic } from '
|
|
1
|
+
import type { modalSharedLogic } from '../../types';
|
|
2
2
|
export declare function useModalSharedLogic(): modalSharedLogic;
|
|
@@ -2,7 +2,7 @@ import { NestedNavItem } from '../../../../../types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
type wrapperCreateProps = {
|
|
4
4
|
variant: 'WrapperCreate';
|
|
5
|
-
|
|
5
|
+
actionItemParentId?: string;
|
|
6
6
|
onCreate: (newItem: NestedNavItem) => void;
|
|
7
7
|
};
|
|
8
8
|
type wrapperEditProps = {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Route, GroupedEntities,
|
|
1
|
+
import { Route, GroupedEntities, StructuredNavigationVariant, NavigationInput, NestedNavItem } from '../../../types';
|
|
2
2
|
export default function useApi(): {
|
|
3
3
|
fetchAllContentTypes: () => Promise<any>;
|
|
4
4
|
fetchConfiguredContentTypes: () => Promise<any>;
|
|
5
5
|
fetchAllEntities: () => Promise<GroupedEntities[]>;
|
|
6
6
|
getRelatedRoute: (relatedDocumentId: string) => Promise<Route>;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
getRoute: (documentId: string) => Promise<Route>;
|
|
8
|
+
getAllRoutes: () => Promise<Route[]>;
|
|
9
|
+
getProhibitedRouteIds: (documentId?: string) => Promise<string[]>;
|
|
9
10
|
getNavigation: ({ documentId, variant }?: {
|
|
10
11
|
documentId?: string;
|
|
11
12
|
variant?: StructuredNavigationVariant | "namesOnly";
|
|
@@ -1,17 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export interface RouteItemProps {
|
|
4
|
-
item: NestedNavItem;
|
|
5
|
-
setParentId: (id: string) => void;
|
|
6
|
-
setActionItem: React.Dispatch<React.SetStateAction<NestedNavItem | NestedNavigation | undefined>>;
|
|
7
|
-
setNavigationItems: React.Dispatch<React.SetStateAction<NestedNavItem[] | undefined>>;
|
|
8
|
-
ghost?: boolean;
|
|
9
|
-
depth?: number;
|
|
10
|
-
maxDepth: number;
|
|
11
|
-
style?: React.CSSProperties;
|
|
12
|
-
wrapperRef?(node: HTMLLIElement): void;
|
|
13
|
-
handleProps?: any;
|
|
14
|
-
disableInteraction?: boolean;
|
|
15
|
-
indentationWidth?: number;
|
|
16
|
-
}
|
|
2
|
+
import { RouteItemProps } from '../../types';
|
|
17
3
|
export declare const RouteItem: import("react").ForwardRefExoticComponent<RouteItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NestedNavItem } from '../../../../types';
|
|
2
|
+
export default function RouteItemMenu({ item, depth, maxDepth, handleEdit, handleAddChildren, handleDelete, handleRestore }: {
|
|
3
|
+
item: NestedNavItem;
|
|
4
|
+
depth?: number;
|
|
5
|
+
maxDepth: number;
|
|
6
|
+
handleEdit: () => void;
|
|
7
|
+
handleAddChildren: () => void;
|
|
8
|
+
handleDelete: () => void;
|
|
9
|
+
handleRestore: () => void;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RouteItemProps } from '
|
|
1
|
+
import { RouteItemProps } from '../../types';
|
|
2
2
|
export default function SortableRouteItem({ item, depth, setNavigationItems, ...props }: RouteItemProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { GroupedEntities, NestedNavItem, NestedNavigation, RouteSettings } from '../../../types';
|
|
3
|
+
import type { PanelPathState, PanelAction } from '../types';
|
|
4
|
+
export type ModalItem_VariantCreate = {
|
|
5
|
+
actionItemParent: NestedNavItem | null;
|
|
6
|
+
navigationItems?: NestedNavItem[] | null;
|
|
7
|
+
navigations: NestedNavigation[] | null;
|
|
8
|
+
onCreate: (newItem: NestedNavItem) => void;
|
|
9
|
+
};
|
|
10
|
+
export type ModalItem_VariantEdit = {
|
|
11
|
+
item: NestedNavItem;
|
|
12
|
+
navigationItems?: NestedNavItem[] | null;
|
|
13
|
+
onEdit: (editedItem: NestedNavItem) => void;
|
|
14
|
+
};
|
|
15
|
+
export type modalSharedLogic = {
|
|
16
|
+
availableEntities: GroupedEntities[];
|
|
17
|
+
selectedContentType: GroupedEntities | undefined;
|
|
18
|
+
setSelectedContentType: (value: GroupedEntities) => void;
|
|
19
|
+
entities: GroupedEntities[];
|
|
20
|
+
validationState: 'initial' | 'checking' | 'done';
|
|
21
|
+
setValidationState: (value: 'initial' | 'checking' | 'done') => void;
|
|
22
|
+
initialState: React.RefObject<RouteSettings>;
|
|
23
|
+
navItemState: RouteSettings;
|
|
24
|
+
dispatchNavItemState: React.Dispatch<any>;
|
|
25
|
+
path: ExtendedPanelPathState;
|
|
26
|
+
dispatchPath: React.Dispatch<ExtendedPanelAction>;
|
|
27
|
+
debouncedCheckUrl: ({ url, routeDocumentId, withoutTransform }: {
|
|
28
|
+
url: string;
|
|
29
|
+
routeDocumentId?: string | null;
|
|
30
|
+
withoutTransform?: boolean;
|
|
31
|
+
}) => void;
|
|
32
|
+
modalType: string;
|
|
33
|
+
setModalType: (value: string) => void;
|
|
34
|
+
selectedNavigation: NestedNavigation | undefined;
|
|
35
|
+
};
|
|
36
|
+
export type ExtendedPanelPathState = PanelPathState & {
|
|
37
|
+
initialPath: string;
|
|
38
|
+
slug: string;
|
|
39
|
+
};
|
|
40
|
+
export type ExtendedPanelAction = PanelAction | {
|
|
41
|
+
type: 'SET_INITIALPATH';
|
|
42
|
+
payload: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: 'SET_SLUG';
|
|
45
|
+
payload: string;
|
|
46
|
+
};
|
|
47
|
+
export type navItemStateAction = {
|
|
48
|
+
type: 'SET_TITLE';
|
|
49
|
+
payload: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'SET_ACTIVE';
|
|
52
|
+
payload: boolean;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'SET_OVERRIDE';
|
|
55
|
+
payload: boolean;
|
|
56
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { NestedNavItem, NestedNavigation } from '../../../types';
|
|
3
|
+
export type RouteItemProps = {
|
|
4
|
+
item: NestedNavItem;
|
|
5
|
+
initialItem?: NestedNavItem;
|
|
6
|
+
setActionItemParent: (item: NestedNavItem | null) => void;
|
|
7
|
+
setActionItem: React.Dispatch<React.SetStateAction<NestedNavItem | NestedNavigation | undefined>>;
|
|
8
|
+
setNavigationItems: React.Dispatch<React.SetStateAction<NestedNavItem[] | undefined>>;
|
|
9
|
+
ghost?: boolean;
|
|
10
|
+
depth?: number;
|
|
11
|
+
maxDepth: number;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
wrapperRef?(node: HTMLLIElement): void;
|
|
14
|
+
handleProps?: any;
|
|
15
|
+
disableInteraction?: boolean;
|
|
16
|
+
indentationWidth?: number;
|
|
17
|
+
navigationItems?: NestedNavItem[] | null;
|
|
18
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Route } from "../../../types";
|
|
2
|
+
export type PanelAction = {
|
|
3
|
+
type: 'DEFAULT';
|
|
4
|
+
payload: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'NO_URL_CHECK';
|
|
7
|
+
payload: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'NO_TRANSFORM_AND_CHECK';
|
|
10
|
+
payload: string;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'RESET_URL_CHECK_FLAG';
|
|
13
|
+
} | {
|
|
14
|
+
type: 'SET_REPLACEMENT';
|
|
15
|
+
payload: string;
|
|
16
|
+
} | {
|
|
17
|
+
type: 'SET_UIDPATH';
|
|
18
|
+
payload: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'SET_CANONICALPATH';
|
|
21
|
+
payload: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'SET_OVERRIDEPATH';
|
|
24
|
+
payload: string;
|
|
25
|
+
};
|
|
26
|
+
export type PanelPathState = {
|
|
27
|
+
value?: string;
|
|
28
|
+
prevValue?: string;
|
|
29
|
+
uidPath?: string;
|
|
30
|
+
needsUrlCheck: boolean;
|
|
31
|
+
replacement: string | null;
|
|
32
|
+
canonicalPath?: string;
|
|
33
|
+
overridePath?: string;
|
|
34
|
+
};
|
|
35
|
+
export type RouteStructureProps = {
|
|
36
|
+
canonicalPath?: string;
|
|
37
|
+
routes: Route[];
|
|
38
|
+
selectedParent: Route | null;
|
|
39
|
+
setSelectedParent: (value: Route | null) => void;
|
|
40
|
+
prohibitedRouteIds?: string[];
|
|
41
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Route } from '../../../types/';
|
|
2
|
-
export type RouteSortKey = keyof Pick<Route, 'title' | 'path' | 'type'>;
|
|
2
|
+
export type RouteSortKey = keyof Pick<Route, 'title' | 'canonicalPath' | 'path' | 'type'>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NestedNavItem } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a string representing the navigation hierarchy for a given target item.
|
|
4
|
+
*
|
|
5
|
+
* Traverses a flat, depth-annotated array of navigation items to construct a breadcrumb-like
|
|
6
|
+
* hierarchy string (e.g., "Parent > Child > Target") for the specified target item.
|
|
7
|
+
*
|
|
8
|
+
* @param navigationItems - Flat array of NestedNavItem, ordered so that parents precede children.
|
|
9
|
+
* @param targetItem - The navigation item for which to build the hierarchy string. Must have a valid depth property.
|
|
10
|
+
* @returns The navigation hierarchy as a string (e.g., "Parent > Child > Target"), or null if the target is not found or input is invalid.
|
|
11
|
+
*/
|
|
12
|
+
export default function buildBreadcrumbString({ navigationItems, targetItem, includeTarget, }: {
|
|
13
|
+
navigationItems?: NestedNavItem[] | null;
|
|
14
|
+
targetItem: NestedNavItem;
|
|
15
|
+
includeTarget?: boolean;
|
|
16
|
+
}): string | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { NestedNavItem, Entity, GroupedEntities } from '../../../types';
|
|
1
|
+
import type { NestedNavItem, Entity, GroupedEntities, RouteType } from '../../../types';
|
|
2
|
+
import type { ExtendedPanelPathState } from '../types';
|
|
2
3
|
type CreateTempNavItemObjectParams = {
|
|
3
|
-
|
|
4
|
+
actionItemParentId: string | undefined;
|
|
4
5
|
entityRoute: {
|
|
5
6
|
documentId: string;
|
|
6
7
|
} | null;
|
|
@@ -14,11 +15,8 @@ type CreateTempNavItemObjectParams = {
|
|
|
14
15
|
};
|
|
15
16
|
selectedEntity: Entity | undefined | null;
|
|
16
17
|
selectedContentType: GroupedEntities | undefined | null;
|
|
17
|
-
path?:
|
|
18
|
-
|
|
19
|
-
uidPath: string;
|
|
20
|
-
};
|
|
21
|
-
type?: 'internal' | 'external' | 'wrapper';
|
|
18
|
+
path?: ExtendedPanelPathState;
|
|
19
|
+
type?: RouteType;
|
|
22
20
|
};
|
|
23
|
-
export default function createTempNavItemObject({
|
|
21
|
+
export default function createTempNavItemObject({ actionItemParentId, entityRoute, selectedNavigation, navItemState, selectedEntity, selectedContentType, path, type, }: CreateTempNavItemObjectParams): NestedNavItem;
|
|
24
22
|
export {};
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks if a URL is unique by making a GET request to the checkUniquePath endpoint.
|
|
3
|
-
* @param
|
|
4
|
-
* @param
|
|
3
|
+
* @param fetchFunction The authenticated fetch function to make the request
|
|
4
|
+
* @param path The path to check for uniqueness.
|
|
5
5
|
* @param routeDocumentId The ID of the route to exclude from the check.
|
|
6
|
-
* @
|
|
6
|
+
* @param withoutTransform If true, the path will not be transformed/normalized before checking.
|
|
7
|
+
* @returns A promise that resolves to the unique path if the request is successful.
|
|
7
8
|
* @throws {Error} Throws an error if the request fails or the network response is not ok.
|
|
8
9
|
*/
|
|
9
|
-
export default function duplicateCheck(
|
|
10
|
+
export default function duplicateCheck({ fetchFunction, path, routeDocumentId, withoutTransform, }: {
|
|
11
|
+
fetchFunction: (path: string) => Promise<any>;
|
|
12
|
+
path: string;
|
|
13
|
+
routeDocumentId?: string | null;
|
|
14
|
+
withoutTransform?: boolean;
|
|
15
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NestedNavItem } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Finds the parent navigation item of a given target item in a flat, depth-annotated array.
|
|
4
|
+
*
|
|
5
|
+
* @param navigationItems - Flat array of NestedNavItem, ordered such that parents precede children.
|
|
6
|
+
* @param targetItem - The item whose parent is to be found. Must have a valid depth property.
|
|
7
|
+
* @returns The parent NestedNavItem if found, otherwise null.
|
|
8
|
+
*/
|
|
9
|
+
export default function findParentNavItem({ navigationItems, targetItem, onlyInternalItems, }: {
|
|
10
|
+
navigationItems?: NestedNavItem[] | null;
|
|
11
|
+
targetItem: NestedNavItem;
|
|
12
|
+
onlyInternalItems?: boolean;
|
|
13
|
+
}): NestedNavItem | null;
|
|
@@ -2,6 +2,7 @@ import debounce from "./debounce";
|
|
|
2
2
|
import duplicateCheck from "./duplicateCheck";
|
|
3
3
|
import { isNestedNavigation, isNestedNavItem } from "./typeChecks";
|
|
4
4
|
import getTranslation from "./getTranslation";
|
|
5
|
-
import countChildren from "./countChildren";
|
|
6
5
|
import createTempNavItemObject from "./createTempNavItemObject";
|
|
7
|
-
|
|
6
|
+
import findParentNavItem from "./findParentNavItem";
|
|
7
|
+
import buildBreadcrumbString from "./buildBreadcrumbString";
|
|
8
|
+
export { debounce, duplicateCheck, isNestedNavigation, isNestedNavItem, getTranslation, createTempNavItemObject, findParentNavItem, buildBreadcrumbString, };
|