@juicemantics/veloiq-ui 0.6.0 → 0.7.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/dist/index.mjs CHANGED
@@ -992,7 +992,7 @@ var CommandCenterPortal = ({
992
992
  }, [query, parsedCommand, search, clear]);
993
993
  const allModelChildren = useMemo(
994
994
  () => menuItems.flatMap(
995
- (m) => (m.children || []).map((c) => ({ ...c, moduleLabel: String(m.label || m.name || "") }))
995
+ (m) => (m.children || []).filter((c) => !c.meta?.hide).map((c) => ({ ...c, moduleLabel: String(m.label || m.name || "") }))
996
996
  ),
997
997
  [menuItems]
998
998
  );
@@ -1010,8 +1010,8 @@ var CommandCenterPortal = ({
1010
1010
  }, [allModelChildren]);
1011
1011
  const modules = useMemo(() => {
1012
1012
  const q2 = parsedCommand ? parsedCommand.modelQuery : query.toLowerCase().trim();
1013
- const moduleItems = menuItems.filter((item) => item.children && item.children.length > 0);
1014
- const sorted = navConfig.length > 0 ? sortItemsByNavConfig(moduleItems, navConfig) : moduleItems;
1013
+ const visibleModules = menuItems.filter((item) => item.children && item.children.length > 0).map((item) => ({ ...item, children: (item.children || []).filter((c) => !c.meta?.hide) })).filter((item) => item.children && item.children.length > 0);
1014
+ const sorted = navConfig.length > 0 ? sortItemsByNavConfig(visibleModules, navConfig) : visibleModules;
1015
1015
  if (!q2) return sorted;
1016
1016
  return sorted.map((module) => {
1017
1017
  const moduleMatch = (module.label || "").toLowerCase().includes(q2);
@@ -20130,18 +20130,38 @@ var DynamicList = ({ model: modelProp, allModels, filter, relationConfig, isEmbe
20130
20130
 
20131
20131
  // src/components/MultiPane/paneUtils.ts
20132
20132
  function parsePanes(searchParams) {
20133
- return searchParams.getAll("pane").map((param) => {
20134
- const colonIdx = param.indexOf(":");
20135
- if (colonIdx < 1) return null;
20136
- const resource = param.slice(0, colonIdx);
20137
- const id = param.slice(colonIdx + 1);
20138
- if (!resource || !id) return null;
20139
- return { resource, id };
20140
- }).filter((p) => p !== null);
20133
+ const standard = searchParams.getAll("pane");
20134
+ if (standard.length > 0) {
20135
+ return standard.map((param) => {
20136
+ const colonIdx = param.indexOf(":");
20137
+ if (colonIdx < 1) return null;
20138
+ const resource = param.slice(0, colonIdx);
20139
+ const id = param.slice(colonIdx + 1);
20140
+ if (!resource || !id) return null;
20141
+ return { resource, id };
20142
+ }).filter((p) => p !== null);
20143
+ }
20144
+ const legacy = [];
20145
+ for (const [key, value] of searchParams.entries()) {
20146
+ if (/^pane(?:\[\d*\])?$/.test(key)) {
20147
+ const colonIdx = value.indexOf(":");
20148
+ if (colonIdx < 1) continue;
20149
+ const resource = value.slice(0, colonIdx);
20150
+ const id = value.slice(colonIdx + 1);
20151
+ if (resource && id) {
20152
+ legacy.push({ resource, id });
20153
+ }
20154
+ }
20155
+ }
20156
+ return legacy;
20141
20157
  }
20142
20158
  function applyPanesToSearchParams(existing, panes) {
20143
20159
  const next = new URLSearchParams(existing);
20144
- next.delete("pane");
20160
+ for (const [key] of existing.entries()) {
20161
+ if (key === "pane" || /^pane\[\d+\]$/.test(key)) {
20162
+ next.delete(key);
20163
+ }
20164
+ }
20145
20165
  panes.forEach((p) => next.append("pane", `${p.resource}:${p.id}`));
20146
20166
  return next;
20147
20167
  }
@@ -20294,11 +20314,15 @@ var MultiPaneLayout = ({ children }) => {
20294
20314
  useEffect(() => {
20295
20315
  const newCount = panes.length;
20296
20316
  const prevCount = prevPaneCountRef.current;
20297
- prevPaneCountRef.current = newCount;
20298
- if (newCount <= prevCount || !pendingLayoutRef.current || !groupRef.current) {
20317
+ if (!pendingLayoutRef.current || !groupRef.current) {
20299
20318
  pendingLayoutRef.current = null;
20300
20319
  return;
20301
20320
  }
20321
+ if (newCount <= prevCount) {
20322
+ pendingLayoutRef.current = null;
20323
+ return;
20324
+ }
20325
+ prevPaneCountRef.current = newCount;
20302
20326
  const prevLayout = pendingLayoutRef.current;
20303
20327
  pendingLayoutRef.current = null;
20304
20328
  const donorId = prevCount === 0 ? LIST_PANEL_ID : detailPanelId(prevCount - 1);
@@ -21753,7 +21777,7 @@ function generateResources(models, moduleName, options = {}) {
21753
21777
  };
21754
21778
  const children = (models || []).map((model) => {
21755
21779
  const resource = model.resource || model.name;
21756
- const isRelation = hideRelations && (resource.toLowerCase().endsWith("_relation") || resource.toLowerCase().endsWith("_rela") || Array.isArray(model.fields) && model.fields.some((f) => f?.key === "eid_from") && model.fields.some((f) => f?.key === "eid_to"));
21780
+ const isRelation = hideRelations && (resource.toLowerCase().endsWith("_relation") || resource.toLowerCase().endsWith("_rela") || (Array.isArray(model.fields) && model.fields.some((f) => f?.key === "eid_from") && model.fields.some((f) => f?.key === "eid_to") || model.fields.length > 0 && model.fields.every((f) => !!f?.reference)));
21757
21781
  return {
21758
21782
  name: resource,
21759
21783
  list: `/${resource}`,