@richardmcquiston01/dashboard-widgets-toolkit 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +2225 -1904
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +57 -3
- package/dist/core.d.ts +57 -3
- package/dist/core.js +2211 -1905
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +2225 -1904
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2211 -1905
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +381 -23
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +30 -2
- package/dist/react.d.ts +30 -2
- package/dist/react.js +381 -23
- package/dist/react.js.map +1 -1
- package/dist/{storage-DwJ-vGJg.d.cts → storage-CRBfjiVZ.d.cts} +184 -62
- package/dist/{storage-DwJ-vGJg.d.ts → storage-CRBfjiVZ.d.ts} +184 -62
- package/package.json +1 -1
package/dist/react.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode, ReactElement, RefObject } from 'react';
|
|
2
|
-
import { D as DashboardWidget, W as WidgetSize, a as WidgetFill, G as GraphWidgetData, N as NiceDomain, b as WidgetDefinition, c as DetailProviderOptions, d as DetailData, e as DetailQuery, O as OptionValues, L as Locale, f as DashboardLayout, g as WidgetViewerSettings, h as WidgetSettingsPatch, A as AlertListWidgetData, B as BarListWidgetData, i as GaugeWidgetData, K as KpiWidgetData, T as TableWidgetData, R as ResolvedTableControls, j as DetailSort, k as TextWidgetData, l as WidgetData, m as LayoutPersistence, S as StoreScope, P as PageItem, n as NormalizeOptions, o as ResolveOptions, p as WidgetContext, q as WidgetProviders } from './storage-
|
|
2
|
+
import { D as DashboardWidget, W as WidgetSize, a as WidgetFill, G as GraphWidgetData, N as NiceDomain, b as WidgetDefinition, c as DetailProviderOptions, d as DetailData, e as DetailQuery, O as OptionValues, L as Locale, f as DashboardLayout, g as WidgetViewerSettings, h as WidgetSettingsPatch, A as AlertListWidgetData, B as BarListWidgetData, i as GaugeWidgetData, K as KpiWidgetData, T as TableWidgetData, R as ResolvedTableControls, j as DetailSort, k as TextWidgetData, l as WidgetData, m as LayoutPersistence, S as StoreScope, P as PageItem, n as NormalizeOptions, o as ResolveOptions, p as WidgetContext, q as WidgetProviders } from './storage-CRBfjiVZ.cjs';
|
|
3
3
|
|
|
4
4
|
interface WidgetCardProps {
|
|
5
5
|
readonly title: string;
|
|
@@ -216,6 +216,18 @@ interface DashboardLabels {
|
|
|
216
216
|
readonly menuHide: string;
|
|
217
217
|
/** The card menu's item that opens the Options dialog. */
|
|
218
218
|
readonly menuOptions: string;
|
|
219
|
+
/** Arrange menu item that makes a clone of the widget. */
|
|
220
|
+
readonly menuDuplicate: string;
|
|
221
|
+
readonly duplicate: (title: string) => string;
|
|
222
|
+
/** Accessible name of Duplicate when the page has no room; `reason` says why. */
|
|
223
|
+
readonly duplicateBlocked: (title: string, reason: string) => string;
|
|
224
|
+
readonly duplicated: (title: string) => string;
|
|
225
|
+
/** Options dialog button that deletes a clone. */
|
|
226
|
+
readonly optionsDelete: string;
|
|
227
|
+
readonly confirmDelete: string;
|
|
228
|
+
readonly deleted: (title: string) => string;
|
|
229
|
+
/** The title suggested for a clone shown with another view. */
|
|
230
|
+
readonly suggestedViewTitle: (title: string, viewLabel: string) => string;
|
|
219
231
|
/** The Options dialog: heading, fields and buttons. */
|
|
220
232
|
readonly optionsFor: (title: string) => string;
|
|
221
233
|
readonly optionsTitleField: string;
|
|
@@ -393,11 +405,18 @@ interface WidgetOptionsDialogProps {
|
|
|
393
405
|
};
|
|
394
406
|
/** Whether another widget already shows this title; the dialog refuses it. */
|
|
395
407
|
readonly isTitleInUse?: (title: string) => boolean;
|
|
408
|
+
/**
|
|
409
|
+
* For a clone: its original's title, so choosing another view can suggest
|
|
410
|
+
* a title like "Recent Orders Line Chart".
|
|
411
|
+
*/
|
|
412
|
+
readonly sourceTitle?: string;
|
|
413
|
+
/** For a clone: shows "Delete this widget"; called after the viewer confirms. */
|
|
414
|
+
readonly onDelete?: () => void;
|
|
396
415
|
/** Called after the viewer confirms Apply, Reset or Revert. */
|
|
397
416
|
readonly onApply: (patch: WidgetSettingsPatch) => void;
|
|
398
417
|
readonly onClose: () => void;
|
|
399
418
|
}
|
|
400
|
-
declare function WidgetOptionsDialog({ definition, settings, baseline, isTitleInUse, onApply, onClose, }: WidgetOptionsDialogProps): ReactElement;
|
|
419
|
+
declare function WidgetOptionsDialog({ definition, settings, baseline, isTitleInUse, sourceTitle, onDelete, onApply, onClose, }: WidgetOptionsDialogProps): ReactElement;
|
|
401
420
|
|
|
402
421
|
/**
|
|
403
422
|
* Default colors, used as `var(--dwt-*, fallback)` so charts read correctly
|
|
@@ -547,6 +566,13 @@ interface UseWidgetsOptions extends ResolveOptions {
|
|
|
547
566
|
* fresh object each render.
|
|
548
567
|
*/
|
|
549
568
|
readonly optionValues?: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;
|
|
569
|
+
/**
|
|
570
|
+
* The view each widget shows, by widget key (see `viewValuesFromLayout`).
|
|
571
|
+
* Only views the provider supplies matter: choosing one loads it (the
|
|
572
|
+
* provider is called with `options.view`), and the card shows loading until
|
|
573
|
+
* it arrives. It may be a fresh object each render.
|
|
574
|
+
*/
|
|
575
|
+
readonly viewValues?: Readonly<Record<string, string | undefined>>;
|
|
550
576
|
}
|
|
551
577
|
interface UseWidgetsResult {
|
|
552
578
|
/** Pass to `Dashboard` or `WidgetGrid`: placeholders first, then results. */
|
|
@@ -555,6 +581,8 @@ interface UseWidgetsResult {
|
|
|
555
581
|
readonly refresh: (key?: string) => void;
|
|
556
582
|
/** Choose option values for one widget; same effect as `optionValues`. */
|
|
557
583
|
readonly setOptions: (key: string, chosen: Readonly<Record<string, unknown>>) => void;
|
|
584
|
+
/** Choose a widget's view; same effect as `viewValues`. */
|
|
585
|
+
readonly setView: (key: string, view: string | undefined) => void;
|
|
558
586
|
/**
|
|
559
587
|
* For `loadWhen: 'visible'`: attach to any element that contains the cards,
|
|
560
588
|
* for example a wrapper `<div ref={gridRef}>` around `Dashboard`.
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode, ReactElement, RefObject } from 'react';
|
|
2
|
-
import { D as DashboardWidget, W as WidgetSize, a as WidgetFill, G as GraphWidgetData, N as NiceDomain, b as WidgetDefinition, c as DetailProviderOptions, d as DetailData, e as DetailQuery, O as OptionValues, L as Locale, f as DashboardLayout, g as WidgetViewerSettings, h as WidgetSettingsPatch, A as AlertListWidgetData, B as BarListWidgetData, i as GaugeWidgetData, K as KpiWidgetData, T as TableWidgetData, R as ResolvedTableControls, j as DetailSort, k as TextWidgetData, l as WidgetData, m as LayoutPersistence, S as StoreScope, P as PageItem, n as NormalizeOptions, o as ResolveOptions, p as WidgetContext, q as WidgetProviders } from './storage-
|
|
2
|
+
import { D as DashboardWidget, W as WidgetSize, a as WidgetFill, G as GraphWidgetData, N as NiceDomain, b as WidgetDefinition, c as DetailProviderOptions, d as DetailData, e as DetailQuery, O as OptionValues, L as Locale, f as DashboardLayout, g as WidgetViewerSettings, h as WidgetSettingsPatch, A as AlertListWidgetData, B as BarListWidgetData, i as GaugeWidgetData, K as KpiWidgetData, T as TableWidgetData, R as ResolvedTableControls, j as DetailSort, k as TextWidgetData, l as WidgetData, m as LayoutPersistence, S as StoreScope, P as PageItem, n as NormalizeOptions, o as ResolveOptions, p as WidgetContext, q as WidgetProviders } from './storage-CRBfjiVZ.js';
|
|
3
3
|
|
|
4
4
|
interface WidgetCardProps {
|
|
5
5
|
readonly title: string;
|
|
@@ -216,6 +216,18 @@ interface DashboardLabels {
|
|
|
216
216
|
readonly menuHide: string;
|
|
217
217
|
/** The card menu's item that opens the Options dialog. */
|
|
218
218
|
readonly menuOptions: string;
|
|
219
|
+
/** Arrange menu item that makes a clone of the widget. */
|
|
220
|
+
readonly menuDuplicate: string;
|
|
221
|
+
readonly duplicate: (title: string) => string;
|
|
222
|
+
/** Accessible name of Duplicate when the page has no room; `reason` says why. */
|
|
223
|
+
readonly duplicateBlocked: (title: string, reason: string) => string;
|
|
224
|
+
readonly duplicated: (title: string) => string;
|
|
225
|
+
/** Options dialog button that deletes a clone. */
|
|
226
|
+
readonly optionsDelete: string;
|
|
227
|
+
readonly confirmDelete: string;
|
|
228
|
+
readonly deleted: (title: string) => string;
|
|
229
|
+
/** The title suggested for a clone shown with another view. */
|
|
230
|
+
readonly suggestedViewTitle: (title: string, viewLabel: string) => string;
|
|
219
231
|
/** The Options dialog: heading, fields and buttons. */
|
|
220
232
|
readonly optionsFor: (title: string) => string;
|
|
221
233
|
readonly optionsTitleField: string;
|
|
@@ -393,11 +405,18 @@ interface WidgetOptionsDialogProps {
|
|
|
393
405
|
};
|
|
394
406
|
/** Whether another widget already shows this title; the dialog refuses it. */
|
|
395
407
|
readonly isTitleInUse?: (title: string) => boolean;
|
|
408
|
+
/**
|
|
409
|
+
* For a clone: its original's title, so choosing another view can suggest
|
|
410
|
+
* a title like "Recent Orders Line Chart".
|
|
411
|
+
*/
|
|
412
|
+
readonly sourceTitle?: string;
|
|
413
|
+
/** For a clone: shows "Delete this widget"; called after the viewer confirms. */
|
|
414
|
+
readonly onDelete?: () => void;
|
|
396
415
|
/** Called after the viewer confirms Apply, Reset or Revert. */
|
|
397
416
|
readonly onApply: (patch: WidgetSettingsPatch) => void;
|
|
398
417
|
readonly onClose: () => void;
|
|
399
418
|
}
|
|
400
|
-
declare function WidgetOptionsDialog({ definition, settings, baseline, isTitleInUse, onApply, onClose, }: WidgetOptionsDialogProps): ReactElement;
|
|
419
|
+
declare function WidgetOptionsDialog({ definition, settings, baseline, isTitleInUse, sourceTitle, onDelete, onApply, onClose, }: WidgetOptionsDialogProps): ReactElement;
|
|
401
420
|
|
|
402
421
|
/**
|
|
403
422
|
* Default colors, used as `var(--dwt-*, fallback)` so charts read correctly
|
|
@@ -547,6 +566,13 @@ interface UseWidgetsOptions extends ResolveOptions {
|
|
|
547
566
|
* fresh object each render.
|
|
548
567
|
*/
|
|
549
568
|
readonly optionValues?: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;
|
|
569
|
+
/**
|
|
570
|
+
* The view each widget shows, by widget key (see `viewValuesFromLayout`).
|
|
571
|
+
* Only views the provider supplies matter: choosing one loads it (the
|
|
572
|
+
* provider is called with `options.view`), and the card shows loading until
|
|
573
|
+
* it arrives. It may be a fresh object each render.
|
|
574
|
+
*/
|
|
575
|
+
readonly viewValues?: Readonly<Record<string, string | undefined>>;
|
|
550
576
|
}
|
|
551
577
|
interface UseWidgetsResult {
|
|
552
578
|
/** Pass to `Dashboard` or `WidgetGrid`: placeholders first, then results. */
|
|
@@ -555,6 +581,8 @@ interface UseWidgetsResult {
|
|
|
555
581
|
readonly refresh: (key?: string) => void;
|
|
556
582
|
/** Choose option values for one widget; same effect as `optionValues`. */
|
|
557
583
|
readonly setOptions: (key: string, chosen: Readonly<Record<string, unknown>>) => void;
|
|
584
|
+
/** Choose a widget's view; same effect as `viewValues`. */
|
|
585
|
+
readonly setView: (key: string, view: string | undefined) => void;
|
|
558
586
|
/**
|
|
559
587
|
* For `loadWhen: 'visible'`: attach to any element that contains the cards,
|
|
560
588
|
* for example a wrapper `<div ref={gridRef}>` around `Dashboard`.
|