@wildo-ai/saas-frontend-lib 1.1.12 → 1.1.14
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/esm/components/data-display/DisplayValueDispatcher.d.ts.map +1 -1
- package/dist/esm/components/data-display/DisplayValueDispatcher.js +17 -1
- package/dist/esm/components/data-display/DisplayValueDispatcher.js.map +1 -1
- package/dist/esm/components/data-display/approval-seal.d.ts +97 -0
- package/dist/esm/components/data-display/approval-seal.d.ts.map +1 -0
- package/dist/esm/components/data-display/approval-seal.js +208 -0
- package/dist/esm/components/data-display/approval-seal.js.map +1 -0
- package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.d.ts.map +1 -1
- package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.js +5 -2
- package/dist/esm/components/data-display/external-data-provenance/external-data-provenance.frontend.js.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-file.d.ts.map +1 -1
- package/dist/esm/components/data-display/formatters/display-field-file.js +16 -2
- package/dist/esm/components/data-display/formatters/display-field-file.js.map +1 -1
- package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
- package/dist/esm/components/flows-actors/approval.js +48 -18
- package/dist/esm/components/flows-actors/approval.js.map +1 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.d.ts.map +1 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.js +20 -1
- package/dist/esm/components/form/automated/ResourceAutomatedForm.js.map +1 -1
- package/dist/esm/components/form/chromes/FormFieldChrome.js +1 -1
- package/dist/esm/components/form/chromes/FormFieldChrome.js.map +1 -1
- package/dist/esm/components/form/chromes/field-control-aria.d.ts +8 -1
- package/dist/esm/components/form/chromes/field-control-aria.d.ts.map +1 -1
- package/dist/esm/components/form/chromes/field-control-aria.js +19 -2
- package/dist/esm/components/form/chromes/field-control-aria.js.map +1 -1
- package/dist/esm/components/form/validation-errors/validate-field-url.frontend.d.ts +5 -0
- package/dist/esm/components/form/validation-errors/validate-field-url.frontend.d.ts.map +1 -1
- package/dist/esm/components/form/validation-errors/validate-field-url.frontend.js +6 -2
- package/dist/esm/components/form/validation-errors/validate-field-url.frontend.js.map +1 -1
- package/dist/esm/components/resources/ResourceCollectionBody_Table.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceCollectionBody_Table.js +8 -1
- package/dist/esm/components/resources/ResourceCollectionBody_Table.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_DangerZone.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_DangerZone.js +2 -2
- package/dist/esm/components/resources/ResourceLayout_DangerZone.js.map +1 -1
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.js +2 -2
- package/dist/esm/components/resources/ResourceLayout_RecordSharing.js.map +1 -1
- package/dist/esm/components/resources/ResourceListItemRenderer.d.ts.map +1 -1
- package/dist/esm/components/resources/ResourceListItemRenderer.js +6 -1
- package/dist/esm/components/resources/ResourceListItemRenderer.js.map +1 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.d.ts.map +1 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js +5 -1
- package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js.map +1 -1
- package/dist/esm/components/resources/skeleton/DisplayLayout.js +2 -2
- package/dist/esm/components/resources/skeleton/DisplayLayout.js.map +1 -1
- package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.d.ts.map +1 -1
- package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.js +71 -16
- package/dist/esm/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.js.map +1 -1
- package/dist/esm/components/sections/surface.d.ts +12 -0
- package/dist/esm/components/sections/surface.d.ts.map +1 -1
- package/dist/esm/components/sections/surface.js +14 -0
- package/dist/esm/components/sections/surface.js.map +1 -1
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.d.ts +27 -24
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.d.ts.map +1 -1
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.js +27 -33
- package/dist/esm/components/views/chart-dashboard/ChartDashboard.js.map +1 -1
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.d.ts +37 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.d.ts.map +1 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.js +100 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.js.map +1 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.d.ts +3 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.d.ts.map +1 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.js +34 -0
- package/dist/esm/components/views/chart-dashboard/ChartDashboardLayoutEditor.labels.js.map +1 -0
- package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.d.ts +47 -0
- package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.d.ts.map +1 -0
- package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.js +94 -0
- package/dist/esm/components/views/chart-dashboard/chart-dashboard-layout.utils.js.map +1 -0
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.d.ts +39 -0
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.d.ts.map +1 -0
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.js +155 -0
- package/dist/esm/components/views/chart-dashboard/useChartDashboardLayout.js.map +1 -0
- package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.d.ts.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.js +3 -2
- package/dist/esm/core/app-shell/shell-motion/shell-motion-origins.js.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.d.ts +15 -0
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.d.ts.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js +29 -0
- package/dist/esm/core/app-shell/shell-motion/shell-motion-vocabulary.js.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/use-shell-motion.d.ts.map +1 -1
- package/dist/esm/core/app-shell/shell-motion/use-shell-motion.js +2 -2
- package/dist/esm/core/app-shell/shell-motion/use-shell-motion.js.map +1 -1
- package/dist/esm/core/branding/useBrandPresentation.d.ts.map +1 -1
- package/dist/esm/core/branding/useBrandPresentation.js +17 -6
- package/dist/esm/core/branding/useBrandPresentation.js.map +1 -1
- package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.d.ts.map +1 -1
- package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js +2 -0
- package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js.map +1 -1
- package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.d.ts.map +1 -1
- package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.js +11 -1
- package/dist/esm/core/execution/useExecutionResourceOperationContextBuilder.js.map +1 -1
- package/dist/esm/core/i18n/I18nContext.d.ts.map +1 -1
- package/dist/esm/core/i18n/I18nContext.js +8 -2
- package/dist/esm/core/i18n/I18nContext.js.map +1 -1
- package/dist/esm/core/i18n/component-label-resolution.utils.d.ts.map +1 -1
- package/dist/esm/core/i18n/component-label-resolution.utils.js +6 -1
- package/dist/esm/core/i18n/component-label-resolution.utils.js.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.d.ts +0 -15
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.d.ts.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.js +71 -6
- package/dist/esm/core/monitoring/analytics/AnalyticsContext.js.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.d.ts.map +1 -1
- package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.js +12 -3
- package/dist/esm/core/monitoring/analytics/AnalyticsEventBridge.js.map +1 -1
- package/dist/esm/core/navigation/NavigationContext.d.ts.map +1 -1
- package/dist/esm/core/navigation/NavigationContext.js +60 -17
- package/dist/esm/core/navigation/NavigationContext.js.map +1 -1
- package/dist/esm/core/navigation/launcher-resolution.d.ts +29 -0
- package/dist/esm/core/navigation/launcher-resolution.d.ts.map +1 -1
- package/dist/esm/core/navigation/launcher-resolution.js +31 -0
- package/dist/esm/core/navigation/launcher-resolution.js.map +1 -1
- package/dist/esm/core/navigation/navigation-controller-internals.d.ts +48 -0
- package/dist/esm/core/navigation/navigation-controller-internals.d.ts.map +1 -1
- package/dist/esm/core/navigation/navigation-controller-internals.js +56 -3
- package/dist/esm/core/navigation/navigation-controller-internals.js.map +1 -1
- package/dist/esm/core/navigation/useNavigationRouterSync.d.ts.map +1 -1
- package/dist/esm/core/navigation/useNavigationRouterSync.js +30 -2
- package/dist/esm/core/navigation/useNavigationRouterSync.js.map +1 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts +34 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts.map +1 -1
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js +41 -0
- package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js.map +1 -1
- package/dist/esm/core/resources/route-parent-relocation.frontend.utils.d.ts +44 -0
- package/dist/esm/core/resources/route-parent-relocation.frontend.utils.d.ts.map +1 -0
- package/dist/esm/core/resources/route-parent-relocation.frontend.utils.js +63 -0
- package/dist/esm/core/resources/route-parent-relocation.frontend.utils.js.map +1 -0
- package/dist/esm/core/resources/useOperationDirectExecution.d.ts.map +1 -1
- package/dist/esm/core/resources/useOperationDirectExecution.js +45 -6
- package/dist/esm/core/resources/useOperationDirectExecution.js.map +1 -1
- package/dist/esm/core/runtime/AppRouter.d.ts.map +1 -1
- package/dist/esm/core/runtime/AppRouter.js +18 -1
- package/dist/esm/core/runtime/AppRouter.js.map +1 -1
- package/dist/esm/core/security/UserOrgsContext.d.ts.map +1 -1
- package/dist/esm/core/security/UserOrgsContext.js +61 -8
- package/dist/esm/core/security/UserOrgsContext.js.map +1 -1
- package/dist/esm/core/ui/inner-control-activation.utils.d.ts +16 -0
- package/dist/esm/core/ui/inner-control-activation.utils.d.ts.map +1 -0
- package/dist/esm/core/ui/inner-control-activation.utils.js +44 -0
- package/dist/esm/core/ui/inner-control-activation.utils.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceCollectionBody_Calendar.js","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/calendar/ResourceCollectionBody_Calendar.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,+DAA+D,CAAC;AAChH,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,iGAAiG,CAAC;AAoCzG,MAAM,QAAQ,GAAuB,EAAE,CAAC;AAExC,MAAM,UAAU,+BAA+B,CAAwC,E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AG,CAAC,IAAI,CACnB,aAAI,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,+CAA+C,YACtE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gDAClB,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;gDAC/B,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;gDACjC,OAAO,CACL,aAAiB,SAAS,EAAC,WAAW,wBAAqB,MAAM,YAC9D,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACnB,KAAC,MAAM,IACL,OAAO,EAAE,sBAAsB,CAAC,KAAK,EACrC,IAAI,EAAE,UAAU,CAAC,EAAE,EACnB,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC5B,SAAS,EAAC,sFAAsF,EAChG,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,YAE9B,KAAK,GACC,CACV,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,mCAAmC,EAAC,KAAK,EAAE,KAAK,YAAG,KAAK,GAAQ,CACjF,IAdM,MAAM,CAeV,CACN,CAAC;4CACJ,CAAC,CAAC,GACC,CACN,KAjDI,GAAG,CAkDL,CACN,CAAC;4BACJ,CAAC,CAAC,IA1DK,IAAI,CAAC,CAAC,CAAE,CAAC,GAAG,CA2DhB,CACN,CAAC,GACI,IACF,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The CALENDAR body of a resource collection (`CollectionDisplayMode.CALENDAR`, #2298): a month grid, each row on the\n * day its date field falls on.\n *\n * Like the table and board bodies, the list host owns the fetch (whose window on the date field IS the visible weeks,\n * so moving to another month refetches), the bucketing by day, the row's label and what opening a row does. This\n * component owns the grid, the month navigation and the keyboard.\n *\n * ## Keyboard (the WAI-ARIA date-grid pattern)\n *\n * The grid is one tab stop: the FOCUSED day. Arrow keys move between days (Left/Right a day, Up/Down a week), Home/End\n * to the start and end of the week, Page Up/Page Down a month. Moving past the displayed month shows the neighbouring\n * month, and the focus follows. Tab from the focused day reaches that day's items (buttons), and only that day's: the\n * items of other days are reached by moving to their day first, so a month of rows does not become a hundred tab stops.\n */\n\nimport React, { useCallback, useEffect, useId, useRef, useState } from 'react';\nimport { ButtonSize } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { useIconRegistry } from '~wildo-frontend-lib/core/icons/useIconRegistry';\nimport { IconSize, StandardIconReference } from '~wildo-frontend-lib/core/icons/icon-registry.frontend.schemas';\nimport {\n calendarDayKey,\n calendarKeyboardStep,\n calendarMonthOf,\n moveCalendarFocus,\n shiftCalendarMonth,\n type CalendarGridDay,\n} from '~wildo-frontend-lib/components/resources/collection/calendar/collection-calendar.frontend.utils';\n\nexport interface ResourceCollectionBody_CalendarProps<TItem extends Record<string, unknown>> {\n /** The weeks of the displayed month (`buildCalendarMonthGrid`). */\n weeks: readonly (readonly CalendarGridDay[])[];\n /** The rows of each day, keyed by `calendarDayKey` (`groupItemsByCalendarDay`). */\n itemsByDay: ReadonlyMap<string, readonly TItem[]>;\n /** The first day of the displayed month, as UTC midnight. */\n month: Date;\n /** Today, as UTC midnight of the reader's day. */\n today: Date;\n /** The first day of the reader's week, `0` Sunday … `6` Saturday. */\n firstDayOfWeek: number;\n /** Show another month (the host moves its fetch window with it). */\n onMonthChange: (month: Date) => void;\n /** The heading of the displayed month (\"November 2026\"). */\n monthHeading: string;\n /** The seven weekday column headings, in grid order. */\n weekdayLabels: readonly string[];\n /** The day number shown in a cell. */\n dayNumberLabel: (day: Date) => string;\n /** A day cell's accessible name: its date and how many items fall on it. */\n dayLabel: (day: Date, count: number) => string;\n getItemId: (item: TItem) => string;\n /** The row's name as a list shows it. */\n getItemLabel: (item: TItem) => string;\n /** Whether the row can be opened; one that cannot is shown and not offered as a button. */\n canOpenItem: (item: TItem) => boolean;\n onOpenItem: (item: TItem) => void;\n calendarLabel: string;\n previousMonthLabel: string;\n nextMonthLabel: string;\n todayLabel: string;\n keyboardHint: string;\n}\n\nconst NO_ITEMS: readonly unknown[] = [];\n\nexport function ResourceCollectionBody_Calendar<TItem extends Record<string, unknown>>({\n weeks,\n itemsByDay,\n month,\n today,\n firstDayOfWeek,\n onMonthChange,\n monthHeading,\n weekdayLabels,\n dayNumberLabel,\n dayLabel,\n getItemId,\n getItemLabel,\n canOpenItem,\n onOpenItem,\n calendarLabel,\n previousMonthLabel,\n nextMonthLabel,\n todayLabel,\n keyboardHint,\n}: ResourceCollectionBody_CalendarProps<TItem>): React.JSX.Element {\n const hintId = useId();\n const headingId = useId();\n const { renderIcon } = useIconRegistry();\n const gridRef = useRef<HTMLTableElement>(null);\n /** The day holding the grid's single tab stop. Kept inside the displayed month when the month changes. */\n const [focusedDay, setFocusedDay] = useState<Date>(() => (calendarMonthOf(today).getTime() === calendarMonthOf(month).getTime() ? today : calendarMonthOf(month)));\n /** Set by a keyboard move, so the focus follows the move once the grid has re-rendered (the month may change). */\n const moveFocusRef = useRef(false);\n\n // A month changed by the buttons (or by the host) brings the tab stop with it.\n useEffect(() => {\n setFocusedDay((current) => (calendarMonthOf(current).getTime() === calendarMonthOf(month).getTime() ? current : calendarMonthOf(month)));\n }, [month]);\n\n const focusedKey = calendarDayKey(focusedDay);\n useEffect(() => {\n if (!moveFocusRef.current) return;\n moveFocusRef.current = false;\n gridRef.current?.querySelector<HTMLElement>(`[data-calendar-day=\"${focusedKey}\"]`)?.focus();\n }, [focusedKey, weeks]);\n\n const focusDay = useCallback((day: Date) => {\n moveFocusRef.current = true;\n setFocusedDay(day);\n const target = calendarMonthOf(day);\n if (target.getTime() !== calendarMonthOf(month).getTime()) onMonthChange(target);\n }, [month, onMonthChange]);\n\n const onDayKeyDown = (event: React.KeyboardEvent<HTMLElement>, day: Date) => {\n // Only the day cell itself: the arrow keys keep their meaning on the items inside it.\n if (event.target !== event.currentTarget) return;\n const step = calendarKeyboardStep(event.key);\n if (!step) return;\n event.preventDefault();\n focusDay(moveCalendarFocus(day, step, firstDayOfWeek));\n };\n\n const todayKey = calendarDayKey(today);\n return (\n <div className=\"flex flex-col gap-item-sm\" data-slot=\"collection-calendar\">\n <div className=\"flex items-center gap-item-sm\">\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.ICON_SM}\n aria-label={previousMonthLabel}\n title={previousMonthLabel}\n onClick={() => onMonthChange(shiftCalendarMonth(month, -1))}\n >\n <span aria-hidden=\"true\">{renderIcon(StandardIconReference.CHEVRON_LEFT, { size: IconSize.SM })}</span>\n </Button>\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.ICON_SM}\n aria-label={nextMonthLabel}\n title={nextMonthLabel}\n onClick={() => onMonthChange(shiftCalendarMonth(month, 1))}\n >\n <span aria-hidden=\"true\">{renderIcon(StandardIconReference.CHEVRON_RIGHT, { size: IconSize.SM })}</span>\n </Button>\n <h3 id={headingId} className=\"text-sm font-medium\" aria-live=\"polite\">{monthHeading}</h3>\n <Button variant={ButtonVariants_Variant.GHOST} size={ButtonSize.SM} className=\"ms-auto\" onClick={() => focusDay(today)}>\n {todayLabel}\n </Button>\n </div>\n <span id={hintId} className=\"sr-only\">{keyboardHint}</span>\n <table\n ref={gridRef}\n role=\"grid\"\n aria-label={calendarLabel}\n aria-describedby={hintId}\n className=\"w-full table-fixed border-collapse\"\n >\n <caption className=\"sr-only\">{monthHeading}</caption>\n <thead>\n <tr>\n {weekdayLabels.map((label, index) => (\n <th key={index} scope=\"col\" className=\"pb-item-xs text-xs font-medium text-muted-foreground\">{label}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {weeks.map((week) => (\n <tr key={week[0]!.key}>\n {week.map(({ day, key, inMonth }) => {\n const items = itemsByDay.get(key) ?? (NO_ITEMS as readonly TItem[]);\n const isFocused = key === focusedKey;\n return (\n <td\n key={key}\n role=\"gridcell\"\n data-calendar-day={key}\n data-in-month={inMonth ? 'true' : undefined}\n data-today={key === todayKey ? 'true' : undefined}\n aria-label={dayLabel(day, items.length)}\n aria-current={key === todayKey ? 'date' : undefined}\n tabIndex={isFocused ? 0 : -1}\n onKeyDown={(event) => onDayKeyDown(event, day)}\n onFocus={(event) => { if (event.target === event.currentTarget && !isFocused) setFocusedDay(day); }}\n className={cn(\n 'h-24 border align-top p-item-xs outline-none focus-visible:ring-2 focus-visible:ring-ring',\n !inMonth && 'bg-muted/30 text-muted-foreground',\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'mb-item-xs inline-flex size-6 items-center justify-center rounded-full text-xs',\n key === todayKey && 'bg-primary text-primary-foreground',\n )}\n >\n {dayNumberLabel(day)}\n </span>\n {items.length > 0 && (\n <ul role=\"list\" className=\"flex max-h-28 flex-col gap-px overflow-y-auto\">\n {items.map((item) => {\n const itemId = getItemId(item);\n const label = getItemLabel(item);\n return (\n <li key={itemId} className=\"list-none\" data-calendar-item={itemId}>\n {canOpenItem(item) ? (\n <Button\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.XS}\n tabIndex={isFocused ? 0 : -1}\n className=\"h-auto w-full justify-start truncate px-item-xs py-px text-start text-xs font-normal\"\n title={label}\n onClick={() => onOpenItem(item)}\n >\n {label}\n </Button>\n ) : (\n <span className=\"block truncate px-item-xs text-xs\" title={label}>{label}</span>\n )}\n </li>\n );\n })}\n </ul>\n )}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ResourceCollectionBody_Calendar.js","sourceRoot":"","sources":["../../../../../../src/components/resources/collection/calendar/ResourceCollectionBody_Calendar.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,C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IAAI,CAAC,YAE9B,KAAK,GACC,CACV,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,mCAAmC,EAAC,KAAK,EAAE,KAAK,YAAG,KAAK,GAAQ,CACjF,IAdM,MAAM,CAeV,CACN,CAAC;4CACJ,CAAC,CAAC,GACC,CACN,KApDI,GAAG,CAqDL,CACN,CAAC;4BACJ,CAAC,CAAC,IA7DK,IAAI,CAAC,CAAC,CAAE,CAAC,GAAG,CA8DhB,CACN,CAAC,GACI,IACF,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The CALENDAR body of a resource collection (`CollectionDisplayMode.CALENDAR`, #2298): a month grid, each row on the\n * day its date field falls on.\n *\n * Like the table and board bodies, the list host owns the fetch (whose window on the date field IS the visible weeks,\n * so moving to another month refetches), the bucketing by day, the row's label and what opening a row does. This\n * component owns the grid, the month navigation and the keyboard.\n *\n * ## Keyboard (the WAI-ARIA date-grid pattern)\n *\n * The grid is one tab stop: the FOCUSED day. Arrow keys move between days (Left/Right a day, Up/Down a week), Home/End\n * to the start and end of the week, Page Up/Page Down a month. Moving past the displayed month shows the neighbouring\n * month, and the focus follows. Tab from the focused day reaches that day's items (buttons), and only that day's: the\n * items of other days are reached by moving to their day first, so a month of rows does not become a hundred tab stops.\n */\n\nimport React, { useCallback, useEffect, useId, useRef, useState } from 'react';\nimport { ButtonSize } from '@wildo-ai/presets-components-models';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { focusIndicatorClasses, FocusIndicatorShape } from '~wildo-frontend-lib/core/ui/themes/focus-indicator';\nimport { Button, ButtonVariants_Variant } from '~wildo-frontend-lib/components/actions/button';\nimport { useIconRegistry } from '~wildo-frontend-lib/core/icons/useIconRegistry';\nimport { IconSize, StandardIconReference } from '~wildo-frontend-lib/core/icons/icon-registry.frontend.schemas';\nimport {\n calendarDayKey,\n calendarKeyboardStep,\n calendarMonthOf,\n moveCalendarFocus,\n shiftCalendarMonth,\n type CalendarGridDay,\n} from '~wildo-frontend-lib/components/resources/collection/calendar/collection-calendar.frontend.utils';\n\nexport interface ResourceCollectionBody_CalendarProps<TItem extends Record<string, unknown>> {\n /** The weeks of the displayed month (`buildCalendarMonthGrid`). */\n weeks: readonly (readonly CalendarGridDay[])[];\n /** The rows of each day, keyed by `calendarDayKey` (`groupItemsByCalendarDay`). */\n itemsByDay: ReadonlyMap<string, readonly TItem[]>;\n /** The first day of the displayed month, as UTC midnight. */\n month: Date;\n /** Today, as UTC midnight of the reader's day. */\n today: Date;\n /** The first day of the reader's week, `0` Sunday … `6` Saturday. */\n firstDayOfWeek: number;\n /** Show another month (the host moves its fetch window with it). */\n onMonthChange: (month: Date) => void;\n /** The heading of the displayed month (\"November 2026\"). */\n monthHeading: string;\n /** The seven weekday column headings, in grid order. */\n weekdayLabels: readonly string[];\n /** The day number shown in a cell. */\n dayNumberLabel: (day: Date) => string;\n /** A day cell's accessible name: its date and how many items fall on it. */\n dayLabel: (day: Date, count: number) => string;\n getItemId: (item: TItem) => string;\n /** The row's name as a list shows it. */\n getItemLabel: (item: TItem) => string;\n /** Whether the row can be opened; one that cannot is shown and not offered as a button. */\n canOpenItem: (item: TItem) => boolean;\n onOpenItem: (item: TItem) => void;\n calendarLabel: string;\n previousMonthLabel: string;\n nextMonthLabel: string;\n todayLabel: string;\n keyboardHint: string;\n}\n\nconst NO_ITEMS: readonly unknown[] = [];\n\nexport function ResourceCollectionBody_Calendar<TItem extends Record<string, unknown>>({\n weeks,\n itemsByDay,\n month,\n today,\n firstDayOfWeek,\n onMonthChange,\n monthHeading,\n weekdayLabels,\n dayNumberLabel,\n dayLabel,\n getItemId,\n getItemLabel,\n canOpenItem,\n onOpenItem,\n calendarLabel,\n previousMonthLabel,\n nextMonthLabel,\n todayLabel,\n keyboardHint,\n}: ResourceCollectionBody_CalendarProps<TItem>): React.JSX.Element {\n const hintId = useId();\n const headingId = useId();\n const { renderIcon } = useIconRegistry();\n const gridRef = useRef<HTMLTableElement>(null);\n /** The day holding the grid's single tab stop. Kept inside the displayed month when the month changes. */\n const [focusedDay, setFocusedDay] = useState<Date>(() => (calendarMonthOf(today).getTime() === calendarMonthOf(month).getTime() ? today : calendarMonthOf(month)));\n /** Set by a keyboard move, so the focus follows the move once the grid has re-rendered (the month may change). */\n const moveFocusRef = useRef(false);\n\n // A month changed by the buttons (or by the host) brings the tab stop with it.\n useEffect(() => {\n setFocusedDay((current) => (calendarMonthOf(current).getTime() === calendarMonthOf(month).getTime() ? current : calendarMonthOf(month)));\n }, [month]);\n\n const focusedKey = calendarDayKey(focusedDay);\n useEffect(() => {\n if (!moveFocusRef.current) return;\n moveFocusRef.current = false;\n gridRef.current?.querySelector<HTMLElement>(`[data-calendar-day=\"${focusedKey}\"]`)?.focus();\n }, [focusedKey, weeks]);\n\n const focusDay = useCallback((day: Date) => {\n moveFocusRef.current = true;\n setFocusedDay(day);\n const target = calendarMonthOf(day);\n if (target.getTime() !== calendarMonthOf(month).getTime()) onMonthChange(target);\n }, [month, onMonthChange]);\n\n const onDayKeyDown = (event: React.KeyboardEvent<HTMLElement>, day: Date) => {\n // Only the day cell itself: the arrow keys keep their meaning on the items inside it.\n if (event.target !== event.currentTarget) return;\n const step = calendarKeyboardStep(event.key);\n if (!step) return;\n event.preventDefault();\n focusDay(moveCalendarFocus(day, step, firstDayOfWeek));\n };\n\n const todayKey = calendarDayKey(today);\n return (\n <div className=\"flex flex-col gap-item-sm\" data-slot=\"collection-calendar\">\n <div className=\"flex items-center gap-item-sm\">\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.ICON_SM}\n aria-label={previousMonthLabel}\n title={previousMonthLabel}\n onClick={() => onMonthChange(shiftCalendarMonth(month, -1))}\n >\n <span aria-hidden=\"true\">{renderIcon(StandardIconReference.CHEVRON_LEFT, { size: IconSize.SM })}</span>\n </Button>\n <Button\n variant={ButtonVariants_Variant.OUTLINE}\n size={ButtonSize.ICON_SM}\n aria-label={nextMonthLabel}\n title={nextMonthLabel}\n onClick={() => onMonthChange(shiftCalendarMonth(month, 1))}\n >\n <span aria-hidden=\"true\">{renderIcon(StandardIconReference.CHEVRON_RIGHT, { size: IconSize.SM })}</span>\n </Button>\n <h3 id={headingId} className=\"text-sm font-medium\" aria-live=\"polite\">{monthHeading}</h3>\n <Button variant={ButtonVariants_Variant.GHOST} size={ButtonSize.SM} className=\"ms-auto\" onClick={() => focusDay(today)}>\n {todayLabel}\n </Button>\n </div>\n <span id={hintId} className=\"sr-only\">{keyboardHint}</span>\n <table\n ref={gridRef}\n role=\"grid\"\n aria-label={calendarLabel}\n aria-describedby={hintId}\n className=\"w-full table-fixed border-collapse\"\n >\n <caption className=\"sr-only\">{monthHeading}</caption>\n <thead>\n <tr>\n {weekdayLabels.map((label, index) => (\n <th key={index} scope=\"col\" className=\"pb-item-xs text-xs font-medium text-muted-foreground\">{label}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {weeks.map((week) => (\n <tr key={week[0]!.key}>\n {week.map(({ day, key, inMonth }) => {\n const items = itemsByDay.get(key) ?? (NO_ITEMS as readonly TItem[]);\n const isFocused = key === focusedKey;\n return (\n <td\n key={key}\n role=\"gridcell\"\n data-calendar-day={key}\n data-in-month={inMonth ? 'true' : undefined}\n data-today={key === todayKey ? 'true' : undefined}\n aria-label={dayLabel(day, items.length)}\n aria-current={key === todayKey ? 'date' : undefined}\n tabIndex={isFocused ? 0 : -1}\n onKeyDown={(event) => onDayKeyDown(event, day)}\n onFocus={(event) => { if (event.target === event.currentTarget && !isFocused) setFocusedDay(day); }}\n className={cn(\n // A day cell sits packed in the grid, its neighbours flush against it: the INSET shape draws\n // inside the box so no neighbour or clipping ancestor covers it.\n 'h-24 border align-top p-item-xs',\n focusIndicatorClasses(FocusIndicatorShape.INSET),\n !inMonth && 'bg-muted/30 text-muted-foreground',\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'mb-item-xs inline-flex size-6 items-center justify-center rounded-full text-xs',\n key === todayKey && 'bg-primary text-primary-foreground',\n )}\n >\n {dayNumberLabel(day)}\n </span>\n {items.length > 0 && (\n <ul role=\"list\" className=\"flex max-h-28 flex-col gap-px overflow-y-auto\">\n {items.map((item) => {\n const itemId = getItemId(item);\n const label = getItemLabel(item);\n return (\n <li key={itemId} className=\"list-none\" data-calendar-item={itemId}>\n {canOpenItem(item) ? (\n <Button\n variant={ButtonVariants_Variant.GHOST}\n size={ButtonSize.XS}\n tabIndex={isFocused ? 0 : -1}\n className=\"h-auto w-full justify-start truncate px-item-xs py-px text-start text-xs font-normal\"\n title={label}\n onClick={() => onOpenItem(item)}\n >\n {label}\n </Button>\n ) : (\n <span className=\"block truncate px-item-xs text-xs\" title={label}>{label}</span>\n )}\n </li>\n );\n })}\n </ul>\n )}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import React, { useMemo } from 'react';
|
|
|
4
4
|
import { TypographyVariant } from '@wildo-ai/presets-components-models';
|
|
5
5
|
import { SectionLegendVoiceHost } from '../../sections/section-legend-voice.js';
|
|
6
6
|
import { cn } from '../../../core/ui/cn.js';
|
|
7
|
-
import {
|
|
7
|
+
import { optionalMaxInlineSizeStyle } from '../../sections/surface.js';
|
|
8
8
|
import { FieldScopeProvider } from './FieldScopeContext.js';
|
|
9
9
|
import { useOptionalDisplayTemplateContext } from '../../data-display/DisplayTemplateContext.js';
|
|
10
10
|
import { ContentSectionContainer } from '../../sections/ContentSectionContainer.js';
|
|
@@ -52,7 +52,7 @@ export function DisplayLayout({ className, children, responsiveMaxWidth }) {
|
|
|
52
52
|
// The selector spells the attribute literally because Tailwind reads class names statically;
|
|
53
53
|
// `display-layout-derived-width.test.tsx` holds it equal to `COLLECTION_SURFACE_ATTRIBUTE`.
|
|
54
54
|
responsiveMaxWidth === undefined
|
|
55
|
-
&& '[max-inline-size:var(--measure-max-width,42rem)] has-[[data-collection-surface]]:[max-inline-size:none]', className), style:
|
|
55
|
+
&& '[max-inline-size:var(--measure-max-width,42rem)] has-[[data-collection-surface]]:[max-inline-size:none]', className), style: optionalMaxInlineSizeStyle(responsiveMaxWidth), "data-inline-size-tier": responsiveMaxWidth ?? 'derived', "data-guidance-display": true, children: renderedChildren }) }) }));
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Introspects children for `<Section>` elements with container-mode `appearance`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayLayout.js","sourceRoot":"","sources":["../../../../../src/components/resources/skeleton/DisplayLayout.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAA2B,MAAM,qCAAqC,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AAC9F,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EACL,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAqB,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mDAAmD,CAAC;AACnG,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,GAE3B,MAAM,+BAA+B,CAAC;AAgCvC,0EAA0E;AAE1E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM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AY,EACZ,eAAe,GAIhB;IACC,OAAO,CACL,KAAC,kBAAkB,IACjB,QAAQ,EAAE,sBAAsB,CAAC,OAAO,EACxC,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,GAChC,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport React, { useMemo, type ReactNode } from 'react';\nimport { TypographyVariant, type ResponsiveMaxWidth } from '@wildo-ai/presets-components-models';\nimport { SectionLegendVoiceHost } from '../../sections/section-legend-voice';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { responsiveMaxWidthToCssValue } from '../../sections/surface';\nimport { FieldScopeProvider } from './FieldScopeContext';\nimport { useOptionalDisplayTemplateContext } from '../../data-display/DisplayTemplateContext';\nimport { ContentSectionContainer } from '../../sections/ContentSectionContainer';\nimport type { ContentSectionDescriptor } from '../../sections/ContentSectionContainer';\nimport {\n groupSectionsByAppearance,\n buildSectionConfigFromGroup,\n} from './section-consolidation.utils';\nimport { GroupedSectionBody, type SectionProps } from './Section';\nimport { GroupedSectionHostKind } from './Section.shared';\nimport type { SectionConfig } from '@wildo-ai/presets-components-models';\nimport { SectionMode, getEnumValues } from '@wildo-ai/zod-decorators';\nimport { getFieldSchema, getNestedValue } from '../../data-display/display-field-resolution.utils';\nimport {\n SectionStageBindingError,\n assertSectionStageBinding,\n resolveCurrentSectionStage,\n type SectionStageBinding,\n} from '../../sections/section-stages';\nimport type { SectionGroup } from './section-consolidation.utils';\n\n/** @wildo_source:part:start saas.frontend.display-layout.reading-measure facet:layer:frontend facet:family:layout facet:audience:app-developer */\nexport interface DisplayLayoutProps {\n /** Additional CSS classes for the root container. */\n className?: string;\n /**\n * How wide the layout root lets its content grow, named in the framework's own vocabulary.\n *\n * Left unset, the width is DERIVED from what the layout renders: the reading-measure cap (~42rem, themeable\n * via `--measure-max-width`) that keeps a single-column stack of label/value pairs readable instead of\n * stretched edge to edge — lifted as soon as the layout holds a collection (see the last paragraph).\n *\n * It is WRONG for a composed document. A template that renders tabs, quote blocks, tables or regions\n * is not a field stack: those set their own measure internally, and a 42rem cap around them squeezes\n * the whole composition into a column with dead space beside it. Such a template declares `'none'`.\n *\n * `'none'` is not \"uncapped\" in practice — the zone content boundary above has already capped the\n * area at the page-content width (`'content'`, ~80rem) and an adjacent pane is narrower still. This\n * prop decides only whether a SECOND, tighter cap applies inside that, and the answer depends on what\n * the template renders, which is why the template is the one asked.\n *\n * Left UNSET, the cap is derived from what the layout actually renders: the reading measure for fields,\n * lifted as soon as the layout holds a COLLECTION (a related list, an embedded collection — any surface\n * marked {@link COLLECTION_SURFACE_ATTRIBUTE}). A list squeezed into a 42rem column, under a header that\n * spans the page, is what a field-only cap does to a record whose page is mostly its list. Declared, the\n * value is the template's statement and is applied as given.\n */\n responsiveMaxWidth?: ResponsiveMaxWidth;\n children?: ReactNode;\n}\n/** @wildo_source:part:end saas.frontend.display-layout.reading-measure */\n\n/**\n * The attribute that marks a COLLECTION in the rendered page, so a layout around it can tell it holds a list.\n *\n * Carried by the `ResourceLayout_List` / `ResourceLayout_Search` wrappers (around any preset or custom view, from\n * the first paint) and by a `RelatedResourceSections` block that holds a list (before its labels load, whichever\n * tab is open). Read by CSS `:has()`: by `DisplayLayout`, to lift its reading measure, and by the READ page, to give\n * the danger zone the same width as the record body (`--record-body-max-inline-size`). Being CSS, the decision\n * follows the DOM and never needs a second render.\n */\nexport const COLLECTION_SURFACE_ATTRIBUTE = 'data-collection-surface';\n\n/**\n * Root wrapper for display (read-only) layout templates.\n *\n * Provides a root `FieldScopeContext` with empty prefix so nested\n * `<DisplayField name=\"...\">` components resolve field names correctly.\n *\n * `ResourceDisplayContext` (inline editing, RMM, file upload) is provided\n * by the parent `ResourceAutomaticDisplayer`, not by this layout component.\n *\n * @example\n * ```tsx\n * <DisplayLayout>\n * <Section name=\"general\">\n * <DisplayField name=\"title\" />\n * <DisplayField name=\"status\" />\n * </Section>\n * </DisplayLayout>\n * ```\n */\nexport function DisplayLayout({ className, children, responsiveMaxWidth }: DisplayLayoutProps): ReactNode {\n const displayCtx = useOptionalDisplayTemplateContext();\n const renderedChildren = useMemo(\n () => renderGroupedChildren(children, displayCtx),\n [children, displayCtx],\n );\n\n return (\n <FieldScopeProvider pathPrefix=\"\">\n {/* A read body names its section groups in the EYEBROW voice — see `SectionLegendVoiceHost`. */}\n <SectionLegendVoiceHost voice={TypographyVariant.EYEBROW}>\n {/*\n T4c — reading-measure cap (mirrors FormLayout). A single-column\n read/detail stack caps at `--measure-max-width` (~42rem) and aligns to\n the LEFT of the content zone, so detail views stop stretching\n edge-to-edge yet stay flush with the left-aligned resource header and\n danger-zone siblings (no centred gutter between them). `max-w` only\n engages above the measure, so a detail rendered inside a narrow\n dialog/panel is unaffected. Retune/opt-out via the CSS var or `className`.\n */}\n {/*\n `space-y-section` separates stacked SECTIONS (each titled CARD group /\n container) with a clear gap so consecutive cards read as distinct groups\n rather than one continuous stack. Sectionless templates whose direct\n children are bare SETTINGS_ROW field rows must NOT inherit that section\n gap: the row chrome is a self-delimiting list item (`py-card-sm` rhythm +\n `border-b` hairline), so consecutive rows stack FLUSH — the same\n content-aware rule the `ContentSection` body applies to settings rows.\n The pairwise `:has(+ …)` selector zeroes only the margin BETWEEN two\n adjacent settings rows, so a row followed by a real section (mixed\n template) keeps the section gap.\n\n ⚠ The attribute match is `^=settings` (prefix), NOT `=settings_row`:\n Tailwind converts an unescaped `_` inside an arbitrary variant to a\n SPACE, emitting the invalid selector `[data-chrome-mode=settings row]`\n which the browser silently drops (this killed ContentSection's original\n `…=settings_row]]:gap-0` spelling — verified against the served CSS).\n Only `settings_row` starts with `settings`, so the prefix is exact.\n */}\n <div\n className={cn(\n 'mr-auto w-full space-y-section',\n '[&>[data-chrome-mode^=settings]:has(+[data-chrome-mode^=settings])]:mb-0',\n // Derived width (no declaration): the reading measure, lifted when the layout holds a collection.\n // The selector spells the attribute literally because Tailwind reads class names statically;\n // `display-layout-derived-width.test.tsx` holds it equal to `COLLECTION_SURFACE_ATTRIBUTE`.\n responsiveMaxWidth === undefined\n && '[max-inline-size:var(--measure-max-width,42rem)] has-[[data-collection-surface]]:[max-inline-size:none]',\n className,\n )}\n style={responsiveMaxWidth === undefined ? undefined : { maxInlineSize: responsiveMaxWidthToCssValue(responsiveMaxWidth) }}\n data-inline-size-tier={responsiveMaxWidth ?? 'derived'}\n data-guidance-display\n >\n {renderedChildren}\n </div>\n </SectionLegendVoiceHost>\n </FieldScopeProvider>\n );\n}\n\n/**\n * Introspects children for `<Section>` elements with container-mode `appearance`.\n * Groups sections sharing the same container mode into a `ContentSectionContainer`.\n * Solo-mode sections and non-Section children render in place.\n */\nfunction renderGroupedChildren(\n children: ReactNode,\n displayCtx: ReturnType<typeof useOptionalDisplayTemplateContext>,\n): ReactNode {\n const grouped = groupSectionsByAppearance(children, displayCtx?.defaultSectionAppearance);\n\n return (\n <>\n {grouped.items.map((item, idx) => {\n if (item.type === 'node') {\n return <React.Fragment key={idx}>{item.node}</React.Fragment>;\n }\n\n const { group } = item;\n const config = withRecordStage(buildSectionConfigFromGroup(group), group, displayCtx);\n const sectionLabels = displayCtx?.sectionLabels ?? {};\n const sectionDescriptions = displayCtx?.sectionDescriptions ?? {};\n\n const contentSections: ContentSectionDescriptor[] = group.sections.map((el) => ({\n id: el.props.name,\n title: sectionLabels[el.props.name],\n description: sectionDescriptions[el.props.name],\n content: (\n <GroupedSectionContent\n sectionProps={el.props}\n providesHeading={!!sectionLabels[el.props.name]}\n />\n ),\n }));\n\n return (\n <ContentSectionContainer\n key={`group-${group.mode}-${idx}`}\n sections={contentSections}\n config={config}\n />\n );\n })}\n </>\n );\n}\n\n/**\n * A STAGES group's current stage, read from the record this layout displays (#1786). This host is the one that\n * holds the record, so it is where the bound field is read; the container only draws the result. Every other\n * mode's config is returned as built.\n *\n * The binding is checked against the field's schema on every render that groups it, and a binding that could\n * misstate a record's stage throws (`assertSectionStageBinding`). Outside a display template there is no record:\n * the config is returned without a stage and the container stacks the sections instead of guessing.\n */\nfunction withRecordStage(\n config: SectionConfig,\n group: SectionGroup,\n displayCtx: ReturnType<typeof useOptionalDisplayTemplateContext>,\n): SectionConfig {\n if (config.mode !== SectionMode.STAGES || displayCtx === null) return config;\n const [first, ...rest] = group.sections;\n const stageNames = group.sections.map((section) => section.props.name);\n // `stageBinding` exists only on the STAGES member of the `SectionProps` union; grouping already put only STAGES\n // sections here, but the element type does not know it.\n const stageBindingOf = (props: SectionProps): SectionStageBinding | undefined =>\n 'stageBinding' in props ? props.stageBinding : undefined;\n const stray = rest.find((section) => stageBindingOf(section.props) !== undefined);\n if (stray !== undefined) {\n throw new SectionStageBindingError(\n `section \"${stray.props.name}\" declares a stageBinding, but a group's binding is read from its FIRST section (\"${first.props.name}\"). Declare it there, once.`,\n );\n }\n const binding = stageBindingOf(first.props);\n const fieldSchema = binding ? getFieldSchema(displayCtx.schema, binding.field) : undefined;\n assertSectionStageBinding(binding, stageNames, fieldSchema ? getEnumValues(fieldSchema) : undefined);\n const currentStage = displayCtx.isLoading ? null : resolveCurrentSectionStage(binding, getNestedValue(displayCtx.data, binding.field));\n return { ...config, currentStage };\n}\n\n/**\n * Wraps an individual grouped section's content with section-level behaviors\n * (displayChromeMode) when rendered inside a container.\n */\nfunction GroupedSectionContent({\n sectionProps,\n providesHeading,\n}: {\n sectionProps: Pick<SectionProps, 'name' | 'children' | 'chromeMode' | 'className' | 'disabled'>;\n providesHeading?: boolean;\n}): ReactNode {\n return (\n <GroupedSectionBody\n hostKind={GroupedSectionHostKind.DISPLAY}\n sectionProps={sectionProps}\n providesHeading={providesHeading}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DisplayLayout.js","sourceRoot":"","sources":["../../../../../src/components/resources/skeleton/DisplayLayout.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAA2B,MAAM,qCAAqC,CAAC;AACjG,OAAO,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A6B,CAC/J,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3F,yBAAyB,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACrG,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B,CAAC,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACvI,OAAO,EAAE,GAAG,MAAM,EAAE,YAAY,EAAE,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,SAAS,qBAAqB,CAAC,EAC7B,YAAY,EACZ,eAAe,GAIhB;IACC,OAAO,CACL,KAAC,kBAAkB,IACjB,QAAQ,EAAE,sBAAsB,CAAC,OAAO,EACxC,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,GAChC,CACH,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport React, { useMemo, type ReactNode } from 'react';\nimport { TypographyVariant, type ResponsiveMaxWidth } from '@wildo-ai/presets-components-models';\nimport { SectionLegendVoiceHost } from '../../sections/section-legend-voice';\nimport { cn } from '~wildo-frontend-lib/core/ui/cn';\nimport { optionalMaxInlineSizeStyle } from '../../sections/surface';\nimport { FieldScopeProvider } from './FieldScopeContext';\nimport { useOptionalDisplayTemplateContext } from '../../data-display/DisplayTemplateContext';\nimport { ContentSectionContainer } from '../../sections/ContentSectionContainer';\nimport type { ContentSectionDescriptor } from '../../sections/ContentSectionContainer';\nimport {\n groupSectionsByAppearance,\n buildSectionConfigFromGroup,\n} from './section-consolidation.utils';\nimport { GroupedSectionBody, type SectionProps } from './Section';\nimport { GroupedSectionHostKind } from './Section.shared';\nimport type { SectionConfig } from '@wildo-ai/presets-components-models';\nimport { SectionMode, getEnumValues } from '@wildo-ai/zod-decorators';\nimport { getFieldSchema, getNestedValue } from '../../data-display/display-field-resolution.utils';\nimport {\n SectionStageBindingError,\n assertSectionStageBinding,\n resolveCurrentSectionStage,\n type SectionStageBinding,\n} from '../../sections/section-stages';\nimport type { SectionGroup } from './section-consolidation.utils';\n\n/** @wildo_source:part:start saas.frontend.display-layout.reading-measure facet:layer:frontend facet:family:layout facet:audience:app-developer */\nexport interface DisplayLayoutProps {\n /** Additional CSS classes for the root container. */\n className?: string;\n /**\n * How wide the layout root lets its content grow, named in the framework's own vocabulary.\n *\n * Left unset, the width is DERIVED from what the layout renders: the reading-measure cap (~42rem, themeable\n * via `--measure-max-width`) that keeps a single-column stack of label/value pairs readable instead of\n * stretched edge to edge — lifted as soon as the layout holds a collection (see the last paragraph).\n *\n * It is WRONG for a composed document. A template that renders tabs, quote blocks, tables or regions\n * is not a field stack: those set their own measure internally, and a 42rem cap around them squeezes\n * the whole composition into a column with dead space beside it. Such a template declares `'none'`.\n *\n * `'none'` is not \"uncapped\" in practice — the zone content boundary above has already capped the\n * area at the page-content width (`'content'`, ~80rem) and an adjacent pane is narrower still. This\n * prop decides only whether a SECOND, tighter cap applies inside that, and the answer depends on what\n * the template renders, which is why the template is the one asked.\n *\n * Left UNSET, the cap is derived from what the layout actually renders: the reading measure for fields,\n * lifted as soon as the layout holds a COLLECTION (a related list, an embedded collection — any surface\n * marked {@link COLLECTION_SURFACE_ATTRIBUTE}). A list squeezed into a 42rem column, under a header that\n * spans the page, is what a field-only cap does to a record whose page is mostly its list. Declared, the\n * value is the template's statement and is applied as given.\n */\n responsiveMaxWidth?: ResponsiveMaxWidth;\n children?: ReactNode;\n}\n/** @wildo_source:part:end saas.frontend.display-layout.reading-measure */\n\n/**\n * The attribute that marks a COLLECTION in the rendered page, so a layout around it can tell it holds a list.\n *\n * Carried by the `ResourceLayout_List` / `ResourceLayout_Search` wrappers (around any preset or custom view, from\n * the first paint) and by a `RelatedResourceSections` block that holds a list (before its labels load, whichever\n * tab is open). Read by CSS `:has()`: by `DisplayLayout`, to lift its reading measure, and by the READ page, to give\n * the danger zone the same width as the record body (`--record-body-max-inline-size`). Being CSS, the decision\n * follows the DOM and never needs a second render.\n */\nexport const COLLECTION_SURFACE_ATTRIBUTE = 'data-collection-surface';\n\n/**\n * Root wrapper for display (read-only) layout templates.\n *\n * Provides a root `FieldScopeContext` with empty prefix so nested\n * `<DisplayField name=\"...\">` components resolve field names correctly.\n *\n * `ResourceDisplayContext` (inline editing, RMM, file upload) is provided\n * by the parent `ResourceAutomaticDisplayer`, not by this layout component.\n *\n * @example\n * ```tsx\n * <DisplayLayout>\n * <Section name=\"general\">\n * <DisplayField name=\"title\" />\n * <DisplayField name=\"status\" />\n * </Section>\n * </DisplayLayout>\n * ```\n */\nexport function DisplayLayout({ className, children, responsiveMaxWidth }: DisplayLayoutProps): ReactNode {\n const displayCtx = useOptionalDisplayTemplateContext();\n const renderedChildren = useMemo(\n () => renderGroupedChildren(children, displayCtx),\n [children, displayCtx],\n );\n\n return (\n <FieldScopeProvider pathPrefix=\"\">\n {/* A read body names its section groups in the EYEBROW voice — see `SectionLegendVoiceHost`. */}\n <SectionLegendVoiceHost voice={TypographyVariant.EYEBROW}>\n {/*\n T4c — reading-measure cap (mirrors FormLayout). A single-column\n read/detail stack caps at `--measure-max-width` (~42rem) and aligns to\n the LEFT of the content zone, so detail views stop stretching\n edge-to-edge yet stay flush with the left-aligned resource header and\n danger-zone siblings (no centred gutter between them). `max-w` only\n engages above the measure, so a detail rendered inside a narrow\n dialog/panel is unaffected. Retune/opt-out via the CSS var or `className`.\n */}\n {/*\n `space-y-section` separates stacked SECTIONS (each titled CARD group /\n container) with a clear gap so consecutive cards read as distinct groups\n rather than one continuous stack. Sectionless templates whose direct\n children are bare SETTINGS_ROW field rows must NOT inherit that section\n gap: the row chrome is a self-delimiting list item (`py-card-sm` rhythm +\n `border-b` hairline), so consecutive rows stack FLUSH — the same\n content-aware rule the `ContentSection` body applies to settings rows.\n The pairwise `:has(+ …)` selector zeroes only the margin BETWEEN two\n adjacent settings rows, so a row followed by a real section (mixed\n template) keeps the section gap.\n\n ⚠ The attribute match is `^=settings` (prefix), NOT `=settings_row`:\n Tailwind converts an unescaped `_` inside an arbitrary variant to a\n SPACE, emitting the invalid selector `[data-chrome-mode=settings row]`\n which the browser silently drops (this killed ContentSection's original\n `…=settings_row]]:gap-0` spelling — verified against the served CSS).\n Only `settings_row` starts with `settings`, so the prefix is exact.\n */}\n <div\n className={cn(\n 'mr-auto w-full space-y-section',\n '[&>[data-chrome-mode^=settings]:has(+[data-chrome-mode^=settings])]:mb-0',\n // Derived width (no declaration): the reading measure, lifted when the layout holds a collection.\n // The selector spells the attribute literally because Tailwind reads class names statically;\n // `display-layout-derived-width.test.tsx` holds it equal to `COLLECTION_SURFACE_ATTRIBUTE`.\n responsiveMaxWidth === undefined\n && '[max-inline-size:var(--measure-max-width,42rem)] has-[[data-collection-surface]]:[max-inline-size:none]',\n className,\n )}\n style={optionalMaxInlineSizeStyle(responsiveMaxWidth)}\n data-inline-size-tier={responsiveMaxWidth ?? 'derived'}\n data-guidance-display\n >\n {renderedChildren}\n </div>\n </SectionLegendVoiceHost>\n </FieldScopeProvider>\n );\n}\n\n/**\n * Introspects children for `<Section>` elements with container-mode `appearance`.\n * Groups sections sharing the same container mode into a `ContentSectionContainer`.\n * Solo-mode sections and non-Section children render in place.\n */\nfunction renderGroupedChildren(\n children: ReactNode,\n displayCtx: ReturnType<typeof useOptionalDisplayTemplateContext>,\n): ReactNode {\n const grouped = groupSectionsByAppearance(children, displayCtx?.defaultSectionAppearance);\n\n return (\n <>\n {grouped.items.map((item, idx) => {\n if (item.type === 'node') {\n return <React.Fragment key={idx}>{item.node}</React.Fragment>;\n }\n\n const { group } = item;\n const config = withRecordStage(buildSectionConfigFromGroup(group), group, displayCtx);\n const sectionLabels = displayCtx?.sectionLabels ?? {};\n const sectionDescriptions = displayCtx?.sectionDescriptions ?? {};\n\n const contentSections: ContentSectionDescriptor[] = group.sections.map((el) => ({\n id: el.props.name,\n title: sectionLabels[el.props.name],\n description: sectionDescriptions[el.props.name],\n content: (\n <GroupedSectionContent\n sectionProps={el.props}\n providesHeading={!!sectionLabels[el.props.name]}\n />\n ),\n }));\n\n return (\n <ContentSectionContainer\n key={`group-${group.mode}-${idx}`}\n sections={contentSections}\n config={config}\n />\n );\n })}\n </>\n );\n}\n\n/**\n * A STAGES group's current stage, read from the record this layout displays (#1786). This host is the one that\n * holds the record, so it is where the bound field is read; the container only draws the result. Every other\n * mode's config is returned as built.\n *\n * The binding is checked against the field's schema on every render that groups it, and a binding that could\n * misstate a record's stage throws (`assertSectionStageBinding`). Outside a display template there is no record:\n * the config is returned without a stage and the container stacks the sections instead of guessing.\n */\nfunction withRecordStage(\n config: SectionConfig,\n group: SectionGroup,\n displayCtx: ReturnType<typeof useOptionalDisplayTemplateContext>,\n): SectionConfig {\n if (config.mode !== SectionMode.STAGES || displayCtx === null) return config;\n const [first, ...rest] = group.sections;\n const stageNames = group.sections.map((section) => section.props.name);\n // `stageBinding` exists only on the STAGES member of the `SectionProps` union; grouping already put only STAGES\n // sections here, but the element type does not know it.\n const stageBindingOf = (props: SectionProps): SectionStageBinding | undefined =>\n 'stageBinding' in props ? props.stageBinding : undefined;\n const stray = rest.find((section) => stageBindingOf(section.props) !== undefined);\n if (stray !== undefined) {\n throw new SectionStageBindingError(\n `section \"${stray.props.name}\" declares a stageBinding, but a group's binding is read from its FIRST section (\"${first.props.name}\"). Declare it there, once.`,\n );\n }\n const binding = stageBindingOf(first.props);\n const fieldSchema = binding ? getFieldSchema(displayCtx.schema, binding.field) : undefined;\n assertSectionStageBinding(binding, stageNames, fieldSchema ? getEnumValues(fieldSchema) : undefined);\n const currentStage = displayCtx.isLoading ? null : resolveCurrentSectionStage(binding, getNestedValue(displayCtx.data, binding.field));\n return { ...config, currentStage };\n}\n\n/**\n * Wraps an individual grouped section's content with section-level behaviors\n * (displayChromeMode) when rendered inside a container.\n */\nfunction GroupedSectionContent({\n sectionProps,\n providesHeading,\n}: {\n sectionProps: Pick<SectionProps, 'name' | 'children' | 'chromeMode' | 'className' | 'disabled'>;\n providesHeading?: boolean;\n}): ReactNode {\n return (\n <GroupedSectionBody\n hostKind={GroupedSectionHostKind.DISPLAY}\n sectionProps={sectionProps}\n providesHeading={providesHeading}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceFieldDisplayPreset_ResourceReference_Default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"ResourceFieldDisplayPreset_ResourceReference_Default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/resources-fields/_presets/resource-reference/ResourceFieldDisplayPreset_ResourceReference_Default.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAwE,MAAM,OAAO,CAAC;AA6B7F,OAAO,KAAK,EAAE,yDAAyD,EAAE,MAAM,2GAA2G,CAAC;AA8D3L,eAAO,MAAM,oDAAoD,GAAI,gIASlE,yDAAyD,KAAG,KAAK,CAAC,GAAG,CAAC,OAu2BxE,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
9
9
|
* explicitly, the preset resolves it from relationship/FK metadata in the
|
|
10
10
|
* frontend registry rather than from local naming guesses alone.
|
|
11
11
|
*/
|
|
12
|
-
import React, { useEffect, useState, useCallback, useMemo, useRef } from 'react';
|
|
12
|
+
import React, { useContext, useEffect, useState, useCallback, useMemo, useRef } from 'react';
|
|
13
13
|
import { Link } from 'react-router';
|
|
14
14
|
import { Skeleton } from '../../../../components/feedback/skeleton.js';
|
|
15
15
|
import { Badge } from '../../../../components/data-display/badge.js';
|
|
@@ -23,14 +23,18 @@ import { useI18n } from '../../../../core/i18n/useI18n.js';
|
|
|
23
23
|
import { cn } from '../../../../core/ui/cn.js';
|
|
24
24
|
import { FocusIndicatorShape, focusIndicatorClasses } from '../../../../core/ui/themes/focus-indicator.js';
|
|
25
25
|
import { FrontendResourceUtils, frontendResourceUtils } from '../../../../core/resources/frontend-resource.utils.js';
|
|
26
|
-
import { pickPreferredOperationForCoreSemanticAddressability } from '../../../../core/resources/resource-addressability.frontend.utils.js';
|
|
26
|
+
import { pickPreferredOperationForCoreSemanticAddressability, resolveRecordOrganizationId } from '../../../../core/resources/resource-addressability.frontend.utils.js';
|
|
27
|
+
import { viewerReachesUserSubject } from '../../../../core/navigation/launcher-resolution.js';
|
|
28
|
+
import { useViewerEffectiveRolesInOrganization } from '../../../../core/navigation/launcher-runtime-availability.js';
|
|
29
|
+
import { useAppScopeSafe } from '../../../../core/scope/useAppScope.js';
|
|
27
30
|
import { scopeReferencedRecord } from '../../../../core/resources/referenced-record-scope.frontend.utils.js';
|
|
28
31
|
import { useResourceDisplayContext, withoutHiddenParentReference } from '../../../../components/data-display/automatic-displayer.utils.js';
|
|
29
32
|
import { resolveForeignKeyReferencedResourceType } from '../../../../components/data-display/reference-display-target.js';
|
|
30
33
|
import { useOptionalFormSchemaContext } from '../../../../components/form/useFormSchemaContext.js';
|
|
31
|
-
import { CoreResourceOperation, ParentDisplay, ResourcesConfigOperationsUrlsBuilderUtils } from '@wildo-ai/saas-models';
|
|
34
|
+
import { CoreResourceOperation, CoreResourceType, coreResourceShared_FieldIdentifier, ParentDisplay, ResourcesConfigOperationsUrlsBuilderUtils } from '@wildo-ai/saas-models';
|
|
32
35
|
import { NavigationContentType, NavigationZone } from '../../../../core/navigation/navigation.schemas.js';
|
|
33
36
|
import { NavigationUtils } from '../../../../core/navigation/navigation.utils.js';
|
|
37
|
+
import { ScopedNavigationControllerContext } from '../../../../core/navigation/useNavigationController.js';
|
|
34
38
|
import { ResourceSummaryDisplayer } from '../../../../components/data-display/ResourceSummaryDisplayer.js';
|
|
35
39
|
import { useUserFacingErrorMessage } from '../../../../core/errors/useUserFacingErrorMessage.js';
|
|
36
40
|
import { fetchResourceReferenceRecordAndLabel, normalizeResourceReferenceSelectionValue, } from '../../../../components/resources-fields/resource-reference/resource-reference.shared.utils.js';
|
|
@@ -171,6 +175,30 @@ export const ResourceFieldDisplayPreset_ResourceReference_Default = ({ fieldName
|
|
|
171
175
|
return displayParams?.linkable ?? true;
|
|
172
176
|
}, [isParentReference, parentRefConfig, displayParams?.linkable]);
|
|
173
177
|
const navigationZone = displayContext?.navigationZone ?? formSchemaContext?.navigationZone;
|
|
178
|
+
/*
|
|
179
|
+
* A SCOPED controller, when this reference is drawn inside a surface that keeps its own navigation stack — today the
|
|
180
|
+
* Settings Hub's sections (`SettingsSectionNavigationHost`), whose rows and actions drill in INSIDE the hub.
|
|
181
|
+
*
|
|
182
|
+
* Read as a bare context rather than through `useNavigationController()`, which throws outside a NavigationProvider:
|
|
183
|
+
* this preset also renders on hosts with no navigation at all (an artifact document), which is why it reaches
|
|
184
|
+
* navigation through the event bus.
|
|
185
|
+
*
|
|
186
|
+
* And why the bus is not enough here: NAVIGATION_REQUEST is translated by ONE runtime-owned bridge
|
|
187
|
+
* (`NavigationRequestBridge`), mounted under the NavigationProvider and therefore OUTSIDE any scoped host, so it
|
|
188
|
+
* always reaches the GLOBAL controller. A member's name in the Settings Hub's members table was sent there: the
|
|
189
|
+
* person's READ opened on the page beneath the hub while the hub stayed on top, and the click looked dead. Inside a
|
|
190
|
+
* scoped host the reference asks that host, exactly as clicking the member's row does, so the person opens in the
|
|
191
|
+
* hub's own drill-in with its back control.
|
|
192
|
+
*/
|
|
193
|
+
const scopedNavigationController = useContext(ScopedNavigationControllerContext);
|
|
194
|
+
/** Hands a navigation to the scoped host when there is one, else to the runtime's bridge. */
|
|
195
|
+
const requestNavigation = useCallback((request) => {
|
|
196
|
+
if (scopedNavigationController) {
|
|
197
|
+
scopedNavigationController.navigate(request);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
emit(FrontendEvents.NAVIGATION_REQUEST, { content: request.content, initiator: request.initiator, urlPath: request.urlPath });
|
|
201
|
+
}, [emit, scopedNavigationController]);
|
|
174
202
|
// Check if pre-populated data is usable through the configured resource id field.
|
|
175
203
|
const prePopulatedLabel = React.useMemo(() => {
|
|
176
204
|
if (!prePopulatedData || typeof prePopulatedData !== 'object' || !resourceType)
|
|
@@ -267,6 +295,30 @@ export const ResourceFieldDisplayPreset_ResourceReference_Default = ({ fieldName
|
|
|
267
295
|
targetId: id,
|
|
268
296
|
registry,
|
|
269
297
|
}), [hostContextIdentifiers, scopedContextualParameters, fkLinkUrlInfo?.currentParentRequirements, hostRecordType, hostRecordId, resourceType, registry]);
|
|
298
|
+
/*
|
|
299
|
+
* The viewer, for the one question the READ pick below must ask about them (#3791): whose row the READ may reach.
|
|
300
|
+
* Their roles in the tenant the host is read in, and their own user id. Both are read without the throwing hooks, so a
|
|
301
|
+
* host outside the providers (an artifact document) gets a viewer nobody is known to be, and a reference to a person
|
|
302
|
+
* offers no door there until the session is known.
|
|
303
|
+
*/
|
|
304
|
+
const referenceViewer = useViewerEffectiveRolesInOrganization(resolveRecordOrganizationId(hostRecordType, hostRecordId != null ? String(hostRecordId) : undefined, hostContextIdentifiers));
|
|
305
|
+
const viewerUserId = useAppScopeSafe()?.currentUserId ?? null;
|
|
306
|
+
/**
|
|
307
|
+
* The READ variants of the referenced resource this viewer may OPEN on one target (#3791): every one, except a
|
|
308
|
+
* `USER_SELF`-scoped variant addressed to another person that does not admit them (`viewerReachesUserSubject`).
|
|
309
|
+
*
|
|
310
|
+
* Without it the pick took the `users` default READ for any person: an organization administrator's click on a
|
|
311
|
+
* member's name opened a page whose every read answered `403`, titled by the person's id. The person is the target
|
|
312
|
+
* itself for a reference to a user, else the `userId` the target's scope names; when neither says, it is unknown and
|
|
313
|
+
* no person-scoped variant is offered. Only the reference's DOORS ask this (its link and its overlay): its label read is
|
|
314
|
+
* a different question and keeps its route.
|
|
315
|
+
*/
|
|
316
|
+
const readOperationsViewerMayOpen = useCallback((refResourceConfig, id, contextualParameters) => {
|
|
317
|
+
const targetIsPerson = resourceType === CoreResourceType.USERS || resourceType === CoreResourceType.USER_SELF;
|
|
318
|
+
const scopedPerson = contextualParameters[coreResourceShared_FieldIdentifier[CoreResourceType.USERS]];
|
|
319
|
+
const subjectUserId = targetIsPerson ? id : (typeof scopedPerson === 'string' ? scopedPerson : null);
|
|
320
|
+
return (refResourceConfig.operations ?? []).filter((operation) => viewerReachesUserSubject({ ...operation, resourcePrimaryScope: operation.resourcePrimaryScope ?? refResourceConfig.resourcePrimaryScope }, { subjectUserId, viewerUserId }, referenceViewer));
|
|
321
|
+
}, [resourceType, referenceViewer, viewerUserId]);
|
|
270
322
|
/**
|
|
271
323
|
* Resolve a concrete link URL for a given FK value.
|
|
272
324
|
* Builds scoped URLs like /organizations/org-123/users/user-456 instead of /USERS/user-456.
|
|
@@ -284,7 +336,7 @@ export const ResourceFieldDisplayPreset_ResourceReference_Default = ({ fieldName
|
|
|
284
336
|
};
|
|
285
337
|
const readOp = pickPreferredOperationForCoreSemanticAddressability({
|
|
286
338
|
resourceConfig: refResourceConfig,
|
|
287
|
-
operations: refResourceConfig
|
|
339
|
+
operations: readOperationsViewerMayOpen(refResourceConfig, id, contextualParameters),
|
|
288
340
|
coreOperation: CoreResourceOperation.READ,
|
|
289
341
|
registry,
|
|
290
342
|
hasResourceId: true,
|
|
@@ -327,7 +379,7 @@ export const ResourceFieldDisplayPreset_ResourceReference_Default = ({ fieldName
|
|
|
327
379
|
// selectMatchingRoutePath may throw — graceful fallback
|
|
328
380
|
}
|
|
329
381
|
return null;
|
|
330
|
-
}, [fkLinkUrlInfo, registry, resourceType, scopeToTarget]);
|
|
382
|
+
}, [fkLinkUrlInfo, registry, resourceType, scopeToTarget, readOperationsViewerMayOpen]);
|
|
331
383
|
/**
|
|
332
384
|
* The OVERLAY fallback — a reference whose target READ is `EMBEDDED` (decided 2026-09-01).
|
|
333
385
|
*
|
|
@@ -343,25 +395,26 @@ export const ResourceFieldDisplayPreset_ResourceReference_Default = ({ fieldName
|
|
|
343
395
|
const { refResourceConfig, ownFieldIdentifier } = fkLinkUrlInfo;
|
|
344
396
|
const targetScope = scopeToTarget(id);
|
|
345
397
|
const fullContextIdentifiers = { ...targetScope.identifiers, [resourceType]: id };
|
|
398
|
+
const contextualParameters = {
|
|
399
|
+
...targetScope.contextualParameters,
|
|
400
|
+
...(ownFieldIdentifier ? { [ownFieldIdentifier]: id } : {}),
|
|
401
|
+
};
|
|
346
402
|
const readOp = pickPreferredOperationForCoreSemanticAddressability({
|
|
347
403
|
resourceConfig: refResourceConfig,
|
|
348
|
-
operations: refResourceConfig
|
|
404
|
+
operations: readOperationsViewerMayOpen(refResourceConfig, id, contextualParameters),
|
|
349
405
|
coreOperation: CoreResourceOperation.READ,
|
|
350
406
|
registry,
|
|
351
407
|
hasResourceId: true,
|
|
352
408
|
requireFrontendAddressable: false,
|
|
353
409
|
contextResourceIdentifiers: fullContextIdentifiers,
|
|
354
|
-
contextualParameters
|
|
355
|
-
...targetScope.contextualParameters,
|
|
356
|
-
...(ownFieldIdentifier ? { [ownFieldIdentifier]: id } : {}),
|
|
357
|
-
},
|
|
410
|
+
contextualParameters,
|
|
358
411
|
});
|
|
359
412
|
if (!readOp)
|
|
360
413
|
return null;
|
|
361
414
|
if (readOp.operationFrontendConfig?.surface !== ResourceOperationFrontendSurface.EMBEDDED)
|
|
362
415
|
return null;
|
|
363
416
|
return { readOp };
|
|
364
|
-
}, [fkLinkUrlInfo, registry, resourceType, scopeToTarget]);
|
|
417
|
+
}, [fkLinkUrlInfo, registry, resourceType, scopeToTarget, readOperationsViewerMayOpen]);
|
|
365
418
|
/**
|
|
366
419
|
* The route a reference's READ is sent on: the route it links to, else — for a target with no page to link to (an
|
|
367
420
|
* EMBEDDED or API_ONLY read) — the READ's own most specific HTTP route its target-scoped parameters satisfy. Either
|
|
@@ -481,7 +534,9 @@ export const ResourceFieldDisplayPreset_ResourceReference_Default = ({ fieldName
|
|
|
481
534
|
// badge of the card. It is a block link instead, drawn by the focus contract, as a selectable card is.
|
|
482
535
|
const summaryLink = effectiveDisplayMode === ForeignKeyDisplayMode.SUMMARY;
|
|
483
536
|
const navigationTarget = resolveFkNavigationTarget(id);
|
|
484
|
-
|
|
537
|
+
// A scoped host takes the click too: without it, the bare `<Link>` below would hand the address to the router and
|
|
538
|
+
// leave the host (the hub closes and the record becomes the page), where every other drill-in stays inside it.
|
|
539
|
+
const shouldUseControllerNavigation = Boolean((navigationZone || scopedNavigationController) && navigationTarget?.readOp && navigationTarget?.url);
|
|
485
540
|
const handleReferenceNavigation = (e) => {
|
|
486
541
|
if (!shouldUseControllerNavigation
|
|
487
542
|
|| !navigationTarget
|
|
@@ -503,12 +558,12 @@ export const ResourceFieldDisplayPreset_ResourceReference_Default = ({ fieldName
|
|
|
503
558
|
parentResourcesRequirements: navigationTarget.parentResourcesRequirements,
|
|
504
559
|
});
|
|
505
560
|
e.preventDefault();
|
|
506
|
-
|
|
561
|
+
requestNavigation({
|
|
507
562
|
content: {
|
|
508
563
|
contentType: NavigationContentType.RESOURCE_OPERATION,
|
|
509
564
|
resourceContext: readContext,
|
|
510
565
|
},
|
|
511
|
-
initiator: { sourceZone: navigationZone },
|
|
566
|
+
initiator: { sourceZone: navigationZone ?? NavigationZone.PRIMARY },
|
|
512
567
|
urlPath: navigationTarget.url,
|
|
513
568
|
});
|
|
514
569
|
};
|
|
@@ -569,7 +624,7 @@ export const ResourceFieldDisplayPreset_ResourceReference_Default = ({ fieldName
|
|
|
569
624
|
parentResourcesRequirements: targetScope.parentRequirements,
|
|
570
625
|
});
|
|
571
626
|
// No urlPath on purpose: an overlay is not a place — nothing to deep-link, nothing to pop.
|
|
572
|
-
|
|
627
|
+
requestNavigation({
|
|
573
628
|
content: {
|
|
574
629
|
contentType: NavigationContentType.RESOURCE_OPERATION,
|
|
575
630
|
resourceContext: readContext,
|
|
@@ -595,7 +650,7 @@ export const ResourceFieldDisplayPreset_ResourceReference_Default = ({ fieldName
|
|
|
595
650
|
: 'block text-primary hover:underline bg-transparent border-none p-0 cursor-pointer text-left', onClick: openOverlay, children: content }));
|
|
596
651
|
}
|
|
597
652
|
return content;
|
|
598
|
-
}, [
|
|
653
|
+
}, [requestNavigation, scopedNavigationController, effectiveDisplayMode, fkLinkUrlInfo, isLinkable, isParentReference, navigationZone, parentRefConfig, resolveFkNavigationTarget, resolveFkOverlayTarget, resourceType, scopeToTarget]);
|
|
599
654
|
// Render a single value
|
|
600
655
|
const renderValue = useCallback((id) => {
|
|
601
656
|
if (effectiveDisplayMode === ForeignKeyDisplayMode.ID) {
|