@multiplatform.one/backoffice 7.89.0 → 7.90.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/backoffice",
3
- "version": "7.89.0",
3
+ "version": "7.90.1",
4
4
  "description": "Embeddable Frappe desk recreation (backoffice) for the multiplatform.one stack",
5
5
  "keywords": [
6
6
  "backoffice",
@@ -71,21 +71,21 @@
71
71
  "access": "public"
72
72
  },
73
73
  "dependencies": {
74
- "@multiplatform.one/components": "^7.89.0",
75
- "@multiplatform.one/forms": "^7.89.0",
76
- "@multiplatform.one/frappe": "^7.89.0",
77
- "@multiplatform.one/frappe-ui": "^7.89.0",
78
- "@multiplatform.one/i18n": "^7.89.0",
79
- "@multiplatform.one/platform": "^7.89.0",
80
- "@multiplatform.one/store": "^7.89.0",
81
- "@multiplatform.one/table": "^7.89.0",
82
- "@multiplatform.one/theme": "^7.89.0",
74
+ "@multiplatform.one/components": "^7.90.1",
75
+ "@multiplatform.one/forms": "^7.90.1",
76
+ "@multiplatform.one/frappe": "^7.90.1",
77
+ "@multiplatform.one/frappe-ui": "^7.90.1",
78
+ "@multiplatform.one/i18n": "^7.90.1",
79
+ "@multiplatform.one/platform": "^7.90.1",
80
+ "@multiplatform.one/store": "^7.90.1",
81
+ "@multiplatform.one/table": "^7.90.1",
82
+ "@multiplatform.one/theme": "^7.90.1",
83
83
  "@phosphor-icons/react": "^2.1.10",
84
84
  "tamagui": "2.7.6"
85
85
  },
86
86
  "devDependencies": {
87
- "@multiplatform.one/config": "7.89.0",
88
- "@multiplatform.one/test-utils": "7.89.0",
87
+ "@multiplatform.one/config": "7.90.1",
88
+ "@multiplatform.one/test-utils": "7.90.1",
89
89
  "@tamagui/build": "2.7.6",
90
90
  "@testing-library/react": "^16.3.3",
91
91
  "@types/react-dom": "^19.2.3",
@@ -15,7 +15,6 @@ import {
15
15
  XStack,
16
16
  YStack,
17
17
  ActionButton,
18
- type DropdownMenuEntry,
19
18
  } from "@multiplatform.one/components";
20
19
  import {
21
20
  Button,
@@ -26,15 +25,12 @@ import {
26
25
  SearchInput,
27
26
  } from "@multiplatform.one/forms";
28
27
  import { DataTable, type DataTableColumn } from "@multiplatform.one/table";
29
- import {
30
- ArrowDownIcon,
31
- CaretLeftIcon,
32
- ChartBarIcon,
33
- FunnelIcon,
34
- ListBulletsIcon,
35
- } from "@phosphor-icons/react";
28
+ import { useLayoutSizeClass } from "@multiplatform.one/theme";
29
+ import { ArrowDownIcon, CaretLeftIcon, FunnelIcon } from "@phosphor-icons/react";
36
30
  import { useState } from "react";
37
31
  import { LIST_PAGE_SIZE, ListPaging } from "../list/list-paging";
32
+ import type { BackofficeView } from "../navigation/paths";
33
+ import { useViewMenuEntries, ViewSwitcherMenu } from "../views/ViewSwitcherMenu";
38
34
 
39
35
  const meta = {
40
36
  title: "Boards/Freeform/Backoffice",
@@ -85,25 +81,21 @@ const pokemon: Pokemon[] = (
85
81
  modified,
86
82
  }));
87
83
 
88
- const views = [
89
- { type: "list", label: "List", icon: ListBulletsIcon },
90
- { type: "report", label: "Report", icon: ChartBarIcon },
91
- ];
84
+ const views: readonly BackofficeView[] = ["list", "report"];
92
85
 
93
- function HeaderActions({ view }: { view: string }) {
86
+ function HeaderActions({ view }: Readonly<{ view: BackofficeView }>) {
94
87
  const [current, setCurrent] = useState(view);
95
- const entries: DropdownMenuEntry[] = views.map(({ type, label, icon: Icon }) => ({
96
- key: type,
97
- label,
98
- icon: <Icon />,
99
- checked: type === current,
100
- onSelect: () => setCurrent(type),
101
- }));
88
+ const compact = useLayoutSizeClass() === "compact";
89
+ const entries = useViewMenuEntries({ views, current, onViewChange: setCurrent });
102
90
  return (
103
91
  <>
104
- <DropdownMenu items={entries} closeOnSelect placement="bottom-end">
105
- <PageMenuButton />
106
- </DropdownMenu>
92
+ {compact ? (
93
+ <DropdownMenu items={entries} closeOnSelect placement="bottom-end">
94
+ <PageMenuButton />
95
+ </DropdownMenu>
96
+ ) : (
97
+ <ViewSwitcherMenu views={views} current={current} onViewChange={setCurrent} />
98
+ )}
107
99
  <ActionButton kind="add" />
108
100
  </>
109
101
  );
@@ -149,14 +149,15 @@ describe("<DoctypeReportView />", () => {
149
149
  });
150
150
  });
151
151
 
152
- it("keeps the report toolbar outside a bounded vertical body scrollport", async () => {
152
+ it("scrolls the rows alone: toolbar, header and totals stay outside the scrollport", async () => {
153
153
  renderReport();
154
154
  await waitFor(() => expect(screen.getByText("ACME Corp")).toBeTruthy());
155
155
  const region = screen.getByTestId("frappe-report-scroll");
156
- expect(["auto", "scroll"]).toContain(getComputedStyle(region).overflowY);
157
156
  expect(getComputedStyle(region).minHeight).toBe("0px");
158
- const content = region.firstElementChild?.firstElementChild as HTMLElement;
159
- expect(getComputedStyle(content).flexBasis).toBe("auto");
160
- expect(getComputedStyle(content).flexShrink).toBe("0");
157
+ const rows = region.querySelector("[data-report-grid] tbody") as HTMLElement;
158
+ expect(["auto", "scroll"]).toContain(getComputedStyle(rows).overflowY);
159
+ expect(getComputedStyle(rows).minHeight).toBe("0px");
160
+ expect(rows.textContent).not.toContain("Totals");
161
+ expect(region.querySelector("[data-report-grid] tfoot")?.textContent).toContain("Totals");
161
162
  expect(region.querySelector('[aria-label="Columns"]')).toBeNull();
162
163
  });