@richardmcquiston01/dashboard-widgets-toolkit 0.5.0 → 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/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 +484 -374
- 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 +484 -374
- 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.cjs
CHANGED
|
@@ -252,6 +252,16 @@ function resolveDetailOptions(definition) {
|
|
|
252
252
|
mode: options.mode ?? "client"
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
|
+
function resolveTableControls(definition) {
|
|
256
|
+
const setting = definition.tableControls;
|
|
257
|
+
if (setting === void 0 || setting === false) return void 0;
|
|
258
|
+
const options = setting === true ? {} : setting;
|
|
259
|
+
const resolved = {
|
|
260
|
+
search: options.search ?? true,
|
|
261
|
+
sort: options.sort ?? true
|
|
262
|
+
};
|
|
263
|
+
return resolved.search || resolved.sort ? resolved : void 0;
|
|
264
|
+
}
|
|
255
265
|
function defaultDetailQuery(pageSize = DEFAULT_DETAIL_PAGE_SIZE) {
|
|
256
266
|
return { page: 1, pageSize };
|
|
257
267
|
}
|
|
@@ -526,17 +536,19 @@ function validateDetailData(data, subject = "Detail data") {
|
|
|
526
536
|
}
|
|
527
537
|
return ok(data);
|
|
528
538
|
}
|
|
539
|
+
function tableDetailData(data) {
|
|
540
|
+
return {
|
|
541
|
+
columns: data.columns.map((column, index) => ({
|
|
542
|
+
key: `c${index}`,
|
|
543
|
+
label: column.label,
|
|
544
|
+
...column.numeric === void 0 ? {} : { numeric: column.numeric }
|
|
545
|
+
})),
|
|
546
|
+
rows: data.rows
|
|
547
|
+
};
|
|
548
|
+
}
|
|
529
549
|
function deriveDetailData(data, locale) {
|
|
530
550
|
if (data.kind === "TABLE") {
|
|
531
|
-
|
|
532
|
-
return {
|
|
533
|
-
columns: data.columns.map((column, index) => ({
|
|
534
|
-
key: `c${index}`,
|
|
535
|
-
label: column.label,
|
|
536
|
-
...column.numeric === void 0 ? {} : { numeric: column.numeric }
|
|
537
|
-
})),
|
|
538
|
-
rows: data.rows
|
|
539
|
-
};
|
|
551
|
+
return data.footer === void 0 ? tableDetailData(data) : void 0;
|
|
540
552
|
}
|
|
541
553
|
if (data.kind === "BAR_LIST") {
|
|
542
554
|
return {
|
|
@@ -1021,6 +1033,24 @@ function checkDetailOption(detail, problems) {
|
|
|
1021
1033
|
requireOneOf(detail, "mode", DETAIL_MODES, "detail", problems);
|
|
1022
1034
|
}
|
|
1023
1035
|
}
|
|
1036
|
+
function checkTableControlsOption(controls, kind, problems) {
|
|
1037
|
+
if (controls === void 0 || controls === false) return;
|
|
1038
|
+
if (typeof controls !== "boolean" && !isRecord(controls)) {
|
|
1039
|
+
problems.push(
|
|
1040
|
+
`tableControls must be true, false or an options object, got ${describeType2(controls)}.`
|
|
1041
|
+
);
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
if (isRecord(controls)) {
|
|
1045
|
+
optionalBoolean(controls, "search", "tableControls", problems);
|
|
1046
|
+
optionalBoolean(controls, "sort", "tableControls", problems);
|
|
1047
|
+
}
|
|
1048
|
+
if (typeof kind === "string" && kind !== "TABLE") {
|
|
1049
|
+
problems.push(
|
|
1050
|
+
`tableControls only applies to TABLE widgets, but kind is "${kind}".`
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1024
1054
|
function formatProblems(prefix, problems) {
|
|
1025
1055
|
const shown = problems.slice(0, MAX_REPORTED_PROBLEMS);
|
|
1026
1056
|
const more = problems.length - shown.length;
|
|
@@ -1093,6 +1123,7 @@ function validateWidgetDefinition(value) {
|
|
|
1093
1123
|
);
|
|
1094
1124
|
}
|
|
1095
1125
|
checkDetailOption(value["detail"], problems);
|
|
1126
|
+
checkTableControlsOption(value["tableControls"], value["kind"], problems);
|
|
1096
1127
|
if (value["fill"] !== void 0) {
|
|
1097
1128
|
requireOneOf(value, "fill", WIDGET_FILLS, "", problems);
|
|
1098
1129
|
}
|
|
@@ -1440,6 +1471,7 @@ exports.pruneLayout = pruneLayout;
|
|
|
1440
1471
|
exports.queryRows = queryRows;
|
|
1441
1472
|
exports.resolveDetailOptions = resolveDetailOptions;
|
|
1442
1473
|
exports.resolvePayload = resolvePayload;
|
|
1474
|
+
exports.resolveTableControls = resolveTableControls;
|
|
1443
1475
|
exports.resolveWidget = resolveWidget;
|
|
1444
1476
|
exports.resolveWidgets = resolveWidgets;
|
|
1445
1477
|
exports.restoreWidget = restoreWidget;
|
|
@@ -1448,6 +1480,7 @@ exports.serializeLayout = serializeLayout;
|
|
|
1448
1480
|
exports.shareOf = shareOf;
|
|
1449
1481
|
exports.showWidget = showWidget;
|
|
1450
1482
|
exports.sortDefinitions = sortDefinitions;
|
|
1483
|
+
exports.tableDetailData = tableDetailData;
|
|
1451
1484
|
exports.toggleHidden = toggleHidden;
|
|
1452
1485
|
exports.toggleMinimized = toggleMinimized;
|
|
1453
1486
|
exports.upgradeLegacyWidgetData = upgradeLegacyWidgetData;
|