@abpjs/ui 0.2.0-next.10 → 0.2.0-next.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0-next.12
4
+
5
+ A prerelease under npm's `next` tag: lists served a page at a time.
6
+
7
+ - `useListState(source)`: a list's page, page size, sort, search (asked once typing settles) and filters, from a
8
+ `ListSource` (`{ key, load(query, signal) }`); a change goes back to the first page, only the latest answer counts,
9
+ and the previous rows stay while the next page comes (`refreshing`). `table` and `pagination` are the props for
10
+ `DataTable` (manual sort) and `Pagination`; `onQueryChange` for a screen that keeps the list's place in its address.
11
+ - `abpListSource(request, path, options)` and `useAreaListSource(area, path, options)`: a list in ABP's shape
12
+ (`skipCount`, `maxResultCount`, `sorting`, `filter` in; `{ totalCount, items }` out), with `abpListParams`. A host
13
+ gives an area its own source (a query engine, saved views) in place of the package's.
14
+
15
+ ## 0.2.0-next.11
16
+
17
+ A prerelease under npm's `next` tag: the first of the `guard` area's building blocks.
18
+
19
+ - `@abpjs/ui/rules`: names by language (`Names`, `languageChain(locale, default)`, `pickName(chain, names, fallback)`)
20
+ and `splitList` (a comma- or line-separated list, trimmed).
21
+
3
22
  ## 0.2.0-next.10
4
23
 
5
24
  A prerelease under npm's `next` tag.
package/dist/index.d.ts CHANGED
@@ -1553,6 +1553,102 @@ declare function useSlotSaves(): {
1553
1553
  run: () => Promise<void>;
1554
1554
  };
1555
1555
 
1556
+ /** What a list shows: a page of rows, sorted and narrowed (ADR 0109 amendment). */
1557
+ interface ListQuery {
1558
+ /** From 1. */
1559
+ page: number;
1560
+ pageSize: number;
1561
+ /** A column's id and its direction; null for the list's own order. */
1562
+ sort: {
1563
+ columnId: string;
1564
+ direction: 'asc' | 'desc';
1565
+ } | null;
1566
+ /** What's typed in the list's search. */
1567
+ search: string;
1568
+ /** The list's other filters by name (a status, a directory); an empty value is no filter. */
1569
+ filters: Record<string, string>;
1570
+ }
1571
+ /** A page of a list: its rows and how many there are in all. */
1572
+ interface ListPage<T> {
1573
+ items: T[];
1574
+ total: number;
1575
+ }
1576
+ /**
1577
+ * Where a list's rows come from: the server package's own paging, or the host's (its query engine), which a host gives
1578
+ * an area in place of the package's. `key` names what it lists: a different key is a different list, read afresh.
1579
+ */
1580
+ interface ListSource<T> {
1581
+ key: string;
1582
+ load: (query: ListQuery, signal: AbortSignal) => Promise<ListPage<T>>;
1583
+ }
1584
+ declare const DEFAULT_PAGE_SIZE = 25;
1585
+ declare function emptyQuery(initial?: Partial<ListQuery>): ListQuery;
1586
+ /** How a list's query maps onto a server's: the search's parameter, and each sortable column's field. */
1587
+ interface AbpListOptions {
1588
+ /** The parameter the search goes in (ABP's lists: `filter`). */
1589
+ searchParam?: string;
1590
+ /** A column's id to the server's field for `sorting`; a column not here sorts by its id. */
1591
+ sortFields?: Record<string, string>;
1592
+ /** Parameters every page asks with (a fixed scope, a kind). */
1593
+ fixed?: Record<string, string>;
1594
+ }
1595
+ /** ABP's paging parameters for a query: `skipCount`, `maxResultCount`, `sorting` ("username desc"), the search and filters. */
1596
+ declare function abpListParams(query: ListQuery, options?: AbpListOptions): URLSearchParams;
1597
+ /** A list served in ABP's shape (`PagedAndSortedResultRequestDto` in, `{ totalCount, items }` out) at a path. */
1598
+ declare function abpListSource<T>(request: HostRequest, path: string, options?: AbpListOptions): ListSource<T>;
1599
+ /** How many pages a list has (at least one). */
1600
+ declare const pageCount: (total: number, pageSize: number) => number;
1601
+
1602
+ interface ListState<T> {
1603
+ /** The list's place: its page, size, sort, filters, and what's typed in its search (asked once typing settles). */
1604
+ query: ListQuery;
1605
+ /** The page's rows; undefined until the first page comes. */
1606
+ rows: T[] | undefined;
1607
+ total: number;
1608
+ pages: number;
1609
+ /** The first page is coming. */
1610
+ loading: boolean;
1611
+ /** Another page or a new search is coming: the rows shown are the last ones until it does. */
1612
+ refreshing: boolean;
1613
+ error: string | null;
1614
+ setSearch: (search: string) => void;
1615
+ /** One filter by name; null or '' removes it. */
1616
+ setFilter: (name: string, value: string | null) => void;
1617
+ setSort: (sort: ListQuery['sort']) => void;
1618
+ setPage: (page: number) => void;
1619
+ setPageSize: (pageSize: number) => void;
1620
+ /** Reads the page again (after a change made elsewhere). */
1621
+ reload: () => void;
1622
+ /** For `DataTable`: the rows, the first load's placeholders, the error, and the sort, which the source applies. */
1623
+ table: {
1624
+ rows: T[] | undefined;
1625
+ loading: boolean;
1626
+ error: string | null;
1627
+ sort: ListQuery['sort'];
1628
+ onSortChange: (sort: ListQuery['sort']) => void;
1629
+ sortMode: 'manual';
1630
+ };
1631
+ /** For `Pagination`: the page and how many. */
1632
+ pagination: {
1633
+ page: number;
1634
+ pages: number;
1635
+ onPage: (page: number) => void;
1636
+ };
1637
+ }
1638
+ /**
1639
+ * A list's page, search, filters and sort, read from its source (ADR 0109 amendment): a change of search, filters, sort
1640
+ * or page size goes back to the first page; typing waits `searchDelay` ms; only the latest answer counts; a different
1641
+ * source (its `key`) starts empty. `onQueryChange` hears every change, for a screen that keeps the list's place in its
1642
+ * address.
1643
+ */
1644
+ declare function useListState<T>(source: ListSource<T>, options?: {
1645
+ initial?: Partial<ListQuery>;
1646
+ searchDelay?: number;
1647
+ onQueryChange?: (query: ListQuery) => void;
1648
+ }): ListState<T>;
1649
+ /** An area's list served in ABP's shape at a path on this host (`/accounts/page`): the same source while the path is. */
1650
+ declare function useAreaListSource<T>(area: string, path: string, options?: AbpListOptions): ListSource<T>;
1651
+
1556
1652
  /** Whether what was typed can be a code yet: six digits (spaces between are fine), or a recovery code's ten characters. */
1557
1653
  declare function looksLikeCode(value: string, recovery: boolean): boolean;
1558
1654
  /**
@@ -2808,4 +2904,4 @@ interface TooltipProps extends Omit<Tooltip$1.RootProps, 'children'> {
2808
2904
  */
2809
2905
  declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
2810
2906
 
2811
- export { ABP_UI_VERSION, AbpApiError, type AbpBrand, type AbpHost, type AbpLabels, AbpProvider, type AbpProviderProps, type AbpSystemOptions, type ApiQuery, AppLink, type AppLinkProps, AppShell, type AppShellBrand, type AppShellNavItem, type AppShellNavSection, type AppShellPlace, type AppShellProps, type AppShellSidebar, type AreaTexts, type Arrival, ArriveOnChange, type ArriveOnChangeProps, AttentionChip, type AttentionChipProps, type AvatarPerson, AvatarStack, type AvatarStackProps, Bone, type BoneProps, type BreadcrumbItem, Breadcrumbs, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarGrid, type CalendarGridProps, type CalendarItem, type CardDates, CategoryProgress, type CategoryProgressProps, type CelebrateTarget, Chart, type ChartProps, type ChartSeries, CheckboxField, type CheckboxFieldProps, Collapse, type CollapseProps, type ColorMode, ColorModeProvider, ColorModeToggle, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, ConfirmProvider, CountBadge, type CountBadgeProps, Counter, type CounterProps, DashboardGrid, type DashboardGridProps, DataTable, type DataTableColumn, type DataTableProps, type DataTableSelection, type DataTableSort, type Direction, DirectionalIcon, DropHint, type DropHintProps, type DropZoneOptions, type DropZoneState, type DroppedFile, EMPTY_VALUE, EmptyState, type EmptyStateProps, FadeIn, type FadeInProps, Field, type FieldProps, FileDropArea, type FileDropAreaProps, FormDialog, type FormDialogProps, FormField, type GridItem, HighlightText, type HostEventHandler, type HostEvents, type HostFile, type HostLanguage, HostProvider, type HostRequest, type HostRequestInit, type HostRequestOptions, type HostScope, HostSlot, IconButton, type IconButtonProps, IconTile, type IconTileProps, Indicator, type IndicatorProps, InlineAlert, type InlineAlertProps, KanbanBoard, type KanbanBoardProps, type KanbanColumn, type KanbanItem, type KanbanLane, type KanbanMove, type LinkComponent, Loading, type LoadingProps, LoadingState, MotionProvider, type MotionSetting, type MotionState, Nudge, type NudgeProps, PageHeader, type PageHeaderProps, PageTitleProvider, Pagination, type PaginationProps, Panel, type PanelProps, PanelTone, type Particle, PathChips, type PathChipsProps, PersonChip, type PersonChipProps, type PlacedCard, PluginTextsProvider, type Pose, Presence, PresenceItem, type PresenceItemProps, PresenceList, type PresenceListProps, type PresenceProps, Pressable, type PressableProps, PriorityMark, type PriorityMarkProps, type PropertyItem, PropertyList, type PropertyListProps, type QueryConditionJson, type QueryExportFormat, type QueryField, type QueryGroup, type QueryJson, type QueryListLabels, type QueryNodeJson, type QueryRow, type QuerySuggestion, type QuerySuggestions, type QueryValueEditor, QueryableList, type QueryableListError, type QueryableListExport, type QueryableListProps, type QueryableListState, type QueryableListView, type QueueProgress, RecordKey, type RecordKeyProps, type RegisterSlotSave, Reveal, RevealItem, type RevealItemProps, type RevealProps, SHOWN, STEP_UP_REQUIRED, STRONG_FACTOR_REQUIRED, type Scale, SearchInput, type SearchInputProps, type SectionMove, SegmentedControl, type SegmentedControlProps, type SegmentedItem, SelectField, type SelectFieldProps, type SelectOption, type SettingsArea, SettingsLayout, type SettingsLayoutProps, type SettingsPage, type SettingsSection, SlideItem, type SlideItemProps, SlideList, type SlideListProps, type SlotSave, type SortDirection, type SortableSection, SortableSections, type SortableSectionsProps, type StatusCategory, StatusPill, type StatusPillProps, type StatusTone, StepUpDialog, type StepUpHandler, type StepUpNeed, Swap, type SwapProps, SwitchField, type SwitchFieldProps, TITLE_SEPARATOR, TextBone, type TextBoneProps, TextSlot, type TextSlotProps, type TimelineCardItem, TimelineCards, type TimelineCardsProps, TimelineChart, type TimelineChartProps, type TimelineItem, type TimelineRow, type TimelineScale, type TitleParts, Toaster, Tooltip, type TooltipProps, UPLOADS_AT_ONCE, type UploadJob, UploadList, type UploadListProps, type UploadRow, type UploadState, abpConfig, arriveCss, asMotionSetting, avatarPalette, basicConditions, boneWidth, burst, compactLayout, compareOrdinal, composeTitle, covers, createAbpSystem, createAreaTexts, createHostEvents, createHostRequest, createPasskey, curves, defaultBrand, defaultLabels, defaultQueryListLabels, directionOf, droppedFiles, errorText, fileNameOf, findSettingsPage, folderOf, foldersFor, formatDateTime, formatMessage, formatNumber, getPasskey, ghostCss, groupKey, heavierFirst, hiddenPose, inSections, isStepUp, looksLikeCode, durations as motionDurations, needsStepUp, notify, pageList, partsOf, passkeysSupported, pastedName, placeCards, placeItem, priorityLevel, progressOf, readAbpError, readEvents, refusal, requestStepUp, setStepUpHandler, settingsArea, shineCss, springs, staggerDelay, stepUpNeedOf, targetOf, toStart, toaster, useAbpLabels, useAbpLocale, useAbpTimeZone, useApiAction, useApiDownload, useApiQuery, useAreaEvents, useAreaRequest, useArriving, useCan, useCelebrate, useColorMode, useConfirm, useDropZone, useFilesOverPage, useFormatters, useHost, useHostLanguages, useLinkComponent, useLoading, useMe, useMotionSetting, useNames, useNavigate, useOptionalHost, usePageDrop, usePageTitle, usePageTitleParts, usePageTitleSite, usePastedFiles, usePluginTexts, useProductName, useSlotSaves, useTokenVar };
2907
+ export { ABP_UI_VERSION, AbpApiError, type AbpBrand, type AbpHost, type AbpLabels, type AbpListOptions, AbpProvider, type AbpProviderProps, type AbpSystemOptions, type ApiQuery, AppLink, type AppLinkProps, AppShell, type AppShellBrand, type AppShellNavItem, type AppShellNavSection, type AppShellPlace, type AppShellProps, type AppShellSidebar, type AreaTexts, type Arrival, ArriveOnChange, type ArriveOnChangeProps, AttentionChip, type AttentionChipProps, type AvatarPerson, AvatarStack, type AvatarStackProps, Bone, type BoneProps, type BreadcrumbItem, Breadcrumbs, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarGrid, type CalendarGridProps, type CalendarItem, type CardDates, CategoryProgress, type CategoryProgressProps, type CelebrateTarget, Chart, type ChartProps, type ChartSeries, CheckboxField, type CheckboxFieldProps, Collapse, type CollapseProps, type ColorMode, ColorModeProvider, ColorModeToggle, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, ConfirmProvider, CountBadge, type CountBadgeProps, Counter, type CounterProps, DEFAULT_PAGE_SIZE, DashboardGrid, type DashboardGridProps, DataTable, type DataTableColumn, type DataTableProps, type DataTableSelection, type DataTableSort, type Direction, DirectionalIcon, DropHint, type DropHintProps, type DropZoneOptions, type DropZoneState, type DroppedFile, EMPTY_VALUE, EmptyState, type EmptyStateProps, FadeIn, type FadeInProps, Field, type FieldProps, FileDropArea, type FileDropAreaProps, FormDialog, type FormDialogProps, FormField, type GridItem, HighlightText, type HostEventHandler, type HostEvents, type HostFile, type HostLanguage, HostProvider, type HostRequest, type HostRequestInit, type HostRequestOptions, type HostScope, HostSlot, IconButton, type IconButtonProps, IconTile, type IconTileProps, Indicator, type IndicatorProps, InlineAlert, type InlineAlertProps, KanbanBoard, type KanbanBoardProps, type KanbanColumn, type KanbanItem, type KanbanLane, type KanbanMove, type LinkComponent, type ListPage, type ListQuery, type ListSource, type ListState, Loading, type LoadingProps, LoadingState, MotionProvider, type MotionSetting, type MotionState, Nudge, type NudgeProps, PageHeader, type PageHeaderProps, PageTitleProvider, Pagination, type PaginationProps, Panel, type PanelProps, PanelTone, type Particle, PathChips, type PathChipsProps, PersonChip, type PersonChipProps, type PlacedCard, PluginTextsProvider, type Pose, Presence, PresenceItem, type PresenceItemProps, PresenceList, type PresenceListProps, type PresenceProps, Pressable, type PressableProps, PriorityMark, type PriorityMarkProps, type PropertyItem, PropertyList, type PropertyListProps, type QueryConditionJson, type QueryExportFormat, type QueryField, type QueryGroup, type QueryJson, type QueryListLabels, type QueryNodeJson, type QueryRow, type QuerySuggestion, type QuerySuggestions, type QueryValueEditor, QueryableList, type QueryableListError, type QueryableListExport, type QueryableListProps, type QueryableListState, type QueryableListView, type QueueProgress, RecordKey, type RecordKeyProps, type RegisterSlotSave, Reveal, RevealItem, type RevealItemProps, type RevealProps, SHOWN, STEP_UP_REQUIRED, STRONG_FACTOR_REQUIRED, type Scale, SearchInput, type SearchInputProps, type SectionMove, SegmentedControl, type SegmentedControlProps, type SegmentedItem, SelectField, type SelectFieldProps, type SelectOption, type SettingsArea, SettingsLayout, type SettingsLayoutProps, type SettingsPage, type SettingsSection, SlideItem, type SlideItemProps, SlideList, type SlideListProps, type SlotSave, type SortDirection, type SortableSection, SortableSections, type SortableSectionsProps, type StatusCategory, StatusPill, type StatusPillProps, type StatusTone, StepUpDialog, type StepUpHandler, type StepUpNeed, Swap, type SwapProps, SwitchField, type SwitchFieldProps, TITLE_SEPARATOR, TextBone, type TextBoneProps, TextSlot, type TextSlotProps, type TimelineCardItem, TimelineCards, type TimelineCardsProps, TimelineChart, type TimelineChartProps, type TimelineItem, type TimelineRow, type TimelineScale, type TitleParts, Toaster, Tooltip, type TooltipProps, UPLOADS_AT_ONCE, type UploadJob, UploadList, type UploadListProps, type UploadRow, type UploadState, abpConfig, abpListParams, abpListSource, arriveCss, asMotionSetting, avatarPalette, basicConditions, boneWidth, burst, compactLayout, compareOrdinal, composeTitle, covers, createAbpSystem, createAreaTexts, createHostEvents, createHostRequest, createPasskey, curves, defaultBrand, defaultLabels, defaultQueryListLabels, directionOf, droppedFiles, emptyQuery, errorText, fileNameOf, findSettingsPage, folderOf, foldersFor, formatDateTime, formatMessage, formatNumber, getPasskey, ghostCss, groupKey, heavierFirst, hiddenPose, inSections, isStepUp, looksLikeCode, durations as motionDurations, needsStepUp, notify, pageCount, pageList, partsOf, passkeysSupported, pastedName, placeCards, placeItem, priorityLevel, progressOf, readAbpError, readEvents, refusal, requestStepUp, setStepUpHandler, settingsArea, shineCss, springs, staggerDelay, stepUpNeedOf, targetOf, toStart, toaster, useAbpLabels, useAbpLocale, useAbpTimeZone, useApiAction, useApiDownload, useApiQuery, useAreaEvents, useAreaListSource, useAreaRequest, useArriving, useCan, useCelebrate, useColorMode, useConfirm, useDropZone, useFilesOverPage, useFormatters, useHost, useHostLanguages, useLinkComponent, useListState, useLoading, useMe, useMotionSetting, useNames, useNavigate, useOptionalHost, usePageDrop, usePageTitle, usePageTitleParts, usePageTitleSite, usePastedFiles, usePluginTexts, useProductName, useSlotSaves, useTokenVar };