@firecms/entity_history 3.0.0 → 3.1.0-canary.02232f4

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/index.umd.js CHANGED
@@ -51,59 +51,66 @@
51
51
  return t2;
52
52
  }, equal);
53
53
  function UserChip(t0) {
54
- const $ = reactCompilerRuntime.c(11);
54
+ const $ = reactCompilerRuntime.c(12);
55
55
  const {
56
56
  user
57
57
  } = t0;
58
+ const {
59
+ t
60
+ } = core.useTranslation();
58
61
  const t1 = user.email ?? user.uid;
59
62
  let t2;
60
- if ($[0] !== user.displayName || $[1] !== user.photoURL) {
61
- t2 = user.photoURL && /* @__PURE__ */ jsxRuntime.jsx("img", { className: "rounded-full w-6 h-6 mr-2", src: user.photoURL, alt: user.displayName ?? "User picture" });
62
- $[0] = user.displayName;
63
- $[1] = user.photoURL;
64
- $[2] = t2;
63
+ if ($[0] !== t || $[1] !== user.displayName || $[2] !== user.photoURL) {
64
+ t2 = user.photoURL && /* @__PURE__ */ jsxRuntime.jsx("img", { className: "rounded-full w-6 h-6 mr-2", src: user.photoURL, alt: user.displayName ?? t("user_picture") });
65
+ $[0] = t;
66
+ $[1] = user.displayName;
67
+ $[2] = user.photoURL;
68
+ $[3] = t2;
65
69
  } else {
66
- t2 = $[2];
70
+ t2 = $[3];
67
71
  }
68
72
  const t3 = user.displayName ?? user.email ?? user.uid;
69
73
  let t4;
70
- if ($[3] !== t3) {
74
+ if ($[4] !== t3) {
71
75
  t4 = /* @__PURE__ */ jsxRuntime.jsx("span", { children: t3 });
72
- $[3] = t3;
73
- $[4] = t4;
76
+ $[4] = t3;
77
+ $[5] = t4;
74
78
  } else {
75
- t4 = $[4];
79
+ t4 = $[5];
76
80
  }
77
81
  let t5;
78
- if ($[5] !== t2 || $[6] !== t4) {
82
+ if ($[6] !== t2 || $[7] !== t4) {
79
83
  t5 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Chip, { size: "small", className: "flex items-center", children: [
80
84
  t2,
81
85
  t4
82
86
  ] });
83
- $[5] = t2;
84
- $[6] = t4;
85
- $[7] = t5;
87
+ $[6] = t2;
88
+ $[7] = t4;
89
+ $[8] = t5;
86
90
  } else {
87
- t5 = $[7];
91
+ t5 = $[8];
88
92
  }
89
93
  let t6;
90
- if ($[8] !== t1 || $[9] !== t5) {
94
+ if ($[9] !== t1 || $[10] !== t5) {
91
95
  t6 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t1, children: t5 });
92
- $[8] = t1;
93
- $[9] = t5;
94
- $[10] = t6;
96
+ $[9] = t1;
97
+ $[10] = t5;
98
+ $[11] = t6;
95
99
  } else {
96
- t6 = $[10];
100
+ t6 = $[11];
97
101
  }
98
102
  return t6;
99
103
  }
100
104
  function PreviousValueView(t0) {
101
- const $ = reactCompilerRuntime.c(12);
105
+ const $ = reactCompilerRuntime.c(18);
102
106
  const {
103
107
  previousValueInPath,
104
108
  childProperty,
105
- key
109
+ propertyKey
106
110
  } = t0;
111
+ const {
112
+ t
113
+ } = core.useTranslation();
107
114
  if (typeof previousValueInPath === "string" || typeof previousValueInPath === "number") {
108
115
  let t1;
109
116
  if ($[0] !== previousValueInPath) {
@@ -128,43 +135,61 @@
128
135
  return t2;
129
136
  } else {
130
137
  let t1;
131
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
132
- t1 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", children: "Previous value" });
133
- $[4] = t1;
138
+ if ($[4] !== t) {
139
+ t1 = t("entity_history_previous_value");
140
+ $[4] = t;
141
+ $[5] = t1;
134
142
  } else {
135
- t1 = $[4];
143
+ t1 = $[5];
136
144
  }
137
- const t2 = key;
138
- const t3 = childProperty;
139
- let t4;
140
- if ($[5] !== previousValueInPath || $[6] !== t2 || $[7] !== t3) {
141
- t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
142
- t1,
143
- /* @__PURE__ */ jsxRuntime.jsx(core.PropertyPreview, { propertyKey: t2, value: previousValueInPath, property: t3, size: "small" })
144
- ] });
145
- $[5] = previousValueInPath;
146
- $[6] = t2;
147
- $[7] = t3;
148
- $[8] = t4;
145
+ let t2;
146
+ if ($[6] !== t1) {
147
+ t2 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", children: t1 });
148
+ $[6] = t1;
149
+ $[7] = t2;
149
150
  } else {
150
- t4 = $[8];
151
+ t2 = $[7];
151
152
  }
153
+ const t3 = propertyKey;
154
+ const t4 = childProperty;
152
155
  let t5;
153
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
154
- t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardBackspaceIcon, { size: "smallest", color: "disabled", className: "mb-1" });
155
- $[9] = t5;
156
+ if ($[8] !== previousValueInPath || $[9] !== t3 || $[10] !== t4) {
157
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(core.PropertyPreview, { propertyKey: t3, value: previousValueInPath, property: t4, size: "small" });
158
+ $[8] = previousValueInPath;
159
+ $[9] = t3;
160
+ $[10] = t4;
161
+ $[11] = t5;
156
162
  } else {
157
- t5 = $[9];
163
+ t5 = $[11];
158
164
  }
159
165
  let t6;
160
- if ($[10] !== t4) {
161
- t6 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { side: "left", title: t4, children: t5 });
162
- $[10] = t4;
163
- $[11] = t6;
166
+ if ($[12] !== t2 || $[13] !== t5) {
167
+ t6 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
168
+ t2,
169
+ t5
170
+ ] });
171
+ $[12] = t2;
172
+ $[13] = t5;
173
+ $[14] = t6;
174
+ } else {
175
+ t6 = $[14];
176
+ }
177
+ let t7;
178
+ if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
179
+ t7 = /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardBackspaceIcon, { size: "smallest", color: "disabled", className: "mb-1" });
180
+ $[15] = t7;
181
+ } else {
182
+ t7 = $[15];
183
+ }
184
+ let t8;
185
+ if ($[16] !== t6) {
186
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { side: "left", title: t6, children: t7 });
187
+ $[16] = t6;
188
+ $[17] = t8;
164
189
  } else {
165
- t6 = $[11];
190
+ t8 = $[17];
166
191
  }
167
- return t6;
192
+ return t8;
168
193
  }
169
194
  }
170
195
  }
@@ -182,6 +207,9 @@
182
207
  const customizationController = core.useCustomizationController();
183
208
  const navigationController = core.useNavigationController();
184
209
  const sideEntityController = core.useSideEntityController();
210
+ const {
211
+ t
212
+ } = core.useTranslation();
185
213
  const collection = collectionProp ?? navigationController.getCollection(entity.path);
186
214
  const updatedOn = entity.values?.["__metadata"]?.["updated_on"];
187
215
  if (!collection) {
@@ -205,9 +233,9 @@
205
233
  !user && updatedBy && /* @__PURE__ */ jsxRuntime.jsx(ui.Chip, { size: "small", children: updatedBy }),
206
234
  user && /* @__PURE__ */ jsxRuntime.jsx(UserChip, { user })
207
235
  ] }),
208
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("bg-white dark:bg-surface-900", "min-h-[42px]", "w-full", "items-center", hover ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 group-hover:bg-surface-accent-50 dark:group-hover:bg-surface-800" : "", size === "small" ? "p-1" : "px-2 py-1", "flex border rounded-lg", onClick ? "cursor-pointer" : "", ui.defaultBorderMixin), children: [
236
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("bg-white dark:bg-surface-900", "min-h-[44px]", "w-full", "items-center", hover ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 group-hover:bg-surface-accent-50 dark:group-hover:bg-surface-800" : "", size === "small" ? "p-1" : "px-2 py-1", "flex border rounded-lg", onClick ? "cursor-pointer" : "", ui.defaultBorderMixin), children: [
209
237
  actions,
210
- entity && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "See details for this revision", className: "my-2 grow-0 shrink-0 self-start", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { color: "inherit", className: "", onClick: (e) => {
238
+ entity && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t("entity_history_see_details"), className: "my-2 grow-0 shrink-0 self-start", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { color: "inherit", className: "", onClick: (e) => {
211
239
  sideEntityController.open({
212
240
  entityId: entity.id,
213
241
  path: entity.path,
@@ -230,11 +258,11 @@
230
258
  const childProperty = core.getPropertyInPath(resolvedCollection.properties, key);
231
259
  const valueInPath = core.getValueInPath(entity.values, key);
232
260
  const previousValueInPath = previousValues ? core.getValueInPath(previousValues, key) : void 0;
233
- const element = childProperty ? entity ? /* @__PURE__ */ jsxRuntime.jsx(core.PropertyPreview, { propertyKey: key, value: valueInPath, property: childProperty, size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(core.SkeletonPropertyComponent, { property: childProperty, size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "body2", children: typeof valueInPath === "string" ? valueInPath : JSON.stringify(valueInPath) });
261
+ const element = childProperty ? entity ? /* @__PURE__ */ jsxRuntime.jsx(core.PropertyPreview, { propertyKey: key, value: valueInPath, property: childProperty, size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(core.SkeletonPropertyComponent, { property: childProperty, size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "body2", children: typeof valueInPath === "string" ? valueInPath : JSON.stringify(valueInPath, core.jsonStringifyReplacer) });
234
262
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full my-1 items-center", children: [
235
263
  /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", className: "min-w-[140px] md:min-w-[200px] w-1/5 pr-8 overflow-hidden text-ellipsis text-right", children: key }),
236
264
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-4/5", children: [
237
- previousValueInPath !== void 0 && previousValueInPath !== valueInPath && /* @__PURE__ */ jsxRuntime.jsx(PreviousValueView, { previousValueInPath, childProperty }, key),
265
+ previousValueInPath !== void 0 && previousValueInPath !== valueInPath && /* @__PURE__ */ jsxRuntime.jsx(PreviousValueView, { previousValueInPath, childProperty, propertyKey: key }),
238
266
  element
239
267
  ] })
240
268
  ] }, "ref_prev_" + key);
@@ -243,7 +271,7 @@
243
271
  ] });
244
272
  }
245
273
  function EntityHistoryView(t0) {
246
- const $ = reactCompilerRuntime.c(58);
274
+ const $ = reactCompilerRuntime.c(78);
247
275
  const {
248
276
  entity,
249
277
  collection,
@@ -251,12 +279,15 @@
251
279
  } = t0;
252
280
  const authController = core.useAuthController();
253
281
  const snackbarController = core.useSnackbarController();
282
+ const {
283
+ t
284
+ } = core.useTranslation();
254
285
  const dirty = formContext?.formex.dirty;
255
286
  const dataSource = core.useDataSource();
256
287
  const pathAndId = entity ? entity?.path + "/" + entity?.id : void 0;
257
288
  const [revertVersionDialog, setRevertVersionDialog] = React.useState(void 0);
258
289
  let t1;
259
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
290
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
260
291
  t1 = [];
261
292
  $[0] = t1;
262
293
  } else {
@@ -270,8 +301,7 @@
270
301
  const observerRef = React.useRef(null);
271
302
  const loadMoreRef = React.useRef(null);
272
303
  let t2;
273
- let t3;
274
- if ($[1] !== dataSource || $[2] !== limit || $[3] !== pathAndId) {
304
+ if ($[1] !== collection || $[2] !== dataSource || $[3] !== limit || $[4] !== pathAndId) {
275
305
  t2 = () => {
276
306
  if (!pathAndId) {
277
307
  return;
@@ -279,6 +309,7 @@
279
309
  setIsLoading(true);
280
310
  const listener = dataSource.listenCollection?.({
281
311
  path: pathAndId + "/__history",
312
+ collection,
282
313
  order: "desc",
283
314
  orderBy: "__metadata.updated_on",
284
315
  limit,
@@ -300,19 +331,27 @@
300
331
  }
301
332
  };
302
333
  };
334
+ $[1] = collection;
335
+ $[2] = dataSource;
336
+ $[3] = limit;
337
+ $[4] = pathAndId;
338
+ $[5] = t2;
339
+ } else {
340
+ t2 = $[5];
341
+ }
342
+ let t3;
343
+ if ($[6] !== dataSource || $[7] !== limit || $[8] !== pathAndId) {
303
344
  t3 = [pathAndId, limit, dataSource];
304
- $[1] = dataSource;
305
- $[2] = limit;
306
- $[3] = pathAndId;
307
- $[4] = t2;
308
- $[5] = t3;
345
+ $[6] = dataSource;
346
+ $[7] = limit;
347
+ $[8] = pathAndId;
348
+ $[9] = t3;
309
349
  } else {
310
- t2 = $[4];
311
- t3 = $[5];
350
+ t3 = $[9];
312
351
  }
313
352
  React.useEffect(t2, t3);
314
353
  let t4;
315
- if ($[6] !== hasMore || $[7] !== isLoading) {
354
+ if ($[10] !== hasMore || $[11] !== isLoading) {
316
355
  t4 = () => {
317
356
  const currentContainer = containerRef.current;
318
357
  const currentLoadMore = loadMoreRef.current;
@@ -331,7 +370,7 @@
331
370
  const handleObserver = (entries) => {
332
371
  const target = entries[0];
333
372
  if (target.isIntersecting && hasMore && !isLoading) {
334
- setLimit(_temp);
373
+ setLimit(_temp$1);
335
374
  }
336
375
  };
337
376
  const observer = new IntersectionObserver(handleObserver, options);
@@ -344,35 +383,44 @@
344
383
  }
345
384
  };
346
385
  };
347
- $[6] = hasMore;
348
- $[7] = isLoading;
349
- $[8] = t4;
386
+ $[10] = hasMore;
387
+ $[11] = isLoading;
388
+ $[12] = t4;
350
389
  } else {
351
- t4 = $[8];
390
+ t4 = $[12];
352
391
  }
353
392
  let t5;
354
- if ($[9] !== hasMore || $[10] !== isLoading || $[11] !== revisions.length) {
393
+ if ($[13] !== hasMore || $[14] !== isLoading || $[15] !== revisions.length) {
355
394
  t5 = [hasMore, isLoading, revisions.length];
356
- $[9] = hasMore;
357
- $[10] = isLoading;
358
- $[11] = revisions.length;
359
- $[12] = t5;
395
+ $[13] = hasMore;
396
+ $[14] = isLoading;
397
+ $[15] = revisions.length;
398
+ $[16] = t5;
360
399
  } else {
361
- t5 = $[12];
400
+ t5 = $[16];
362
401
  }
363
402
  React.useEffect(t4, t5);
364
403
  if (!entity) {
365
404
  let t62;
366
- if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
367
- t62 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "History is only available for existing entities" }) });
368
- $[13] = t62;
405
+ if ($[17] !== t) {
406
+ t62 = t("entity_history_only_existing");
407
+ $[17] = t;
408
+ $[18] = t62;
369
409
  } else {
370
- t62 = $[13];
410
+ t62 = $[18];
371
411
  }
372
- return t62;
412
+ let t72;
413
+ if ($[19] !== t62) {
414
+ t72 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: t62 }) });
415
+ $[19] = t62;
416
+ $[20] = t72;
417
+ } else {
418
+ t72 = $[20];
419
+ }
420
+ return t72;
373
421
  }
374
422
  let t6;
375
- if ($[14] !== authController || $[15] !== collection || $[16] !== dataSource || $[17] !== entity || $[18] !== formContext || $[19] !== snackbarController) {
423
+ if ($[21] !== authController || $[22] !== collection || $[23] !== dataSource || $[24] !== entity || $[25] !== formContext || $[26] !== snackbarController || $[27] !== t) {
376
424
  t6 = function doRevert2(revertVersion) {
377
425
  if (!entity) {
378
426
  throw new Error("No entity to revert");
@@ -406,64 +454,75 @@
406
454
  });
407
455
  setRevertVersionDialog(void 0);
408
456
  snackbarController.open({
409
- message: "Reverted version",
457
+ message: t("entity_history_reverted"),
410
458
  type: "info"
411
459
  });
412
460
  }).catch((error_0) => {
413
461
  console.error("Error reverting entity:", error_0);
414
462
  snackbarController.open({
415
- message: "Error reverting entity",
463
+ message: t("entity_history_error_reverting"),
416
464
  type: "error"
417
465
  });
418
466
  });
419
467
  };
420
- $[14] = authController;
421
- $[15] = collection;
422
- $[16] = dataSource;
423
- $[17] = entity;
424
- $[18] = formContext;
425
- $[19] = snackbarController;
426
- $[20] = t6;
468
+ $[21] = authController;
469
+ $[22] = collection;
470
+ $[23] = dataSource;
471
+ $[24] = entity;
472
+ $[25] = formContext;
473
+ $[26] = snackbarController;
474
+ $[27] = t;
475
+ $[28] = t6;
427
476
  } else {
428
- t6 = $[20];
477
+ t6 = $[28];
429
478
  }
430
479
  const doRevert = t6;
431
480
  let t7;
432
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
481
+ if ($[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
433
482
  t7 = ui.cls("relative flex-1 h-full overflow-auto w-full flex flex-col gap-4 p-8");
434
- $[21] = t7;
483
+ $[29] = t7;
435
484
  } else {
436
- t7 = $[21];
485
+ t7 = $[29];
437
486
  }
438
487
  let t8;
439
- if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
440
- t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "h5", className: "mt-24 ml-4", children: "History" });
441
- $[22] = t8;
488
+ if ($[30] !== t) {
489
+ t8 = t("history");
490
+ $[30] = t;
491
+ $[31] = t8;
442
492
  } else {
443
- t8 = $[22];
493
+ t8 = $[31];
444
494
  }
445
495
  let t9;
446
- if ($[23] !== revisions.length) {
447
- t9 = revisions.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
448
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "ml-4 mt-8", children: "No history available" }),
449
- /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", className: "ml-4", children: "When you save an entity, a new version is created and stored in the history." })
450
- ] });
451
- $[23] = revisions.length;
452
- $[24] = t9;
496
+ if ($[32] !== t8) {
497
+ t9 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "h5", className: "mt-24 ml-4", children: t8 });
498
+ $[32] = t8;
499
+ $[33] = t9;
453
500
  } else {
454
- t9 = $[24];
501
+ t9 = $[33];
455
502
  }
456
503
  let t10;
457
- if ($[25] !== collection || $[26] !== dirty || $[27] !== revisions || $[28] !== snackbarController) {
458
- let t112;
459
- if ($[30] !== collection || $[31] !== dirty || $[32] !== snackbarController) {
460
- t112 = (revision, index) => {
504
+ if ($[34] !== revisions.length || $[35] !== t) {
505
+ t10 = revisions.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
506
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "ml-4 mt-8", children: t("entity_history_no_history") }),
507
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", className: "ml-4", children: t("entity_history_when_save") })
508
+ ] });
509
+ $[34] = revisions.length;
510
+ $[35] = t;
511
+ $[36] = t10;
512
+ } else {
513
+ t10 = $[36];
514
+ }
515
+ let t11;
516
+ if ($[37] !== collection || $[38] !== dirty || $[39] !== revisions || $[40] !== snackbarController || $[41] !== t) {
517
+ let t122;
518
+ if ($[43] !== collection || $[44] !== dirty || $[45] !== snackbarController || $[46] !== t) {
519
+ t122 = (revision, index) => {
461
520
  const previewKeys = revision.values?.__metadata?.changed_fields;
462
521
  const previousValues = revision.values?.__metadata?.previous_values;
463
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-cols gap-2 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(EntityHistoryEntry, { size: "large", entity: revision, collection, previewKeys, previousValues, actions: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "Revert to this version", className: "m-2 grow-0 self-start", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: () => {
522
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-cols gap-2 w-full", children: /* @__PURE__ */ jsxRuntime.jsx(EntityHistoryEntry, { size: "large", entity: revision, collection, previewKeys, previousValues, actions: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t("entity_history_revert_tooltip"), className: "m-2 grow-0 self-start", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: () => {
464
523
  if (dirty) {
465
524
  snackbarController.open({
466
- message: "Please save or discard your changes before reverting",
525
+ message: t("entity_history_please_save"),
467
526
  type: "warning"
468
527
  });
469
528
  } else {
@@ -471,113 +530,130 @@
471
530
  }
472
531
  }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.HistoryIcon, {}) }) }) }) }, index);
473
532
  };
474
- $[30] = collection;
475
- $[31] = dirty;
476
- $[32] = snackbarController;
477
- $[33] = t112;
533
+ $[43] = collection;
534
+ $[44] = dirty;
535
+ $[45] = snackbarController;
536
+ $[46] = t;
537
+ $[47] = t122;
478
538
  } else {
479
- t112 = $[33];
539
+ t122 = $[47];
480
540
  }
481
- t10 = revisions.map(t112);
482
- $[25] = collection;
483
- $[26] = dirty;
484
- $[27] = revisions;
485
- $[28] = snackbarController;
486
- $[29] = t10;
541
+ t11 = revisions.map(t122);
542
+ $[37] = collection;
543
+ $[38] = dirty;
544
+ $[39] = revisions;
545
+ $[40] = snackbarController;
546
+ $[41] = t;
547
+ $[42] = t11;
487
548
  } else {
488
- t10 = $[29];
549
+ t11 = $[42];
489
550
  }
490
- let t11;
491
- if ($[34] !== hasMore || $[35] !== isLoading || $[36] !== revisions.length) {
492
- t11 = revisions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: loadMoreRef, className: "py-4 text-center", children: [
493
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Loading more..." }),
494
- !hasMore && revisions.length > 5 && /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "No more history available" })
551
+ let t12;
552
+ if ($[48] !== hasMore || $[49] !== isLoading || $[50] !== revisions.length || $[51] !== t) {
553
+ t12 = revisions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: loadMoreRef, className: "py-4 text-center", children: [
554
+ isLoading && /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: t("loading_more") }),
555
+ !hasMore && revisions.length > 5 && /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: t("entity_history_no_more") })
495
556
  ] });
496
- $[34] = hasMore;
497
- $[35] = isLoading;
498
- $[36] = revisions.length;
499
- $[37] = t11;
557
+ $[48] = hasMore;
558
+ $[49] = isLoading;
559
+ $[50] = revisions.length;
560
+ $[51] = t;
561
+ $[52] = t12;
500
562
  } else {
501
- t11 = $[37];
563
+ t12 = $[52];
502
564
  }
503
- let t12;
504
- if ($[38] !== t10 || $[39] !== t11 || $[40] !== t9) {
505
- t12 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 max-w-6xl mx-auto w-full", children: [
506
- t8,
565
+ let t13;
566
+ if ($[53] !== t10 || $[54] !== t11 || $[55] !== t12 || $[56] !== t9) {
567
+ t13 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 max-w-6xl mx-auto w-full", children: [
507
568
  t9,
508
569
  t10,
509
- t11
570
+ t11,
571
+ t12
510
572
  ] });
511
- $[38] = t10;
512
- $[39] = t11;
513
- $[40] = t9;
514
- $[41] = t12;
573
+ $[53] = t10;
574
+ $[54] = t11;
575
+ $[55] = t12;
576
+ $[56] = t9;
577
+ $[57] = t13;
515
578
  } else {
516
- t12 = $[41];
579
+ t13 = $[57];
517
580
  }
518
- const t13 = Boolean(revertVersionDialog);
519
- let t14;
520
- if ($[42] !== doRevert || $[43] !== revertVersionDialog) {
521
- t14 = function() {
581
+ const t14 = Boolean(revertVersionDialog);
582
+ let t15;
583
+ if ($[58] !== doRevert || $[59] !== revertVersionDialog) {
584
+ t15 = function() {
522
585
  if (!revertVersionDialog) {
523
586
  return;
524
587
  }
525
588
  doRevert(revertVersionDialog);
526
589
  };
527
- $[42] = doRevert;
528
- $[43] = revertVersionDialog;
529
- $[44] = t14;
590
+ $[58] = doRevert;
591
+ $[59] = revertVersionDialog;
592
+ $[60] = t15;
530
593
  } else {
531
- t14 = $[44];
594
+ t15 = $[60];
532
595
  }
533
- let t15;
534
596
  let t16;
535
- if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
536
- t15 = function() {
597
+ if ($[61] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
598
+ t16 = function() {
537
599
  setRevertVersionDialog(void 0);
538
600
  };
539
- t16 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", children: "Revert data to this version?" });
540
- $[45] = t15;
541
- $[46] = t16;
601
+ $[61] = t16;
542
602
  } else {
543
- t15 = $[45];
544
- t16 = $[46];
603
+ t16 = $[61];
545
604
  }
546
605
  let t17;
547
- if ($[47] !== collection || $[48] !== entity?.path || $[49] !== revertVersionDialog) {
548
- t17 = revertVersionDialog ? /* @__PURE__ */ jsxRuntime.jsx(core.EntityView, { entity: revertVersionDialog, collection, path: entity?.path }) : null;
549
- $[47] = collection;
550
- $[48] = entity?.path;
551
- $[49] = revertVersionDialog;
552
- $[50] = t17;
606
+ if ($[62] !== t) {
607
+ t17 = t("entity_history_revert_dialog_title");
608
+ $[62] = t;
609
+ $[63] = t17;
553
610
  } else {
554
- t17 = $[50];
611
+ t17 = $[63];
555
612
  }
556
613
  let t18;
557
- if ($[51] !== t13 || $[52] !== t14 || $[53] !== t17) {
558
- t18 = /* @__PURE__ */ jsxRuntime.jsx(core.ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t13, onAccept: t14, onCancel: t15, title: t16, body: t17 }) });
559
- $[51] = t13;
560
- $[52] = t14;
561
- $[53] = t17;
562
- $[54] = t18;
614
+ if ($[64] !== t17) {
615
+ t18 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", children: t17 });
616
+ $[64] = t17;
617
+ $[65] = t18;
563
618
  } else {
564
- t18 = $[54];
619
+ t18 = $[65];
565
620
  }
566
621
  let t19;
567
- if ($[55] !== t12 || $[56] !== t18) {
568
- t19 = /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: t7, children: [
569
- t12,
570
- t18
622
+ if ($[66] !== collection || $[67] !== entity?.path || $[68] !== revertVersionDialog) {
623
+ t19 = revertVersionDialog ? /* @__PURE__ */ jsxRuntime.jsx(core.EntityView, { entity: revertVersionDialog, collection, path: entity?.path }) : null;
624
+ $[66] = collection;
625
+ $[67] = entity?.path;
626
+ $[68] = revertVersionDialog;
627
+ $[69] = t19;
628
+ } else {
629
+ t19 = $[69];
630
+ }
631
+ let t20;
632
+ if ($[70] !== t14 || $[71] !== t15 || $[72] !== t18 || $[73] !== t19) {
633
+ t20 = /* @__PURE__ */ jsxRuntime.jsx(core.ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t14, onAccept: t15, onCancel: t16, title: t18, body: t19 }) });
634
+ $[70] = t14;
635
+ $[71] = t15;
636
+ $[72] = t18;
637
+ $[73] = t19;
638
+ $[74] = t20;
639
+ } else {
640
+ t20 = $[74];
641
+ }
642
+ let t21;
643
+ if ($[75] !== t13 || $[76] !== t20) {
644
+ t21 = /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: t7, children: [
645
+ t13,
646
+ t20
571
647
  ] });
572
- $[55] = t12;
573
- $[56] = t18;
574
- $[57] = t19;
648
+ $[75] = t13;
649
+ $[76] = t20;
650
+ $[77] = t21;
575
651
  } else {
576
- t19 = $[57];
652
+ t21 = $[77];
577
653
  }
578
- return t19;
654
+ return t21;
579
655
  }
580
- function _temp(prev) {
656
+ function _temp$1(prev) {
581
657
  return prev + 5;
582
658
  }
583
659
  function createHistoryEntry({
@@ -585,7 +661,8 @@
585
661
  previousValues,
586
662
  values,
587
663
  path,
588
- entityId
664
+ entityId,
665
+ collection
589
666
  }) {
590
667
  const uid = context.authController.user?.uid;
591
668
  const dataSource = context.dataSource;
@@ -602,7 +679,8 @@
602
679
  dataSource.saveEntity({
603
680
  path: path + "/" + entityId + "/__history",
604
681
  values: entry,
605
- status: "new"
682
+ status: "new",
683
+ collection
606
684
  }).then(() => {
607
685
  console.debug("History saved for", path, entityId);
608
686
  });
@@ -614,12 +692,14 @@
614
692
  const path = props.path;
615
693
  const entityId = props.entityId;
616
694
  const context = props.context;
695
+ const collection = props.collection;
617
696
  createHistoryEntry({
618
697
  context,
619
698
  previousValues,
620
699
  values,
621
700
  path,
622
- entityId
701
+ entityId,
702
+ collection
623
703
  });
624
704
  }
625
705
  };
@@ -663,6 +743,314 @@
663
743
  }
664
744
  return changedFields;
665
745
  }
746
+ function getRelativeTimeString(date, t) {
747
+ const now = /* @__PURE__ */ new Date();
748
+ const diffMs = now.getTime() - date.getTime();
749
+ const diffSeconds = Math.floor(diffMs / 1e3);
750
+ const diffMinutes = Math.floor(diffSeconds / 60);
751
+ const diffHours = Math.floor(diffMinutes / 60);
752
+ const diffDays = Math.floor(diffHours / 24);
753
+ if (diffSeconds < 60) return t("entity_history_just_now");
754
+ if (diffMinutes < 60) return t("entity_history_minutes_ago", {
755
+ minutes: diffMinutes
756
+ });
757
+ if (diffHours < 24) return t("entity_history_hours_ago", {
758
+ hours: diffHours
759
+ });
760
+ if (diffDays < 30) return t("entity_history_days_ago", {
761
+ days: diffDays
762
+ });
763
+ return date.toLocaleDateString();
764
+ }
765
+ function LastEditedByIndicator(t0) {
766
+ const $ = reactCompilerRuntime.c(24);
767
+ const {
768
+ path,
769
+ entityId,
770
+ collection
771
+ } = t0;
772
+ const {
773
+ t
774
+ } = core.useTranslation();
775
+ const {
776
+ getUser
777
+ } = useHistoryController();
778
+ const dataSource = core.useDataSource();
779
+ const [latestEntry, setLatestEntry] = React.useState();
780
+ let t1;
781
+ if ($[0] !== collection || $[1] !== dataSource || $[2] !== entityId || $[3] !== path) {
782
+ t1 = () => {
783
+ if (!path || !entityId) {
784
+ return;
785
+ }
786
+ const historyPath = `${path}/${entityId}/__history`;
787
+ const unsubscribe = dataSource.listenCollection?.({
788
+ path: historyPath,
789
+ collection,
790
+ orderBy: "__metadata.updated_on",
791
+ order: "desc",
792
+ limit: 1,
793
+ onUpdate: (entities) => {
794
+ setLatestEntry(entities[0]);
795
+ },
796
+ onError: _temp
797
+ });
798
+ return () => {
799
+ if (typeof unsubscribe === "function") {
800
+ unsubscribe();
801
+ }
802
+ };
803
+ };
804
+ $[0] = collection;
805
+ $[1] = dataSource;
806
+ $[2] = entityId;
807
+ $[3] = path;
808
+ $[4] = t1;
809
+ } else {
810
+ t1 = $[4];
811
+ }
812
+ let t2;
813
+ if ($[5] !== dataSource || $[6] !== entityId || $[7] !== path) {
814
+ t2 = [path, entityId, dataSource];
815
+ $[5] = dataSource;
816
+ $[6] = entityId;
817
+ $[7] = path;
818
+ $[8] = t2;
819
+ } else {
820
+ t2 = $[8];
821
+ }
822
+ React.useEffect(t1, t2);
823
+ const metadata = latestEntry?.values?.__metadata;
824
+ const uid = metadata?.updated_by;
825
+ const editedOn = metadata?.updated_on;
826
+ const hasData = Boolean(uid || editedOn);
827
+ let t3;
828
+ if ($[9] !== getUser || $[10] !== uid) {
829
+ t3 = uid ? getUser?.(uid) : void 0;
830
+ $[9] = getUser;
831
+ $[10] = uid;
832
+ $[11] = t3;
833
+ } else {
834
+ t3 = $[11];
835
+ }
836
+ const user = t3;
837
+ let t4;
838
+ if ($[12] !== editedOn) {
839
+ t4 = editedOn instanceof Date ? editedOn : editedOn?.toDate ? editedOn.toDate() : null;
840
+ $[12] = editedOn;
841
+ $[13] = t4;
842
+ } else {
843
+ t4 = $[13];
844
+ }
845
+ const date = t4;
846
+ let t5;
847
+ if ($[14] !== date || $[15] !== t) {
848
+ t5 = date ? getRelativeTimeString(date, t) : null;
849
+ $[14] = date;
850
+ $[15] = t;
851
+ $[16] = t5;
852
+ } else {
853
+ t5 = $[16];
854
+ }
855
+ const timeString = t5;
856
+ const displayName = user?.displayName ?? user?.email ?? uid;
857
+ const photoURL = user?.photoURL;
858
+ let t6;
859
+ if ($[17] !== displayName || $[18] !== hasData || $[19] !== photoURL || $[20] !== timeString) {
860
+ t6 = hasData && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
861
+ photoURL ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: photoURL, alt: displayName ?? "User", className: "rounded-full object-cover w-6 h-6" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-full bg-primary/10 dark:bg-primary-dark/20 flex items-center justify-center text-primary dark:text-primary-dark font-medium w-6 h-6 text-xs", children: (displayName ?? "?").charAt(0).toUpperCase() }),
862
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
863
+ displayName,
864
+ timeString ? ` · ${timeString}` : ""
865
+ ] })
866
+ ] });
867
+ $[17] = displayName;
868
+ $[18] = hasData;
869
+ $[19] = photoURL;
870
+ $[20] = timeString;
871
+ $[21] = t6;
872
+ } else {
873
+ t6 = $[21];
874
+ }
875
+ let t7;
876
+ if ($[22] !== t6) {
877
+ t7 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 text-xs text-text-secondary dark:text-text-secondary-dark min-h-6", children: t6 });
878
+ $[22] = t6;
879
+ $[23] = t7;
880
+ } else {
881
+ t7 = $[23];
882
+ }
883
+ return t7;
884
+ }
885
+ function _temp(error) {
886
+ console.error("Error fetching latest history entry:", error);
887
+ }
888
+ function LastEditedByFormAction(t0) {
889
+ const $ = reactCompilerRuntime.c(4);
890
+ const {
891
+ entityId,
892
+ path,
893
+ status,
894
+ collection
895
+ } = t0;
896
+ if (status === "new" || status === "copy" || !entityId) {
897
+ return null;
898
+ }
899
+ if (!collection.history) {
900
+ return null;
901
+ }
902
+ let t1;
903
+ if ($[0] !== collection || $[1] !== entityId || $[2] !== path) {
904
+ t1 = /* @__PURE__ */ jsxRuntime.jsx(LastEditedByIndicator, { path, entityId, collection });
905
+ $[0] = collection;
906
+ $[1] = entityId;
907
+ $[2] = path;
908
+ $[3] = t1;
909
+ } else {
910
+ t1 = $[3];
911
+ }
912
+ return t1;
913
+ }
914
+ const entityHistoryTranslationsEn = {
915
+ history: "History",
916
+ entity_history_only_existing: "History is only available for existing entities",
917
+ entity_history_reverted: "Reverted version",
918
+ entity_history_error_reverting: "Error reverting entity",
919
+ entity_history_no_history: "No history available",
920
+ entity_history_when_save: "When you save an entity, a new version is created and stored in the history.",
921
+ entity_history_revert_tooltip: "Revert to this version",
922
+ entity_history_please_save: "Please save or discard your changes before reverting",
923
+ loading_more: "Loading more...",
924
+ entity_history_no_more: "No more history available",
925
+ entity_history_revert_dialog_title: "Revert data to this version?",
926
+ entity_history_previous_value: "Previous value",
927
+ entity_history_see_details: "See details for this revision",
928
+ entity_history_just_now: "just now",
929
+ entity_history_minutes_ago: "{{minutes}}m ago",
930
+ entity_history_hours_ago: "{{hours}}h ago",
931
+ entity_history_days_ago: "{{days}}d ago",
932
+ user_picture: "User picture"
933
+ };
934
+ const entityHistoryTranslationsEs = {
935
+ history: "Historial",
936
+ entity_history_only_existing: "El historial solo está disponible para entidades existentes",
937
+ entity_history_reverted: "Versión revertida",
938
+ entity_history_error_reverting: "Error al revertir la entidad",
939
+ entity_history_no_history: "No hay historial disponible",
940
+ entity_history_when_save: "Cuando guardas una entidad, se crea una nueva versión y se almacena en el historial.",
941
+ entity_history_revert_tooltip: "Revertir a esta versión",
942
+ entity_history_please_save: "Por favor, guarda o descarta tus cambios antes de revertir",
943
+ loading_more: "Cargando más...",
944
+ entity_history_no_more: "No hay más historial disponible",
945
+ entity_history_revert_dialog_title: "¿Revertir datos a esta versión?",
946
+ entity_history_previous_value: "Valor anterior",
947
+ entity_history_see_details: "Ver detalles de esta revisión",
948
+ entity_history_just_now: "justo ahora",
949
+ entity_history_minutes_ago: "hace {{minutes}}m",
950
+ entity_history_hours_ago: "hace {{hours}}h",
951
+ entity_history_days_ago: "hace {{days}}d",
952
+ user_picture: "Foto de usuario"
953
+ };
954
+ const entityHistoryTranslationsDe = {
955
+ history: "Verlauf",
956
+ entity_history_only_existing: "Verlauf ist nur für vorhandene Entitäten verfügbar",
957
+ entity_history_reverted: "Wiederhergestellte Version",
958
+ entity_history_error_reverting: "Fehler beim Wiederherstellen der Entität",
959
+ entity_history_no_history: "Kein Verlauf verfügbar",
960
+ entity_history_when_save: "Wenn Sie eine Entität speichern, wird eine neue Version erstellt und im Verlauf gespeichert.",
961
+ entity_history_revert_tooltip: "Zu dieser Version zurückkehren",
962
+ entity_history_please_save: "Bitte speichern oder verwerfen Sie Ihre Änderungen vor der Wiederherstellung",
963
+ loading_more: "Mehr laden...",
964
+ entity_history_no_more: "Kein weiterer Verlauf verfügbar",
965
+ entity_history_revert_dialog_title: "Daten auf diese Version zurücksetzen?",
966
+ entity_history_previous_value: "Vorheriger Wert",
967
+ entity_history_see_details: "Details zu dieser Überarbeitung anzeigen",
968
+ entity_history_just_now: "gerade eben",
969
+ entity_history_minutes_ago: "vor {{minutes}}m",
970
+ entity_history_hours_ago: "vor {{hours}}h",
971
+ entity_history_days_ago: "vor {{days}}d",
972
+ user_picture: "Benutzerbild"
973
+ };
974
+ const entityHistoryTranslationsFr = {
975
+ history: "Historique",
976
+ entity_history_only_existing: "L'historique n'est disponible que pour les entités existantes",
977
+ entity_history_reverted: "Version restaurée",
978
+ entity_history_error_reverting: "Erreur lors de la restauration de l'entité",
979
+ entity_history_no_history: "Aucun historique disponible",
980
+ entity_history_when_save: "Lorsque vous enregistrez une entité, une nouvelle version est créée et stockée dans l'historique.",
981
+ entity_history_revert_tooltip: "Revenir à cette version",
982
+ entity_history_please_save: "Veuillez enregistrer ou annuler vos modifications avant de restaurer",
983
+ loading_more: "Chargement en cours...",
984
+ entity_history_no_more: "Aucun autre historique disponible",
985
+ entity_history_revert_dialog_title: "Restaurer les données à cette version ?",
986
+ entity_history_previous_value: "Valeur précédente",
987
+ entity_history_see_details: "Voir les détails de cette révision",
988
+ entity_history_just_now: "à l'instant",
989
+ entity_history_minutes_ago: "il y a {{minutes}}m",
990
+ entity_history_hours_ago: "il y a {{hours}}h",
991
+ entity_history_days_ago: "il y a {{days}}j",
992
+ user_picture: "Photo de l'utilisateur"
993
+ };
994
+ const entityHistoryTranslationsIt = {
995
+ history: "Cronologia",
996
+ entity_history_only_existing: "La cronologia è disponibile solo per le entità esistenti",
997
+ entity_history_reverted: "Versione ripristinata",
998
+ entity_history_error_reverting: "Errore durante il ripristino dell'entità",
999
+ entity_history_no_history: "Nessuna cronologia disponibile",
1000
+ entity_history_when_save: "Quando salvi un'entità, viene creata una nuova versione e memorizzata nella cronologia.",
1001
+ entity_history_revert_tooltip: "Ripristina a questa versione",
1002
+ entity_history_please_save: "Salva o annulla le modifiche prima del ripristino",
1003
+ loading_more: "Caricamento in corso...",
1004
+ entity_history_no_more: "Nessuna ulteriore cronologia disponibile",
1005
+ entity_history_revert_dialog_title: "Vuoi ripristinare i dati a questa versione?",
1006
+ entity_history_previous_value: "Valore precedente",
1007
+ entity_history_see_details: "Vedi i dettagli per questa revisione",
1008
+ entity_history_just_now: "proprio adesso",
1009
+ entity_history_minutes_ago: "{{minutes}} min fa",
1010
+ entity_history_hours_ago: "{{hours}} h fa",
1011
+ entity_history_days_ago: "{{days}} g fa",
1012
+ user_picture: "Immagine utente"
1013
+ };
1014
+ const entityHistoryTranslationsHi = {
1015
+ history: "इतिहास",
1016
+ entity_history_only_existing: "इतिहास केवल मौजूद संस्थाओं के लिए उपलब्ध है",
1017
+ entity_history_reverted: "परिवर्तित संस्करण",
1018
+ entity_history_error_reverting: "संस्था को वापस लाने में त्रुटि",
1019
+ entity_history_no_history: "कोई इतिहास उपलब्ध नहीं",
1020
+ entity_history_when_save: "जब आप किसी संस्था को सहेजते हैं, तो एक नया संस्करण बनाया जाता है और इतिहास में संग्रहीत किया जाता है।",
1021
+ entity_history_revert_tooltip: "इस संस्करण पर वापस जाएं",
1022
+ entity_history_please_save: "कृपया वापस जाने से पहले अपने परिवर्तनों को सहेजें या हटा दें",
1023
+ loading_more: "और लोड हो रहा है...",
1024
+ entity_history_no_more: "कोई और इतिहास उपलब्ध नहीं",
1025
+ entity_history_revert_dialog_title: "डेटा को इस संस्करण में वापस लाएँ?",
1026
+ entity_history_previous_value: "पिछला मान",
1027
+ entity_history_see_details: "इस संशोधन के लिए विवरण यहाँ देखें",
1028
+ entity_history_just_now: "अभी-अभी",
1029
+ entity_history_minutes_ago: "{{minutes}}m पहले",
1030
+ entity_history_hours_ago: "{{hours}}h पहले",
1031
+ entity_history_days_ago: "{{days}}d पहले",
1032
+ user_picture: "उपयोगकर्ता चित्र"
1033
+ };
1034
+ const entityHistoryTranslationsPt = {
1035
+ history: "Histórico",
1036
+ entity_history_only_existing: "O histórico está disponível apenas para entidades existentes",
1037
+ entity_history_reverted: "Versão revertida",
1038
+ entity_history_error_reverting: "Erro ao reverter entidade",
1039
+ entity_history_no_history: "Sem histórico disponível",
1040
+ entity_history_when_save: "Quando guarda uma entidade, é criada uma nova versão e armazenada no histórico.",
1041
+ entity_history_revert_tooltip: "Reverter para esta versão",
1042
+ entity_history_please_save: "Por favor guarde ou descarte as suas alterações antes de reverter",
1043
+ loading_more: "A carregar mais...",
1044
+ entity_history_no_more: "Sem mais histórico disponível",
1045
+ entity_history_revert_dialog_title: "Reverter dados para esta versão?",
1046
+ entity_history_previous_value: "Valor anterior",
1047
+ entity_history_see_details: "Ver detalhes desta revisão",
1048
+ entity_history_just_now: "agora mesmo",
1049
+ entity_history_minutes_ago: "há {{minutes}}m",
1050
+ entity_history_hours_ago: "há {{hours}}h",
1051
+ entity_history_days_ago: "há {{days}}d",
1052
+ user_picture: "Foto do utilizador"
1053
+ };
666
1054
  function useEntityHistoryPlugin(props) {
667
1055
  const {
668
1056
  defaultEnabled = false
@@ -671,6 +1059,7 @@
671
1059
  if (collection.history === true || defaultEnabled && collection.history !== false) {
672
1060
  return {
673
1061
  ...collection,
1062
+ history: true,
674
1063
  entityViews: [...collection.entityViews ?? [], {
675
1064
  key: "__history",
676
1065
  name: "History",
@@ -691,13 +1080,26 @@
691
1080
  getUser: props?.getUser
692
1081
  }
693
1082
  },
1083
+ form: {
1084
+ BeforeTitle: LastEditedByFormAction
1085
+ },
694
1086
  collection: {
695
1087
  modifyCollection
1088
+ },
1089
+ i18n: {
1090
+ en: entityHistoryTranslationsEn,
1091
+ es: entityHistoryTranslationsEs,
1092
+ de: entityHistoryTranslationsDe,
1093
+ fr: entityHistoryTranslationsFr,
1094
+ it: entityHistoryTranslationsIt,
1095
+ hi: entityHistoryTranslationsHi,
1096
+ pt: entityHistoryTranslationsPt
696
1097
  }
697
1098
  }), [props]);
698
1099
  }
699
1100
  exports2.HistoryControllerContext = HistoryControllerContext;
700
1101
  exports2.HistoryControllerProvider = HistoryControllerProvider;
1102
+ exports2.LastEditedByIndicator = LastEditedByIndicator;
701
1103
  exports2.createHistoryEntry = createHistoryEntry;
702
1104
  exports2.useEntityHistoryPlugin = useEntityHistoryPlugin;
703
1105
  exports2.useHistoryController = useHistoryController;