@marktiderman/genesis-ui-native 3.12.1 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-TUDJDIGC.js → chunk-DCCOZSGR.js} +4 -2
- package/dist/chunk-DCCOZSGR.js.map +1 -0
- package/dist/{chunk-47CDRP43.js → chunk-G5M2Q7OU.js} +77 -4
- package/dist/chunk-G5M2Q7OU.js.map +1 -0
- package/dist/{chunk-C2ARUGT7.js → chunk-SRCGQWE4.js} +3 -3
- package/dist/{chunk-C2ARUGT7.js.map → chunk-SRCGQWE4.js.map} +1 -1
- package/dist/{chunk-X5CPLUPZ.js → chunk-WTO3LIUS.js} +4 -77
- package/dist/chunk-WTO3LIUS.js.map +1 -0
- package/dist/components/index.js +2 -2
- package/dist/data/index.d.ts +170 -27
- package/dist/data/index.js +493 -24
- package/dist/data/index.js.map +1 -1
- package/dist/{inbox-page-BGqR_cBs.d.ts → inbox-page-DD1cQdF4.d.ts} +6 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/layouts/index.d.ts +2 -2
- package/dist/layouts/index.js +2 -2
- package/package.json +3 -3
- package/src/data/NativeRecordPeek.tsx +12 -1
- package/src/data/__tests__/parity-data.test.tsx +26 -0
- package/src/data/resource-view/NativeRecordView.tsx +15 -2
- package/src/data/resource-view/NativeResourceView.tsx +153 -16
- package/src/data/resource-view/__tests__/native-record-view.test.tsx +24 -0
- package/src/data/resource-view/__tests__/native-resource-inbox.test.tsx +59 -0
- package/src/data/resource-view/__tests__/native-resource-lists.test.tsx +281 -0
- package/src/data/resource-view/index.ts +12 -1
- package/src/data/resource-view/list-controls.tsx +508 -0
- package/src/data/resource-view/mapping.ts +10 -0
- package/src/data/resource-view/messages.ts +70 -0
- package/src/data/resource-view/use-native-resource-view.ts +13 -3
- package/src/layouts/__tests__/inbox-page-start.test.tsx +39 -0
- package/src/layouts/inbox-page.tsx +7 -0
- package/dist/chunk-47CDRP43.js.map +0 -1
- package/dist/chunk-TUDJDIGC.js.map +0 -1
- package/dist/chunk-X5CPLUPZ.js.map +0 -1
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Box, FULL_SCREEN_DARK, Grid, Inline, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_DOUBLE_TAP_MS, LIGHTBOX_MAX_ZOOM, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeBulkBar, NativeButtonGroup, NativeCalendar, NativeCarousel, NativeChartContainer,
|
|
2
|
-
export { DEFAULT_GALLERY_RATIO, GALLERY_DEFAULTS, NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeDatePicker, NativeGalleryGrid, NativeLabel, NativeProgress, NativeSearchBar, NativeSegmentedControl, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSwitch, NativeTextarea, NativeTimePicker, alertVariants, galleryItemRatio, justifyRows } from '../chunk-
|
|
1
|
+
export { Box, FULL_SCREEN_DARK, Grid, Inline, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_DOUBLE_TAP_MS, LIGHTBOX_MAX_ZOOM, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeBulkBar, NativeButtonGroup, NativeCalendar, NativeCarousel, NativeChartContainer, NativeChoiceCard, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFollowUpList, NativeFullScreenModal, NativeGalleryCard, NativeGlassSurface, NativeHeaderCard, NativeHeadlineNumbers, NativeInputGroup, NativeInputOTP, NativeLightbox, NativeLiveIndicator, NativeNumberInput, NativePagination, NativePasswordToggleField, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeRating, NativeReadinessChip, NativeResourceSettingsPage, NativeResponsesToolbar, NativeSettingsRow, NativeShareSheet, NativeSlider, NativeSortableList, NativeStatCard, NativeStatusBadge, NativeStepper, NativeSummaryCard, NativeTabBar, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTierBadge, NativeToastProvider, NativeToggle, NativeToggleRow, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, NativeUserAvatar, NativeWhatsNewSheet, NativeWorkspaceSwitcher, NativeZoomablePhoto, Stack, defaultNativeLightboxLabels, lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, lightboxTouchDistance, nextRating, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from '../chunk-WTO3LIUS.js';
|
|
2
|
+
export { DEFAULT_GALLERY_RATIO, GALLERY_DEFAULTS, NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeChip, NativeChipGroup, NativeDatePicker, NativeGalleryGrid, NativeLabel, NativeProgress, NativeSearchBar, NativeSegmentedControl, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSwitch, NativeTextarea, NativeTimePicker, alertVariants, galleryItemRatio, justifyRows } from '../chunk-G5M2Q7OU.js';
|
|
3
3
|
export { NativeComposerBar, NativeThreadList, THREAD_AT_BOTTOM_POINTS, threadListMode, threadNearBottom } from '../chunk-BQYT6TH2.js';
|
|
4
4
|
export { NATIVE_ICON_NAMES, NativeBadge, NativeBanner, NativeButton, NativeContextMenu, NativeEmptyState, NativeIcon, NativeImage, NativeInlineAlert, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeNoFeaturesFound, NativeNoFeedbackFound, NativeNoSearchResults, NativeRefreshControl, NativeSectionListHeader, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwipeRow, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants } from '../chunk-D4UU6KIF.js';
|
|
5
5
|
export { GenesisModulesProvider, useGenesisModules } from '../chunk-VHUUOH46.js';
|
package/dist/data/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType } from 'react';
|
|
3
|
-
import { ResourceFormFieldDef, BaseRecord, DataRow, FieldReference, WriteConflict, ResourceContract } from '@marktiderman/genesis-core';
|
|
3
|
+
import { ResourceFormFieldDef, BaseRecord, DataRow, FieldReference, FilterParam, WriteConflict, ResourceContract } from '@marktiderman/genesis-core';
|
|
4
4
|
import { Control, UseFormReturn, FieldErrors } from 'react-hook-form';
|
|
5
|
-
import { UseResourceOptions, WizardStep } from '@marktiderman/genesis-core/hooks';
|
|
6
|
-
import { ResourceView, Allowed, RowSummary, RowPicture, DisplayHint, ResolvedFormField, ResolvedLink, Viewer, ViewGallery, ResolvedColumn, RecordView, GroupRowsOptions, RowGroup } from '@marktiderman/genesis-core/resource-view';
|
|
7
|
-
import { b as InboxPageSlotMap, e as ScreenHeaderProps } from '../inbox-page-
|
|
5
|
+
import { UseResourceOptions, ListStateResult, WizardStep } from '@marktiderman/genesis-core/hooks';
|
|
6
|
+
import { ResourceView, Allowed, RowSummary, RowPicture, DisplayHint, ResolvedFormField, ResolvedLink, Viewer, SavedViewStore, ViewGallery, ResolvedColumn, RecordView, GroupRowsOptions, RowGroup } from '@marktiderman/genesis-core/resource-view';
|
|
7
|
+
import { b as InboxPageSlotMap, e as ScreenHeaderProps } from '../inbox-page-DD1cQdF4.js';
|
|
8
8
|
import { InboxSwipeAction } from '@marktiderman/genesis-core/conversation';
|
|
9
9
|
import { ReadinessLabels } from '@marktiderman/genesis-core/resource';
|
|
10
10
|
import { u as NativePickedFile, b as GenesisFilePicker } from '../native-modules-6JnyeGR-.js';
|
|
@@ -215,11 +215,54 @@ interface NativeResourceViewMessages {
|
|
|
215
215
|
deleteFailed: string;
|
|
216
216
|
dismiss: string;
|
|
217
217
|
};
|
|
218
|
+
/**
|
|
219
|
+
* A list's segments, declared filters, view types, board and calendar (ADR 0017). Optional, so
|
|
220
|
+
* a catalogue written before it still fits; the English is used for what's missing.
|
|
221
|
+
*/
|
|
222
|
+
lists?: Partial<NativeListMessages>;
|
|
218
223
|
}
|
|
224
|
+
/** The words of a list's controls, board and calendar on the phone. @stability Beta */
|
|
225
|
+
interface NativeListMessages {
|
|
226
|
+
segments: string;
|
|
227
|
+
filters: string;
|
|
228
|
+
/** `{count}`: declared filters set. */
|
|
229
|
+
filtersSet: string;
|
|
230
|
+
clear: string;
|
|
231
|
+
done: string;
|
|
232
|
+
from: string;
|
|
233
|
+
to: string;
|
|
234
|
+
/** The view types, by name. */
|
|
235
|
+
types: Readonly<Record<string, string>>;
|
|
236
|
+
/** The switcher's accessible name. */
|
|
237
|
+
type: string;
|
|
238
|
+
/** Board: the column of rows with no value. */
|
|
239
|
+
noValue: string;
|
|
240
|
+
/** A card the screen won't let this viewer move. */
|
|
241
|
+
notAllowed: string;
|
|
242
|
+
/** `{name}`: a card whose last move is still saving. */
|
|
243
|
+
stillSaving: string;
|
|
244
|
+
/** `{noun}`: a move that matched no row. */
|
|
245
|
+
notChanged: string;
|
|
246
|
+
/** `{name}`: a move that failed with no words of its own. */
|
|
247
|
+
moveFailed: string;
|
|
248
|
+
/** `{column}`: a card's move, in its menu. */
|
|
249
|
+
moveTo: string;
|
|
250
|
+
loadMore: string;
|
|
251
|
+
today: string;
|
|
252
|
+
previous: string;
|
|
253
|
+
next: string;
|
|
254
|
+
agenda: string;
|
|
255
|
+
month: string;
|
|
256
|
+
noEvents: string;
|
|
257
|
+
allDay: string;
|
|
258
|
+
/** `{count}`: rows the calendar's limit left out. */
|
|
259
|
+
more: string;
|
|
260
|
+
}
|
|
261
|
+
declare const defaultNativeListMessages: NativeListMessages;
|
|
219
262
|
declare const defaultNativeResourceViewMessages: NativeResourceViewMessages;
|
|
220
263
|
|
|
221
|
-
type Row$
|
|
222
|
-
type AnyResourceView<T extends Row$
|
|
264
|
+
type Row$6 = Record<string, unknown>;
|
|
265
|
+
type AnyResourceView<T extends Row$6 = Row$6> = ResourceView<any, T & DataRow>;
|
|
223
266
|
/** What one row shows in a NativeListItem. */
|
|
224
267
|
interface NativeResourceRowItem {
|
|
225
268
|
id: string;
|
|
@@ -238,7 +281,7 @@ interface NativeResourceRowItem {
|
|
|
238
281
|
* A row as NativeListItem draws it: `view.summary(row)`'s title, subtitle and chips, and nothing
|
|
239
282
|
* else. A view that wants a second line says so in its summary.
|
|
240
283
|
*/
|
|
241
|
-
declare function rowItem<T extends Row$
|
|
284
|
+
declare function rowItem<T extends Row$6>(view: AnyResourceView<T>, row: T): NativeResourceRowItem;
|
|
242
285
|
interface NativeResourceSection<T> {
|
|
243
286
|
key: string;
|
|
244
287
|
/** Empty for the one section of an ungrouped view (no header is drawn). */
|
|
@@ -249,7 +292,7 @@ interface NativeResourceSection<T> {
|
|
|
249
292
|
* Rows in sections by `definition.groupBy`, in the order each group first appears (the server's
|
|
250
293
|
* sort, so paging never reorders what's on screen). Without `groupBy`, one untitled section.
|
|
251
294
|
*/
|
|
252
|
-
declare function sectionsFor<T extends Row$
|
|
295
|
+
declare function sectionsFor<T extends Row$6>(view: AnyResourceView<T>, rows: readonly T[], messages: NativeResourceViewMessages): NativeResourceSection<T>[];
|
|
253
296
|
/** A row action: InboxPage's swipe action plus an icon name and, when a guard refuses it, why. */
|
|
254
297
|
interface NativeResourceSwipeAction extends InboxSwipeAction {
|
|
255
298
|
/** An icon name from Genesis's set (`edit`, `trash`), mapped per platform. */
|
|
@@ -263,7 +306,7 @@ type NativeResourceScreenCan<T> = (action: "create" | "update" | "delete", row?:
|
|
|
263
306
|
* The effective right: the screen's rule AND the view's guard (never OR). The guard gets the
|
|
264
307
|
* viewer (`useViewer()`); without one it gets no one, so a guard that needs it refuses.
|
|
265
308
|
*/
|
|
266
|
-
declare function allowed<T extends Row$
|
|
309
|
+
declare function allowed<T extends Row$6>(view: AnyResourceView<T>, action: "create" | "update" | "delete", row: T | undefined, screen?: NativeResourceScreenCan<T>, viewer?: Viewer): Allowed | false;
|
|
267
310
|
interface SwipeActionOptions<T> {
|
|
268
311
|
messages: NativeResourceViewMessages;
|
|
269
312
|
/** The provider moves deleted rows to a recycle bin (`capabilities(resource).softDelete`). */
|
|
@@ -277,12 +320,17 @@ interface SwipeActionOptions<T> {
|
|
|
277
320
|
onDelete: (row: T) => void;
|
|
278
321
|
/** A refused action was pressed: say why. */
|
|
279
322
|
onRefused: (label: string, reason: string) => void;
|
|
323
|
+
/**
|
|
324
|
+
* Runs one of the view's own actions (ADR 0017 §2) on the row. With it, the view's actions sit
|
|
325
|
+
* between Edit and Delete, each refused one with its reason (`view.canAction`).
|
|
326
|
+
*/
|
|
327
|
+
onAction?: ((name: string, row: T) => void) | undefined;
|
|
280
328
|
}
|
|
281
329
|
/**
|
|
282
330
|
* A row's swipe actions, from the view's guards. A refused action stays in the list with its
|
|
283
331
|
* reason, so the person learns why; one the screen turns off (`false`) is left out.
|
|
284
332
|
*/
|
|
285
|
-
declare function swipeActionsFor<T extends Row$
|
|
333
|
+
declare function swipeActionsFor<T extends Row$6>(view: AnyResourceView<T>, row: T, options: SwipeActionOptions<T>): NativeResourceSwipeAction[];
|
|
286
334
|
/** How a form field is drawn. */
|
|
287
335
|
type NativeFormFieldKind = "text" | "email" | "tel" | "url" | "number" | "textarea" | "switch" | "segmented" | "select" | "date" | "datetime"
|
|
288
336
|
/** A link: a searchable list of the linked rows, through the provider. */
|
|
@@ -327,7 +375,7 @@ interface NativeFormField {
|
|
|
327
375
|
* `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
|
|
328
376
|
* them as text.
|
|
329
377
|
*/
|
|
330
|
-
declare function formFieldsFor<T extends Row$
|
|
378
|
+
declare function formFieldsFor<T extends Row$6>(view: AnyResourceView<T>, mode: "create" | "edit", options?: {
|
|
331
379
|
/**
|
|
332
380
|
* Fields the screen's filter fixes. A link among them stays read-only: the list is that
|
|
333
381
|
* record's (a client's sessions), and a picker would move the row out of it (as on the web).
|
|
@@ -345,15 +393,15 @@ declare function formFieldsFor<T extends Row$5>(view: AnyResourceView<T>, mode:
|
|
|
345
393
|
* An edit passes `dirty`, the fields the person changed, so a save never rewrites the rest. A
|
|
346
394
|
* cleared optional value (an empty text, a cleared number or date) is sent as null.
|
|
347
395
|
*/
|
|
348
|
-
declare function writableValues<T extends Row$
|
|
396
|
+
declare function writableValues<T extends Row$6>(view: AnyResourceView<T>, mode: "create" | "edit", fields: readonly NativeFormField[], values: Readonly<Record<string, unknown>>, dirty?: ReadonlySet<string>): Record<string, unknown>;
|
|
349
397
|
/** Field errors for a save: required fields with no value, and text over `max`. */
|
|
350
398
|
declare function validateValues(fields: readonly NativeFormField[], values: Readonly<Record<string, unknown>>, messages: NativeResourceViewMessages): Record<string, string>;
|
|
351
399
|
|
|
352
|
-
type Row$
|
|
400
|
+
type Row$5 = Record<string, unknown>;
|
|
353
401
|
type Filter = Readonly<Record<string, string | number | boolean | null | readonly (string | number)[]>>;
|
|
354
402
|
/** How long typing waits before the search goes to the server. */
|
|
355
403
|
declare const SEARCH_DEBOUNCE_MS = 300;
|
|
356
|
-
interface NativeResourceViewOptions<T extends Row$
|
|
404
|
+
interface NativeResourceViewOptions<T extends Row$5 = Row$5> {
|
|
357
405
|
/** A tab the view defines: its server filter. */
|
|
358
406
|
preset?: string;
|
|
359
407
|
/**
|
|
@@ -378,6 +426,10 @@ interface NativeResourceViewOptions<T extends Row$4 = Row$4> {
|
|
|
378
426
|
can?: NativeResourceScreenCan<T>;
|
|
379
427
|
/** Refetch loaded pages when the provider reports a change. */
|
|
380
428
|
live?: boolean;
|
|
429
|
+
/** The list state's filters (core `useListState`: a segment and the declared filters), on top of the screen's. */
|
|
430
|
+
listFilters?: readonly FilterParam[];
|
|
431
|
+
/** False while another type (a board, a calendar) draws the rows: the list reads nothing. Default true. */
|
|
432
|
+
enabled?: boolean;
|
|
381
433
|
}
|
|
382
434
|
type SaveResult = {
|
|
383
435
|
ok: true;
|
|
@@ -386,7 +438,7 @@ type SaveResult = {
|
|
|
386
438
|
message?: string;
|
|
387
439
|
fields: Record<string, string>;
|
|
388
440
|
};
|
|
389
|
-
interface UseNativeResourceViewReturn<T extends Row$
|
|
441
|
+
interface UseNativeResourceViewReturn<T extends Row$5 = Row$5> {
|
|
390
442
|
rows: T[];
|
|
391
443
|
/** Rows in `groupBy` sections (one untitled section when the view doesn't group). */
|
|
392
444
|
sections: NativeResourceSection<T>[];
|
|
@@ -423,6 +475,7 @@ interface UseNativeResourceViewReturn<T extends Row$4 = Row$4> {
|
|
|
423
475
|
onEdit: (row: T) => void;
|
|
424
476
|
onDelete: (row: T) => void;
|
|
425
477
|
onRefused: (label: string, reason: string) => void;
|
|
478
|
+
onAction?: ((name: string, row: T) => void) | undefined;
|
|
426
479
|
}) => NativeResourceSwipeAction[];
|
|
427
480
|
/** Whether a new row may be created: true, or the guard's reason. False when the screen turns it off or there's no form. */
|
|
428
481
|
canCreate: Allowed | false;
|
|
@@ -438,6 +491,8 @@ interface UseNativeResourceViewReturn<T extends Row$4 = Row$4> {
|
|
|
438
491
|
remove: (row: T) => void;
|
|
439
492
|
/** The provider bins deleted rows (they can be restored). */
|
|
440
493
|
softDelete: boolean;
|
|
494
|
+
/** The screen's and the tab's filters, before the list state's: what segment counts start from. */
|
|
495
|
+
baseFilters: FilterParam[];
|
|
441
496
|
}
|
|
442
497
|
/** The values a create takes from the screen: every non-null equality filter, the screen's over the tab's. */
|
|
443
498
|
declare function screenValues(...filters: (Filter | undefined)[]): Record<string, string | number | boolean>;
|
|
@@ -453,20 +508,20 @@ type ServerSort = {
|
|
|
453
508
|
* page never lands in the middle of an earlier section, then the view's `orderBy` within each
|
|
454
509
|
* group. A provider without `multiSort` applies only the first.
|
|
455
510
|
*/
|
|
456
|
-
declare function serverSorts<T extends Row$
|
|
511
|
+
declare function serverSorts<T extends Row$5>(view: AnyResourceView<T>): ServerSort[];
|
|
457
512
|
/** The first of {@link serverSorts}: what a provider that sorts by one field gets. */
|
|
458
|
-
declare function serverSort<T extends Row$
|
|
459
|
-
declare function useNativeResourceView<T extends Row$
|
|
513
|
+
declare function serverSort<T extends Row$5>(view: AnyResourceView<T>): ServerSort | undefined;
|
|
514
|
+
declare function useNativeResourceView<T extends Row$5 = Row$5>(view: AnyResourceView<T>, options?: NativeResourceViewOptions<T>): UseNativeResourceViewReturn<T>;
|
|
460
515
|
|
|
461
|
-
type Row$
|
|
516
|
+
type Row$4 = Record<string, unknown>;
|
|
462
517
|
/** The gesture wrapper around a row, the same props as InboxPage's `swipeable` slot. */
|
|
463
518
|
type NativeResourceSwipeableProps = Omit<InboxPageSlotMap["swipeable"], "actions"> & {
|
|
464
519
|
actions: NativeResourceSwipeAction[];
|
|
465
520
|
};
|
|
466
521
|
/** How rows show: a list (the default) or cards in columns, as the web's `mode`. */
|
|
467
522
|
type NativeResourceViewMode = "list" | "grid";
|
|
468
|
-
/** The view types the phone draws
|
|
469
|
-
type NativeResourceViewType = NativeResourceViewMode | "gallery";
|
|
523
|
+
/** The view types the phone draws (ADR 0021). @stability Beta */
|
|
524
|
+
type NativeResourceViewType = NativeResourceViewMode | "gallery" | "inbox" | "board" | "calendar";
|
|
470
525
|
/**
|
|
471
526
|
* Spread onto your card's Pressable: the press (the screen's `onRowPress`, else the peek), the
|
|
472
527
|
* long press (the row's actions), and the label and actions screen readers use. The same wiring
|
|
@@ -504,7 +559,7 @@ interface NativeResourceCardActions {
|
|
|
504
559
|
first: boolean;
|
|
505
560
|
last: boolean;
|
|
506
561
|
}
|
|
507
|
-
interface NativeResourceViewProps<T extends Row$
|
|
562
|
+
interface NativeResourceViewProps<T extends Row$4 = Row$4> extends NativeResourceViewOptions<T> {
|
|
508
563
|
view: AnyResourceView<T>;
|
|
509
564
|
/** The heading above the list. Default the view's title; `false` when the navigation bar shows it. */
|
|
510
565
|
title?: string | false;
|
|
@@ -528,10 +583,28 @@ interface NativeResourceViewProps<T extends Row$3 = Row$3> extends NativeResourc
|
|
|
528
583
|
mode?: NativeResourceViewMode;
|
|
529
584
|
/**
|
|
530
585
|
* The view type (ADR 0021), as the web's `<ResourceView type>`: `"list"` (default), `"grid"`, or
|
|
531
|
-
* `"gallery"` (the grid as photos, from the view's `gallery` block)
|
|
532
|
-
*
|
|
586
|
+
* `"gallery"` (the grid as photos, from the view's `gallery` block), or `"inbox"` (InboxPage's
|
|
587
|
+
* rows from the view's `inbox` block: unread in bold, a preview, a time, swipe actions), `"board"`
|
|
588
|
+
* (the view's board block: columns side by side, a long press moves a card) or `"calendar"` (the
|
|
589
|
+
* view's calendar block: an agenda or a month). Wins over `mode`, and fixes the type: the
|
|
590
|
+
* switcher stays off unless `switcher` asks for it.
|
|
533
591
|
*/
|
|
534
592
|
type?: NativeResourceViewType;
|
|
593
|
+
/**
|
|
594
|
+
* The view-type switcher above the list (ADR 0017 §11): the view's `types` the phone draws, the
|
|
595
|
+
* person's choice kept in `savedViews`. Default on when the view declares `types` (two or more
|
|
596
|
+
* the phone draws) and the screen fixes neither `type` nor `mode`.
|
|
597
|
+
*/
|
|
598
|
+
switcher?: boolean;
|
|
599
|
+
/** Where the person's choices (the view type) are kept: the app's saved-view store, the web's contract. */
|
|
600
|
+
savedViews?: SavedViewStore;
|
|
601
|
+
/** The segment the list opens on. Default the view's first. */
|
|
602
|
+
defaultSegment?: string;
|
|
603
|
+
/**
|
|
604
|
+
* Runs one of the view's actions on a row (a swipe or the long-press menu). Default: the
|
|
605
|
+
* provider's `runAction`, after the action's `confirm`.
|
|
606
|
+
*/
|
|
607
|
+
onAction?: (name: string, row: T) => void | Promise<void>;
|
|
535
608
|
/** Columns in grid mode (React Native's FlatList name). Default 2. */
|
|
536
609
|
numColumns?: number;
|
|
537
610
|
/**
|
|
@@ -565,7 +638,7 @@ interface NativeResourceViewProps<T extends Row$3 = Row$3> extends NativeResourc
|
|
|
565
638
|
* <NativeResourceView view={brandsView} onRowPress={(b) => router.push(`/brands/${b.id}`)} />
|
|
566
639
|
* ```
|
|
567
640
|
*/
|
|
568
|
-
declare function NativeResourceView<T extends Row$
|
|
641
|
+
declare function NativeResourceView<T extends Row$4 = Row$4>(props: NativeResourceViewProps<T>): react.JSX.Element;
|
|
569
642
|
|
|
570
643
|
type Values = Record<string, unknown>;
|
|
571
644
|
interface NativeResourceFormSheetProps {
|
|
@@ -586,6 +659,70 @@ interface NativeResourceFormSheetProps {
|
|
|
586
659
|
}
|
|
587
660
|
declare function NativeResourceFormSheet({ open, mode, title, fields, initial, loading, recordKey, onCancel, onSave, testID, }: NativeResourceFormSheetProps): react.JSX.Element;
|
|
588
661
|
|
|
662
|
+
type Row$3 = Record<string, unknown>;
|
|
663
|
+
/** The list words: the app's catalogue over the English. */
|
|
664
|
+
declare function useNativeListMessages(): NativeListMessages;
|
|
665
|
+
/** The view types the phone draws. @stability Beta */
|
|
666
|
+
declare const NATIVE_VIEW_TYPES: readonly ["list", "grid", "gallery", "inbox", "board", "calendar"];
|
|
667
|
+
/**
|
|
668
|
+
* The types a person may switch between on the phone: the view's, as the phone draws them (a
|
|
669
|
+
* table is a list there), each once.
|
|
670
|
+
*
|
|
671
|
+
* @stability Beta
|
|
672
|
+
*/
|
|
673
|
+
declare function nativeSwitchableTypes(view: AnyResourceView<Row$3>): string[];
|
|
674
|
+
/** The view's types as a segmented control: the phone's view-type switcher. @stability Beta */
|
|
675
|
+
declare function NativeViewTypeSwitcher({ state, types, testID }: {
|
|
676
|
+
state: ListStateResult;
|
|
677
|
+
types: readonly string[];
|
|
678
|
+
testID?: string;
|
|
679
|
+
}): react.JSX.Element | null;
|
|
680
|
+
/** The view's segments as a row of chips, each with its count when it asks for one. @stability Beta */
|
|
681
|
+
declare function NativeViewSegments({ view, state, baseFilters, enabled, testID, }: {
|
|
682
|
+
view: AnyResourceView<Row$3>;
|
|
683
|
+
state: ListStateResult;
|
|
684
|
+
/** The list's other filters (the screen's), which counts include. */
|
|
685
|
+
baseFilters?: readonly FilterParam[];
|
|
686
|
+
/** False while the screen waits: no count is read. */
|
|
687
|
+
enabled?: boolean;
|
|
688
|
+
testID?: string;
|
|
689
|
+
}): react.JSX.Element | null;
|
|
690
|
+
/** The view's declared filters: a Filters button (with how many are set) and a sheet to set them. @stability Beta */
|
|
691
|
+
declare function NativeViewFilterControls({ view, state, testID }: {
|
|
692
|
+
view: AnyResourceView<Row$3>;
|
|
693
|
+
state: ListStateResult;
|
|
694
|
+
testID?: string;
|
|
695
|
+
}): react.JSX.Element | null;
|
|
696
|
+
/**
|
|
697
|
+
* The view as a board on the phone: its columns side by side, scrolled across; a card opens on a
|
|
698
|
+
* press, and a long press offers its moves ("Move to …"), each through the view's guards and the
|
|
699
|
+
* resource's own update (core's useViewBoard, as the web's board).
|
|
700
|
+
*/
|
|
701
|
+
declare function NativeResourceBoard({ view, filters, can, onOpen, header, testID, enabled, }: {
|
|
702
|
+
view: AnyResourceView<Row$3>;
|
|
703
|
+
filters: readonly FilterParam[];
|
|
704
|
+
can?: NativeResourceScreenCan<Row$3> | undefined;
|
|
705
|
+
onOpen: (row: Row$3) => void;
|
|
706
|
+
header?: ReactNode;
|
|
707
|
+
testID: string;
|
|
708
|
+
/** False while the screen waits: nothing is fetched. */
|
|
709
|
+
enabled?: boolean;
|
|
710
|
+
}): react.JSX.Element;
|
|
711
|
+
/**
|
|
712
|
+
* The view as a calendar on the phone: an agenda (the window's days with their events) or a
|
|
713
|
+
* month (a grid of days with dots; a tap shows that day's events below). Rows come through core's
|
|
714
|
+
* useViewCalendarRange and calendarEvents, and land by placeEvents, as on the web.
|
|
715
|
+
*/
|
|
716
|
+
declare function NativeResourceCalendar({ view, filters, onOpen, header, testID, enabled, }: {
|
|
717
|
+
view: AnyResourceView<Row$3>;
|
|
718
|
+
filters: readonly FilterParam[];
|
|
719
|
+
onOpen: (row: Row$3) => void;
|
|
720
|
+
header?: ReactNode;
|
|
721
|
+
testID: string;
|
|
722
|
+
/** False while the screen waits: nothing is fetched. */
|
|
723
|
+
enabled?: boolean;
|
|
724
|
+
}): react.JSX.Element;
|
|
725
|
+
|
|
589
726
|
/** The clocks a timestamp can be read on: the viewer's and the scope's (IANA names). */
|
|
590
727
|
interface DisplayTimeZones {
|
|
591
728
|
viewer: string;
|
|
@@ -937,6 +1074,12 @@ interface NativeRecordPeekProps<T extends Row = Row> extends Omit<NativeRecordVi
|
|
|
937
1074
|
* promise: the sheet closes when it resolves, and a rejection is shown in plain words.
|
|
938
1075
|
*/
|
|
939
1076
|
onDelete?: (row: T) => unknown;
|
|
1077
|
+
/**
|
|
1078
|
+
* `false` when `onDelete` confirms on its own (a list's own delete handler): the peek calls it at
|
|
1079
|
+
* once instead of asking first. Default `true`, as genesis-ui's RecordPeek, so one `onDelete`
|
|
1080
|
+
* means the same on both.
|
|
1081
|
+
*/
|
|
1082
|
+
confirmDelete?: boolean;
|
|
940
1083
|
/** The screen's own rule, as NativeResourceView's `can`: `false` hides Edit or Delete, a sentence refuses it. Only narrows the view's guards. */
|
|
941
1084
|
can?: NativeResourceScreenCan<T>;
|
|
942
1085
|
/** Above the record (a link to its full page). */
|
|
@@ -952,6 +1095,6 @@ interface NativeRecordPeekProps<T extends Row = Row> extends Omit<NativeRecordVi
|
|
|
952
1095
|
cancel?: string;
|
|
953
1096
|
};
|
|
954
1097
|
}
|
|
955
|
-
declare function NativeRecordPeek<T extends Row = Row>({ row, open, onClose, onEdit, onDelete, can, header, snapPoints, labels, testID, ...rest }: NativeRecordPeekProps<T>): react.JSX.Element;
|
|
1098
|
+
declare function NativeRecordPeek<T extends Row = Row>({ row, open, onClose, onEdit, onDelete, confirmDelete: confirmFirst, can, header, snapPoints, labels, testID, ...rest }: NativeRecordPeekProps<T>): react.JSX.Element;
|
|
956
1099
|
|
|
957
|
-
export { type AnyResourceView, DEFAULT_MAX_PAGES, type DisplayContext, type DisplayRenderer, type DisplayRenderers, DisplayRenderersProvider, type DisplayTimeZones, DisplayTimeZonesProvider, type NativeCardFieldDef, NativeConflictSheet, type NativeConflictSheetMessages, type NativeConflictSheetProps, NativeCustomView, type NativeCustomViewProps, type NativeCustomViewState, NativeDataFilters, type NativeDataFiltersProps, NativeDataPageShell, type NativeDataPageShellProps, type NativeDetailField, NativeDetailPanel, type NativeDetailPanelProps, NativeEmptyState, type NativeEmptyStateProps, NativeFieldArrayRenderer, type NativeFieldArrayRendererProps, NativeFileUploadField, type NativeFileUploadFieldProps, type NativeFormField, type NativeFormFieldKind, NativeRecordPeek, type NativeRecordPeekProps, NativeRecordView, type NativeRecordViewHeaderProps, NativeRecordViewMenu, type NativeRecordViewMessages, type NativeRecordViewProps, NativeRelationField, type NativeRelationFieldProps, type NativeResourceCardActions, type NativeResourceCardPressableProps, NativeResourceForm, NativeResourceFormFieldRenderer, type NativeResourceFormFieldRendererProps, type NativeResourceFormProps, NativeResourceFormSheet, type NativeResourceFormSheetProps, NativeResourcePage, type NativeResourcePageProps, type NativeResourceRowItem, type NativeResourceScreenCan, type NativeResourceSection, type NativeResourceSwipeAction, type NativeResourceSwipeableProps, NativeResourceView, type NativeResourceViewMessages, NativeResourceViewMessagesProvider, type NativeResourceViewMode, type NativeResourceViewOptions, type NativeResourceViewProps, type NativeResourceViewType, NativeResourceWorkspace, type NativeResourceWorkspaceHeaderProps, NativeResourceWorkspaceMenu, type NativeResourceWorkspaceMessages, type NativeResourceWorkspaceProps, NativeWizardForm, type NativeWizardFormProps, SEARCH_DEBOUNCE_MS, SEGMENTED_SECTIONS_MAX, type SaveResult, type UseNativeResourceViewReturn, allowed, dateToDay, dayToDate, defaultNativeRecordViewMessages, defaultNativeResourceViewMessages, defaultNativeResourceWorkspaceMessages, displayText, formFieldsFor, formatDay, formatInstant, getNativeRecordViewStackOptions, getNativeResourceWorkspaceStackOptions, nativeDisplayRenderers, openableUrl, parseSettingNumber, resolveZone, rowItem, screenValues, sectionsFor, serverSort, serverSorts, swipeActionsFor, useDisplayCell, useDisplayTimeZones, useNativeCustomView, useNativeResourceView, useNativeResourceViewMessages, validateValues, writableValues };
|
|
1100
|
+
export { type AnyResourceView, DEFAULT_MAX_PAGES, type DisplayContext, type DisplayRenderer, type DisplayRenderers, DisplayRenderersProvider, type DisplayTimeZones, DisplayTimeZonesProvider, NATIVE_VIEW_TYPES, type NativeCardFieldDef, NativeConflictSheet, type NativeConflictSheetMessages, type NativeConflictSheetProps, NativeCustomView, type NativeCustomViewProps, type NativeCustomViewState, NativeDataFilters, type NativeDataFiltersProps, NativeDataPageShell, type NativeDataPageShellProps, type NativeDetailField, NativeDetailPanel, type NativeDetailPanelProps, NativeEmptyState, type NativeEmptyStateProps, NativeFieldArrayRenderer, type NativeFieldArrayRendererProps, NativeFileUploadField, type NativeFileUploadFieldProps, type NativeFormField, type NativeFormFieldKind, type NativeListMessages, NativeRecordPeek, type NativeRecordPeekProps, NativeRecordView, type NativeRecordViewHeaderProps, NativeRecordViewMenu, type NativeRecordViewMessages, type NativeRecordViewProps, NativeRelationField, type NativeRelationFieldProps, NativeResourceBoard, NativeResourceCalendar, type NativeResourceCardActions, type NativeResourceCardPressableProps, NativeResourceForm, NativeResourceFormFieldRenderer, type NativeResourceFormFieldRendererProps, type NativeResourceFormProps, NativeResourceFormSheet, type NativeResourceFormSheetProps, NativeResourcePage, type NativeResourcePageProps, type NativeResourceRowItem, type NativeResourceScreenCan, type NativeResourceSection, type NativeResourceSwipeAction, type NativeResourceSwipeableProps, NativeResourceView, type NativeResourceViewMessages, NativeResourceViewMessagesProvider, type NativeResourceViewMode, type NativeResourceViewOptions, type NativeResourceViewProps, type NativeResourceViewType, NativeResourceWorkspace, type NativeResourceWorkspaceHeaderProps, NativeResourceWorkspaceMenu, type NativeResourceWorkspaceMessages, type NativeResourceWorkspaceProps, NativeViewFilterControls, NativeViewSegments, NativeViewTypeSwitcher, NativeWizardForm, type NativeWizardFormProps, SEARCH_DEBOUNCE_MS, SEGMENTED_SECTIONS_MAX, type SaveResult, type UseNativeResourceViewReturn, allowed, dateToDay, dayToDate, defaultNativeListMessages, defaultNativeRecordViewMessages, defaultNativeResourceViewMessages, defaultNativeResourceWorkspaceMessages, displayText, formFieldsFor, formatDay, formatInstant, getNativeRecordViewStackOptions, getNativeResourceWorkspaceStackOptions, nativeDisplayRenderers, nativeSwitchableTypes, openableUrl, parseSettingNumber, resolveZone, rowItem, screenValues, sectionsFor, serverSort, serverSorts, swipeActionsFor, useDisplayCell, useDisplayTimeZones, useNativeCustomView, useNativeListMessages, useNativeResourceView, useNativeResourceViewMessages, validateValues, writableValues };
|