@richardmcquiston01/dashboard-widgets-toolkit 0.4.1 → 0.6.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 +3 -370
- package/dist/core.cjs +42 -9
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +41 -10
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +42 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +41 -10
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +589 -470
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +19 -9
- package/dist/react.d.ts +19 -9
- package/dist/react.js +589 -470
- package/dist/react.js.map +1 -1
- package/dist/{scale-dWDGE1zW.d.cts → scale-D51ZGIF4.d.cts} +30 -1
- package/dist/{scale-dWDGE1zW.d.ts → scale-D51ZGIF4.d.ts} +30 -1
- package/dist/styles.css +16 -0
- package/package.json +1 -1
|
@@ -385,6 +385,18 @@ interface ResolvedDetailOptions {
|
|
|
385
385
|
readonly pageSize: number;
|
|
386
386
|
readonly mode: DetailMode;
|
|
387
387
|
}
|
|
388
|
+
/** The `tableControls` setting on a widget definition. `true` means both. */
|
|
389
|
+
interface WidgetTableControls {
|
|
390
|
+
/** A search box over every column. Default true. */
|
|
391
|
+
readonly search?: boolean;
|
|
392
|
+
/** Sortable column headers. Default true. */
|
|
393
|
+
readonly sort?: boolean;
|
|
394
|
+
}
|
|
395
|
+
/** `WidgetTableControls` with every default filled in. */
|
|
396
|
+
interface ResolvedTableControls {
|
|
397
|
+
readonly search: boolean;
|
|
398
|
+
readonly sort: boolean;
|
|
399
|
+
}
|
|
388
400
|
interface DetailColumn {
|
|
389
401
|
/** Stable id used by sort, filters and URLs. Unique within the data. */
|
|
390
402
|
readonly key: string;
|
|
@@ -448,6 +460,11 @@ interface DetailPage {
|
|
|
448
460
|
}
|
|
449
461
|
/** Reads `definition.detail` with defaults; undefined when there is none. */
|
|
450
462
|
declare function resolveDetailOptions(definition: Pick<WidgetDefinition, 'title' | 'detail'>): ResolvedDetailOptions | undefined;
|
|
463
|
+
/**
|
|
464
|
+
* Reads `definition.tableControls` with defaults; undefined when the widget
|
|
465
|
+
* has none (or both are turned off).
|
|
466
|
+
*/
|
|
467
|
+
declare function resolveTableControls(definition: Pick<WidgetDefinition, 'tableControls'>): ResolvedTableControls | undefined;
|
|
451
468
|
/** The first page, unsorted and unfiltered. */
|
|
452
469
|
declare function defaultDetailQuery(pageSize?: number): DetailQuery;
|
|
453
470
|
/**
|
|
@@ -479,6 +496,11 @@ declare function parseDetailQuery(queryString: string, pageSize?: number, data?:
|
|
|
479
496
|
* Reports every problem, naming the column or row and cell.
|
|
480
497
|
*/
|
|
481
498
|
declare function validateDetailData(data: unknown, subject?: string): Result<DetailData>;
|
|
499
|
+
/**
|
|
500
|
+
* A TABLE's columns and rows as detail data (column keys `c0`, `c1`, ...),
|
|
501
|
+
* footer ignored, so the table can be searched and sorted with `queryRows`.
|
|
502
|
+
*/
|
|
503
|
+
declare function tableDetailData(data: TableWidgetData): DetailData;
|
|
482
504
|
/**
|
|
483
505
|
* The detail data for a widget whose card payload is already complete, so a
|
|
484
506
|
* detail view needs no provider: a TABLE without a `footer` (a footer means
|
|
@@ -529,6 +551,13 @@ interface WidgetDefinition {
|
|
|
529
551
|
* paging. `true` uses defaults. The data comes from a detail provider.
|
|
530
552
|
*/
|
|
531
553
|
readonly detail?: boolean | WidgetDetailOptions;
|
|
554
|
+
/**
|
|
555
|
+
* TABLE widgets only: a search box and sortable column headers in the card
|
|
556
|
+
* itself, working on the rows the card holds. `true` turns on both. With a
|
|
557
|
+
* `footer` (rows were left out) they only see the rows shown; use `detail`
|
|
558
|
+
* for the full list.
|
|
559
|
+
*/
|
|
560
|
+
readonly tableControls?: boolean | WidgetTableControls;
|
|
532
561
|
/** Fill free space in the row (height, width or both). Default: none. */
|
|
533
562
|
readonly fill?: WidgetFill;
|
|
534
563
|
}
|
|
@@ -632,4 +661,4 @@ declare function niceDomain(values: readonly number[], tickCount?: number): Nice
|
|
|
632
661
|
*/
|
|
633
662
|
declare function labelStride(count: number, maxLabels?: number): number;
|
|
634
663
|
|
|
635
|
-
export {
|
|
664
|
+
export { MAX_DETAIL_PAGE_SIZE as $, type AlertListWidgetData as A, type BarListWidgetData as B, type CachedPayload as C, type DashboardWidget as D, type DetailMode as E, type DetailPage as F, type GraphWidgetData as G, type DetailProvider as H, type DetailProviders as I, type DetailSort as J, type KpiWidgetData as K, type Locale as L, EMPTY_LAYOUT as M, type NiceDomain as N, type EmptyWidget as O, type Err as P, type ErrorWidget as Q, type ResolvedTableControls as R, type FormatOptions as S, type TableWidgetData as T, type GraphPoint as U, type GraphSeries as V, type WidgetSize as W, type KpiDelta as X, type KpiDeltaOptions as Y, type LayoutItem as Z, type LoadingWidget as _, type WidgetFill as a, serializeLayout as a$, MAX_GRAPH_SERIES as a0, type Ok as a1, type OkWidget as a2, type ProviderOptions as a3, type ResolvedDetailOptions as a4, type ResolvedWidget as a5, type SortDirection as a6, type TableCell as a7, type TableColumn as a8, VALUE_FORMATS as a9, isMinimized as aA, isWidgetEmptyState as aB, isWidgetKind as aC, isWidgetVisibleTo as aD, kpiDelta as aE, labelStride as aF, loadingWidgets as aG, minimizeWidget as aH, moveWidget as aI, moveWidgetBy as aJ, moveWidgetDown as aK, moveWidgetUp as aL, niceDomain as aM, niceStep as aN, ok as aO, parseDetailQuery as aP, parseLayout as aQ, percentChange as aR, pruneLayout as aS, queryRows as aT, resolveDetailOptions as aU, resolvePayload as aV, resolveTableControls as aW, resolveWidget as aX, resolveWidgets as aY, restoreWidget as aZ, serializeDetailQuery as a_, type ValueFormat as aa, WIDGET_FILLS as ab, WIDGET_KINDS as ac, WIDGET_SIZES as ad, type WidgetCache as ae, type WidgetDataOf as af, type WidgetDetailOptions as ag, type WidgetEmptyState as ah, type WidgetProvider as ai, type WidgetStatus as aj, type WidgetTableControls as ak, cacheKeyFor as al, defaultDetailQuery as am, defineWidget as an, deriveDetailData as ao, describeUnknownError as ap, emptyTextFor as aq, emptyWidget as ar, err as as, failedWidget as at, formatCount as au, formatPercentChange as av, formatValue as aw, hiddenWidgets as ax, hideWidget as ay, isHidden as az, type WidgetDefinition as b, shareOf as b0, showWidget as b1, sortDefinitions as b2, tableDetailData as b3, toggleHidden as b4, toggleMinimized as b5, validateDetailData as b6, visibleWidgets as b7, widgetsFor as b8, type DetailProviderOptions as c, type DetailData as d, type DetailQuery as e, type DashboardLayout as f, type GaugeWidgetData as g, type TextWidgetData as h, type WidgetData as i, type ResolveOptions as j, type WidgetContext as k, type WidgetProviders as l, type WidgetKind as m, type Result as n, type WidgetPayload as o, type AlertListItem as p, type BarListItem as q, DEFAULT_COMPARISON_LABEL as r, DEFAULT_CURRENCY as s, DEFAULT_DETAIL_PAGE_SIZE as t, DEFAULT_EMPTY_TEXT as u, DETAIL_MODES as v, type DeltaDirection as w, type DeltaSentiment as x, type DetailCell as y, type DetailColumn as z };
|
|
@@ -385,6 +385,18 @@ interface ResolvedDetailOptions {
|
|
|
385
385
|
readonly pageSize: number;
|
|
386
386
|
readonly mode: DetailMode;
|
|
387
387
|
}
|
|
388
|
+
/** The `tableControls` setting on a widget definition. `true` means both. */
|
|
389
|
+
interface WidgetTableControls {
|
|
390
|
+
/** A search box over every column. Default true. */
|
|
391
|
+
readonly search?: boolean;
|
|
392
|
+
/** Sortable column headers. Default true. */
|
|
393
|
+
readonly sort?: boolean;
|
|
394
|
+
}
|
|
395
|
+
/** `WidgetTableControls` with every default filled in. */
|
|
396
|
+
interface ResolvedTableControls {
|
|
397
|
+
readonly search: boolean;
|
|
398
|
+
readonly sort: boolean;
|
|
399
|
+
}
|
|
388
400
|
interface DetailColumn {
|
|
389
401
|
/** Stable id used by sort, filters and URLs. Unique within the data. */
|
|
390
402
|
readonly key: string;
|
|
@@ -448,6 +460,11 @@ interface DetailPage {
|
|
|
448
460
|
}
|
|
449
461
|
/** Reads `definition.detail` with defaults; undefined when there is none. */
|
|
450
462
|
declare function resolveDetailOptions(definition: Pick<WidgetDefinition, 'title' | 'detail'>): ResolvedDetailOptions | undefined;
|
|
463
|
+
/**
|
|
464
|
+
* Reads `definition.tableControls` with defaults; undefined when the widget
|
|
465
|
+
* has none (or both are turned off).
|
|
466
|
+
*/
|
|
467
|
+
declare function resolveTableControls(definition: Pick<WidgetDefinition, 'tableControls'>): ResolvedTableControls | undefined;
|
|
451
468
|
/** The first page, unsorted and unfiltered. */
|
|
452
469
|
declare function defaultDetailQuery(pageSize?: number): DetailQuery;
|
|
453
470
|
/**
|
|
@@ -479,6 +496,11 @@ declare function parseDetailQuery(queryString: string, pageSize?: number, data?:
|
|
|
479
496
|
* Reports every problem, naming the column or row and cell.
|
|
480
497
|
*/
|
|
481
498
|
declare function validateDetailData(data: unknown, subject?: string): Result<DetailData>;
|
|
499
|
+
/**
|
|
500
|
+
* A TABLE's columns and rows as detail data (column keys `c0`, `c1`, ...),
|
|
501
|
+
* footer ignored, so the table can be searched and sorted with `queryRows`.
|
|
502
|
+
*/
|
|
503
|
+
declare function tableDetailData(data: TableWidgetData): DetailData;
|
|
482
504
|
/**
|
|
483
505
|
* The detail data for a widget whose card payload is already complete, so a
|
|
484
506
|
* detail view needs no provider: a TABLE without a `footer` (a footer means
|
|
@@ -529,6 +551,13 @@ interface WidgetDefinition {
|
|
|
529
551
|
* paging. `true` uses defaults. The data comes from a detail provider.
|
|
530
552
|
*/
|
|
531
553
|
readonly detail?: boolean | WidgetDetailOptions;
|
|
554
|
+
/**
|
|
555
|
+
* TABLE widgets only: a search box and sortable column headers in the card
|
|
556
|
+
* itself, working on the rows the card holds. `true` turns on both. With a
|
|
557
|
+
* `footer` (rows were left out) they only see the rows shown; use `detail`
|
|
558
|
+
* for the full list.
|
|
559
|
+
*/
|
|
560
|
+
readonly tableControls?: boolean | WidgetTableControls;
|
|
532
561
|
/** Fill free space in the row (height, width or both). Default: none. */
|
|
533
562
|
readonly fill?: WidgetFill;
|
|
534
563
|
}
|
|
@@ -632,4 +661,4 @@ declare function niceDomain(values: readonly number[], tickCount?: number): Nice
|
|
|
632
661
|
*/
|
|
633
662
|
declare function labelStride(count: number, maxLabels?: number): number;
|
|
634
663
|
|
|
635
|
-
export {
|
|
664
|
+
export { MAX_DETAIL_PAGE_SIZE as $, type AlertListWidgetData as A, type BarListWidgetData as B, type CachedPayload as C, type DashboardWidget as D, type DetailMode as E, type DetailPage as F, type GraphWidgetData as G, type DetailProvider as H, type DetailProviders as I, type DetailSort as J, type KpiWidgetData as K, type Locale as L, EMPTY_LAYOUT as M, type NiceDomain as N, type EmptyWidget as O, type Err as P, type ErrorWidget as Q, type ResolvedTableControls as R, type FormatOptions as S, type TableWidgetData as T, type GraphPoint as U, type GraphSeries as V, type WidgetSize as W, type KpiDelta as X, type KpiDeltaOptions as Y, type LayoutItem as Z, type LoadingWidget as _, type WidgetFill as a, serializeLayout as a$, MAX_GRAPH_SERIES as a0, type Ok as a1, type OkWidget as a2, type ProviderOptions as a3, type ResolvedDetailOptions as a4, type ResolvedWidget as a5, type SortDirection as a6, type TableCell as a7, type TableColumn as a8, VALUE_FORMATS as a9, isMinimized as aA, isWidgetEmptyState as aB, isWidgetKind as aC, isWidgetVisibleTo as aD, kpiDelta as aE, labelStride as aF, loadingWidgets as aG, minimizeWidget as aH, moveWidget as aI, moveWidgetBy as aJ, moveWidgetDown as aK, moveWidgetUp as aL, niceDomain as aM, niceStep as aN, ok as aO, parseDetailQuery as aP, parseLayout as aQ, percentChange as aR, pruneLayout as aS, queryRows as aT, resolveDetailOptions as aU, resolvePayload as aV, resolveTableControls as aW, resolveWidget as aX, resolveWidgets as aY, restoreWidget as aZ, serializeDetailQuery as a_, type ValueFormat as aa, WIDGET_FILLS as ab, WIDGET_KINDS as ac, WIDGET_SIZES as ad, type WidgetCache as ae, type WidgetDataOf as af, type WidgetDetailOptions as ag, type WidgetEmptyState as ah, type WidgetProvider as ai, type WidgetStatus as aj, type WidgetTableControls as ak, cacheKeyFor as al, defaultDetailQuery as am, defineWidget as an, deriveDetailData as ao, describeUnknownError as ap, emptyTextFor as aq, emptyWidget as ar, err as as, failedWidget as at, formatCount as au, formatPercentChange as av, formatValue as aw, hiddenWidgets as ax, hideWidget as ay, isHidden as az, type WidgetDefinition as b, shareOf as b0, showWidget as b1, sortDefinitions as b2, tableDetailData as b3, toggleHidden as b4, toggleMinimized as b5, validateDetailData as b6, visibleWidgets as b7, widgetsFor as b8, type DetailProviderOptions as c, type DetailData as d, type DetailQuery as e, type DashboardLayout as f, type GaugeWidgetData as g, type TextWidgetData as h, type WidgetData as i, type ResolveOptions as j, type WidgetContext as k, type WidgetProviders as l, type WidgetKind as m, type Result as n, type WidgetPayload as o, type AlertListItem as p, type BarListItem as q, DEFAULT_COMPARISON_LABEL as r, DEFAULT_CURRENCY as s, DEFAULT_DETAIL_PAGE_SIZE as t, DEFAULT_EMPTY_TEXT as u, DETAIL_MODES as v, type DeltaDirection as w, type DeltaSentiment as x, type DetailCell as y, type DetailColumn as z };
|
package/dist/styles.css
CHANGED
|
@@ -700,3 +700,19 @@
|
|
|
700
700
|
border-radius: 0;
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
|
+
|
|
704
|
+
:where(.dwt-table-search) {
|
|
705
|
+
margin-block-end: 8px;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
:where(.dwt-table-search input) {
|
|
709
|
+
box-sizing: border-box;
|
|
710
|
+
inline-size: 100%;
|
|
711
|
+
max-inline-size: 256px;
|
|
712
|
+
font: inherit;
|
|
713
|
+
color: var(--dwt-text);
|
|
714
|
+
background: var(--dwt-surface);
|
|
715
|
+
border: 1px solid var(--dwt-border);
|
|
716
|
+
border-radius: 6px;
|
|
717
|
+
padding: 4px 8px;
|
|
718
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@richardmcquiston01/dashboard-widgets-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Framework-agnostic dashboard widget toolkit: typed widget definitions and data payloads (KPI, gauge, table, bar list, alert list, chart), user layout (order, hide, minimise), and React renderers. Bring your own data providers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dashboard",
|