@multiplatform.one/backoffice 7.88.0 → 7.88.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/dist/cjs/form/DocFormScreen.cjs +18 -8
- package/dist/cjs/form/DocFormScreen.native.js +17 -7
- package/dist/cjs/form/DocFormScreen.native.js.map +1 -1
- package/dist/esm/form/DocFormScreen.mjs +18 -8
- package/dist/esm/form/DocFormScreen.mjs.map +1 -1
- package/dist/esm/form/DocFormScreen.native.js +18 -8
- package/dist/esm/form/DocFormScreen.native.js.map +1 -1
- package/dist/jsx/form/DocFormScreen.mjs +18 -8
- package/dist/jsx/form/DocFormScreen.mjs.map +1 -1
- package/dist/jsx/form/DocFormScreen.native.js +17 -7
- package/dist/jsx/form/DocFormScreen.native.js.map +1 -1
- package/package.json +12 -12
- package/src/desk/DeskPokemon.stories.tsx +5 -5
- package/src/form/DocFormScreen.tsx +19 -9
- package/src/formBuilder/FormBuilderScreen.screen.spec.tsx +6 -6
- package/src/formBuilder/api.spec.ts +2 -2
- package/src/list/DoctypeListScreen.auth.spec.tsx +1 -1
- package/src/views/ImageView.screen.spec.tsx +2 -2
- package/types/form/DocFormScreen.d.ts.map +1 -1
|
@@ -29,15 +29,15 @@ const pokemonMeta = {
|
|
|
29
29
|
sort_field: "modified",
|
|
30
30
|
sort_order: "DESC",
|
|
31
31
|
fields: [
|
|
32
|
-
{ fieldname: "pokemon_name", fieldtype: "Data", label: "Pokemon
|
|
32
|
+
{ fieldname: "pokemon_name", fieldtype: "Data", label: "Pokemon name", in_list_view: 1 },
|
|
33
33
|
{ fieldname: "poke_id", fieldtype: "Int", label: "Poke ID", in_list_view: 1 },
|
|
34
34
|
{ fieldname: "species", fieldtype: "Data", label: "Species", in_list_view: 1 },
|
|
35
35
|
{ fieldname: "height", fieldtype: "Int", label: "Height (dm)" },
|
|
36
36
|
{ fieldname: "weight", fieldtype: "Int", label: "Weight (hg)" },
|
|
37
|
-
{ fieldname: "base_experience", fieldtype: "Int", label: "Base
|
|
37
|
+
{ fieldname: "base_experience", fieldtype: "Int", label: "Base experience" },
|
|
38
38
|
{ fieldname: "column_break_1", fieldtype: "Column Break" },
|
|
39
|
-
{ fieldname: "sprite_front", fieldtype: "Attach Image", label: "Sprite (
|
|
40
|
-
{ fieldname: "sprite_back", fieldtype: "Attach Image", label: "Sprite (
|
|
39
|
+
{ fieldname: "sprite_front", fieldtype: "Attach Image", label: "Sprite (front)" },
|
|
40
|
+
{ fieldname: "sprite_back", fieldtype: "Attach Image", label: "Sprite (back)" },
|
|
41
41
|
{ fieldname: "section_break_stats", fieldtype: "Section Break", label: "Stats" },
|
|
42
42
|
{ fieldname: "stats", fieldtype: "Table", label: "Stats", options: "Pokemon Stat" },
|
|
43
43
|
],
|
|
@@ -51,7 +51,7 @@ const statMeta = {
|
|
|
51
51
|
istable: 1,
|
|
52
52
|
fields: [
|
|
53
53
|
{ fieldname: "stat", fieldtype: "Data", label: "Stat", in_list_view: 1 },
|
|
54
|
-
{ fieldname: "base_stat", fieldtype: "Int", label: "Base
|
|
54
|
+
{ fieldname: "base_stat", fieldtype: "Int", label: "Base stat", in_list_view: 1 },
|
|
55
55
|
{ fieldname: "effort", fieldtype: "Int", label: "Effort", in_list_view: 1 },
|
|
56
56
|
],
|
|
57
57
|
permissions: [{ role: "All", read: 1, write: 1, create: 1 }],
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
type DocShareGrant,
|
|
43
43
|
type FormTab,
|
|
44
44
|
} from "@multiplatform.one/frappe-ui";
|
|
45
|
-
import { useLayoutSizeClass, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
45
|
+
import { layoutBreakpoints, useLayoutSizeClass, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
46
46
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
47
47
|
import { useTranslation } from "react-i18next";
|
|
48
48
|
import {
|
|
@@ -872,13 +872,15 @@ export function DocFormScreen({
|
|
|
872
872
|
|
|
873
873
|
return (
|
|
874
874
|
<YStack flex={1}>
|
|
875
|
-
{
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
875
|
+
<YStack {...pageCap}>
|
|
876
|
+
{slots.renderFormHeader
|
|
877
|
+
? slots.renderFormHeader({
|
|
878
|
+
doctype,
|
|
879
|
+
...(docName ? { name: docName } : {}),
|
|
880
|
+
defaultContent: toolbar,
|
|
881
|
+
})
|
|
882
|
+
: toolbar}
|
|
883
|
+
</YStack>
|
|
882
884
|
|
|
883
885
|
{(form.wasDeleted || validationSummary || form.conflict) && (
|
|
884
886
|
<YStack paddingHorizontal="$3">
|
|
@@ -945,7 +947,13 @@ export function DocFormScreen({
|
|
|
945
947
|
) : (
|
|
946
948
|
// Wide: main column (body + timeline) with the compact metadata
|
|
947
949
|
// rail keeping its trailing position.
|
|
948
|
-
<XStack
|
|
950
|
+
<XStack
|
|
951
|
+
{...pageCap}
|
|
952
|
+
{...knobProps.panelPadding}
|
|
953
|
+
{...knobProps.gapLg}
|
|
954
|
+
alignItems="flex-start"
|
|
955
|
+
data-doc-form-page=""
|
|
956
|
+
>
|
|
949
957
|
<YStack flex={1} minWidth={0} {...knobProps.gapLg}>
|
|
950
958
|
{formBody}
|
|
951
959
|
{timeline}
|
|
@@ -1090,3 +1098,5 @@ export function DocFormScreen({
|
|
|
1090
1098
|
</YStack>
|
|
1091
1099
|
);
|
|
1092
1100
|
}
|
|
1101
|
+
|
|
1102
|
+
const pageCap = { width: "100%", maxWidth: layoutBreakpoints.xl, alignSelf: "center" } as const;
|
|
@@ -130,7 +130,7 @@ function save() {
|
|
|
130
130
|
describe("FormBuilderScreen", { timeout: 90_000 }, () => {
|
|
131
131
|
it("opens the requested field properties without changing the layout", async () => {
|
|
132
132
|
renderBuilder({ initialSelection: "sprite_back" });
|
|
133
|
-
expect(await screen.findByDisplayValue("Sprite (
|
|
133
|
+
expect(await screen.findByDisplayValue("Sprite (back)")).toBeTruthy();
|
|
134
134
|
expect(
|
|
135
135
|
document.querySelector('[data-fb-fieldname="sprite_back"]')?.getAttribute("data-fb-selected"),
|
|
136
136
|
).toBe("true");
|
|
@@ -231,7 +231,7 @@ describe("FormBuilderScreen", { timeout: 90_000 }, () => {
|
|
|
231
231
|
|
|
232
232
|
it("moves through the keyboard machine, saves the order and reloads it", async () => {
|
|
233
233
|
const { saves, reads } = renderBuilder();
|
|
234
|
-
const grip = await screen.findByRole("button", { name: "Reorder Sprite (
|
|
234
|
+
const grip = await screen.findByRole("button", { name: "Reorder Sprite (back)" });
|
|
235
235
|
fireEvent.keyDown(grip, { key: " " });
|
|
236
236
|
fireEvent.keyDown(grip, { key: "ArrowLeft" });
|
|
237
237
|
expect(document.querySelector("[aria-live=polite]")?.textContent).toContain("position 2");
|
|
@@ -252,9 +252,9 @@ describe("FormBuilderScreen", { timeout: 90_000 }, () => {
|
|
|
252
252
|
|
|
253
253
|
it("moves through the field menu and persists the first column destination", async () => {
|
|
254
254
|
const { saves } = renderBuilder();
|
|
255
|
-
fireEvent.click(await screen.findByRole("button", { name: "Menu for Sprite (
|
|
255
|
+
fireEvent.click(await screen.findByRole("button", { name: "Menu for Sprite (back)" }));
|
|
256
256
|
fireEvent.click(await screen.findByRole("menuitem", { name: "Move to section: Stats" }));
|
|
257
|
-
fireEvent.click(screen.getByRole("button", { name: "Menu for Sprite (
|
|
257
|
+
fireEvent.click(screen.getByRole("button", { name: "Menu for Sprite (back)" }));
|
|
258
258
|
fireEvent.click(
|
|
259
259
|
await screen.findByRole("menuitem", { name: "Move to section: Untitled section" }),
|
|
260
260
|
);
|
|
@@ -372,9 +372,9 @@ describe("FormBuilderScreen", { timeout: 90_000 }, () => {
|
|
|
372
372
|
fireEvent.click(await screen.findByRole("button", { name: "Field types" }));
|
|
373
373
|
expect(await screen.findByRole("button", { name: "Add Data field" })).toBeTruthy();
|
|
374
374
|
fireEvent.keyDown(document, { key: "Escape" });
|
|
375
|
-
fireEvent.click(screen.getByRole("button", { name: "Menu for Sprite (
|
|
375
|
+
fireEvent.click(screen.getByRole("button", { name: "Menu for Sprite (back)" }));
|
|
376
376
|
fireEvent.click(await screen.findByRole("menuitem", { name: "Edit properties" }));
|
|
377
|
-
expect(await screen.findByDisplayValue("Sprite (
|
|
377
|
+
expect(await screen.findByDisplayValue("Sprite (back)")).toBeTruthy();
|
|
378
378
|
expect(document.querySelector("[data-fb-columns]")?.getAttribute("data-fb-stacked")).toBe(
|
|
379
379
|
"true",
|
|
380
380
|
);
|
|
@@ -30,7 +30,7 @@ const source: FormBuilderSource = {
|
|
|
30
30
|
{
|
|
31
31
|
fieldname: "pokemon_name",
|
|
32
32
|
fieldtype: "Data",
|
|
33
|
-
label: "Pokemon
|
|
33
|
+
label: "Pokemon name",
|
|
34
34
|
name: "row-a",
|
|
35
35
|
permlevel: 2,
|
|
36
36
|
fetch_from: "link.name",
|
|
@@ -258,7 +258,7 @@ describe("form builder persistence", () => {
|
|
|
258
258
|
fieldErrors: { nickname: "Fieldname nickname appears multiple times" },
|
|
259
259
|
});
|
|
260
260
|
expect(
|
|
261
|
-
parseFormBuilderError(new Error('Field "Pokemon
|
|
261
|
+
parseFormBuilderError(new Error('Field "Pokemon name" cannot be changed'), layout)
|
|
262
262
|
.fieldErrors,
|
|
263
263
|
).toHaveProperty("pokemon_name");
|
|
264
264
|
expect(
|
|
@@ -17,7 +17,7 @@ const meta = {
|
|
|
17
17
|
doctype: "DocType",
|
|
18
18
|
title_field: "pokemon_name",
|
|
19
19
|
fields: [
|
|
20
|
-
{ fieldname: "pokemon_name", fieldtype: "Data", label: "Pokemon
|
|
20
|
+
{ fieldname: "pokemon_name", fieldtype: "Data", label: "Pokemon name", in_list_view: 1 },
|
|
21
21
|
],
|
|
22
22
|
permissions: [{ role: "Pokemon Reader", read: 1 }],
|
|
23
23
|
};
|
|
@@ -20,9 +20,9 @@ function pokedexMeta(name: string) {
|
|
|
20
20
|
title_field: "pokemon_name",
|
|
21
21
|
image_field: "sprite_front",
|
|
22
22
|
fields: [
|
|
23
|
-
{ fieldname: "pokemon_name", fieldtype: "Data", label: "Pokemon
|
|
23
|
+
{ fieldname: "pokemon_name", fieldtype: "Data", label: "Pokemon name", in_list_view: 1 },
|
|
24
24
|
{ fieldname: "poke_type", fieldtype: "Data", label: "Type", in_list_view: 1 },
|
|
25
|
-
{ fieldname: "sprite_front", fieldtype: "Attach Image", label: "Sprite (
|
|
25
|
+
{ fieldname: "sprite_front", fieldtype: "Attach Image", label: "Sprite (front)" },
|
|
26
26
|
],
|
|
27
27
|
permissions: [{ role: "All", read: 1 }],
|
|
28
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocFormScreen.d.ts","sourceRoot":"","sources":["../../src/form/DocFormScreen.tsx"],"names":[],"mappings":"AA+CA,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAmCtC,oDAAoD;AACpD,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kEAAkE;IAClE,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,sCAAsC;IACtC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,IAAI,EA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