derive-dashboards 0.11.0 → 0.11.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # derive-dashboards
2
2
 
3
+ ## 0.11.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 3273fbe: - A tile's CSV writes a dimension shown as another (an id shown as its name) by its name, as the tile shows it.
8
+ - The date control says no "All time" beside a pick such as "Last 7 days": tiles that read every date are not the pick's.
9
+
10
+ ## 0.11.1
11
+
12
+ ### Patch Changes
13
+
14
+ - d4605fe: A filter's value list says there is more whenever a row was left out, also where a value has two names. The query closure finds a dimension's name field through the one `shownAsMember` rule.
15
+
3
16
  ## 0.11.0
4
17
 
5
18
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import { ownEntry, parseMemberId, resolveDimension, resolveMeasure, sourceOf } from "../model/member.mjs";
1
+ import { ownEntry, parseMemberId, resolveDimension, resolveMeasure, shownAsMember, sourceOf } from "../model/member.mjs";
2
2
  import { didYouMean } from "../model/validate/fields.mjs";
3
3
  import { derivedIssues } from "./derived-rules.mjs";
4
4
  import { formulaRefs } from "./formulas.mjs";
@@ -29,8 +29,8 @@ function dimension(w, source, id, path) {
29
29
  const name = parseMemberId(id)?.name ?? id;
30
30
  w.sources.add(resolved.source);
31
31
  w.members.add(`${resolved.source}.${name}`);
32
- const { dimension: def } = resolved;
33
- if (def.kind === "string" && def.shownAs !== void 0) w.members.add(`${resolved.source}.${def.shownAs}`);
32
+ const shown = parseMemberId(shownAsMember(w.model, source, id) ?? "")?.name;
33
+ if (shown !== void 0) w.members.add(`${resolved.source}.${shown}`);
34
34
  return resolved;
35
35
  }
36
36
  function measure(w, source, id, path) {
@@ -56,16 +56,16 @@ async function memberValues(x, a) {
56
56
  query,
57
57
  calendar: calendarOf(x.rt.options)
58
58
  });
59
- const values = [...new Set(answer.rows.flatMap((row) => {
59
+ const rows = answer.rows.flatMap((row) => {
60
60
  const cell = row[0] ?? null;
61
61
  if (cell === null || typeof cell !== "object") return [cell];
62
62
  return isMark(cell) ? [] : [cell.v];
63
- }))];
64
- const page = values.slice(0, limit);
63
+ });
64
+ const page = [...new Set(rows.slice(0, limit))];
65
65
  const labels = answer.columns[0]?.labels;
66
66
  return {
67
67
  values: page,
68
- more: values.length > limit,
68
+ more: rows.length > limit,
69
69
  ...labels === void 0 ? {} : { labels }
70
70
  };
71
71
  }
@@ -17,6 +17,8 @@ function headingOf(column) {
17
17
  * no value is put through a float on the way.
18
18
  */
19
19
  const written = (digits, column) => column.format === "percent" ? `${column.fraction === true ? movePoint(digits, 2) : digits}%` : digits;
20
+ /** A dimension shown as another (an id shown as its name) is written as it is shown. */
21
+ const shownAs = (cell, column) => typeof cell === "string" ? column.labels?.[cell] : void 0;
20
22
  /**
21
23
  * One cell: nothing for no value, the fold's word for a mark, true or false, a number's own
22
24
  * digits as a plain decimal, and any other text guarded. A text is a number only in a column
@@ -28,6 +30,8 @@ function cellText(cell, column, words) {
28
30
  if (cell === null) return "";
29
31
  if (isMark(cell)) return guarded(cell.mark === "all" ? words.total : words.other);
30
32
  if (typeof cell === "boolean") return String(cell);
33
+ const label = shownAs(cell, column);
34
+ if (label !== void 0) return guarded(label);
31
35
  const digits = typeof cell === "string" && !isNumeric(column) ? void 0 : cellDigits(cell);
32
36
  if (digits !== void 0) return written(digits, column);
33
37
  return guarded(typeof cell === "object" ? cell.v : String(cell));
@@ -1,3 +1,4 @@
1
+ import { useDashboards } from "../context.mjs";
1
2
  import { rangeOf, useBar, useWords } from "./context.mjs";
2
3
  // src/filters/dates-said.ts
3
4
  /** In place of dates not known yet, to the eye: the tiles' answers are on their way. */
@@ -48,6 +49,7 @@ function unpicked(at, words) {
48
49
  function useDates(control, said) {
49
50
  const { picks, span, period } = useBar();
50
51
  const words = useWords();
52
+ const { messages } = useDashboards();
51
53
  if (control.kind !== "date_range") return {
52
54
  text: said,
53
55
  beside: void 0,
@@ -59,7 +61,7 @@ function useDates(control, said) {
59
61
  }, words);
60
62
  const dates = datesOf(span, words.datesLoading);
61
63
  const range = rangeOf(picks, control.id);
62
- if (range === void 0 || !("last" in range) || dates.seen === void 0) return {
64
+ if (range === void 0 || !("last" in range) || dates.seen === void 0 || span === messages.tileAllTime) return {
63
65
  text: said,
64
66
  beside: void 0,
65
67
  spoken: said,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "derive-dashboards",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Open-source embedded dashboards for your product: the server, the engine, React components, charts and the CLI, in one package.",
5
5
  "type": "module",
6
6
  "license": "MIT",