@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/core.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as WidgetDefinition, D as DashboardWidget, p as WidgetContext, o as ResolveOptions, q as WidgetProviders,
|
|
2
|
-
export {
|
|
1
|
+
import { b as WidgetDefinition, r as PageOptions, C as CloneOptions, f as DashboardLayout, P as PageItem, s as Result, t as WidgetClone, D as DashboardWidget, p as WidgetContext, o as ResolveOptions, q as WidgetProviders, u as WidgetKind, v as WidgetPayload } from './storage-CRBfjiVZ.cjs';
|
|
2
|
+
export { w as AddPageOptions, x as AlertListItem, A as AlertListWidgetData, y as BASE_VIEW_KEY, z as BarListItem, B as BarListWidgetData, E as BooleanOption, F as CachedPayload, H as ChoiceOption, I as CloneItem, J as ColorOption, M as ColumnsOption, Q as ConflictPolicy, U as ConvertViewOptions, V as DATE_RANGE_PRESETS, X as DEFAULT_COMPARISON_LABEL, Y as DEFAULT_CURRENCY, Z as DEFAULT_DETAIL_PAGE_SIZE, _ as DEFAULT_EMPTY_TEXT, $ as DEFAULT_MAX_LAYOUT_BYTES, a0 as DEFAULT_PAGE_KEY, a1 as DEFAULT_PAGE_ROWS, a2 as DETAIL_MODES, a3 as DateRangeOption, a4 as DateRangePreset, a5 as DeltaDirection, a6 as DeltaSentiment, a7 as DetailCell, a8 as DetailColumn, d as DetailData, a9 as DetailMode, aa as DetailPage, ab as DetailProvider, c as DetailProviderOptions, ac as DetailProviders, e as DetailQuery, j as DetailSort, ad as EMPTY_LAYOUT, ae as EmptyWidget, af as EncodingOptions, ag as EnforceLocksOptions, ah as Err, ai as ErrorWidget, aj as FormatOptions, i as GaugeWidgetData, ak as GraphPoint, al as GraphSeries, G as GraphWidgetData, am as GridItem, an as KpiDelta, ao as KpiDeltaOptions, K as KpiWidgetData, ap as LAYOUT_ENVELOPE_VERSION, aq as LayoutItem, ar as LayoutPage, m as LayoutPersistence, as as LayoutPersistenceOptions, at as LayoutSettings, au as LoadedLayout, av as LoadingWidget, L as Locale, aw as MAX_DETAIL_PAGE_SIZE, ax as MAX_GRAPH_SERIES, ay as MAX_PAGE_ROWS, az as MAX_PAGE_TITLE_LENGTH, aA as MAX_PARSED_CLONES, aB as MAX_PARSED_PAGES, aC as MAX_PARSED_SETTINGS, aD as MAX_TEXT_OPTION_LENGTH, aE as MAX_WIDGET_OPTIONS, aF as MAX_WIDGET_TITLE_LENGTH, aG as MAX_WIDGET_VIEWS, aH as MAX_WIDGET_WIDTH, aI as MIN_WIDGET_WIDTH, N as NiceDomain, n as NormalizeOptions, aJ as NormalizeSettingsOptions, aK as NumberOption, aL as OPTION_KEY_PATTERN, aM as Ok, aN as OkWidget, aO as OptionContext, aP as OptionValue, O as OptionValues, aQ as PageRoom, aR as PlacedRow, aS as ProviderOptions, aT as ResolvedDetailOptions, R as ResolvedTableControls, aU as ResolvedWidget, aV as ResolvedWidgetLock, aW as RetryOptions, aX as SaveOptions, aY as SavedLayout, aZ as SettingsItem, a_ as SortDirection, a$ as SortOption, b0 as StorageAdapter, b1 as StorageLogEvent, b2 as StoreErrorCode, b3 as StoreResult, S as StoreScope, b4 as StoredValue, b5 as TableCell, b6 as TableColumn, T as TableWidgetData, b7 as TextOption, k as TextWidgetData, b8 as VALUE_FORMATS, b9 as VIEW_CONVERSIONS, ba as ValueFormat, bb as ViewConversion, bc as ViewsItem, bd as WIDGET_FILLS, be as WIDGET_KINDS, bf as WIDGET_OPTION_TYPES, bg as WIDGET_SIZES, bh as WIDTH_COLUMNS, bi as WidgetCache, l as WidgetData, bj as WidgetDataOf, bk as WidgetDetailOptions, bl as WidgetEmptyState, a as WidgetFill, bm as WidgetLock, bn as WidgetOption, bo as WidgetProvider, h as WidgetSettingsPatch, W as WidgetSize, bp as WidgetStatus, bq as WidgetTableControls, br as WidgetView, g as WidgetViewerSettings, bs as addPage, bt as applyClientOptions, bu as applySettings, bv as applyView, bw as assignPages, bx as baseColumnSpan, by as cacheKeyFor, bz as cleanClones, bA as clearWidgetSettings, bB as cloneNumber, bC as coerceOptionValue, bD as convertView, bE as createLayoutPersistence, bF as defaultDetailQuery, bG as defaultOptionValue, bH as defineWidget, bI as deriveDetailData, bJ as describeUnknownError, bK as effectiveDefinitions, bL as effectiveViewKey, bM as emptyTextFor, bN as emptyWidget, bO as enforceLocks, bP as err, bQ as failedWidget, bR as fillColumnSpans, bS as fillWidthSpans, bT as fillsHeight, bU as fillsWidth, bV as finalizeWidget, bW as findView, bX as fitCount, bY as formatCount, bZ as formatPercentChange, b_ as formatValue, b$ as hasPages, c0 as hasViews, c1 as hiddenWidgets, c2 as hideWidget, c3 as isClientApplied, c4 as isColumnKeyFor, c5 as isFlexible, c6 as isHidden, c7 as isIsoInterval, c8 as isMinimized, c9 as isOptionsLocked, ca as isProviderView, cb as isTitleInUse, cc as isWidgetEmptyState, cd as isWidgetKind, ce as isWidgetVisibleTo, cf as isWidgetWidth, cg as itemWidth, ch as kindLabel, ci as kpiDelta, cj as labelStride, ck as loadViewKey, cl as loadViewKind, cm as loadingWidgets, cn as memoryAdapter, co as minimizeWidget, cp as movePage, cq as moveWidget, cr as moveWidgetBy, cs as moveWidgetDown, ct as moveWidgetToPage, cu as moveWidgetUp, cv as nextPageKey, cw as niceDomain, cx as niceStep, cy as normalizeLayout, cz as normalizeSettings, cA as normalizeTitle, cB as ok, cC as optionValuesFor, cD as optionValuesFromLayout, cE as optionsCacheSuffix, cF as pageLayout, cG as pageList, cH as pageOf, cI as pageRoom, cJ as pageWidgets, cK as parseClones, cL as parseDetailQuery, cM as parseLayout, cN as parseSettings, cO as parseSortValue, cP as percentChange, cQ as placeRows, cR as pruneLayout, cS as queryRows, cT as readOnly, cU as removePage, cV as renamePage, cW as resolveDateRange, cX as resolveDetailOptions, cY as resolveOptionValues, cZ as resolvePageKey, c_ as resolvePayload, c$ as resolveTableControls, d0 as resolveWidget, d1 as resolveWidgetLock, d2 as resolveWidgetUnapplied, d3 as resolveWidgets, d4 as restoreWidget, d5 as sameOptionValues, d6 as serializeClones, d7 as serializeDetailQuery, d8 as serializeLayout, d9 as serializeSettings, da as setWidgetSettings, db as shareOf, dc as showWidget, dd as sortDefinitions, de as sortFromOptions, df as tableDetailData, dg as toggleHidden, dh as toggleMinimized, di as usesWidthColumns, dj as utf8Length, dk as validateDetailData, dl as viewChoices, dm as viewKind, dn as viewNote, dp as viewValuesFromLayout, dq as visibleWidgets, dr as widgetOptionValues, ds as widgetsFor, dt as widthForSize, du as widthRange, dv as widthShareLabel, dw as withClones, dx as withEncoding, dy as withFallback, dz as withLogging, dA as withPageLayout, dB as withPrefix, dC as withReadCache, dD as withRetry } from './storage-CRBfjiVZ.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Maker Toolkit compatibility. Its API (`apps/api/src/widgets`) serves
|
|
@@ -33,6 +33,52 @@ interface LegacyWidgetDefinition {
|
|
|
33
33
|
*/
|
|
34
34
|
declare function fromLegacyDefinition(legacy: LegacyWidgetDefinition): WidgetDefinition | null;
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Making and deleting clones (see `clones.ts`): the layout changes behind a
|
|
38
|
+
* "Duplicate" and a "Delete" control. Inputs are never mutated; a refusal is
|
|
39
|
+
* a `Result` with a specific message, and a no-op returns the same object.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/** Options for `duplicateWidget`. */
|
|
43
|
+
interface DuplicateOptions extends PageOptions, CloneOptions {
|
|
44
|
+
}
|
|
45
|
+
/** What `duplicateWidget` returns: the new layout and the clone's key. */
|
|
46
|
+
interface Duplicated {
|
|
47
|
+
readonly layout: DashboardLayout;
|
|
48
|
+
/** The new clone's key, for opening its Options dialog. */
|
|
49
|
+
readonly key: string;
|
|
50
|
+
}
|
|
51
|
+
/** Whether a widget (or the widget a clone copies) may be duplicated. */
|
|
52
|
+
declare function canDuplicate(definitions: readonly PageItem[], key: string, options?: CloneOptions): boolean;
|
|
53
|
+
/** `from#n`, with n one more than the highest number used for that original. */
|
|
54
|
+
declare function nextCloneKey(definitions: readonly {
|
|
55
|
+
readonly key: string;
|
|
56
|
+
}[], layout: {
|
|
57
|
+
readonly clones?: readonly WidgetClone[];
|
|
58
|
+
}, fromKey: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* A title for a clone shown with another view: "Recent Orders Line Chart".
|
|
61
|
+
* Cut to the title limit.
|
|
62
|
+
*/
|
|
63
|
+
declare function suggestedViewTitle(title: string, viewLabel: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Duplicates a widget into a clone placed right after it. The copy starts
|
|
66
|
+
* with the widget's own width, view and option values (not its title, which
|
|
67
|
+
* is "Title (#n)"). Cloning a clone clones the original. Refused for an
|
|
68
|
+
* unknown widget, when the original's `locked.clone` forbids it, and, in a
|
|
69
|
+
* paged layout, when the page has no room for the clone's width.
|
|
70
|
+
*
|
|
71
|
+
* Pass the definitions you render with (clones included, as `withClones`
|
|
72
|
+
* returns them).
|
|
73
|
+
*/
|
|
74
|
+
declare function duplicateWidget<T extends PageItem>(definitions: readonly T[], layout: DashboardLayout, key: string, options?: DuplicateOptions): Result<Duplicated>;
|
|
75
|
+
/**
|
|
76
|
+
* Removes a clone from the layout: its entry, its settings, and its place in
|
|
77
|
+
* every order, hidden and minimized list. Originals can't be deleted (hide
|
|
78
|
+
* them), so any other key returns the layout unchanged.
|
|
79
|
+
*/
|
|
80
|
+
declare function deleteClone(layout: DashboardLayout, key: string): DashboardLayout;
|
|
81
|
+
|
|
36
82
|
/**
|
|
37
83
|
* Loads widgets one by one, after the first render, and reports each result
|
|
38
84
|
* as it arrives. It is the logic behind the React `useWidgets` hook, kept
|
|
@@ -82,6 +128,14 @@ interface WidgetLoader {
|
|
|
82
128
|
* values don't change.
|
|
83
129
|
*/
|
|
84
130
|
setOptions(key: string, chosen: Readonly<Record<string, unknown>>): void;
|
|
131
|
+
/**
|
|
132
|
+
* Sets the view a widget shows (`undefined` or an empty string: its
|
|
133
|
+
* `defaultView`). Only a view the provider supplies loads anything: the
|
|
134
|
+
* provider is called with that view, the card shows loading until it
|
|
135
|
+
* arrives, and an earlier answer for the same view comes back from the
|
|
136
|
+
* cache. Switching among the base and converted views reloads nothing.
|
|
137
|
+
*/
|
|
138
|
+
setView(key: string, view: string | undefined): void;
|
|
85
139
|
/** Aborts everything in flight and ignores any later result. */
|
|
86
140
|
dispose(): void;
|
|
87
141
|
}
|
|
@@ -178,4 +232,4 @@ declare function validateWidgetData(value: unknown, options?: ValidateWidgetData
|
|
|
178
232
|
*/
|
|
179
233
|
declare function validateWidgetDefinition(value: unknown): Result<WidgetDefinition>;
|
|
180
234
|
|
|
181
|
-
export { DashboardWidget, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, type RefreshOptions, ResolveOptions, Result, THEME_TOKEN_VARIABLES, type ThemeColorKey, type ThemeLengthKey, type ThemeMode, type ThemeOptions, type ThemeTokenKey, type ThemeTokens, type ValidateWidgetDataOptions, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, type WidgetThemeStyles, createTheme, createWidgetLoader, fromLegacyDefinition, isSafeHref, isSafeImageUrl, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };
|
|
235
|
+
export { CloneOptions, DashboardLayout, DashboardWidget, type DuplicateOptions, type Duplicated, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, PageItem, PageOptions, type RefreshOptions, ResolveOptions, Result, THEME_TOKEN_VARIABLES, type ThemeColorKey, type ThemeLengthKey, type ThemeMode, type ThemeOptions, type ThemeTokenKey, type ThemeTokens, type ValidateWidgetDataOptions, WidgetClone, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, type WidgetThemeStyles, canDuplicate, createTheme, createWidgetLoader, deleteClone, duplicateWidget, fromLegacyDefinition, isSafeHref, isSafeImageUrl, nextCloneKey, suggestedViewTitle, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as WidgetDefinition, D as DashboardWidget, p as WidgetContext, o as ResolveOptions, q as WidgetProviders,
|
|
2
|
-
export {
|
|
1
|
+
import { b as WidgetDefinition, r as PageOptions, C as CloneOptions, f as DashboardLayout, P as PageItem, s as Result, t as WidgetClone, D as DashboardWidget, p as WidgetContext, o as ResolveOptions, q as WidgetProviders, u as WidgetKind, v as WidgetPayload } from './storage-CRBfjiVZ.js';
|
|
2
|
+
export { w as AddPageOptions, x as AlertListItem, A as AlertListWidgetData, y as BASE_VIEW_KEY, z as BarListItem, B as BarListWidgetData, E as BooleanOption, F as CachedPayload, H as ChoiceOption, I as CloneItem, J as ColorOption, M as ColumnsOption, Q as ConflictPolicy, U as ConvertViewOptions, V as DATE_RANGE_PRESETS, X as DEFAULT_COMPARISON_LABEL, Y as DEFAULT_CURRENCY, Z as DEFAULT_DETAIL_PAGE_SIZE, _ as DEFAULT_EMPTY_TEXT, $ as DEFAULT_MAX_LAYOUT_BYTES, a0 as DEFAULT_PAGE_KEY, a1 as DEFAULT_PAGE_ROWS, a2 as DETAIL_MODES, a3 as DateRangeOption, a4 as DateRangePreset, a5 as DeltaDirection, a6 as DeltaSentiment, a7 as DetailCell, a8 as DetailColumn, d as DetailData, a9 as DetailMode, aa as DetailPage, ab as DetailProvider, c as DetailProviderOptions, ac as DetailProviders, e as DetailQuery, j as DetailSort, ad as EMPTY_LAYOUT, ae as EmptyWidget, af as EncodingOptions, ag as EnforceLocksOptions, ah as Err, ai as ErrorWidget, aj as FormatOptions, i as GaugeWidgetData, ak as GraphPoint, al as GraphSeries, G as GraphWidgetData, am as GridItem, an as KpiDelta, ao as KpiDeltaOptions, K as KpiWidgetData, ap as LAYOUT_ENVELOPE_VERSION, aq as LayoutItem, ar as LayoutPage, m as LayoutPersistence, as as LayoutPersistenceOptions, at as LayoutSettings, au as LoadedLayout, av as LoadingWidget, L as Locale, aw as MAX_DETAIL_PAGE_SIZE, ax as MAX_GRAPH_SERIES, ay as MAX_PAGE_ROWS, az as MAX_PAGE_TITLE_LENGTH, aA as MAX_PARSED_CLONES, aB as MAX_PARSED_PAGES, aC as MAX_PARSED_SETTINGS, aD as MAX_TEXT_OPTION_LENGTH, aE as MAX_WIDGET_OPTIONS, aF as MAX_WIDGET_TITLE_LENGTH, aG as MAX_WIDGET_VIEWS, aH as MAX_WIDGET_WIDTH, aI as MIN_WIDGET_WIDTH, N as NiceDomain, n as NormalizeOptions, aJ as NormalizeSettingsOptions, aK as NumberOption, aL as OPTION_KEY_PATTERN, aM as Ok, aN as OkWidget, aO as OptionContext, aP as OptionValue, O as OptionValues, aQ as PageRoom, aR as PlacedRow, aS as ProviderOptions, aT as ResolvedDetailOptions, R as ResolvedTableControls, aU as ResolvedWidget, aV as ResolvedWidgetLock, aW as RetryOptions, aX as SaveOptions, aY as SavedLayout, aZ as SettingsItem, a_ as SortDirection, a$ as SortOption, b0 as StorageAdapter, b1 as StorageLogEvent, b2 as StoreErrorCode, b3 as StoreResult, S as StoreScope, b4 as StoredValue, b5 as TableCell, b6 as TableColumn, T as TableWidgetData, b7 as TextOption, k as TextWidgetData, b8 as VALUE_FORMATS, b9 as VIEW_CONVERSIONS, ba as ValueFormat, bb as ViewConversion, bc as ViewsItem, bd as WIDGET_FILLS, be as WIDGET_KINDS, bf as WIDGET_OPTION_TYPES, bg as WIDGET_SIZES, bh as WIDTH_COLUMNS, bi as WidgetCache, l as WidgetData, bj as WidgetDataOf, bk as WidgetDetailOptions, bl as WidgetEmptyState, a as WidgetFill, bm as WidgetLock, bn as WidgetOption, bo as WidgetProvider, h as WidgetSettingsPatch, W as WidgetSize, bp as WidgetStatus, bq as WidgetTableControls, br as WidgetView, g as WidgetViewerSettings, bs as addPage, bt as applyClientOptions, bu as applySettings, bv as applyView, bw as assignPages, bx as baseColumnSpan, by as cacheKeyFor, bz as cleanClones, bA as clearWidgetSettings, bB as cloneNumber, bC as coerceOptionValue, bD as convertView, bE as createLayoutPersistence, bF as defaultDetailQuery, bG as defaultOptionValue, bH as defineWidget, bI as deriveDetailData, bJ as describeUnknownError, bK as effectiveDefinitions, bL as effectiveViewKey, bM as emptyTextFor, bN as emptyWidget, bO as enforceLocks, bP as err, bQ as failedWidget, bR as fillColumnSpans, bS as fillWidthSpans, bT as fillsHeight, bU as fillsWidth, bV as finalizeWidget, bW as findView, bX as fitCount, bY as formatCount, bZ as formatPercentChange, b_ as formatValue, b$ as hasPages, c0 as hasViews, c1 as hiddenWidgets, c2 as hideWidget, c3 as isClientApplied, c4 as isColumnKeyFor, c5 as isFlexible, c6 as isHidden, c7 as isIsoInterval, c8 as isMinimized, c9 as isOptionsLocked, ca as isProviderView, cb as isTitleInUse, cc as isWidgetEmptyState, cd as isWidgetKind, ce as isWidgetVisibleTo, cf as isWidgetWidth, cg as itemWidth, ch as kindLabel, ci as kpiDelta, cj as labelStride, ck as loadViewKey, cl as loadViewKind, cm as loadingWidgets, cn as memoryAdapter, co as minimizeWidget, cp as movePage, cq as moveWidget, cr as moveWidgetBy, cs as moveWidgetDown, ct as moveWidgetToPage, cu as moveWidgetUp, cv as nextPageKey, cw as niceDomain, cx as niceStep, cy as normalizeLayout, cz as normalizeSettings, cA as normalizeTitle, cB as ok, cC as optionValuesFor, cD as optionValuesFromLayout, cE as optionsCacheSuffix, cF as pageLayout, cG as pageList, cH as pageOf, cI as pageRoom, cJ as pageWidgets, cK as parseClones, cL as parseDetailQuery, cM as parseLayout, cN as parseSettings, cO as parseSortValue, cP as percentChange, cQ as placeRows, cR as pruneLayout, cS as queryRows, cT as readOnly, cU as removePage, cV as renamePage, cW as resolveDateRange, cX as resolveDetailOptions, cY as resolveOptionValues, cZ as resolvePageKey, c_ as resolvePayload, c$ as resolveTableControls, d0 as resolveWidget, d1 as resolveWidgetLock, d2 as resolveWidgetUnapplied, d3 as resolveWidgets, d4 as restoreWidget, d5 as sameOptionValues, d6 as serializeClones, d7 as serializeDetailQuery, d8 as serializeLayout, d9 as serializeSettings, da as setWidgetSettings, db as shareOf, dc as showWidget, dd as sortDefinitions, de as sortFromOptions, df as tableDetailData, dg as toggleHidden, dh as toggleMinimized, di as usesWidthColumns, dj as utf8Length, dk as validateDetailData, dl as viewChoices, dm as viewKind, dn as viewNote, dp as viewValuesFromLayout, dq as visibleWidgets, dr as widgetOptionValues, ds as widgetsFor, dt as widthForSize, du as widthRange, dv as widthShareLabel, dw as withClones, dx as withEncoding, dy as withFallback, dz as withLogging, dA as withPageLayout, dB as withPrefix, dC as withReadCache, dD as withRetry } from './storage-CRBfjiVZ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Maker Toolkit compatibility. Its API (`apps/api/src/widgets`) serves
|
|
@@ -33,6 +33,52 @@ interface LegacyWidgetDefinition {
|
|
|
33
33
|
*/
|
|
34
34
|
declare function fromLegacyDefinition(legacy: LegacyWidgetDefinition): WidgetDefinition | null;
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Making and deleting clones (see `clones.ts`): the layout changes behind a
|
|
38
|
+
* "Duplicate" and a "Delete" control. Inputs are never mutated; a refusal is
|
|
39
|
+
* a `Result` with a specific message, and a no-op returns the same object.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/** Options for `duplicateWidget`. */
|
|
43
|
+
interface DuplicateOptions extends PageOptions, CloneOptions {
|
|
44
|
+
}
|
|
45
|
+
/** What `duplicateWidget` returns: the new layout and the clone's key. */
|
|
46
|
+
interface Duplicated {
|
|
47
|
+
readonly layout: DashboardLayout;
|
|
48
|
+
/** The new clone's key, for opening its Options dialog. */
|
|
49
|
+
readonly key: string;
|
|
50
|
+
}
|
|
51
|
+
/** Whether a widget (or the widget a clone copies) may be duplicated. */
|
|
52
|
+
declare function canDuplicate(definitions: readonly PageItem[], key: string, options?: CloneOptions): boolean;
|
|
53
|
+
/** `from#n`, with n one more than the highest number used for that original. */
|
|
54
|
+
declare function nextCloneKey(definitions: readonly {
|
|
55
|
+
readonly key: string;
|
|
56
|
+
}[], layout: {
|
|
57
|
+
readonly clones?: readonly WidgetClone[];
|
|
58
|
+
}, fromKey: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* A title for a clone shown with another view: "Recent Orders Line Chart".
|
|
61
|
+
* Cut to the title limit.
|
|
62
|
+
*/
|
|
63
|
+
declare function suggestedViewTitle(title: string, viewLabel: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Duplicates a widget into a clone placed right after it. The copy starts
|
|
66
|
+
* with the widget's own width, view and option values (not its title, which
|
|
67
|
+
* is "Title (#n)"). Cloning a clone clones the original. Refused for an
|
|
68
|
+
* unknown widget, when the original's `locked.clone` forbids it, and, in a
|
|
69
|
+
* paged layout, when the page has no room for the clone's width.
|
|
70
|
+
*
|
|
71
|
+
* Pass the definitions you render with (clones included, as `withClones`
|
|
72
|
+
* returns them).
|
|
73
|
+
*/
|
|
74
|
+
declare function duplicateWidget<T extends PageItem>(definitions: readonly T[], layout: DashboardLayout, key: string, options?: DuplicateOptions): Result<Duplicated>;
|
|
75
|
+
/**
|
|
76
|
+
* Removes a clone from the layout: its entry, its settings, and its place in
|
|
77
|
+
* every order, hidden and minimized list. Originals can't be deleted (hide
|
|
78
|
+
* them), so any other key returns the layout unchanged.
|
|
79
|
+
*/
|
|
80
|
+
declare function deleteClone(layout: DashboardLayout, key: string): DashboardLayout;
|
|
81
|
+
|
|
36
82
|
/**
|
|
37
83
|
* Loads widgets one by one, after the first render, and reports each result
|
|
38
84
|
* as it arrives. It is the logic behind the React `useWidgets` hook, kept
|
|
@@ -82,6 +128,14 @@ interface WidgetLoader {
|
|
|
82
128
|
* values don't change.
|
|
83
129
|
*/
|
|
84
130
|
setOptions(key: string, chosen: Readonly<Record<string, unknown>>): void;
|
|
131
|
+
/**
|
|
132
|
+
* Sets the view a widget shows (`undefined` or an empty string: its
|
|
133
|
+
* `defaultView`). Only a view the provider supplies loads anything: the
|
|
134
|
+
* provider is called with that view, the card shows loading until it
|
|
135
|
+
* arrives, and an earlier answer for the same view comes back from the
|
|
136
|
+
* cache. Switching among the base and converted views reloads nothing.
|
|
137
|
+
*/
|
|
138
|
+
setView(key: string, view: string | undefined): void;
|
|
85
139
|
/** Aborts everything in flight and ignores any later result. */
|
|
86
140
|
dispose(): void;
|
|
87
141
|
}
|
|
@@ -178,4 +232,4 @@ declare function validateWidgetData(value: unknown, options?: ValidateWidgetData
|
|
|
178
232
|
*/
|
|
179
233
|
declare function validateWidgetDefinition(value: unknown): Result<WidgetDefinition>;
|
|
180
234
|
|
|
181
|
-
export { DashboardWidget, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, type RefreshOptions, ResolveOptions, Result, THEME_TOKEN_VARIABLES, type ThemeColorKey, type ThemeLengthKey, type ThemeMode, type ThemeOptions, type ThemeTokenKey, type ThemeTokens, type ValidateWidgetDataOptions, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, type WidgetThemeStyles, createTheme, createWidgetLoader, fromLegacyDefinition, isSafeHref, isSafeImageUrl, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };
|
|
235
|
+
export { CloneOptions, DashboardLayout, DashboardWidget, type DuplicateOptions, type Duplicated, type LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, PageItem, PageOptions, type RefreshOptions, ResolveOptions, Result, THEME_TOKEN_VARIABLES, type ThemeColorKey, type ThemeLengthKey, type ThemeMode, type ThemeOptions, type ThemeTokenKey, type ThemeTokens, type ValidateWidgetDataOptions, WidgetClone, WidgetContext, WidgetDefinition, WidgetKind, type WidgetLoader, type WidgetLoaderOptions, WidgetPayload, WidgetProviders, type WidgetThemeStyles, canDuplicate, createTheme, createWidgetLoader, deleteClone, duplicateWidget, fromLegacyDefinition, isSafeHref, isSafeImageUrl, nextCloneKey, suggestedViewTitle, upgradeLegacyWidgetData, validateWidgetData, validateWidgetDefinition };
|