@open-mercato/ui 0.8.1-develop.7228.1.b7ea09d2d3 → 0.8.1-develop.7238.1.3abe669ea5

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.
@@ -1,3 +1,3 @@
1
- Generated lucide registry with 169 icons -> /home/runner/work/open-mercato/open-mercato/packages/ui/src/backend/icons/lucideRegistry.generated.tsx
1
+ Generated lucide registry with 170 icons -> /home/runner/work/open-mercato/open-mercato/packages/ui/src/backend/icons/lucideRegistry.generated.tsx
2
2
  [build:ui] found 450 entry points
3
3
  [build:ui] built successfully
@@ -173,6 +173,12 @@ function buildResolvedEntityIdsKey(entityId, entityIds) {
173
173
  }
174
174
  return list.join("\0");
175
175
  }
176
+ function mergeByKey(primary, legacy, keyOf) {
177
+ if (!legacy.length) return primary;
178
+ const seen = new Set(primary.map(keyOf));
179
+ const extra = legacy.filter((item) => !seen.has(keyOf(item)));
180
+ return extra.length ? [...primary, ...extra] : primary;
181
+ }
176
182
  function readByDotPath(source, path) {
177
183
  if (!source || !path) return void 0;
178
184
  if (Object.prototype.hasOwnProperty.call(source, path)) return source[path];
@@ -393,6 +399,7 @@ function CrudForm({
393
399
  customFieldsetBindings,
394
400
  customFieldsManageMode = "inline",
395
401
  injectionSpotId,
402
+ legacyInjectionSpotId,
396
403
  replacementHandle,
397
404
  collapsibleGroups,
398
405
  sortableGroups,
@@ -480,6 +487,7 @@ function CrudForm({
480
487
  return ComponentReplacementHandles.crudForm("unknown");
481
488
  }, [replacementHandle, resolvedEntityIds]);
482
489
  const headerInjectionSpotId = resolvedInjectionSpotId ? extensionSpotChildId(resolvedInjectionSpotId, "header") : void 0;
490
+ const legacyHeaderInjectionSpotId = legacyInjectionSpotId ? extensionSpotChildId(legacyInjectionSpotId, "header") : void 0;
483
491
  const recordId = React.useMemo(() => {
484
492
  const raw = values.id;
485
493
  if (typeof raw === "string") return raw;
@@ -716,13 +724,28 @@ function CrudForm({
716
724
  window.history.replaceState = originalReplaceState;
717
725
  };
718
726
  }, [allowNextNavigation, clearDirtyState, confirmUnsavedChanges, embedded, hasUnsavedChanges, router, trackDirtyWhenEmbedded]);
719
- const { widgets: injectionWidgets } = useInjectionWidgets(resolvedInjectionSpotId, {
727
+ const { widgets: primaryInjectionWidgets } = useInjectionWidgets(resolvedInjectionSpotId, {
728
+ context: injectionContext,
729
+ triggerOnLoad: true
730
+ });
731
+ const { widgets: legacyInjectionWidgets } = useInjectionWidgets(legacyInjectionSpotId, {
720
732
  context: injectionContext,
721
733
  triggerOnLoad: true
722
734
  });
723
- const { widgets: injectedFieldWidgets } = useInjectionDataWidgets(
735
+ const injectionWidgets = React.useMemo(
736
+ () => mergeByKey(primaryInjectionWidgets, legacyInjectionWidgets, (w) => w.widgetId),
737
+ [primaryInjectionWidgets, legacyInjectionWidgets]
738
+ );
739
+ const { widgets: primaryFieldWidgets } = useInjectionDataWidgets(
724
740
  resolvedInjectionSpotId ? extensionSpotChildId(resolvedInjectionSpotId, "fields") : "__disabled__:fields"
725
741
  );
742
+ const { widgets: legacyFieldWidgets } = useInjectionDataWidgets(
743
+ legacyInjectionSpotId ? extensionSpotChildId(legacyInjectionSpotId, "fields") : "__disabled__:fields"
744
+ );
745
+ const injectedFieldWidgets = React.useMemo(
746
+ () => mergeByKey(primaryFieldWidgets, legacyFieldWidgets, (w) => w.metadata.id),
747
+ [primaryFieldWidgets, legacyFieldWidgets]
748
+ );
726
749
  const { triggerEvent: triggerInjectionEvent } = useInjectionSpotEvents(resolvedInjectionSpotId ?? "", injectionWidgets);
727
750
  const extendedInjectionEventsEnabled = CRUDFORM_EXTENDED_EVENTS_ENABLED && Boolean(resolvedInjectionSpotId);
728
751
  const widgetRequiredFieldIds = React.useMemo(() => {
@@ -1063,16 +1086,28 @@ function CrudForm({
1063
1086
  autoCheckAcl: versionHistory?.autoCheckAcl
1064
1087
  }
1065
1088
  );
1066
- const headerInjectionAction = headerInjectionSpotId ? /* @__PURE__ */ jsx(
1067
- InjectionSpot,
1068
- {
1069
- spotId: headerInjectionSpotId,
1070
- context: injectionContext,
1071
- data: values,
1072
- onDataChange: (newData) => setValues(newData),
1073
- disabled: pending
1074
- }
1075
- ) : null;
1089
+ const headerInjectionAction = headerInjectionSpotId || legacyHeaderInjectionSpotId ? /* @__PURE__ */ jsxs(Fragment, { children: [
1090
+ headerInjectionSpotId ? /* @__PURE__ */ jsx(
1091
+ InjectionSpot,
1092
+ {
1093
+ spotId: headerInjectionSpotId,
1094
+ context: injectionContext,
1095
+ data: values,
1096
+ onDataChange: (newData) => setValues(newData),
1097
+ disabled: pending
1098
+ }
1099
+ ) : null,
1100
+ legacyHeaderInjectionSpotId ? /* @__PURE__ */ jsx(
1101
+ InjectionSpot,
1102
+ {
1103
+ spotId: legacyHeaderInjectionSpotId,
1104
+ context: injectionContext,
1105
+ data: values,
1106
+ onDataChange: (newData) => setValues(newData),
1107
+ disabled: pending
1108
+ }
1109
+ ) : null
1110
+ ] }) : null;
1076
1111
  const headerExtraActions = versionHistoryEnabled || headerInjectionAction || extraActions ? /* @__PURE__ */ jsxs(Fragment, { children: [
1077
1112
  versionHistoryEnabled ? versionHistoryAction : null,
1078
1113
  headerInjectionAction,