@richardmcquiston01/dashboard-widgets-toolkit 0.5.0 → 0.7.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 +6 -1
- package/dist/core.cjs +51 -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 +50 -10
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +51 -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 +50 -10
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +575 -456
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +7 -3
- package/dist/react.d.ts +7 -3
- package/dist/react.js +575 -456
- package/dist/react.js.map +1 -1
- package/dist/{scale-dWDGE1zW.d.cts → scale-W60sXwlI.d.cts} +37 -1
- package/dist/{scale-dWDGE1zW.d.ts → scale-W60sXwlI.d.ts} +37 -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-W60sXwlI.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-W60sXwlI.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 {
|
|
@@ -812,6 +824,14 @@ function optionalNumber(record, field, path, problems) {
|
|
|
812
824
|
requireNumber(record, field, path, problems);
|
|
813
825
|
}
|
|
814
826
|
}
|
|
827
|
+
function optionalSortValue(record, path, problems) {
|
|
828
|
+
const value = record["value"];
|
|
829
|
+
if (value !== void 0 && typeof value !== "string" && !(typeof value === "number" && Number.isFinite(value))) {
|
|
830
|
+
problems.push(
|
|
831
|
+
`${path}.value must be a string or a finite number, got ${describeType2(value)}.`
|
|
832
|
+
);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
815
835
|
function optionalBoolean(record, field, path, problems) {
|
|
816
836
|
const value = record[field];
|
|
817
837
|
if (value !== void 0 && typeof value !== "boolean") {
|
|
@@ -915,6 +935,7 @@ function checkPayloadFields(kind, data, problems) {
|
|
|
915
935
|
}
|
|
916
936
|
eachRecord(row, rowPath, problems, (cell, cellPath) => {
|
|
917
937
|
requireString(cell, "text", cellPath, problems);
|
|
938
|
+
optionalSortValue(cell, cellPath, problems);
|
|
918
939
|
optionalUrl(
|
|
919
940
|
cell,
|
|
920
941
|
"href",
|
|
@@ -1019,6 +1040,24 @@ function checkDetailOption(detail, problems) {
|
|
|
1019
1040
|
requireOneOf(detail, "mode", DETAIL_MODES, "detail", problems);
|
|
1020
1041
|
}
|
|
1021
1042
|
}
|
|
1043
|
+
function checkTableControlsOption(controls, kind, problems) {
|
|
1044
|
+
if (controls === void 0 || controls === false) return;
|
|
1045
|
+
if (typeof controls !== "boolean" && !isRecord(controls)) {
|
|
1046
|
+
problems.push(
|
|
1047
|
+
`tableControls must be true, false or an options object, got ${describeType2(controls)}.`
|
|
1048
|
+
);
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
if (isRecord(controls)) {
|
|
1052
|
+
optionalBoolean(controls, "search", "tableControls", problems);
|
|
1053
|
+
optionalBoolean(controls, "sort", "tableControls", problems);
|
|
1054
|
+
}
|
|
1055
|
+
if (typeof kind === "string" && kind !== "TABLE") {
|
|
1056
|
+
problems.push(
|
|
1057
|
+
`tableControls only applies to TABLE widgets, but kind is "${kind}".`
|
|
1058
|
+
);
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1022
1061
|
function formatProblems(prefix, problems) {
|
|
1023
1062
|
const shown = problems.slice(0, MAX_REPORTED_PROBLEMS);
|
|
1024
1063
|
const more = problems.length - shown.length;
|
|
@@ -1091,6 +1130,7 @@ function validateWidgetDefinition(value) {
|
|
|
1091
1130
|
);
|
|
1092
1131
|
}
|
|
1093
1132
|
checkDetailOption(value["detail"], problems);
|
|
1133
|
+
checkTableControlsOption(value["tableControls"], value["kind"], problems);
|
|
1094
1134
|
if (value["fill"] !== void 0) {
|
|
1095
1135
|
requireOneOf(value, "fill", WIDGET_FILLS, "", problems);
|
|
1096
1136
|
}
|
|
@@ -1374,6 +1414,6 @@ function labelStride(count, maxLabels = 6) {
|
|
|
1374
1414
|
return Math.max(1, Math.ceil(count / Math.max(1, maxLabels)));
|
|
1375
1415
|
}
|
|
1376
1416
|
|
|
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 };
|
|
1417
|
+
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
1418
|
//# sourceMappingURL=index.js.map
|
|
1379
1419
|
//# sourceMappingURL=index.js.map
|