@multiplatform.one/backoffice 7.40.0 → 7.42.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.
Files changed (58) hide show
  1. package/dist/cjs/form/DocFormScreen.cjs +1 -0
  2. package/dist/cjs/form/DocFormScreen.native.js +1 -0
  3. package/dist/cjs/form/DocFormScreen.native.js.map +1 -1
  4. package/dist/cjs/i18n/en.cjs +4 -0
  5. package/dist/cjs/i18n/en.native.js +4 -0
  6. package/dist/cjs/i18n/en.native.js.map +1 -1
  7. package/dist/cjs/list/DoctypeListScreen.cjs +91 -72
  8. package/dist/cjs/list/DoctypeListScreen.native.js +101 -74
  9. package/dist/cjs/list/DoctypeListScreen.native.js.map +1 -1
  10. package/dist/cjs/list/list-paging.cjs +94 -0
  11. package/dist/cjs/list/list-paging.native.js +103 -0
  12. package/dist/cjs/list/list-paging.native.js.map +1 -0
  13. package/dist/esm/form/DocFormScreen.mjs +1 -0
  14. package/dist/esm/form/DocFormScreen.mjs.map +1 -1
  15. package/dist/esm/form/DocFormScreen.native.js +1 -0
  16. package/dist/esm/form/DocFormScreen.native.js.map +1 -1
  17. package/dist/esm/i18n/en.mjs +4 -0
  18. package/dist/esm/i18n/en.mjs.map +1 -1
  19. package/dist/esm/i18n/en.native.js +4 -0
  20. package/dist/esm/i18n/en.native.js.map +1 -1
  21. package/dist/esm/list/DoctypeListScreen.mjs +93 -74
  22. package/dist/esm/list/DoctypeListScreen.mjs.map +1 -1
  23. package/dist/esm/list/DoctypeListScreen.native.js +103 -76
  24. package/dist/esm/list/DoctypeListScreen.native.js.map +1 -1
  25. package/dist/esm/list/list-paging.mjs +68 -0
  26. package/dist/esm/list/list-paging.mjs.map +1 -0
  27. package/dist/esm/list/list-paging.native.js +74 -0
  28. package/dist/esm/list/list-paging.native.js.map +1 -0
  29. package/dist/jsx/form/DocFormScreen.mjs +1 -0
  30. package/dist/jsx/form/DocFormScreen.mjs.map +1 -1
  31. package/dist/jsx/form/DocFormScreen.native.js +1 -0
  32. package/dist/jsx/form/DocFormScreen.native.js.map +1 -1
  33. package/dist/jsx/i18n/en.mjs +4 -0
  34. package/dist/jsx/i18n/en.mjs.map +1 -1
  35. package/dist/jsx/i18n/en.native.js +4 -0
  36. package/dist/jsx/i18n/en.native.js.map +1 -1
  37. package/dist/jsx/list/DoctypeListScreen.mjs +93 -74
  38. package/dist/jsx/list/DoctypeListScreen.mjs.map +1 -1
  39. package/dist/jsx/list/DoctypeListScreen.native.js +101 -74
  40. package/dist/jsx/list/DoctypeListScreen.native.js.map +1 -1
  41. package/dist/jsx/list/list-paging.mjs +68 -0
  42. package/dist/jsx/list/list-paging.mjs.map +1 -0
  43. package/dist/jsx/list/list-paging.native.js +103 -0
  44. package/dist/jsx/list/list-paging.native.js.map +1 -0
  45. package/package.json +12 -12
  46. package/src/design/DeskPhoneBoard.stories.tsx +356 -0
  47. package/src/form/DocFormScreen.chrome.spec.ts +4 -0
  48. package/src/form/DocFormScreen.tsx +1 -0
  49. package/src/i18n/en.ts +4 -0
  50. package/src/list/DoctypeListScreen.tsx +122 -84
  51. package/src/list/list-paging.screen.spec.tsx +55 -0
  52. package/src/list/list-paging.tsx +78 -0
  53. package/types/form/DocFormScreen.d.ts.map +1 -1
  54. package/types/i18n/en.d.ts +4 -0
  55. package/types/i18n/en.d.ts.map +1 -1
  56. package/types/list/DoctypeListScreen.d.ts.map +1 -1
  57. package/types/list/list-paging.d.ts +13 -0
  58. package/types/list/list-paging.d.ts.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/backoffice",
3
- "version": "7.40.0",
3
+ "version": "7.42.0",
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.40.0",
75
- "@multiplatform.one/forms": "^7.40.0",
76
- "@multiplatform.one/frappe": "^7.40.0",
77
- "@multiplatform.one/frappe-ui": "^7.40.0",
78
- "@multiplatform.one/i18n": "^7.40.0",
79
- "@multiplatform.one/platform": "^7.40.0",
80
- "@multiplatform.one/store": "^7.40.0",
81
- "@multiplatform.one/table": "^7.40.0",
82
- "@multiplatform.one/theme": "^7.40.0",
74
+ "@multiplatform.one/components": "^7.42.0",
75
+ "@multiplatform.one/forms": "^7.42.0",
76
+ "@multiplatform.one/frappe": "^7.42.0",
77
+ "@multiplatform.one/frappe-ui": "^7.42.0",
78
+ "@multiplatform.one/i18n": "^7.42.0",
79
+ "@multiplatform.one/platform": "^7.42.0",
80
+ "@multiplatform.one/store": "^7.42.0",
81
+ "@multiplatform.one/table": "^7.42.0",
82
+ "@multiplatform.one/theme": "^7.42.0",
83
83
  "@phosphor-icons/react": "^2.1.10",
84
84
  "tamagui": "2.7.6"
85
85
  },
86
86
  "devDependencies": {
87
- "@multiplatform.one/config": "7.40.0",
88
- "@multiplatform.one/test-utils": "7.40.0",
87
+ "@multiplatform.one/config": "7.42.0",
88
+ "@multiplatform.one/test-utils": "7.42.0",
89
89
  "@tamagui/build": "2.7.6",
90
90
  "@testing-library/react": "^16.3.3",
91
91
  "@types/react-dom": "^19.2.3",
@@ -0,0 +1,356 @@
1
+ // FZ-7684 design board. Desk (Frappe v15) decides WHAT each screen carries:
2
+ // the fields, the actions and their order. MPO decides how it looks: page
3
+ // templates, components at their default sizes, theme gaps. Fixtures only.
4
+ import {
5
+ Chip,
6
+ DetailPageLayout,
7
+ H2,
8
+ Image,
9
+ List,
10
+ ListPageLayout,
11
+ ListRow,
12
+ ListRowMeta,
13
+ PageHeader,
14
+ PageSection,
15
+ Text,
16
+ ViewSwitcher,
17
+ XStack,
18
+ YStack,
19
+ } from "@multiplatform.one/components";
20
+ import {
21
+ Button,
22
+ FormGrid,
23
+ ImageField,
24
+ Input,
25
+ SearchInput,
26
+ ToggleGroup,
27
+ } from "@multiplatform.one/forms";
28
+ import { DataTable, type DataTableColumn } from "@multiplatform.one/table";
29
+ import {
30
+ ArrowDownIcon,
31
+ CaretLeftIcon,
32
+ ChartBarIcon,
33
+ DotsThreeIcon,
34
+ FunnelIcon,
35
+ ListBulletsIcon,
36
+ PlusIcon,
37
+ } from "@phosphor-icons/react";
38
+ import { useState } from "react";
39
+
40
+ const meta = {
41
+ title: "Boards/Freeform/Backoffice",
42
+ tags: ["!test"],
43
+ parameters: {
44
+ status: { type: "beta" },
45
+ layout: "fullscreen",
46
+ docs: {
47
+ description: {
48
+ component:
49
+ "Desk v15 list, report and form content, laid out with MPO page templates and default-size components (FZ-7684).",
50
+ },
51
+ },
52
+ },
53
+ };
54
+ export default meta;
55
+
56
+ const sprite = (id: number) =>
57
+ `https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/${id}.png`;
58
+
59
+ interface Pokemon {
60
+ name: string;
61
+ pokemon_name: string;
62
+ poke_id: number;
63
+ species: string;
64
+ height: number;
65
+ weight: number;
66
+ modified: string;
67
+ }
68
+
69
+ const pokemon: Pokemon[] = (
70
+ [
71
+ ["pikachu", "Pikachu", 25, "Mouse Pokémon", 4, 60, "4 d"],
72
+ ["raticate", "Raticate", 20, "Mouse Pokémon", 7, 185, "4 d"],
73
+ ["rattata", "Rattata", 19, "Mouse Pokémon", 3, 35, "4 d"],
74
+ ["pidgeot", "Pidgeot", 18, "Bird Pokémon", 15, 395, "4 d"],
75
+ ["pidgeotto", "Pidgeotto", 17, "Bird Pokémon", 11, 300, "4 d"],
76
+ ["pidgey", "Pidgey", 16, "Tiny Bird Pokémon", 3, 18, "5 d"],
77
+ ["beedrill", "Beedrill", 15, "Poison Bee Pokémon", 10, 295, "5 d"],
78
+ ] as const
79
+ ).map(([name, pokemon_name, poke_id, species, height, weight, modified]) => ({
80
+ name,
81
+ pokemon_name,
82
+ poke_id,
83
+ species,
84
+ height,
85
+ weight,
86
+ modified,
87
+ }));
88
+
89
+ const views = [
90
+ { type: "list", label: "List", icon: ListBulletsIcon },
91
+ { type: "report", label: "Report", icon: ChartBarIcon },
92
+ ];
93
+
94
+ function HeaderActions({ view }: { view: string }) {
95
+ const [current, setCurrent] = useState(view);
96
+ return (
97
+ <XStack flex={1} gap="$2" alignItems="center" justifyContent="space-between">
98
+ <ViewSwitcher views={views} currentView={current} onViewChange={setCurrent} />
99
+ <XStack gap="$2" alignItems="center">
100
+ <Button outlined icon={DotsThreeIcon} aria-label="More actions" />
101
+ <Button accent icon={PlusIcon}>
102
+ Add
103
+ </Button>
104
+ </XStack>
105
+ </XStack>
106
+ );
107
+ }
108
+
109
+ /** Desk's filter area: Filter on the left, the sort field and direction on the right. */
110
+ function FilterBar({ filters }: { filters?: number }) {
111
+ return (
112
+ <XStack gap="$2" alignItems="center" justifyContent="space-between">
113
+ <Button outlined icon={FunnelIcon}>
114
+ {filters ? `Filter · ${filters}` : "Filter"}
115
+ </Button>
116
+ <Button outlined iconAfter={ArrowDownIcon}>
117
+ Last Updated On
118
+ </Button>
119
+ </XStack>
120
+ );
121
+ }
122
+
123
+ /** Desk's list foot: page size and Load More. */
124
+ function PageFoot({ shown, total }: { shown: number; total: number }) {
125
+ const [size, setSize] = useState("20");
126
+ return (
127
+ <YStack gap="$3">
128
+ <Text color="$color11">
129
+ {shown} of {total}
130
+ </Text>
131
+ <XStack gap="$3" alignItems="center" justifyContent="space-between">
132
+ <ToggleGroup
133
+ aria-label="Page size"
134
+ type="single"
135
+ value={size}
136
+ onChange={(value) => setSize(Array.isArray(value) ? (value[0] ?? "20") : value)}
137
+ options={[
138
+ { label: "20", value: "20" },
139
+ { label: "100", value: "100" },
140
+ { label: "500", value: "500" },
141
+ ]}
142
+ />
143
+ <Button outlined>Load More</Button>
144
+ </XStack>
145
+ </YStack>
146
+ );
147
+ }
148
+
149
+ export const ListView = {
150
+ name: "List",
151
+ render: () => (
152
+ <ListPageLayout
153
+ header={<PageHeader heading={<H2>Pokemon</H2>} actions={<HeaderActions view="list" />} />}
154
+ toolbar={
155
+ <YStack gap="$3">
156
+ <SearchInput placeholder="Pokemon Name" aria-label="Pokemon Name" defaultValue="" />
157
+ <FilterBar />
158
+ </YStack>
159
+ }
160
+ >
161
+ <YStack gap="$4">
162
+ <List<Pokemon>
163
+ items={pokemon}
164
+ aria-label="Pokemon"
165
+ renderItem={(doc) => (
166
+ <ListRow
167
+ icon={<Image src={sprite(doc.poke_id)} alt="" size="extraSmall" />}
168
+ title={doc.pokemon_name}
169
+ subtitle={
170
+ <Text color="$color10" fontSize="$3" numberOfLines={1}>
171
+ {doc.species} · Poke ID {doc.poke_id}
172
+ </Text>
173
+ }
174
+ meta={<ListRowMeta color="$color10">{doc.modified}</ListRowMeta>}
175
+ />
176
+ )}
177
+ />
178
+ <PageFoot shown={pokemon.length} total={151} />
179
+ </YStack>
180
+ </ListPageLayout>
181
+ ),
182
+ };
183
+
184
+ const numberHeader = (label: string) => () => (
185
+ <Text flex={1} textAlign="right" numberOfLines={1}>
186
+ {label}
187
+ </Text>
188
+ );
189
+
190
+ const reportColumns = [
191
+ {
192
+ accessorKey: "pokemon_name",
193
+ header: "Pokemon Name",
194
+ width: 164,
195
+ cell: ({ row }) => (
196
+ <XStack flex={1} minWidth="$0" gap="$3" alignItems="center">
197
+ <Image src={sprite(row.original.poke_id)} alt="" size="extraSmall" />
198
+ <YStack flex={1} minWidth="$0">
199
+ <Text numberOfLines={1}>{row.original.pokemon_name}</Text>
200
+ <Text color="$color10" fontSize="$3" numberOfLines={1}>
201
+ {row.original.species}
202
+ </Text>
203
+ </YStack>
204
+ </XStack>
205
+ ),
206
+ },
207
+ {
208
+ accessorKey: "poke_id",
209
+ width: 90,
210
+ header: numberHeader("Poke ID"),
211
+ align: "right",
212
+ meta: { label: "Poke ID", align: "right" },
213
+ },
214
+ {
215
+ accessorKey: "weight",
216
+ width: 96,
217
+ header: numberHeader("Weight"),
218
+ align: "right",
219
+ meta: { label: "Weight (hg)", align: "right" },
220
+ },
221
+ ] as DataTableColumn<Pokemon>[];
222
+
223
+ export const ReportView = {
224
+ name: "Report",
225
+ render: () => (
226
+ <ListPageLayout
227
+ header={<PageHeader heading={<H2>Pokemon</H2>} actions={<HeaderActions view="report" />} />}
228
+ toolbar={
229
+ <YStack gap="$3">
230
+ <FilterBar filters={1} />
231
+ <XStack gap="$2" flexWrap="wrap">
232
+ <Chip variant="subtle" onDismiss={() => {}}>
233
+ Species like %Pokémon%
234
+ </Chip>
235
+ </XStack>
236
+ </YStack>
237
+ }
238
+ >
239
+ <YStack gap="$4">
240
+ <DataTable
241
+ data={pokemon}
242
+ columns={reportColumns}
243
+ layout="table"
244
+ columnLayout="scroll"
245
+ enablePagination={false}
246
+ enableFiltering={false}
247
+ enableGlobalSearch={false}
248
+ enableColumnVisibility={false}
249
+ enableSorting={false}
250
+ />
251
+ <XStack gap="$2" flexWrap="wrap">
252
+ <Button outlined>Pick Columns</Button>
253
+ <Button outlined>Group By</Button>
254
+ </XStack>
255
+ <PageFoot shown={pokemon.length} total={151} />
256
+ </YStack>
257
+ </ListPageLayout>
258
+ ),
259
+ };
260
+
261
+ const stats = [
262
+ { stat: "hp", base_stat: 45, effort: 1 },
263
+ { stat: "attack", base_stat: 30, effort: 0 },
264
+ { stat: "defense", base_stat: 35, effort: 0 },
265
+ { stat: "speed", base_stat: 45, effort: 0 },
266
+ ];
267
+
268
+ export const FormView = {
269
+ name: "Form",
270
+ render: () => (
271
+ <DetailPageLayout
272
+ header={
273
+ <PageHeader
274
+ heading={
275
+ <YStack gap="$1">
276
+ <H2>Caterpie</H2>
277
+ <Text color="$color11">Not Saved</Text>
278
+ </YStack>
279
+ }
280
+ />
281
+ }
282
+ toolbarLeading={
283
+ <YStack>
284
+ <Button chromeless icon={CaretLeftIcon}>
285
+ Pokemon
286
+ </Button>
287
+ </YStack>
288
+ }
289
+ toolbarTrailing={
290
+ <XStack gap="$2" alignItems="center">
291
+ <Button outlined icon={DotsThreeIcon} aria-label="More actions" />
292
+ <Button accent>Save</Button>
293
+ </XStack>
294
+ }
295
+ >
296
+ <PageSection>
297
+ <FormGrid>
298
+ <Input label="Pokemon Name" defaultValue="Caterpie" />
299
+ <Input label="Species" defaultValue="Worm Pokémon" />
300
+ </FormGrid>
301
+ <XStack gap="$4">
302
+ <YStack flex={1}>
303
+ <Input label="Poke ID" defaultValue="10" keyboardType="numeric" />
304
+ </YStack>
305
+ <YStack flex={1}>
306
+ <Input label="Base Experience" defaultValue="39" keyboardType="numeric" />
307
+ </YStack>
308
+ </XStack>
309
+ <XStack gap="$4">
310
+ <YStack flex={1}>
311
+ <Input label="Height (dm)" defaultValue="3" keyboardType="numeric" />
312
+ </YStack>
313
+ <YStack flex={1}>
314
+ <Input label="Weight (hg)" defaultValue="29" keyboardType="numeric" />
315
+ </YStack>
316
+ </XStack>
317
+ </PageSection>
318
+ <PageSection title="Sprites">
319
+ <XStack gap="$4">
320
+ <YStack flex={1}>
321
+ <ImageField label="Sprite (Front)" defaultValue={sprite(10)} />
322
+ </YStack>
323
+ <YStack flex={1}>
324
+ <ImageField
325
+ label="Sprite (Back)"
326
+ defaultValue="https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/10.png"
327
+ />
328
+ </YStack>
329
+ </XStack>
330
+ </PageSection>
331
+ <PageSection title="Stats">
332
+ <DataTable
333
+ data={stats}
334
+ columns={
335
+ [
336
+ { accessorKey: "stat", header: "Stat" },
337
+ { accessorKey: "base_stat", header: numberHeader("Base Stat"), align: "right" },
338
+ { accessorKey: "effort", header: numberHeader("Effort"), align: "right" },
339
+ ] as DataTableColumn<(typeof stats)[number]>[]
340
+ }
341
+ layout="table"
342
+ enableSorting={false}
343
+ enablePagination={false}
344
+ enableFiltering={false}
345
+ enableGlobalSearch={false}
346
+ enableColumnVisibility={false}
347
+ />
348
+ <XStack>
349
+ <Button outlined icon={PlusIcon}>
350
+ Add Row
351
+ </Button>
352
+ </XStack>
353
+ </PageSection>
354
+ </DetailPageLayout>
355
+ ),
356
+ };
@@ -74,4 +74,8 @@ describe("DocFormScreen is chrome over FrappeForm (MPO-15 AC2)", () => {
74
74
  expect(frappeUi).toContain("useFrappeForm");
75
75
  expect(source).toMatch(/<FrappeForm(?:<\w+>)?\s[^>]*\bform=\{form\}/s);
76
76
  });
77
+
78
+ it("lays the record's own screen out flat (FZ-7684)", () => {
79
+ expect(source).toMatch(/<FrappeForm(?:<\w+>)?\s[^>]*\blayout="flat"/s);
80
+ });
77
81
  });
@@ -772,6 +772,7 @@ export function DocFormScreen({
772
772
  showTimeline={false}
773
773
  showConnections={false}
774
774
  showBanners={false}
775
+ layout="flat"
775
776
  sectionHeadingLevel={2}
776
777
  renderFieldWrapper={wrapFieldWithErrorBoundary}
777
778
  renderTab={renderTab}
package/src/i18n/en.ts CHANGED
@@ -496,9 +496,13 @@ export const en = {
496
496
  likedBy: "Liked By",
497
497
  likedColumn: "Liked",
498
498
  me: "Me",
499
+ loadMore: "Load More",
499
500
  metaError: "Could not load {{doctype}}",
501
+ more: "More actions",
500
502
  new: "New {{doctype}}",
501
503
  newShort: "New",
504
+ pageSize: "Page size",
505
+ rangeOf: "{{shown}} of {{total}}",
502
506
  noTags: "No Tags",
503
507
  notPermitted: "You can't open the {{doctype}} list",
504
508
  refresh: "Refresh",