@simmalugnt-se/payload-editor-assistant 0.12.0 → 0.12.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.1
4
+
5
+ - The review lists groups in the schema's order (a group's own position, blocks and rows by their
6
+ number) instead of alphabetically by path.
7
+
3
8
  ## 0.12.0
4
9
 
5
10
  - Proposals are grouped by block, row and named group, in document order, with collapsible sections
@@ -158,8 +158,6 @@ export declare const BATCH_COPY: {
158
158
  readonly review: "Check the suggestions. Uncheck any you do not want, or change the wording before saving.";
159
159
  readonly savesDraft: "Saves as a draft; nothing is published.";
160
160
  readonly savesDirectly: "Saved directly: this collection has no drafts.";
161
- readonly before: "Before";
162
- readonly empty: "empty";
163
161
  readonly retry: "Try again";
164
162
  readonly retryWith: "What should be different? (optional)";
165
163
  readonly retrySend: "Ask again";
@@ -197,8 +195,6 @@ export declare const BATCH_COPY: {
197
195
  readonly review: "Granska förslagen. Kryssa ur dem du inte vill ha, eller ändra formuleringen innan du sparar.";
198
196
  readonly savesDraft: "Sparas som utkast; inget publiceras.";
199
197
  readonly savesDirectly: "Sparas direkt: den här samlingen har inga utkast.";
200
- readonly before: "Före";
201
- readonly empty: "tomt";
202
198
  readonly retry: "Försök igen";
203
199
  readonly retryWith: "Vad ska bli annorlunda? (valfritt)";
204
200
  readonly retrySend: "Fråga igen";
@@ -168,8 +168,6 @@ export const BATCH_COPY = {
168
168
  review: "Check the suggestions. Uncheck any you do not want, or change the wording before saving.",
169
169
  savesDraft: "Saves as a draft; nothing is published.",
170
170
  savesDirectly: "Saved directly: this collection has no drafts.",
171
- before: "Before",
172
- empty: "empty",
173
171
  retry: "Try again",
174
172
  retryWith: "What should be different? (optional)",
175
173
  retrySend: "Ask again",
@@ -207,8 +205,6 @@ export const BATCH_COPY = {
207
205
  review: "Granska förslagen. Kryssa ur dem du inte vill ha, eller ändra formuleringen innan du sparar.",
208
206
  savesDraft: "Sparas som utkast; inget publiceras.",
209
207
  savesDirectly: "Sparas direkt: den här samlingen har inga utkast.",
210
- before: "Före",
211
- empty: "tomt",
212
208
  retry: "Försök igen",
213
209
  retryWith: "Vad ska bli annorlunda? (valfritt)",
214
210
  retrySend: "Fråga igen",
@@ -22,8 +22,8 @@ export function groupProposalLines(lines) {
22
22
  ? a.kind === "field"
23
23
  ? -1
24
24
  : 1
25
- : a.kind === "group"
26
- ? a.path.localeCompare(b.path, "en", { numeric: true })
25
+ : a.kind === "group" && b.kind === "group"
26
+ ? a.group.order - b.group.order || a.path.localeCompare(b.path, "en", { numeric: true })
27
27
  : 0);
28
28
  for (const node of nodes)
29
29
  if (node.kind === "group")
@@ -4,6 +4,8 @@ export type FieldPathGroup = {
4
4
  label: string;
5
5
  kind: "container" | "block" | "row" | "group";
6
6
  position?: number;
7
+ /** Where the group sits among its siblings: the schema position, or the row's own position. */
8
+ order: number;
7
9
  };
8
10
  /** Schema labels and one-based row positions for a concrete form field path. */
9
11
  export declare function fieldPathLabels(fields: FieldNode[], path: string, data: unknown, language?: "en" | "sv"): {
@@ -26,6 +26,7 @@ export function fieldPathInfo(fields, path, data, language = "en") {
26
26
  label: name(block?.label ?? block?.slug ?? "block"),
27
27
  kind: "block",
28
28
  position,
29
+ order: position,
29
30
  });
30
31
  scope = block?.fields ?? [];
31
32
  }
@@ -37,22 +38,28 @@ export function fieldPathInfo(fields, path, data, language = "en") {
37
38
  label: `${name(row)} ${position}`,
38
39
  kind: "row",
39
40
  position,
41
+ order: position,
40
42
  });
41
43
  }
42
44
  continue;
43
45
  }
44
46
  schemaPath = schemaPath ? `${schemaPath}.${segment}` : segment;
45
- field = scope.find((entry) => entry.path === schemaPath);
47
+ const at = scope.findIndex((entry) => entry.path === schemaPath);
48
+ field = at >= 0 ? scope[at] : undefined;
46
49
  parts.push(name(field?.label ?? segment));
47
50
  if (field?.type === "group" || field?.type === "blocks" || field?.type === "array") {
48
51
  groups.push({
49
52
  path: concretePath,
50
53
  label: name(field.label ?? segment),
51
54
  kind: field.type === "group" ? "group" : "container",
55
+ order: at,
52
56
  });
53
57
  }
54
- else if (!field && scope.some((entry) => entry.path.startsWith(`${schemaPath}.`))) {
55
- groups.push({ path: concretePath, label: name(segment), kind: "group" });
58
+ else if (!field) {
59
+ const inside = scope.findIndex((entry) => entry.path.startsWith(`${schemaPath}.`));
60
+ if (inside >= 0) {
61
+ groups.push({ path: concretePath, label: name(segment), kind: "group", order: inside });
62
+ }
56
63
  }
57
64
  // Named tabs are flattened by walkFields, but their name remains in each child's path.
58
65
  if (field)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simmalugnt-se/payload-editor-assistant",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Context-aware editor assistant plugin for Payload Admin",
5
5
  "keywords": [
6
6
  "payload",