@carto/ps-react-ui 5.0.0-widgets.1 → 5.0.0-widgets.11
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/error-B2IJ9d2h.js +38 -0
- package/dist/error-B2IJ9d2h.js.map +1 -0
- package/dist/no-data-C54XJt13.js +61 -0
- package/dist/no-data-C54XJt13.js.map +1 -0
- package/dist/note-Clng2ej6.js +124 -0
- package/dist/note-Clng2ej6.js.map +1 -0
- package/dist/{row-C_m1ovHv.js → row-DrHwXNvF.js} +2 -2
- package/dist/{row-C_m1ovHv.js.map → row-DrHwXNvF.js.map} +1 -1
- package/dist/{series-6xp-KQ0S.js → series-Do02NQUF.js} +3 -3
- package/dist/{series-6xp-KQ0S.js.map → series-Do02NQUF.js.map} +1 -1
- package/dist/types/components/basemaps/group-wrapper.d.ts +1 -1
- package/dist/types/widgets/actions/lock-selection/types.d.ts +0 -2
- package/dist/types/widgets/actions/searcher/searcher.d.ts +1 -1
- package/dist/types/widgets/actions/searcher/types.d.ts +2 -0
- package/dist/types/widgets/bar/config.d.ts +1 -1
- package/dist/types/widgets/bar/types.d.ts +1 -1
- package/dist/types/widgets/category/config.d.ts +2 -1
- package/dist/types/widgets/category/style.d.ts +0 -1
- package/dist/types/widgets/category/types.d.ts +1 -0
- package/dist/types/widgets/echart/types.d.ts +1 -0
- package/dist/types/widgets/error/error.d.ts +2 -0
- package/dist/types/widgets/error/index.d.ts +2 -0
- package/dist/types/widgets/error/types.d.ts +12 -0
- package/dist/types/widgets/formula/config.d.ts +1 -1
- package/dist/types/widgets/histogram/config.d.ts +1 -1
- package/dist/types/widgets/histogram/types.d.ts +1 -1
- package/dist/types/widgets/index.d.ts +6 -0
- package/dist/types/widgets/loader/index.d.ts +3 -0
- package/dist/types/widgets/loader/loader.d.ts +2 -0
- package/dist/types/widgets/{root → loader}/types.d.ts +1 -1
- package/dist/types/widgets/loader/utils.d.ts +1 -0
- package/dist/types/widgets/markdown/types.d.ts +1 -1
- package/dist/types/widgets/no-data/index.d.ts +2 -0
- package/dist/types/widgets/no-data/no-data.d.ts +35 -0
- package/dist/types/widgets/no-data/style.d.ts +6 -0
- package/dist/types/widgets/no-data/types.d.ts +67 -0
- package/dist/types/widgets/note/index.d.ts +2 -2
- package/dist/types/widgets/note/note.d.ts +2 -2
- package/dist/types/widgets/note/types.d.ts +1 -1
- package/dist/types/widgets/pie/config.d.ts +1 -1
- package/dist/types/widgets/pie/types.d.ts +1 -1
- package/dist/types/widgets/scatterplot/config.d.ts +1 -1
- package/dist/types/widgets/scatterplot/types.d.ts +1 -1
- package/dist/types/widgets/selection-summary/index.d.ts +2 -2
- package/dist/types/widgets/selection-summary/selection-summary.d.ts +2 -2
- package/dist/types/widgets/selection-summary/types.d.ts +1 -1
- package/dist/types/widgets/skeleton-loader/skeleton-loader.d.ts +1 -1
- package/dist/types/widgets/spread/config.d.ts +1 -1
- package/dist/types/widgets/stores/types.d.ts +4 -76
- package/dist/types/widgets/stores/widget-store.d.ts +1 -1
- package/dist/types/widgets/subheader/index.d.ts +2 -2
- package/dist/types/widgets/subheader/subheader.d.ts +2 -2
- package/dist/types/widgets/subheader/types.d.ts +1 -1
- package/dist/types/widgets/table/config.d.ts +8 -2
- package/dist/types/widgets/table/hooks/index.d.ts +2 -2
- package/dist/types/widgets/table/hooks/use-pagination.d.ts +4 -16
- package/dist/types/widgets/table/hooks/use-selection.d.ts +3 -5
- package/dist/types/widgets/table/hooks/use-sort.d.ts +7 -14
- package/dist/types/widgets/table/index.d.ts +2 -2
- package/dist/types/widgets/table/table-ui.d.ts +3 -3
- package/dist/types/widgets/table/types.d.ts +14 -19
- package/dist/types/widgets/timeseries/config.d.ts +1 -1
- package/dist/types/widgets/timeseries/types.d.ts +1 -1
- package/dist/widget-store-CB6Trp_0.js +131 -0
- package/dist/widget-store-CB6Trp_0.js.map +1 -0
- package/dist/widgets/actions.js +602 -596
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +8 -7
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/category.js +238 -272
- package/dist/widgets/category.js.map +1 -1
- package/dist/widgets/echart.js +1 -1
- package/dist/widgets/error.js +5 -0
- package/dist/widgets/error.js.map +1 -0
- package/dist/widgets/formula.js +19 -18
- package/dist/widgets/formula.js.map +1 -1
- package/dist/widgets/histogram.js +54 -53
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/loader.js +57 -0
- package/dist/widgets/loader.js.map +1 -0
- package/dist/widgets/markdown.js +1 -1
- package/dist/widgets/no-data.js +5 -0
- package/dist/widgets/no-data.js.map +1 -0
- package/dist/widgets/note.js +2 -121
- package/dist/widgets/note.js.map +1 -1
- package/dist/widgets/pie.js +8 -7
- package/dist/widgets/pie.js.map +1 -1
- package/dist/widgets/range.js +2 -2
- package/dist/widgets/scatterplot.js +8 -7
- package/dist/widgets/scatterplot.js.map +1 -1
- package/dist/widgets/selection-summary.js +3 -3
- package/dist/widgets/selection-summary.js.map +1 -1
- package/dist/widgets/skeleton-loader.js +1 -1
- package/dist/widgets/spread.js +20 -19
- package/dist/widgets/spread.js.map +1 -1
- package/dist/widgets/stores.js +1 -1
- package/dist/widgets/subheader.js +6 -6
- package/dist/widgets/subheader.js.map +1 -1
- package/dist/widgets/table.js +562 -570
- package/dist/widgets/table.js.map +1 -1
- package/dist/widgets/timeseries.js +8 -7
- package/dist/widgets/timeseries.js.map +1 -1
- package/dist/widgets/wrapper.js +1 -1
- package/dist/widgets/wrapper.js.map +1 -1
- package/dist/widgets.js +8 -2
- package/dist/widgets.js.map +1 -1
- package/package.json +12 -4
- package/dist/types/widgets/root/index.d.ts +0 -3
- package/dist/types/widgets/root/root.d.ts +0 -2
- package/dist/types/widgets/root/style.d.ts +0 -8
- package/dist/types/widgets/root/utils.d.ts +0 -1
- package/dist/widget-store-DNyVElxd.js +0 -190
- package/dist/widget-store-DNyVElxd.js.map +0 -1
- package/dist/widgets/root.js +0 -68
- package/dist/widgets/root.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { WidgetState } from '../stores/types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the WidgetNoData wrapper component
|
|
5
|
+
*
|
|
6
|
+
* @example Basic usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <WidgetNoData id="my-widget">
|
|
9
|
+
* <WidgetContent id="my-widget" />
|
|
10
|
+
* </WidgetNoData>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @example With custom messages
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <WidgetNoData
|
|
16
|
+
* id="my-widget"
|
|
17
|
+
* title="No results found"
|
|
18
|
+
* description="Try adjusting your filters"
|
|
19
|
+
* >
|
|
20
|
+
* <WidgetContent id="my-widget" />
|
|
21
|
+
* </WidgetNoData>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example With custom isEmpty logic
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <WidgetNoData
|
|
27
|
+
* id="my-widget"
|
|
28
|
+
* isEmpty={(data) => {
|
|
29
|
+
* const d = data as CustomData
|
|
30
|
+
* return !d?.items?.length
|
|
31
|
+
* }}
|
|
32
|
+
* >
|
|
33
|
+
* <WidgetContent id="my-widget" />
|
|
34
|
+
* </WidgetNoData>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export interface WidgetNoDataProps {
|
|
38
|
+
/**
|
|
39
|
+
* Widget ID to fetch state from store
|
|
40
|
+
*/
|
|
41
|
+
id: WidgetState['id'];
|
|
42
|
+
/**
|
|
43
|
+
* Children to render when data is available
|
|
44
|
+
*/
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Optional custom title for empty state
|
|
48
|
+
* @default "No data available"
|
|
49
|
+
*/
|
|
50
|
+
title?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Optional custom description for empty state
|
|
53
|
+
* @default "There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust filters"
|
|
54
|
+
*/
|
|
55
|
+
description?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Optional custom function to determine if data is empty
|
|
58
|
+
* If not provided, uses default isEmpty logic that handles:
|
|
59
|
+
* - null/undefined → empty
|
|
60
|
+
* - [] (empty array) → empty
|
|
61
|
+
* - [[]] (nested empty arrays) → empty
|
|
62
|
+
* - {} (empty object) → empty
|
|
63
|
+
* - Primitives → not empty
|
|
64
|
+
* - Arrays/objects with content → not empty
|
|
65
|
+
*/
|
|
66
|
+
isEmpty?: (data: unknown) => boolean;
|
|
67
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { WidgetNote } from './note';
|
|
2
|
+
export type { WidgetNoteProps } from './types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function
|
|
1
|
+
import { WidgetNoteProps } from './types';
|
|
2
|
+
export declare function WidgetNote({ children, labels, }: WidgetNoteProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PieConfig, PieWidgetConfig, PieWidgetData } from './types';
|
|
2
2
|
import { DownloadItem } from '../actions';
|
|
3
|
-
import { ConfigProps } from '../
|
|
3
|
+
import { ConfigProps } from '../loader/types';
|
|
4
4
|
export declare function pieDownloadConfig({ refUI, }: ConfigProps): DownloadItem<PieWidgetData>[];
|
|
5
5
|
export declare function pieConfig(props: PieConfig): PieWidgetConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EchartWidgetData, EchartWidgetState } from '../echart';
|
|
2
2
|
import { EchartWidgetOptionProps, EchartWidgetProps } from '../echart/types';
|
|
3
|
-
import { ConfigProps } from '../
|
|
3
|
+
import { ConfigProps } from '../loader';
|
|
4
4
|
export type PieWidgetData = EchartWidgetData;
|
|
5
5
|
export type PieWidgetState = EchartWidgetState;
|
|
6
6
|
export type PieWidgetConfig = EchartWidgetProps & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ScatterplotConfig, ScatterplotWidgetConfig, ScatterplotWidgetData } from './types';
|
|
2
2
|
import { DownloadItem } from '../actions';
|
|
3
|
-
import { ConfigProps } from '../
|
|
3
|
+
import { ConfigProps } from '../loader/types';
|
|
4
4
|
export declare function scatterplotDownloadConfig({ refUI, }: ConfigProps): DownloadItem<ScatterplotWidgetData>[];
|
|
5
5
|
export declare function scatterplotConfig(props: ScatterplotConfig): ScatterplotWidgetConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EchartWidgetState } from '../echart';
|
|
2
2
|
import { EchartWidgetOptionProps, EchartWidgetProps } from '../echart/types';
|
|
3
|
-
import { ConfigProps } from '../
|
|
3
|
+
import { ConfigProps } from '../loader';
|
|
4
4
|
export type ScatterplotWidgetData = [number, number][][];
|
|
5
5
|
export type ScatterplotWidgetState = EchartWidgetState;
|
|
6
6
|
export type ScatterplotWidgetConfig = EchartWidgetProps & {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { WidgetSelectionSummary } from './selection-summary';
|
|
2
|
+
export type { WidgetSelectionSummaryProps, SelectionSummaryLabels, } from './types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function
|
|
1
|
+
import { WidgetSelectionSummaryProps } from './types';
|
|
2
|
+
export declare function WidgetSelectionSummary({ selections, onClear, labels, }: WidgetSelectionSummaryProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SkeletonLoaderProps } from './types';
|
|
2
|
-
export declare function SkeletonLoader({ id, children, Skeleton, }: SkeletonLoaderProps): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> |
|
|
2
|
+
export declare function SkeletonLoader({ id, children, Skeleton, }: SkeletonLoaderProps): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | null | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DownloadItem } from '../actions';
|
|
2
|
-
import { ConfigProps } from '../
|
|
2
|
+
import { ConfigProps } from '../loader/types';
|
|
3
3
|
import { SpreadWidgetConfig, SpreadWidgetData } from './types';
|
|
4
4
|
import { SeriesConfig } from '../formula/types';
|
|
5
5
|
export interface SpreadConfigProps {
|
|
@@ -1,55 +1,4 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Sort direction for table columns
|
|
4
|
-
*/
|
|
5
|
-
export type StoreSortDirection = 'asc' | 'desc';
|
|
6
|
-
/**
|
|
7
|
-
* Pagination mode for tables
|
|
8
|
-
*/
|
|
9
|
-
export type StorePaginationMode = 'local' | 'remote';
|
|
10
|
-
/**
|
|
11
|
-
* Sort mode for tables
|
|
12
|
-
*/
|
|
13
|
-
export type StoreSortMode = 'local' | 'remote';
|
|
14
|
-
/**
|
|
15
|
-
* Table pagination state stored in widget store
|
|
16
|
-
*/
|
|
17
|
-
export interface TablePaginationStoreState {
|
|
18
|
-
/** Current page (0-indexed) */
|
|
19
|
-
page: number;
|
|
20
|
-
/** Rows per page */
|
|
21
|
-
rowsPerPage: number;
|
|
22
|
-
/** Available rows per page options */
|
|
23
|
-
rowsPerPageOptions: number[];
|
|
24
|
-
/** Pagination mode: local or remote */
|
|
25
|
-
mode: StorePaginationMode;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Table sort state stored in widget store
|
|
29
|
-
*/
|
|
30
|
-
export interface TableSortStoreState {
|
|
31
|
-
/** Column ID being sorted */
|
|
32
|
-
columnId: string | null;
|
|
33
|
-
/** Sort direction */
|
|
34
|
-
direction: StoreSortDirection;
|
|
35
|
-
/** Sort mode: local or remote */
|
|
36
|
-
mode: StoreSortMode;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Table selection state stored in widget store
|
|
40
|
-
*/
|
|
41
|
-
export interface TableSelectionStoreState {
|
|
42
|
-
/** Set of selected row IDs */
|
|
43
|
-
selectedIds: Set<string | number>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Combined table state for widget store
|
|
47
|
-
*/
|
|
48
|
-
export interface TableStoreState {
|
|
49
|
-
pagination?: TablePaginationStoreState;
|
|
50
|
-
sort?: TableSortStoreState;
|
|
51
|
-
selection?: TableSelectionStoreState;
|
|
52
|
-
}
|
|
53
2
|
export interface WidgetsStoreProps {
|
|
54
3
|
/** Unique identifier for the widget */
|
|
55
4
|
id: string;
|
|
@@ -62,7 +11,10 @@ export interface WidgetsStoreProps {
|
|
|
62
11
|
/** Fetching state (e.g., for async data) */
|
|
63
12
|
isFetching: boolean;
|
|
64
13
|
/** Error message if any */
|
|
65
|
-
error?:
|
|
14
|
+
error?: {
|
|
15
|
+
title?: string;
|
|
16
|
+
message?: string;
|
|
17
|
+
};
|
|
66
18
|
/** Whether widget is visible */
|
|
67
19
|
visible?: boolean;
|
|
68
20
|
/** Reference to the widget ui instance */
|
|
@@ -169,30 +121,6 @@ export interface WidgetStoreActions {
|
|
|
169
121
|
* @returns Widget state or undefined if not found
|
|
170
122
|
*/
|
|
171
123
|
getWidget: <T extends WidgetState = WidgetState>(id: WidgetState['id']) => T | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* Set table pagination state for a widget
|
|
174
|
-
* @param id - Widget ID
|
|
175
|
-
* @param pagination - Partial pagination state to merge
|
|
176
|
-
*/
|
|
177
|
-
setTablePagination: (id: WidgetState['id'], pagination: Partial<TablePaginationStoreState>) => void;
|
|
178
|
-
/**
|
|
179
|
-
* Set table sort state for a widget
|
|
180
|
-
* @param id - Widget ID
|
|
181
|
-
* @param sort - Partial sort state to merge
|
|
182
|
-
*/
|
|
183
|
-
setTableSort: (id: WidgetState['id'], sort: Partial<TableSortStoreState>) => void;
|
|
184
|
-
/**
|
|
185
|
-
* Set table selection state for a widget
|
|
186
|
-
* @param id - Widget ID
|
|
187
|
-
* @param selection - Partial selection state to merge
|
|
188
|
-
*/
|
|
189
|
-
setTableSelection: (id: WidgetState['id'], selection: Partial<TableSelectionStoreState>) => void;
|
|
190
|
-
/**
|
|
191
|
-
* Get table state for a widget
|
|
192
|
-
* @param id - Widget ID
|
|
193
|
-
* @returns Table state or undefined if not found
|
|
194
|
-
*/
|
|
195
|
-
getTableState: (id: WidgetState['id']) => TableStoreState | undefined;
|
|
196
124
|
/**
|
|
197
125
|
* Register a tool with the widget's transformation pipeline
|
|
198
126
|
* @param widgetId - Widget ID
|
|
@@ -36,4 +36,4 @@ import { WidgetStore } from './types';
|
|
|
36
36
|
* const formulaWidgets = getWidgetsByType('formula')
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
export declare const useWidgetStore: import('zustand').UseBoundStore<import('zustand').StoreApi<WidgetStore>>;
|
|
39
|
+
export declare const useWidgetStore: import('node_modules/zustand/esm/react.mjs').UseBoundStore<import('node_modules/zustand/esm/vanilla.mjs').StoreApi<WidgetStore>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export { WidgetSubHeader } from './subheader';
|
|
2
|
+
export type { WidgetSubHeaderProps } from './types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function
|
|
1
|
+
import { WidgetSubHeaderProps } from './types';
|
|
2
|
+
export declare function WidgetSubHeader({ slotLeft, slotRight, sx, }: WidgetSubHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { ConfigProps } from '../
|
|
2
|
-
import { TableDownloadConfig, TableWidgetConfig, TableColumn } from './types';
|
|
1
|
+
import { ConfigProps } from '../loader/types';
|
|
2
|
+
import { TableDownloadConfig, TableWidgetConfig, TableColumn, Mode, SortDirection } from './types';
|
|
3
|
+
export declare const DEFAULT_MODE: Mode;
|
|
4
|
+
export declare const DEFAULT_PAGE = 0;
|
|
5
|
+
export declare const DEFAULT_ROWS_PER_PAGE = 10;
|
|
6
|
+
export declare const DEFAULT_ROWS_PER_PAGE_OPTIONS: number[];
|
|
7
|
+
export declare const DEFAULT_COLUMN_ID: null;
|
|
8
|
+
export declare const DEFAULT_DIRECTION: SortDirection;
|
|
3
9
|
/**
|
|
4
10
|
* Default table download configuration
|
|
5
11
|
* Supports PNG export (screenshot) and CSV export (data)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { usePagination } from './use-pagination';
|
|
2
2
|
export { useSort } from './use-sort';
|
|
3
3
|
export { useSelection } from './use-selection';
|
|
4
|
-
export type {
|
|
5
|
-
export type {
|
|
4
|
+
export type { UsePaginationResult } from './use-pagination';
|
|
5
|
+
export type { UseSortResult } from './use-sort';
|
|
6
6
|
export type { UseSelectionOptions, UseSelectionResult } from './use-selection';
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import { TableRow
|
|
2
|
-
export interface UsePaginationOptions {
|
|
3
|
-
/** Pagination mode: local or remote */
|
|
4
|
-
mode: PaginationMode;
|
|
5
|
-
/** Initial page (0-indexed) */
|
|
6
|
-
initialPage?: number;
|
|
7
|
-
/** Initial rows per page */
|
|
8
|
-
initialRowsPerPage?: number;
|
|
9
|
-
/** Available rows per page options */
|
|
10
|
-
rowsPerPageOptions?: number[];
|
|
11
|
-
/** Total rows (for remote pagination) */
|
|
12
|
-
total?: number;
|
|
13
|
-
/** Callback when page changes (for remote pagination) */
|
|
14
|
-
onPageChange?: (page: number, rowsPerPage: number) => void;
|
|
15
|
-
}
|
|
1
|
+
import { TableRow } from '../types';
|
|
16
2
|
export interface UsePaginationResult<T> {
|
|
3
|
+
/** Whether pagination is enabled */
|
|
4
|
+
paginationEnabled: boolean;
|
|
17
5
|
/** Current page (0-indexed) */
|
|
18
6
|
page: number;
|
|
19
7
|
/** Rows per page */
|
|
@@ -42,4 +30,4 @@ export interface UsePaginationResult<T> {
|
|
|
42
30
|
* Supports both local (client-side) and remote (server-side) pagination
|
|
43
31
|
* State is persisted in the widget store for the given widgetId
|
|
44
32
|
*/
|
|
45
|
-
export declare function usePagination<T extends TableRow>(widgetId: string, data: T[]
|
|
33
|
+
export declare function usePagination<T extends TableRow>(widgetId: string, data: T[]): UsePaginationResult<T>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { TableRow } from '../types';
|
|
2
2
|
export interface UseSelectionOptions {
|
|
3
|
-
/** Initial selected IDs */
|
|
4
|
-
initialSelectedIds?: Set<string | number>;
|
|
5
3
|
/** Callback when selection changes */
|
|
6
|
-
onSelectionChange?: (selectedIds:
|
|
4
|
+
onSelectionChange?: (selectedIds: (string | number)[]) => void;
|
|
7
5
|
}
|
|
8
6
|
export interface UseSelectionResult {
|
|
9
|
-
/**
|
|
10
|
-
selectedIds:
|
|
7
|
+
/** Array of selected row IDs */
|
|
8
|
+
selectedIds: (string | number)[];
|
|
11
9
|
/** Check if a row is selected */
|
|
12
10
|
isSelected: (id: string | number) => boolean;
|
|
13
11
|
/** Check if all provided rows are selected */
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import { TableRow,
|
|
2
|
-
export interface
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
/** Initial sort column ID */
|
|
6
|
-
initialColumnId?: string | null;
|
|
7
|
-
/** Initial sort direction */
|
|
8
|
-
initialDirection?: SortDirection;
|
|
9
|
-
/** Callback when sort changes (for remote sorting) */
|
|
10
|
-
onSortChange?: (columnId: string, direction: SortDirection) => void;
|
|
11
|
-
}
|
|
12
|
-
export interface UseSortResult<T> {
|
|
1
|
+
import { TableRow, SortDirection, SortState } from '../types';
|
|
2
|
+
export interface UseSortResult<T> extends SortState {
|
|
3
|
+
/** Whether sorting is enabled */
|
|
4
|
+
sortEnabled: boolean;
|
|
13
5
|
/** Current sort state */
|
|
14
|
-
|
|
6
|
+
columnId: string | null;
|
|
7
|
+
direction: SortDirection;
|
|
15
8
|
/** Sorted data (for local mode) */
|
|
16
9
|
sortedData: T[];
|
|
17
10
|
/** Toggle sort on a column */
|
|
@@ -26,4 +19,4 @@ export interface UseSortResult<T> {
|
|
|
26
19
|
* Supports both local (client-side) and remote (server-side) sorting
|
|
27
20
|
* State is persisted in the widget store for the given widgetId
|
|
28
21
|
*/
|
|
29
|
-
export declare function useSort<T extends TableRow>(widgetId: string, data: T[]
|
|
22
|
+
export declare function useSort<T extends TableRow>(widgetId: string, data: T[]): UseSortResult<T>;
|
|
@@ -9,5 +9,5 @@ export { TableSkeleton } from './skeleton';
|
|
|
9
9
|
export { sanitizeTableRow, sanitizeTableData } from './serializer';
|
|
10
10
|
export { getCellValue, compareValues, sortData, paginateData } from './helpers';
|
|
11
11
|
export { styles as tableStyles } from './style';
|
|
12
|
-
export type { TableUIProps, TableColumn, TableRow, TableWidgetData, TablePaginationState, SortDirection, SortState,
|
|
13
|
-
export type {
|
|
12
|
+
export type { TableUIProps, TableColumn, TableRow, TableWidgetData, TablePaginationState, SortDirection, SortState, Mode, TableWidgetConfig, TableWidgetState, TableDownloadConfig, TableProps, CellHeaderProps, RowProps, PaginationProps, PaginationActionsProps, } from './types';
|
|
13
|
+
export type { UsePaginationResult, UseSortResult, UseSelectionOptions, UseSelectionResult, } from './hooks';
|
|
@@ -14,13 +14,13 @@ export interface TableComponentProps extends MuiTableProps {
|
|
|
14
14
|
*/
|
|
15
15
|
declare function Table({ children, ref, stickyHeader, ...props }: TableComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
declare namespace Table {
|
|
17
|
-
var Head: import("
|
|
17
|
+
var Head: import("node_modules/@mui/material/OverridableComponent").OverridableComponent<import("node_modules/@mui/material").TableHeadTypeMap<{}, "thead">>;
|
|
18
18
|
var CellHeader: typeof import(".").CellHeader;
|
|
19
|
-
var Body: import("
|
|
19
|
+
var Body: import("node_modules/@mui/material/OverridableComponent").OverridableComponent<import("node_modules/@mui/material").TableBodyTypeMap<{}, "tbody">>;
|
|
20
20
|
var Row: typeof import(".").Row;
|
|
21
21
|
var Cell: typeof TableCell;
|
|
22
22
|
var Container: typeof TableContainer;
|
|
23
|
-
var Paper: import("
|
|
23
|
+
var Paper: import("node_modules/@mui/material/OverridableComponent").OverridableComponent<import("node_modules/@mui/material").PaperTypeMap<{}, "div">>;
|
|
24
24
|
var Pagination: typeof import(".").Pagination;
|
|
25
25
|
var PaginationActions: typeof import(".").PaginationActions;
|
|
26
26
|
}
|
|
@@ -63,13 +63,9 @@ export interface SortState {
|
|
|
63
63
|
direction: SortDirection;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Pagination mode
|
|
66
|
+
* Pagination and sort mode
|
|
67
67
|
*/
|
|
68
|
-
export type
|
|
69
|
-
/**
|
|
70
|
-
* Sort mode
|
|
71
|
-
*/
|
|
72
|
-
export type SortMode = 'local' | 'remote';
|
|
68
|
+
export type Mode = 'local' | 'remote';
|
|
73
69
|
/**
|
|
74
70
|
* Table widget configuration
|
|
75
71
|
*/
|
|
@@ -78,45 +74,44 @@ export interface TableWidgetConfig {
|
|
|
78
74
|
columns?: TableColumn[];
|
|
79
75
|
/** Enable row selection with checkboxes */
|
|
80
76
|
selectable?: boolean;
|
|
77
|
+
/** Currently selected row IDs */
|
|
78
|
+
selected: (string | number)[];
|
|
79
|
+
/** Pagination and sort mode: local (client-side) or remote (server-side) */
|
|
80
|
+
mode: Mode;
|
|
81
81
|
/** Pagination configuration */
|
|
82
82
|
pagination?: {
|
|
83
|
-
/**
|
|
84
|
-
|
|
83
|
+
/** Current page (0-indexed) */
|
|
84
|
+
page?: number;
|
|
85
85
|
/** Available rows per page options */
|
|
86
86
|
rowsPerPageOptions?: number[];
|
|
87
87
|
/** Default rows per page */
|
|
88
|
-
|
|
88
|
+
rowsPerPage?: number;
|
|
89
89
|
/** Total rows for remote pagination */
|
|
90
90
|
total?: number;
|
|
91
91
|
};
|
|
92
92
|
/** Sort configuration */
|
|
93
93
|
sort?: {
|
|
94
|
-
/** Sort mode: local (client-side) or remote (server-side) */
|
|
95
|
-
mode: SortMode;
|
|
96
94
|
/** Default sort column */
|
|
97
|
-
|
|
95
|
+
columnId: string | null;
|
|
98
96
|
/** Default sort direction */
|
|
99
|
-
|
|
97
|
+
direction?: SortDirection;
|
|
100
98
|
};
|
|
101
99
|
/** Callback when a row is clicked */
|
|
102
100
|
onRowClick?: (row: TableRow) => void;
|
|
103
101
|
/** Callback when hovering over a row (null when leaving table) */
|
|
104
102
|
onRowHover?: (row: TableRow | null) => void;
|
|
105
103
|
/** Callback when selection changes */
|
|
106
|
-
onSelectionChange?: (
|
|
104
|
+
onSelectionChange?: (selected: (string | number)[]) => void;
|
|
107
105
|
/** Callback when page changes (for remote pagination) */
|
|
108
106
|
onPageChange?: (page: number, rowsPerPage: number) => void;
|
|
109
107
|
/** Callback when sort changes (for remote sorting) */
|
|
110
108
|
onSortChange?: (columnId: string, direction: SortDirection) => void;
|
|
111
109
|
}
|
|
112
110
|
/**
|
|
113
|
-
* Table widget state
|
|
111
|
+
* Table widget state - includes both configuration and runtime state
|
|
114
112
|
*/
|
|
115
|
-
export type TableWidgetState = BaseWidgetState<WrapperState<TableWidgetConfig> & {
|
|
113
|
+
export type TableWidgetState = BaseWidgetState<WrapperState<TableWidgetConfig & {}> & {
|
|
116
114
|
data: TableWidgetData;
|
|
117
|
-
paginationState?: TablePaginationState;
|
|
118
|
-
sortState?: SortState;
|
|
119
|
-
selectedIds?: Set<string | number>;
|
|
120
115
|
}>;
|
|
121
116
|
/**
|
|
122
117
|
* Table download configuration
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TimeseriesConfig, TimeseriesWidgetConfig, TimeseriesWidgetData } from './types';
|
|
2
2
|
import { DownloadItem } from '../actions';
|
|
3
|
-
import { ConfigProps } from '../
|
|
3
|
+
import { ConfigProps } from '../loader/types';
|
|
4
4
|
export declare function timeseriesDownloadConfig({ refUI, }: ConfigProps): DownloadItem<TimeseriesWidgetData>[];
|
|
5
5
|
export declare function timeseriesConfig(props: TimeseriesConfig): TimeseriesWidgetConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EchartWidgetData, EchartWidgetState } from '../echart';
|
|
2
2
|
import { EchartWidgetOptionProps, EchartWidgetProps } from '../echart/types';
|
|
3
|
-
import { ConfigProps } from '../
|
|
3
|
+
import { ConfigProps } from '../loader';
|
|
4
4
|
export type TimeseriesWidgetData = EchartWidgetData;
|
|
5
5
|
export type TimeseriesWidgetState = EchartWidgetState;
|
|
6
6
|
export type TimeseriesWidgetConfig = EchartWidgetProps & {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { create as f } from "zustand";
|
|
2
|
+
const T = /* @__PURE__ */ new Map(), w = f()((g, u) => ({
|
|
3
|
+
// State
|
|
4
|
+
widgets: {},
|
|
5
|
+
// Actions
|
|
6
|
+
setWidget: (e, t) => g((o) => {
|
|
7
|
+
const r = o.widgets[e] ?? {};
|
|
8
|
+
return {
|
|
9
|
+
widgets: {
|
|
10
|
+
...o.widgets,
|
|
11
|
+
[e]: {
|
|
12
|
+
...r,
|
|
13
|
+
...t,
|
|
14
|
+
id: e
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}),
|
|
19
|
+
removeWidget: (e) => g((t) => {
|
|
20
|
+
const o = {
|
|
21
|
+
...t.widgets
|
|
22
|
+
};
|
|
23
|
+
return delete o[e], {
|
|
24
|
+
widgets: o
|
|
25
|
+
};
|
|
26
|
+
}),
|
|
27
|
+
clearWidgets: () => g({
|
|
28
|
+
widgets: {}
|
|
29
|
+
}),
|
|
30
|
+
getWidget: (e) => u().widgets[e],
|
|
31
|
+
registerTool: (e, t) => g((o) => {
|
|
32
|
+
const r = o.widgets[e] ?? {}, l = (r.registeredTools ?? []).filter((d) => d.id !== t.id);
|
|
33
|
+
return {
|
|
34
|
+
widgets: {
|
|
35
|
+
...o.widgets,
|
|
36
|
+
[e]: {
|
|
37
|
+
...r,
|
|
38
|
+
id: e,
|
|
39
|
+
registeredTools: [...l, t]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
unregisterTool: (e, t) => g((o) => {
|
|
45
|
+
const r = o.widgets[e];
|
|
46
|
+
if (!r) return o;
|
|
47
|
+
const l = (r.registeredTools ?? []).filter((d) => d.id !== t);
|
|
48
|
+
return {
|
|
49
|
+
widgets: {
|
|
50
|
+
...o.widgets,
|
|
51
|
+
[e]: {
|
|
52
|
+
...r,
|
|
53
|
+
registeredTools: l
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}),
|
|
58
|
+
updateToolConfig: (e, t, o) => g((r) => {
|
|
59
|
+
const i = r.widgets[e];
|
|
60
|
+
if (!i) return r;
|
|
61
|
+
const d = (i.registeredTools ?? []).map((n) => n.id === t ? {
|
|
62
|
+
...n,
|
|
63
|
+
config: {
|
|
64
|
+
...n.config,
|
|
65
|
+
...o
|
|
66
|
+
}
|
|
67
|
+
} : n);
|
|
68
|
+
return {
|
|
69
|
+
widgets: {
|
|
70
|
+
...r.widgets,
|
|
71
|
+
[e]: {
|
|
72
|
+
...i,
|
|
73
|
+
registeredTools: d
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}),
|
|
78
|
+
setToolEnabled: (e, t, o) => g((r) => {
|
|
79
|
+
const i = r.widgets[e];
|
|
80
|
+
if (!i) return r;
|
|
81
|
+
const d = (i.registeredTools ?? []).map((n) => n.id === t ? {
|
|
82
|
+
...n,
|
|
83
|
+
enabled: o
|
|
84
|
+
} : n);
|
|
85
|
+
return {
|
|
86
|
+
widgets: {
|
|
87
|
+
...r.widgets,
|
|
88
|
+
[e]: {
|
|
89
|
+
...i,
|
|
90
|
+
registeredTools: d
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}),
|
|
95
|
+
executeToolPipeline: async (e, t) => {
|
|
96
|
+
const o = u().widgets[e];
|
|
97
|
+
if (!o) return;
|
|
98
|
+
const r = (T.get(e) ?? 0) + 1;
|
|
99
|
+
T.set(e, r);
|
|
100
|
+
const i = o, l = /* @__PURE__ */ new Set();
|
|
101
|
+
for (const s of i.registeredTools ?? [])
|
|
102
|
+
s.enabled && s.disables && s.disables.forEach((c) => l.add(c));
|
|
103
|
+
const d = [...i.registeredTools ?? []].filter((s) => s.enabled && !l.has(s.id)).sort((s, c) => s.order - c.order);
|
|
104
|
+
let n = t;
|
|
105
|
+
for (const s of d) {
|
|
106
|
+
if (T.get(e) !== r)
|
|
107
|
+
return;
|
|
108
|
+
try {
|
|
109
|
+
n = await s.fn(n, s.config);
|
|
110
|
+
} catch (c) {
|
|
111
|
+
console.error(`Tool ${s.id} failed for widget ${e}:`, c);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
g((s) => {
|
|
115
|
+
const c = s.widgets[e];
|
|
116
|
+
return c ? {
|
|
117
|
+
widgets: {
|
|
118
|
+
...s.widgets,
|
|
119
|
+
[e]: {
|
|
120
|
+
...c,
|
|
121
|
+
data: n
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
} : s;
|
|
125
|
+
}), T.get(e) === r && T.delete(e);
|
|
126
|
+
}
|
|
127
|
+
}));
|
|
128
|
+
export {
|
|
129
|
+
w as u
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=widget-store-CB6Trp_0.js.map
|