@marktiderman/genesis-core 2.4.1 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +42 -0
  2. package/dist/{chunk-ZIMQUFXD.js → chunk-37RWGNIO.js} +9 -4
  3. package/dist/chunk-37RWGNIO.js.map +1 -0
  4. package/dist/chunk-BIIENNTW.js +497 -0
  5. package/dist/chunk-BIIENNTW.js.map +1 -0
  6. package/dist/{chunk-XMC4EJUE.js → chunk-EHFYSJJA.js} +6 -3
  7. package/dist/chunk-EHFYSJJA.js.map +1 -0
  8. package/dist/chunk-LZVU5NGV.js +82 -0
  9. package/dist/chunk-LZVU5NGV.js.map +1 -0
  10. package/dist/{chunk-X6EO3XBB.js → chunk-OKCSGNCU.js} +9 -4
  11. package/dist/chunk-OKCSGNCU.js.map +1 -0
  12. package/dist/{chunk-5NEOX2N7.js → chunk-OWYX4BEI.js} +4 -4
  13. package/dist/{chunk-5NEOX2N7.js.map → chunk-OWYX4BEI.js.map} +1 -1
  14. package/dist/csv.d.ts +1 -3
  15. package/dist/dates.d.ts +199 -1
  16. package/dist/dates.js +1 -1
  17. package/dist/errors.d.ts +8 -1
  18. package/dist/errors.js +1 -1
  19. package/dist/form-types.d.ts +1 -70
  20. package/dist/hooks/index.d.ts +3 -4
  21. package/dist/hooks/index.js +7 -6
  22. package/dist/hooks/mutation-mode.d.ts +1 -3
  23. package/dist/hooks/related-keys.d.ts +1 -3
  24. package/dist/hooks/use-capabilities.d.ts +1 -2
  25. package/dist/hooks/use-infinite-resource.d.ts +1 -3
  26. package/dist/hooks/use-link-options.d.ts +58 -0
  27. package/dist/hooks/use-link-options.js +10 -0
  28. package/dist/hooks/use-link-options.js.map +1 -0
  29. package/dist/hooks/use-live.d.ts +1 -3
  30. package/dist/hooks/use-one.d.ts +1 -3
  31. package/dist/hooks/use-relation-label.d.ts +8 -4
  32. package/dist/hooks/use-relation-label.js +1 -1
  33. package/dist/hooks/use-resource-form.d.ts +1 -3
  34. package/dist/hooks/use-resource-form.js +2 -2
  35. package/dist/hooks/use-resource.d.ts +1 -3
  36. package/dist/hooks/use-write.d.ts +1 -3
  37. package/dist/index.d.ts +5 -6
  38. package/dist/index.js +7 -6
  39. package/dist/provider/index.d.ts +4 -6
  40. package/dist/resource-view/index.d.ts +118 -4
  41. package/dist/resource-view/index.js +148 -35
  42. package/dist/resource-view/index.js.map +1 -1
  43. package/dist/schema/index.d.ts +3 -5
  44. package/dist/testing/index.d.ts +2 -4
  45. package/dist/types-r_Rlw7BB.d.ts +800 -0
  46. package/dist/{write-outcome-CFnpciUI.d.ts → write-outcome-BWV34wh5.d.ts} +1 -1
  47. package/package.json +1 -1
  48. package/dist/chunk-3B4IFDMK.js +0 -117
  49. package/dist/chunk-3B4IFDMK.js.map +0 -1
  50. package/dist/chunk-X6EO3XBB.js.map +0 -1
  51. package/dist/chunk-XMC4EJUE.js.map +0 -1
  52. package/dist/chunk-ZIMQUFXD.js.map +0 -1
  53. package/dist/types-CXhqXPN1.d.ts +0 -367
  54. package/dist/types-o8j7g6O6.d.ts +0 -331
@@ -1,6 +1,4 @@
1
- import { D as DataProvider, a as Identifier } from '../types-CXhqXPN1.js';
2
- import { b as FieldReference } from '../types-o8j7g6O6.js';
3
- import '../form-types.js';
1
+ import { D as DataProvider, l as FieldReference, b as Identifier } from '../types-r_Rlw7BB.js';
4
2
 
5
3
  interface UseRelationLabelOptions {
6
4
  /** The linked row's field that names it. Default: the linked resource's `labelField` (`describe`). */
@@ -8,6 +6,12 @@ interface UseRelationLabelOptions {
8
6
  /** Default `true`. */
9
7
  enabled?: boolean;
10
8
  }
9
+ /**
10
+ * The linked resource's naming field, as a link's words find it: its `labelField` from
11
+ * `describe`, else a `name`/`title`-like field. Undefined when it can't say. Asked once per
12
+ * resource and provider; a picker uses it to search and sort the rows it lists.
13
+ */
14
+ declare function relationNamingField(provider: DataProvider, resource: string): Promise<string | undefined>;
11
15
  /**
12
16
  * The words for one linked id, batched with every other id asked for in the same tick: one
13
17
  * `getList(resource, { filters: [{ field, operator: "in" }] })` per linked resource and naming
@@ -22,4 +26,4 @@ declare function loadRelationLabel(provider: DataProvider, reference: FieldRefer
22
26
  */
23
27
  declare function useRelationLabel(reference: FieldReference | undefined, id: unknown, options?: UseRelationLabelOptions): string | null | undefined;
24
28
 
25
- export { type UseRelationLabelOptions, loadRelationLabel, useRelationLabel };
29
+ export { type UseRelationLabelOptions, loadRelationLabel, relationNamingField, useRelationLabel };
@@ -1,4 +1,4 @@
1
- export { loadRelationLabel, useRelationLabel } from '../chunk-XMC4EJUE.js';
1
+ export { loadRelationLabel, relationNamingField, useRelationLabel } from '../chunk-EHFYSJJA.js';
2
2
  import '../chunk-VDEW4AOS.js';
3
3
  import '../chunk-ZYJUEJ4Z.js';
4
4
  //# sourceMappingURL=use-relation-label.js.map
@@ -1,8 +1,6 @@
1
1
  import { UseFormReturn } from 'react-hook-form';
2
- import { ResourceFormFieldDef } from '../form-types.js';
3
- import { I as InvalidationKey } from '../types-CXhqXPN1.js';
2
+ import { y as ResourceFormFieldDef, I as InvalidationKey } from '../types-r_Rlw7BB.js';
4
3
  import { MutationModeOptions } from './mutation-mode.js';
5
- import '../types-o8j7g6O6.js';
6
4
  import '@tanstack/react-query';
7
5
 
8
6
  interface UseResourceFormOptions extends MutationModeOptions {
@@ -1,7 +1,7 @@
1
- export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-X6EO3XBB.js';
1
+ export { blankValues, buildArrayItemDefaults, useResourceForm } from '../chunk-OKCSGNCU.js';
2
+ import '../chunk-XQO4OH2N.js';
2
3
  import '../chunk-GWQHP3RC.js';
3
4
  import '../chunk-K4ZNAF3G.js';
4
- import '../chunk-XQO4OH2N.js';
5
5
  import '../chunk-AUVKRXRC.js';
6
6
  import '../chunk-OSFG3GFY.js';
7
7
  import '../chunk-7PUFVNPB.js';
@@ -1,9 +1,7 @@
1
1
  import { UseQueryResult, UseMutationResult } from '@tanstack/react-query';
2
- import { S as SortParam, F as FilterParam, I as InvalidationKey, l as ListResult, L as ListParams, a as Identifier, B as BaseRecord } from '../types-CXhqXPN1.js';
2
+ import { S as SortParam, a as FilterParam, I as InvalidationKey, s as ListResult, L as ListParams, b as Identifier, B as BaseRecord } from '../types-r_Rlw7BB.js';
3
3
  import { MutationModeOptions } from './mutation-mode.js';
4
4
  import { LiveOptions } from './use-live.js';
5
- import '../types-o8j7g6O6.js';
6
- import '../form-types.js';
7
5
 
8
6
  interface UseResourceOptions<T> extends MutationModeOptions {
9
7
  defaultSort?: SortParam;
@@ -1,7 +1,5 @@
1
1
  import { QueryClient, MutationOptions } from '@tanstack/react-query';
2
- import { I as InvalidationKey } from '../types-CXhqXPN1.js';
3
- import '../types-o8j7g6O6.js';
4
- import '../form-types.js';
2
+ import { I as InvalidationKey } from '../types-r_Rlw7BB.js';
5
3
 
6
4
  declare const WRITE_FAILED = "That didn't work. Try again.";
7
5
  interface UseWriteOptions<A, R> {
package/dist/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
- import { L as ListParams, a as Identifier } from './types-CXhqXPN1.js';
2
- export { A as ArrayFilter, B as BaseRecord, b as BulkChange, c as BulkResult, C as CountMode, d as CreateParams, e as CreateResult, D as DataProvider, f as DeleteParams, g as DeleteResult, F as FilterParam, G as GetManyParams, h as GetManyResult, i as GetOneParams, j as GetOneResult, H as HistoryParams, k as ImportParams, I as InvalidationKey, l as ListResult, N as NullFilter, P as PaginationParam, R as RangeFilter, m as ResourceChangeEvent, n as RowFailure, o as ScalarFilter, S as SortParam, p as SubscribeParams, U as UpdateParams, q as UpdateResult, W as WriteEvent } from './types-CXhqXPN1.js';
3
- export { D as DataWriteError, a as DataWriteErrorOptions, W as WriteOutcome, i as isDataWriteError } from './write-outcome-CFnpciUI.js';
1
+ import { L as ListParams, b as Identifier } from './types-r_Rlw7BB.js';
2
+ export { A as ArrayFilter, c as AuditEntry, B as BaseRecord, d as BulkChange, e as BulkResult, C as CountMode, f as CreateParams, g as CreateResult, D as DataProvider, h as DataRow, i as DeleteParams, j as DeleteResult, k as FieldPermissions, l as FieldReference, F as FieldSchema, m as FieldType, n as FilterOperator, a as FilterParam, G as GetManyParams, o as GetManyResult, p as GetOneParams, q as GetOneResult, H as HistoryParams, r as ImportParams, I as InvalidationKey, s as ListResult, N as NullFilter, P as PaginationParam, t as ProviderCapabilities, R as RangeFilter, u as RecordComment, v as ResourceAccess, w as ResourceChangeEvent, x as ResourceContract, y as ResourceFormFieldDef, z as ResourceRelation, E as ResourceSchema, J as ResourceSummary, K as RowAction, M as RowFailure, O as RowOf, Q as ScalarFilter, T as SelectOption, S as SortParam, U as StorageType, V as SubscribeParams, X as UpdateParams, Y as UpdateResult, Z as VersionField, m as WidgetHint, W as WriteEvent, _ as defineResource } from './types-r_Rlw7BB.js';
3
+ export { D as DataWriteError, a as DataWriteErrorOptions, W as WriteOutcome, i as isDataWriteError } from './write-outcome-BWV34wh5.js';
4
4
  export { CallRpcOptions, CreateOrAdoptOptions, CreateOrAdoptResult, DEFAULT_RPC_MESSAGES, DataProviderRoot, DataProviderRootProps, GenesisProvider, GenesisProviderProps, MockProviderOptions, PostgrestFieldErrors, RPC_FAILED, RpcClient, SupabaseClient, SupabaseClientInput, SupabaseProviderOptions, SupabaseRealtimeChannel, SupabaseRealtimePayload, SupabaseResourceConfig, SupabaseWriteContext, callRpc, createMockProvider, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, useDataProvider, useStorage, writeOutcomeFromCode } from './provider/index.js';
5
5
  export { D as DataReadError, a as DataReadErrorOptions, R as ReadOutcome, i as isDataReadError, r as readFailureMessage } from './read-outcome-BnboMYOV.js';
6
6
  export { S as StorageAdapter } from './types-DKcxHXxq.js';
7
7
  export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './storage/index.js';
8
8
  export { UseResourceOptions, UseResourceReturn, useResource } from './hooks/use-resource.js';
9
9
  export { UseOneOptions, useOne } from './hooks/use-one.js';
10
- export { UseRelationLabelOptions, loadRelationLabel, useRelationLabel } from './hooks/use-relation-label.js';
10
+ export { UseRelationLabelOptions, loadRelationLabel, relationNamingField, useRelationLabel } from './hooks/use-relation-label.js';
11
+ export { LinkOption, LinkTarget, UseLinkOptionsOptions, UseLinkOptionsReturn, useLinkOptions } from './hooks/use-link-options.js';
11
12
  export { InfinitePageParam, UseInfiniteResourceOptions, UseInfiniteResourceReturn, useInfiniteResource } from './hooks/use-infinite-resource.js';
12
13
  export { useCapabilities } from './hooks/use-capabilities.js';
13
14
  export { UseWriteOptions, UseWriteReturn, WRITE_FAILED, useWrite } from './hooks/use-write.js';
@@ -20,8 +21,6 @@ export { UseResourceFormOptions, UseResourceFormReturn, blankValues, buildArrayI
20
21
  export { UseWizardReturn, WizardStep, useWizard } from './hooks/use-wizard.js';
21
22
  export { DEFAULT_UNDO_DELAY_MS, MutationMode, MutationModeOptions, UndoableWrite, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './hooks/mutation-mode.js';
22
23
  export { DEFAULT_UNSAVED_CHANGES_MESSAGE, UseUnsavedChangesGuardOptions, UseUnsavedChangesGuardReturn, useUnsavedChangesGuard } from './hooks/use-unsaved-changes-guard.js';
23
- export { FieldType, ResourceFormFieldDef, SelectOption, FieldType as WidgetHint } from './form-types.js';
24
- export { A as AuditEntry, D as DataRow, a as FieldPermissions, b as FieldReference, F as FieldSchema, c as FilterOperator, P as ProviderCapabilities, R as RecordComment, d as ResourceAccess, e as ResourceContract, f as ResourceRelation, g as ResourceSchema, h as ResourceSummary, i as RowAction, j as RowOf, S as StorageType, V as VersionField, k as defineResource } from './types-o8j7g6O6.js';
25
24
  export { decodeRecordKey, encodeRecordKey, keyFields } from './schema/index.js';
26
25
  import { Query } from '@tanstack/react-query';
27
26
  export { isSafeUrl, normalizeLinkUrl } from './urls.js';
package/dist/index.js CHANGED
@@ -2,18 +2,19 @@ export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabas
2
2
  export { defineResource } from './chunk-7FVTGKTX.js';
3
3
  export { decodeRecordKey, encodeRecordKey, keyFields } from './chunk-KV2HW4G4.js';
4
4
  import './chunk-XCX2TRBL.js';
5
- export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from './chunk-5NEOX2N7.js';
5
+ export { ViewerScope, WorkspaceScope, clearViewerCache, rememberedWorkspaceId, scopeClock, useOptionalViewerScope, useViewer, useViewerScope, useWorkspace } from './chunk-OWYX4BEI.js';
6
6
  export { useWizard } from './chunk-7KOLYF27.js';
7
7
  export { WRITE_FAILED, useWrite } from './chunk-52T2EYXH.js';
8
8
  export { NO_VIEWER } from './chunk-OZYF55E3.js';
9
9
  export { useDraft } from './chunk-DF2UWEEB.js';
10
+ export { useLinkOptions } from './chunk-LZVU5NGV.js';
10
11
  export { useInfiniteResource } from './chunk-2VVZ2KX3.js';
11
- export { loadRelationLabel, useRelationLabel } from './chunk-XMC4EJUE.js';
12
- export { blankValues, buildArrayItemDefaults, useResourceForm } from './chunk-X6EO3XBB.js';
12
+ export { loadRelationLabel, relationNamingField, useRelationLabel } from './chunk-EHFYSJJA.js';
13
+ export { blankValues, buildArrayItemDefaults, useResourceForm } from './chunk-OKCSGNCU.js';
14
+ export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from './chunk-XQO4OH2N.js';
13
15
  export { useOne } from './chunk-GWQHP3RC.js';
14
16
  export { useResource } from './chunk-CC37H7O2.js';
15
17
  export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS } from './chunk-K4ZNAF3G.js';
16
- export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from './chunk-XQO4OH2N.js';
17
18
  import './chunk-UHOMTFBD.js';
18
19
  export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from './chunk-HBAPYA5K.js';
19
20
  import './chunk-AUVKRXRC.js';
@@ -23,8 +24,8 @@ import './chunk-7NUL32W7.js';
23
24
  export { useCapabilities } from './chunk-LGTXQTHA.js';
24
25
  export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from './chunk-VDEW4AOS.js';
25
26
  export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './chunk-ZYJUEJ4Z.js';
26
- import './chunk-3B4IFDMK.js';
27
- export { classifyError, defaultErrorReporter, errorMessages, getErrorReporter, reportError, setErrorReporter } from './chunk-ZIMQUFXD.js';
27
+ import './chunk-BIIENNTW.js';
28
+ export { classifyError, defaultErrorReporter, errorMessages, getErrorReporter, reportError, setErrorReporter } from './chunk-37RWGNIO.js';
28
29
  export { fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from './chunk-PA6WJE5E.js';
29
30
  export { DataReadError, isDataReadError, readFailureMessage } from './chunk-HUNGCTRA.js';
30
31
  export { titleCase } from './chunk-RYEXWQFD.js';
@@ -1,15 +1,13 @@
1
- import { D as DataProvider, a as Identifier, B as BaseRecord, I as InvalidationKey, W as WriteEvent, C as CountMode, F as FilterParam } from '../types-CXhqXPN1.js';
2
- export { A as ArrayFilter, b as BulkChange, c as BulkResult, d as CreateParams, e as CreateResult, f as DeleteParams, g as DeleteResult, G as GetManyParams, h as GetManyResult, i as GetOneParams, j as GetOneResult, H as HistoryParams, k as ImportParams, L as ListParams, l as ListResult, N as NullFilter, P as PaginationParam, R as RangeFilter, m as ResourceChangeEvent, n as RowFailure, o as ScalarFilter, S as SortParam, p as SubscribeParams, U as UpdateParams, q as UpdateResult } from '../types-CXhqXPN1.js';
3
- import { D as DataWriteError, W as WriteOutcome } from '../write-outcome-CFnpciUI.js';
4
- export { a as DataWriteErrorOptions, i as isDataWriteError } from '../write-outcome-CFnpciUI.js';
1
+ import { D as DataProvider, b as Identifier, B as BaseRecord, I as InvalidationKey, W as WriteEvent, C as CountMode, a as FilterParam } from '../types-r_Rlw7BB.js';
2
+ export { A as ArrayFilter, d as BulkChange, e as BulkResult, f as CreateParams, g as CreateResult, i as DeleteParams, j as DeleteResult, G as GetManyParams, o as GetManyResult, p as GetOneParams, q as GetOneResult, H as HistoryParams, r as ImportParams, L as ListParams, s as ListResult, N as NullFilter, P as PaginationParam, R as RangeFilter, w as ResourceChangeEvent, M as RowFailure, Q as ScalarFilter, S as SortParam, V as SubscribeParams, X as UpdateParams, Y as UpdateResult } from '../types-r_Rlw7BB.js';
3
+ import { D as DataWriteError, W as WriteOutcome } from '../write-outcome-BWV34wh5.js';
4
+ export { a as DataWriteErrorOptions, i as isDataWriteError } from '../write-outcome-BWV34wh5.js';
5
5
  import { D as DataReadError, R as ReadOutcome } from '../read-outcome-BnboMYOV.js';
6
6
  export { a as DataReadErrorOptions, i as isDataReadError, r as readFailureMessage } from '../read-outcome-BnboMYOV.js';
7
7
  import * as react from 'react';
8
8
  import { ReactNode } from 'react';
9
9
  import { QueryClient } from '@tanstack/react-query';
10
10
  import { S as StorageAdapter } from '../types-DKcxHXxq.js';
11
- import '../types-o8j7g6O6.js';
12
- import '../form-types.js';
13
11
 
14
12
  interface MockProviderOptions {
15
13
  /** Simulated latency in ms (default 0). */
@@ -1,9 +1,7 @@
1
- import { D as DataRow, e as ResourceContract, j as RowOf, i as RowAction, F as FieldSchema } from '../types-o8j7g6O6.js';
1
+ import { h as DataRow, x as ResourceContract, O as RowOf, K as RowAction, F as FieldSchema, a as FilterParam, b as Identifier } from '../types-r_Rlw7BB.js';
2
2
  import { C as ChipTone, R as Readiness } from '../status-BXRokZD9.js';
3
3
  import { V as Viewer, R as ResourceScope } from '../viewer-scope-bthEYSOB.js';
4
4
  export { G as GenesisViewerRoles, N as NO_VIEWER } from '../viewer-scope-bthEYSOB.js';
5
- import { a as Identifier } from '../types-CXhqXPN1.js';
6
- import '../form-types.js';
7
5
  import 'react';
8
6
  import '@tanstack/react-query';
9
7
  import '../dates.js';
@@ -39,8 +37,27 @@ interface ViewField<Row extends DataRow = DataRow> {
39
37
  * `"Someone you can't see"`. Default: the catalogue's `common.hiddenLink`. Never the raw id.
40
38
  */
41
39
  missingLabel?: string;
40
+ /**
41
+ * For a link: edit it in the view's forms with a picker, and how the picker lists the rows it
42
+ * can point at. Setting it (`{}` is enough) opts the link in; without it (or the view's
43
+ * `editLinks`) a link stays read-only. `view` narrows it to the linked view's rules (its scope
44
+ * and default filter); `filter` adds more.
45
+ */
46
+ link?: ViewLink;
42
47
  /** Longest text a form accepts. Feeds the derived validation. */
43
48
  max?: number;
49
+ /**
50
+ * In a form: the browser's autofill token (`email`, `tel`, `given-name`, `one-time-code`,
51
+ * `off`, ...). Unset, the input carries no `autocomplete` attribute and gets no token from its
52
+ * type, so the browser applies its own heuristics (it may still offer to fill it). Set a token
53
+ * where the form is about the viewer, and `off` on a form about someone else (an admin editing
54
+ * a member) to ask the browser not to fill in the person at the keyboard.
55
+ */
56
+ autoComplete?: string;
57
+ /** In a form: which on-screen keyboard a phone shows. Unset, it follows the field's type. */
58
+ inputMode?: "none" | "text" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
59
+ /** In a form: the label on the keyboard's Return key (`next`, `done`, `go`, `search`, `send`). */
60
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send";
44
61
  /** Shown read-only even where the server would accept a write. Never widens. */
45
62
  readOnly?: boolean;
46
63
  /**
@@ -60,6 +77,50 @@ interface ViewField<Row extends DataRow = DataRow> {
60
77
  */
61
78
  timeZone?: ViewTimeZone;
62
79
  }
80
+ /**
81
+ * A picker's filter: equality per field. `null` is "is empty", a list is "any of". Sent to the
82
+ * server with the list request, never applied to loaded rows.
83
+ */
84
+ type LinkFilter = Readonly<Record<string, string | number | boolean | null | readonly (string | number)[]>>;
85
+ /** The parts of the linked resource's view a picker reads. */
86
+ type LinkedView = Pick<ResourceView<any, any>, "resource" | "definition" | "labelField">;
87
+ /**
88
+ * How a link's picker lists the linked rows (`fields.owner_id.link`). The list always goes through
89
+ * the provider, so row-level security decides what the viewer can pick; these only narrow it.
90
+ */
91
+ interface ViewLink {
92
+ /**
93
+ * The linked resource's view. Its `scope` keys (read from the viewer's scope, as its own lists
94
+ * do), its `default` preset's filter (or `preset`'s) and its `labelField` apply to the picker.
95
+ * A function for two views that link each other (`() => usersView`).
96
+ */
97
+ view?: LinkedView | (() => LinkedView);
98
+ /** One of the linked view's presets whose filter the picker uses. Default: its `default` preset. */
99
+ preset?: string;
100
+ /**
101
+ * More filters: fixed, or from the form's values, for a picker that follows another field
102
+ * (`(values) => ({ project_id: values.project_id })`, the tasks of the chosen project).
103
+ */
104
+ filter?: LinkFilter | ((values: Readonly<Record<string, unknown>>) => LinkFilter);
105
+ /** The linked fields a search matches. Default: the naming field (`labelField`). */
106
+ searchFields?: readonly string[];
107
+ }
108
+ /** A link's picker, resolved: what to list, what names a row, and the filters to send. */
109
+ interface ResolvedLink {
110
+ /** The linked resource. */
111
+ resource: string;
112
+ /** The linked field the link stores (its key, usually `id`). */
113
+ field: string;
114
+ /** The linked field that names a row: the view field's, else the linked view's. Undefined: the provider's `describe`. */
115
+ readonly labelField: string | undefined;
116
+ /** The linked fields a search matches. Unset: the naming field. */
117
+ searchFields?: readonly string[];
118
+ /**
119
+ * The filters a picker sends: the linked view's scope keys from `scope` (as its own lists apply
120
+ * them), its preset's filter, then the link's own `filter` for these form values.
121
+ */
122
+ filters(scope?: ResourceScope | null, values?: Readonly<Record<string, unknown>>): FilterParam[];
123
+ }
63
124
  /**
64
125
  * An IANA zone name as written: `"UTC"`, `"GMT"` or `Area/Location` (`"Europe/Berlin"`). The
65
126
  * type keeps a bare word out; `defineView` checks the runtime knows the zone.
@@ -195,6 +256,29 @@ interface ViewCopy {
195
256
  filtered?: string;
196
257
  };
197
258
  }
259
+ /** How a calendar lays out its window: a month grid, 1–4 weeks, a day-by-day agenda, or a row per lane. */
260
+ type ViewCalendarLayout = "month" | "weeks" | "agenda" | "lanes";
261
+ /**
262
+ * How the view's rows show as a calendar: ResourceView's `mode="calendar"` on the web,
263
+ * NativeResourceView's later. Plain values only, so every platform reads the same block; a screen
264
+ * overrides the layout, weeks and anchor, and adds functions (dot colours, `onSelect`).
265
+ */
266
+ interface ViewCalendar<Name extends string = string> {
267
+ /** The date or timestamp field that places each row. */
268
+ field: Name;
269
+ /** Where a row ends: its last day for a date field, its end instant for a timestamp. */
270
+ endField?: Name;
271
+ /** A yes/no field: the row is all day, its timestamp shown without a time. */
272
+ allDayField?: Name;
273
+ /** The field whose value (or list of values) names a row's lanes: a dot each, a lane each. */
274
+ laneBy?: Name;
275
+ /** Default `month`. */
276
+ layout?: ViewCalendarLayout;
277
+ /** For `weeks`, `agenda` and `lanes`: 1 to 4. Default 2. */
278
+ weeks?: 1 | 2 | 3 | 4;
279
+ /** 0 Sunday or 1 Monday (default). */
280
+ weekStartsOn?: 0 | 1;
281
+ }
198
282
  /** What `defineView` accepts. */
199
283
  interface ViewDefinition<C extends ResourceContract, Row extends DataRow = RowOf<C>> {
200
284
  copy?: ViewCopy;
@@ -214,12 +298,19 @@ interface ViewDefinition<C extends ResourceContract, Row extends DataRow = RowOf
214
298
  presets?: Readonly<Record<string, ViewPreset<FieldNameOf<C>>>>;
215
299
  /** The record form. Default: every writable field, in contract order. */
216
300
  form?: readonly ViewFormItem<FieldNameOf<C>>[];
301
+ /**
302
+ * Edit every link in this view's forms with a picker. Default false: a link is read-only (and
303
+ * never sent) unless its `fields.<link>.link` is set (`{}` is enough). The default flips in 3.0.
304
+ */
305
+ editLinks?: boolean;
217
306
  can?: ViewGuards<Row>;
218
307
  /** Named operations on one row, in the order a menu shows them. Names are unique. */
219
308
  actions?: readonly ViewAction<Row>[];
220
309
  summary?: (row: Row) => RowSummary;
221
310
  /** The scope keys this view needs above it (`["org_id"]`). They stay out of forms. */
222
311
  scope?: readonly FieldNameOf<C>[];
312
+ /** How the rows show as a calendar (`mode="calendar"`). */
313
+ calendar?: ViewCalendar<FieldNameOf<C>>;
223
314
  /** Group rows under headers by this field. */
224
315
  groupBy?: FieldNameOf<C>;
225
316
  /** Default order; `manual: true` turns on drag to reorder, writing this field. */
@@ -258,6 +349,12 @@ interface ResolvedFormField {
258
349
  required: boolean;
259
350
  readOnly: boolean;
260
351
  max?: number;
352
+ /** The input's autofill token (`ViewField.autoComplete`). */
353
+ autoComplete?: string;
354
+ /** The keyboard a phone shows (`ViewField.inputMode`). */
355
+ inputMode?: ViewField["inputMode"];
356
+ /** The Return key's label (`ViewField.enterKeyHint`). */
357
+ enterKeyHint?: ViewField["enterKeyHint"];
261
358
  /** For a link: the linked row's field that names it (`ViewField.labelField`). */
262
359
  labelField?: string;
263
360
  /** For a link: the words when its row is hidden or gone (`ViewField.missingLabel`). */
@@ -267,6 +364,8 @@ interface ResolvedFormField {
267
364
  value: string;
268
365
  label: string;
269
366
  }[];
367
+ /** For a link the view opted in (`fields.<link>.link`, `editLinks`): how its picker lists the linked rows. */
368
+ link?: ResolvedLink;
270
369
  /** The heading it sits under, or null for none. */
271
370
  section: string | null;
272
371
  sectionTitle: string | null;
@@ -315,6 +414,7 @@ declare class ViewDefinitionError extends Error {
315
414
  readonly problems: readonly string[];
316
415
  constructor(resource: string, problems: readonly string[]);
317
416
  }
417
+
318
418
  /** The display a field gets when the view doesn't name one. */
319
419
  declare function deriveDisplay(field: FieldSchema): DisplayHint;
320
420
  /** A table name's singular, for the default noun. A wrong guess is fixed with `@genesis {"noun"}`. */
@@ -341,6 +441,14 @@ declare function valueText(labels: Readonly<Record<string, string>> | undefined,
341
441
  * Throws {@link ViewDefinitionError} when it names something the contract doesn't have, so a
342
442
  * renamed column fails at start-up, not as a blank cell.
343
443
  */
444
+ /**
445
+ * What's wrong with a calendar block for these fields, one sentence each (empty when it's fine).
446
+ * `defineView` checks the view's own block with it; a renderer checks a screen's overrides merged
447
+ * over that block with it too, so neither can name a field that isn't there or isn't a date.
448
+ *
449
+ * @stability Beta
450
+ */
451
+ declare function calendarProblems(fields: readonly Pick<FieldSchema, "name" | "type" | "array">[], calendar: Partial<ViewCalendar>): string[];
344
452
  declare function defineView<C extends ResourceContract, Row extends DataRow = RowOf<C>>(contract: C, definition?: ViewDefinition<C, Row>): ResourceView<C, Row>;
345
453
 
346
454
  /**
@@ -384,6 +492,12 @@ declare function scopeValues(view: Pick<ResourceView<any, any>, "resource" | "de
384
492
  */
385
493
  declare function scopeFilter(view: Pick<ResourceView<any, any>, "definition">, scope: ResourceScope | null | undefined): Readonly<Record<string, ScopeValue | readonly (string | number)[]>>;
386
494
 
495
+ /**
496
+ * A screen's or a picker's filter as provider filters: a single value is `eq`, `null` is
497
+ * `is_null` and a list is `in`.
498
+ */
499
+ declare function filterParams(filter: LinkFilter | null | undefined): FilterParam[];
500
+
387
501
  /**
388
502
  * A screen's `tree` (`<ResourceView tree={{ getParentId }} />`): rows nest under the row
389
503
  * `getParentId` names. Client-side data only: every row is loaded, and children are never
@@ -649,4 +763,4 @@ type WorkspaceSection<Row extends DataRow = DataRow, Name extends string = strin
649
763
  /** @deprecated Renamed `RecordViewHeaderAction`. */
650
764
  type WorkspaceHeaderAction = RecordViewHeaderAction;
651
765
 
652
- export { type Allowed, type ComputedColumn, type DisplayHint, type FieldNameOf, type RecordView, type RecordViewDefinition, type RecordViewFilter, type RecordViewHeader, type RecordViewHeaderAction, type RecordViewHeaderOptions, type RecordViewListSection, type RecordViewReadinessItem, type RecordViewSection, type RecordViewSettingsSection, type RecordViewSlotSection, type ResolvedColumn, type ResolvedFormField, type ResolvedReadinessItem, type ResolvedRecordViewSection, type ResolvedViewAction, type ResourceTree, type ResourceView, type ResourceWorkspace, type RowImage, RowOf, type RowPicture, type RowSummary, type TimeZoneName, type TreeNode, type TreeOptions, type TreeResult, type ViewAction, type ViewColumn, type ViewCopy, type ViewDefinition, ViewDefinitionError, type ViewField, type ViewFormItem, type ViewGuards, type ViewPreset, type ViewTimeZone, type ViewTone, Viewer, type WorkspaceDefinition, type WorkspaceHeaderAction, type WorkspaceSection, cascadeSelection, defineRecordView, defineView, defineWorkspace, deriveDisplay, initialExpanded, initialsOf, isRecordView, isWorkspace, plural, rowPicture, scopeFilter, scopeValues, setExpanded, singular, treeRows, valueText };
766
+ export { type Allowed, type ComputedColumn, type DisplayHint, type FieldNameOf, type LinkFilter, type LinkedView, type RecordView, type RecordViewDefinition, type RecordViewFilter, type RecordViewHeader, type RecordViewHeaderAction, type RecordViewHeaderOptions, type RecordViewListSection, type RecordViewReadinessItem, type RecordViewSection, type RecordViewSettingsSection, type RecordViewSlotSection, type ResolvedColumn, type ResolvedFormField, type ResolvedLink, type ResolvedReadinessItem, type ResolvedRecordViewSection, type ResolvedViewAction, type ResourceTree, type ResourceView, type ResourceWorkspace, type RowImage, RowOf, type RowPicture, type RowSummary, type TimeZoneName, type TreeNode, type TreeOptions, type TreeResult, type ViewAction, type ViewCalendar, type ViewCalendarLayout, type ViewColumn, type ViewCopy, type ViewDefinition, ViewDefinitionError, type ViewField, type ViewFormItem, type ViewGuards, type ViewLink, type ViewPreset, type ViewTimeZone, type ViewTone, Viewer, type WorkspaceDefinition, type WorkspaceHeaderAction, type WorkspaceSection, calendarProblems, cascadeSelection, defineRecordView, defineView, defineWorkspace, deriveDisplay, filterParams, initialExpanded, initialsOf, isRecordView, isWorkspace, plural, rowPicture, scopeFilter, scopeValues, setExpanded, singular, treeRows, valueText };
@@ -2,11 +2,15 @@ import { readinessOf } from '../chunk-PP3XFFQM.js';
2
2
  import { keyFields, encodeRecordKey } from '../chunk-KV2HW4G4.js';
3
3
  import { NO_VIEWER } from '../chunk-OZYF55E3.js';
4
4
  export { NO_VIEWER } from '../chunk-OZYF55E3.js';
5
- import { isTimeZone } from '../chunk-3B4IFDMK.js';
5
+ import { isTimeZone } from '../chunk-BIIENNTW.js';
6
+ import { isDevelopment, reportError } from '../chunk-37RWGNIO.js';
7
+ import '../chunk-PA6WJE5E.js';
8
+ import '../chunk-HUNGCTRA.js';
6
9
  import { titleCase } from '../chunk-RYEXWQFD.js';
10
+ import '../chunk-LG6TUBVM.js';
7
11
  import { isSafeUrl } from '../chunk-YDDPFSQ6.js';
8
12
 
9
- // src/resource-view/define-view.ts
13
+ // src/resource-view/errors.ts
10
14
  var ViewDefinitionError = class extends Error {
11
15
  problems;
12
16
  constructor(resource, problems) {
@@ -15,6 +19,105 @@ var ViewDefinitionError = class extends Error {
15
19
  this.problems = problems;
16
20
  }
17
21
  };
22
+
23
+ // src/resource-view/scope.ts
24
+ var camel = (key) => key.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
25
+ function scopeValues(view, scope) {
26
+ const out = {};
27
+ const missing = [];
28
+ for (const key of view.definition.scope ?? []) {
29
+ const value = scope && Object.hasOwn(scope, key) ? scope[key] : scope?.[camel(key)];
30
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") out[key] = value;
31
+ else missing.push(key);
32
+ }
33
+ if (missing.length && process.env.NODE_ENV !== "production") {
34
+ throw new ViewDefinitionError(
35
+ view.resource,
36
+ missing.map((key) => `scope "${key}" has no single value in ViewerScope's scope`)
37
+ );
38
+ }
39
+ return Object.freeze(out);
40
+ }
41
+ function scopeFilter(view, scope) {
42
+ const out = {};
43
+ if (!scope) return out;
44
+ for (const key of view.definition.scope ?? []) {
45
+ const value = Object.hasOwn(scope, key) ? scope[key] : scope[camel(key)];
46
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") out[key] = value;
47
+ else if (Array.isArray(value) && value.every((v) => typeof v === "string" || typeof v === "number")) out[key] = value;
48
+ }
49
+ return Object.freeze(out);
50
+ }
51
+
52
+ // src/resource-view/link.ts
53
+ function filterParams(filter) {
54
+ return Object.entries(filter ?? {}).map(
55
+ ([field, value]) => value === null ? { field, operator: "is_null" } : Array.isArray(value) ? { field, operator: "in", value: [...value] } : { field, operator: "eq", value }
56
+ );
57
+ }
58
+ function linkProblems(name, link, reference) {
59
+ if (link === void 0) return [];
60
+ const where = `fields.${name}.link`;
61
+ if (!reference) return [`${where} is set, but "${name}" isn't a link`];
62
+ if (!link || typeof link !== "object" || Array.isArray(link)) return [`${where} isn't an object`];
63
+ const l = link;
64
+ const problems = [];
65
+ if (l.view !== void 0 && typeof l.view !== "function") problems.push(...linkedViewProblems(where, l.view, reference, l.preset));
66
+ else if (l.view === void 0 && l.preset !== void 0) problems.push(`${where}.preset needs a view`);
67
+ if (l.preset !== void 0 && typeof l.preset !== "string") problems.push(`${where}.preset isn't a preset name`);
68
+ if (l.filter !== void 0 && typeof l.filter !== "function" && (!l.filter || typeof l.filter !== "object" || Array.isArray(l.filter))) {
69
+ problems.push(`${where}.filter isn't a filter or a function`);
70
+ }
71
+ if (l.searchFields !== void 0 && (!Array.isArray(l.searchFields) || l.searchFields.some((f) => typeof f !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(f)))) {
72
+ problems.push(`${where}.searchFields isn't a list of field names`);
73
+ }
74
+ return problems;
75
+ }
76
+ function linkedViewProblems(where, view, reference, preset) {
77
+ const v = view;
78
+ if (!v || typeof v !== "object" || typeof v.resource !== "string") return [`${where}.view isn't a view`];
79
+ if (v.resource !== reference.resource) return [`${where}.view is a view of "${v.resource}", but the link points at "${reference.resource}"`];
80
+ if (preset !== void 0 && !Object.hasOwn(v.definition.presets ?? {}, preset)) {
81
+ return [`${where}.preset "${preset}" isn't one of ${v.resource}'s presets`];
82
+ }
83
+ return [];
84
+ }
85
+ function resolveLink(owner, name, reference, link, labelField) {
86
+ let linked;
87
+ let read = false;
88
+ const linkedView = () => {
89
+ if (read) return linked;
90
+ read = true;
91
+ linked = typeof link?.view === "function" ? link.view() : link?.view;
92
+ if (linked && typeof link?.view === "function") {
93
+ const problems = linkedViewProblems(`fields.${name}.link`, linked, reference, link.preset);
94
+ if (problems.length) {
95
+ const error = new ViewDefinitionError(owner, problems);
96
+ if (isDevelopment()) throw error;
97
+ reportError(error, { source: "core:resource-view-link", tags: { resource: owner } });
98
+ linked = void 0;
99
+ }
100
+ }
101
+ return linked;
102
+ };
103
+ return Object.freeze({
104
+ resource: reference.resource,
105
+ field: reference.field,
106
+ // Read when asked: a view given as a function may not exist yet while this one is defined.
107
+ get labelField() {
108
+ return labelField ?? linkedView()?.labelField;
109
+ },
110
+ ...link?.searchFields ? { searchFields: Object.freeze([...link.searchFields]) } : {},
111
+ filters(scope, values = {}) {
112
+ const view = linkedView();
113
+ const preset = view ? view.definition.presets?.[link?.preset ?? "default"]?.filter : void 0;
114
+ const own2 = typeof link?.filter === "function" ? link.filter(values) : link?.filter;
115
+ return filterParams({ ...view ? scopeFilter(view, scope) : {}, ...preset, ...own2 });
116
+ }
117
+ });
118
+ }
119
+
120
+ // src/resource-view/define-view.ts
18
121
  function deriveDisplay(field) {
19
122
  if (field.references) return "relation";
20
123
  switch (field.widget) {
@@ -83,6 +186,28 @@ function valueText(labels, value) {
83
186
  const key = String(value);
84
187
  return own(labels, key) ?? titleCase(key);
85
188
  }
189
+ function calendarProblems(fields, calendar) {
190
+ const problems = [];
191
+ const byName = new Map(fields.map((f) => [f.name, f]));
192
+ const typed = (name, where, type) => {
193
+ if (name === void 0) return;
194
+ const f = byName.get(name);
195
+ if (!f) problems.push(`${where} names "${name}", which isn't a field`);
196
+ else if (f.type !== type || f.array) problems.push(`${where} "${name}" isn't a ${type === "datetime" ? "date or timestamp" : "yes/no"} field`);
197
+ };
198
+ typed(calendar.field, "calendar.field", "datetime");
199
+ typed(calendar.endField, "calendar.endField", "datetime");
200
+ typed(calendar.allDayField, "calendar.allDayField", "boolean");
201
+ if (calendar.laneBy !== void 0 && !byName.has(calendar.laneBy)) problems.push(`calendar.laneBy names "${calendar.laneBy}", which isn't a field`);
202
+ if (calendar.layout !== void 0 && !["month", "weeks", "agenda", "lanes"].includes(calendar.layout)) {
203
+ problems.push(`calendar.layout "${String(calendar.layout)}" isn't month, weeks, agenda or lanes`);
204
+ }
205
+ if (calendar.weeks !== void 0 && ![1, 2, 3, 4].includes(calendar.weeks)) problems.push(`calendar.weeks is 1 to 4, not ${String(calendar.weeks)}`);
206
+ if (calendar.weekStartsOn !== void 0 && calendar.weekStartsOn !== 0 && calendar.weekStartsOn !== 1) {
207
+ problems.push(`calendar.weekStartsOn is 0 (Sunday) or 1 (Monday), not ${String(calendar.weekStartsOn)}`);
208
+ }
209
+ return problems;
210
+ }
86
211
  function defineView(contract, definition = {}) {
87
212
  const facts = contract;
88
213
  const fields = contract.fields;
@@ -155,6 +280,8 @@ function defineView(contract, definition = {}) {
155
280
  if (typeof v.missingLabel !== "string" || !v.missingLabel.trim()) problems.push(`fields.${name}.missingLabel isn't text`);
156
281
  else if (!byName.get(name)?.references) problems.push(`fields.${name}.missingLabel is set, but "${name}" isn't a link`);
157
282
  }
283
+ for (const [name, v] of Object.entries(viewFields)) problems.push(...linkProblems(name, v?.link, byName.get(name)?.references));
284
+ if (definition.editLinks !== void 0 && typeof definition.editLinks !== "boolean") problems.push("editLinks isn't true or false");
158
285
  for (const [name, v] of Object.entries(viewFields)) {
159
286
  if (v?.labelField === void 0) continue;
160
287
  if (typeof v.labelField !== "string" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(v.labelField)) {
@@ -183,6 +310,8 @@ function defineView(contract, definition = {}) {
183
310
  }
184
311
  for (const name of scope) known(name, "scope");
185
312
  if (definition.groupBy) known(definition.groupBy, "groupBy");
313
+ const calendar = definition.calendar ? Object.freeze({ ...definition.calendar }) : void 0;
314
+ if (calendar) problems.push(...calendarProblems(fields, calendar));
186
315
  if (definition.orderBy) known(definition.orderBy.field, "orderBy");
187
316
  for (const [name, preset] of Object.entries(presets)) {
188
317
  if (preset.columns && preset.columns !== "default" && !own(columnLists, preset.columns)) {
@@ -226,10 +355,13 @@ function defineView(contract, definition = {}) {
226
355
  };
227
356
  const valueLabel = (name, value) => valueText(own(viewFields, name)?.labels, value);
228
357
  const readable = (name) => byName.get(name)?.permissions?.read !== false;
358
+ const editLinks = definition.editLinks === true;
359
+ const linkEditable = (f) => Boolean(f.references) && (editLinks || own(viewFields, f.name)?.link !== void 0);
229
360
  const readOnly = (field) => Boolean(
230
- field.generated || field.readOnly || field.references || field.permissions?.update === false || own(viewFields, field.name)?.readOnly
361
+ field.generated || field.readOnly || field.references && !linkEditable(field) || field.permissions?.update === false || own(viewFields, field.name)?.readOnly
231
362
  );
232
363
  const quiet = (f) => keys.has(f.name) || scope.has(f.name) || Boolean(f.sensitive) || Boolean(f.references);
364
+ const neededLink = (f) => linkEditable(f) && !f.nullable && !f.optional && !f.hasDefault && !scope.has(f.name);
233
365
  const defaultColumns = own(columnLists, "default") ?? fields.filter((f) => !quiet(f)).map((f) => f.name);
234
366
  const presetNames = Object.freeze(["default", ...Object.keys(columnLists).filter((p) => p !== "default")]);
235
367
  const resolvedColumns = /* @__PURE__ */ new Map();
@@ -262,9 +394,14 @@ function defineView(contract, definition = {}) {
262
394
  resolvedColumns.set(preset, out);
263
395
  return out;
264
396
  };
397
+ const links = new Map(
398
+ fields.filter((f) => linkEditable(f)).map((f) => [f.name, resolveLink(contract.name, f.name, f.references, own(viewFields, f.name)?.link, own(viewFields, f.name)?.labelField)])
399
+ );
265
400
  const placed = definition.form ? formItems.flatMap(
266
401
  (item) => typeof item === "string" ? [{ name: item, section: null, sectionTitle: null }] : item.fields.map((name) => ({ name, section: item.section, sectionTitle: item.title ?? titleCase(item.section) }))
267
- ) : fields.filter((f) => !readOnly(f) && (!quiet(f) || keys.has(f.name) && !f.hasDefault && !f.sensitive) && f.type !== "json" && !f.array).map((f) => ({ name: f.name, section: null, sectionTitle: null }));
402
+ ) : fields.filter(
403
+ (f) => !readOnly(f) && (!quiet(f) || keys.has(f.name) && !f.hasDefault && !f.sensitive || neededLink(f) && !f.sensitive) && f.type !== "json" && !f.array
404
+ ).map((f) => ({ name: f.name, section: null, sectionTitle: null }));
268
405
  const serverKey = (f, mode) => keys.has(f.name) && (mode === "edit" || Boolean(f.hasDefault));
269
406
  const resolvedForms = /* @__PURE__ */ new Map();
270
407
  const form = (mode) => {
@@ -283,9 +420,13 @@ function defineView(contract, definition = {}) {
283
420
  section,
284
421
  sectionTitle,
285
422
  ...v?.max !== void 0 ? { max: v.max } : {},
423
+ ...v?.autoComplete ? { autoComplete: v.autoComplete } : {},
424
+ ...v?.inputMode ? { inputMode: v.inputMode } : {},
425
+ ...v?.enterKeyHint ? { enterKeyHint: v.enterKeyHint } : {},
286
426
  ...v?.labelField ? { labelField: v.labelField } : {},
287
427
  ...v?.missingLabel ? { missingLabel: v.missingLabel } : {},
288
428
  ...field.enumValues?.length ? { options: Object.freeze(field.enumValues.map((value) => Object.freeze({ value, label: valueLabel(name, value) }))) } : {},
429
+ ...links.has(name) ? { link: links.get(name) } : {},
289
430
  ...v?.visible ? { visible: v.visible } : {}
290
431
  });
291
432
  }));
@@ -335,7 +476,8 @@ function defineView(contract, definition = {}) {
335
476
  presets,
336
477
  ...definition.form ? { form: formItems } : {},
337
478
  ...definition.scope ? { scope: Object.freeze([...definition.scope]) } : {},
338
- ...definition.actions ? { actions: actionList } : {}
479
+ ...definition.actions ? { actions: actionList } : {},
480
+ ...calendar ? { calendar } : {}
339
481
  }),
340
482
  resource: contract.name,
341
483
  noun,
@@ -386,35 +528,6 @@ function rowPicture(summary) {
386
528
  return initials ? { kind: "initials", text: initials } : null;
387
529
  }
388
530
 
389
- // src/resource-view/scope.ts
390
- var camel = (key) => key.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
391
- function scopeValues(view, scope) {
392
- const out = {};
393
- const missing = [];
394
- for (const key of view.definition.scope ?? []) {
395
- const value = scope && Object.hasOwn(scope, key) ? scope[key] : scope?.[camel(key)];
396
- if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") out[key] = value;
397
- else missing.push(key);
398
- }
399
- if (missing.length && process.env.NODE_ENV !== "production") {
400
- throw new ViewDefinitionError(
401
- view.resource,
402
- missing.map((key) => `scope "${key}" has no single value in ViewerScope's scope`)
403
- );
404
- }
405
- return Object.freeze(out);
406
- }
407
- function scopeFilter(view, scope) {
408
- const out = {};
409
- if (!scope) return out;
410
- for (const key of view.definition.scope ?? []) {
411
- const value = Object.hasOwn(scope, key) ? scope[key] : scope[camel(key)];
412
- if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") out[key] = value;
413
- else if (Array.isArray(value) && value.every((v) => typeof v === "string" || typeof v === "number")) out[key] = value;
414
- }
415
- return Object.freeze(out);
416
- }
417
-
418
531
  // src/resource-view/tree.ts
419
532
  var rootish = (parent) => parent == null || parent === "";
420
533
  function treeRows(rows, options) {
@@ -738,6 +851,6 @@ function defineRecordView(view, definition) {
738
851
  var defineWorkspace = defineRecordView;
739
852
  var isWorkspace = isRecordView;
740
853
 
741
- export { ViewDefinitionError, cascadeSelection, defineRecordView, defineView, defineWorkspace, deriveDisplay, initialExpanded, initialsOf, isRecordView, isWorkspace, plural, rowPicture, scopeFilter, scopeValues, setExpanded, singular, treeRows, valueText };
854
+ export { ViewDefinitionError, calendarProblems, cascadeSelection, defineRecordView, defineView, defineWorkspace, deriveDisplay, filterParams, initialExpanded, initialsOf, isRecordView, isWorkspace, plural, rowPicture, scopeFilter, scopeValues, setExpanded, singular, treeRows, valueText };
742
855
  //# sourceMappingURL=index.js.map
743
856
  //# sourceMappingURL=index.js.map