@firecms/entity_history 3.1.0 → 3.2.0-canary.4c3b8f2

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
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] === /* @__PURE__ */ 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 = propertyKey;
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] === /* @__PURE__ */ 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;
164
181
  } else {
165
- t6 = $[11];
182
+ t7 = $[15];
166
183
  }
167
- return t6;
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;
189
+ } else {
190
+ t8 = $[17];
191
+ }
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) {
@@ -207,7 +235,7 @@
207
235
  ] }),
208
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,
@@ -243,7 +271,7 @@
243
271
  ] });
244
272
  }
245
273
  function EntityHistoryView(t0) {
246
- const $ = reactCompilerRuntime.c(62);
274
+ const $ = reactCompilerRuntime.c(78);
247
275
  const {
248
276
  entity,
249
277
  collection,
@@ -251,6 +279,9 @@
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;
@@ -371,16 +402,25 @@
371
402
  React.useEffect(t4, t5);
372
403
  if (!entity) {
373
404
  let t62;
374
- if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
375
- 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" }) });
376
- $[17] = t62;
405
+ if ($[17] !== t) {
406
+ t62 = t("entity_history_only_existing");
407
+ $[17] = t;
408
+ $[18] = t62;
409
+ } else {
410
+ t62 = $[18];
411
+ }
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;
377
417
  } else {
378
- t62 = $[17];
418
+ t72 = $[20];
379
419
  }
380
- return t62;
420
+ return t72;
381
421
  }
382
422
  let t6;
383
- if ($[18] !== authController || $[19] !== collection || $[20] !== dataSource || $[21] !== entity || $[22] !== formContext || $[23] !== snackbarController) {
423
+ if ($[21] !== authController || $[22] !== collection || $[23] !== dataSource || $[24] !== entity || $[25] !== formContext || $[26] !== snackbarController || $[27] !== t) {
384
424
  t6 = function doRevert2(revertVersion) {
385
425
  if (!entity) {
386
426
  throw new Error("No entity to revert");
@@ -414,64 +454,75 @@
414
454
  });
415
455
  setRevertVersionDialog(void 0);
416
456
  snackbarController.open({
417
- message: "Reverted version",
457
+ message: t("entity_history_reverted"),
418
458
  type: "info"
419
459
  });
420
460
  }).catch((error_0) => {
421
461
  console.error("Error reverting entity:", error_0);
422
462
  snackbarController.open({
423
- message: "Error reverting entity",
463
+ message: t("entity_history_error_reverting"),
424
464
  type: "error"
425
465
  });
426
466
  });
427
467
  };
428
- $[18] = authController;
429
- $[19] = collection;
430
- $[20] = dataSource;
431
- $[21] = entity;
432
- $[22] = formContext;
433
- $[23] = snackbarController;
434
- $[24] = 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;
435
476
  } else {
436
- t6 = $[24];
477
+ t6 = $[28];
437
478
  }
438
479
  const doRevert = t6;
439
480
  let t7;
440
- if ($[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
481
+ if ($[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
441
482
  t7 = ui.cls("relative flex-1 h-full overflow-auto w-full flex flex-col gap-4 p-8");
442
- $[25] = t7;
483
+ $[29] = t7;
443
484
  } else {
444
- t7 = $[25];
485
+ t7 = $[29];
445
486
  }
446
487
  let t8;
447
- if ($[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
448
- t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "h5", className: "mt-24 ml-4", children: "History" });
449
- $[26] = t8;
488
+ if ($[30] !== t) {
489
+ t8 = t("history");
490
+ $[30] = t;
491
+ $[31] = t8;
450
492
  } else {
451
- t8 = $[26];
493
+ t8 = $[31];
452
494
  }
453
495
  let t9;
454
- if ($[27] !== revisions.length) {
455
- t9 = revisions.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
456
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "ml-4 mt-8", children: "No history available" }),
457
- /* @__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." })
458
- ] });
459
- $[27] = revisions.length;
460
- $[28] = 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;
461
500
  } else {
462
- t9 = $[28];
501
+ t9 = $[33];
463
502
  }
464
503
  let t10;
465
- if ($[29] !== collection || $[30] !== dirty || $[31] !== revisions || $[32] !== snackbarController) {
466
- let t112;
467
- if ($[34] !== collection || $[35] !== dirty || $[36] !== snackbarController) {
468
- 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) => {
469
520
  const previewKeys = revision.values?.__metadata?.changed_fields;
470
521
  const previousValues = revision.values?.__metadata?.previous_values;
471
- 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: () => {
472
523
  if (dirty) {
473
524
  snackbarController.open({
474
- message: "Please save or discard your changes before reverting",
525
+ message: t("entity_history_please_save"),
475
526
  type: "warning"
476
527
  });
477
528
  } else {
@@ -479,111 +530,128 @@
479
530
  }
480
531
  }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.HistoryIcon, {}) }) }) }) }, index);
481
532
  };
482
- $[34] = collection;
483
- $[35] = dirty;
484
- $[36] = snackbarController;
485
- $[37] = t112;
533
+ $[43] = collection;
534
+ $[44] = dirty;
535
+ $[45] = snackbarController;
536
+ $[46] = t;
537
+ $[47] = t122;
486
538
  } else {
487
- t112 = $[37];
539
+ t122 = $[47];
488
540
  }
489
- t10 = revisions.map(t112);
490
- $[29] = collection;
491
- $[30] = dirty;
492
- $[31] = revisions;
493
- $[32] = snackbarController;
494
- $[33] = t10;
541
+ t11 = revisions.map(t122);
542
+ $[37] = collection;
543
+ $[38] = dirty;
544
+ $[39] = revisions;
545
+ $[40] = snackbarController;
546
+ $[41] = t;
547
+ $[42] = t11;
495
548
  } else {
496
- t10 = $[33];
549
+ t11 = $[42];
497
550
  }
498
- let t11;
499
- if ($[38] !== hasMore || $[39] !== isLoading || $[40] !== revisions.length) {
500
- t11 = revisions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: loadMoreRef, className: "py-4 text-center", children: [
501
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Loading more..." }),
502
- !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") })
503
556
  ] });
504
- $[38] = hasMore;
505
- $[39] = isLoading;
506
- $[40] = revisions.length;
507
- $[41] = t11;
557
+ $[48] = hasMore;
558
+ $[49] = isLoading;
559
+ $[50] = revisions.length;
560
+ $[51] = t;
561
+ $[52] = t12;
508
562
  } else {
509
- t11 = $[41];
563
+ t12 = $[52];
510
564
  }
511
- let t12;
512
- if ($[42] !== t10 || $[43] !== t11 || $[44] !== t9) {
513
- t12 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 max-w-6xl mx-auto w-full", children: [
514
- 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: [
515
568
  t9,
516
569
  t10,
517
- t11
570
+ t11,
571
+ t12
518
572
  ] });
519
- $[42] = t10;
520
- $[43] = t11;
521
- $[44] = t9;
522
- $[45] = t12;
573
+ $[53] = t10;
574
+ $[54] = t11;
575
+ $[55] = t12;
576
+ $[56] = t9;
577
+ $[57] = t13;
523
578
  } else {
524
- t12 = $[45];
579
+ t13 = $[57];
525
580
  }
526
- const t13 = Boolean(revertVersionDialog);
527
- let t14;
528
- if ($[46] !== doRevert || $[47] !== revertVersionDialog) {
529
- t14 = function() {
581
+ const t14 = Boolean(revertVersionDialog);
582
+ let t15;
583
+ if ($[58] !== doRevert || $[59] !== revertVersionDialog) {
584
+ t15 = function() {
530
585
  if (!revertVersionDialog) {
531
586
  return;
532
587
  }
533
588
  doRevert(revertVersionDialog);
534
589
  };
535
- $[46] = doRevert;
536
- $[47] = revertVersionDialog;
537
- $[48] = t14;
590
+ $[58] = doRevert;
591
+ $[59] = revertVersionDialog;
592
+ $[60] = t15;
538
593
  } else {
539
- t14 = $[48];
594
+ t15 = $[60];
540
595
  }
541
- let t15;
542
596
  let t16;
543
- if ($[49] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
544
- t15 = function() {
597
+ if ($[61] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
598
+ t16 = function() {
545
599
  setRevertVersionDialog(void 0);
546
600
  };
547
- t16 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", children: "Revert data to this version?" });
548
- $[49] = t15;
549
- $[50] = t16;
601
+ $[61] = t16;
550
602
  } else {
551
- t15 = $[49];
552
- t16 = $[50];
603
+ t16 = $[61];
553
604
  }
554
605
  let t17;
555
- if ($[51] !== collection || $[52] !== entity?.path || $[53] !== revertVersionDialog) {
556
- t17 = revertVersionDialog ? /* @__PURE__ */ jsxRuntime.jsx(core.EntityView, { entity: revertVersionDialog, collection, path: entity?.path }) : null;
557
- $[51] = collection;
558
- $[52] = entity?.path;
559
- $[53] = revertVersionDialog;
560
- $[54] = t17;
606
+ if ($[62] !== t) {
607
+ t17 = t("entity_history_revert_dialog_title");
608
+ $[62] = t;
609
+ $[63] = t17;
561
610
  } else {
562
- t17 = $[54];
611
+ t17 = $[63];
563
612
  }
564
613
  let t18;
565
- if ($[55] !== t13 || $[56] !== t14 || $[57] !== t17) {
566
- t18 = /* @__PURE__ */ jsxRuntime.jsx(core.ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(core.ConfirmationDialog, { open: t13, onAccept: t14, onCancel: t15, title: t16, body: t17 }) });
567
- $[55] = t13;
568
- $[56] = t14;
569
- $[57] = t17;
570
- $[58] = t18;
614
+ if ($[64] !== t17) {
615
+ t18 = /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", children: t17 });
616
+ $[64] = t17;
617
+ $[65] = t18;
571
618
  } else {
572
- t18 = $[58];
619
+ t18 = $[65];
573
620
  }
574
621
  let t19;
575
- if ($[59] !== t12 || $[60] !== t18) {
576
- t19 = /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: t7, children: [
577
- t12,
578
- 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
579
647
  ] });
580
- $[59] = t12;
581
- $[60] = t18;
582
- $[61] = t19;
648
+ $[75] = t13;
649
+ $[76] = t20;
650
+ $[77] = t21;
583
651
  } else {
584
- t19 = $[61];
652
+ t21 = $[77];
585
653
  }
586
- return t19;
654
+ return t21;
587
655
  }
588
656
  function _temp$1(prev) {
589
657
  return prev + 5;
@@ -675,17 +743,23 @@
675
743
  }
676
744
  return changedFields;
677
745
  }
678
- function getRelativeTimeString(date) {
746
+ function getRelativeTimeString(date, t) {
679
747
  const now = /* @__PURE__ */ new Date();
680
748
  const diffMs = now.getTime() - date.getTime();
681
749
  const diffSeconds = Math.floor(diffMs / 1e3);
682
750
  const diffMinutes = Math.floor(diffSeconds / 60);
683
751
  const diffHours = Math.floor(diffMinutes / 60);
684
752
  const diffDays = Math.floor(diffHours / 24);
685
- if (diffSeconds < 60) return "just now";
686
- if (diffMinutes < 60) return `${diffMinutes}m ago`;
687
- if (diffHours < 24) return `${diffHours}h ago`;
688
- if (diffDays < 30) return `${diffDays}d ago`;
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
+ });
689
763
  return date.toLocaleDateString();
690
764
  }
691
765
  function LastEditedByIndicator(t0) {
@@ -695,6 +769,9 @@
695
769
  entityId,
696
770
  collection
697
771
  } = t0;
772
+ const {
773
+ t
774
+ } = core.useTranslation();
698
775
  const {
699
776
  getUser
700
777
  } = useHistoryController();
@@ -760,7 +837,7 @@
760
837
  }
761
838
  const user = t3;
762
839
  const date = editedOn instanceof Date ? editedOn : editedOn?.toDate ? editedOn.toDate() : null;
763
- const timeString = date ? getRelativeTimeString(date) : null;
840
+ const timeString = date ? getRelativeTimeString(date, t) : null;
764
841
  const displayName = user?.displayName ?? user?.email ?? uid;
765
842
  const photoURL = user?.photoURL;
766
843
  let t4;
@@ -828,6 +905,146 @@
828
905
  }
829
906
  return t1;
830
907
  }
908
+ const entityHistoryTranslationsEn = {
909
+ history: "History",
910
+ entity_history_only_existing: "History is only available for existing entities",
911
+ entity_history_reverted: "Reverted version",
912
+ entity_history_error_reverting: "Error reverting entity",
913
+ entity_history_no_history: "No history available",
914
+ entity_history_when_save: "When you save an entity, a new version is created and stored in the history.",
915
+ entity_history_revert_tooltip: "Revert to this version",
916
+ entity_history_please_save: "Please save or discard your changes before reverting",
917
+ loading_more: "Loading more...",
918
+ entity_history_no_more: "No more history available",
919
+ entity_history_revert_dialog_title: "Revert data to this version?",
920
+ entity_history_previous_value: "Previous value",
921
+ entity_history_see_details: "See details for this revision",
922
+ entity_history_just_now: "just now",
923
+ entity_history_minutes_ago: "{{minutes}}m ago",
924
+ entity_history_hours_ago: "{{hours}}h ago",
925
+ entity_history_days_ago: "{{days}}d ago",
926
+ user_picture: "User picture"
927
+ };
928
+ const entityHistoryTranslationsEs = {
929
+ history: "Historial",
930
+ entity_history_only_existing: "El historial solo está disponible para entidades existentes",
931
+ entity_history_reverted: "Versión revertida",
932
+ entity_history_error_reverting: "Error al revertir la entidad",
933
+ entity_history_no_history: "No hay historial disponible",
934
+ entity_history_when_save: "Cuando guardas una entidad, se crea una nueva versión y se almacena en el historial.",
935
+ entity_history_revert_tooltip: "Revertir a esta versión",
936
+ entity_history_please_save: "Por favor, guarda o descarta tus cambios antes de revertir",
937
+ loading_more: "Cargando más...",
938
+ entity_history_no_more: "No hay más historial disponible",
939
+ entity_history_revert_dialog_title: "¿Revertir datos a esta versión?",
940
+ entity_history_previous_value: "Valor anterior",
941
+ entity_history_see_details: "Ver detalles de esta revisión",
942
+ entity_history_just_now: "justo ahora",
943
+ entity_history_minutes_ago: "hace {{minutes}}m",
944
+ entity_history_hours_ago: "hace {{hours}}h",
945
+ entity_history_days_ago: "hace {{days}}d",
946
+ user_picture: "Foto de usuario"
947
+ };
948
+ const entityHistoryTranslationsDe = {
949
+ history: "Verlauf",
950
+ entity_history_only_existing: "Verlauf ist nur für vorhandene Entitäten verfügbar",
951
+ entity_history_reverted: "Wiederhergestellte Version",
952
+ entity_history_error_reverting: "Fehler beim Wiederherstellen der Entität",
953
+ entity_history_no_history: "Kein Verlauf verfügbar",
954
+ entity_history_when_save: "Wenn Sie eine Entität speichern, wird eine neue Version erstellt und im Verlauf gespeichert.",
955
+ entity_history_revert_tooltip: "Zu dieser Version zurückkehren",
956
+ entity_history_please_save: "Bitte speichern oder verwerfen Sie Ihre Änderungen vor der Wiederherstellung",
957
+ loading_more: "Mehr laden...",
958
+ entity_history_no_more: "Kein weiterer Verlauf verfügbar",
959
+ entity_history_revert_dialog_title: "Daten auf diese Version zurücksetzen?",
960
+ entity_history_previous_value: "Vorheriger Wert",
961
+ entity_history_see_details: "Details zu dieser Überarbeitung anzeigen",
962
+ entity_history_just_now: "gerade eben",
963
+ entity_history_minutes_ago: "vor {{minutes}}m",
964
+ entity_history_hours_ago: "vor {{hours}}h",
965
+ entity_history_days_ago: "vor {{days}}d",
966
+ user_picture: "Benutzerbild"
967
+ };
968
+ const entityHistoryTranslationsFr = {
969
+ history: "Historique",
970
+ entity_history_only_existing: "L'historique n'est disponible que pour les entités existantes",
971
+ entity_history_reverted: "Version restaurée",
972
+ entity_history_error_reverting: "Erreur lors de la restauration de l'entité",
973
+ entity_history_no_history: "Aucun historique disponible",
974
+ entity_history_when_save: "Lorsque vous enregistrez une entité, une nouvelle version est créée et stockée dans l'historique.",
975
+ entity_history_revert_tooltip: "Revenir à cette version",
976
+ entity_history_please_save: "Veuillez enregistrer ou annuler vos modifications avant de restaurer",
977
+ loading_more: "Chargement en cours...",
978
+ entity_history_no_more: "Aucun autre historique disponible",
979
+ entity_history_revert_dialog_title: "Restaurer les données à cette version ?",
980
+ entity_history_previous_value: "Valeur précédente",
981
+ entity_history_see_details: "Voir les détails de cette révision",
982
+ entity_history_just_now: "à l'instant",
983
+ entity_history_minutes_ago: "il y a {{minutes}}m",
984
+ entity_history_hours_ago: "il y a {{hours}}h",
985
+ entity_history_days_ago: "il y a {{days}}j",
986
+ user_picture: "Photo de l'utilisateur"
987
+ };
988
+ const entityHistoryTranslationsIt = {
989
+ history: "Cronologia",
990
+ entity_history_only_existing: "La cronologia è disponibile solo per le entità esistenti",
991
+ entity_history_reverted: "Versione ripristinata",
992
+ entity_history_error_reverting: "Errore durante il ripristino dell'entità",
993
+ entity_history_no_history: "Nessuna cronologia disponibile",
994
+ entity_history_when_save: "Quando salvi un'entità, viene creata una nuova versione e memorizzata nella cronologia.",
995
+ entity_history_revert_tooltip: "Ripristina a questa versione",
996
+ entity_history_please_save: "Salva o annulla le modifiche prima del ripristino",
997
+ loading_more: "Caricamento in corso...",
998
+ entity_history_no_more: "Nessuna ulteriore cronologia disponibile",
999
+ entity_history_revert_dialog_title: "Vuoi ripristinare i dati a questa versione?",
1000
+ entity_history_previous_value: "Valore precedente",
1001
+ entity_history_see_details: "Vedi i dettagli per questa revisione",
1002
+ entity_history_just_now: "proprio adesso",
1003
+ entity_history_minutes_ago: "{{minutes}} min fa",
1004
+ entity_history_hours_ago: "{{hours}} h fa",
1005
+ entity_history_days_ago: "{{days}} g fa",
1006
+ user_picture: "Immagine utente"
1007
+ };
1008
+ const entityHistoryTranslationsHi = {
1009
+ history: "इतिहास",
1010
+ entity_history_only_existing: "इतिहास केवल मौजूद संस्थाओं के लिए उपलब्ध है",
1011
+ entity_history_reverted: "परिवर्तित संस्करण",
1012
+ entity_history_error_reverting: "संस्था को वापस लाने में त्रुटि",
1013
+ entity_history_no_history: "कोई इतिहास उपलब्ध नहीं",
1014
+ entity_history_when_save: "जब आप किसी संस्था को सहेजते हैं, तो एक नया संस्करण बनाया जाता है और इतिहास में संग्रहीत किया जाता है।",
1015
+ entity_history_revert_tooltip: "इस संस्करण पर वापस जाएं",
1016
+ entity_history_please_save: "कृपया वापस जाने से पहले अपने परिवर्तनों को सहेजें या हटा दें",
1017
+ loading_more: "और लोड हो रहा है...",
1018
+ entity_history_no_more: "कोई और इतिहास उपलब्ध नहीं",
1019
+ entity_history_revert_dialog_title: "डेटा को इस संस्करण में वापस लाएँ?",
1020
+ entity_history_previous_value: "पिछला मान",
1021
+ entity_history_see_details: "इस संशोधन के लिए विवरण यहाँ देखें",
1022
+ entity_history_just_now: "अभी-अभी",
1023
+ entity_history_minutes_ago: "{{minutes}}m पहले",
1024
+ entity_history_hours_ago: "{{hours}}h पहले",
1025
+ entity_history_days_ago: "{{days}}d पहले",
1026
+ user_picture: "उपयोगकर्ता चित्र"
1027
+ };
1028
+ const entityHistoryTranslationsPt = {
1029
+ history: "Histórico",
1030
+ entity_history_only_existing: "O histórico está disponível apenas para entidades existentes",
1031
+ entity_history_reverted: "Versão revertida",
1032
+ entity_history_error_reverting: "Erro ao reverter entidade",
1033
+ entity_history_no_history: "Sem histórico disponível",
1034
+ entity_history_when_save: "Quando guarda uma entidade, é criada uma nova versão e armazenada no histórico.",
1035
+ entity_history_revert_tooltip: "Reverter para esta versão",
1036
+ entity_history_please_save: "Por favor guarde ou descarte as suas alterações antes de reverter",
1037
+ loading_more: "A carregar mais...",
1038
+ entity_history_no_more: "Sem mais histórico disponível",
1039
+ entity_history_revert_dialog_title: "Reverter dados para esta versão?",
1040
+ entity_history_previous_value: "Valor anterior",
1041
+ entity_history_see_details: "Ver detalhes desta revisão",
1042
+ entity_history_just_now: "agora mesmo",
1043
+ entity_history_minutes_ago: "há {{minutes}}m",
1044
+ entity_history_hours_ago: "há {{hours}}h",
1045
+ entity_history_days_ago: "há {{days}}d",
1046
+ user_picture: "Foto do utilizador"
1047
+ };
831
1048
  function useEntityHistoryPlugin(props) {
832
1049
  const {
833
1050
  defaultEnabled = false
@@ -862,6 +1079,15 @@
862
1079
  },
863
1080
  collection: {
864
1081
  modifyCollection
1082
+ },
1083
+ i18n: {
1084
+ en: entityHistoryTranslationsEn,
1085
+ es: entityHistoryTranslationsEs,
1086
+ de: entityHistoryTranslationsDe,
1087
+ fr: entityHistoryTranslationsFr,
1088
+ it: entityHistoryTranslationsIt,
1089
+ hi: entityHistoryTranslationsHi,
1090
+ pt: entityHistoryTranslationsPt
865
1091
  }
866
1092
  }), [props]);
867
1093
  }