@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
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { GridItem, LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, MAX_WIDGET_WIDTH, MIN_WIDGET_WIDTH, RefreshOptions, ValidateWidgetDataOptions, WIDTH_COLUMNS, WidgetLoader, WidgetLoaderOptions, baseColumnSpan, createWidgetLoader, fillColumnSpans, fillWidthSpans, fillsHeight, fillsWidth, fromLegacyDefinition, isSafeHref, isSafeImageUrl, isWidgetWidth, itemWidth, upgradeLegacyWidgetData, usesWidthColumns, validateWidgetData, validateWidgetDefinition, widthForSize } from './core.cjs';
|
|
2
|
-
export {
|
|
2
|
+
export { p as AlertListItem, A as AlertListWidgetData, q as BarListItem, B as BarListWidgetData, C as CachedPayload, r as DEFAULT_COMPARISON_LABEL, s as DEFAULT_CURRENCY, t as DEFAULT_DETAIL_PAGE_SIZE, u as DEFAULT_EMPTY_TEXT, v as DETAIL_MODES, f as DashboardLayout, D as DashboardWidget, w as DeltaDirection, x as DeltaSentiment, y as DetailCell, z as DetailColumn, d as DetailData, E as DetailMode, F as DetailPage, H as DetailProvider, c as DetailProviderOptions, I as DetailProviders, e as DetailQuery, J as DetailSort, M as EMPTY_LAYOUT, O as EmptyWidget, P as Err, Q as ErrorWidget, S as FormatOptions, g as GaugeWidgetData, U as GraphPoint, V as GraphSeries, G as GraphWidgetData, X as KpiDelta, Y as KpiDeltaOptions, K as KpiWidgetData, Z as LayoutItem, _ as LoadingWidget, L as Locale, $ as MAX_DETAIL_PAGE_SIZE, a0 as MAX_GRAPH_SERIES, N as NiceDomain, a1 as Ok, a2 as OkWidget, a3 as ProviderOptions, j as ResolveOptions, a4 as ResolvedDetailOptions, R as ResolvedTableControls, a5 as ResolvedWidget, n as Result, a6 as SortDirection, a7 as TableCell, a8 as TableColumn, T as TableWidgetData, h as TextWidgetData, a9 as VALUE_FORMATS, aa as ValueFormat, ab as WIDGET_FILLS, ac as WIDGET_KINDS, ad as WIDGET_SIZES, ae as WidgetCache, k as WidgetContext, i as WidgetData, af as WidgetDataOf, b as WidgetDefinition, ag as WidgetDetailOptions, ah as WidgetEmptyState, a as WidgetFill, m as WidgetKind, o as WidgetPayload, ai as WidgetProvider, l as WidgetProviders, W as WidgetSize, aj as WidgetStatus, ak as WidgetTableControls, al as cacheKeyFor, am as defaultDetailQuery, an as defineWidget, ao as deriveDetailData, ap as describeUnknownError, aq as emptyTextFor, ar as emptyWidget, as as err, at as failedWidget, au as formatCount, av as formatPercentChange, aw as formatValue, ax as hiddenWidgets, ay as hideWidget, az as isHidden, aA as isMinimized, aB as isWidgetEmptyState, aC as isWidgetKind, aD as isWidgetVisibleTo, aE as kpiDelta, aF as labelStride, aG as loadingWidgets, aH as minimizeWidget, aI as moveWidget, aJ as moveWidgetBy, aK as moveWidgetDown, aL as moveWidgetUp, aM as niceDomain, aN as niceStep, aO as ok, aP as parseDetailQuery, aQ as parseLayout, aR as percentChange, aS as pruneLayout, aT as queryRows, aU as resolveDetailOptions, aV as resolvePayload, aW as resolveTableControls, aX as resolveWidget, aY as resolveWidgets, aZ as restoreWidget, a_ as serializeDetailQuery, a$ as serializeLayout, b0 as shareOf, b1 as showWidget, b2 as sortDefinitions, b3 as tableDetailData, b4 as toggleHidden, b5 as toggleMinimized, b6 as validateDetailData, b7 as visibleWidgets, b8 as widgetsFor } from './scale-D51ZGIF4.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { GridItem, LegacyWidgetDefinition, MAX_REPORTED_PROBLEMS, MAX_WIDGET_WIDTH, MIN_WIDGET_WIDTH, RefreshOptions, ValidateWidgetDataOptions, WIDTH_COLUMNS, WidgetLoader, WidgetLoaderOptions, baseColumnSpan, createWidgetLoader, fillColumnSpans, fillWidthSpans, fillsHeight, fillsWidth, fromLegacyDefinition, isSafeHref, isSafeImageUrl, isWidgetWidth, itemWidth, upgradeLegacyWidgetData, usesWidthColumns, validateWidgetData, validateWidgetDefinition, widthForSize } from './core.js';
|
|
2
|
-
export {
|
|
2
|
+
export { p as AlertListItem, A as AlertListWidgetData, q as BarListItem, B as BarListWidgetData, C as CachedPayload, r as DEFAULT_COMPARISON_LABEL, s as DEFAULT_CURRENCY, t as DEFAULT_DETAIL_PAGE_SIZE, u as DEFAULT_EMPTY_TEXT, v as DETAIL_MODES, f as DashboardLayout, D as DashboardWidget, w as DeltaDirection, x as DeltaSentiment, y as DetailCell, z as DetailColumn, d as DetailData, E as DetailMode, F as DetailPage, H as DetailProvider, c as DetailProviderOptions, I as DetailProviders, e as DetailQuery, J as DetailSort, M as EMPTY_LAYOUT, O as EmptyWidget, P as Err, Q as ErrorWidget, S as FormatOptions, g as GaugeWidgetData, U as GraphPoint, V as GraphSeries, G as GraphWidgetData, X as KpiDelta, Y as KpiDeltaOptions, K as KpiWidgetData, Z as LayoutItem, _ as LoadingWidget, L as Locale, $ as MAX_DETAIL_PAGE_SIZE, a0 as MAX_GRAPH_SERIES, N as NiceDomain, a1 as Ok, a2 as OkWidget, a3 as ProviderOptions, j as ResolveOptions, a4 as ResolvedDetailOptions, R as ResolvedTableControls, a5 as ResolvedWidget, n as Result, a6 as SortDirection, a7 as TableCell, a8 as TableColumn, T as TableWidgetData, h as TextWidgetData, a9 as VALUE_FORMATS, aa as ValueFormat, ab as WIDGET_FILLS, ac as WIDGET_KINDS, ad as WIDGET_SIZES, ae as WidgetCache, k as WidgetContext, i as WidgetData, af as WidgetDataOf, b as WidgetDefinition, ag as WidgetDetailOptions, ah as WidgetEmptyState, a as WidgetFill, m as WidgetKind, o as WidgetPayload, ai as WidgetProvider, l as WidgetProviders, W as WidgetSize, aj as WidgetStatus, ak as WidgetTableControls, al as cacheKeyFor, am as defaultDetailQuery, an as defineWidget, ao as deriveDetailData, ap as describeUnknownError, aq as emptyTextFor, ar as emptyWidget, as as err, at as failedWidget, au as formatCount, av as formatPercentChange, aw as formatValue, ax as hiddenWidgets, ay as hideWidget, az as isHidden, aA as isMinimized, aB as isWidgetEmptyState, aC as isWidgetKind, aD as isWidgetVisibleTo, aE as kpiDelta, aF as labelStride, aG as loadingWidgets, aH as minimizeWidget, aI as moveWidget, aJ as moveWidgetBy, aK as moveWidgetDown, aL as moveWidgetUp, aM as niceDomain, aN as niceStep, aO as ok, aP as parseDetailQuery, aQ as parseLayout, aR as percentChange, aS as pruneLayout, aT as queryRows, aU as resolveDetailOptions, aV as resolvePayload, aW as resolveTableControls, aX as resolveWidget, aY as resolveWidgets, aZ as restoreWidget, a_ as serializeDetailQuery, a$ as serializeLayout, b0 as shareOf, b1 as showWidget, b2 as sortDefinitions, b3 as tableDetailData, b4 as toggleHidden, b5 as toggleMinimized, b6 as validateDetailData, b7 as visibleWidgets, b8 as widgetsFor } from './scale-D51ZGIF4.js';
|
package/dist/index.js
CHANGED
|
@@ -250,6 +250,16 @@ function resolveDetailOptions(definition) {
|
|
|
250
250
|
mode: options.mode ?? "client"
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
|
+
function resolveTableControls(definition) {
|
|
254
|
+
const setting = definition.tableControls;
|
|
255
|
+
if (setting === void 0 || setting === false) return void 0;
|
|
256
|
+
const options = setting === true ? {} : setting;
|
|
257
|
+
const resolved = {
|
|
258
|
+
search: options.search ?? true,
|
|
259
|
+
sort: options.sort ?? true
|
|
260
|
+
};
|
|
261
|
+
return resolved.search || resolved.sort ? resolved : void 0;
|
|
262
|
+
}
|
|
253
263
|
function defaultDetailQuery(pageSize = DEFAULT_DETAIL_PAGE_SIZE) {
|
|
254
264
|
return { page: 1, pageSize };
|
|
255
265
|
}
|
|
@@ -524,17 +534,19 @@ function validateDetailData(data, subject = "Detail data") {
|
|
|
524
534
|
}
|
|
525
535
|
return ok(data);
|
|
526
536
|
}
|
|
537
|
+
function tableDetailData(data) {
|
|
538
|
+
return {
|
|
539
|
+
columns: data.columns.map((column, index) => ({
|
|
540
|
+
key: `c${index}`,
|
|
541
|
+
label: column.label,
|
|
542
|
+
...column.numeric === void 0 ? {} : { numeric: column.numeric }
|
|
543
|
+
})),
|
|
544
|
+
rows: data.rows
|
|
545
|
+
};
|
|
546
|
+
}
|
|
527
547
|
function deriveDetailData(data, locale) {
|
|
528
548
|
if (data.kind === "TABLE") {
|
|
529
|
-
|
|
530
|
-
return {
|
|
531
|
-
columns: data.columns.map((column, index) => ({
|
|
532
|
-
key: `c${index}`,
|
|
533
|
-
label: column.label,
|
|
534
|
-
...column.numeric === void 0 ? {} : { numeric: column.numeric }
|
|
535
|
-
})),
|
|
536
|
-
rows: data.rows
|
|
537
|
-
};
|
|
549
|
+
return data.footer === void 0 ? tableDetailData(data) : void 0;
|
|
538
550
|
}
|
|
539
551
|
if (data.kind === "BAR_LIST") {
|
|
540
552
|
return {
|
|
@@ -1019,6 +1031,24 @@ function checkDetailOption(detail, problems) {
|
|
|
1019
1031
|
requireOneOf(detail, "mode", DETAIL_MODES, "detail", problems);
|
|
1020
1032
|
}
|
|
1021
1033
|
}
|
|
1034
|
+
function checkTableControlsOption(controls, kind, problems) {
|
|
1035
|
+
if (controls === void 0 || controls === false) return;
|
|
1036
|
+
if (typeof controls !== "boolean" && !isRecord(controls)) {
|
|
1037
|
+
problems.push(
|
|
1038
|
+
`tableControls must be true, false or an options object, got ${describeType2(controls)}.`
|
|
1039
|
+
);
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
if (isRecord(controls)) {
|
|
1043
|
+
optionalBoolean(controls, "search", "tableControls", problems);
|
|
1044
|
+
optionalBoolean(controls, "sort", "tableControls", problems);
|
|
1045
|
+
}
|
|
1046
|
+
if (typeof kind === "string" && kind !== "TABLE") {
|
|
1047
|
+
problems.push(
|
|
1048
|
+
`tableControls only applies to TABLE widgets, but kind is "${kind}".`
|
|
1049
|
+
);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1022
1052
|
function formatProblems(prefix, problems) {
|
|
1023
1053
|
const shown = problems.slice(0, MAX_REPORTED_PROBLEMS);
|
|
1024
1054
|
const more = problems.length - shown.length;
|
|
@@ -1091,6 +1121,7 @@ function validateWidgetDefinition(value) {
|
|
|
1091
1121
|
);
|
|
1092
1122
|
}
|
|
1093
1123
|
checkDetailOption(value["detail"], problems);
|
|
1124
|
+
checkTableControlsOption(value["tableControls"], value["kind"], problems);
|
|
1094
1125
|
if (value["fill"] !== void 0) {
|
|
1095
1126
|
requireOneOf(value, "fill", WIDGET_FILLS, "", problems);
|
|
1096
1127
|
}
|
|
@@ -1374,6 +1405,6 @@ function labelStride(count, maxLabels = 6) {
|
|
|
1374
1405
|
return Math.max(1, Math.ceil(count / Math.max(1, maxLabels)));
|
|
1375
1406
|
}
|
|
1376
1407
|
|
|
1377
|
-
export { DEFAULT_COMPARISON_LABEL, DEFAULT_CURRENCY, DEFAULT_DETAIL_PAGE_SIZE, DEFAULT_EMPTY_TEXT, DETAIL_MODES, EMPTY_LAYOUT, MAX_DETAIL_PAGE_SIZE, MAX_GRAPH_SERIES, MAX_REPORTED_PROBLEMS, MAX_WIDGET_WIDTH, MIN_WIDGET_WIDTH, VALUE_FORMATS, WIDGET_FILLS, WIDGET_KINDS, WIDGET_SIZES, WIDTH_COLUMNS, baseColumnSpan, cacheKeyFor, createWidgetLoader, defaultDetailQuery, defineWidget, deriveDetailData, describeUnknownError, emptyTextFor, emptyWidget, err, failedWidget, fillColumnSpans, fillWidthSpans, fillsHeight, fillsWidth, formatCount, formatPercentChange, formatValue, fromLegacyDefinition, hiddenWidgets, hideWidget, isHidden, isMinimized, isSafeHref, isSafeImageUrl, isWidgetEmptyState, isWidgetKind, isWidgetVisibleTo, isWidgetWidth, itemWidth, kpiDelta, labelStride, loadingWidgets, minimizeWidget, moveWidget, moveWidgetBy, moveWidgetDown, moveWidgetUp, niceDomain, niceStep, ok, parseDetailQuery, parseLayout, percentChange, pruneLayout, queryRows, resolveDetailOptions, resolvePayload, resolveWidget, resolveWidgets, restoreWidget, serializeDetailQuery, serializeLayout, shareOf, showWidget, sortDefinitions, toggleHidden, toggleMinimized, upgradeLegacyWidgetData, usesWidthColumns, validateDetailData, validateWidgetData, validateWidgetDefinition, visibleWidgets, widgetsFor, widthForSize };
|
|
1408
|
+
export { DEFAULT_COMPARISON_LABEL, DEFAULT_CURRENCY, DEFAULT_DETAIL_PAGE_SIZE, DEFAULT_EMPTY_TEXT, DETAIL_MODES, EMPTY_LAYOUT, MAX_DETAIL_PAGE_SIZE, MAX_GRAPH_SERIES, MAX_REPORTED_PROBLEMS, MAX_WIDGET_WIDTH, MIN_WIDGET_WIDTH, VALUE_FORMATS, WIDGET_FILLS, WIDGET_KINDS, WIDGET_SIZES, WIDTH_COLUMNS, baseColumnSpan, cacheKeyFor, createWidgetLoader, defaultDetailQuery, defineWidget, deriveDetailData, describeUnknownError, emptyTextFor, emptyWidget, err, failedWidget, fillColumnSpans, fillWidthSpans, fillsHeight, fillsWidth, formatCount, formatPercentChange, formatValue, fromLegacyDefinition, hiddenWidgets, hideWidget, isHidden, isMinimized, isSafeHref, isSafeImageUrl, isWidgetEmptyState, isWidgetKind, isWidgetVisibleTo, isWidgetWidth, itemWidth, kpiDelta, labelStride, loadingWidgets, minimizeWidget, moveWidget, moveWidgetBy, moveWidgetDown, moveWidgetUp, niceDomain, niceStep, ok, parseDetailQuery, parseLayout, percentChange, pruneLayout, queryRows, resolveDetailOptions, resolvePayload, resolveTableControls, resolveWidget, resolveWidgets, restoreWidget, serializeDetailQuery, serializeLayout, shareOf, showWidget, sortDefinitions, tableDetailData, toggleHidden, toggleMinimized, upgradeLegacyWidgetData, usesWidthColumns, validateDetailData, validateWidgetData, validateWidgetDefinition, visibleWidgets, widgetsFor, widthForSize };
|
|
1378
1409
|
//# sourceMappingURL=index.js.map
|
|
1379
1410
|
//# sourceMappingURL=index.js.map
|