@marktiderman/genesis-ui-native 3.3.0 → 3.4.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.
@@ -4,7 +4,7 @@ import { ResourceFormFieldDef, BaseRecord, DataRow, FieldReference, ResourceCont
4
4
  import { Control, UseFormReturn } from 'react-hook-form';
5
5
  import { UseResourceOptions } from '@marktiderman/genesis-core/hooks';
6
6
  import { d as InboxSwipeAction, c as InboxPageSlotMap, g as ScreenHeaderProps } from '../inbox-page-DZUR-PJ1.js';
7
- import { ResourceView, DisplayHint, Allowed, RowSummary, RowPicture, Viewer, ResolvedColumn, RecordView } from '@marktiderman/genesis-core/resource-view';
7
+ import { ResourceView, DisplayHint, ResolvedFormField, ResolvedLink, Allowed, RowSummary, RowPicture, Viewer, ResolvedColumn, RecordView } from '@marktiderman/genesis-core/resource-view';
8
8
  import { ReadinessLabels } from '@marktiderman/genesis-core/resource';
9
9
  import '@marktiderman/genesis-core/slots';
10
10
  import 'react-native';
@@ -191,6 +191,22 @@ interface NativeResourceViewMessages {
191
191
  clear: string;
192
192
  loading: string;
193
193
  };
194
+ /**
195
+ * A link's picker in the form sheet. Optional, so a catalogue written before it still fits; the
196
+ * English is used for what's missing.
197
+ */
198
+ link?: {
199
+ /** The picker with nothing chosen. */
200
+ placeholder?: string;
201
+ search?: string;
202
+ /** The choice that empties an optional link. */
203
+ none?: string;
204
+ noResults?: string;
205
+ loadMore?: string;
206
+ loadFailed?: string;
207
+ /** A row whose name is empty (never its raw id). */
208
+ untitled?: string;
209
+ };
194
210
  refusal: {
195
211
  /** `{noun}`. A delete failed with no message of its own. */
196
212
  deleteFailed: string;
@@ -265,7 +281,9 @@ interface SwipeActionOptions<T> {
265
281
  */
266
282
  declare function swipeActionsFor<T extends Row$3>(view: AnyResourceView<T>, row: T, options: SwipeActionOptions<T>): NativeResourceSwipeAction[];
267
283
  /** How a form field is drawn. */
268
- type NativeFormFieldKind = "text" | "email" | "url" | "number" | "textarea" | "switch" | "segmented" | "select" | "date" | "datetime";
284
+ type NativeFormFieldKind = "text" | "email" | "tel" | "url" | "number" | "textarea" | "switch" | "segmented" | "select" | "date" | "datetime"
285
+ /** A link: a searchable list of the linked rows, through the provider. */
286
+ | "link";
269
287
  interface NativeFormField {
270
288
  key: string;
271
289
  label: string;
@@ -279,12 +297,20 @@ interface NativeFormField {
279
297
  /** From the contract: the column has a default (or is generated). */
280
298
  hasDefault?: boolean;
281
299
  max?: number;
300
+ /** The view field's autofill token (`ViewField.autoComplete`); unset, none is passed. */
301
+ autoComplete?: string;
302
+ /** The keyboard (`ViewField.inputMode`), over the kind's own. */
303
+ inputMode?: ResolvedFormField["inputMode"];
304
+ /** The Return key's label (`ViewField.enterKeyHint`). */
305
+ enterKeyHint?: ResolvedFormField["enterKeyHint"];
282
306
  options?: {
283
307
  value: string;
284
308
  label: string;
285
309
  }[];
286
310
  /** For a link: what it points at and the linked row's naming field, so it shows the row's words. */
287
311
  references?: FieldReference;
312
+ /** For a link the person can change: how its picker lists the linked rows (`ResolvedFormField.link`). */
313
+ link?: ResolvedLink;
288
314
  labelField?: string;
289
315
  missingLabel?: string;
290
316
  /** The heading it sits under; null for the form's first, untitled group. */
@@ -293,12 +319,23 @@ interface NativeFormField {
293
319
  visible?: (values: Readonly<Record<string, unknown>>) => boolean;
294
320
  }
295
321
  /**
296
- * The form sheet's fields: `view.form(mode)` (which already leaves out JSON, lists, links, scope,
322
+ * The form sheet's fields: `view.form(mode)` (which already leaves out JSON, lists, scope,
297
323
  * sensitive and unreadable fields and server-filled keys), each marked read-only unless
298
- * `view.writable(mode)` lists it. Copied, never mutated: core caches and freezes `form()`. A create leaves read-only fields out (there is nothing to show yet); an edit shows
324
+ * `view.writable(mode)` lists it. A link the person can change is a picker (`kind: "link"`). Copied, never mutated: core caches and freezes `form()`. A create leaves read-only fields out (there is nothing to show yet); an edit shows
299
325
  * them as text.
300
326
  */
301
- declare function formFieldsFor<T extends Row$3>(view: AnyResourceView<T>, mode: "create" | "edit"): NativeFormField[];
327
+ declare function formFieldsFor<T extends Row$3>(view: AnyResourceView<T>, mode: "create" | "edit", options?: {
328
+ /**
329
+ * Fields the screen's filter fixes. A link among them stays read-only: the list is that
330
+ * record's (a client's sessions), and a picker would move the row out of it (as on the web).
331
+ */
332
+ pinned?: Iterable<string>;
333
+ /**
334
+ * Lists the screen's filter holds fields to (`{ owner_id: ["a", "b"] }`). A link among them
335
+ * picks only among those rows, so a save never moves the row out of the list.
336
+ */
337
+ within?: Readonly<Record<string, readonly (string | number)[]>>;
338
+ }): NativeFormField[];
302
339
  /**
303
340
  * What a save sends: only the keys `view.writable(mode)` lists and the form shows. Read-only,
304
341
  * generated, key and scope fields, and anything else the values carry (joined columns), never go.
@@ -12,10 +12,10 @@ import { createContext, memo, useState, useCallback, useMemo, useEffect, useCont
12
12
  import { SafeAreaView } from 'react-native-safe-area-context';
13
13
  import { titleCase, useResourceForm, resourceKeys, useDataProvider, useViewer as useViewer$1, encodeRecordKey, useCapabilities as useCapabilities$1, DataWriteError } from '@marktiderman/genesis-core';
14
14
  import { Controller, useForm } from 'react-hook-form';
15
- import { useRelationLabel, useResource, useViewer, useInfiniteResource, useCapabilities, useOptionalViewerScope, scopeClock, useOne } from '@marktiderman/genesis-core/hooks';
15
+ import { useRelationLabel, useResource, useViewer, useInfiniteResource, useCapabilities, useOptionalViewerScope, scopeClock, useOne, useLinkOptions } from '@marktiderman/genesis-core/hooks';
16
16
  import { personTimeZone, isTimeZone, wallClock } from '@marktiderman/genesis-core/dates';
17
17
  import { isSafeUrl } from '@marktiderman/genesis-core/urls';
18
- import { valueText, rowPicture } from '@marktiderman/genesis-core/resource-view';
18
+ import { valueText, rowPicture, filterParams as filterParams$1 } from '@marktiderman/genesis-core/resource-view';
19
19
  import { useQueryClient, useQuery } from '@tanstack/react-query';
20
20
  import { readinessChip } from '@marktiderman/genesis-core/resource';
21
21
 
@@ -235,12 +235,14 @@ function NativeDetailPanel({
235
235
  var KEYBOARD_TYPE_MAP = {
236
236
  email: "email-address",
237
237
  url: "url",
238
+ tel: "phone-pad",
238
239
  text: "default",
239
240
  date: "default"
240
241
  };
241
242
  var AUTO_CAPITALIZE_MAP = {
242
243
  email: "none",
243
244
  url: "none",
245
+ tel: "none",
244
246
  text: "sentences",
245
247
  date: "none"
246
248
  };
@@ -392,6 +394,9 @@ function NativeResourceFormFieldRenderer({
392
394
  placeholder: field.placeholder,
393
395
  keyboardType: KEYBOARD_TYPE_MAP[fieldType] ?? "default",
394
396
  autoCapitalize: AUTO_CAPITALIZE_MAP[fieldType] ?? "sentences",
397
+ ...field.autoComplete ? { autoComplete: field.autoComplete } : {},
398
+ ...field.inputMode ? { inputMode: field.inputMode } : {},
399
+ ...field.enterKeyHint ? { enterKeyHint: field.enterKeyHint } : {},
395
400
  value: f.value != null ? String(f.value) : "",
396
401
  onChangeText: f.onChange,
397
402
  editable: !isDisabled,
@@ -844,6 +849,15 @@ var defaultNativeResourceViewMessages = {
844
849
  clear: "Clear {label}",
845
850
  loading: "Loading"
846
851
  },
852
+ link: {
853
+ placeholder: "Choose\u2026",
854
+ search: "Search",
855
+ none: "None",
856
+ noResults: "No matches",
857
+ loadMore: "Show more",
858
+ loadFailed: "Couldn't load the choices.",
859
+ untitled: "Untitled"
860
+ },
847
861
  refusal: {
848
862
  deleteFailed: "This {noun} couldn't be deleted. Try again.",
849
863
  dismiss: "Dismiss"
@@ -1087,8 +1101,9 @@ function swipeActionsFor(view, row, options) {
1087
1101
  return actions;
1088
1102
  }
1089
1103
  var SEGMENTED_MAX = 4;
1090
- function kindFor(display, options) {
1104
+ function kindFor(display, options, widget) {
1091
1105
  if (options) return options.length <= SEGMENTED_MAX ? "segmented" : "select";
1106
+ if (widget === "tel" && display === "text") return "tel";
1092
1107
  switch (display) {
1093
1108
  case "boolean":
1094
1109
  return "switch";
@@ -1111,23 +1126,43 @@ function kindFor(display, options) {
1111
1126
  return "text";
1112
1127
  }
1113
1128
  }
1114
- function formFieldsFor(view, mode) {
1115
- const writable = new Set(view.writable(mode));
1129
+ function heldTo(link, keys) {
1130
+ if (!keys) return link;
1131
+ const held = { field: link.field, operator: "in", value: [...keys] };
1132
+ return Object.freeze({
1133
+ resource: link.resource,
1134
+ field: link.field,
1135
+ get labelField() {
1136
+ return link.labelField;
1137
+ },
1138
+ ...link.searchFields ? { searchFields: link.searchFields } : {},
1139
+ filters: (scope, values) => [...link.filters(scope, values), held]
1140
+ });
1141
+ }
1142
+ function formFieldsFor(view, mode, options = {}) {
1143
+ const pinned = new Set(options.pinned ?? []);
1144
+ const within = options.within ?? {};
1145
+ const writable = new Set([...view.writable(mode)].filter((name) => !(pinned.has(name) && view.field(name)?.references)));
1116
1146
  return view.form(mode).filter((f) => f.display !== "json" && !f.field.array).filter((f) => mode === "edit" || writable.has(f.field.name)).map((f) => {
1117
- const options = f.options?.map((o) => ({ value: o.value, label: o.label }));
1147
+ const options2 = f.options?.map((o) => ({ value: o.value, label: o.label }));
1118
1148
  const readOnly = !writable.has(f.field.name);
1149
+ const link = !readOnly && !options2 && f.link ? heldTo(f.link, Object.hasOwn(within, f.field.name) ? within[f.field.name] : void 0) : void 0;
1119
1150
  return {
1120
1151
  key: f.field.name,
1121
1152
  label: f.label,
1122
- kind: kindFor(f.display, options),
1153
+ kind: link ? "link" : kindFor(f.display, options2, f.field.widget),
1123
1154
  display: f.display,
1124
1155
  required: !readOnly && f.required,
1125
1156
  readOnly,
1126
1157
  ...typeof f.field.nullable === "boolean" ? { nullable: f.field.nullable } : {},
1127
1158
  ...f.field.hasDefault || f.field.generated ? { hasDefault: true } : {},
1128
1159
  ...f.max !== void 0 ? { max: f.max } : {},
1129
- ...options ? { options } : {},
1160
+ ...f.autoComplete ? { autoComplete: f.autoComplete } : {},
1161
+ ...f.inputMode ? { inputMode: f.inputMode } : {},
1162
+ ...f.enterKeyHint ? { enterKeyHint: f.enterKeyHint } : {},
1163
+ ...options2 ? { options: options2 } : {},
1130
1164
  ...f.field.references ? { references: f.field.references } : {},
1165
+ ...link ? { link } : {},
1131
1166
  ...f.labelField ? { labelField: f.labelField } : {},
1132
1167
  ...f.missingLabel ? { missingLabel: f.missingLabel } : {},
1133
1168
  section: f.section,
@@ -1181,9 +1216,131 @@ function refusalFields(error) {
1181
1216
  }
1182
1217
  return {};
1183
1218
  }
1219
+ var SEARCH_DEBOUNCE_MS = 300;
1220
+ function NativeLinkPicker({ field, value, onChange, values, error, testID }) {
1221
+ const messages = useNativeResourceViewMessages();
1222
+ const words = { ...defaultNativeResourceViewMessages.link, ...messages.link };
1223
+ const link = field.link;
1224
+ const viewer = useViewer();
1225
+ const [open, setOpen] = useState(false);
1226
+ const [query, setQuery] = useState("");
1227
+ const [search, setSearch] = useState("");
1228
+ useEffect(() => {
1229
+ const timer = setTimeout(() => setSearch(query), SEARCH_DEBOUNCE_MS);
1230
+ return () => clearTimeout(timer);
1231
+ }, [query]);
1232
+ const filtersKey = JSON.stringify(link.filters(viewer.scope, values));
1233
+ const filters = useMemo(() => JSON.parse(filtersKey), [filtersKey]);
1234
+ const labelField = field.labelField ?? link.labelField;
1235
+ const list = useLinkOptions(
1236
+ { resource: link.resource, field: link.field, labelField, searchFields: link.searchFields },
1237
+ { filters, search, enabled: open, untitled: words.untitled }
1238
+ );
1239
+ const loaded = isEmptyValue(value) ? void 0 : list.options.find((o) => String(o.value) === String(value));
1240
+ const looked = useRelationLabel({ resource: link.resource, field: link.field }, value, {
1241
+ ...list.labelField ?? labelField ? { labelField: list.labelField ?? labelField } : {},
1242
+ enabled: !isEmptyValue(value) && !loaded
1243
+ });
1244
+ const chosen = isEmptyValue(value) ? null : loaded?.label ?? (looked === void 0 ? void 0 : looked ?? field.missingLabel ?? messages.common.hiddenLink ?? defaultNativeResourceViewMessages.common.hiddenLink);
1245
+ const shown = chosen === void 0 ? messages.common.empty : chosen ?? words.placeholder;
1246
+ const pick = (next) => {
1247
+ onChange(next);
1248
+ setOpen(false);
1249
+ setQuery("");
1250
+ };
1251
+ return /* @__PURE__ */ jsxs(View, { testID, style: { gap: 6 }, children: [
1252
+ /* @__PURE__ */ jsx(NativeLabel, { children: field.label }),
1253
+ /* @__PURE__ */ jsxs(
1254
+ Pressable,
1255
+ {
1256
+ testID: `${testID}-trigger`,
1257
+ accessibilityRole: "button",
1258
+ accessibilityLabel: error ? `${field.label}, ${shown}, ${error}` : `${field.label}, ${shown}`,
1259
+ accessibilityState: { expanded: open },
1260
+ onPress: () => setOpen((was) => !was),
1261
+ className: "min-h-[44px] flex-row items-center justify-between rounded-md border border-input bg-background px-3",
1262
+ children: [
1263
+ /* @__PURE__ */ jsx(Text, { className: chosen ? "text-base text-foreground" : "text-base text-muted-foreground", numberOfLines: 1, children: shown }),
1264
+ /* @__PURE__ */ jsx(Text, { className: "text-muted-foreground", accessible: false, children: open ? "\u25B4" : "\u25BE" })
1265
+ ]
1266
+ }
1267
+ ),
1268
+ open ? /* @__PURE__ */ jsxs(View, { testID: `${testID}-list`, style: { gap: 4 }, accessibilityRole: "radiogroup", accessibilityLabel: field.label, children: [
1269
+ list.searchable ? /* @__PURE__ */ jsx(
1270
+ NativeSearchBar,
1271
+ {
1272
+ testID: `${testID}-search`,
1273
+ value: query,
1274
+ onChange: setQuery,
1275
+ placeholder: words.search,
1276
+ showCancel: false
1277
+ }
1278
+ ) : null,
1279
+ !field.required && query === "" ? /* @__PURE__ */ jsx(
1280
+ Option,
1281
+ {
1282
+ testID: `${testID}-none`,
1283
+ label: words.none,
1284
+ muted: true,
1285
+ selected: isEmptyValue(value),
1286
+ onPress: () => pick(null)
1287
+ }
1288
+ ) : null,
1289
+ list.isLoading ? /* @__PURE__ */ jsx(NativeText, { preset: "caption", className: "px-3 py-2 text-muted-foreground", testID: `${testID}-loading`, children: messages.form.loading }) : list.isError ? /* @__PURE__ */ jsx(NativeText, { preset: "caption", className: "px-3 py-2 text-destructive", accessibilityRole: "alert", children: words.loadFailed }) : list.options.length === 0 ? /* @__PURE__ */ jsx(NativeText, { preset: "caption", className: "px-3 py-2 text-muted-foreground", testID: `${testID}-empty`, children: words.noResults }) : list.options.map((option) => /* @__PURE__ */ jsx(
1290
+ Option,
1291
+ {
1292
+ testID: `${testID}-option-${String(option.value)}`,
1293
+ label: option.label,
1294
+ selected: !isEmptyValue(value) && String(value) === String(option.value),
1295
+ onPress: () => pick(option.value)
1296
+ },
1297
+ String(option.value)
1298
+ )),
1299
+ list.hasMore ? /* @__PURE__ */ jsx(
1300
+ NativeButton,
1301
+ {
1302
+ variant: "ghost",
1303
+ size: "sm",
1304
+ testID: `${testID}-more`,
1305
+ disabled: list.isLoadingMore,
1306
+ onPress: list.loadMore,
1307
+ children: list.isLoadingMore ? messages.list.loadingMore : words.loadMore
1308
+ }
1309
+ ) : null
1310
+ ] }) : null,
1311
+ error ? (
1312
+ // A live region on Android; the alert role on iOS and the web.
1313
+ /* @__PURE__ */ jsx(View, { accessibilityLiveRegion: "polite", children: /* @__PURE__ */ jsx(NativeText, { preset: "caption", className: "text-destructive", testID: `${testID}-error`, accessibilityRole: "alert", children: error }) })
1314
+ ) : null
1315
+ ] });
1316
+ }
1317
+ function Option({
1318
+ label,
1319
+ selected,
1320
+ muted = false,
1321
+ onPress,
1322
+ testID
1323
+ }) {
1324
+ return /* @__PURE__ */ jsxs(
1325
+ Pressable,
1326
+ {
1327
+ testID,
1328
+ accessibilityRole: "radio",
1329
+ accessibilityLabel: label,
1330
+ accessibilityState: { checked: selected },
1331
+ onPress,
1332
+ className: "min-h-[44px] flex-row items-center justify-between px-3",
1333
+ children: [
1334
+ /* @__PURE__ */ jsx(Text, { className: muted ? "text-base text-muted-foreground" : "text-base text-foreground", children: label }),
1335
+ selected ? /* @__PURE__ */ jsx(Text, { className: "text-base text-primary", accessible: false, children: "\u2713" }) : null
1336
+ ]
1337
+ }
1338
+ );
1339
+ }
1184
1340
  var FIELD_TYPE = {
1185
1341
  text: "text",
1186
1342
  email: "email",
1343
+ tel: "tel",
1187
1344
  url: "url",
1188
1345
  number: "number",
1189
1346
  textarea: "textarea",
@@ -1322,6 +1479,26 @@ function FormField({
1322
1479
  /* @__PURE__ */ jsx(NativeText, { testID: `${id}-value`, preset: "body", className: "text-muted-foreground", children: shown })
1323
1480
  ] });
1324
1481
  }
1482
+ if (field.kind === "link" && field.link) {
1483
+ return /* @__PURE__ */ jsx(
1484
+ Controller,
1485
+ {
1486
+ name: field.key,
1487
+ control: f.control,
1488
+ render: ({ field: input }) => /* @__PURE__ */ jsx(
1489
+ NativeLinkPicker,
1490
+ {
1491
+ field,
1492
+ value: input.value,
1493
+ onChange: input.onChange,
1494
+ values: f.getValues(),
1495
+ error,
1496
+ testID: id
1497
+ }
1498
+ )
1499
+ }
1500
+ );
1501
+ }
1325
1502
  const type = FIELD_TYPE[field.kind];
1326
1503
  if (type) {
1327
1504
  const def = {
@@ -1330,7 +1507,10 @@ function FormField({
1330
1507
  type,
1331
1508
  required: field.required,
1332
1509
  ...field.options ? { options: field.options } : {},
1333
- ...field.max !== void 0 ? { maxLength: field.max } : {}
1510
+ ...field.max !== void 0 ? { maxLength: field.max } : {},
1511
+ ...field.autoComplete ? { autoComplete: field.autoComplete } : {},
1512
+ ...field.inputMode ? { inputMode: field.inputMode } : {},
1513
+ ...field.enterKeyHint ? { enterKeyHint: field.enterKeyHint } : {}
1334
1514
  };
1335
1515
  return /* @__PURE__ */ jsx(View, { testID: id, children: /* @__PURE__ */ jsx(NativeResourceFormFieldRenderer, { field: def, control: f.control, action: m }) });
1336
1516
  }
@@ -1394,11 +1574,9 @@ function DateField({
1394
1574
  clearable ? /* @__PURE__ */ jsx(NativeButton, { variant: "ghost", size: "sm", testID: `${testID}-clear`, onPress: () => onChange(null), children: fill(messages.form.clear, { label: label.toLowerCase() }) }) : null
1395
1575
  ] });
1396
1576
  }
1397
- var SEARCH_DEBOUNCE_MS = 300;
1577
+ var SEARCH_DEBOUNCE_MS2 = 300;
1398
1578
  function filterParams(filter) {
1399
- return Object.entries(filter ?? {}).map(
1400
- ([field, value]) => value === null ? { field, operator: "is_null" } : Array.isArray(value) ? { field, operator: "in", value: [...value] } : { field, operator: "eq", value }
1401
- );
1579
+ return filterParams$1(filter);
1402
1580
  }
1403
1581
  function screenValues(...filters) {
1404
1582
  const out = {};
@@ -1409,6 +1587,16 @@ function screenValues(...filters) {
1409
1587
  }
1410
1588
  return out;
1411
1589
  }
1590
+ function screenLists(...filters) {
1591
+ const out = {};
1592
+ for (const filter of filters) {
1593
+ for (const [field, value] of Object.entries(filter ?? {})) {
1594
+ if (Array.isArray(value)) out[field] = [...value];
1595
+ else delete out[field];
1596
+ }
1597
+ }
1598
+ return out;
1599
+ }
1412
1600
  var DEFAULT_MAX_PAGES = 10;
1413
1601
  function serverSorts(view) {
1414
1602
  const groupBy = view.definition.groupBy;
@@ -1434,6 +1622,8 @@ function useNativeResourceView(view, options = {}) {
1434
1622
  );
1435
1623
  const createKey = JSON.stringify(screenValues(tabFilter, filter));
1436
1624
  const createDefaults = useMemo(() => JSON.parse(createKey), [createKey]);
1625
+ const listKey = JSON.stringify(screenLists(tabFilter, filter));
1626
+ const within = useMemo(() => JSON.parse(listKey), [listKey]);
1437
1627
  const sorts = useMemo(() => serverSorts(view), [view]);
1438
1628
  const searchFields = useMemo(
1439
1629
  () => searchOption ?? (view.labelField ? [view.labelField] : void 0),
@@ -1455,7 +1645,7 @@ function useNativeResourceView(view, options = {}) {
1455
1645
  (text2) => {
1456
1646
  setSearchText(text2);
1457
1647
  if (timer.current) clearTimeout(timer.current);
1458
- timer.current = setTimeout(() => sendSearch(text2), SEARCH_DEBOUNCE_MS);
1648
+ timer.current = setTimeout(() => sendSearch(text2), SEARCH_DEBOUNCE_MS2);
1459
1649
  },
1460
1650
  [sendSearch]
1461
1651
  );
@@ -1475,8 +1665,8 @@ function useNativeResourceView(view, options = {}) {
1475
1665
  const capabilities = useCapabilities(view.resource);
1476
1666
  const softDelete = capabilities.data?.softDelete === true;
1477
1667
  const formFields = useCallback(
1478
- (mode) => mode === "create" ? formFieldsFor(view, "create").filter((f) => !(f.key in createDefaults)) : formFieldsFor(view, "edit"),
1479
- [view, createDefaults]
1668
+ (mode) => mode === "create" ? formFieldsFor(view, "create", { within }).filter((f) => !(f.key in createDefaults)) : formFieldsFor(view, "edit", { pinned: Object.keys(createDefaults), within }),
1669
+ [view, createDefaults, within]
1480
1670
  );
1481
1671
  const editable = useMemo(() => formFieldsFor(view, "edit").some((f) => !f.readOnly), [view]);
1482
1672
  const viewer = useViewer();
@@ -2336,6 +2526,6 @@ function Cell({ last, children }) {
2336
2526
  ] });
2337
2527
  }
2338
2528
 
2339
- export { DEFAULT_MAX_PAGES, DisplayRenderersProvider, DisplayTimeZonesProvider, NativeDataFilters, NativeDataPageShell, NativeDetailPanel, NativeEmptyState2 as NativeEmptyState, NativeRecordView, NativeRecordViewMenu, NativeResourceForm, NativeResourceFormFieldRenderer, NativeResourceFormSheet, NativeResourcePage, NativeResourceView, NativeResourceViewMessagesProvider, NativeResourceWorkspace, NativeResourceWorkspaceMenu, SEARCH_DEBOUNCE_MS, SEGMENTED_SECTIONS_MAX, allowed, dateToDay, dayToDate, defaultNativeRecordViewMessages, defaultNativeResourceViewMessages, defaultNativeResourceWorkspaceMessages, displayText, formFieldsFor, formatDay, formatInstant, getNativeRecordViewStackOptions, getNativeResourceWorkspaceStackOptions, nativeDisplayRenderers, openableUrl, parseSettingNumber, resolveZone, rowItem, screenValues, sectionsFor, serverSort, serverSorts, swipeActionsFor, useDisplayCell, useDisplayTimeZones, useNativeResourceView, useNativeResourceViewMessages, validateValues, writableValues };
2529
+ export { DEFAULT_MAX_PAGES, DisplayRenderersProvider, DisplayTimeZonesProvider, NativeDataFilters, NativeDataPageShell, NativeDetailPanel, NativeEmptyState2 as NativeEmptyState, NativeRecordView, NativeRecordViewMenu, NativeResourceForm, NativeResourceFormFieldRenderer, NativeResourceFormSheet, NativeResourcePage, NativeResourceView, NativeResourceViewMessagesProvider, NativeResourceWorkspace, NativeResourceWorkspaceMenu, SEARCH_DEBOUNCE_MS2 as SEARCH_DEBOUNCE_MS, SEGMENTED_SECTIONS_MAX, allowed, dateToDay, dayToDate, defaultNativeRecordViewMessages, defaultNativeResourceViewMessages, defaultNativeResourceWorkspaceMessages, displayText, formFieldsFor, formatDay, formatInstant, getNativeRecordViewStackOptions, getNativeResourceWorkspaceStackOptions, nativeDisplayRenderers, openableUrl, parseSettingNumber, resolveZone, rowItem, screenValues, sectionsFor, serverSort, serverSorts, swipeActionsFor, useDisplayCell, useDisplayTimeZones, useNativeResourceView, useNativeResourceViewMessages, validateValues, writableValues };
2340
2530
  //# sourceMappingURL=index.js.map
2341
2531
  //# sourceMappingURL=index.js.map