@rebasepro/admin 0.13.1-canary.gf57a27e → 0.14.0
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/{CollectionEditorDialog-BnfOcqM_.js → CollectionEditorDialog-CSheud_E.js} +19 -9
- package/dist/CollectionEditorDialog-CSheud_E.js.map +1 -0
- package/dist/{PropertyEditView-vLXglzIy.js → PropertyEditView-CWZlC1gq.js} +5 -5
- package/dist/PropertyEditView-CWZlC1gq.js.map +1 -0
- package/dist/{RouterCollectionsStudioView-DF3aiOuv.js → RouterCollectionsStudioView-CwTpdzWF.js} +4 -4
- package/dist/{RouterCollectionsStudioView-DF3aiOuv.js.map → RouterCollectionsStudioView-CwTpdzWF.js.map} +1 -1
- package/dist/collection_editor_ui.js +4 -4
- package/dist/components/ClearFilterSortButton.d.ts +7 -1
- package/dist/components/CollectionViewBinding/SortButton.d.ts +7 -1
- package/dist/components/RelationSelector.d.ts +13 -0
- package/dist/data_export/export/export.d.ts +7 -0
- package/dist/data_export/export/fetch_export_data.d.ts +48 -0
- package/dist/data_export/export/index.d.ts +1 -0
- package/dist/data_import/utils/csv.d.ts +30 -0
- package/dist/data_import/utils/index.d.ts +2 -0
- package/dist/data_import/utils/save_entities.d.ts +38 -0
- package/dist/data_import/utils/transforms.d.ts +9 -0
- package/dist/editor.js +3 -0
- package/dist/editor.js.map +1 -1
- package/dist/{export-C26xQN-g.js → export-L53WektO.js} +175 -39
- package/dist/export-L53WektO.js.map +1 -0
- package/dist/{history-DSS-Ebwh.js → history-D5SKygpJ.js} +2 -2
- package/dist/{history-DSS-Ebwh.js.map → history-D5SKygpJ.js.map} +1 -1
- package/dist/{import-Dhx96B6x.js → import-C_4edkoD.js} +5 -4
- package/dist/import-C_4edkoD.js.map +1 -0
- package/dist/index.js +93 -74
- package/dist/index.js.map +1 -1
- package/dist/preview/components/date_fns_locales.d.ts +9 -0
- package/dist/{util-Bt6VadeZ.js → util-C-D5yD2n.js} +567 -113
- package/dist/util-C-D5yD2n.js.map +1 -0
- package/package.json +10 -9
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +8 -3
- package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +5 -2
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +1 -0
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +9 -8
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +5 -2
- package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +5 -2
- package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +1 -0
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +92 -84
- package/src/collection_editor/useLocalCollectionsConfigController.tsx +10 -3
- package/src/components/ClearFilterSortButton.tsx +16 -7
- package/src/components/CollectionTableBinding/table_bindings.tsx +7 -1
- package/src/components/CollectionViewBinding/CollectionBoardViewBinding.tsx +13 -7
- package/src/components/CollectionViewBinding/CollectionViewBinding.tsx +1 -0
- package/src/components/CollectionViewBinding/CollectionViewStartActions.tsx +9 -0
- package/src/components/CollectionViewBinding/SortButton.tsx +16 -4
- package/src/components/CollectionViewBinding/ViewModeToggle.tsx +10 -5
- package/src/components/CollectionViewBinding/useBoardDataController.tsx +11 -3
- package/src/components/DefaultDrawer.tsx +7 -0
- package/src/components/DrawerNavigationItem.tsx +12 -0
- package/src/components/RelationSelector.tsx +52 -5
- package/src/components/SearchIconsView.tsx +14 -33
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +1 -0
- package/src/components/UserSelector.tsx +47 -5
- package/src/data_export/export/ExportCollectionAction.tsx +101 -48
- package/src/data_export/export/export.ts +63 -16
- package/src/data_export/export/fetch_export_data.ts +90 -0
- package/src/data_export/export/index.ts +1 -0
- package/src/data_import/components/DataNewPropertiesMapping.tsx +20 -3
- package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +1 -0
- package/src/data_import/components/ImportSaveInProgress.tsx +35 -36
- package/src/data_import/import/ImportCollectionAction.tsx +13 -2
- package/src/data_import/utils/csv.ts +153 -0
- package/src/data_import/utils/data.ts +7 -1
- package/src/data_import/utils/file_to_json.ts +77 -6
- package/src/data_import/utils/index.ts +2 -0
- package/src/data_import/utils/save_entities.ts +138 -0
- package/src/data_import/utils/transforms.ts +23 -0
- package/src/editor/components/image-bubble.tsx +2 -0
- package/src/editor/selectors/link-selector.tsx +1 -0
- package/src/form/field_bindings/BinaryFieldBinding.tsx +1 -0
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +4 -0
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +3 -0
- package/src/form/field_bindings/TextFieldBinding.tsx +18 -0
- package/src/form/field_bindings/VectorFieldBinding.tsx +1 -0
- package/src/preview/components/DatePreview.tsx +15 -2
- package/src/preview/components/ReferencePreview.tsx +5 -8
- package/src/preview/components/RelationPreview.tsx +8 -7
- package/src/preview/components/date_fns_locales.ts +125 -0
- package/dist/CollectionEditorDialog-BnfOcqM_.js.map +0 -1
- package/dist/PropertyEditView-vLXglzIy.js.map +0 -1
- package/dist/export-C26xQN-g.js.map +0 -1
- package/dist/import-Dhx96B6x.js.map +0 -1
- package/dist/util-Bt6VadeZ.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { EntityReference } from "@rebasepro/types";
|
|
5
5
|
import type { PreviewSize } from "../../types/components/PropertyPreviewProps";
|
|
6
6
|
import { useCustomizationController, useFetch, useComponentOverride, CollectionScopeProvider } from "@rebasepro/app";
|
|
7
7
|
import { Skeleton } from "@rebasepro/ui";
|
|
@@ -157,11 +157,10 @@ function ReferencePreviewExisting<M extends Record<string, unknown> = Record<str
|
|
|
157
157
|
useCache: true
|
|
158
158
|
});
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const usedEntity = entity ?? referencesCache.get(reference.pathWithId);
|
|
160
|
+
// Only what the fetch currently reports — see the note in RelationPreview:
|
|
161
|
+
// the module-level Map that used to back this kept a deleted row on screen
|
|
162
|
+
// for the rest of the session, and across a sign-out.
|
|
163
|
+
const usedEntity = entity;
|
|
165
164
|
|
|
166
165
|
let body: React.ReactNode;
|
|
167
166
|
|
|
@@ -234,5 +233,3 @@ function ReferencePreviewExisting<M extends Record<string, unknown> = Record<str
|
|
|
234
233
|
hover={hover}/>;
|
|
235
234
|
|
|
236
235
|
}
|
|
237
|
-
|
|
238
|
-
const referencesCache = new Map<string, Entity<any>>();
|
|
@@ -189,11 +189,14 @@ function RelationPreviewExisting<M extends Record<string, unknown> = Record<stri
|
|
|
189
189
|
useCache: true
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
// Only what the fetch currently reports. There used to be a module-level
|
|
193
|
+
// Map behind this, written on every successful fetch and never invalidated:
|
|
194
|
+
// when the target row was deleted `useFetch` correctly reported it gone and
|
|
195
|
+
// the card carried on rendering the copy in the Map, so the "missing"
|
|
196
|
+
// branches below were unreachable for anything previewed this session — and
|
|
197
|
+
// the Map outlived a sign-out. `useFetch` keeps its own cache, seeds the
|
|
198
|
+
// first render from it, and clears the entry when the row disappears.
|
|
199
|
+
const usedEntity = passedEntity ?? entity;
|
|
197
200
|
|
|
198
201
|
let body: React.ReactNode;
|
|
199
202
|
|
|
@@ -266,5 +269,3 @@ function RelationPreviewExisting<M extends Record<string, unknown> = Record<stri
|
|
|
266
269
|
hover={hover}/>;
|
|
267
270
|
|
|
268
271
|
}
|
|
269
|
-
|
|
270
|
-
const relationsCache = new Map<string, Entity<any>>();
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { Locale as LocaleKey } from "@rebasepro/admin-types";
|
|
2
|
+
import type { Locale as DateFnsLocale } from "date-fns";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One date-fns locale, fetched when the admin is actually configured to use it.
|
|
6
|
+
*
|
|
7
|
+
* `DatePreview` used to open with:
|
|
8
|
+
*
|
|
9
|
+
* import * as locales from "date-fns/locale";
|
|
10
|
+
*
|
|
11
|
+
* and then index that namespace with the configured locale. A namespace import
|
|
12
|
+
* of a barrel is a reference to every member of it, so all ~77 locales were
|
|
13
|
+
* bundled — 640 kB, in the entry chunk's static graph, to format dates in the
|
|
14
|
+
* one locale a given deployment has configured (and `undefined`, meaning
|
|
15
|
+
* en-US, for nearly all of them).
|
|
16
|
+
*
|
|
17
|
+
* A map of thunks is written out rather than derived from the locale key,
|
|
18
|
+
* because `import(`date-fns/locale/${name}`)` is not statically analysable:
|
|
19
|
+
* the bundler cannot see which modules it must emit, and the import fails at
|
|
20
|
+
* runtime in a build. Each entry below is its own async chunk, and exactly one
|
|
21
|
+
* of them is ever fetched.
|
|
22
|
+
*
|
|
23
|
+
* `fil` is in the `Locale` union and has no date-fns locale to import; it
|
|
24
|
+
* resolved to `undefined` through the namespace too, so it still does.
|
|
25
|
+
*/
|
|
26
|
+
const dateFnsLocaleLoaders: Partial<Record<LocaleKey, () => Promise<DateFnsLocale>>> = {
|
|
27
|
+
af: () => import("date-fns/locale/af").then(m => m.af),
|
|
28
|
+
ar: () => import("date-fns/locale/ar").then(m => m.ar),
|
|
29
|
+
arDZ: () => import("date-fns/locale/ar-DZ").then(m => m.arDZ),
|
|
30
|
+
arMA: () => import("date-fns/locale/ar-MA").then(m => m.arMA),
|
|
31
|
+
arSA: () => import("date-fns/locale/ar-SA").then(m => m.arSA),
|
|
32
|
+
az: () => import("date-fns/locale/az").then(m => m.az),
|
|
33
|
+
be: () => import("date-fns/locale/be").then(m => m.be),
|
|
34
|
+
bg: () => import("date-fns/locale/bg").then(m => m.bg),
|
|
35
|
+
bn: () => import("date-fns/locale/bn").then(m => m.bn),
|
|
36
|
+
ca: () => import("date-fns/locale/ca").then(m => m.ca),
|
|
37
|
+
cs: () => import("date-fns/locale/cs").then(m => m.cs),
|
|
38
|
+
cy: () => import("date-fns/locale/cy").then(m => m.cy),
|
|
39
|
+
da: () => import("date-fns/locale/da").then(m => m.da),
|
|
40
|
+
de: () => import("date-fns/locale/de").then(m => m.de),
|
|
41
|
+
el: () => import("date-fns/locale/el").then(m => m.el),
|
|
42
|
+
enAU: () => import("date-fns/locale/en-AU").then(m => m.enAU),
|
|
43
|
+
enCA: () => import("date-fns/locale/en-CA").then(m => m.enCA),
|
|
44
|
+
enGB: () => import("date-fns/locale/en-GB").then(m => m.enGB),
|
|
45
|
+
enIN: () => import("date-fns/locale/en-IN").then(m => m.enIN),
|
|
46
|
+
enNZ: () => import("date-fns/locale/en-NZ").then(m => m.enNZ),
|
|
47
|
+
enUS: () => import("date-fns/locale/en-US").then(m => m.enUS),
|
|
48
|
+
eo: () => import("date-fns/locale/eo").then(m => m.eo),
|
|
49
|
+
es: () => import("date-fns/locale/es").then(m => m.es),
|
|
50
|
+
et: () => import("date-fns/locale/et").then(m => m.et),
|
|
51
|
+
eu: () => import("date-fns/locale/eu").then(m => m.eu),
|
|
52
|
+
faIR: () => import("date-fns/locale/fa-IR").then(m => m.faIR),
|
|
53
|
+
fi: () => import("date-fns/locale/fi").then(m => m.fi),
|
|
54
|
+
fr: () => import("date-fns/locale/fr").then(m => m.fr),
|
|
55
|
+
frCA: () => import("date-fns/locale/fr-CA").then(m => m.frCA),
|
|
56
|
+
frCH: () => import("date-fns/locale/fr-CH").then(m => m.frCH),
|
|
57
|
+
gd: () => import("date-fns/locale/gd").then(m => m.gd),
|
|
58
|
+
gl: () => import("date-fns/locale/gl").then(m => m.gl),
|
|
59
|
+
gu: () => import("date-fns/locale/gu").then(m => m.gu),
|
|
60
|
+
he: () => import("date-fns/locale/he").then(m => m.he),
|
|
61
|
+
hi: () => import("date-fns/locale/hi").then(m => m.hi),
|
|
62
|
+
hr: () => import("date-fns/locale/hr").then(m => m.hr),
|
|
63
|
+
hu: () => import("date-fns/locale/hu").then(m => m.hu),
|
|
64
|
+
hy: () => import("date-fns/locale/hy").then(m => m.hy),
|
|
65
|
+
id: () => import("date-fns/locale/id").then(m => m.id),
|
|
66
|
+
is: () => import("date-fns/locale/is").then(m => m.is),
|
|
67
|
+
it: () => import("date-fns/locale/it").then(m => m.it),
|
|
68
|
+
ja: () => import("date-fns/locale/ja").then(m => m.ja),
|
|
69
|
+
ka: () => import("date-fns/locale/ka").then(m => m.ka),
|
|
70
|
+
kk: () => import("date-fns/locale/kk").then(m => m.kk),
|
|
71
|
+
kn: () => import("date-fns/locale/kn").then(m => m.kn),
|
|
72
|
+
ko: () => import("date-fns/locale/ko").then(m => m.ko),
|
|
73
|
+
lb: () => import("date-fns/locale/lb").then(m => m.lb),
|
|
74
|
+
lt: () => import("date-fns/locale/lt").then(m => m.lt),
|
|
75
|
+
lv: () => import("date-fns/locale/lv").then(m => m.lv),
|
|
76
|
+
mk: () => import("date-fns/locale/mk").then(m => m.mk),
|
|
77
|
+
ms: () => import("date-fns/locale/ms").then(m => m.ms),
|
|
78
|
+
mt: () => import("date-fns/locale/mt").then(m => m.mt),
|
|
79
|
+
nb: () => import("date-fns/locale/nb").then(m => m.nb),
|
|
80
|
+
nl: () => import("date-fns/locale/nl").then(m => m.nl),
|
|
81
|
+
nlBE: () => import("date-fns/locale/nl-BE").then(m => m.nlBE),
|
|
82
|
+
nn: () => import("date-fns/locale/nn").then(m => m.nn),
|
|
83
|
+
pl: () => import("date-fns/locale/pl").then(m => m.pl),
|
|
84
|
+
pt: () => import("date-fns/locale/pt").then(m => m.pt),
|
|
85
|
+
ptBR: () => import("date-fns/locale/pt-BR").then(m => m.ptBR),
|
|
86
|
+
ro: () => import("date-fns/locale/ro").then(m => m.ro),
|
|
87
|
+
ru: () => import("date-fns/locale/ru").then(m => m.ru),
|
|
88
|
+
sk: () => import("date-fns/locale/sk").then(m => m.sk),
|
|
89
|
+
sl: () => import("date-fns/locale/sl").then(m => m.sl),
|
|
90
|
+
sr: () => import("date-fns/locale/sr").then(m => m.sr),
|
|
91
|
+
srLatn: () => import("date-fns/locale/sr-Latn").then(m => m.srLatn),
|
|
92
|
+
sv: () => import("date-fns/locale/sv").then(m => m.sv),
|
|
93
|
+
ta: () => import("date-fns/locale/ta").then(m => m.ta),
|
|
94
|
+
te: () => import("date-fns/locale/te").then(m => m.te),
|
|
95
|
+
th: () => import("date-fns/locale/th").then(m => m.th),
|
|
96
|
+
tr: () => import("date-fns/locale/tr").then(m => m.tr),
|
|
97
|
+
ug: () => import("date-fns/locale/ug").then(m => m.ug),
|
|
98
|
+
uk: () => import("date-fns/locale/uk").then(m => m.uk),
|
|
99
|
+
uz: () => import("date-fns/locale/uz").then(m => m.uz),
|
|
100
|
+
vi: () => import("date-fns/locale/vi").then(m => m.vi),
|
|
101
|
+
zhCN: () => import("date-fns/locale/zh-CN").then(m => m.zhCN),
|
|
102
|
+
zhTW: () => import("date-fns/locale/zh-TW").then(m => m.zhTW),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const cache = new Map<LocaleKey, DateFnsLocale>();
|
|
106
|
+
|
|
107
|
+
/** The locale if it has already been fetched, otherwise `undefined`. Never fetches. */
|
|
108
|
+
export function getLoadedDateFnsLocale(locale: LocaleKey | undefined): DateFnsLocale | undefined {
|
|
109
|
+
return locale ? cache.get(locale) : undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Fetch a date-fns locale. Resolves to `undefined` for a locale date-fns does
|
|
114
|
+
* not ship, which is what indexing the namespace used to yield.
|
|
115
|
+
*/
|
|
116
|
+
export async function loadDateFnsLocale(locale: LocaleKey | undefined): Promise<DateFnsLocale | undefined> {
|
|
117
|
+
if (!locale) return undefined;
|
|
118
|
+
const cached = cache.get(locale);
|
|
119
|
+
if (cached) return cached;
|
|
120
|
+
const loader = dateFnsLocaleLoaders[locale];
|
|
121
|
+
if (!loader) return undefined;
|
|
122
|
+
const loaded = await loader();
|
|
123
|
+
cache.set(locale, loaded);
|
|
124
|
+
return loaded;
|
|
125
|
+
}
|