@rebasepro/admin 0.9.1-canary.16c42e9 → 0.9.1-canary.26fe4b2

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.
Files changed (92) hide show
  1. package/dist/{CollectionEditorDialog-DbPpDDwb.js → CollectionEditorDialog-BOlKGGg7.js} +123 -31
  2. package/dist/{CollectionEditorDialog-DbPpDDwb.js.map → CollectionEditorDialog-BOlKGGg7.js.map} +1 -1
  3. package/dist/{PropertyEditView-DfJbZ67t.js → PropertyEditView-i51tFOfM.js} +3 -3
  4. package/dist/PropertyEditView-i51tFOfM.js.map +1 -0
  5. package/dist/{RouterCollectionsStudioView-C6XQ7Il5.js → RouterCollectionsStudioView-Dh4W53PU.js} +4 -4
  6. package/dist/{RouterCollectionsStudioView-C6XQ7Il5.js.map → RouterCollectionsStudioView-Dh4W53PU.js.map} +1 -1
  7. package/dist/collection_editor_ui.js +4 -4
  8. package/dist/components/field_configs.d.ts +17 -0
  9. package/dist/contexts/BreacrumbsContext.d.ts +1 -1
  10. package/dist/editor.js.map +1 -1
  11. package/dist/export-BM6HPujv.js +518 -0
  12. package/dist/export-BM6HPujv.js.map +1 -0
  13. package/dist/{history-GSa4BgDt.js → history-CtIPJxvQ.js} +3 -3
  14. package/dist/history-CtIPJxvQ.js.map +1 -0
  15. package/dist/hooks/useSelectionDialog.d.ts +1 -1
  16. package/dist/import-DzQnT03v.js +328 -0
  17. package/dist/import-DzQnT03v.js.map +1 -0
  18. package/dist/index.js +3299 -1
  19. package/dist/index.js.map +1 -0
  20. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  21. package/dist/preview/util.d.ts +1 -0
  22. package/dist/util/view_mode.d.ts +54 -0
  23. package/dist/{src-B8WuGSPZ.js → util-XFwQ9FEc.js} +17388 -21329
  24. package/dist/util-XFwQ9FEc.js.map +1 -0
  25. package/package.json +8 -8
  26. package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +104 -9
  27. package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +1 -1
  28. package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +1 -1
  29. package/src/components/CollectionTableBinding/CollectionRowActions.tsx +1 -1
  30. package/src/components/CollectionTableBinding/fields/TableReferenceField.tsx +1 -1
  31. package/src/components/CollectionViewBinding/CollectionBoardViewBinding.tsx +1 -1
  32. package/src/components/CollectionViewBinding/CollectionViewActions.tsx +1 -1
  33. package/src/components/CollectionViewBinding/CollectionViewBinding.tsx +76 -126
  34. package/src/components/CollectionViewBinding/CollectionViewStartActions.tsx +4 -8
  35. package/src/components/CollectionViewBinding/SplitListView.tsx +114 -63
  36. package/src/components/DetailViewBinding.tsx +4 -2
  37. package/src/components/EditFormActions.tsx +2 -2
  38. package/src/components/EditViewBinding.tsx +3 -2
  39. package/src/components/EntityPreviewBinding.tsx +2 -1
  40. package/src/components/HomePage/ContentHomePage.tsx +2 -1
  41. package/src/components/HomePage/FavouritesView.tsx +1 -1
  42. package/src/components/RebaseRouteDefs.tsx +1 -1
  43. package/src/components/ReferenceTable/SelectionTableBinding.tsx +2 -1
  44. package/src/components/ReferenceWidget.tsx +1 -1
  45. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +1 -1
  46. package/src/components/SidePanelBinding.tsx +46 -8
  47. package/src/components/SidePanelProvider.tsx +14 -11
  48. package/src/components/field_configs.tsx +41 -24
  49. package/src/components/history/EntityHistoryView.tsx +1 -1
  50. package/src/contexts/BreacrumbsContext.tsx +1 -1
  51. package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +2 -4
  52. package/src/data_import/import/ImportCollectionAction.tsx +6 -6
  53. package/src/editor/selectors/color-selector.tsx +1 -1
  54. package/src/editor/selectors/node-selector.tsx +1 -1
  55. package/src/editor/selectors/text-buttons.tsx +1 -1
  56. package/src/form/EntityForm.tsx +4 -1
  57. package/src/form/EntityFormBinding.tsx +3 -1
  58. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +2 -1
  59. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +3 -2
  60. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -1
  61. package/src/form/field_bindings/DateTimeFieldBinding.tsx +2 -1
  62. package/src/form/field_bindings/KeyValueFieldBinding.tsx +2 -1
  63. package/src/form/field_bindings/MapFieldBinding.tsx +2 -1
  64. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +2 -1
  65. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +2 -1
  66. package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +2 -1
  67. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -1
  68. package/src/form/field_bindings/ReferenceFieldBinding.tsx +3 -2
  69. package/src/form/field_bindings/RelationFieldBinding.tsx +2 -1
  70. package/src/form/field_bindings/RepeatFieldBinding.tsx +2 -1
  71. package/src/form/field_bindings/SelectFieldBinding.tsx +2 -1
  72. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +2 -1
  73. package/src/form/field_bindings/SwitchFieldBinding.tsx +2 -1
  74. package/src/form/field_bindings/TextFieldBinding.tsx +2 -1
  75. package/src/form/field_bindings/UserSelectFieldBinding.tsx +2 -1
  76. package/src/form/field_bindings/VectorFieldBinding.tsx +2 -1
  77. package/src/hooks/useBuildSidePanel.tsx +8 -0
  78. package/src/hooks/useSelectionDialog.tsx +3 -3
  79. package/src/preview/components/ImagePreview.tsx +1 -1
  80. package/src/preview/components/ReferencePreview.tsx +1 -1
  81. package/src/preview/components/RelationPreview.tsx +2 -2
  82. package/src/preview/components/UrlComponentPreview.tsx +2 -9
  83. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -1
  84. package/src/preview/property_previews/NumberPropertyPreview.tsx +1 -1
  85. package/src/preview/util.ts +9 -0
  86. package/src/routes/CustomViewRoute.tsx +2 -1
  87. package/src/routes/RebaseRoute.tsx +20 -25
  88. package/src/util/navigation_utils.ts +2 -5
  89. package/src/util/view_mode.ts +102 -0
  90. package/dist/PropertyEditView-DfJbZ67t.js.map +0 -1
  91. package/dist/history-GSa4BgDt.js.map +0 -1
  92. package/dist/src-B8WuGSPZ.js.map +0 -1
@@ -0,0 +1,518 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
+ import { tn as useCMSContext } from "./util-XFwQ9FEc.js";
3
+ import React, { useCallback } from "react";
4
+ import { Alert, BooleanSwitchWithLabel, Button, CircularProgress, Dialog, DialogActions, DialogContent, DialogTitle, DownloadIcon, IconButton, Label, RadioGroup, RadioGroupItem, Tooltip, iconSize } from "@rebasepro/ui";
5
+ import { getDefaultValuesFor } from "@rebasepro/common";
6
+ import { useData, useTranslation } from "@rebasepro/app";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { getArrayValuesCount, getValueInPath } from "@rebasepro/utils";
9
+ //#region src/data_export/export/export.ts
10
+ function downloadEntitiesExport({ data, additionalData, properties, propertiesOrder, name, flattenArrays, additionalHeaders, exportType, dateExportType }) {
11
+ console.debug("Downloading export", {
12
+ dataLength: data.length,
13
+ properties,
14
+ exportType,
15
+ dateExportType
16
+ });
17
+ if (exportType === "csv") {
18
+ const headers = getExportHeaders(properties, propertiesOrder, additionalHeaders, flattenArrays ? getArrayValuesCount(data.map((d) => d.values)) : {});
19
+ const exportableData = getEntityCSVExportableData(data, additionalData, properties, headers, dateExportType);
20
+ downloadBlob([entryToCSVRow(headers.map((h) => h.label)), ...exportableData.map((entry) => entryToCSVRow(entry))], `${name}.csv`, "text/csv");
21
+ } else {
22
+ const exportableData = getEntityJsonExportableData(data, additionalData, properties, dateExportType);
23
+ downloadBlob([JSON.stringify(exportableData, null, 2)], `${name}.json`, "application/json");
24
+ }
25
+ }
26
+ function getEntityCSVExportableData(data, additionalData, properties, headers, dateExportType) {
27
+ const mergedData = data.map((e) => ({
28
+ id: e.id,
29
+ ...processValuesForExport(e.values, properties, "csv", dateExportType)
30
+ }));
31
+ if (additionalData) additionalData.forEach((additional, index) => {
32
+ mergedData[index] = {
33
+ ...mergedData[index],
34
+ ...additional
35
+ };
36
+ });
37
+ return mergedData && mergedData.map((entry) => {
38
+ return headers.map((header) => getValueInPath(entry, header.key));
39
+ });
40
+ }
41
+ function getEntityJsonExportableData(data, additionalData, properties, dateExportType) {
42
+ const mergedData = data.map((e) => ({
43
+ id: e.id,
44
+ ...processValuesForExport(e.values, properties, "json", dateExportType)
45
+ }));
46
+ if (additionalData) additionalData.forEach((additional, index) => {
47
+ mergedData[index] = {
48
+ ...mergedData[index],
49
+ ...additional
50
+ };
51
+ });
52
+ return mergedData;
53
+ }
54
+ function getExportHeaders(properties, propertiesOrder, additionalHeaders, arrayValuesCount) {
55
+ const headers = [{
56
+ label: "id",
57
+ key: "id"
58
+ }, ...(propertiesOrder ?? Object.keys(properties)).flatMap((childKey) => {
59
+ const property = properties[childKey];
60
+ if (!property) {
61
+ console.warn("Property not found", childKey, properties);
62
+ return [];
63
+ }
64
+ if (arrayValuesCount && arrayValuesCount[childKey] > 1) return Array.from({ length: arrayValuesCount[childKey] }, (_, i) => getHeaders(property, `${childKey}[${i}]`, "")).flat();
65
+ else return getHeaders(property, childKey, "");
66
+ })];
67
+ if (additionalHeaders) headers.push(...additionalHeaders.map((h) => ({
68
+ label: h,
69
+ key: h
70
+ })));
71
+ return headers;
72
+ }
73
+ /**
74
+ * Get headers for property. There could be more than one header per property
75
+ * @param property
76
+ * @param propertyKey
77
+ * @param prefix
78
+ */
79
+ function getHeaders(property, propertyKey, prefix = "") {
80
+ const currentKey = prefix ? `${prefix}.${propertyKey}` : propertyKey;
81
+ if (property.type === "map" && property.properties) return Object.entries(property.properties).map(([childKey, p]) => getHeaders(p, childKey, currentKey)).flat();
82
+ else return [{
83
+ label: currentKey,
84
+ key: currentKey
85
+ }];
86
+ }
87
+ function processValueForExport(inputValue, property, exportType, dateExportType) {
88
+ let value;
89
+ if (property.type === "map" && property.properties) value = processValuesForExport(inputValue, property.properties, exportType, dateExportType);
90
+ else if (property.type === "array") if (property.of && Array.isArray(inputValue)) if (Array.isArray(property.of)) value = property.of.map((p, i) => processValueForExport(inputValue[i], p, exportType, dateExportType));
91
+ else if (property.of.type === "map") value = exportType === "csv" ? inputValue.map((e) => JSON.stringify(e)) : inputValue.map((e) => processValueForExport(e, property.of, exportType, dateExportType));
92
+ else value = inputValue.map((e) => processValueForExport(e, property.of, exportType, dateExportType));
93
+ else value = inputValue;
94
+ else if (property.type === "reference" && inputValue && typeof inputValue === "object" && "isEntityReference" in inputValue && typeof inputValue.isEntityReference === "function" && inputValue.isEntityReference()) {
95
+ const ref = inputValue ? inputValue : void 0;
96
+ value = ref ? ref.fullPath : null;
97
+ } else if (property.type === "date" && inputValue instanceof Date) value = inputValue ? dateExportType === "timestamp" ? inputValue.getTime() : inputValue.toISOString() : null;
98
+ else value = inputValue;
99
+ return value;
100
+ }
101
+ function processValuesForExport(inputValues, properties, exportType, dateExportType) {
102
+ const updatedValues = Object.entries(properties).map(([key, property]) => {
103
+ const updatedValue = processValueForExport(inputValues && inputValues[key], property, exportType, dateExportType);
104
+ if (updatedValue === void 0) return {};
105
+ return { [key]: updatedValue };
106
+ }).reduce((a, b) => ({
107
+ ...a,
108
+ ...b
109
+ }), {});
110
+ return {
111
+ ...inputValues,
112
+ ...updatedValues
113
+ };
114
+ }
115
+ function entryToCSVRow(entry) {
116
+ return entry.map((v) => {
117
+ if (v === null || v === void 0) return "";
118
+ if (Array.isArray(v)) return "\"" + JSON.stringify(v).replaceAll("\"", "\"\"") + "\"";
119
+ return "\"" + String(v).replaceAll("\"", "\"\"") + "\"";
120
+ }).join(",") + "\r\n";
121
+ }
122
+ function downloadBlob(content, filename, contentType) {
123
+ const blob = new Blob(content, { type: contentType });
124
+ const url = URL.createObjectURL(blob);
125
+ const pom = document.createElement("a");
126
+ pom.href = url;
127
+ pom.setAttribute("download", filename);
128
+ pom.click();
129
+ }
130
+ function downloadDataAsCsv(data, name) {
131
+ if (data.length === 0) return;
132
+ const headers = Object.keys(data[0]);
133
+ downloadBlob([[headers.join(","), ...data.map((row) => headers.map((header) => {
134
+ const value = row[header];
135
+ if (value === null || value === void 0) return "";
136
+ if (Array.isArray(value)) return `"${JSON.stringify(value).replace(/"/g, "\"\"")}"`;
137
+ return `"${String(value).replace(/"/g, "\"\"")}"`;
138
+ }).join(","))].join("\r\n")], `${name}.csv`, "text/csv");
139
+ }
140
+ //#endregion
141
+ //#region src/data_export/export/BasicExportAction.tsx
142
+ function BasicExportAction({ data, properties, propertiesOrder }) {
143
+ const { t } = useTranslation();
144
+ const dateRef = React.useRef(/* @__PURE__ */ new Date());
145
+ const [flattenArrays, setFlattenArrays] = React.useState(true);
146
+ const [exportType, setExportType] = React.useState("csv");
147
+ const [dateExportType, setDateExportType] = React.useState("string");
148
+ const [open, setOpen] = React.useState(false);
149
+ const handleClickOpen = useCallback(() => {
150
+ setOpen(true);
151
+ }, [setOpen]);
152
+ const handleClose = useCallback(() => {
153
+ setOpen(false);
154
+ }, [setOpen]);
155
+ const onOkClicked = useCallback(() => {
156
+ downloadEntitiesExport({
157
+ data,
158
+ additionalData: [],
159
+ properties,
160
+ propertiesOrder,
161
+ name: "export.csv",
162
+ flattenArrays,
163
+ additionalHeaders: [],
164
+ exportType,
165
+ dateExportType
166
+ });
167
+ handleClose();
168
+ }, []);
169
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
170
+ title: "Export",
171
+ asChild: true,
172
+ children: /* @__PURE__ */ jsx(IconButton, {
173
+ size: "small",
174
+ color: "primary",
175
+ onClick: handleClickOpen,
176
+ children: /* @__PURE__ */ jsx(DownloadIcon, { size: "small" })
177
+ })
178
+ }), /* @__PURE__ */ jsxs(Dialog, {
179
+ open,
180
+ onOpenChange: setOpen,
181
+ maxWidth: "xl",
182
+ children: [
183
+ /* @__PURE__ */ jsx(DialogTitle, {
184
+ variant: "h6",
185
+ children: t("export_data")
186
+ }),
187
+ /* @__PURE__ */ jsxs(DialogContent, {
188
+ className: "flex flex-col gap-4 my-4",
189
+ children: [
190
+ /* @__PURE__ */ jsx("div", { children: t("download_table_csv") }),
191
+ /* @__PURE__ */ jsxs("div", {
192
+ className: "flex flex-row gap-4",
193
+ children: [/* @__PURE__ */ jsx("div", {
194
+ className: "p-4 flex flex-col",
195
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
196
+ value: exportType,
197
+ onValueChange: (v) => setExportType(v),
198
+ children: [/* @__PURE__ */ jsxs("div", {
199
+ className: "flex items-center gap-2",
200
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
201
+ value: "csv",
202
+ id: "radio-csv"
203
+ }), /* @__PURE__ */ jsx(Label, {
204
+ htmlFor: "radio-csv",
205
+ children: t("csv")
206
+ })]
207
+ }), /* @__PURE__ */ jsxs("div", {
208
+ className: "flex items-center gap-2",
209
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
210
+ value: "json",
211
+ id: "radio-json"
212
+ }), /* @__PURE__ */ jsx(Label, {
213
+ htmlFor: "radio-json",
214
+ children: t("json")
215
+ })]
216
+ })]
217
+ })
218
+ }), /* @__PURE__ */ jsx("div", {
219
+ className: "p-4 flex flex-col",
220
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
221
+ value: dateExportType,
222
+ onValueChange: (v) => setDateExportType(v),
223
+ children: [/* @__PURE__ */ jsxs("div", {
224
+ className: "flex items-center gap-2",
225
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
226
+ value: "timestamp",
227
+ id: "radio-timestamp"
228
+ }), /* @__PURE__ */ jsxs(Label, {
229
+ htmlFor: "radio-timestamp",
230
+ children: [
231
+ t("dates_as_timestamps"),
232
+ " (",
233
+ dateRef.current.getTime(),
234
+ ")"
235
+ ]
236
+ })]
237
+ }), /* @__PURE__ */ jsxs("div", {
238
+ className: "flex items-center gap-2",
239
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
240
+ value: "string",
241
+ id: "radio-string"
242
+ }), /* @__PURE__ */ jsxs(Label, {
243
+ htmlFor: "radio-string",
244
+ children: [
245
+ t("dates_as_strings"),
246
+ " (",
247
+ dateRef.current.toISOString(),
248
+ ")"
249
+ ]
250
+ })]
251
+ })]
252
+ })
253
+ })]
254
+ }),
255
+ /* @__PURE__ */ jsx(BooleanSwitchWithLabel, {
256
+ size: "small",
257
+ disabled: exportType !== "csv",
258
+ value: flattenArrays,
259
+ onValueChange: setFlattenArrays,
260
+ label: t("flatten_arrays")
261
+ })
262
+ ]
263
+ }),
264
+ /* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
265
+ onClick: handleClose,
266
+ variant: "text",
267
+ children: t("cancel")
268
+ }), /* @__PURE__ */ jsx(Button, {
269
+ onClick: onOkClicked,
270
+ children: t("download")
271
+ })] })
272
+ ]
273
+ })] });
274
+ }
275
+ //#endregion
276
+ //#region src/data_export/export/ExportCollectionAction.tsx
277
+ var DOCS_LIMIT = 500;
278
+ function ExportCollectionAction({ collection, path, collectionEntitiesCount, onAnalyticsEvent, exportAllowed, notAllowedView }) {
279
+ const { t } = useTranslation();
280
+ const exportConfig = typeof collection.exportable === "object" ? collection.exportable : void 0;
281
+ const dateRef = React.useRef(/* @__PURE__ */ new Date());
282
+ const [includeUndefinedValues, setIncludeUndefinedValues] = React.useState(false);
283
+ const [flattenArrays, setFlattenArrays] = React.useState(true);
284
+ const [exportType, setExportType] = React.useState("csv");
285
+ const [dateExportType, setDateExportType] = React.useState("string");
286
+ const context = useCMSContext();
287
+ const dataClient = useData();
288
+ const canExport = !exportAllowed || exportAllowed({
289
+ collectionEntitiesCount: collectionEntitiesCount ?? 0,
290
+ path,
291
+ collection
292
+ });
293
+ const [dataLoading, setDataLoading] = React.useState(false);
294
+ const [dataLoadingError, setDataLoadingError] = React.useState();
295
+ const [open, setOpen] = React.useState(false);
296
+ const handleClickOpen = useCallback(() => {
297
+ setOpen(true);
298
+ }, [setOpen]);
299
+ const handleClose = useCallback(() => {
300
+ setOpen(false);
301
+ }, [setOpen]);
302
+ const fetchAdditionalFields = useCallback(async (entities) => {
303
+ const additionalExportFields = exportConfig?.additionalFields;
304
+ const additionalFields = collection.additionalFields;
305
+ const resolvedExportColumnsValues = additionalExportFields ? await Promise.all(entities.map(async (entity) => {
306
+ return (await Promise.all(additionalExportFields.map(async (column) => {
307
+ return { [column.key]: await column.builder({
308
+ entity,
309
+ context
310
+ }) };
311
+ }))).reduce((a, b) => ({
312
+ ...a,
313
+ ...b
314
+ }), {});
315
+ })) : [];
316
+ const resolvedColumnsValues = additionalFields ? await Promise.all(entities.map(async (entity) => {
317
+ return (await Promise.all(additionalFields.map(async (field) => {
318
+ if (!field.value) return {};
319
+ return { [field.key]: await field.value({
320
+ entity,
321
+ context
322
+ }) };
323
+ }))).reduce((a, b) => ({
324
+ ...a,
325
+ ...b
326
+ }), {});
327
+ })) : [];
328
+ return [...resolvedExportColumnsValues, ...resolvedColumnsValues];
329
+ }, [exportConfig?.additionalFields]);
330
+ const doDownload = useCallback(async (collection, exportConfig) => {
331
+ onAnalyticsEvent?.("export_collection", { collection: collection.slug });
332
+ setDataLoading(true);
333
+ dataClient.collection(path).find({}).then(async (res) => {
334
+ const data = res.data;
335
+ setDataLoadingError(void 0);
336
+ const additionalData = await fetchAdditionalFields(data);
337
+ const additionalHeaders = [...exportConfig?.additionalFields?.map((column) => column.key) ?? [], ...collection.additionalFields?.map((field) => field.key) ?? []];
338
+ downloadEntitiesExport({
339
+ data: includeUndefinedValues ? data.map((entity) => {
340
+ const defaultValues = getDefaultValuesFor(collection.properties);
341
+ return {
342
+ ...entity,
343
+ values: {
344
+ ...defaultValues,
345
+ ...entity.values
346
+ }
347
+ };
348
+ }) : data,
349
+ additionalData,
350
+ properties: collection.properties,
351
+ propertiesOrder: collection.propertiesOrder,
352
+ name: collection.name,
353
+ flattenArrays,
354
+ additionalHeaders,
355
+ exportType,
356
+ dateExportType
357
+ });
358
+ onAnalyticsEvent?.("export_collection_success", { collection: collection.slug });
359
+ }).catch((e) => {
360
+ console.error("Error loading export data", e);
361
+ setDataLoadingError(e);
362
+ }).finally(() => setDataLoading(false));
363
+ }, [
364
+ onAnalyticsEvent,
365
+ dataClient,
366
+ path,
367
+ fetchAdditionalFields,
368
+ includeUndefinedValues,
369
+ flattenArrays,
370
+ exportType,
371
+ dateExportType
372
+ ]);
373
+ const onOkClicked = useCallback(() => {
374
+ doDownload(collection, exportConfig);
375
+ handleClose();
376
+ }, [
377
+ doDownload,
378
+ collection,
379
+ exportConfig,
380
+ handleClose
381
+ ]);
382
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
383
+ title: "Export",
384
+ asChild: true,
385
+ children: /* @__PURE__ */ jsx(IconButton, {
386
+ size: "small",
387
+ color: "primary",
388
+ onClick: handleClickOpen,
389
+ children: /* @__PURE__ */ jsx(DownloadIcon, { size: iconSize.small })
390
+ })
391
+ }), /* @__PURE__ */ jsxs(Dialog, {
392
+ open,
393
+ onOpenChange: setOpen,
394
+ maxWidth: "xl",
395
+ children: [
396
+ /* @__PURE__ */ jsx(DialogTitle, {
397
+ variant: "h6",
398
+ children: t("export_data")
399
+ }),
400
+ /* @__PURE__ */ jsxs(DialogContent, {
401
+ className: "flex flex-col gap-4 my-4",
402
+ children: [
403
+ /* @__PURE__ */ jsx("div", { children: t("download_table_csv") }),
404
+ collectionEntitiesCount !== void 0 && collectionEntitiesCount > DOCS_LIMIT && /* @__PURE__ */ jsx(Alert, {
405
+ color: "warning",
406
+ children: /* @__PURE__ */ jsx("div", { children: t("large_number_of_documents", { count: collectionEntitiesCount.toString() }) })
407
+ }),
408
+ /* @__PURE__ */ jsxs("div", {
409
+ className: "flex flex-row gap-4",
410
+ children: [/* @__PURE__ */ jsx("div", {
411
+ className: "p-4 flex flex-col",
412
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
413
+ value: exportType,
414
+ onValueChange: (v) => setExportType(v),
415
+ children: [/* @__PURE__ */ jsxs("div", {
416
+ className: "flex items-center gap-2",
417
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
418
+ value: "csv",
419
+ id: "radio-csv"
420
+ }), /* @__PURE__ */ jsx(Label, {
421
+ htmlFor: "radio-csv",
422
+ children: t("csv")
423
+ })]
424
+ }), /* @__PURE__ */ jsxs("div", {
425
+ className: "flex items-center gap-2",
426
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
427
+ value: "json",
428
+ id: "radio-json"
429
+ }), /* @__PURE__ */ jsx(Label, {
430
+ htmlFor: "radio-json",
431
+ children: t("json")
432
+ })]
433
+ })]
434
+ })
435
+ }), /* @__PURE__ */ jsx("div", {
436
+ className: "p-4 flex flex-col",
437
+ children: /* @__PURE__ */ jsxs(RadioGroup, {
438
+ value: dateExportType,
439
+ onValueChange: (v) => setDateExportType(v),
440
+ children: [/* @__PURE__ */ jsxs("div", {
441
+ className: "flex items-center gap-2",
442
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
443
+ value: "timestamp",
444
+ id: "radio-timestamp"
445
+ }), /* @__PURE__ */ jsxs(Label, {
446
+ htmlFor: "radio-timestamp",
447
+ children: [
448
+ t("dates_as_timestamps"),
449
+ " (",
450
+ dateRef.current.getTime(),
451
+ ")"
452
+ ]
453
+ })]
454
+ }), /* @__PURE__ */ jsxs("div", {
455
+ className: "flex items-center gap-2",
456
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
457
+ value: "string",
458
+ id: "radio-string"
459
+ }), /* @__PURE__ */ jsxs(Label, {
460
+ htmlFor: "radio-string",
461
+ children: [
462
+ t("dates_as_strings"),
463
+ " (",
464
+ dateRef.current.toISOString(),
465
+ ")"
466
+ ]
467
+ })]
468
+ })]
469
+ })
470
+ })]
471
+ }),
472
+ /* @__PURE__ */ jsx(BooleanSwitchWithLabel, {
473
+ size: "small",
474
+ disabled: exportType !== "csv",
475
+ value: flattenArrays,
476
+ onValueChange: setFlattenArrays,
477
+ label: t("flatten_arrays")
478
+ }),
479
+ /* @__PURE__ */ jsx(BooleanSwitchWithLabel, {
480
+ size: "small",
481
+ value: includeUndefinedValues,
482
+ onValueChange: setIncludeUndefinedValues,
483
+ label: t("include_undefined_values")
484
+ }),
485
+ !canExport && notAllowedView
486
+ ]
487
+ }),
488
+ /* @__PURE__ */ jsxs(DialogActions, { children: [
489
+ dataLoading && /* @__PURE__ */ jsx(CircularProgress, { size: "smallest" }),
490
+ /* @__PURE__ */ jsx(Button, {
491
+ onClick: handleClose,
492
+ variant: "text",
493
+ children: t("cancel")
494
+ }),
495
+ /* @__PURE__ */ jsx(Button, {
496
+ onClick: onOkClicked,
497
+ disabled: dataLoading || !canExport,
498
+ children: t("download")
499
+ })
500
+ ] })
501
+ ]
502
+ })] });
503
+ }
504
+ //#endregion
505
+ //#region src/data_export/export/index.ts
506
+ var export_exports = /* @__PURE__ */ __exportAll({
507
+ BasicExportAction: () => BasicExportAction,
508
+ ExportCollectionAction: () => ExportCollectionAction,
509
+ downloadBlob: () => downloadBlob,
510
+ downloadDataAsCsv: () => downloadDataAsCsv,
511
+ downloadEntitiesExport: () => downloadEntitiesExport,
512
+ getEntityCSVExportableData: () => getEntityCSVExportableData,
513
+ getEntityJsonExportableData: () => getEntityJsonExportableData
514
+ });
515
+ //#endregion
516
+ export { downloadDataAsCsv as a, getEntityJsonExportableData as c, downloadBlob as i, ExportCollectionAction as n, downloadEntitiesExport as o, BasicExportAction as r, getEntityCSVExportableData as s, export_exports as t };
517
+
518
+ //# sourceMappingURL=export-BM6HPujv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-BM6HPujv.js","names":[],"sources":["../src/data_export/export/export.ts","../src/data_export/export/BasicExportAction.tsx","../src/data_export/export/ExportCollectionAction.tsx","../src/data_export/export/index.ts"],"sourcesContent":["import { Entity, EntityReference, Properties, Property } from \"@rebasepro/types\";\nimport { type ArrayValuesCount, getArrayValuesCount, getValueInPath } from \"@rebasepro/utils\";\n\ninterface Header {\n key: string;\n label: string;\n}\n\nexport interface DownloadEntitiesExportParams<M extends Record<string, unknown>> {\n data: Entity<M>[];\n additionalData: Record<string, unknown>[] | undefined;\n properties: Properties;\n propertiesOrder: string[] | undefined;\n name: string;\n flattenArrays: boolean;\n additionalHeaders: string[] | undefined;\n exportType: \"csv\" | \"json\";\n dateExportType: \"timestamp\" | \"string\";\n}\n\nexport function downloadEntitiesExport<M extends Record<string, unknown>>({\n data,\n additionalData,\n properties,\n propertiesOrder,\n name,\n flattenArrays,\n additionalHeaders,\n exportType,\n dateExportType\n}: DownloadEntitiesExportParams<M>\n) {\n\n console.debug(\"Downloading export\", {\n dataLength: data.length,\n properties,\n exportType,\n dateExportType\n });\n\n if (exportType === \"csv\") {\n const arrayValuesCount = flattenArrays ? getArrayValuesCount(data.map(d => d.values)) : {};\n const headers = getExportHeaders(properties, propertiesOrder, additionalHeaders, arrayValuesCount);\n const exportableData = getEntityCSVExportableData(data, additionalData, properties, headers, dateExportType);\n const headersData = entryToCSVRow(headers.map(h => h.label));\n const csvData = exportableData.map(entry => entryToCSVRow(entry));\n downloadBlob([headersData, ...csvData], `${name}.csv`, \"text/csv\");\n } else {\n const exportableData = getEntityJsonExportableData(data, additionalData, properties, dateExportType);\n const json = JSON.stringify(exportableData, null, 2);\n downloadBlob([json], `${name}.json`, \"application/json\");\n }\n}\n\nexport function getEntityCSVExportableData(data: Entity<Record<string, unknown>>[],\n additionalData: Record<string, unknown>[] | undefined,\n properties: Properties,\n headers: Header[],\n dateExportType: \"timestamp\" | \"string\"\n) {\n\n const mergedData: Record<string, unknown>[] = data.map(e => ({\n id: e.id,\n ...processValuesForExport(e.values, properties, \"csv\", dateExportType)\n }));\n\n if (additionalData) {\n additionalData.forEach((additional, index) => {\n mergedData[index] = { ...mergedData[index],\n...additional };\n });\n }\n\n return mergedData && mergedData.map((entry) => {\n return headers.map((header) => getValueInPath(entry, header.key));\n });\n}\n\nexport function getEntityJsonExportableData(data: Entity<Record<string, unknown>>[],\n additionalData: Record<string, unknown>[] | undefined,\n properties: Properties,\n dateExportType: \"timestamp\" | \"string\"\n) {\n\n const mergedData: Record<string, unknown>[] = data.map(e => ({\n id: e.id,\n ...processValuesForExport(e.values, properties, \"json\", dateExportType)\n }));\n\n if (additionalData) {\n additionalData.forEach((additional, index) => {\n mergedData[index] = { ...mergedData[index],\n...additional };\n });\n }\n\n return mergedData;\n}\n\nfunction getExportHeaders<M extends Record<string, unknown>>(properties: Properties,\n propertiesOrder: string[] | undefined,\n additionalHeaders: string[] | undefined,\n arrayValuesCount?: ArrayValuesCount): Header[] {\n\n const headers: Header[] = [\n {\n label: \"id\",\n key: \"id\"\n },\n ...(propertiesOrder ?? Object.keys(properties))\n .flatMap((childKey) => {\n const property = properties[childKey];\n if (!property) {\n console.warn(\"Property not found\", childKey, properties);\n return [];\n }\n if (arrayValuesCount && arrayValuesCount[childKey] > 1) {\n return Array.from({ length: arrayValuesCount[childKey] },\n (_, i) => getHeaders(property as Property, `${childKey}[${i}]`, \"\"))\n .flat();\n } else {\n return getHeaders(property as Property, childKey, \"\");\n }\n })\n ];\n\n if (additionalHeaders) {\n headers.push(...additionalHeaders.map(h => ({\n label: h,\n key: h\n })));\n }\n\n return headers;\n}\n\n/**\n * Get headers for property. There could be more than one header per property\n * @param property\n * @param propertyKey\n * @param prefix\n */\nfunction getHeaders(property: Property, propertyKey: string, prefix = \"\"): Header[] {\n const currentKey = prefix ? `${prefix}.${propertyKey}` : propertyKey;\n if (property.type === \"map\" && property.properties) {\n return Object.entries(property.properties)\n .map(([childKey, p]) => getHeaders(p, childKey, currentKey))\n .flat();\n } else {\n return [{\n label: currentKey,\n key: currentKey\n }];\n }\n}\n\nfunction processValueForExport(inputValue: unknown,\n property: Property,\n exportType: \"csv\" | \"json\",\n dateExportType: \"timestamp\" | \"string\"\n): unknown {\n\n let value: unknown;\n if (property.type === \"map\" && property.properties) {\n value = processValuesForExport(inputValue as Record<string, unknown>, property.properties as Properties, exportType, dateExportType);\n } else if (property.type === \"array\") {\n if (property.of && Array.isArray(inputValue)) {\n if (Array.isArray(property.of)) {\n value = property.of.map((p, i) => processValueForExport(inputValue[i], p, exportType, dateExportType));\n } else if (property.of.type === \"map\") {\n value = exportType === \"csv\"\n ? inputValue.map((e) => JSON.stringify(e))\n : inputValue.map((e) => processValueForExport(e, property.of as Property, exportType, dateExportType));\n ;\n } else {\n value = inputValue.map((e) => processValueForExport(e, property.of as Property, exportType, dateExportType));\n }\n } else {\n value = inputValue;\n }\n } else if (property.type === \"reference\" && inputValue && typeof inputValue === \"object\" && \"isEntityReference\" in inputValue && typeof (inputValue as EntityReference).isEntityReference === \"function\" && (inputValue as EntityReference).isEntityReference()) {\n const ref = inputValue ? inputValue as EntityReference : undefined;\n value = ref ? ref.fullPath : null;\n } else if (property.type === \"date\" && inputValue instanceof Date) {\n value = inputValue ? (dateExportType === \"timestamp\" ? inputValue.getTime() : inputValue.toISOString()) : null;\n } else {\n value = inputValue;\n }\n\n return value;\n}\n\nfunction processValuesForExport<M extends Record<string, unknown>>\n (inputValues: Record<string, unknown>,\n properties: Properties,\n exportType: \"csv\" | \"json\",\n dateExportType: \"timestamp\" | \"string\"\n ): Record<string, unknown> {\n const updatedValues = Object.entries(properties)\n .map(([key, property]) => {\n const inputValue = inputValues && (inputValues)[key];\n const updatedValue = processValueForExport(inputValue, property as Property, exportType, dateExportType);\n if (updatedValue === undefined) return {};\n return ({ [key]: updatedValue });\n })\n .reduce((a, b) => ({ ...a,\n...b }), {}) as Record<string, unknown>;\n return { ...inputValues,\n...updatedValues };\n}\n\nfunction entryToCSVRow(entry: unknown[]) {\n return entry\n .map((v: unknown) => {\n if (v === null || v === undefined) return \"\";\n if (Array.isArray(v))\n return \"\\\"\" + JSON.stringify(v).replaceAll(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n const s = String(v);\n return \"\\\"\" + s.replaceAll(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n })\n .join(\",\") + \"\\r\\n\";\n}\n\nexport function downloadBlob(content: BlobPart[], filename: string, contentType: string) {\n const blob = new Blob(content, { type: contentType });\n const url = URL.createObjectURL(blob);\n const pom = document.createElement(\"a\");\n pom.href = url;\n pom.setAttribute(\"download\", filename);\n pom.click();\n}\n\nexport function downloadDataAsCsv(data: object[], name: string) {\n if (data.length === 0) return;\n\n const headers = Object.keys(data[0]);\n const csvContent = [\n headers.join(\",\"),\n ...data.map(row => headers.map(header => {\n const value = (row as Record<string, unknown>)[header];\n if (value === null || value === undefined) return \"\";\n if (Array.isArray(value)) return `\"${JSON.stringify(value).replace(/\"/g, '\"\"')}\"`;\n return `\"${String(value).replace(/\"/g, '\"\"')}\"`;\n }).join(\",\"))\n ].join(\"\\r\\n\");\n\n downloadBlob([csvContent], `${name}.csv`, \"text/csv\");\n}\n","\nimport React, { useCallback } from \"react\";\n\nimport { useTranslation } from \"@rebasepro/app\";\nimport { Entity, Properties } from \"@rebasepro/types\";\nimport {\n BooleanSwitchWithLabel,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { downloadEntitiesExport } from \"./export\";\n\nexport type BasicExportActionProps = {\n data: Entity<any>[];\n properties: Properties;\n propertiesOrder?: string[];\n}\n\nexport function BasicExportAction({\n data,\n properties,\n propertiesOrder\n}: BasicExportActionProps) {\n\n const { t } = useTranslation();\n const dateRef = React.useRef<Date>(new Date());\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const onOkClicked = useCallback(() => {\n downloadEntitiesExport({\n data,\n additionalData: [],\n properties,\n propertiesOrder,\n name: \"export.csv\",\n flattenArrays,\n additionalHeaders: [],\n exportType,\n dateExportType\n });\n handleClose();\n }, []);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton\n size={\"small\"}\n color={\"primary\"} onClick={handleClickOpen}>\n <DownloadIcon\n size={\"small\"}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n <div>{t(\"download_table_csv\")}</div>\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n </DialogContent>\n\n <DialogActions>\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n","\nimport React, { useCallback } from \"react\";\n\nimport {\n useAuthController,\n useCustomizationController,\n useData,\n useTranslation\n} from \"@rebasepro/app\";\nimport { useCMSContext } from \"../../hooks\";\nimport { CollectionActionsProps, Entity, CollectionConfig, ExportConfig, RebaseContext, User } from \"@rebasepro/types\";\nimport { getDefaultValuesFor } from \"@rebasepro/common\";\nimport {\n Alert,\n BooleanSwitchWithLabel,\n Button,\n CircularProgress,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DownloadIcon,\n IconButton,\n iconSize,\n Label,\n RadioGroup,\n RadioGroupItem,\n Tooltip\n} from \"@rebasepro/ui\";\nimport { downloadEntitiesExport } from \"./export\";\n\nconst DOCS_LIMIT = 500;\n\nexport function ExportCollectionAction<M extends Record<string, unknown>, USER extends User>({\n collection,\n path,\n collectionEntitiesCount,\n onAnalyticsEvent,\n exportAllowed,\n notAllowedView\n}: CollectionActionsProps<M, USER, CollectionConfig<M>> & {\n exportAllowed?: (props: { collectionEntitiesCount: number, path: string, collection: CollectionConfig }) => boolean;\n notAllowedView?: React.ReactNode;\n onAnalyticsEvent?: (event: string, params?: any) => void;\n}) {\n\n const { t } = useTranslation();\n\n const exportConfig = typeof collection.exportable === \"object\" ? collection.exportable : undefined;\n\n const dateRef = React.useRef<Date>(new Date());\n\n const [includeUndefinedValues, setIncludeUndefinedValues] = React.useState<boolean>(false);\n const [flattenArrays, setFlattenArrays] = React.useState<boolean>(true);\n const [exportType, setExportType] = React.useState<\"csv\" | \"json\">(\"csv\");\n const [dateExportType, setDateExportType] = React.useState<\"timestamp\" | \"string\">(\"string\");\n\n const context = useCMSContext<USER>();\n const dataClient = useData();\n\n const canExport = !exportAllowed || exportAllowed({\n collectionEntitiesCount: collectionEntitiesCount ?? 0,\n path,\n collection\n });\n\n const [dataLoading, setDataLoading] = React.useState<boolean>(false);\n const [dataLoadingError, setDataLoadingError] = React.useState<Error | undefined>();\n\n const [open, setOpen] = React.useState(false);\n\n const handleClickOpen = useCallback(() => {\n setOpen(true);\n }, [setOpen]);\n\n const handleClose = useCallback(() => {\n setOpen(false);\n }, [setOpen]);\n\n const fetchAdditionalFields = useCallback(async (entities: Entity<M>[]) => {\n\n const additionalExportFields = exportConfig?.additionalFields;\n const additionalFields = collection.additionalFields;\n\n const resolvedExportColumnsValues: Record<string, any>[] = additionalExportFields\n ? await Promise.all(entities.map(async (entity) => {\n return (await Promise.all(additionalExportFields.map(async (column) => {\n return {\n [column.key]: await column.builder({\n entity,\n context: context as RebaseContext\n })\n };\n }))).reduce((a, b) => ({ ...a,\n...b }), {});\n }))\n : [];\n\n const resolvedColumnsValues: Record<string, any>[] = additionalFields\n ? await Promise.all(entities.map(async (entity) => {\n return (await Promise.all(additionalFields\n .map(async (field) => {\n if (!field.value)\n return {};\n return {\n [field.key]: await field.value({\n entity,\n context: context as RebaseContext\n })\n };\n }))).reduce((a, b) => ({ ...a,\n...b }), {});\n }))\n : [];\n return [...resolvedExportColumnsValues, ...resolvedColumnsValues];\n }, [exportConfig?.additionalFields]);\n\n const doDownload = useCallback(async (collection: CollectionConfig<M>,\n exportConfig: ExportConfig<any> | undefined) => {\n\n onAnalyticsEvent?.(\"export_collection\", {\n collection: collection.slug\n });\n setDataLoading(true);\n dataClient.collection(path).find({})\n .then(async (res) => {\n const data = res.data as Entity<M>[];\n setDataLoadingError(undefined);\n const additionalData = await fetchAdditionalFields(data);\n const additionalHeaders = [\n ...exportConfig?.additionalFields?.map(column => column.key) ?? [],\n ...collection.additionalFields?.map(field => field.key) ?? []\n ];\n\n const dataWithDefaults = includeUndefinedValues\n ? data.map(entity => {\n const defaultValues = getDefaultValuesFor(collection.properties);\n return {\n ...entity,\n values: { ...defaultValues,\n...entity.values }\n };\n })\n : data;\n downloadEntitiesExport({\n data: dataWithDefaults,\n additionalData,\n properties: collection.properties,\n propertiesOrder: collection.propertiesOrder,\n name: collection.name,\n flattenArrays,\n additionalHeaders,\n exportType,\n dateExportType\n });\n onAnalyticsEvent?.(\"export_collection_success\", {\n collection: collection.slug\n });\n })\n .catch((e) => {\n console.error(\"Error loading export data\", e);\n setDataLoadingError(e);\n })\n .finally(() => setDataLoading(false));\n\n }, [onAnalyticsEvent, dataClient, path, fetchAdditionalFields, includeUndefinedValues, flattenArrays, exportType, dateExportType]);\n\n const onOkClicked = useCallback(() => {\n doDownload(collection, exportConfig);\n handleClose();\n }, [doDownload, collection, exportConfig, handleClose]);\n\n return <>\n\n <Tooltip title={\"Export\"}\n asChild={true}>\n <IconButton\n size={\"small\"}\n color={\"primary\"}\n onClick={handleClickOpen}>\n <DownloadIcon size={iconSize.small}/>\n </IconButton>\n </Tooltip>\n\n <Dialog\n open={open}\n onOpenChange={setOpen}\n maxWidth={\"xl\"}>\n\n <DialogTitle variant={\"h6\"}>{t(\"export_data\")}</DialogTitle>\n\n <DialogContent className={\"flex flex-col gap-4 my-4\"}>\n\n <div>{t(\"download_table_csv\")}</div>\n\n {collectionEntitiesCount !== undefined && collectionEntitiesCount > DOCS_LIMIT &&\n <Alert color={\"warning\"}>\n <div>\n {t(\"large_number_of_documents\", { count: collectionEntitiesCount.toString() })}\n </div>\n </Alert>}\n\n <div className={\"flex flex-row gap-4\"}>\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={exportType} onValueChange={(v) => setExportType(v as \"csv\" | \"json\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"csv\" id=\"radio-csv\"/>\n <Label htmlFor=\"radio-csv\">{t(\"csv\")}</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"json\" id=\"radio-json\"/>\n <Label htmlFor=\"radio-json\">{t(\"json\")}</Label>\n </div>\n </RadioGroup>\n </div>\n\n <div className={\"p-4 flex flex-col\"}>\n <RadioGroup value={dateExportType} onValueChange={(v) => setDateExportType(v as \"timestamp\" | \"string\")}>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"timestamp\" id=\"radio-timestamp\"/>\n <Label htmlFor=\"radio-timestamp\">{t(\"dates_as_timestamps\")} ({dateRef.current.getTime()})</Label>\n </div>\n <div className=\"flex items-center gap-2\">\n <RadioGroupItem value=\"string\" id=\"radio-string\"/>\n <Label htmlFor=\"radio-string\">{t(\"dates_as_strings\")} ({dateRef.current.toISOString()})</Label>\n </div>\n </RadioGroup>\n </div>\n </div>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n disabled={exportType !== \"csv\"}\n value={flattenArrays}\n onValueChange={setFlattenArrays}\n label={t(\"flatten_arrays\")}/>\n\n <BooleanSwitchWithLabel\n size={\"small\"}\n value={includeUndefinedValues}\n onValueChange={setIncludeUndefinedValues}\n label={t(\"include_undefined_values\")}/>\n\n {!canExport && notAllowedView}\n\n </DialogContent>\n\n <DialogActions>\n\n {dataLoading && <CircularProgress size={\"smallest\"}/>}\n\n <Button onClick={handleClose}\n variant={\"text\"}>\n {t(\"cancel\")}\n </Button>\n\n <Button onClick={onOkClicked}\n disabled={dataLoading || !canExport}>\n {t(\"download\")}\n </Button>\n\n </DialogActions>\n\n </Dialog>\n\n </>;\n}\n","export * from \"./export\";\nexport * from \"./BasicExportAction\";\nexport * from \"./ExportCollectionAction\";\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,uBAA0D,EACtE,MACA,gBACA,YACA,iBACA,MACA,eACA,mBACA,YACA,kBAEF;CAEE,QAAQ,MAAM,sBAAsB;EAChC,YAAY,KAAK;EACjB;EACA;EACA;CACJ,CAAC;CAED,IAAI,eAAe,OAAO;EAEtB,MAAM,UAAU,iBAAiB,YAAY,iBAAiB,mBADrC,gBAAgB,oBAAoB,KAAK,KAAI,MAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CACQ;EACjG,MAAM,iBAAiB,2BAA2B,MAAM,gBAAgB,YAAY,SAAS,cAAc;EAG3G,aAAa,CAFO,cAAc,QAAQ,KAAI,MAAK,E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oBAAf;WAA+B,EAAE,kBAAkB;WAAE;WAAG,QAAQ,QAAQ,YAAY;WAAE;UAAQ;WAC7F;UACG;;MACX,CAAA,CACJ;;KAEL,oBAAC,wBAAD;MACI,MAAM;MACN,UAAU,eAAe;MACzB,OAAO;MACP,eAAe;MACf,OAAO,EAAE,gBAAgB;KAAG,CAAA;KAEhC,oBAAC,wBAAD;MACI,MAAM;MACN,OAAO;MACP,eAAe;MACf,OAAO,EAAE,0BAA0B;KAAG,CAAA;KAEzC,CAAC,aAAa;IAEJ;;GAEf,qBAAC,eAAD,EAAA,UAAA;IAEK,eAAe,oBAAC,kBAAD,EAAkB,MAAM,WAAY,CAAA;IAEpD,oBAAC,QAAD;KAAQ,SAAS;KACb,SAAS;eACR,EAAE,QAAQ;IACP,CAAA;IAER,oBAAC,QAAD;KAAQ,SAAS;KACb,UAAU,eAAe,CAAC;eACzB,EAAE,UAAU;IACT,CAAA;GAEG,EAAA,CAAA;EAEX;GAEV,EAAA,CAAA;AACN"}
@@ -1,9 +1,9 @@
1
- import { Fn as useHistory, V as PropertyPreview, yr as getPropertyInPath } from "./src-B8WuGSPZ.js";
1
+ import { $ as useHistory, Vn as getPropertyInPath, mn as PropertyPreview } from "./util-XFwQ9FEc.js";
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  import { ArrowLeftIcon, Chip, ErrorBoundary, HistoryIcon, IconButton, Label, Tooltip, Typography, cls, defaultBorderMixin, iconSize } from "@rebasepro/ui";
4
4
  import { ConfirmationDialog, useAuthController, useSnackbarController } from "@rebasepro/app";
5
- import { getValueInPath } from "@rebasepro/utils";
6
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { getValueInPath } from "@rebasepro/utils";
7
7
  //#region src/components/history/UserChip.tsx
8
8
  function UserChip({ user }) {
9
9
  return /* @__PURE__ */ jsx(Tooltip, {
@@ -308,4 +308,4 @@ function EntityHistoryView({ entity, collection, formContext }) {
308
308
  //#endregion
309
309
  export { EntityHistoryView };
310
310
 
311
- //# sourceMappingURL=history-GSa4BgDt.js.map
311
+ //# sourceMappingURL=history-CtIPJxvQ.js.map