@mercurjs/dashboard-shared 2.4.1 → 2.4.2-canary.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.d.ts +39 -5
- package/dist/index.js +140 -59
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1946,6 +1946,17 @@ type LayeredRoute = {
|
|
|
1946
1946
|
path: string;
|
|
1947
1947
|
children?: LayeredRoute[];
|
|
1948
1948
|
};
|
|
1949
|
+
type LazyModule = {
|
|
1950
|
+
Component?: ComponentType<RenderDefaultProps> | null;
|
|
1951
|
+
handle?: unknown;
|
|
1952
|
+
};
|
|
1953
|
+
/**
|
|
1954
|
+
* Overrides a built-in page's lazy route with an extension's, handing the
|
|
1955
|
+
* built-in component to the extension as `renderDefault`. The built-in loader
|
|
1956
|
+
* is kept unless the extension declares its own, so `renderDefault` still has
|
|
1957
|
+
* the data it reads.
|
|
1958
|
+
*/
|
|
1959
|
+
declare function overrideLazyRoute<T extends LazyModule>(previous: () => Promise<T>, next: () => Promise<T>): () => Promise<T>;
|
|
1949
1960
|
/**
|
|
1950
1961
|
* Collapses routes emitted in layer order so the last route at a path wins and
|
|
1951
1962
|
* receives the previous page as `renderDefault`. Parallel (modal) children at
|
|
@@ -2115,7 +2126,7 @@ type ExtendableFormFieldProps<TFieldValues extends FieldValues = FieldValues, TC
|
|
|
2115
2126
|
/**
|
|
2116
2127
|
* Wraps one of a form's own fields so `forms[].fields[id]` can replace it (the
|
|
2117
2128
|
* replacement binds to the same form key; validation stays the base schema's)
|
|
2118
|
-
* or remove it (`null`, the field keeps its default value).
|
|
2129
|
+
* or remove it (`null` or `hidden`, the field keeps its default value).
|
|
2119
2130
|
*/
|
|
2120
2131
|
declare const ExtendableFormField: <TFieldValues extends FieldValues, TContext, TTransformed>({ model, zone, tab, id, control, data, children, }: ExtendableFormFieldProps<TFieldValues, TContext, TTransformed>) => react_jsx_runtime.JSX.Element | null;
|
|
2121
2132
|
|
|
@@ -2253,12 +2264,35 @@ type UseExtendableGridProps<TData> = {
|
|
|
2253
2264
|
/**
|
|
2254
2265
|
* Applies a form tab's `forms[].fields` to a data grid, the way
|
|
2255
2266
|
* `<ExtendableFormField>` does for a regular form: a base column id + `null`
|
|
2256
|
-
* removes the column, a base id + field replaces how
|
|
2257
|
-
* editing the base column's form path), and any other key
|
|
2258
|
-
* column bound to the row's `additional_data`.
|
|
2267
|
+
* (or a field with `hidden`) removes the column, a base id + field replaces how
|
|
2268
|
+
* it renders (it keeps editing the base column's form path), and any other key
|
|
2269
|
+
* appends an editable column bound to the row's `additional_data`. Generated
|
|
2270
|
+
* column ids like `stock_locations.<id>` also match their `stock_locations`
|
|
2271
|
+
* prefix, so one key targets the whole group.
|
|
2259
2272
|
*/
|
|
2260
2273
|
declare function useExtendableGrid<TData>(props: UseExtendableGridProps<TData>): ColumnDef<TData, unknown>[];
|
|
2261
2274
|
|
|
2275
|
+
type BuiltInFieldScope = {
|
|
2276
|
+
model: string;
|
|
2277
|
+
zone: string;
|
|
2278
|
+
tab?: string;
|
|
2279
|
+
/** Match only entries of `tab`, as data grids do. */
|
|
2280
|
+
exactTab?: boolean;
|
|
2281
|
+
};
|
|
2282
|
+
type BuiltInFieldDefaults = {
|
|
2283
|
+
/** Resolved defaults by built-in id; ids without a value are left out. */
|
|
2284
|
+
values: Record<string, unknown>;
|
|
2285
|
+
/** Built-in ids whose override sets `hidden: true`. */
|
|
2286
|
+
hidden: Record<string, boolean>;
|
|
2287
|
+
isLoading: boolean;
|
|
2288
|
+
};
|
|
2289
|
+
declare function resolveBuiltInFieldDefault(extension: ExtensionRegistry, { model, zone, tab, exactTab }: BuiltInFieldScope, id: string): Promise<unknown>;
|
|
2290
|
+
/**
|
|
2291
|
+
* Resolves the `defaultValue` (sync or async) of `forms[].fields` overrides on
|
|
2292
|
+
* a form's built-in fields, so a `hidden` field still has a value to submit.
|
|
2293
|
+
*/
|
|
2294
|
+
declare function useBuiltInFieldDefaults(scope: BuiltInFieldScope, ids: string[]): BuiltInFieldDefaults;
|
|
2295
|
+
|
|
2262
2296
|
type Keyed = {
|
|
2263
2297
|
key: string;
|
|
2264
2298
|
};
|
|
@@ -2579,4 +2613,4 @@ declare const plainTextToHtml: (value?: string | null) => string;
|
|
|
2579
2613
|
|
|
2580
2614
|
declare const getListInitialData: <TData>(queryParams: Record<string, string | undefined>, loaderData: TData | undefined) => TData | undefined;
|
|
2581
2615
|
|
|
2582
|
-
export { type Action, type ActionGroup, ActionMenu, type AdditionalDataScope, AddressForm, AddressSchema, type AttributeChange, type AttributeChangeKind, AttributeValueInput, BadgeListSummary, CORE_ENTRY_PREFIX, CORE_LAYOUTS, ChipGroup, ChipInput, CodeCell, CodeHeader, Combobox, type Command, ConditionalTooltip, ConfirmPrompt, type ConfirmPromptProps, type CoreNavItem, CountrySelect, CreatedAtCell, CreatedAtHeader, type CurrencyInfo, type CustomFieldsModule, CustomerInfo, DataGrid, DataTable, DateCell, DateHeader, DateRangeDisplay, DeprecatedPercentageInput, type DetailPageDefaultsOptions, type DisplayEntry, DisplayExtensionZone, type DisplayExtensionZoneProps, DisplayField, type DisplayFieldProps, DisplaySection, type DisplaySectionField, type DisplaySectionProps, type EditAttributeAttribute, EditAttributeForm, type EditAttributeFormProps, EmailCell, EmailForm, EmailHeader, EmailSchema, type EntryRenderer, ErrorBoundary, ExtendableFormField, type ExtendableFormFieldProps, type ExtendableTable, type ExtensionGridColumnArgs, ExtensionProvider, type ExtensionProviderProps, ExtensionRegistry, type ExtractableOffer, type ExtractableOffers, type FeedbackSubmitHandler, type FieldDiff, FilePreview, type FileType, FileUpload, type FileUploadProps, type Filter, FilterGroup, Form, FormExtensionZone, type FormExtensionZoneProps, type FormFieldInputType, type FormFieldOverride, GeneralSectionSkeleton, type GridFieldName, HandleInput, HeadingSkeleton, IconAvatar, IconButtonSkeleton, ImageAvatar, type ImageRef, IncludesTaxTooltip, InfiniteList, JsonViewSection, JsonViewSectionSkeleton, KeyboundForm, LayoutComposer, type LayoutComposerProps, LayoutEntry, type LayoutEntryProps, type LayoutModule, LinkButton, ListBadge, ListSummary, Listicle, type ListicleProps, LocalizedTablePagination, type MediaDiff, MetadataForm, MetadataSection, MoneyAmountCell, NameCell, NameHeader, type NavGroup, type NavGroupItem, type NavItemGroup, type NavigationModule, NoRecords, type NoRecordsProps, NoResults, type NoResultsProps, type OnboardingStep, type OnboardingStepDefault, OrderBy, PercentageInput, PermissionAction, type PermissionActionProps, PermissionGuard, type PermissionGuardProps, type PermissionedCommand, PermissionsContext, PermissionsProvider, type PermissionsProviderProps, PlaceholderCell, type PreferenceModule, PriceListDateStatus, type PriceListGridGroupRow, type PriceListGridOfferRow, type PriceListGridRow, PriceListStatus, PriceListType, type ProductAttributeBatchPayload, ProductAttributeSection, type ProductAttributeSectionProps, type ProductChangeAttribute, ProductChangePanel, type ProductChangePanelProps, type ProductChangeProduct, type ProductChangeResolvers, type ProductChangeVariant, type ProductChangeView, ProgressBar, ProvinceSelect, Query, REFERENCE_FIELDS, RICH_TEXT_ALLOWED_ATTRIBUTES, RICH_TEXT_ALLOWED_TAGS, type RawEntry, type ReferenceField, type RenderDefaultProps, type ResolvedAttribute, type ResolvedDisplays, type ResolvedFormField, RichText, RichTextEditor, type RichTextEditorProps, RouteDrawer, RouteFocusModal, RoutePermissionGuard, SIDEBAR_MENU_CONTENT, SIDEBAR_RAIL_FADE, SectionNoAccess, SectionRow, type SectionRowProps, type SectionWidget, type SectionWidgetMap, SegmentedControl, type SegmentedControlOption, SidebarContext, type SidebarContextValue, SidebarLink, type SidebarLinkProps, SidebarProvider, type SidebarState, SingleColumnLayoutComponent, SingleColumnPage, SingleColumnPageSkeleton, Skeleton, SortableList, SortableTree, StackedDrawer, StackedFocusModal, type StaticCountry, StatusCell, SwitchBox, type TQueryKey, type TabDefinition, TabbedForm, TableFooterSkeleton, TableSectionSkeleton, TableSkeleton, TextCell, TextHeader, TextSkeleton, Thumbnail, TopbarActions, TransferOwnershipSchema, TwoColumnLayoutComponent, TwoColumnPage, TwoColumnPageSkeleton, type UseExtendableFormProps, type UseExtendableGridProps, type UseExtendableTableProps, type UseQueryOptionsWrapper, type VariantGroup, VisuallyHidden, type Widget, type WidgetModule, type WidgetPlacement, type WidgetTab, type WidgetTabs, WidgetZone, type WidgetZoneProps, type ZoneWidgets, _DataTable, applyActionPermissions, applyNavGroups, applyNavOverrides, applyReplacements, buildAdditionalDataDefaults, buildAdditionalDataSchema, buildCoreEntries, buildDisplayEntries, buildOfferGridData, buildProductChangeView, buildScopedAdditionalData, buildWidgetEntries, countries, createDataGridHelper, createDataGridPriceColumns, createFormHelper, createWithPermission, currencies, detailPageDefaultEntries, extractPricesFromOffers, extractReferenceIds, extractSectionElements, filterCommandsByPermission, formatFieldValue, genericForwardRef, getCountryByIso2, getCurrencySymbol, getDecimalDigits, getExtensionRegistry, getFormattedAddress, getFormattedCountry, getLinkQuery, getListInitialData, getLocaleAmount, getNativeSymbol, getPriceListStatus, getStylizedAmount, groupNavItems, humanizeFieldName, isAmountLessThenRoundingError, isForbidden, isHtml, isImageList, isOrderActionable, isOrderAwaitingAction, isPermitted, isPriceListGroupRow, isProductRow, isReferenceField, isSameAddress, linkFields, mergeLayoutPreferences, mergeListFilters, navOverridesFromPreferences, permissionMapAllows, plainTextToHtml, productChangeViewHasContent, queryClient, queryKeysFactory, refineAdditionalData, resolveFormFieldType, resolveRouteOverrides, richTextContentClasses, sanitizeRichText, toPermissionList, useActionLocks, useCan, useCollapsedSidebar, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDisplayFieldOverride, useDocumentDirection, useExpandedSidebar, useExtendableForm, useExtendableGrid, useExtendableTable, useExtension, useExtensionActivity, useLinkQuery, usePermissionGate, usePermissions, usePermittedCommands, useQueryParams, useResourcePermissions, useRouteModal, useSidebar, useSidebarMenuPlacement, useStackedModal, useTabManagement, useTabbedForm, useWidgetTabs, withLinkFields };
|
|
2616
|
+
export { type Action, type ActionGroup, ActionMenu, type AdditionalDataScope, AddressForm, AddressSchema, type AttributeChange, type AttributeChangeKind, AttributeValueInput, BadgeListSummary, type BuiltInFieldDefaults, type BuiltInFieldScope, CORE_ENTRY_PREFIX, CORE_LAYOUTS, ChipGroup, ChipInput, CodeCell, CodeHeader, Combobox, type Command, ConditionalTooltip, ConfirmPrompt, type ConfirmPromptProps, type CoreNavItem, CountrySelect, CreatedAtCell, CreatedAtHeader, type CurrencyInfo, type CustomFieldsModule, CustomerInfo, DataGrid, DataTable, DateCell, DateHeader, DateRangeDisplay, DeprecatedPercentageInput, type DetailPageDefaultsOptions, type DisplayEntry, DisplayExtensionZone, type DisplayExtensionZoneProps, DisplayField, type DisplayFieldProps, DisplaySection, type DisplaySectionField, type DisplaySectionProps, type EditAttributeAttribute, EditAttributeForm, type EditAttributeFormProps, EmailCell, EmailForm, EmailHeader, EmailSchema, type EntryRenderer, ErrorBoundary, ExtendableFormField, type ExtendableFormFieldProps, type ExtendableTable, type ExtensionGridColumnArgs, ExtensionProvider, type ExtensionProviderProps, ExtensionRegistry, type ExtractableOffer, type ExtractableOffers, type FeedbackSubmitHandler, type FieldDiff, FilePreview, type FileType, FileUpload, type FileUploadProps, type Filter, FilterGroup, Form, FormExtensionZone, type FormExtensionZoneProps, type FormFieldInputType, type FormFieldOverride, GeneralSectionSkeleton, type GridFieldName, HandleInput, HeadingSkeleton, IconAvatar, IconButtonSkeleton, ImageAvatar, type ImageRef, IncludesTaxTooltip, InfiniteList, JsonViewSection, JsonViewSectionSkeleton, KeyboundForm, LayoutComposer, type LayoutComposerProps, LayoutEntry, type LayoutEntryProps, type LayoutModule, LinkButton, ListBadge, ListSummary, Listicle, type ListicleProps, LocalizedTablePagination, type MediaDiff, MetadataForm, MetadataSection, MoneyAmountCell, NameCell, NameHeader, type NavGroup, type NavGroupItem, type NavItemGroup, type NavigationModule, NoRecords, type NoRecordsProps, NoResults, type NoResultsProps, type OnboardingStep, type OnboardingStepDefault, OrderBy, PercentageInput, PermissionAction, type PermissionActionProps, PermissionGuard, type PermissionGuardProps, type PermissionedCommand, PermissionsContext, PermissionsProvider, type PermissionsProviderProps, PlaceholderCell, type PreferenceModule, PriceListDateStatus, type PriceListGridGroupRow, type PriceListGridOfferRow, type PriceListGridRow, PriceListStatus, PriceListType, type ProductAttributeBatchPayload, ProductAttributeSection, type ProductAttributeSectionProps, type ProductChangeAttribute, ProductChangePanel, type ProductChangePanelProps, type ProductChangeProduct, type ProductChangeResolvers, type ProductChangeVariant, type ProductChangeView, ProgressBar, ProvinceSelect, Query, REFERENCE_FIELDS, RICH_TEXT_ALLOWED_ATTRIBUTES, RICH_TEXT_ALLOWED_TAGS, type RawEntry, type ReferenceField, type RenderDefaultProps, type ResolvedAttribute, type ResolvedDisplays, type ResolvedFormField, RichText, RichTextEditor, type RichTextEditorProps, RouteDrawer, RouteFocusModal, RoutePermissionGuard, SIDEBAR_MENU_CONTENT, SIDEBAR_RAIL_FADE, SectionNoAccess, SectionRow, type SectionRowProps, type SectionWidget, type SectionWidgetMap, SegmentedControl, type SegmentedControlOption, SidebarContext, type SidebarContextValue, SidebarLink, type SidebarLinkProps, SidebarProvider, type SidebarState, SingleColumnLayoutComponent, SingleColumnPage, SingleColumnPageSkeleton, Skeleton, SortableList, SortableTree, StackedDrawer, StackedFocusModal, type StaticCountry, StatusCell, SwitchBox, type TQueryKey, type TabDefinition, TabbedForm, TableFooterSkeleton, TableSectionSkeleton, TableSkeleton, TextCell, TextHeader, TextSkeleton, Thumbnail, TopbarActions, TransferOwnershipSchema, TwoColumnLayoutComponent, TwoColumnPage, TwoColumnPageSkeleton, type UseExtendableFormProps, type UseExtendableGridProps, type UseExtendableTableProps, type UseQueryOptionsWrapper, type VariantGroup, VisuallyHidden, type Widget, type WidgetModule, type WidgetPlacement, type WidgetTab, type WidgetTabs, WidgetZone, type WidgetZoneProps, type ZoneWidgets, _DataTable, applyActionPermissions, applyNavGroups, applyNavOverrides, applyReplacements, buildAdditionalDataDefaults, buildAdditionalDataSchema, buildCoreEntries, buildDisplayEntries, buildOfferGridData, buildProductChangeView, buildScopedAdditionalData, buildWidgetEntries, countries, createDataGridHelper, createDataGridPriceColumns, createFormHelper, createWithPermission, currencies, detailPageDefaultEntries, extractPricesFromOffers, extractReferenceIds, extractSectionElements, filterCommandsByPermission, formatFieldValue, genericForwardRef, getCountryByIso2, getCurrencySymbol, getDecimalDigits, getExtensionRegistry, getFormattedAddress, getFormattedCountry, getLinkQuery, getListInitialData, getLocaleAmount, getNativeSymbol, getPriceListStatus, getStylizedAmount, groupNavItems, humanizeFieldName, isAmountLessThenRoundingError, isForbidden, isHtml, isImageList, isOrderActionable, isOrderAwaitingAction, isPermitted, isPriceListGroupRow, isProductRow, isReferenceField, isSameAddress, linkFields, mergeLayoutPreferences, mergeListFilters, navOverridesFromPreferences, overrideLazyRoute, permissionMapAllows, plainTextToHtml, productChangeViewHasContent, queryClient, queryKeysFactory, refineAdditionalData, resolveBuiltInFieldDefault, resolveFormFieldType, resolveRouteOverrides, richTextContentClasses, sanitizeRichText, toPermissionList, useActionLocks, useBuiltInFieldDefaults, useCan, useCollapsedSidebar, useCombinedRefs, useCommandHistory, useDataTable, useDate, useDisplayFieldOverride, useDocumentDirection, useExpandedSidebar, useExtendableForm, useExtendableGrid, useExtendableTable, useExtension, useExtensionActivity, useLinkQuery, usePermissionGate, usePermissions, usePermittedCommands, useQueryParams, useResourcePermissions, useRouteModal, useSidebar, useSidebarMenuPlacement, useStackedModal, useTabManagement, useTabbedForm, useWidgetTabs, withLinkFields };
|
package/dist/index.js
CHANGED
|
@@ -26642,6 +26642,20 @@ function override(previous, next) {
|
|
|
26642
26642
|
children: next.children ? resolveRouteOverrides([...previous.children ?? [], ...next.children]) : previous.children
|
|
26643
26643
|
};
|
|
26644
26644
|
}
|
|
26645
|
+
var mergeHandles = (previous, next) => previous && next && typeof previous === "object" && typeof next === "object" ? { ...previous, ...next } : next ?? previous;
|
|
26646
|
+
function overrideLazyRoute(previous, next) {
|
|
26647
|
+
return async () => {
|
|
26648
|
+
const [base, custom] = await Promise.all([previous(), next()]);
|
|
26649
|
+
const Previous = base.Component;
|
|
26650
|
+
const Next = custom.Component;
|
|
26651
|
+
if (!Previous || !Next) {
|
|
26652
|
+
return { ...base, ...custom };
|
|
26653
|
+
}
|
|
26654
|
+
const Component = (props) => createElement(Next, { ...props, renderDefault: () => createElement(Previous) });
|
|
26655
|
+
Component.displayName = Next.displayName ?? Next.name ?? "RouteOverride";
|
|
26656
|
+
return { ...base, ...custom, Component, handle: mergeHandles(base.handle, custom.handle) };
|
|
26657
|
+
};
|
|
26658
|
+
}
|
|
26645
26659
|
function resolveRouteOverrides(routes) {
|
|
26646
26660
|
const byPath = /* @__PURE__ */ new Map();
|
|
26647
26661
|
for (const route of routes) {
|
|
@@ -27075,13 +27089,7 @@ var FormExtensionZone = ({
|
|
|
27075
27089
|
builtInFieldIds,
|
|
27076
27090
|
exactTab
|
|
27077
27091
|
}) => {
|
|
27078
|
-
const fields = useExtension().getFormFields(
|
|
27079
|
-
model,
|
|
27080
|
-
zone,
|
|
27081
|
-
tab,
|
|
27082
|
-
builtInFieldIds,
|
|
27083
|
-
exactTab
|
|
27084
|
-
);
|
|
27092
|
+
const fields = useExtension().getFormFields(model, zone, tab, builtInFieldIds, exactTab).filter(({ field }) => !field.hidden);
|
|
27085
27093
|
if (fields.length === 0) return null;
|
|
27086
27094
|
return /* @__PURE__ */ jsx83("div", { className: "flex flex-col gap-y-4", children: fields.map(({ name, field }) => /* @__PURE__ */ jsx83(
|
|
27087
27095
|
ExtensionField,
|
|
@@ -27111,7 +27119,7 @@ var ExtendableFormField = ({
|
|
|
27111
27119
|
tab
|
|
27112
27120
|
);
|
|
27113
27121
|
if (!overridden) return /* @__PURE__ */ jsx83(Fragment9, { children });
|
|
27114
|
-
if (!field) return null;
|
|
27122
|
+
if (!field || field.hidden) return null;
|
|
27115
27123
|
return /* @__PURE__ */ jsx83(
|
|
27116
27124
|
ExtensionField,
|
|
27117
27125
|
{
|
|
@@ -27258,21 +27266,24 @@ function applyGridExtension(extension, {
|
|
|
27258
27266
|
}) {
|
|
27259
27267
|
const locked = new Set(lockedColumnIds);
|
|
27260
27268
|
const builtInIds = baseColumns.flatMap((c) => columnId2(c) ?? []);
|
|
27269
|
+
const overrideFor = (id) => {
|
|
27270
|
+
const exact = extension.getFormFieldOverride(model, zone, id, tab, true);
|
|
27271
|
+
const group = id.includes(".") ? id.slice(0, id.indexOf(".")) : null;
|
|
27272
|
+
if (exact.overridden || !group) return exact;
|
|
27273
|
+
return extension.getFormFieldOverride(model, zone, group, tab, true);
|
|
27274
|
+
};
|
|
27261
27275
|
const columns = baseColumns.flatMap((col) => {
|
|
27262
27276
|
const id = columnId2(col);
|
|
27263
27277
|
if (!id || locked.has(id)) return [col];
|
|
27264
|
-
const { overridden, field } =
|
|
27265
|
-
model,
|
|
27266
|
-
zone,
|
|
27267
|
-
id,
|
|
27268
|
-
tab,
|
|
27269
|
-
true
|
|
27270
|
-
);
|
|
27278
|
+
const { overridden, field } = overrideFor(id);
|
|
27271
27279
|
if (!overridden) return [col];
|
|
27272
|
-
if (!field) return [];
|
|
27280
|
+
if (!field || field.hidden) return [];
|
|
27273
27281
|
return [createColumn({ id, field, getFieldName: baseFieldName(col) })];
|
|
27274
27282
|
});
|
|
27275
|
-
const
|
|
27283
|
+
const builtInGroups = builtInIds.flatMap(
|
|
27284
|
+
(id) => id.includes(".") ? [id.slice(0, id.indexOf("."))] : []
|
|
27285
|
+
);
|
|
27286
|
+
const added = allowAdd ? extension.getFormFields(model, zone, tab, [...builtInIds, ...builtInGroups], true).filter(({ field }) => !field.hidden) : [];
|
|
27276
27287
|
for (const { name, field } of added) {
|
|
27277
27288
|
columns.push(
|
|
27278
27289
|
createColumn({
|
|
@@ -27324,6 +27335,73 @@ function useExtendableGrid(props) {
|
|
|
27324
27335
|
);
|
|
27325
27336
|
}
|
|
27326
27337
|
|
|
27338
|
+
// src/extensions/use-built-in-field-defaults.ts
|
|
27339
|
+
import { useQueries as useQueries2 } from "@tanstack/react-query";
|
|
27340
|
+
import { useCallback as useCallback22, useMemo as useMemo20 } from "react";
|
|
27341
|
+
async function resolveBuiltInFieldDefault(extension, { model, zone, tab, exactTab }, id) {
|
|
27342
|
+
const { field } = extension.getFormFieldOverride(model, zone, id, tab, exactTab);
|
|
27343
|
+
if (!field || field.defaultValue === void 0) return void 0;
|
|
27344
|
+
if (typeof field.defaultValue !== "function") return field.defaultValue;
|
|
27345
|
+
try {
|
|
27346
|
+
return await field.defaultValue(void 0);
|
|
27347
|
+
} catch {
|
|
27348
|
+
return void 0;
|
|
27349
|
+
}
|
|
27350
|
+
}
|
|
27351
|
+
function useBuiltInFieldDefaults(scope, ids) {
|
|
27352
|
+
const extension = useExtension();
|
|
27353
|
+
const { model, zone, tab, exactTab } = scope;
|
|
27354
|
+
const idsKey = ids.join(",");
|
|
27355
|
+
const overrides = useMemo20(
|
|
27356
|
+
() => (idsKey ? idsKey.split(",") : []).flatMap((id) => {
|
|
27357
|
+
const { field } = extension.getFormFieldOverride(
|
|
27358
|
+
model,
|
|
27359
|
+
zone,
|
|
27360
|
+
id,
|
|
27361
|
+
tab,
|
|
27362
|
+
exactTab
|
|
27363
|
+
);
|
|
27364
|
+
return field ? [{ id, field }] : [];
|
|
27365
|
+
}),
|
|
27366
|
+
[extension, model, zone, tab, exactTab, idsKey]
|
|
27367
|
+
);
|
|
27368
|
+
const withDefault = useMemo20(
|
|
27369
|
+
() => overrides.filter(({ field }) => field.defaultValue !== void 0),
|
|
27370
|
+
[overrides]
|
|
27371
|
+
);
|
|
27372
|
+
const combine = useCallback22(
|
|
27373
|
+
(results) => {
|
|
27374
|
+
const values2 = {};
|
|
27375
|
+
results.forEach((result, index) => {
|
|
27376
|
+
if (result.data !== void 0 && result.data !== null) {
|
|
27377
|
+
values2[withDefault[index].id] = result.data;
|
|
27378
|
+
}
|
|
27379
|
+
});
|
|
27380
|
+
return { values: values2, isLoading: results.some((r) => r.isPending) };
|
|
27381
|
+
},
|
|
27382
|
+
[withDefault]
|
|
27383
|
+
);
|
|
27384
|
+
const { values, isLoading } = useQueries2({
|
|
27385
|
+
queries: withDefault.map(({ id }) => ({
|
|
27386
|
+
queryKey: ["extension-default", model, zone, tab ?? null, id],
|
|
27387
|
+
queryFn: async () => await resolveBuiltInFieldDefault(extension, scope, id) ?? null,
|
|
27388
|
+
staleTime: Infinity,
|
|
27389
|
+
retry: false
|
|
27390
|
+
})),
|
|
27391
|
+
combine
|
|
27392
|
+
});
|
|
27393
|
+
const hidden = useMemo20(
|
|
27394
|
+
() => Object.fromEntries(
|
|
27395
|
+
overrides.filter(({ field }) => field.hidden).map(({ id }) => [id, true])
|
|
27396
|
+
),
|
|
27397
|
+
[overrides]
|
|
27398
|
+
);
|
|
27399
|
+
return useMemo20(
|
|
27400
|
+
() => ({ values, hidden, isLoading }),
|
|
27401
|
+
[values, hidden, isLoading]
|
|
27402
|
+
);
|
|
27403
|
+
}
|
|
27404
|
+
|
|
27327
27405
|
// src/extensions/list-filters.ts
|
|
27328
27406
|
var isRemoval = (filter) => "remove" in filter && filter.remove === true;
|
|
27329
27407
|
function mergeListFilters(base, extensions) {
|
|
@@ -27369,7 +27447,7 @@ var useLinkQuery = (model, base) => {
|
|
|
27369
27447
|
|
|
27370
27448
|
// src/extensions/use-extendable-form.ts
|
|
27371
27449
|
import { zodResolver as zodResolver3 } from "@hookform/resolvers/zod";
|
|
27372
|
-
import { useMemo as
|
|
27450
|
+
import { useMemo as useMemo21 } from "react";
|
|
27373
27451
|
import { useForm as useForm3 } from "react-hook-form";
|
|
27374
27452
|
import { z as z4 } from "zod";
|
|
27375
27453
|
var useExtendableForm = ({
|
|
@@ -27383,7 +27461,7 @@ var useExtendableForm = ({
|
|
|
27383
27461
|
...props
|
|
27384
27462
|
}) => {
|
|
27385
27463
|
const extension = useExtension();
|
|
27386
|
-
const schema =
|
|
27464
|
+
const schema = useMemo21(() => {
|
|
27387
27465
|
const additionalData = buildAdditionalDataSchema(
|
|
27388
27466
|
extension,
|
|
27389
27467
|
model,
|
|
@@ -27393,7 +27471,7 @@ var useExtendableForm = ({
|
|
|
27393
27471
|
).partial().optional();
|
|
27394
27472
|
return typeof baseSchema.extend === "function" ? baseSchema.extend({ additional_data: additionalData }) : baseSchema.and(z4.object({ additional_data: additionalData }));
|
|
27395
27473
|
}, [baseSchema, extension, model, zone, tab, builtInFieldIds]);
|
|
27396
|
-
const defaultValues =
|
|
27474
|
+
const defaultValues = useMemo21(
|
|
27397
27475
|
() => ({
|
|
27398
27476
|
...baseDefaultValues,
|
|
27399
27477
|
additional_data: buildAdditionalDataDefaults(
|
|
@@ -27415,17 +27493,17 @@ var useExtendableForm = ({
|
|
|
27415
27493
|
};
|
|
27416
27494
|
|
|
27417
27495
|
// src/extensions/action-locks.ts
|
|
27418
|
-
import { useCallback as
|
|
27496
|
+
import { useCallback as useCallback23, useMemo as useMemo22 } from "react";
|
|
27419
27497
|
var useActionLocks = (model, entity) => {
|
|
27420
27498
|
const registry = useExtension();
|
|
27421
|
-
return
|
|
27499
|
+
return useCallback23(
|
|
27422
27500
|
(action) => registry.getActionLock(model, action, entity),
|
|
27423
27501
|
[registry, model, entity]
|
|
27424
27502
|
);
|
|
27425
27503
|
};
|
|
27426
27504
|
var useExtensionActivity = (model, entity) => {
|
|
27427
27505
|
const registry = useExtension();
|
|
27428
|
-
return
|
|
27506
|
+
return useMemo22(
|
|
27429
27507
|
() => registry.getActivity(model, entity),
|
|
27430
27508
|
[registry, model, entity]
|
|
27431
27509
|
);
|
|
@@ -27663,17 +27741,17 @@ import {
|
|
|
27663
27741
|
Children as Children3,
|
|
27664
27742
|
createContext as createContext9,
|
|
27665
27743
|
useContext as useContext13,
|
|
27666
|
-
useMemo as
|
|
27744
|
+
useMemo as useMemo24
|
|
27667
27745
|
} from "react";
|
|
27668
27746
|
import { useTranslation as useTranslation37 } from "react-i18next";
|
|
27669
27747
|
|
|
27670
27748
|
// src/components/tabbed-form/use-tab-management.ts
|
|
27671
|
-
import { useCallback as
|
|
27749
|
+
import { useCallback as useCallback24, useEffect as useEffect20, useMemo as useMemo23, useState as useState32 } from "react";
|
|
27672
27750
|
var useTabManagement = ({
|
|
27673
27751
|
tabs,
|
|
27674
27752
|
form
|
|
27675
27753
|
}) => {
|
|
27676
|
-
const visibleTabs =
|
|
27754
|
+
const visibleTabs = useMemo23(
|
|
27677
27755
|
() => tabs.filter((t2) => !t2.isVisible || t2.isVisible(form)),
|
|
27678
27756
|
[tabs, form]
|
|
27679
27757
|
);
|
|
@@ -27703,7 +27781,7 @@ var useTabManagement = ({
|
|
|
27703
27781
|
}, [activeTabId, visibleTabs]);
|
|
27704
27782
|
const activeIndex = visibleTabs.findIndex((t2) => t2.id === activeTabId);
|
|
27705
27783
|
const isLastTab = activeIndex === visibleTabs.length - 1;
|
|
27706
|
-
const onNext =
|
|
27784
|
+
const onNext = useCallback24(async () => {
|
|
27707
27785
|
const valid = await form.trigger();
|
|
27708
27786
|
if (!valid) {
|
|
27709
27787
|
return;
|
|
@@ -27712,7 +27790,7 @@ var useTabManagement = ({
|
|
|
27712
27790
|
setActiveTabId(visibleTabs[activeIndex + 1].id);
|
|
27713
27791
|
}
|
|
27714
27792
|
}, [form, activeIndex, visibleTabs]);
|
|
27715
|
-
const onTabChange =
|
|
27793
|
+
const onTabChange = useCallback24(
|
|
27716
27794
|
async (tabId) => {
|
|
27717
27795
|
const valid = await form.trigger();
|
|
27718
27796
|
if (!valid) {
|
|
@@ -27782,11 +27860,11 @@ function Root6({
|
|
|
27782
27860
|
transformTabs
|
|
27783
27861
|
}) {
|
|
27784
27862
|
const { t: t2 } = useTranslation37();
|
|
27785
|
-
const { tabs: rawTabs, elements } =
|
|
27863
|
+
const { tabs: rawTabs, elements } = useMemo24(
|
|
27786
27864
|
() => collectTabs(children),
|
|
27787
27865
|
[children]
|
|
27788
27866
|
);
|
|
27789
|
-
const tabs =
|
|
27867
|
+
const tabs = useMemo24(
|
|
27790
27868
|
() => transformTabs ? transformTabs(rawTabs) : rawTabs,
|
|
27791
27869
|
[transformTabs, rawTabs]
|
|
27792
27870
|
);
|
|
@@ -27917,7 +27995,7 @@ import { memo } from "react";
|
|
|
27917
27995
|
// src/components/table/data-table/data-table-filter/data-table-filter.tsx
|
|
27918
27996
|
import { Button as Button14, clx as clx49 } from "@medusajs/ui";
|
|
27919
27997
|
import { Popover as RadixPopover8 } from "radix-ui";
|
|
27920
|
-
import { useCallback as
|
|
27998
|
+
import { useCallback as useCallback27, useEffect as useEffect23, useMemo as useMemo26, useRef as useRef18, useState as useState37 } from "react";
|
|
27921
27999
|
import { useSearchParams as useSearchParams7 } from "react-router-dom";
|
|
27922
28000
|
import { useTranslation as useTranslation42 } from "react-i18next";
|
|
27923
28001
|
|
|
@@ -27939,7 +28017,7 @@ import { EllipseMiniSolid as EllipseMiniSolid2 } from "@medusajs/icons";
|
|
|
27939
28017
|
import { DatePicker, Text as Text21, clx as clx45 } from "@medusajs/ui";
|
|
27940
28018
|
import isEqual from "lodash.isequal";
|
|
27941
28019
|
import { Popover as RadixPopover4 } from "radix-ui";
|
|
27942
|
-
import { useMemo as
|
|
28020
|
+
import { useMemo as useMemo25, useState as useState33 } from "react";
|
|
27943
28021
|
import { t } from "i18next";
|
|
27944
28022
|
import { useTranslation as useTranslation39 } from "react-i18next";
|
|
27945
28023
|
|
|
@@ -28297,7 +28375,7 @@ var today = /* @__PURE__ */ new Date();
|
|
|
28297
28375
|
today.setHours(0, 0, 0, 0);
|
|
28298
28376
|
var usePresets = () => {
|
|
28299
28377
|
const { t: t2 } = useTranslation39();
|
|
28300
|
-
return
|
|
28378
|
+
return useMemo25(
|
|
28301
28379
|
() => [
|
|
28302
28380
|
{
|
|
28303
28381
|
label: t2("filters.date.today"),
|
|
@@ -28367,7 +28445,7 @@ import {
|
|
|
28367
28445
|
Popover as RadixPopover5,
|
|
28368
28446
|
RadioGroup as RadixRadioGroup
|
|
28369
28447
|
} from "radix-ui";
|
|
28370
|
-
import { useCallback as
|
|
28448
|
+
import { useCallback as useCallback25, useEffect as useEffect21, useState as useState34 } from "react";
|
|
28371
28449
|
import { useTranslation as useTranslation40 } from "react-i18next";
|
|
28372
28450
|
import { jsx as jsx90, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
28373
28451
|
var NumberFilter = ({
|
|
@@ -28392,7 +28470,7 @@ var NumberFilter = ({
|
|
|
28392
28470
|
const [operator, setOperator] = useState34(
|
|
28393
28471
|
getOperator(currentValue)
|
|
28394
28472
|
);
|
|
28395
|
-
const debouncedOnChange =
|
|
28473
|
+
const debouncedOnChange = useCallback25(
|
|
28396
28474
|
debounce2((e, operator2) => {
|
|
28397
28475
|
const value = e.target.value;
|
|
28398
28476
|
const curr = JSON.parse(currentValue?.join(",") || "{}");
|
|
@@ -28762,7 +28840,7 @@ var SelectFilter = ({
|
|
|
28762
28840
|
import { Input as Input12, Label as Label5, clx as clx48 } from "@medusajs/ui";
|
|
28763
28841
|
import debounce3 from "lodash.debounce";
|
|
28764
28842
|
import { Popover as RadixPopover7 } from "radix-ui";
|
|
28765
|
-
import { useCallback as
|
|
28843
|
+
import { useCallback as useCallback26, useEffect as useEffect22, useState as useState36 } from "react";
|
|
28766
28844
|
import { jsx as jsx92, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
28767
28845
|
var StringFilter = ({
|
|
28768
28846
|
filter,
|
|
@@ -28778,7 +28856,7 @@ var StringFilter = ({
|
|
|
28778
28856
|
const [previousValue, setPreviousValue] = useState36(
|
|
28779
28857
|
query?.[0]
|
|
28780
28858
|
);
|
|
28781
|
-
const debouncedOnChange =
|
|
28859
|
+
const debouncedOnChange = useCallback26(
|
|
28782
28860
|
debounce3((e) => {
|
|
28783
28861
|
const value = e.target.value;
|
|
28784
28862
|
if (!value) {
|
|
@@ -28907,16 +28985,16 @@ var DataTableFilter2 = ({
|
|
|
28907
28985
|
setOpen(false);
|
|
28908
28986
|
setActiveFilters((prev) => [...prev, { ...filter, openOnMount: true }]);
|
|
28909
28987
|
};
|
|
28910
|
-
const removeFilter =
|
|
28988
|
+
const removeFilter = useCallback27((key) => {
|
|
28911
28989
|
setActiveFilters((prev) => prev.filter((f) => f.key !== key));
|
|
28912
28990
|
}, []);
|
|
28913
|
-
const removeAllFilters =
|
|
28991
|
+
const removeAllFilters = useCallback27(() => {
|
|
28914
28992
|
setActiveFilters([]);
|
|
28915
28993
|
}, []);
|
|
28916
28994
|
return /* @__PURE__ */ jsx93(
|
|
28917
28995
|
DataTableFilterContext.Provider,
|
|
28918
28996
|
{
|
|
28919
|
-
value:
|
|
28997
|
+
value: useMemo26(
|
|
28920
28998
|
() => ({
|
|
28921
28999
|
removeFilter,
|
|
28922
29000
|
removeAllFilters
|
|
@@ -29203,7 +29281,7 @@ var DataTableOrderBy = ({
|
|
|
29203
29281
|
|
|
29204
29282
|
// src/components/table/data-table/data-table-search/data-table-search.tsx
|
|
29205
29283
|
import { Input as Input13 } from "@medusajs/ui";
|
|
29206
|
-
import { useCallback as
|
|
29284
|
+
import { useCallback as useCallback28, useEffect as useEffect24 } from "react";
|
|
29207
29285
|
import { useTranslation as useTranslation44 } from "react-i18next";
|
|
29208
29286
|
import debounce4 from "lodash.debounce";
|
|
29209
29287
|
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
@@ -29220,7 +29298,7 @@ var DataTableSearch = ({
|
|
|
29220
29298
|
multiple: false
|
|
29221
29299
|
});
|
|
29222
29300
|
const query = selectedParams.get();
|
|
29223
|
-
const debouncedOnChange =
|
|
29301
|
+
const debouncedOnChange = useCallback28(
|
|
29224
29302
|
debounce4((e) => {
|
|
29225
29303
|
const value = e.target.value;
|
|
29226
29304
|
if (!value) {
|
|
@@ -29879,7 +29957,7 @@ import {
|
|
|
29879
29957
|
getPaginationRowModel,
|
|
29880
29958
|
useReactTable as useReactTable2
|
|
29881
29959
|
} from "@tanstack/react-table";
|
|
29882
|
-
import { useEffect as useEffect26, useMemo as
|
|
29960
|
+
import { useEffect as useEffect26, useMemo as useMemo27, useState as useState40 } from "react";
|
|
29883
29961
|
import { useSearchParams as useSearchParams9 } from "react-router-dom";
|
|
29884
29962
|
var useDataTable2 = ({
|
|
29885
29963
|
data = [],
|
|
@@ -29902,7 +29980,7 @@ var useDataTable2 = ({
|
|
|
29902
29980
|
pageIndex: offset ? Math.ceil(Number(offset) / _pageSize) : 0,
|
|
29903
29981
|
pageSize: _pageSize
|
|
29904
29982
|
});
|
|
29905
|
-
const pagination =
|
|
29983
|
+
const pagination = useMemo27(
|
|
29906
29984
|
() => ({
|
|
29907
29985
|
pageIndex,
|
|
29908
29986
|
pageSize
|
|
@@ -29964,7 +30042,7 @@ var useDataTable2 = ({
|
|
|
29964
30042
|
};
|
|
29965
30043
|
|
|
29966
30044
|
// src/permissions/permissions-provider.tsx
|
|
29967
|
-
import { useCallback as
|
|
30045
|
+
import { useCallback as useCallback29, useMemo as useMemo28 } from "react";
|
|
29968
30046
|
import { jsx as jsx110 } from "react/jsx-runtime";
|
|
29969
30047
|
var PermissionsProvider = ({
|
|
29970
30048
|
permissions = null,
|
|
@@ -29972,11 +30050,11 @@ var PermissionsProvider = ({
|
|
|
29972
30050
|
children
|
|
29973
30051
|
}) => {
|
|
29974
30052
|
const isEnforced = !!permissions;
|
|
29975
|
-
const can =
|
|
30053
|
+
const can = useCallback29(
|
|
29976
30054
|
(key, right = "view") => !permissions || satisfiesPermission(permissions, key, right),
|
|
29977
30055
|
[permissions]
|
|
29978
30056
|
);
|
|
29979
|
-
const hasPermission =
|
|
30057
|
+
const hasPermission = useCallback29(
|
|
29980
30058
|
(permission) => {
|
|
29981
30059
|
if (!permissions) {
|
|
29982
30060
|
return true;
|
|
@@ -29986,15 +30064,15 @@ var PermissionsProvider = ({
|
|
|
29986
30064
|
},
|
|
29987
30065
|
[permissions]
|
|
29988
30066
|
);
|
|
29989
|
-
const hasAnyPermission =
|
|
30067
|
+
const hasAnyPermission = useCallback29(
|
|
29990
30068
|
(list) => !permissions || list.some(hasPermission),
|
|
29991
30069
|
[permissions, hasPermission]
|
|
29992
30070
|
);
|
|
29993
|
-
const hasAllPermissions =
|
|
30071
|
+
const hasAllPermissions = useCallback29(
|
|
29994
30072
|
(list) => !permissions || list.every(hasPermission),
|
|
29995
30073
|
[permissions, hasPermission]
|
|
29996
30074
|
);
|
|
29997
|
-
const value =
|
|
30075
|
+
const value = useMemo28(
|
|
29998
30076
|
() => ({
|
|
29999
30077
|
permissions,
|
|
30000
30078
|
isLoading,
|
|
@@ -30036,7 +30114,7 @@ var PermissionGuard = ({
|
|
|
30036
30114
|
// src/permissions/route-permission-guard.tsx
|
|
30037
30115
|
import { ExclamationCircle as ExclamationCircle5 } from "@medusajs/icons";
|
|
30038
30116
|
import { Container as Container6, Heading as Heading10, Text as Text23 } from "@medusajs/ui";
|
|
30039
|
-
import { useMemo as
|
|
30117
|
+
import { useMemo as useMemo29 } from "react";
|
|
30040
30118
|
import { useTranslation as useTranslation51 } from "react-i18next";
|
|
30041
30119
|
import { Navigate as Navigate2, Outlet as Outlet3, useMatches } from "react-router-dom";
|
|
30042
30120
|
import { jsx as jsx112, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
@@ -30069,7 +30147,7 @@ var readRequirementFromHandle = (handle) => {
|
|
|
30069
30147
|
var RoutePermissionGuard = () => {
|
|
30070
30148
|
const matches = useMatches();
|
|
30071
30149
|
const { hasAnyPermission, hasAllPermissions, isLoading } = usePermissions();
|
|
30072
|
-
const requirement =
|
|
30150
|
+
const requirement = useMemo29(() => {
|
|
30073
30151
|
for (let i = matches.length - 1; i >= 0; i--) {
|
|
30074
30152
|
const found = readRequirementFromHandle(matches[i].handle);
|
|
30075
30153
|
if (found) {
|
|
@@ -30107,10 +30185,10 @@ var AccessDenied = ({
|
|
|
30107
30185
|
};
|
|
30108
30186
|
|
|
30109
30187
|
// src/permissions/use-resource-permissions.tsx
|
|
30110
|
-
import { useMemo as
|
|
30188
|
+
import { useMemo as useMemo30 } from "react";
|
|
30111
30189
|
var useResourcePermissions = (key) => {
|
|
30112
30190
|
const { can, isLoading } = usePermissions();
|
|
30113
|
-
return
|
|
30191
|
+
return useMemo30(
|
|
30114
30192
|
() => ({
|
|
30115
30193
|
canView: can(key, "view"),
|
|
30116
30194
|
canEdit: can(key, "edit"),
|
|
@@ -30177,7 +30255,7 @@ import { createContext as createContext11 } from "react";
|
|
|
30177
30255
|
var SidebarContext = createContext11(null);
|
|
30178
30256
|
|
|
30179
30257
|
// src/providers/sidebar-provider/sidebar-provider.tsx
|
|
30180
|
-
import { useCallback as
|
|
30258
|
+
import { useCallback as useCallback30, useEffect as useEffect27, useMemo as useMemo31, useState as useState41 } from "react";
|
|
30181
30259
|
import { useLocation as useLocation4 } from "react-router-dom";
|
|
30182
30260
|
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
30183
30261
|
var SidebarProvider = ({ children }) => {
|
|
@@ -30187,14 +30265,14 @@ var SidebarProvider = ({ children }) => {
|
|
|
30187
30265
|
useEffect27(() => {
|
|
30188
30266
|
setMobile(false);
|
|
30189
30267
|
}, [pathname]);
|
|
30190
|
-
const toggle =
|
|
30268
|
+
const toggle = useCallback30((view) => {
|
|
30191
30269
|
if (view === "desktop") {
|
|
30192
30270
|
setDesktop((open) => !open);
|
|
30193
30271
|
} else {
|
|
30194
30272
|
setMobile((open) => !open);
|
|
30195
30273
|
}
|
|
30196
30274
|
}, []);
|
|
30197
|
-
const value =
|
|
30275
|
+
const value = useMemo31(
|
|
30198
30276
|
() => ({
|
|
30199
30277
|
state: desktop ? "expanded" : "collapsed",
|
|
30200
30278
|
desktop,
|
|
@@ -30249,7 +30327,7 @@ var useSidebarMenuPlacement = (align) => {
|
|
|
30249
30327
|
};
|
|
30250
30328
|
|
|
30251
30329
|
// src/layout-composer/layout-composer.tsx
|
|
30252
|
-
import { Fragment as Fragment16, useContext as useContext18, useMemo as
|
|
30330
|
+
import { Fragment as Fragment16, useContext as useContext18, useMemo as useMemo32 } from "react";
|
|
30253
30331
|
import { Outlet as Outlet4 } from "react-router-dom";
|
|
30254
30332
|
|
|
30255
30333
|
// src/layout-composer/entries.ts
|
|
@@ -30394,7 +30472,7 @@ var LayoutComposerRoot = ({
|
|
|
30394
30472
|
const registry = useExtension();
|
|
30395
30473
|
const permissions = useContext18(PermissionsContext);
|
|
30396
30474
|
const layout = registry.getLayout(preferredLayoutId);
|
|
30397
|
-
const entriesBySection =
|
|
30475
|
+
const entriesBySection = useMemo32(() => {
|
|
30398
30476
|
const sectionIds = layout?.sections.map((section) => section.id) ?? [];
|
|
30399
30477
|
const validSections = new Set(sectionIds);
|
|
30400
30478
|
const core = buildCoreEntries(extractSectionElements(sections));
|
|
@@ -30781,18 +30859,21 @@ export {
|
|
|
30781
30859
|
mergeLayoutPreferences,
|
|
30782
30860
|
mergeListFilters,
|
|
30783
30861
|
navOverridesFromPreferences,
|
|
30862
|
+
overrideLazyRoute,
|
|
30784
30863
|
permissionMapAllows,
|
|
30785
30864
|
plainTextToHtml,
|
|
30786
30865
|
productChangeViewHasContent,
|
|
30787
30866
|
queryClient,
|
|
30788
30867
|
queryKeysFactory,
|
|
30789
30868
|
refineAdditionalData,
|
|
30869
|
+
resolveBuiltInFieldDefault,
|
|
30790
30870
|
resolveFormFieldType,
|
|
30791
30871
|
resolveRouteOverrides,
|
|
30792
30872
|
richTextContentClasses,
|
|
30793
30873
|
sanitizeRichText,
|
|
30794
30874
|
toPermissionList,
|
|
30795
30875
|
useActionLocks,
|
|
30876
|
+
useBuiltInFieldDefaults,
|
|
30796
30877
|
useCan,
|
|
30797
30878
|
useCollapsedSidebar,
|
|
30798
30879
|
useCombinedRefs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercurjs/dashboard-shared",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2-canary.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/mercurjs/mercur",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@medusajs/dashboard": "2.22.3",
|
|
35
35
|
"@medusajs/icons": "2.22.3",
|
|
36
36
|
"@medusajs/ui": "4.2.3",
|
|
37
|
-
"@mercurjs/client": "2.4.
|
|
37
|
+
"@mercurjs/client": "2.4.2-canary.0",
|
|
38
38
|
"@radix-ui/react-dialog": "1.1.19",
|
|
39
39
|
"@radix-ui/react-dismissable-layer": "1.1.4",
|
|
40
40
|
"@tanstack/react-query": "5.64.2",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@medusajs/types": "2.22.3",
|
|
73
|
-
"@mercurjs/core": "2.4.
|
|
74
|
-
"@mercurjs/dashboard-sdk": "2.4.
|
|
75
|
-
"@mercurjs/types": "2.4.
|
|
73
|
+
"@mercurjs/core": "2.4.2-canary.0",
|
|
74
|
+
"@mercurjs/dashboard-sdk": "2.4.2-canary.0",
|
|
75
|
+
"@mercurjs/types": "2.4.2-canary.0",
|
|
76
76
|
"@types/lodash.debounce": "^4.0.8",
|
|
77
77
|
"@types/react": "^18.3.2",
|
|
78
78
|
"@types/react-dom": "^18.2.22",
|