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