@jsudc/react 0.7.0 → 0.8.1
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/README.md +113 -22
- package/dist/actions/RowActionsMenu.d.ts +14 -5
- package/dist/actions/RowActionsMenu.js +66 -17
- package/dist/actions/RowActionsMenu.js.map +1 -1
- package/dist/actions/row.d.ts +50 -5
- package/dist/actions/row.js +41 -3
- package/dist/actions/row.js.map +1 -1
- package/dist/actions/rowIcon.d.ts +4 -0
- package/dist/actions/rowIcon.js +13 -0
- package/dist/actions/rowIcon.js.map +1 -0
- package/dist/actions/useCanHover.d.ts +11 -0
- package/dist/actions/useCanHover.js +37 -0
- package/dist/actions/useCanHover.js.map +1 -0
- package/dist/actions/useRowActionRunner.d.ts +3 -1
- package/dist/actions/useRowActionRunner.js +9 -3
- package/dist/actions/useRowActionRunner.js.map +1 -1
- package/dist/data-view/BulkBar.js +1 -1
- package/dist/data-view/FilePreview.js +1 -1
- package/dist/data-view/UdcDataView.js +2 -1
- package/dist/data-view/UdcDataView.js.map +1 -1
- package/dist/headless.d.ts +1 -0
- package/dist/headless.js +6 -5
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -5
- package/dist/kanban/KanbanRenderer.js +1 -1
- package/dist/lookup/LookupValue.d.ts +7 -1
- package/dist/lookup/LookupValue.js +59 -10
- package/dist/lookup/LookupValue.js.map +1 -1
- package/dist/lookup/label.d.ts +7 -0
- package/dist/lookup/label.js +14 -1
- package/dist/lookup/label.js.map +1 -1
- package/dist/lookup/links.d.ts +12 -4
- package/dist/lookup/links.js +4 -1
- package/dist/lookup/links.js.map +1 -1
- package/dist/react-router/UdcReactRouterUrlState.d.ts +3 -2
- package/dist/react-router/UdcReactRouterUrlState.js +3 -1
- package/dist/react-router/UdcReactRouterUrlState.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.scoped.css +1 -1
- package/dist/table/TableRenderer.js +37 -10
- package/dist/table/TableRenderer.js.map +1 -1
- package/dist/table/cells.js +2 -12
- package/dist/table/cells.js.map +1 -1
- package/dist/table/format.d.ts +4 -0
- package/dist/table/format.js +12 -1
- package/dist/table/format.js.map +1 -1
- package/dist/tree/TreeRenderer.js +1 -1
- package/dist/udc/hooks.d.ts +24 -6
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { type BulkActionContext, type BulkActionHandler, type BulkActionHandlers, type BulkActionPlan, bulkActionEligible, MATCH_ALL, planBulkAction, selectionTarget, UdcActionsProvider, type UdcActionsProviderProps, useBulkActionHandlers, } from "./actions/bulk.js";
|
|
2
2
|
export { RowActionsControls, type RowActionsControlsProps, type RowMenuState, type RowMenuVia, rowActionsColumnWidth, rowMenuHandlers, useRowMenu, } from "./actions/RowActionsMenu.js";
|
|
3
|
-
export { eligibleRowActions, isRowMenuKey, type RowActions, type RowActionsDisplay, type RowMenuKeyEvent, rowActionDefs, rowActionsDisplay, } from "./actions/row.js";
|
|
3
|
+
export { DEFAULT_ROW_ACTIONS_MAX, eligibleRowActions, isRowMenuKey, type RowActionSplit, type RowActions, type RowActionsDisplay, type RowMenuKeyEvent, rowActionDefs, rowActionPlacement, rowActionsDisplay, rowActionsMax, splitRowActions, } from "./actions/row.js";
|
|
4
|
+
export { effectiveRowActionsDisplay, useCanHover } from "./actions/useCanHover.js";
|
|
4
5
|
export { type CellComponent, type CellDefinition, type CellProps, type CellRegistry, cellComponent, createCellRegistry, mergeCellRegistries, UdcCellsProvider, type UdcCellsProviderProps, useCellRegistry, } from "./cells/registry.js";
|
|
5
6
|
export { LiveIndicator } from "./data-view/LiveIndicator.js";
|
|
6
7
|
export { columnSortable, sourceSortable } from "./data-view/liveView.js";
|
|
@@ -16,7 +17,7 @@ export { type BatchEntry, batchCovers, type LookupBatch, UdcLookupBatch, useLook
|
|
|
16
17
|
export { LookupCombobox } from "./lookup/LookupCombobox.js";
|
|
17
18
|
export { LookupSelectChip } from "./lookup/LookupSelectChip.js";
|
|
18
19
|
export { LookupValue, useLookupLabels, useLookupRows } from "./lookup/LookupValue.js";
|
|
19
|
-
export { lookupExtras, lookupLabel } from "./lookup/label.js";
|
|
20
|
+
export { lookupColor, lookupExtras, lookupLabel } from "./lookup/label.js";
|
|
20
21
|
export { defaultUdcLinks, filterHref, followLink, type UdcLinks, UdcLinksProvider, useUdcLinks, } from "./lookup/links.js";
|
|
21
22
|
export { LOOKUP_OPTIONS_LIMIT, type LookupOption, type LookupOptionsResult, optionsFilter, useLookupOptions, } from "./lookup/options.js";
|
|
22
23
|
export { asLookup, fetchLookupRows, keyString, type LookupRequest, type LookupRows, lookupKeys, lookupQuery, type UdcLookupResult, useUdcLookup, useUdcLookups, valueKeys, } from "./lookup/useUdcLookup.js";
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { MATCH_ALL, UdcActionsProvider, bulkActionEligible, planBulkAction, selectionTarget, useBulkActionHandlers } from "./actions/bulk.js";
|
|
2
2
|
import { humanize, storage } from "./lib/storage.js";
|
|
3
3
|
import { RowActionsControls, rowActionsColumnWidth, rowMenuHandlers, useRowMenu } from "./actions/RowActionsMenu.js";
|
|
4
|
-
import { eligibleRowActions, isRowMenuKey, rowActionDefs, rowActionsDisplay } from "./actions/row.js";
|
|
4
|
+
import { DEFAULT_ROW_ACTIONS_MAX, eligibleRowActions, isRowMenuKey, rowActionDefs, rowActionPlacement, rowActionsDisplay, rowActionsMax, splitRowActions } from "./actions/row.js";
|
|
5
|
+
import { effectiveRowActionsDisplay, useCanHover } from "./actions/useCanHover.js";
|
|
5
6
|
import { UdcCellsProvider, cellComponent, createCellRegistry, mergeCellRegistries, useCellRegistry } from "./cells/registry.js";
|
|
6
7
|
import { LiveIndicator } from "./data-view/LiveIndicator.js";
|
|
7
8
|
import { columnSortable, sourceSortable } from "./data-view/liveView.js";
|
|
8
|
-
import { createUdcQueryClient, shouldRetry, useUdcClient } from "./udc/client.js";
|
|
9
9
|
import { UdcDataView, resolveChrome } from "./data-view/UdcDataView.js";
|
|
10
10
|
import { INTL_LOCALE, LOCALE_STORAGE_KEY, UdcI18nProvider, intlLocaleOf, isLocale, lookup, makeT, mergeMessages, messageLocales, schemaLabelTerms, tableSection, useI18n } from "./i18n/i18n.js";
|
|
11
|
-
import { applyToListRows } from "./udc/listCache.js";
|
|
12
11
|
import { LOCALES, TRANSLATIONS } from "./i18n/translations.js";
|
|
12
|
+
import { createUdcQueryClient, shouldRetry, useUdcClient } from "./udc/client.js";
|
|
13
13
|
import { LUCIDE_ICONS } from "./icons/lucide.generated.js";
|
|
14
14
|
import { FALLBACK_ICON, resolveIcon } from "./icons/resolve.js";
|
|
15
|
+
import { applyToListRows } from "./udc/listCache.js";
|
|
15
16
|
import { UDC_SCOPE_CLASS } from "./lib/scope.js";
|
|
16
17
|
import { THEME_STORAGE_KEY, ThemeProvider, useTheme } from "./lib/theme.js";
|
|
17
18
|
import { cn } from "./lib/utils.js";
|
|
@@ -19,7 +20,7 @@ import { UdcLookupBatch, batchCovers, useLookupBatch, useLookupBatchContext } fr
|
|
|
19
20
|
import { LookupCombobox } from "./lookup/LookupCombobox.js";
|
|
20
21
|
import { LookupSelectChip } from "./lookup/LookupSelectChip.js";
|
|
21
22
|
import { LookupValue, useLookupLabels, useLookupRows } from "./lookup/LookupValue.js";
|
|
22
|
-
import { lookupExtras, lookupLabel } from "./lookup/label.js";
|
|
23
|
+
import { lookupColor, lookupExtras, lookupLabel } from "./lookup/label.js";
|
|
23
24
|
import { UdcLinksProvider, defaultUdcLinks, filterHref, followLink, useUdcLinks } from "./lookup/links.js";
|
|
24
25
|
import { LOOKUP_OPTIONS_LIMIT, optionsFilter, useLookupOptions } from "./lookup/options.js";
|
|
25
26
|
import { asLookup, fetchLookupRows, keyString, lookupKeys, lookupQuery, useUdcLookup, useUdcLookups, valueKeys } from "./lookup/useUdcLookup.js";
|
|
@@ -42,4 +43,4 @@ import { UdcUiProvider, useUiKit } from "./ui-kit/context.js";
|
|
|
42
43
|
import { createMemoryUrlStateAdapter, prefixUrlStateAdapter } from "./url-state/adapters.js";
|
|
43
44
|
import { UdcUrlStateProvider, useUrlSearchParams, useUrlStateAdapter } from "./url-state/UrlState.js";
|
|
44
45
|
import { windowLocationAdapter } from "./url-state/adapter.js";
|
|
45
|
-
export { ALL_ROWS_MAX, BROWSER_TZ, COMMON_ZONES, DEFAULT_VIRTUAL_OVERSCAN, DEFAULT_VIRTUAL_THRESHOLD, EMPTY_SELECTION, EmptyState, ErrorState, FALLBACK_ICON, INTL_LOCALE, LOCALES, LOCALE_STORAGE_KEY, LOOKUP_OPTIONS_LIMIT, LUCIDE_ICONS, LiveIndicator, LookupCombobox, LookupSelectChip, LookupValue, MATCH_ALL, NoRendererState, RowActionsControls, THEME_STORAGE_KEY, TRANSLATIONS, TZ_STORAGE_KEY, ThemeProvider, TimezoneProvider, UDC_SCOPE_CLASS, UdcActionsProvider, UdcCellsProvider, UdcChangeFeed, UdcChangeFeedContext, UdcDataView, UdcI18nProvider, UdcLinksProvider, UdcLookupBatch, UdcProvider, UdcRenderersProvider, UdcUiProvider, UdcUrlStateProvider, allZones, applyToListRows, asLookup, batchCovers, browserZone, bulkActionEligible, callAction, cellComponent, cn, columnSortable, createCellRegistry, createMemoryUrlStateAdapter, createRendererRegistry, createUdcQueryClient, defaultUdcLinks, eligibleRowActions, fetchAllRows, fetchLookupRows, filterHref, followLink, freshnessOf, humanize, i18nKey, intlLocaleOf, isFolderRow, isLocale, isRowMenuKey, isValidZone, keyString, lookup, lookupExtras, lookupKeys, lookupLabel, lookupQuery, makeT, mergeCellRegistries, mergeMessages, messageLocales, mutateManyTouches, offsetLabel, offsetMinutes, optionsFilter, ownsKeys, pageOffset, pageSelectionState, patchRowInList, planBulkAction, pollInterval, prefixUrlStateAdapter, rendererEntry, rendererTabs, resolveChrome, resolveIcon, resolveTab, resolveVirtualization, rowActionDefs, rowActionsColumnWidth, rowActionsDisplay, rowActivationEnabled, rowMenuHandlers, schemaLabelTerms, selectAllMatching, selectRange, selectionCount, selectionHas, selectionIsEmpty, selectionTarget, setPageSelection, shouldRetry, sourceSortable, storage, tableSection, toggleSelection, udcKeys, useBulkActionHandlers, useCellRegistry, useI18n, useLookupBatch, useLookupBatchContext, useLookupLabels, useLookupOptions, useLookupRows, useRendererRegistry, useRowActivation, useRowMenu, useRowSelection, useTheme, useTimezone, useUdcAction, useUdcAllRows, useUdcChangeFeed, useUdcChanges, useUdcClient, useUdcCollection, useUdcCollections, useUdcDescribe, useUdcLinks, useUdcLookup, useUdcLookups, useUdcMutate, useUdcMutateMany, useUdcSchema, useUdcSource, useUiKit, useUrlSearchParams, useUrlStateAdapter, valueKeys, virtualizationApplies, windowLocationAdapter, zoneCity };
|
|
46
|
+
export { ALL_ROWS_MAX, BROWSER_TZ, COMMON_ZONES, DEFAULT_ROW_ACTIONS_MAX, DEFAULT_VIRTUAL_OVERSCAN, DEFAULT_VIRTUAL_THRESHOLD, EMPTY_SELECTION, EmptyState, ErrorState, FALLBACK_ICON, INTL_LOCALE, LOCALES, LOCALE_STORAGE_KEY, LOOKUP_OPTIONS_LIMIT, LUCIDE_ICONS, LiveIndicator, LookupCombobox, LookupSelectChip, LookupValue, MATCH_ALL, NoRendererState, RowActionsControls, THEME_STORAGE_KEY, TRANSLATIONS, TZ_STORAGE_KEY, ThemeProvider, TimezoneProvider, UDC_SCOPE_CLASS, UdcActionsProvider, UdcCellsProvider, UdcChangeFeed, UdcChangeFeedContext, UdcDataView, UdcI18nProvider, UdcLinksProvider, UdcLookupBatch, UdcProvider, UdcRenderersProvider, UdcUiProvider, UdcUrlStateProvider, allZones, applyToListRows, asLookup, batchCovers, browserZone, bulkActionEligible, callAction, cellComponent, cn, columnSortable, createCellRegistry, createMemoryUrlStateAdapter, createRendererRegistry, createUdcQueryClient, defaultUdcLinks, effectiveRowActionsDisplay, eligibleRowActions, fetchAllRows, fetchLookupRows, filterHref, followLink, freshnessOf, humanize, i18nKey, intlLocaleOf, isFolderRow, isLocale, isRowMenuKey, isValidZone, keyString, lookup, lookupColor, lookupExtras, lookupKeys, lookupLabel, lookupQuery, makeT, mergeCellRegistries, mergeMessages, messageLocales, mutateManyTouches, offsetLabel, offsetMinutes, optionsFilter, ownsKeys, pageOffset, pageSelectionState, patchRowInList, planBulkAction, pollInterval, prefixUrlStateAdapter, rendererEntry, rendererTabs, resolveChrome, resolveIcon, resolveTab, resolveVirtualization, rowActionDefs, rowActionPlacement, rowActionsColumnWidth, rowActionsDisplay, rowActionsMax, rowActivationEnabled, rowMenuHandlers, schemaLabelTerms, selectAllMatching, selectRange, selectionCount, selectionHas, selectionIsEmpty, selectionTarget, setPageSelection, shouldRetry, sourceSortable, splitRowActions, storage, tableSection, toggleSelection, udcKeys, useBulkActionHandlers, useCanHover, useCellRegistry, useI18n, useLookupBatch, useLookupBatchContext, useLookupLabels, useLookupOptions, useLookupRows, useRendererRegistry, useRowActivation, useRowMenu, useRowSelection, useTheme, useTimezone, useUdcAction, useUdcAllRows, useUdcChangeFeed, useUdcChanges, useUdcClient, useUdcCollection, useUdcCollections, useUdcDescribe, useUdcLinks, useUdcLookup, useUdcLookups, useUdcMutate, useUdcMutateMany, useUdcSchema, useUdcSource, useUiKit, useUrlSearchParams, useUrlStateAdapter, valueKeys, virtualizationApplies, windowLocationAdapter, zoneCity };
|
|
@@ -16,8 +16,8 @@ import { useKanbanBoard } from "./useKanbanBoard.js";
|
|
|
16
16
|
import { detectCollision, isVersionConflict, orderBetween } from "@jsudc/core";
|
|
17
17
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
18
18
|
import { KanbanSquare } from "lucide-react";
|
|
19
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
20
19
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
21
21
|
import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, TouchSensor, closestCenter, closestCorners, pointerWithin, useSensor, useSensors } from "@dnd-kit/core";
|
|
22
22
|
import { SortableContext, arrayMove, horizontalListSortingStrategy, sortableKeyboardCoordinates } from "@dnd-kit/sortable";
|
|
23
23
|
// src/kanban/KanbanRenderer.tsx
|
|
@@ -15,7 +15,13 @@ export declare function useLookupLabels(def: FieldDef | undefined, value: unknow
|
|
|
15
15
|
* A `lookup` cell: the target's `label_field` as a link to the target
|
|
16
16
|
* collection filtered by the key (`?f=` `{field: <key field>, op: eq}`), the
|
|
17
17
|
* bare key until the label arrives or when the target has no such row. A
|
|
18
|
-
* `lookup_array` is a list of such chips.
|
|
18
|
+
* `lookup_array` is a list of such chips; with `lookup.color_field` each chip
|
|
19
|
+
* takes its row's colour (`data-color`; a tone such as `danger` draws as that
|
|
20
|
+
* badge, any other name through the host's `--udc-chip-bg` / `--udc-chip-fg`).
|
|
21
|
+
* A long chip ends in "…" inside its rounded box, at most
|
|
22
|
+
* `--udc-chip-max-width` (default `12em`) wide; when the chips do not fit, the
|
|
23
|
+
* first keep their width and the last visible one shrinks. Where `UdcLinks.href`
|
|
24
|
+
* gives `null` for the target, the label and the chips are plain text.
|
|
19
25
|
*/
|
|
20
26
|
export declare function LookupValue({ def, value, field, editable, }: {
|
|
21
27
|
def: FieldDef;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { BADGE_TONE, isTone } from "../table/format.js";
|
|
2
3
|
import { batchCovers, useLookupBatchContext } from "./batch.js";
|
|
3
|
-
import { lookupExtras, lookupLabel } from "./label.js";
|
|
4
|
+
import { lookupColor, lookupExtras, lookupLabel } from "./label.js";
|
|
4
5
|
import { filterHref, followLink, useUdcLinks } from "./links.js";
|
|
5
6
|
import { keyString, useUdcLookup, valueKeys } from "./useUdcLookup.js";
|
|
6
7
|
import { ROW_ID, lookupKeyField, lookupOf } from "@jsudc/core";
|
|
@@ -33,9 +34,29 @@ function useLookupLabels(def, value, field) {
|
|
|
33
34
|
if (!lookup) return keys;
|
|
34
35
|
return keys.map((k) => lookupLabel(row(k), lookup) ?? k);
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The fill of a chip whose colour is no tone: the host maps the name to
|
|
39
|
+
* `--udc-chip-bg` / `--udc-chip-fg`, e.g.
|
|
40
|
+
* `.udc-lookup-chip[data-color="red"] { --udc-chip-bg: …; --udc-chip-fg: …; }`
|
|
41
|
+
* (and again under `.dark`); a name it does not map draws as the default chip.
|
|
42
|
+
*/
|
|
43
|
+
var NAMED_CHIP = {
|
|
44
|
+
backgroundColor: "var(--udc-chip-bg, var(--muted))",
|
|
45
|
+
color: "var(--udc-chip-fg, var(--foreground))"
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* How fast chip `index` of a `lookup_array` gives up width when the chips do
|
|
49
|
+
* not fit: each chip a million times faster than the one before it, so the
|
|
50
|
+
* first chips keep their width and the last visible one ends in "…" (down to
|
|
51
|
+
* its minimum, then the one before it). Capped so the factor stays a finite
|
|
52
|
+
* single-precision float; chips that far along are past the cell's edge.
|
|
53
|
+
*/
|
|
54
|
+
var chipShrink = (index) => 1e6 ** Math.min(index, 6);
|
|
55
|
+
function LookupLink({ lookup, keyValue, row, chip, editable, shrink }) {
|
|
37
56
|
const links = useUdcLinks();
|
|
38
57
|
const label = lookupLabel(row, lookup);
|
|
58
|
+
const color = chip ? lookupColor(row, lookup) : void 0;
|
|
59
|
+
const tone = isTone(color) ? color : void 0;
|
|
39
60
|
const field = lookupKeyField(lookup);
|
|
40
61
|
const href = filterHref(links, lookup.collection, {
|
|
41
62
|
field: field === ROW_ID ? ROW_ID : field,
|
|
@@ -43,6 +64,7 @@ function LookupLink({ lookup, keyValue, row, chip, editable }) {
|
|
|
43
64
|
value: keyValue
|
|
44
65
|
});
|
|
45
66
|
const onClick = (e) => {
|
|
67
|
+
if (href === null) return;
|
|
46
68
|
if (editable && !(e.metaKey || e.ctrlKey || e.button === 1)) {
|
|
47
69
|
e.preventDefault();
|
|
48
70
|
return;
|
|
@@ -50,22 +72,48 @@ function LookupLink({ lookup, keyValue, row, chip, editable }) {
|
|
|
50
72
|
e.stopPropagation();
|
|
51
73
|
followLink(e, href, links);
|
|
52
74
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
75
|
+
const text = label ?? keyValue;
|
|
76
|
+
const style = {
|
|
77
|
+
...color !== void 0 && !tone ? NAMED_CHIP : {},
|
|
78
|
+
...shrink !== void 0 ? { flexShrink: shrink } : {}
|
|
79
|
+
};
|
|
80
|
+
const props = {
|
|
56
81
|
"data-testid": "lookup-link",
|
|
57
82
|
"data-key": keyValue,
|
|
58
83
|
"data-resolved": label !== void 0 || void 0,
|
|
84
|
+
"data-color": color,
|
|
85
|
+
"data-tone": tone,
|
|
86
|
+
"data-link": href !== null || void 0,
|
|
59
87
|
title: lookupExtras(row, lookup) ?? label ?? keyValue,
|
|
60
|
-
className: cn("udc:min-w-0 udc:truncate udc:text-foreground udc:underline-offset-2 udc:hover:text-primary udc:hover:underline udc:focus-visible:underline udc:focus-visible:outline-none", chip && "udc:inline-flex udc:h-5 udc:
|
|
61
|
-
|
|
88
|
+
className: cn("udc:min-w-0 udc:truncate udc:text-foreground", href !== null && "udc:underline-offset-2 udc:hover:text-primary udc:hover:underline udc:focus-visible:underline udc:focus-visible:outline-none", chip && "udc-lookup-chip udc:inline-flex udc:h-5 udc:justify-center udc:max-w-[var(--udc-chip-max-width,12em)] udc:min-w-[min(var(--udc-chip-min-width,2.5rem),var(--udc-chip-max-width,12em))] udc:items-center udc:rounded-full udc:px-2 udc:text-[length:var(--udc-chip-font-size,11px)] udc:font-[number:var(--udc-chip-font-weight,500)]", chip && href !== null && "udc:hover:no-underline", chip && color === void 0 && "udc:bg-muted", chip && color === void 0 && href !== null && "udc:hover:bg-primary/12", chip && color !== void 0 && href !== null && "udc:hover:opacity-80", tone && BADGE_TONE[tone], label === void 0 && "udc:font-mono udc:text-muted-foreground"),
|
|
89
|
+
style: Object.keys(style).length > 0 ? style : void 0
|
|
90
|
+
};
|
|
91
|
+
const body = chip ? /* @__PURE__ */ jsx("span", {
|
|
92
|
+
"data-testid": "lookup-chip-text",
|
|
93
|
+
className: "udc:min-w-0 udc:truncate",
|
|
94
|
+
children: text
|
|
95
|
+
}) : text;
|
|
96
|
+
return href === null ? /* @__PURE__ */ jsx("span", {
|
|
97
|
+
...props,
|
|
98
|
+
children: body
|
|
99
|
+
}) : /* @__PURE__ */ jsx("a", {
|
|
100
|
+
...props,
|
|
101
|
+
href,
|
|
102
|
+
onClick,
|
|
103
|
+
children: body
|
|
62
104
|
});
|
|
63
105
|
}
|
|
64
106
|
/**
|
|
65
107
|
* A `lookup` cell: the target's `label_field` as a link to the target
|
|
66
108
|
* collection filtered by the key (`?f=` `{field: <key field>, op: eq}`), the
|
|
67
109
|
* bare key until the label arrives or when the target has no such row. A
|
|
68
|
-
* `lookup_array` is a list of such chips.
|
|
110
|
+
* `lookup_array` is a list of such chips; with `lookup.color_field` each chip
|
|
111
|
+
* takes its row's colour (`data-color`; a tone such as `danger` draws as that
|
|
112
|
+
* badge, any other name through the host's `--udc-chip-bg` / `--udc-chip-fg`).
|
|
113
|
+
* A long chip ends in "…" inside its rounded box, at most
|
|
114
|
+
* `--udc-chip-max-width` (default `12em`) wide; when the chips do not fit, the
|
|
115
|
+
* first keep their width and the last visible one shrinks. Where `UdcLinks.href`
|
|
116
|
+
* gives `null` for the target, the label and the chips are plain text.
|
|
69
117
|
*/
|
|
70
118
|
function LookupValue({ def, value, field, editable = false }) {
|
|
71
119
|
const { lookup, keys, row } = useLookupRows(def, value, field);
|
|
@@ -76,12 +124,13 @@ function LookupValue({ def, value, field, editable = false }) {
|
|
|
76
124
|
if (def.type === "lookup_array") return /* @__PURE__ */ jsx("span", {
|
|
77
125
|
"data-testid": "lookup-chips",
|
|
78
126
|
className: "udc:flex udc:min-w-0 udc:items-center udc:gap-1 udc:overflow-hidden",
|
|
79
|
-
children: keys.map((k) => /* @__PURE__ */ jsx(LookupLink, {
|
|
127
|
+
children: keys.map((k, i) => /* @__PURE__ */ jsx(LookupLink, {
|
|
80
128
|
lookup,
|
|
81
129
|
keyValue: k,
|
|
82
130
|
row: row(k),
|
|
83
131
|
chip: true,
|
|
84
|
-
editable
|
|
132
|
+
editable,
|
|
133
|
+
shrink: chipShrink(i)
|
|
85
134
|
}, k))
|
|
86
135
|
});
|
|
87
136
|
const key = keys[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LookupValue.js","names":[],"sources":["../../src/lookup/LookupValue.tsx"],"sourcesContent":["import {\n type FieldDef,\n type LookupDef,\n lookupKeyField,\n lookupOf,\n ROW_ID,\n type Row,\n} from \"@jsudc/core\";\nimport type { MouseEvent } from \"react\";\nimport { cn } from \"../lib/utils.js\";\nimport { batchCovers, useLookupBatchContext } from \"./batch.js\";\nimport { lookupExtras, lookupLabel } from \"./label.js\";\nimport { filterHref, followLink, useUdcLinks } from \"./links.js\";\nimport { keyString, useUdcLookup, valueKeys } from \"./useUdcLookup.js\";\n\n/**\n * The labels of a lookup value, from the batch around (`UdcLookupBatch`) or,\n * outside one, from a `useUdcLookup` of its own. `field` names the batch\n * entry. A key not (yet) resolved maps to `undefined`.\n */\nexport function useLookupRows(\n def: FieldDef | undefined,\n value: unknown,\n field?: string,\n): { lookup: LookupDef | undefined; keys: string[]; row: (key: string) => Row | undefined } {\n const lookup = lookupOf(def);\n const keys = valueKeys([value]);\n const batch = useLookupBatchContext();\n const fromBatch = lookup ? batchCovers(batch, field, lookup, keys) : undefined;\n const own = useUdcLookup(lookup ?? { collection: \"\", label_field: \"\" }, keys, {\n enabled: lookup !== undefined && fromBatch === undefined,\n });\n const res = fromBatch ?? own;\n return { lookup, keys, row: (key) => res.row(key) };\n}\n\n/** The labels of a lookup value as strings, the bare key where no label is known. */\nexport function useLookupLabels(\n def: FieldDef | undefined,\n value: unknown,\n field?: string,\n): string[] {\n const { lookup, keys, row } = useLookupRows(def, value, field);\n if (!lookup) return keys;\n return keys.map((k) => lookupLabel(row(k), lookup) ?? k);\n}\n\nfunction LookupLink({\n lookup,\n keyValue,\n row,\n chip,\n editable,\n}: {\n lookup: LookupDef;\n keyValue: string;\n row: Row | undefined;\n chip: boolean;\n editable: boolean;\n}) {\n const links = useUdcLinks();\n const label = lookupLabel(row, lookup);\n const field = lookupKeyField(lookup);\n const href = filterHref(links, lookup.collection, {\n field: field === ROW_ID ? ROW_ID : field,\n op: \"eq\",\n value: keyValue,\n });\n const onClick = (e: MouseEvent) => {\n // In an editable cell a plain click belongs to the cell (double-click edits);\n // Cmd / Ctrl-click still opens the target.\n if (editable && !(e.metaKey || e.ctrlKey || e.button === 1)) {\n e.preventDefault();\n return;\n }\n // The row under the link may have a row_link of its own: the link wins.\n e.stopPropagation();\n followLink(e, href, links);\n };\n return (\n <a\n href={href}\n onClick={onClick}\n data-testid=\"lookup-link\"\n data-key={keyValue}\n data-resolved={label !== undefined || undefined}\n title={lookupExtras(row, lookup) ?? label ?? keyValue}\n className={cn(\n \"udc:min-w-0 udc:truncate udc:text-foreground udc:underline-offset-2 udc:hover:text-primary udc:hover:underline udc:focus-visible:underline udc:focus-visible:outline-none\",\n chip &&\n \"udc:inline-flex udc:h-5 udc:shrink-0 udc:items-center udc:rounded-full udc:bg-muted udc:px-2 udc:text-[11px] udc:font-medium udc:hover:no-underline udc:hover:bg-primary/12\",\n label === undefined && \"udc:font-mono udc:text-muted-foreground\",\n )}\n >\n {label ?? keyValue}\n </a>\n );\n}\n\n/**\n * A `lookup` cell: the target's `label_field` as a link to the target\n * collection filtered by the key (`?f=` `{field: <key field>, op: eq}`), the\n * bare key until the label arrives or when the target has no such row. A\n * `lookup_array` is a list of such chips.\n */\nexport function LookupValue({\n def,\n value,\n field,\n editable = false,\n}: {\n def: FieldDef;\n value: unknown;\n /** The field, so the batch around the cell (if any) answers for it. */\n field?: string | undefined;\n /** In an editable cell a plain click does not follow the link (Cmd / Ctrl-click does). */\n editable?: boolean;\n}) {\n const { lookup, keys, row } = useLookupRows(def, value, field);\n if (!lookup) return <span className=\"udc:truncate\">{keys.join(\", \")}</span>;\n if (def.type === \"lookup_array\") {\n return (\n <span\n data-testid=\"lookup-chips\"\n className=\"udc:flex udc:min-w-0 udc:items-center udc:gap-1 udc:overflow-hidden\"\n >\n {keys.map((k) => (\n <LookupLink key={k} lookup={lookup} keyValue={k} row={row(k)} chip editable={editable} />\n ))}\n </span>\n );\n }\n const key = keys[0];\n return key === undefined ? null : (\n <LookupLink\n lookup={lookup}\n keyValue={keyString(key)}\n row={row(key)}\n chip={false}\n editable={editable}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,SAAgB,cACd,KACA,OACA,OAC0F;CAC1F,MAAM,SAAS,SAAS,GAAG;CAC3B,MAAM,OAAO,UAAU,CAAC,KAAK,CAAC;CAC9B,MAAM,QAAQ,sBAAsB;CACpC,MAAM,YAAY,SAAS,YAAY,OAAO,OAAO,QAAQ,IAAI,IAAI,KAAA;CACrE,MAAM,MAAM,aAAa,UAAU;EAAE,YAAY;EAAI,aAAa;CAAG,GAAG,MAAM,EAC5E,SAAS,WAAW,KAAA,KAAa,cAAc,KAAA,EACjD,CAAC;CACD,MAAM,MAAM,aAAa;CACzB,OAAO;EAAE;EAAQ;EAAM,MAAM,QAAQ,IAAI,IAAI,GAAG;CAAE;AACpD;;AAGA,SAAgB,gBACd,KACA,OACA,OACU;CACV,MAAM,EAAE,QAAQ,MAAM,QAAQ,cAAc,KAAK,OAAO,KAAK;CAC7D,IAAI,CAAC,QAAQ,OAAO;CACpB,OAAO,KAAK,KAAK,MAAM,YAAY,IAAI,CAAC,GAAG,MAAM,KAAK,CAAC;AACzD;AAEA,SAAS,WAAW,EAClB,QACA,UACA,KACA,MACA,YAOC;CACD,MAAM,QAAQ,YAAY;CAC1B,MAAM,QAAQ,YAAY,KAAK,MAAM;CACrC,MAAM,QAAQ,eAAe,MAAM;CACnC,MAAM,OAAO,WAAW,OAAO,OAAO,YAAY;EAChD,OAAO,UAAU,SAAS,SAAS;EACnC,IAAI;EACJ,OAAO;CACT,CAAC;CACD,MAAM,WAAW,MAAkB;EAGjC,IAAI,YAAY,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,IAAI;GAC3D,EAAE,eAAe;GACjB;EACF;EAEA,EAAE,gBAAgB;EAClB,WAAW,GAAG,MAAM,KAAK;CAC3B;CACA,OACE,oBAAC,KAAD;EACQ;EACG;EACT,eAAY;EACZ,YAAU;EACV,iBAAe,UAAU,KAAA,KAAa,KAAA;EACtC,OAAO,aAAa,KAAK,MAAM,KAAK,SAAS;EAC7C,WAAW,GACT,6KACA,QACE,+KACF,UAAU,KAAA,KAAa,yCACzB;EAEC,UAAA,SAAS;CACT,CAAA;AAEP;;;;;;;AAQA,SAAgB,YAAY,EAC1B,KACA,OACA,OACA,WAAW,SAQV;CACD,MAAM,EAAE,QAAQ,MAAM,QAAQ,cAAc,KAAK,OAAO,KAAK;CAC7D,IAAI,CAAC,QAAQ,OAAO,oBAAC,QAAD;EAAM,WAAU;EAAgB,UAAA,KAAK,KAAK,IAAI;CAAQ,CAAA;CAC1E,IAAI,IAAI,SAAS,gBACf,OACE,oBAAC,QAAD;EACE,eAAY;EACZ,WAAU;EAET,UAAA,KAAK,KAAK,MACT,oBAAC,YAAD;GAA4B;GAAQ,UAAU;GAAG,KAAK,IAAI,CAAC;GAAG,MAAA;GAAe;EAAW,GAAvE,CAAuE,CACzF;CACG,CAAA;CAGV,MAAM,MAAM,KAAK;CACjB,OAAO,QAAQ,KAAA,IAAY,OACzB,oBAAC,YAAD;EACU;EACR,UAAU,UAAU,GAAG;EACvB,KAAK,IAAI,GAAG;EACZ,MAAM;EACI;CACX,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"LookupValue.js","names":[],"sources":["../../src/lookup/LookupValue.tsx"],"sourcesContent":["import {\n type FieldDef,\n type LookupDef,\n lookupKeyField,\n lookupOf,\n ROW_ID,\n type Row,\n} from \"@jsudc/core\";\nimport type { CSSProperties, MouseEvent } from \"react\";\nimport { cn } from \"../lib/utils.js\";\nimport { BADGE_TONE, isTone } from \"../table/format.js\";\nimport { batchCovers, useLookupBatchContext } from \"./batch.js\";\nimport { lookupColor, lookupExtras, lookupLabel } from \"./label.js\";\nimport { filterHref, followLink, useUdcLinks } from \"./links.js\";\nimport { keyString, useUdcLookup, valueKeys } from \"./useUdcLookup.js\";\n\n/**\n * The labels of a lookup value, from the batch around (`UdcLookupBatch`) or,\n * outside one, from a `useUdcLookup` of its own. `field` names the batch\n * entry. A key not (yet) resolved maps to `undefined`.\n */\nexport function useLookupRows(\n def: FieldDef | undefined,\n value: unknown,\n field?: string,\n): { lookup: LookupDef | undefined; keys: string[]; row: (key: string) => Row | undefined } {\n const lookup = lookupOf(def);\n const keys = valueKeys([value]);\n const batch = useLookupBatchContext();\n const fromBatch = lookup ? batchCovers(batch, field, lookup, keys) : undefined;\n const own = useUdcLookup(lookup ?? { collection: \"\", label_field: \"\" }, keys, {\n enabled: lookup !== undefined && fromBatch === undefined,\n });\n const res = fromBatch ?? own;\n return { lookup, keys, row: (key) => res.row(key) };\n}\n\n/** The labels of a lookup value as strings, the bare key where no label is known. */\nexport function useLookupLabels(\n def: FieldDef | undefined,\n value: unknown,\n field?: string,\n): string[] {\n const { lookup, keys, row } = useLookupRows(def, value, field);\n if (!lookup) return keys;\n return keys.map((k) => lookupLabel(row(k), lookup) ?? k);\n}\n\n/**\n * The fill of a chip whose colour is no tone: the host maps the name to\n * `--udc-chip-bg` / `--udc-chip-fg`, e.g.\n * `.udc-lookup-chip[data-color=\"red\"] { --udc-chip-bg: …; --udc-chip-fg: …; }`\n * (and again under `.dark`); a name it does not map draws as the default chip.\n */\nconst NAMED_CHIP: CSSProperties = {\n backgroundColor: \"var(--udc-chip-bg, var(--muted))\",\n color: \"var(--udc-chip-fg, var(--foreground))\",\n};\n\n/**\n * How fast chip `index` of a `lookup_array` gives up width when the chips do\n * not fit: each chip a million times faster than the one before it, so the\n * first chips keep their width and the last visible one ends in \"…\" (down to\n * its minimum, then the one before it). Capped so the factor stays a finite\n * single-precision float; chips that far along are past the cell's edge.\n */\nconst chipShrink = (index: number): number => 1e6 ** Math.min(index, 6);\n\nfunction LookupLink({\n lookup,\n keyValue,\n row,\n chip,\n editable,\n shrink,\n}: {\n lookup: LookupDef;\n keyValue: string;\n row: Row | undefined;\n chip: boolean;\n editable: boolean;\n /** A chip's `flex-shrink` in its row of chips. */\n shrink?: number;\n}) {\n const links = useUdcLinks();\n const label = lookupLabel(row, lookup);\n // A chip takes the colour of its row (`lookup.color_field`): a tone draws as\n // that tone's badge, any other name is the host's (`data-color`, NAMED_CHIP).\n const color = chip ? lookupColor(row, lookup) : undefined;\n const tone = isTone(color) ? color : undefined;\n const field = lookupKeyField(lookup);\n // `null`: the host has no view of the target (`UdcLinks.href`), so the value\n // is plain text and a click on it is the row's.\n const href = filterHref(links, lookup.collection, {\n field: field === ROW_ID ? ROW_ID : field,\n op: \"eq\",\n value: keyValue,\n });\n const onClick = (e: MouseEvent) => {\n if (href === null) return;\n // In an editable cell a plain click belongs to the cell (double-click edits);\n // Cmd / Ctrl-click still opens the target.\n if (editable && !(e.metaKey || e.ctrlKey || e.button === 1)) {\n e.preventDefault();\n return;\n }\n // The row under the link may have a row_link of its own: the link wins.\n e.stopPropagation();\n followLink(e, href, links);\n };\n const text = label ?? keyValue;\n const style: CSSProperties = {\n ...(color !== undefined && !tone ? NAMED_CHIP : {}),\n ...(shrink !== undefined ? { flexShrink: shrink } : {}),\n };\n const props = {\n \"data-testid\": \"lookup-link\",\n \"data-key\": keyValue,\n \"data-resolved\": label !== undefined || undefined,\n \"data-color\": color,\n \"data-tone\": tone,\n \"data-link\": href !== null || undefined,\n title: lookupExtras(row, lookup) ?? label ?? keyValue,\n className: cn(\n \"udc:min-w-0 udc:truncate udc:text-foreground\",\n href !== null &&\n \"udc:underline-offset-2 udc:hover:text-primary udc:hover:underline udc:focus-visible:underline udc:focus-visible:outline-none\",\n // The chip's box is a flex container, whose text would be an anonymous flex\n // item that `text-overflow` does not reach: the text is a span of its own\n // that truncates, inside a box at most `--udc-chip-max-width` wide that may\n // shrink to `--udc-chip-min-width` (default 2.5rem, \"K…\") but keeps its rounded ends.\n chip &&\n \"udc-lookup-chip udc:inline-flex udc:h-5 udc:justify-center udc:max-w-[var(--udc-chip-max-width,12em)] udc:min-w-[min(var(--udc-chip-min-width,2.5rem),var(--udc-chip-max-width,12em))] udc:items-center udc:rounded-full udc:px-2 udc:text-[length:var(--udc-chip-font-size,11px)] udc:font-[number:var(--udc-chip-font-weight,500)]\",\n chip && href !== null && \"udc:hover:no-underline\",\n chip && color === undefined && \"udc:bg-muted\",\n chip && color === undefined && href !== null && \"udc:hover:bg-primary/12\",\n chip && color !== undefined && href !== null && \"udc:hover:opacity-80\",\n tone && BADGE_TONE[tone],\n label === undefined && \"udc:font-mono udc:text-muted-foreground\",\n ),\n style: Object.keys(style).length > 0 ? style : undefined,\n };\n const body = chip ? (\n <span data-testid=\"lookup-chip-text\" className=\"udc:min-w-0 udc:truncate\">\n {text}\n </span>\n ) : (\n text\n );\n return href === null ? (\n <span {...props}>{body}</span>\n ) : (\n <a {...props} href={href} onClick={onClick}>\n {body}\n </a>\n );\n}\n\n/**\n * A `lookup` cell: the target's `label_field` as a link to the target\n * collection filtered by the key (`?f=` `{field: <key field>, op: eq}`), the\n * bare key until the label arrives or when the target has no such row. A\n * `lookup_array` is a list of such chips; with `lookup.color_field` each chip\n * takes its row's colour (`data-color`; a tone such as `danger` draws as that\n * badge, any other name through the host's `--udc-chip-bg` / `--udc-chip-fg`).\n * A long chip ends in \"…\" inside its rounded box, at most\n * `--udc-chip-max-width` (default `12em`) wide; when the chips do not fit, the\n * first keep their width and the last visible one shrinks. Where `UdcLinks.href`\n * gives `null` for the target, the label and the chips are plain text.\n */\nexport function LookupValue({\n def,\n value,\n field,\n editable = false,\n}: {\n def: FieldDef;\n value: unknown;\n /** The field, so the batch around the cell (if any) answers for it. */\n field?: string | undefined;\n /** In an editable cell a plain click does not follow the link (Cmd / Ctrl-click does). */\n editable?: boolean;\n}) {\n const { lookup, keys, row } = useLookupRows(def, value, field);\n if (!lookup) return <span className=\"udc:truncate\">{keys.join(\", \")}</span>;\n if (def.type === \"lookup_array\") {\n return (\n <span\n data-testid=\"lookup-chips\"\n className=\"udc:flex udc:min-w-0 udc:items-center udc:gap-1 udc:overflow-hidden\"\n >\n {keys.map((k, i) => (\n <LookupLink\n key={k}\n lookup={lookup}\n keyValue={k}\n row={row(k)}\n chip\n editable={editable}\n shrink={chipShrink(i)}\n />\n ))}\n </span>\n );\n }\n const key = keys[0];\n return key === undefined ? null : (\n <LookupLink\n lookup={lookup}\n keyValue={keyString(key)}\n row={row(key)}\n chip={false}\n editable={editable}\n />\n );\n}\n"],"mappings":"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"}
|
package/dist/lookup/label.d.ts
CHANGED
|
@@ -3,3 +3,10 @@ import type { LookupDef, Row } from "@jsudc/core";
|
|
|
3
3
|
export declare function lookupLabel(row: Row | undefined, lookup: LookupDef): string | undefined;
|
|
4
4
|
/** The extra fields of a target row, `name: value` per line (the link's tooltip). */
|
|
5
5
|
export declare function lookupExtras(row: Row | undefined, lookup: LookupDef): string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* The colour of a target row's chip: the value of `lookup.color_field` (a
|
|
8
|
+
* named palette value such as `danger` or `red`), or `undefined` when the
|
|
9
|
+
* lookup names no colour field or the row has no value there. Read loosely,
|
|
10
|
+
* so a `@jsudc/core` older than `color_field` passes it through as well.
|
|
11
|
+
*/
|
|
12
|
+
export declare function lookupColor(row: Row | undefined, lookup: LookupDef): string | undefined;
|
package/dist/lookup/label.js
CHANGED
|
@@ -11,6 +11,19 @@ function lookupExtras(row, lookup) {
|
|
|
11
11
|
const lines = lookup.extra_fields.map((f) => [f, row[f]]).filter(([, v]) => v !== null && v !== void 0 && v !== "").map(([f, v]) => `${f}: ${typeof v === "string" ? v : JSON.stringify(v)}`);
|
|
12
12
|
return lines.length ? lines.join("\n") : void 0;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The colour of a target row's chip: the value of `lookup.color_field` (a
|
|
16
|
+
* named palette value such as `danger` or `red`), or `undefined` when the
|
|
17
|
+
* lookup names no colour field or the row has no value there. Read loosely,
|
|
18
|
+
* so a `@jsudc/core` older than `color_field` passes it through as well.
|
|
19
|
+
*/
|
|
20
|
+
function lookupColor(row, lookup) {
|
|
21
|
+
const field = lookup.color_field;
|
|
22
|
+
if (!row || typeof field !== "string" || field === "") return void 0;
|
|
23
|
+
const v = row[field];
|
|
24
|
+
if (typeof v === "number") return String(v);
|
|
25
|
+
return typeof v === "string" && v.trim() !== "" ? v.trim() : void 0;
|
|
26
|
+
}
|
|
27
|
+
export { lookupColor, lookupExtras, lookupLabel };
|
|
15
28
|
|
|
16
29
|
//# sourceMappingURL=label.js.map
|
package/dist/lookup/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","names":[],"sources":["../../src/lookup/label.ts"],"sourcesContent":["import type { LookupDef, Row } from \"@jsudc/core\";\n\n/** What a target row is called: its `label_field`, or `undefined` when it has none. */\nexport function lookupLabel(row: Row | undefined, lookup: LookupDef): string | undefined {\n const v = row?.[lookup.label_field];\n if (v === null || v === undefined || v === \"\") return undefined;\n return typeof v === \"string\" ? v : String(v);\n}\n\n/** The extra fields of a target row, `name: value` per line (the link's tooltip). */\nexport function lookupExtras(row: Row | undefined, lookup: LookupDef): string | undefined {\n if (!row || !lookup.extra_fields?.length) return undefined;\n const lines = lookup.extra_fields\n .map((f) => [f, row[f]] as const)\n .filter(([, v]) => v !== null && v !== undefined && v !== \"\")\n .map(([f, v]) => `${f}: ${typeof v === \"string\" ? v : JSON.stringify(v)}`);\n return lines.length ? lines.join(\"\\n\") : undefined;\n}\n"],"mappings":";;AAGA,SAAgB,YAAY,KAAsB,QAAuC;CACvF,MAAM,IAAI,MAAM,OAAO;CACvB,IAAI,MAAM,QAAQ,MAAM,KAAA,KAAa,MAAM,IAAI,OAAO,KAAA;CACtD,OAAO,OAAO,MAAM,WAAW,IAAI,OAAO,CAAC;AAC7C;;AAGA,SAAgB,aAAa,KAAsB,QAAuC;CACxF,IAAI,CAAC,OAAO,CAAC,OAAO,cAAc,QAAQ,OAAO,KAAA;CACjD,MAAM,QAAQ,OAAO,aAClB,KAAK,MAAM,CAAC,GAAG,IAAI,EAAE,CAAU,CAAC,CAChC,QAAQ,GAAG,OAAO,MAAM,QAAQ,MAAM,KAAA,KAAa,MAAM,EAAE,CAAC,CAC5D,KAAK,CAAC,GAAG,OAAO,GAAG,EAAE,IAAI,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC,GAAG;CAC3E,OAAO,MAAM,SAAS,MAAM,KAAK,IAAI,IAAI,KAAA;AAC3C"}
|
|
1
|
+
{"version":3,"file":"label.js","names":[],"sources":["../../src/lookup/label.ts"],"sourcesContent":["import type { LookupDef, Row } from \"@jsudc/core\";\n\n/** What a target row is called: its `label_field`, or `undefined` when it has none. */\nexport function lookupLabel(row: Row | undefined, lookup: LookupDef): string | undefined {\n const v = row?.[lookup.label_field];\n if (v === null || v === undefined || v === \"\") return undefined;\n return typeof v === \"string\" ? v : String(v);\n}\n\n/** The extra fields of a target row, `name: value` per line (the link's tooltip). */\nexport function lookupExtras(row: Row | undefined, lookup: LookupDef): string | undefined {\n if (!row || !lookup.extra_fields?.length) return undefined;\n const lines = lookup.extra_fields\n .map((f) => [f, row[f]] as const)\n .filter(([, v]) => v !== null && v !== undefined && v !== \"\")\n .map(([f, v]) => `${f}: ${typeof v === \"string\" ? v : JSON.stringify(v)}`);\n return lines.length ? lines.join(\"\\n\") : undefined;\n}\n\n/**\n * The colour of a target row's chip: the value of `lookup.color_field` (a\n * named palette value such as `danger` or `red`), or `undefined` when the\n * lookup names no colour field or the row has no value there. Read loosely,\n * so a `@jsudc/core` older than `color_field` passes it through as well.\n */\nexport function lookupColor(row: Row | undefined, lookup: LookupDef): string | undefined {\n const field: unknown = lookup.color_field;\n if (!row || typeof field !== \"string\" || field === \"\") return undefined;\n const v = row[field];\n if (typeof v === \"number\") return String(v);\n return typeof v === \"string\" && v.trim() !== \"\" ? v.trim() : undefined;\n}\n"],"mappings":";;AAGA,SAAgB,YAAY,KAAsB,QAAuC;CACvF,MAAM,IAAI,MAAM,OAAO;CACvB,IAAI,MAAM,QAAQ,MAAM,KAAA,KAAa,MAAM,IAAI,OAAO,KAAA;CACtD,OAAO,OAAO,MAAM,WAAW,IAAI,OAAO,CAAC;AAC7C;;AAGA,SAAgB,aAAa,KAAsB,QAAuC;CACxF,IAAI,CAAC,OAAO,CAAC,OAAO,cAAc,QAAQ,OAAO,KAAA;CACjD,MAAM,QAAQ,OAAO,aAClB,KAAK,MAAM,CAAC,GAAG,IAAI,EAAE,CAAU,CAAC,CAChC,QAAQ,GAAG,OAAO,MAAM,QAAQ,MAAM,KAAA,KAAa,MAAM,EAAE,CAAC,CAC5D,KAAK,CAAC,GAAG,OAAO,GAAG,EAAE,IAAI,OAAO,MAAM,WAAW,IAAI,KAAK,UAAU,CAAC,GAAG;CAC3E,OAAO,MAAM,SAAS,MAAM,KAAK,IAAI,IAAI,KAAA;AAC3C;;;;;;;AAQA,SAAgB,YAAY,KAAsB,QAAuC;CACvF,MAAM,QAAiB,OAAO;CAC9B,IAAI,CAAC,OAAO,OAAO,UAAU,YAAY,UAAU,IAAI,OAAO,KAAA;CAC9D,MAAM,IAAI,IAAI;CACd,IAAI,OAAO,MAAM,UAAU,OAAO,OAAO,CAAC;CAC1C,OAAO,OAAO,MAAM,YAAY,EAAE,KAAK,MAAM,KAAK,EAAE,KAAK,IAAI,KAAA;AAC/D"}
|
package/dist/lookup/links.d.ts
CHANGED
|
@@ -7,8 +7,13 @@ import { type MouseEvent, type ReactNode } from "react";
|
|
|
7
7
|
* where `<UdcDataView collection>` is mounted.
|
|
8
8
|
*/
|
|
9
9
|
export interface UdcLinks {
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The address of `collection`'s view with `search` as its query string, or
|
|
12
|
+
* `null` when the host has no view of `collection`: a lookup chip or label
|
|
13
|
+
* to it is then plain text (a click on it falls through to the row), and a
|
|
14
|
+
* `row_link` to it does nothing.
|
|
15
|
+
*/
|
|
16
|
+
href(collection: string, search: URLSearchParams): string | null;
|
|
12
17
|
/** Go to `href` inside the app. */
|
|
13
18
|
navigate(href: string): void;
|
|
14
19
|
}
|
|
@@ -24,7 +29,10 @@ export declare function UdcLinksProvider({ links, children }: {
|
|
|
24
29
|
children?: ReactNode;
|
|
25
30
|
}): import("react").JSX.Element;
|
|
26
31
|
export declare function useUdcLinks(): UdcLinks;
|
|
27
|
-
/**
|
|
28
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The address of `collection` opened with `filter` as its filter tree (`?f=`);
|
|
34
|
+
* `null` when the host has no view of `collection` (`UdcLinks.href`).
|
|
35
|
+
*/
|
|
36
|
+
export declare function filterHref(links: UdcLinks, collection: string, filter: FilterNode): string | null;
|
|
29
37
|
/** A plain click navigates in the app; Cmd / Ctrl / Shift-click (and the middle button) open a new tab. */
|
|
30
38
|
export declare function followLink(e: Pick<MouseEvent, "metaKey" | "ctrlKey" | "shiftKey" | "button" | "preventDefault">, href: string, links: UdcLinks): void;
|
package/dist/lookup/links.js
CHANGED
|
@@ -28,7 +28,10 @@ function UdcLinksProvider({ links, children }) {
|
|
|
28
28
|
function useUdcLinks() {
|
|
29
29
|
return useContext(UdcLinksContext);
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* The address of `collection` opened with `filter` as its filter tree (`?f=`);
|
|
33
|
+
* `null` when the host has no view of `collection` (`UdcLinks.href`).
|
|
34
|
+
*/
|
|
32
35
|
function filterHref(links, collection, filter) {
|
|
33
36
|
const search = new URLSearchParams();
|
|
34
37
|
const f = encodeFilterParam(filter);
|
package/dist/lookup/links.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.js","names":[],"sources":["../../src/lookup/links.tsx"],"sourcesContent":["import type { FilterNode } from \"@jsudc/core\";\nimport { createContext, type MouseEvent, type ReactNode, useContext } from \"react\";\nimport { encodeFilterParam, PARAM } from \"../data-view/urlState.js\";\n\n/**\n * How the library links from one collection to another (a lookup cell, a\n * `row_link`): the address of a collection's view, and how to go there\n * without a reload. The library knows no routes of its own, so the host says\n * where `<UdcDataView collection>` is mounted.\n */\nexport interface UdcLinks {\n
|
|
1
|
+
{"version":3,"file":"links.js","names":[],"sources":["../../src/lookup/links.tsx"],"sourcesContent":["import type { FilterNode } from \"@jsudc/core\";\nimport { createContext, type MouseEvent, type ReactNode, useContext } from \"react\";\nimport { encodeFilterParam, PARAM } from \"../data-view/urlState.js\";\n\n/**\n * How the library links from one collection to another (a lookup cell, a\n * `row_link`): the address of a collection's view, and how to go there\n * without a reload. The library knows no routes of its own, so the host says\n * where `<UdcDataView collection>` is mounted.\n */\nexport interface UdcLinks {\n /**\n * The address of `collection`'s view with `search` as its query string, or\n * `null` when the host has no view of `collection`: a lookup chip or label\n * to it is then plain text (a click on it falls through to the row), and a\n * `row_link` to it does nothing.\n */\n href(collection: string, search: URLSearchParams): string | null;\n /** Go to `href` inside the app. */\n navigate(href: string): void;\n}\n\n/**\n * `/c/<collection>?…`, followed with the History API: `pushState`, then a\n * `popstate` event, which a router on the History API (react-router's\n * `BrowserRouter` among them) reads as a navigation.\n */\nexport const defaultUdcLinks: UdcLinks = {\n href: (collection, search) => {\n const qs = search.toString();\n return `/c/${encodeURIComponent(collection)}${qs ? `?${qs}` : \"\"}`;\n },\n navigate: (href) => {\n window.history.pushState(null, \"\", href);\n window.dispatchEvent(new PopStateEvent(\"popstate\"));\n },\n};\n\nconst UdcLinksContext = createContext<UdcLinks>(defaultUdcLinks);\n\n/** Links to other collections through `links`; without it, `defaultUdcLinks`. */\nexport function UdcLinksProvider({ links, children }: { links: UdcLinks; children?: ReactNode }) {\n return <UdcLinksContext.Provider value={links}>{children}</UdcLinksContext.Provider>;\n}\n\nexport function useUdcLinks(): UdcLinks {\n return useContext(UdcLinksContext);\n}\n\n/**\n * The address of `collection` opened with `filter` as its filter tree (`?f=`);\n * `null` when the host has no view of `collection` (`UdcLinks.href`).\n */\nexport function filterHref(links: UdcLinks, collection: string, filter: FilterNode): string | null {\n const search = new URLSearchParams();\n const f = encodeFilterParam(filter);\n if (f) search.set(PARAM.filter, f);\n return links.href(collection, search);\n}\n\n/** A plain click navigates in the app; Cmd / Ctrl / Shift-click (and the middle button) open a new tab. */\nexport function followLink(\n e: Pick<MouseEvent, \"metaKey\" | \"ctrlKey\" | \"shiftKey\" | \"button\" | \"preventDefault\">,\n href: string,\n links: UdcLinks,\n): void {\n e.preventDefault();\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) {\n window.open(href, \"_blank\", \"noopener\");\n return;\n }\n links.navigate(href);\n}\n"],"mappings":";;;;;;;;;AA2BA,IAAa,kBAA4B;CACvC,OAAO,YAAY,WAAW;EAC5B,MAAM,KAAK,OAAO,SAAS;EAC3B,OAAO,MAAM,mBAAmB,UAAU,IAAI,KAAK,IAAI,OAAO;CAChE;CACA,WAAW,SAAS;EAClB,OAAO,QAAQ,UAAU,MAAM,IAAI,IAAI;EACvC,OAAO,cAAc,IAAI,cAAc,UAAU,CAAC;CACpD;AACF;AAEA,IAAM,kBAAkB,cAAwB,eAAe;;AAG/D,SAAgB,iBAAiB,EAAE,OAAO,YAAuD;CAC/F,OAAO,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;EAAQ;CAAmC,CAAA;AACrF;AAEA,SAAgB,cAAwB;CACtC,OAAO,WAAW,eAAe;AACnC;;;;;AAMA,SAAgB,WAAW,OAAiB,YAAoB,QAAmC;CACjG,MAAM,SAAS,IAAI,gBAAgB;CACnC,MAAM,IAAI,kBAAkB,MAAM;CAClC,IAAI,GAAG,OAAO,IAAI,MAAM,QAAQ,CAAC;CACjC,OAAO,MAAM,KAAK,YAAY,MAAM;AACtC;;AAGA,SAAgB,WACd,GACA,MACA,OACM;CACN,EAAE,eAAe;CACjB,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,GAAG;EAC1D,OAAO,KAAK,MAAM,UAAU,UAAU;EACtC;CACF;CACA,MAAM,SAAS,IAAI;AACrB"}
|
|
@@ -9,7 +9,8 @@ export declare function UdcReactRouterUrlState({ children, collectionPath, }: {
|
|
|
9
9
|
children?: ReactNode;
|
|
10
10
|
/**
|
|
11
11
|
* The route of a collection's view, e.g. `` (c) => `/udc/${c}` ``. With it, lookup
|
|
12
|
-
* links and `row_link`s go there through the router's `navigate
|
|
12
|
+
* links and `row_link`s go there through the router's `navigate`; `null` for a
|
|
13
|
+
* collection with no view in the app makes its lookup chips plain text.
|
|
13
14
|
*/
|
|
14
|
-
collectionPath?: (collection: string) => string;
|
|
15
|
+
collectionPath?: (collection: string) => string | null;
|
|
15
16
|
}): import("react").JSX.Element;
|
|
@@ -16,8 +16,10 @@ function UdcReactRouterUrlState({ children, collectionPath }) {
|
|
|
16
16
|
const navigate = useNavigate();
|
|
17
17
|
const links = useMemo(() => collectionPath ? {
|
|
18
18
|
href: (collection, search) => {
|
|
19
|
+
const path = collectionPath(collection);
|
|
20
|
+
if (path === null) return null;
|
|
19
21
|
const qs = search.toString();
|
|
20
|
-
return `${
|
|
22
|
+
return `${path}${qs ? `?${qs}` : ""}`;
|
|
21
23
|
},
|
|
22
24
|
navigate: (href) => void navigate(href)
|
|
23
25
|
} : null, [collectionPath, navigate]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UdcReactRouterUrlState.js","names":[],"sources":["../../src/react-router/UdcReactRouterUrlState.tsx"],"sourcesContent":["import { type ReactNode, useMemo, useRef } from \"react\";\nimport { useNavigate, useSearchParams } from \"react-router\";\nimport { type UdcLinks, UdcLinksProvider } from \"../lookup/links.js\";\nimport type { UrlStateAdapter } from \"../url-state/adapter.js\";\nimport { UdcUrlStateProvider } from \"../url-state/UrlState.js\";\n\nconst noSubscription = () => () => {};\n\n/**\n * Mount inside a react-router router (`BrowserRouter`, `MemoryRouter`, a data\n * router) to keep the data view's URL state in the router's location. The\n * adapter is rebuilt when the router's query string changes, which re-renders\n * the hooks under it in the router's own render; nothing to subscribe to.\n */\nexport function UdcReactRouterUrlState({\n children,\n collectionPath,\n}: {\n children?: ReactNode;\n /**\n * The route of a collection's view, e.g. `` (c) => `/udc/${c}` ``. With it, lookup\n * links and `row_link`s go there through the router's `navigate
|
|
1
|
+
{"version":3,"file":"UdcReactRouterUrlState.js","names":[],"sources":["../../src/react-router/UdcReactRouterUrlState.tsx"],"sourcesContent":["import { type ReactNode, useMemo, useRef } from \"react\";\nimport { useNavigate, useSearchParams } from \"react-router\";\nimport { type UdcLinks, UdcLinksProvider } from \"../lookup/links.js\";\nimport type { UrlStateAdapter } from \"../url-state/adapter.js\";\nimport { UdcUrlStateProvider } from \"../url-state/UrlState.js\";\n\nconst noSubscription = () => () => {};\n\n/**\n * Mount inside a react-router router (`BrowserRouter`, `MemoryRouter`, a data\n * router) to keep the data view's URL state in the router's location. The\n * adapter is rebuilt when the router's query string changes, which re-renders\n * the hooks under it in the router's own render; nothing to subscribe to.\n */\nexport function UdcReactRouterUrlState({\n children,\n collectionPath,\n}: {\n children?: ReactNode;\n /**\n * The route of a collection's view, e.g. `` (c) => `/udc/${c}` ``. With it, lookup\n * links and `row_link`s go there through the router's `navigate`; `null` for a\n * collection with no view in the app makes its lookup chips plain text.\n */\n collectionPath?: (collection: string) => string | null;\n}) {\n const [searchParams, setSearchParams] = useSearchParams();\n const navigate = useNavigate();\n const links = useMemo<UdcLinks | null>(\n () =>\n collectionPath\n ? {\n href: (collection, search) => {\n const path = collectionPath(collection);\n if (path === null) return null;\n const qs = search.toString();\n return `${path}${qs ? `?${qs}` : \"\"}`;\n },\n navigate: (href) => void navigate(href),\n }\n : null,\n [collectionPath, navigate],\n );\n const search = searchParams.toString();\n // What the last `set` wrote, until the router renders it: a second update in the\n // same transition starts from the first one's result, as with `window.location`.\n const latest = useRef(search);\n const adapter = useMemo<UrlStateAdapter>(() => {\n latest.current = search;\n return {\n get: () => new URLSearchParams(latest.current),\n set(next, opts) {\n latest.current = next.toString();\n setSearchParams(next, { replace: opts?.replace });\n },\n subscribe: noSubscription,\n };\n }, [search, setSearchParams]);\n const inner = <UdcUrlStateProvider adapter={adapter}>{children}</UdcUrlStateProvider>;\n return links ? <UdcLinksProvider links={links}>{inner}</UdcLinksProvider> : inner;\n}\n"],"mappings":";;;;;;AAMA,IAAM,6BAA6B,CAAC;;;;;;;AAQpC,SAAgB,uBAAuB,EACrC,UACA,kBASC;CACD,MAAM,CAAC,cAAc,mBAAmB,gBAAgB;CACxD,MAAM,WAAW,YAAY;CAC7B,MAAM,QAAQ,cAEV,iBACI;EACE,OAAO,YAAY,WAAW;GAC5B,MAAM,OAAO,eAAe,UAAU;GACtC,IAAI,SAAS,MAAM,OAAO;GAC1B,MAAM,KAAK,OAAO,SAAS;GAC3B,OAAO,GAAG,OAAO,KAAK,IAAI,OAAO;EACnC;EACA,WAAW,SAAS,KAAK,SAAS,IAAI;CACxC,IACA,MACN,CAAC,gBAAgB,QAAQ,CAC3B;CACA,MAAM,SAAS,aAAa,SAAS;CAGrC,MAAM,SAAS,OAAO,MAAM;CAC5B,MAAM,UAAU,cAA+B;EAC7C,OAAO,UAAU;EACjB,OAAO;GACL,WAAW,IAAI,gBAAgB,OAAO,OAAO;GAC7C,IAAI,MAAM,MAAM;IACd,OAAO,UAAU,KAAK,SAAS;IAC/B,gBAAgB,MAAM,EAAE,SAAS,MAAM,QAAQ,CAAC;GAClD;GACA,WAAW;EACb;CACF,GAAG,CAAC,QAAQ,eAAe,CAAC;CAC5B,MAAM,QAAQ,oBAAC,qBAAD;EAA8B;EAAU;CAA8B,CAAA;CACpF,OAAO,QAAQ,oBAAC,kBAAD;EAAyB;EAAQ,UAAA;CAAwB,CAAA,IAAI;AAC9E"}
|