@firecms/core 3.0.0-canary.231 → 3.0.0-canary.233

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.umd.js CHANGED
@@ -69,49 +69,66 @@
69
69
  return cleanPath;
70
70
  }
71
71
  function resolveCollectionPathIds(path, allCollections) {
72
- const cleanPath = removeInitialAndTrailingSlashes(path);
73
- const subpaths = cleanPath.split("/");
74
- if (subpaths.length % 2 === 0) {
75
- throw Error(`resolveCollectionPathIds: Collection paths must have an odd number of segments: ${path}`);
76
- }
77
- const exactMatch = allCollections.find((col) => col.path === cleanPath);
78
- if (exactMatch) {
79
- return exactMatch.path;
80
- }
81
- if (subpaths.length === 1) {
82
- const aliasedCollection = allCollections.find((col) => col.id === subpaths[0]);
83
- return aliasedCollection?.path ?? subpaths[0];
84
- }
85
- let matchingCollection;
86
- let entityIndex = 1;
87
- for (const collection of allCollections) {
88
- const pathSegments = collection.path.split("/");
89
- if (pathSegments.length > 1 && subpaths.slice(0, pathSegments.length).join("/") === collection.path) {
90
- matchingCollection = collection;
91
- entityIndex = pathSegments.length;
72
+ let remainingPath = removeInitialAndTrailingSlashes(path);
73
+ if (!remainingPath) {
74
+ return "";
75
+ }
76
+ let currentCollections = allCollections;
77
+ const resolvedPathParts = [];
78
+ while (remainingPath.length > 0) {
79
+ if (!currentCollections || currentCollections.length === 0) {
80
+ console.warn(`resolveCollectionPathIds: Path structure implies subcollections, but none found before segment starting with "${remainingPath}" in original path "${path}". Appending remaining original path.`);
81
+ resolvedPathParts.push(remainingPath);
82
+ remainingPath = "";
92
83
  break;
93
84
  }
94
- }
95
- if (!matchingCollection) {
96
- const matchingCollections = allCollections.filter((col) => col.id === subpaths[0] || col.path === subpaths[0]);
97
- if (!matchingCollections.length) {
98
- return cleanPath;
85
+ let foundMatch = false;
86
+ const potentialMatches = currentCollections.flatMap((col) => [{
87
+ col,
88
+ match: col.path
89
+ }, {
90
+ col,
91
+ match: col.id
92
+ }]).filter((p) => p.match && remainingPath.startsWith(p.match)).sort((a, b) => b.match.length - a.match.length);
93
+ if (potentialMatches.length > 0) {
94
+ const {
95
+ col: foundCollection,
96
+ match: matchString
97
+ } = potentialMatches[0];
98
+ resolvedPathParts.push(foundCollection.path);
99
+ remainingPath = removeInitialSlash(remainingPath.substring(matchString.length));
100
+ if (remainingPath.length === 0) {
101
+ foundMatch = true;
102
+ break;
103
+ }
104
+ const idSeparatorIndex = remainingPath.indexOf("/");
105
+ let entityId;
106
+ if (idSeparatorIndex > -1) {
107
+ entityId = remainingPath.substring(0, idSeparatorIndex);
108
+ remainingPath = remainingPath.substring(idSeparatorIndex + 1);
109
+ } else {
110
+ entityId = remainingPath;
111
+ remainingPath = "";
112
+ console.warn(`resolveCollectionPathIds: Path seems to end with an entity ID "${entityId}" instead of a collection segment in original path "${path}". This might indicate an invalid input path.`);
113
+ }
114
+ resolvedPathParts.push(entityId);
115
+ currentCollections = foundCollection.subcollections;
116
+ foundMatch = true;
117
+ if (!currentCollections && remainingPath.length > 0) {
118
+ console.warn(`resolveCollectionPathIds: Path continues after entity ID "${entityId}", but no subcollections are defined for the preceding collection "${foundCollection.path}" in path "${path}". Appending remaining original path.`);
119
+ resolvedPathParts.push(remainingPath);
120
+ remainingPath = "";
121
+ break;
122
+ }
99
123
  }
100
- matchingCollection = matchingCollections[0];
101
- }
102
- const entityId = subpaths[entityIndex];
103
- const remainingPath = subpaths.slice(entityIndex + 1);
104
- if (remainingPath.length > 0) {
105
- const subcollectionId = remainingPath[0];
106
- const subcollection = matchingCollection.subcollections?.find((subcol) => subcol.id === subcollectionId);
107
- if (subcollection) {
108
- return `${matchingCollection.path}/${entityId}/${subcollection.path}`;
124
+ if (!foundMatch) {
125
+ console.warn(`resolveCollectionPathIds: Collection definition not found for segment starting with "${remainingPath}" in original path "${path}". Appending remaining original path.`);
126
+ resolvedPathParts.push(remainingPath);
127
+ remainingPath = "";
128
+ break;
109
129
  }
110
130
  }
111
- if (remainingPath.length === 0) {
112
- return `${matchingCollection.path}/${entityId}`;
113
- }
114
- return `${matchingCollection.path}/${entityId}/${remainingPath.join("/")}`;
131
+ return resolvedPathParts.join("/");
115
132
  }
116
133
  function getCollectionByPathOrId(pathOrId, collections) {
117
134
  const subpaths = removeInitialAndTrailingSlashes(pathOrId).split("/");
@@ -6497,7 +6514,7 @@
6497
6514
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls(ui.defaultBorderMixin, "last:border-b-0 border-b"), children: [
6498
6515
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row pt-0.5 pb-0.5 gap-2", children: [
6499
6516
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-[140px] w-[25%] py-1", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", className: "font-mono break-words", color: "secondary", children: key }) }, `table-cell-title-${key}-${key}`),
6500
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow max-w-[75%]", children: childValue && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: childValue.toString() }) }) })
6517
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow max-w-[75%]", children: childValue && typeof childValue !== "object" && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: childValue.toString() }) }) })
6501
6518
  ] }),
6502
6519
  typeof childValue === "object" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls(ui.defaultBorderMixin, "border-l pl-4"), children: /* @__PURE__ */ jsxRuntime.jsx(KeyValuePreview, { value: childValue }) })
6503
6520
  ] }, `map_preview_table_${key}}`);
@@ -16641,6 +16658,7 @@
16641
16658
  t6 = $[15];
16642
16659
  }
16643
16660
  const title = t6;
16661
+ console.log("minimalistView", propertyKey, minimalistView);
16644
16662
  let t7;
16645
16663
  if ($[16] !== expanded || $[17] !== mapFormView || $[18] !== minimalistView || $[19] !== title) {
16646
16664
  t7 = !minimalistView && /* @__PURE__ */ jsxRuntime.jsx(ui.ExpandablePanel, { initiallyExpanded: expanded, title, innerClassName: "px-2 md:px-4 pb-2 md:pb-4 pt-1 md:pt-2", children: mapFormView });
@@ -18262,7 +18280,7 @@
18262
18280
  underlyingValueHasChanged: false,
18263
18281
  context: formContext,
18264
18282
  partOfArray: false,
18265
- minimalistView: false,
18283
+ minimalistView: true,
18266
18284
  autoFocus: open
18267
18285
  } : void 0;
18268
18286
  let internalForm = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[700px] max-w-full max-h-[85vh]", children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, noValidate: true, children: [
@@ -18314,7 +18332,7 @@
18314
18332
  if ((filterIsSet || sortIsSet) && (tableController.clearFilter || tableController.setSortBy)) {
18315
18333
  let label;
18316
18334
  if (filterIsSet && sortIsSet) {
18317
- label = "Clear filter and sort";
18335
+ label = "Clear filter/sort";
18318
18336
  } else {
18319
18337
  if (filterIsSet) {
18320
18338
  label = "Clear filter";