@kronor/dtv 11.0.0 → 13.0.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/README.md +8 -1
- package/dist/cli/config/loadConfig.js +7 -6
- package/dist/index.es.js +30329 -37038
- package/dist/types/App.d.ts +11 -4
- package/dist/types/components/AIAssistantForm.d.ts +1 -1
- package/dist/types/components/ActionButtons.d.ts +5 -14
- package/dist/types/components/Autocomplete.d.ts +2 -2
- package/dist/types/components/FilterForm.d.ts +2 -2
- package/dist/types/components/FilterStatePills.d.ts +1 -1
- package/dist/types/components/LoadingOverlay.d.ts +1 -1
- package/dist/types/components/PhoneNumberFilter.d.ts +2 -1
- package/dist/types/components/SavedFilterList.d.ts +1 -1
- package/dist/types/components/SpeechInput.d.ts +1 -1
- package/dist/types/components/Table.d.ts +1 -1
- package/dist/types/components/TablePagination.d.ts +1 -1
- package/dist/types/components/UserPreferencesPanel.d.ts +1 -1
- package/dist/types/framework/actions.d.ts +5 -2
- package/dist/types/framework/analytics.d.ts +1 -1
- package/dist/types/framework/cell-renderer-components/CurrencyAmount.d.ts +1 -1
- package/dist/types/framework/cell-renderer-components/LayoutHelpers.d.ts +4 -4
- package/dist/types/framework/cell-renderer-components/Link.d.ts +1 -1
- package/dist/types/framework/cell-renderer-components/Mapping.d.ts +1 -1
- package/dist/types/framework/data.d.ts +1 -3
- package/dist/types/framework/fetch-error.d.ts +6 -2
- package/dist/types/framework/filters.d.ts +1 -1
- package/dist/types/framework/graphql-client.d.ts +28 -0
- package/dist/types/framework/state/app-state.d.ts +32 -1
- package/dist/types/lib/index.d.ts +5 -0
- package/dist/types/views/payment-requests/components/NoRowsExtendDateRange.d.ts +1 -1
- package/docs/analytics.md +7 -6
- package/docs/api/runtime.md +2 -0
- package/package.json +11 -12
package/dist/types/App.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AIIntegration, ModifyAiFilterPromptFn } from './components/aiAssistant';
|
|
2
|
-
import { type RequestHeaders } from './framework/
|
|
2
|
+
import { type RequestHeaders } from './framework/graphql-client';
|
|
3
3
|
import { type DTVAnalytics } from './framework/analytics';
|
|
4
4
|
import { View, type SimplifiedRow } from './framework/view';
|
|
5
5
|
import type { UserDataJson } from './framework/user-data';
|
|
@@ -14,8 +14,8 @@ export interface AppProps<V extends View = View> {
|
|
|
14
14
|
* resolved (and awaited) before each request — useful for a short-lived
|
|
15
15
|
* bearer token. The function may be async, so a host that tracks its
|
|
16
16
|
* token's expiry can refresh it proactively (e.g. against an endpoint)
|
|
17
|
-
* before the request is sent. See `
|
|
18
|
-
* framework/
|
|
17
|
+
* before the request is sent. See `createGraphQLClient` in
|
|
18
|
+
* framework/graphql-client.ts.
|
|
19
19
|
*/
|
|
20
20
|
requestHeaders: RequestHeaders;
|
|
21
21
|
/**
|
|
@@ -95,6 +95,13 @@ export type DTVAPI = {
|
|
|
95
95
|
collapseAll: () => void;
|
|
96
96
|
expandAll: () => void;
|
|
97
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Runs the action of `actions` with this `id` as a click on its button would: the button
|
|
100
|
+
* shows it running, a run while it is running or disabled does nothing, and it reports the
|
|
101
|
+
* same analytics and failure toast. For a host that starts an action from a control of its
|
|
102
|
+
* own, e.g. with the toolbar hidden. Does nothing, with a warning, for an id no action has.
|
|
103
|
+
*/
|
|
104
|
+
runAction: (id: string) => void;
|
|
98
105
|
};
|
|
99
|
-
declare function App<V extends View = View>({ graphqlHost, requestHeaders, aiIntegration, showViewsMenu, showViewTitle, showCsvExportButton, showPopoutButton, views: viewsFromProps, viewsJson, externalRuntime, isOverlay, onCloseOverlay, syncFilterStateToUrl, rowSelection, actions, rowClassFunction, rowsPerPageOptions, userData, analytics, modifyAiFilterPrompt, apiRef }: AppProps<V>): import("react
|
|
106
|
+
declare function App<V extends View = View>({ graphqlHost, requestHeaders, aiIntegration, showViewsMenu, showViewTitle, showCsvExportButton, showPopoutButton, views: viewsFromProps, viewsJson, externalRuntime, isOverlay, onCloseOverlay, syncFilterStateToUrl, rowSelection, actions, rowClassFunction, rowsPerPageOptions, userData, analytics, modifyAiFilterPrompt, apiRef }: AppProps<V>): import("react").JSX.Element;
|
|
100
107
|
export default App;
|
|
@@ -14,5 +14,5 @@ interface AIAssistantFormProps {
|
|
|
14
14
|
/** Optional hook to modify the AI prompt template before it is sent to the AI provider. */
|
|
15
15
|
modifyAiFilterPrompt?: ModifyAiFilterPromptFn;
|
|
16
16
|
}
|
|
17
|
-
export default function AIAssistantForm({ setFilterState, selectedView, aiIntegration, toast, setShowFilterForm, modifyAiFilterPrompt }: AIAssistantFormProps): import("react
|
|
17
|
+
export default function AIAssistantForm({ setFilterState, selectedView, aiIntegration, toast, setShowFilterForm, modifyAiFilterPrompt }: AIAssistantFormProps): import("react").JSX.Element;
|
|
18
18
|
export {};
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import { ActionDefinition
|
|
2
|
-
import { View } from '../framework/view';
|
|
3
|
-
import type { ShowToastFn } from '../framework/toast';
|
|
4
|
-
import { FilterState } from '../framework/state';
|
|
1
|
+
import type { ActionDefinition } from '../framework/actions';
|
|
5
2
|
export interface ActionButtonsProps {
|
|
6
3
|
actions: ActionDefinition[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
setFilterState: (next: FilterState) => void;
|
|
11
|
-
refetch: () => void;
|
|
12
|
-
applyFilters: () => void;
|
|
13
|
-
showToast: ShowToastFn;
|
|
14
|
-
shownRows: ShownRows | null;
|
|
15
|
-
userData: ActionUserDataAPI;
|
|
4
|
+
/** Whether the action with this id is running: its button shows it, and cannot be clicked. */
|
|
5
|
+
isRunning: (id: string) => boolean;
|
|
6
|
+
onClick: (id: string) => void;
|
|
16
7
|
}
|
|
17
|
-
export declare function ActionButtons({ actions,
|
|
8
|
+
export declare function ActionButtons({ actions, isRunning, onClick }: ActionButtonsProps): import("react").JSX.Element;
|
|
18
9
|
export default ActionButtons;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLClient } from "graphql-
|
|
1
|
+
import type { GraphQLClient } from "../framework/graphql-client";
|
|
2
2
|
import { SuggestionFetcher } from "../framework/filters";
|
|
3
3
|
import './Autocomplete.css';
|
|
4
4
|
type AutocompleteProps = {
|
|
@@ -12,5 +12,5 @@ type AutocompleteProps = {
|
|
|
12
12
|
multiple?: boolean;
|
|
13
13
|
selectionLimit?: number;
|
|
14
14
|
};
|
|
15
|
-
export declare const Autocomplete: ({ value, placeholder, onChange, graphqlClient, suggestionFetcher, queryMinLength, suggestionLabelField, multiple, selectionLimit }: AutocompleteProps) => import("react
|
|
15
|
+
export declare const Autocomplete: ({ value, placeholder, onChange, graphqlClient, suggestionFetcher, queryMinLength, suggestionLabelField, multiple, selectionLimit }: AutocompleteProps) => import("react").JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FilterGroups } from '../framework/filters';
|
|
2
2
|
import { SavedFilter } from '../framework/saved-filters';
|
|
3
|
-
import { GraphQLClient } from 'graphql-
|
|
3
|
+
import type { GraphQLClient } from '../framework/graphql-client';
|
|
4
4
|
import { FilterState } from '../framework/state';
|
|
5
5
|
import { FilterDisplayState } from '../framework/filter-display-state';
|
|
6
6
|
interface FilterFormProps {
|
|
@@ -17,5 +17,5 @@ interface FilterFormProps {
|
|
|
17
17
|
onSubmit: (trigger: 'submit' | 'reset') => void;
|
|
18
18
|
graphqlClient: GraphQLClient;
|
|
19
19
|
}
|
|
20
|
-
declare function FilterForm({ filterGroups, filterState, setFilterState, onSaveFilter, onUpdateFilter, onShareFilter, savedFilters, displayState, onFilterGroupExpandedChange, onSubmit, graphqlClient }: FilterFormProps): import("react
|
|
20
|
+
declare function FilterForm({ filterGroups, filterState, setFilterState, onSaveFilter, onUpdateFilter, onShareFilter, savedFilters, displayState, onFilterGroupExpandedChange, onSubmit, graphqlClient }: FilterFormProps): import("react").JSX.Element;
|
|
21
21
|
export default FilterForm;
|
|
@@ -6,5 +6,5 @@ interface FilterStatePillsProps {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
label?: string;
|
|
8
8
|
}
|
|
9
|
-
export default function FilterStatePills({ items, onRemove, className, label }: FilterStatePillsProps): import("react
|
|
9
|
+
export default function FilterStatePills({ items, onRemove, className, label }: FilterStatePillsProps): import("react").JSX.Element | null;
|
|
10
10
|
export {};
|
|
@@ -6,5 +6,5 @@ type LoadingOverlayProps = {
|
|
|
6
6
|
/** Optional custom content inside the overlay; if provided, `message` is ignored */
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
};
|
|
9
|
-
export default function LoadingOverlay({ message, className, children }: LoadingOverlayProps):
|
|
9
|
+
export default function LoadingOverlay({ message, className, children }: LoadingOverlayProps): React.JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
export interface PhoneNumberFilterProps {
|
|
2
3
|
value?: string;
|
|
3
4
|
onChange?: (value: string) => void;
|
|
4
5
|
}
|
|
5
|
-
export declare function PhoneNumberFilter({ value, onChange }: PhoneNumberFilterProps):
|
|
6
|
+
export declare function PhoneNumberFilter({ value, onChange }: PhoneNumberFilterProps): React.JSX.Element;
|
|
@@ -10,5 +10,5 @@ interface SavedFilterListProps {
|
|
|
10
10
|
visible: boolean;
|
|
11
11
|
filterGroups: FilterGroups;
|
|
12
12
|
}
|
|
13
|
-
export default function SavedFilterList({ savedFilters, onFilterDelete, onFilterLoad, onFilterApply, onFilterShare, visible, filterGroups }: SavedFilterListProps): import("react
|
|
13
|
+
export default function SavedFilterList({ savedFilters, onFilterDelete, onFilterLoad, onFilterApply, onFilterShare, visible, filterGroups }: SavedFilterListProps): import("react").JSX.Element | null;
|
|
14
14
|
export {};
|
|
@@ -2,5 +2,5 @@ interface SpeechInputProps {
|
|
|
2
2
|
value: string;
|
|
3
3
|
onChange: (value: string) => void;
|
|
4
4
|
}
|
|
5
|
-
declare function SpeechInput({ value, onChange }: SpeechInputProps): import("react
|
|
5
|
+
declare function SpeechInput({ value, onChange }: SpeechInputProps): import("react").JSX.Element;
|
|
6
6
|
export default SpeechInput;
|
|
@@ -38,5 +38,5 @@ type TableProps<Row> = {
|
|
|
38
38
|
ordering?: DataOrdering | null;
|
|
39
39
|
onOrderingChange?: (ordering: DataOrdering | null) => void;
|
|
40
40
|
};
|
|
41
|
-
declare function Table<Row extends object = SimplifiedRow>({ viewId, columns, hiddenColumnIds, paginationKey, data, rawRows, rowExpansion, loadLazyRowExpansionData, noRowsComponent, setFilterState, filterState, applyFilters, ref, rowSelectionType: selectionType, selectedRows, onSelectedRowsChange, rowClassFunction, onRowExpansionApiChange, ordering, onOrderingChange }: TableProps<Row>):
|
|
41
|
+
declare function Table<Row extends object = SimplifiedRow>({ viewId, columns, hiddenColumnIds, paginationKey, data, rawRows, rowExpansion, loadLazyRowExpansionData, noRowsComponent, setFilterState, filterState, applyFilters, ref, rowSelectionType: selectionType, selectedRows, onSelectedRowsChange, rowClassFunction, onRowExpansionApiChange, ordering, onOrderingChange }: TableProps<Row>): React.JSX.Element;
|
|
42
42
|
export default Table;
|
|
@@ -12,5 +12,5 @@ interface TablePaginationProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* Pagination footer including previous/next buttons and a rows-per-page selector.
|
|
14
14
|
*/
|
|
15
|
-
declare function TablePagination({ onPageChange, onPrevPage, hasNextPage, hasPrevPage, currentPage, rowsPerPage, actualRows, onRowsPerPageChange, rowsPerPageOptions }: TablePaginationProps): import("react
|
|
15
|
+
declare function TablePagination({ onPageChange, onPrevPage, hasNextPage, hasPrevPage, currentPage, rowsPerPage, actualRows, onRowsPerPageChange, rowsPerPageOptions }: TablePaginationProps): import("react").JSX.Element;
|
|
16
16
|
export default TablePagination;
|
|
@@ -15,5 +15,5 @@ interface UserPreferencesPanelProps {
|
|
|
15
15
|
onSetSyncFilterStateToUserData: (viewId: ViewId, enabled: boolean) => Promise<ViewData>;
|
|
16
16
|
onSetSyncOrderingToUserData: (viewId: ViewId, enabled: boolean) => Promise<ViewData>;
|
|
17
17
|
}
|
|
18
|
-
export default function UserPreferencesPanel({ visible, preferences, onChangePreferences, currentView, viewData, columnDefinitions, onSetHiddenColumns, onSetSyncFilterStateToUserData, onSetSyncOrderingToUserData }: UserPreferencesPanelProps): import("react
|
|
18
|
+
export default function UserPreferencesPanel({ visible, preferences, onChangePreferences, currentView, viewData, columnDefinitions, onSetHiddenColumns, onSetSyncFilterStateToUserData, onSetSyncOrderingToUserData }: UserPreferencesPanelProps): import("react").JSX.Element | null;
|
|
19
19
|
export {};
|
|
@@ -83,8 +83,11 @@ export interface ActionAPI {
|
|
|
83
83
|
}
|
|
84
84
|
export interface ActionDefinition {
|
|
85
85
|
label: string;
|
|
86
|
-
/**
|
|
87
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Identifies the action among the table's actions: `DTVAPI.runAction` finds it by it, and
|
|
88
|
+
* analytics events name it. Unlike the label, it does not change with wording.
|
|
89
|
+
*/
|
|
90
|
+
id: string;
|
|
88
91
|
onClick: (api: ActionAPI) => void | Promise<void>;
|
|
89
92
|
icon?: string;
|
|
90
93
|
/** Optional PrimeReact Button badge value. */
|
|
@@ -203,7 +203,7 @@ export type DTVAnalyticsEventPayload =
|
|
|
203
203
|
readonly error?: DTVAnalyticsUserDataError;
|
|
204
204
|
}) | (DTVAnalyticsSpan & {
|
|
205
205
|
readonly type: 'action';
|
|
206
|
-
/** The action's `id
|
|
206
|
+
/** The action's `id`. */
|
|
207
207
|
readonly action: string;
|
|
208
208
|
readonly selectedRows: number;
|
|
209
209
|
readonly outcome: 'succeeded' | 'failed';
|
|
@@ -6,5 +6,5 @@ export interface CurrencyAmountProps {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
fractionDigitsOverride?: number;
|
|
8
8
|
}
|
|
9
|
-
export declare function CurrencyAmount({ amount, currency, locale, options, className, fractionDigitsOverride }: CurrencyAmountProps): import("react
|
|
9
|
+
export declare function CurrencyAmount({ amount, currency, locale, options, className, fractionDigitsOverride }: CurrencyAmountProps): import("react").JSX.Element | null;
|
|
10
10
|
export default CurrencyAmount;
|
|
@@ -6,18 +6,18 @@ export declare function FlexRow({ gap, className, align, justify, wrap, children
|
|
|
6
6
|
justify?: string;
|
|
7
7
|
wrap?: string | boolean;
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
-
}):
|
|
9
|
+
}): React.JSX.Element;
|
|
10
10
|
export declare function FlexColumn({ gap, className, align, justify, children }: {
|
|
11
11
|
gap?: string;
|
|
12
12
|
className?: string;
|
|
13
13
|
align?: string;
|
|
14
14
|
justify?: string;
|
|
15
15
|
children: React.ReactNode;
|
|
16
|
-
}):
|
|
17
|
-
export declare function Spacer():
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
export declare function Spacer(): React.JSX.Element;
|
|
18
18
|
export declare function DateTime({ date, locale, options, className }: {
|
|
19
19
|
date: string;
|
|
20
20
|
locale?: string;
|
|
21
21
|
options?: Intl.DateTimeFormatOptions;
|
|
22
22
|
className?: string;
|
|
23
|
-
}):
|
|
23
|
+
}): React.JSX.Element | null;
|
|
@@ -7,5 +7,5 @@ export interface LinkProps {
|
|
|
7
7
|
* A reusable Link component for use throughout the application.
|
|
8
8
|
* Provides consistent styling and behavior for links.
|
|
9
9
|
*/
|
|
10
|
-
export declare function Link({ text, href, className }: LinkProps): import("react
|
|
10
|
+
export declare function Link({ text, href, className }: LinkProps): import("react").JSX.Element;
|
|
11
11
|
export default Link;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { GraphQLClient, type RequestMiddleware } from 'graphql-request';
|
|
2
1
|
import { HasuraOrderBy } from '../framework/graphql';
|
|
3
2
|
import { View } from '../framework/view';
|
|
4
3
|
import type { ColumnDefinition, ColumnId, FieldQuery } from '../framework/column-definition';
|
|
5
4
|
import { FilterState } from './state';
|
|
6
5
|
import type { DataOrdering } from './data-ordering';
|
|
6
|
+
import type { GraphQLClient } from './graphql-client';
|
|
7
7
|
export type FlattenedDataRow = Record<ColumnId, Record<string, unknown>>;
|
|
8
8
|
export interface FetchDataResult {
|
|
9
9
|
rows: Record<string, unknown>[];
|
|
10
10
|
flattenedRows: FlattenedDataRow[];
|
|
11
11
|
}
|
|
12
12
|
export type PaginationCursor = Record<string, unknown> | null;
|
|
13
|
-
export type RequestHeaders = HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
14
|
-
export declare function resolveHeadersMiddleware(requestHeaders?: RequestHeaders): RequestMiddleware;
|
|
15
13
|
export declare function getPaginationCursorValue(cursor: PaginationCursor, field: string): unknown;
|
|
16
14
|
export declare function getPaginationOrderFieldQueries(view: View): FieldQuery[];
|
|
17
15
|
export declare const buildGraphQLQueryVariables: (view: View, filterState: FilterState, rowLimit: number, cursor: PaginationCursor, ordering?: DataOrdering | null) => {
|
|
@@ -31,5 +31,9 @@ export declare class FetchError extends Error {
|
|
|
31
31
|
cause?: unknown;
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
/** Tells what kind of failure
|
|
35
|
-
export declare function
|
|
34
|
+
/** Tells what kind of failure a response with a status other than success, or with GraphQL errors, is. */
|
|
35
|
+
export declare function fetchErrorFromResponse(status: number, errors: readonly unknown[], options?: {
|
|
36
|
+
cause?: unknown;
|
|
37
|
+
}): FetchError;
|
|
38
|
+
/** Tells what kind of failure an error a request rejected with is, keeping a `FetchError` as it is. */
|
|
39
|
+
export declare function toFetchError(error: unknown): FetchError;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GraphQLClient } from 'graphql-
|
|
2
|
+
import type { GraphQLClient } from './graphql-client';
|
|
3
3
|
import type { FieldPath } from '@kronor/hasura-graphql';
|
|
4
4
|
import { HasuraFilterExpression } from './graphql';
|
|
5
5
|
import * as FilterValue from './filterValue';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type RequestHeaders = HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
2
|
+
export type GraphQLVariables = Record<string, unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* Sends GraphQL documents to the host's endpoint. The table uses it for its rows and lazy row
|
|
5
|
+
* expansions, and hands it to suggestion fetchers.
|
|
6
|
+
*/
|
|
7
|
+
export interface GraphQLClient {
|
|
8
|
+
/**
|
|
9
|
+
* Posts the document and resolves to the response's `data`. Rejects with a `FetchError`
|
|
10
|
+
* when the response has GraphQL errors, a status other than success, or does not arrive,
|
|
11
|
+
* and with the signal's reason when the request is aborted.
|
|
12
|
+
*/
|
|
13
|
+
request<Data = unknown>(document: string, variables?: GraphQLVariables, options?: {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}): Promise<Data>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A client for the GraphQL endpoint at `url`.
|
|
19
|
+
*
|
|
20
|
+
* `requestHeaders` is resolved before EVERY request the client makes — table fetches, lazy row
|
|
21
|
+
* expansion, and the filter suggestion/autocomplete fetchers that call `client.request`
|
|
22
|
+
* directly — each with a freshly-resolved token. That is what lets a host keep a short-lived
|
|
23
|
+
* token fresh proactively: it resolves (and, if needed, refreshes) the token immediately before
|
|
24
|
+
* each request. A token refreshed ahead of expiry never produces an auth error, so there is
|
|
25
|
+
* deliberately no reactive retry; a genuinely dead session surfaces as a normal GraphQL error
|
|
26
|
+
* for the host to handle (e.g. reload to login).
|
|
27
|
+
*/
|
|
28
|
+
export declare function createGraphQLClient(url: string, requestHeaders?: RequestHeaders): GraphQLClient;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DTVAnalyticsEventPayload, FiltersAppliedTrigger, ReportedEvent } from '../analytics';
|
|
1
|
+
import type { DTVAnalyticsError, DTVAnalyticsEventPayload, DTVAnalyticsSpan, FiltersAppliedTrigger, ReportedEvent } from '../analytics';
|
|
2
2
|
import type { ViewDefinition } from '../analytics-emitter';
|
|
3
3
|
import type { FetchDataResult } from '../data';
|
|
4
4
|
import { type DataOrdering } from '../data-ordering';
|
|
@@ -40,6 +40,10 @@ export interface AppState {
|
|
|
40
40
|
readonly showPopout: boolean;
|
|
41
41
|
/** The rows the user selected, as the table hands them out; empty when row selection is off. */
|
|
42
42
|
readonly selectedRows: readonly unknown[];
|
|
43
|
+
/** The toolbar actions running, by id, with how many rows were selected when each started. */
|
|
44
|
+
readonly runningActions: ReadonlyMap<string, {
|
|
45
|
+
readonly selectedRows: number;
|
|
46
|
+
}>;
|
|
43
47
|
/** The AI filter assistant filled the draft since filters were last applied. */
|
|
44
48
|
readonly aiAssistedDraft: boolean;
|
|
45
49
|
/** Where the filter state the table opened with came from, until the view settles. */
|
|
@@ -58,6 +62,10 @@ export interface AppStateEnv {
|
|
|
58
62
|
readonly snapshotDiff: (viewId: ViewId) => SnapshotDiff | null;
|
|
59
63
|
/** What a view's rows are read with now; `null` for a view the table does not have. */
|
|
60
64
|
readonly viewQuery: (viewId: ViewId) => ViewQuery | null;
|
|
65
|
+
/** The toolbar action with this id; `null` for an id no action has. */
|
|
66
|
+
readonly action: (id: string) => {
|
|
67
|
+
readonly disabled: boolean;
|
|
68
|
+
} | null;
|
|
61
69
|
}
|
|
62
70
|
/** What applies filters by a message. The table opening with filters is told by the state. */
|
|
63
71
|
export type ApplyTrigger = Extract<FiltersAppliedTrigger, 'submit' | 'reset' | 'pillRemoved' | 'savedFilter' | 'api'>;
|
|
@@ -145,6 +153,19 @@ export type Msg =
|
|
|
145
153
|
readonly tag: 'rowsSelected';
|
|
146
154
|
readonly rows: readonly unknown[];
|
|
147
155
|
}
|
|
156
|
+
/** Run the toolbar action with this id: its button was clicked, or the host asked (`DTVAPI.runAction`). */
|
|
157
|
+
| {
|
|
158
|
+
readonly tag: 'actionRequested';
|
|
159
|
+
readonly id: string;
|
|
160
|
+
}
|
|
161
|
+
/** The run of an action ended: its promise settled, or it threw. */
|
|
162
|
+
| {
|
|
163
|
+
readonly tag: 'actionEnded';
|
|
164
|
+
readonly id: string;
|
|
165
|
+
readonly span: DTVAnalyticsSpan;
|
|
166
|
+
readonly outcome: 'succeeded' | 'failed';
|
|
167
|
+
readonly error?: DTVAnalyticsError;
|
|
168
|
+
}
|
|
148
169
|
/** A component or the user data reported an analytics event, of the selected view. */
|
|
149
170
|
| {
|
|
150
171
|
readonly tag: 'reported';
|
|
@@ -172,6 +193,16 @@ export type Command = {
|
|
|
172
193
|
| {
|
|
173
194
|
readonly tag: 'notifyRowSelectionCleared';
|
|
174
195
|
}
|
|
196
|
+
/** Call the `onClick` of the action with this id, and send `actionEnded` once it ends. */
|
|
197
|
+
| {
|
|
198
|
+
readonly tag: 'runAction';
|
|
199
|
+
readonly id: string;
|
|
200
|
+
}
|
|
201
|
+
/** Warn the host that it asked to run an action no action has the id of. */
|
|
202
|
+
| {
|
|
203
|
+
readonly tag: 'warnUnknownAction';
|
|
204
|
+
readonly id: string;
|
|
205
|
+
}
|
|
175
206
|
/** Report `event` as an analytics event of `viewId`. */
|
|
176
207
|
| {
|
|
177
208
|
readonly tag: 'track';
|
|
@@ -25,10 +25,15 @@ export { CellRenderer } from '../dsl/cellRenderer';
|
|
|
25
25
|
export { FilterTransform } from '../dsl/filterTransform';
|
|
26
26
|
export { rowType } from '../dsl/columns';
|
|
27
27
|
export type { UserDataJson } from '../framework/user-data';
|
|
28
|
+
export { decodeUserData } from '../framework/user-data';
|
|
29
|
+
export { CURRENT_USERDATA_FORMAT_REVISION } from '../framework/user-data.migrations';
|
|
30
|
+
export type { UserDataDecodeError, UserDataDecoding } from '../framework/user-data';
|
|
31
|
+
export type { UndecodedViewData, UndecodedSavedFilter, UserDataWithUndecodedViews } from '../framework/user-data-undecoded';
|
|
28
32
|
export type { UserDataLoadAPI, UserDataSaveAPI, UserDataLoadCallback, UserDataSaveCallback } from '../framework/user-data-manager';
|
|
29
33
|
export type { ActionDefinition, ActionAPI, ActionUserDataAPI, ShownRows } from '../framework/actions';
|
|
30
34
|
export type { DTVAnalytics, DTVAnalyticsEvent, DTVAnalyticsEventBase, DTVAnalyticsEventPayload, DTVAnalyticsEventType, DTVAnalyticsSpan, DTVAnalyticsError, DTVAnalyticsPanel, DTVAnalyticsResets, DTVAnalyticsRetainedView, DTVAnalyticsUserDataError, FiltersAppliedTrigger, FetchReason } from '../framework/analytics';
|
|
31
35
|
export type { FetchErrorInfo, FetchErrorKind } from '../framework/fetch-error';
|
|
36
|
+
export type { GraphQLClient, GraphQLVariables, RequestHeaders } from '../framework/graphql-client';
|
|
32
37
|
export type { HasuraFilterObject, HasuraOperator, HasuraOperatorFor, HasuraComparable, HasuraFilterExpression, GraphQLVariable, HasuraOrderBy, GraphQLSelectionSetItem, GraphQLSelectionSet, GraphQLQueryAST, } from '../framework/graphql';
|
|
33
38
|
export type { ColumnAliasedQueryError } from '../framework/graphql/query';
|
|
34
39
|
export type { DataOrdering } from '../framework/data-ordering';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { NoRowsComponentProps } from "../../../framework/view";
|
|
2
|
-
declare const NoRowsExtendDateRange: ({ updateFilterById, applyFilters }: Pick<NoRowsComponentProps, "updateFilterById" | "applyFilters">) => import("react
|
|
2
|
+
declare const NoRowsExtendDateRange: ({ updateFilterById, applyFilters }: Pick<NoRowsComponentProps, "updateFilterById" | "applyFilters">) => import("react").JSX.Element;
|
|
3
3
|
export default NoRowsExtendDateRange;
|
package/docs/analytics.md
CHANGED
|
@@ -414,12 +414,13 @@ When the stored data is in a format this version cannot read, the table reports
|
|
|
414
414
|
|
|
415
415
|
#### `action`
|
|
416
416
|
|
|
417
|
-
An action
|
|
417
|
+
An action's `onClick` ended: its promise settled, or it threw. It was started by a click on its
|
|
418
|
+
button, or by `DTVAPI.runAction`.
|
|
418
419
|
|
|
419
420
|
| Field | Type | |
|
|
420
421
|
|---|---|---|
|
|
421
|
-
| `action` | string | The action's `id
|
|
422
|
-
| `selectedRows` | number | The rows selected when it
|
|
422
|
+
| `action` | string | The action's `id`. |
|
|
423
|
+
| `selectedRows` | number | The rows selected when it started. |
|
|
423
424
|
| `outcome` | `'succeeded'` \| `'failed'` | `failed`: it threw or rejected. |
|
|
424
425
|
| `error` | [`DTVAnalyticsError`](#dtvanalyticserror), *optional* | When `failed`: what it threw. |
|
|
425
426
|
|
|
@@ -527,7 +528,7 @@ failed lookup is reported, so one broken fetcher can report once per keystroke.
|
|
|
527
528
|
| `error` | [`DTVAnalyticsError`](#dtvanalyticserror) | What it threw. |
|
|
528
529
|
|
|
529
530
|
```json
|
|
530
|
-
{ "type": "suggestionsFailed", "error": { "name": "
|
|
531
|
+
{ "type": "suggestionsFailed", "error": { "name": "FetchError", "message": "field 'vendors' not found in type: 'query_root'" } }
|
|
531
532
|
```
|
|
532
533
|
|
|
533
534
|
## Shared types
|
|
@@ -645,7 +646,7 @@ The type is exported as `UndecodedFilterState`.
|
|
|
645
646
|
{ name: string; message: string }
|
|
646
647
|
```
|
|
647
648
|
|
|
648
|
-
An error's `name` (`TypeError`, `
|
|
649
|
+
An error's `name` (`TypeError`, `FetchError`, …) and `message`. What is thrown that is not an
|
|
649
650
|
`Error` has the name `Error` and itself as the message.
|
|
650
651
|
|
|
651
652
|
### `DTVAnalyticsResets`
|
|
@@ -761,7 +762,7 @@ per record share a definition and its migrations.
|
|
|
761
762
|
- The preferences other than hidden columns: syncing filters or sorting to user data, syncing
|
|
762
763
|
filters to the URL, closing the filter panel on apply.
|
|
763
764
|
- The table's API: `DTVAPI.rowSelection`, `rowExpansion` (its `fetchData` is a `fetch` with
|
|
764
|
-
`reason: 'refresh'`).
|
|
765
|
+
`reason: 'refresh'`, and its `runAction` an `action`).
|
|
765
766
|
- The sorting, rows per page and filters a view opens with are not changes: they are on the
|
|
766
767
|
`fetch` and the `filtersApplied` it names.
|
|
767
768
|
|
package/docs/api/runtime.md
CHANGED
|
@@ -26,6 +26,8 @@ export type Runtime = {
|
|
|
26
26
|
| `initialValues` | Dynamic initial values resolved at parse time | Any `initialValue` field | any |
|
|
27
27
|
| `suggestionFetchers` | Async suggestion providers for autocomplete filter controls | Autocomplete FilterControl `suggestionFetcher` | `(query: string, client: GraphQLClient) => Promise<{ label: string; value: any }[]>` |
|
|
28
28
|
|
|
29
|
+
The `client` is the table's own, sending the host's `requestHeaders` with every request. `client.request(document, variables?, { signal }?)` resolves to the response's `data` and rejects with a `FetchError` when the response has GraphQL errors or a status other than success. Import its type with `import type { GraphQLClient } from '@kronor/dtv'`.
|
|
30
|
+
|
|
29
31
|
## Resolution Precedence
|
|
30
32
|
When parsing a view JSON, runtime references are resolved via:
|
|
31
33
|
1. External runtime passed to the <ViewRenderer /> (if any)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kronor/dtv",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Schema-driven, declarative table views with advanced filtering, data fetching and AI-assisted filter generation.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -58,33 +58,32 @@
|
|
|
58
58
|
"react-dom": "^19.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@kronor/hasura-graphql": "^0.
|
|
62
|
-
"commander": "^
|
|
61
|
+
"@kronor/hasura-graphql": "^0.3.0",
|
|
62
|
+
"commander": "^15.1.0",
|
|
63
63
|
"fast-glob": "^3.3.3",
|
|
64
|
-
"graphql": "^
|
|
65
|
-
"graphql-request": "^7.4.0",
|
|
64
|
+
"graphql": "^17.1.0",
|
|
66
65
|
"primereact": "^10.9.7",
|
|
67
|
-
"typescript": "~5.
|
|
66
|
+
"typescript": "~5.9.3"
|
|
68
67
|
},
|
|
69
68
|
"devDependencies": {
|
|
70
69
|
"@playwright/test": "^1.52.0",
|
|
71
70
|
"@tailwindcss/vite": "^4.1.1",
|
|
72
|
-
"@types/dom-speech-recognition": "^0.0.
|
|
71
|
+
"@types/dom-speech-recognition": "^0.0.12",
|
|
73
72
|
"@types/jest": "^30.0.0",
|
|
74
73
|
"@types/node": "^22.15.21",
|
|
75
74
|
"@types/react": "^19.1.4",
|
|
76
75
|
"@types/react-dom": "^19.1.5",
|
|
77
|
-
"@vitejs/plugin-react": "^
|
|
76
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
78
77
|
"jest": "^30.0.3",
|
|
79
78
|
"jest-environment-jsdom": "^30.0.4",
|
|
80
|
-
"primeicons": "^
|
|
79
|
+
"primeicons": "^8.0.2",
|
|
81
80
|
"react": "^19.0.0",
|
|
82
81
|
"react-dom": "^19.0.0",
|
|
83
|
-
"rimraf": "^
|
|
82
|
+
"rimraf": "^6.1.4",
|
|
84
83
|
"tailwindcss": "^4.1.1",
|
|
85
84
|
"ts-jest": "^29.4.0",
|
|
86
85
|
"tsx": "^4.20.5",
|
|
87
|
-
"vite": "^
|
|
88
|
-
"vite-plugin-css-injected-by-js": "^
|
|
86
|
+
"vite": "^8.3.7",
|
|
87
|
+
"vite-plugin-css-injected-by-js": "^5.0.3"
|
|
89
88
|
}
|
|
90
89
|
}
|