@rebasepro/admin 0.2.4 → 0.2.5

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 (53) hide show
  1. package/dist/{CollectionEditorDialog-D0VqpLPO.js → CollectionEditorDialog-Cn8-tGyL.js} +22 -5
  2. package/dist/CollectionEditorDialog-Cn8-tGyL.js.map +1 -0
  3. package/dist/{CollectionsStudioView-Bc3Rxxc2.js → CollectionsStudioView-C-Ts1rZt.js} +4 -4
  4. package/dist/{CollectionsStudioView-Bc3Rxxc2.js.map → CollectionsStudioView-C-Ts1rZt.js.map} +1 -1
  5. package/dist/{ExportCollectionAction-Ckc-09BQ.js → ExportCollectionAction-BRdKM3DF.js} +2 -2
  6. package/dist/{ExportCollectionAction-Ckc-09BQ.js.map → ExportCollectionAction-BRdKM3DF.js.map} +1 -1
  7. package/dist/{ImportCollectionAction-BqjIrC3Z.js → ImportCollectionAction-U-v7lGxO.js} +2 -2
  8. package/dist/{ImportCollectionAction-BqjIrC3Z.js.map → ImportCollectionAction-U-v7lGxO.js.map} +1 -1
  9. package/dist/{PropertyEditView-CvRSV-A2.js → PropertyEditView-BDNYkfNf.js} +2 -2
  10. package/dist/{PropertyEditView-CvRSV-A2.js.map → PropertyEditView-BDNYkfNf.js.map} +1 -1
  11. package/dist/collection_editor_ui.js +3 -3
  12. package/dist/components/RebaseRouteDefs.d.ts +1 -1
  13. package/dist/components/admin/index.d.ts +1 -3
  14. package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +1 -1
  15. package/dist/hooks/navigation/useResolvedViews.d.ts +2 -5
  16. package/dist/{index-DY2k5TtG.js → index-DHaOV-7A.js} +3 -3
  17. package/dist/index-DHaOV-7A.js.map +1 -0
  18. package/dist/{index-UQOMHwt1.js → index-DJSL_SCr.js} +3 -3
  19. package/dist/index-DJSL_SCr.js.map +1 -0
  20. package/dist/{index-BCcLwgfe.js → index-XMII4H3d.js} +2 -2
  21. package/dist/{index-BCcLwgfe.js.map → index-XMII4H3d.js.map} +1 -1
  22. package/dist/index.d.ts +0 -2
  23. package/dist/index.js +90 -295
  24. package/dist/index.js.map +1 -1
  25. package/dist/{util-ZM9gQuCv.js → util-0GYaJqL_.js} +153 -644
  26. package/dist/util-0GYaJqL_.js.map +1 -0
  27. package/package.json +8 -8
  28. package/src/collection_editor/pgColumnToProperty.ts +19 -2
  29. package/src/components/DefaultDrawer.tsx +2 -2
  30. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +4 -4
  31. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +7 -0
  32. package/src/components/EntityCollectionView/EntityCollectionView.tsx +4 -1
  33. package/src/components/RebaseRouteDefs.tsx +4 -6
  34. package/src/components/admin/index.ts +1 -3
  35. package/src/components/index.ts +1 -3
  36. package/src/hooks/navigation/useBuildNavigationStateController.tsx +2 -3
  37. package/src/hooks/navigation/useResolvedViews.tsx +6 -48
  38. package/src/index.ts +2 -3
  39. package/src/util/previews.ts +9 -1
  40. package/dist/CollectionEditorDialog-D0VqpLPO.js.map +0 -1
  41. package/dist/components/admin/RoleChip.d.ts +0 -4
  42. package/dist/components/admin/RolesFilterSelect.d.ts +0 -2
  43. package/dist/components/admin/RolesView.d.ts +0 -4
  44. package/dist/components/admin/UserRolesSelectField.d.ts +0 -2
  45. package/dist/components/admin/UsersView.d.ts +0 -4
  46. package/dist/index-DY2k5TtG.js.map +0 -1
  47. package/dist/index-UQOMHwt1.js.map +0 -1
  48. package/dist/util-ZM9gQuCv.js.map +0 -1
  49. package/src/components/admin/RoleChip.tsx +0 -23
  50. package/src/components/admin/RolesFilterSelect.tsx +0 -45
  51. package/src/components/admin/RolesView.tsx +0 -470
  52. package/src/components/admin/UserRolesSelectField.tsx +0 -50
  53. package/src/components/admin/UsersView.tsx +0 -693
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
- import { DialogActions, Typography, IconButton, Button, AlertCircleIcon, LoadingButton, cls, defaultBorderMixin, Tooltip, CopyIcon, ImageOffIcon, ExternalLinkIcon, FileTextIcon, Skeleton, Table, TableBody, TableRow, TableCell, Chip, getColorSchemeForSeed, ErrorBoundary, FunctionSquareIcon, iconSize, CircleIcon, HashIcon, LinkIcon, Rows3Icon, UploadIcon, RepeatIcon, VoteIcon, CalendarIcon, FlagIcon, GlobeIcon, MailIcon, AlignLeftIcon, TextIcon, ArrowRightToLineIcon, HistoryIcon, CircularProgressCenter, Tab, Maximize2Icon, PencilIcon, Alert, Tabs, CodeIcon, CenteredView, useDebouncedCallback, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, TextField, BooleanSwitch, DateTimeField, useInjectStyles, fieldBackgroundInvisibleMixin, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, XIcon, PopoverPrimitive, SearchIcon, CircularProgress, ChevronDownIcon, Separator, paperMixin, CheckIcon, Menu, MenuItem, MoreVerticalIcon, Checkbox, Badge, SearchBar, Label, BooleanSwitchWithLabel, useOutsideAlerter, VirtualTable, getColorSchemeForKey, Container, PlusIcon, TableHeader, Trash2Icon, Dialog, DialogTitle, DialogContent, Sheet, debounce, coolIconKeys, lucideIcons, ExpandablePanel, HandleIcon, MinusIcon, ChevronUpIcon, Collapse, EyeOffIcon, EyeIcon, FolderUpIcon, ListOrderedIcon, UserIcon, ListIcon, QuoteIcon, FileUpload, ChevronRightIcon, SettingsIcon, Popover, CHIP_COLORS, Card, ResizablePanels, Markdown, RefreshCwIcon, TableIcon, LayoutGridIcon, KanbanIcon, ToggleButtonGroup, ColumnsIcon, CheckCircleIcon, KeyRoundIcon, Portal, FilterXIcon, FilterChip, ChevronsUpDownIcon, ArrowLeftIcon, FilterIcon, MoonIcon, SunIcon, SunMoonIcon, LogOutIcon, Avatar, ChevronsLeftIcon, ChevronsRightIcon, MenuIcon, ArrowRightIcon, AlertTriangleIcon, XCircleIcon } from "@rebasepro/ui";
3
+ import { DialogActions, Typography, IconButton, Button, AlertCircleIcon, LoadingButton, cls, defaultBorderMixin, Tooltip, CopyIcon, ImageOffIcon, ExternalLinkIcon, FileTextIcon, Skeleton, Table, TableBody, TableRow, TableCell, Chip, getColorSchemeForSeed, ErrorBoundary, FunctionSquareIcon, iconSize, CircleIcon, HashIcon, LinkIcon, Rows3Icon, UploadIcon, RepeatIcon, VoteIcon, CalendarIcon, FlagIcon, GlobeIcon, MailIcon, AlignLeftIcon, TextIcon, ArrowRightToLineIcon, HistoryIcon, CircularProgressCenter, Tab, Maximize2Icon, PencilIcon, Alert, Tabs, CodeIcon, CenteredView, useDebouncedCallback, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, TextField, BooleanSwitch, DateTimeField, useInjectStyles, fieldBackgroundInvisibleMixin, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, XIcon, PopoverPrimitive, SearchIcon, CircularProgress, ChevronDownIcon, Separator, paperMixin, CheckIcon, Menu, MenuItem, MoreVerticalIcon, Checkbox, Badge, SearchBar, Label, BooleanSwitchWithLabel, useOutsideAlerter, VirtualTable, Dialog, Sheet, PlusIcon, debounce, coolIconKeys, lucideIcons, ExpandablePanel, HandleIcon, MinusIcon, ChevronUpIcon, Collapse, EyeOffIcon, EyeIcon, Trash2Icon, FolderUpIcon, ListOrderedIcon, UserIcon, ListIcon, QuoteIcon, FileUpload, ChevronRightIcon, TableHeader, SettingsIcon, Popover, CHIP_COLORS, Card, ResizablePanels, getColorSchemeForKey, Markdown, RefreshCwIcon, DialogContent, TableIcon, LayoutGridIcon, KanbanIcon, ToggleButtonGroup, ColumnsIcon, DialogTitle, CheckCircleIcon, KeyRoundIcon, Portal, FilterXIcon, FilterChip, ChevronsUpDownIcon, ArrowLeftIcon, FilterIcon, MoonIcon, SunIcon, SunMoonIcon, LogOutIcon, Avatar, ChevronsLeftIcon, ChevronsRightIcon, MenuIcon, ArrowRightIcon, AlertTriangleIcon, XCircleIcon } from "@rebasepro/ui";
4
4
  import * as React from "react";
5
5
  import React__default, { useRef, useEffect, useState, useMemo, lazy, Suspense, useCallback, useSyncExternalStore, useContext, createContext, forwardRef, memo, useLayoutEffect, createElement } from "react";
6
- import { useTranslation, useStorageSource, ErrorView, buildEnumLabel, getColorScheme, useAuthController, useCustomizationController, useAnalyticsController, IconForView, useEntityFetch, useModeController, useRebaseContext, usePermissions, createFormexStub, useSlot, resolveComponentRef, getIcon, PluginProviderStack, useUserSelector, UserDisplay, useSnackbarController, ErrorTooltip, useStorageUploadController, useData, useRelationSelector, getRowHeight, getEntityFromCache, useLargeLayout, getColumnKeysForProperty, DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE$1, getEntityFromMemoryCache, saveEntityToMemoryCache, CONTAINER_FULL_WIDTH, ADDITIONAL_TAB_WIDTH, FORM_CONTAINER_WIDTH, useInternalUserManagementController, ConfirmationDialog, useUnsavedChangesDialog, UnsavedChangesDialog, useColumnIds, useDataTableController, saveEntityWithCallbacks, iconsSearch, deleteEntityWithCallbacks, useUserConfigurationPersistence, useScrollRestoration, useBridgeRegistration, useAdminModeController, RebaseLogo, LanguageToggle, useRebaseRegistry, buildCollapsedDefaults, useCollapsedGroups, useBuildLocalConfigurationPersistence, useRebaseClient, CustomizationControllerContext, StudioBridgeRegistryProvider, flattenKeys, removeEntityFromCache, saveEntityToCache, removeEntityFromMemoryCache, getFormFieldKeys } from "@rebasepro/core";
6
+ import { useTranslation, useStorageSource, ErrorView, buildEnumLabel, getColorScheme, useAuthController, useCustomizationController, useAnalyticsController, IconForView, useEntityFetch, useModeController, useRebaseContext, usePermissions, createFormexStub, useSlot, resolveComponentRef, getIcon, PluginProviderStack, useUserSelector, UserDisplay, useSnackbarController, ErrorTooltip, useStorageUploadController, useData, useRelationSelector, getRowHeight, getEntityFromCache, useLargeLayout, getColumnKeysForProperty, DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE$1, getEntityFromMemoryCache, saveEntityToMemoryCache, CONTAINER_FULL_WIDTH, ADDITIONAL_TAB_WIDTH, FORM_CONTAINER_WIDTH, useUnsavedChangesDialog, UnsavedChangesDialog, useColumnIds, useDataTableController, saveEntityWithCallbacks, iconsSearch, deleteEntityWithCallbacks, useInternalUserManagementController, ConfirmationDialog, useUserConfigurationPersistence, useScrollRestoration, useBridgeRegistration, useAdminModeController, RebaseLogo, LanguageToggle, useRebaseRegistry, buildCollapsedDefaults, useCollapsedGroups, useBuildLocalConfigurationPersistence, useRebaseClient, CustomizationControllerContext, StudioBridgeRegistryProvider, flattenKeys, removeEntityFromCache, saveEntityToCache, removeEntityFromMemoryCache, getFormFieldKeys } from "@rebasepro/core";
7
7
  import ExcelJS from "exceljs";
8
8
  import { isPropertyBuilder, enumToObjectEntries, getLabelOrConfigFrom, resolveArrayProperties, getEntityImagePreviewPropertyKey, resolveDefaultSelectedView, getSubcollections, removeInitialAndTrailingSlashes, resolveEnumValues, getReferenceFrom, normalizeToEntityRelation, getRelationFrom, isReadOnly, getLocalChangesBackup, getNavigationEntriesFromPath, CollectionRegistry, getParentReferencesFromPath, canReadCollection, defaultUsersCollection, resolveCollectionPathIds, resolveProperty, isHidden, getArrayResolvedProperties, DEFAULT_ONE_OF_VALUE, getDefaultValueFor, DEFAULT_ONE_OF_TYPE, getDefaultValueFortype, resolveStorageFilenameString, resolveStoragePathString, resolveRelationProperty, getTableName, getDefaultValuesFor } from "@rebasepro/common";
9
- import { EntityRelation, EntityReference, getDataSourceCapabilities, GeoPoint, Vector } from "@rebasepro/types";
9
+ import { EntityRelation, EntityReference, GeoPoint, getDataSourceCapabilities, Vector } from "@rebasepro/types";
10
10
  import { useFormex, setIn, Field, getIn, useCreateFormex, Formex } from "@rebasepro/formex";
11
11
  import { inferTypeFromValue } from "@rebasepro/schema-inference";
12
12
  import { hydrateRegExp, getValueInPath, mergeDeep, getHashValue, pick, randomString, toArray, defaultDateFormat, isObject } from "@rebasepro/utils";
@@ -1951,6 +1951,10 @@ function getDefaultPropertiesOrder(collection) {
1951
1951
  if (collection.propertiesOrder) return collection.propertiesOrder;
1952
1952
  return [...Object.keys(collection.properties), ...(collection.additionalFields ?? []).map((field) => field.key)];
1953
1953
  }
1954
+ function isHiddenProperty(property) {
1955
+ if (!property) return false;
1956
+ return Boolean(property.ui?.hideFromCollection);
1957
+ }
1954
1958
  function getEntityPreviewKeys(authController, targetCollection, fields, previewProperties, limit = 3) {
1955
1959
  const allProperties = Object.keys(targetCollection.properties);
1956
1960
  let listProperties = previewProperties?.filter((p) => allProperties.includes(p));
@@ -1967,7 +1971,7 @@ function getEntityPreviewKeys(authController, targetCollection, fields, previewP
1967
1971
  return !isIdProp;
1968
1972
  }).filter((key) => {
1969
1973
  const property = targetCollection.properties[key];
1970
- return property && !isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property);
1974
+ return property && !isPropertyBuilder(property) && !isReferenceProperty(property) && !isRelationProperty(property) && !isHiddenProperty(property);
1971
1975
  }).slice(0, limit);
1972
1976
  }
1973
1977
  }
@@ -1981,6 +1985,9 @@ function getEntityTitlePropertyKey(collection, propertyConfigs) {
1981
1985
  const property = collection.properties[key];
1982
1986
  if (property && !isPropertyBuilder(property)) {
1983
1987
  const prop = property;
1988
+ if (isHiddenProperty(prop)) {
1989
+ continue;
1990
+ }
1984
1991
  if (prop.type === "string" && !prop.ui?.multiline && !prop.ui?.markdown && !prop.storage && !prop.isId) {
1985
1992
  if (!firstStringCandidate) {
1986
1993
  firstStringCandidate = key;
@@ -2612,7 +2619,7 @@ function EntityView(t0) {
2612
2619
  }
2613
2620
  return t8;
2614
2621
  }
2615
- const EntityHistoryView$2 = lazy(() => import("./index-BCcLwgfe.js").then((m) => ({
2622
+ const EntityHistoryView$2 = lazy(() => import("./index-XMII4H3d.js").then((m) => ({
2616
2623
  default: m.EntityHistoryView
2617
2624
  })));
2618
2625
  const BUILTIN_ENTITY_VIEWS = {
@@ -2702,7 +2709,7 @@ function EntityJsonPreview(t0) {
2702
2709
  }
2703
2710
  return t4;
2704
2711
  }
2705
- const EntityHistoryView$1 = lazy(() => import("./index-BCcLwgfe.js").then((m) => ({
2712
+ const EntityHistoryView$1 = lazy(() => import("./index-XMII4H3d.js").then((m) => ({
2706
2713
  default: m.EntityHistoryView
2707
2714
  })));
2708
2715
  const MAIN_TAB_VALUE$1 = "__main_##Q$SC^#S6";
@@ -8485,7 +8492,7 @@ function EntityActionButton(t0) {
8485
8492
  }
8486
8493
  return t5;
8487
8494
  }
8488
- const EntityHistoryView = lazy(() => import("./index-BCcLwgfe.js").then((m) => ({
8495
+ const EntityHistoryView = lazy(() => import("./index-XMII4H3d.js").then((m) => ({
8489
8496
  default: m.EntityHistoryView
8490
8497
  })));
8491
8498
  const MAIN_TAB_VALUE = "__main_##Q$SC^#S6";
@@ -9755,481 +9762,6 @@ function useResolvedCollections(props) {
9755
9762
  refresh
9756
9763
  }), [resolvedCollections, loading, error, refresh]);
9757
9764
  }
9758
- function RoleChip(t0) {
9759
- const $ = c(9);
9760
- const {
9761
- role
9762
- } = t0;
9763
- let colorScheme;
9764
- if (role.isAdmin) {
9765
- let t12;
9766
- if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
9767
- t12 = getColorSchemeForKey("blue");
9768
- $[0] = t12;
9769
- } else {
9770
- t12 = $[0];
9771
- }
9772
- colorScheme = t12;
9773
- } else {
9774
- if (role.id === "editor") {
9775
- let t12;
9776
- if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
9777
- t12 = getColorSchemeForKey("yellow");
9778
- $[1] = t12;
9779
- } else {
9780
- t12 = $[1];
9781
- }
9782
- colorScheme = t12;
9783
- } else {
9784
- if (role.id === "viewer") {
9785
- let t12;
9786
- if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
9787
- t12 = getColorSchemeForKey("gray");
9788
- $[2] = t12;
9789
- } else {
9790
- t12 = $[2];
9791
- }
9792
- colorScheme = t12;
9793
- } else {
9794
- let t12;
9795
- if ($[3] !== role.id) {
9796
- t12 = getColorSchemeForSeed(role.id);
9797
- $[3] = role.id;
9798
- $[4] = t12;
9799
- } else {
9800
- t12 = $[4];
9801
- }
9802
- colorScheme = t12;
9803
- }
9804
- }
9805
- }
9806
- let t1;
9807
- if ($[5] !== colorScheme || $[6] !== role.id || $[7] !== role.name) {
9808
- t1 = /* @__PURE__ */ jsx(Chip, { colorScheme, children: role.name }, role.id);
9809
- $[5] = colorScheme;
9810
- $[6] = role.id;
9811
- $[7] = role.name;
9812
- $[8] = t1;
9813
- } else {
9814
- t1 = $[8];
9815
- }
9816
- return t1;
9817
- }
9818
- function RolesView({
9819
- userManagement: userManagementProp
9820
- }) {
9821
- const userManagementContext = useInternalUserManagementController();
9822
- const userManagement = userManagementProp ?? userManagementContext;
9823
- if (!userManagement) {
9824
- return null;
9825
- }
9826
- const {
9827
- roles,
9828
- saveRole,
9829
- deleteRole,
9830
- loading,
9831
- allowDefaultRolesCreation,
9832
- rolesError
9833
- } = userManagement;
9834
- const snackbarController = useSnackbarController();
9835
- const {
9836
- t
9837
- } = useTranslation();
9838
- const breadcrumbs = useBreadcrumbsController();
9839
- React__default.useEffect(() => {
9840
- breadcrumbs.set({
9841
- breadcrumbs: [{
9842
- title: t("roles"),
9843
- url: "/roles"
9844
- }]
9845
- });
9846
- }, []);
9847
- const [dialogOpen, setDialogOpen] = useState(false);
9848
- const [selectedRole, setSelectedRole] = useState();
9849
- const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false);
9850
- const [roleToDelete, setRoleToDelete] = useState();
9851
- const [deleteInProgress, setDeleteInProgress] = useState(false);
9852
- const handleAddRole = () => {
9853
- setSelectedRole(void 0);
9854
- setDialogOpen(true);
9855
- };
9856
- const handleEditRole = (role) => {
9857
- setSelectedRole(role);
9858
- setDialogOpen(true);
9859
- };
9860
- const handleClose = () => {
9861
- setDialogOpen(false);
9862
- setSelectedRole(void 0);
9863
- };
9864
- const handleDelete = async () => {
9865
- if (!roleToDelete || !deleteRole) return;
9866
- setDeleteInProgress(true);
9867
- try {
9868
- await deleteRole(roleToDelete);
9869
- snackbarController.open({
9870
- type: "success",
9871
- message: t("role_deleted_successfully")
9872
- });
9873
- setDeleteConfirmOpen(false);
9874
- setRoleToDelete(void 0);
9875
- } catch (error) {
9876
- snackbarController.open({
9877
- type: "error",
9878
- message: error instanceof Error ? error.message : t("error_deleting_role")
9879
- });
9880
- } finally {
9881
- setDeleteInProgress(false);
9882
- }
9883
- };
9884
- const createDefaultRoles = async () => {
9885
- if (!saveRole) return;
9886
- const defaultRoles = [{
9887
- id: "admin",
9888
- name: "Admin",
9889
- isAdmin: true
9890
- }, {
9891
- id: "editor",
9892
- name: "Editor",
9893
- isAdmin: false
9894
- }, {
9895
- id: "viewer",
9896
- name: "Viewer",
9897
- isAdmin: false
9898
- }];
9899
- try {
9900
- for (const role_0 of defaultRoles) {
9901
- await saveRole(role_0);
9902
- }
9903
- snackbarController.open({
9904
- type: "success",
9905
- message: t("saved_correctly")
9906
- });
9907
- } catch (error_0) {
9908
- snackbarController.open({
9909
- type: "error",
9910
- message: error_0 instanceof Error ? error_0.message : t("error_saving_role")
9911
- });
9912
- }
9913
- };
9914
- if (loading) {
9915
- return /* @__PURE__ */ jsx(CenteredView, { children: /* @__PURE__ */ jsx(CircularProgress, {}) });
9916
- }
9917
- return /* @__PURE__ */ jsxs(Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
9918
- /* @__PURE__ */ jsxs("div", { className: "flex items-center mt-12 mb-4 gap-4", children: [
9919
- /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "grow mb-0", component: "h4", children: t("roles") }),
9920
- /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(PlusIcon, {}), onClick: handleAddRole, disabled: !saveRole, children: t("add_role") })
9921
- ] }),
9922
- /* @__PURE__ */ jsx("div", { className: "w-full overflow-auto", children: /* @__PURE__ */ jsxs(Table, { className: "w-full", children: [
9923
- /* @__PURE__ */ jsxs(TableHeader, { children: [
9924
- /* @__PURE__ */ jsx(TableCell, { header: true, children: t("role") }),
9925
- /* @__PURE__ */ jsx(TableCell, { header: true, className: "items-center", children: t("is_admin") }),
9926
- /* @__PURE__ */ jsx(TableCell, { header: true, className: "w-24 text-right", children: t("actions") })
9927
- ] }),
9928
- /* @__PURE__ */ jsxs(TableBody, { children: [
9929
- roles && roles.map((role_1) => {
9930
- return /* @__PURE__ */ jsxs(TableRow, { onClick: () => saveRole && handleEditRole(role_1), children: [
9931
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(RoleChip, { role: role_1 }) }),
9932
- /* @__PURE__ */ jsx(TableCell, { className: "items-center", children: /* @__PURE__ */ jsx(Checkbox, { checked: role_1.isAdmin ?? false, disabled: true }) }),
9933
- /* @__PURE__ */ jsx(TableCell, { className: "text-right whitespace-nowrap", children: /* @__PURE__ */ jsx("div", { className: "flex justify-end items-center gap-1", children: !role_1.isAdmin && deleteRole && /* @__PURE__ */ jsx(Tooltip, { asChild: true, title: t("delete_this_role"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e) => {
9934
- e.stopPropagation();
9935
- setRoleToDelete(role_1);
9936
- setDeleteConfirmOpen(true);
9937
- }, children: /* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.small }) }) }) }) })
9938
- ] }, role_1.id);
9939
- }),
9940
- (!roles || roles.length === 0) && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colspan: 3, children: /* @__PURE__ */ jsxs(CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
9941
- /* @__PURE__ */ jsx(Typography, { variant: "label", children: rolesError ? t("no_permission_to_view_roles") : t("no_roles_yet") }),
9942
- rolesError && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: t("no_permission_description") }),
9943
- !rolesError && allowDefaultRolesCreation && saveRole && /* @__PURE__ */ jsx(Button, { onClick: createDefaultRoles, children: t("create_default_roles") })
9944
- ] }) }) })
9945
- ] })
9946
- ] }) }),
9947
- saveRole && /* @__PURE__ */ jsx(RoleDetailsForm, { open: dialogOpen, role: selectedRole, saveRole, handleClose }, selectedRole?.id ?? "new"),
9948
- /* @__PURE__ */ jsx(ConfirmationDialog, { open: deleteConfirmOpen, loading: deleteInProgress, onAccept: handleDelete, onCancel: () => {
9949
- setDeleteConfirmOpen(false);
9950
- setRoleToDelete(void 0);
9951
- }, title: /* @__PURE__ */ jsx(Fragment, { children: t("delete_confirmation_title") }), body: /* @__PURE__ */ jsx(Fragment, { children: t("delete_role_confirmation") }) })
9952
- ] });
9953
- }
9954
- function RoleDetailsForm({
9955
- open,
9956
- role: roleProp,
9957
- saveRole,
9958
- handleClose
9959
- }) {
9960
- const snackbarController = useSnackbarController();
9961
- const {
9962
- t
9963
- } = useTranslation();
9964
- const isNewRole = !roleProp;
9965
- const [roleId, setRoleId] = useState(roleProp?.id || "");
9966
- const [roleName, setRoleName] = useState(roleProp?.name || "");
9967
- const [isAdmin, setIsAdmin] = useState(roleProp?.isAdmin ?? false);
9968
- const [isSubmitting, setIsSubmitting] = useState(false);
9969
- const [errors, setErrors] = useState({});
9970
- const [submitCount, setSubmitCount] = useState(0);
9971
- const validate = () => {
9972
- const newErrors = {};
9973
- if (!roleId) newErrors.id = "Required";
9974
- if (!roleName) newErrors.name = "Required";
9975
- setErrors(newErrors);
9976
- return Object.keys(newErrors).length === 0;
9977
- };
9978
- const handleSubmit = async (e) => {
9979
- e.preventDefault();
9980
- setSubmitCount((c2) => c2 + 1);
9981
- if (!validate()) return;
9982
- setIsSubmitting(true);
9983
- try {
9984
- await saveRole({
9985
- id: roleId,
9986
- name: roleName,
9987
- isAdmin
9988
- });
9989
- handleClose();
9990
- } catch (error) {
9991
- snackbarController.open({
9992
- type: "error",
9993
- message: error instanceof Error ? error.message : "Failed to save role"
9994
- });
9995
- } finally {
9996
- setIsSubmitting(false);
9997
- }
9998
- };
9999
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (open_0) => !open_0 ? handleClose() : void 0, maxWidth: "4xl", children: /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, autoComplete: "off", noValidate: true, style: {
10000
- display: "flex",
10001
- flexDirection: "column",
10002
- position: "relative",
10003
- height: "100%"
10004
- }, children: [
10005
- /* @__PURE__ */ jsx(DialogTitle, { variant: "h4", gutterBottom: false, children: t("role") }),
10006
- /* @__PURE__ */ jsx(DialogContent, { className: "h-full grow overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
10007
- /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-4", children: [
10008
- /* @__PURE__ */ jsx(TextField, { name: "id", required: true, error: submitCount > 0 && Boolean(errors.id), value: roleId, onChange: (e_0) => setRoleId(e_0.target.value), label: t("role_id"), disabled: !isNewRole }),
10009
- submitCount > 0 && errors.id && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: errors.id })
10010
- ] }),
10011
- /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-4", children: [
10012
- /* @__PURE__ */ jsx(TextField, { name: "name", required: true, error: submitCount > 0 && Boolean(errors.name), value: roleName, onChange: (e_1) => setRoleName(e_1.target.value), label: t("role_name") }),
10013
- submitCount > 0 && errors.name && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: errors.name })
10014
- ] }),
10015
- /* @__PURE__ */ jsx("div", { className: "col-span-12 sm:col-span-4 flex items-start pt-2", children: /* @__PURE__ */ jsxs(Label, { className: "flex items-center gap-2 cursor-pointer mt-3", children: [
10016
- /* @__PURE__ */ jsx(Checkbox, { checked: isAdmin, onCheckedChange: (checked) => setIsAdmin(Boolean(checked)) }),
10017
- /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "font-medium", children: t("is_admin") })
10018
- ] }) }),
10019
- /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(CollectionPermissionsMatrix, { roleId, isAdmin }) })
10020
- ] }) }),
10021
- /* @__PURE__ */ jsxs(DialogActions, { children: [
10022
- /* @__PURE__ */ jsx(Button, { variant: "text", onClick: handleClose, children: t("cancel") }),
10023
- /* @__PURE__ */ jsx(LoadingButton, { variant: "filled", type: "submit", disabled: isSubmitting, loading: isSubmitting, children: isNewRole ? t("create_role") : t("update") })
10024
- ] })
10025
- ] }) });
10026
- }
10027
- const CRUD_OPS = [{
10028
- op: "select",
10029
- label: "read"
10030
- }, {
10031
- op: "insert",
10032
- label: "create"
10033
- }, {
10034
- op: "update",
10035
- label: "edit"
10036
- }, {
10037
- op: "delete",
10038
- label: "delete"
10039
- }];
10040
- function hasRoleAccess(rules, roleId, op) {
10041
- if (!rules || rules.length === 0) return true;
10042
- const applicable = rules.filter((r) => r.operation === op || r.operation === "all" || r.operations?.includes(op) || r.operations?.includes("all"));
10043
- if (applicable.length === 0) return false;
10044
- const forRole = applicable.filter((r) => !r.roles || r.roles.length === 0 || r.roles.includes(roleId) || r.roles.includes("public"));
10045
- if (forRole.length === 0) return false;
10046
- for (const r of forRole) {
10047
- if ((r.mode ?? "permissive") === "restrictive") return false;
10048
- }
10049
- return forRole.some((r) => (r.mode ?? "permissive") === "permissive");
10050
- }
10051
- function PermCell(t0) {
10052
- const $ = c(3);
10053
- const {
10054
- granted
10055
- } = t0;
10056
- const t1 = granted ? "text-green-500 dark:text-green-400 font-bold" : "text-surface-300 dark:text-surface-600";
10057
- const t2 = granted ? "✓" : "✗";
10058
- let t3;
10059
- if ($[0] !== t1 || $[1] !== t2) {
10060
- t3 = /* @__PURE__ */ jsx("span", { className: t1, children: t2 });
10061
- $[0] = t1;
10062
- $[1] = t2;
10063
- $[2] = t3;
10064
- } else {
10065
- t3 = $[2];
10066
- }
10067
- return t3;
10068
- }
10069
- function CollectionPermissionsMatrix(t0) {
10070
- const $ = c(34);
10071
- const {
10072
- roleId,
10073
- isAdmin
10074
- } = t0;
10075
- const {
10076
- collections
10077
- } = useCollectionRegistryController();
10078
- const {
10079
- t
10080
- } = useTranslation();
10081
- if (!collections || collections.length === 0) {
10082
- let t12;
10083
- if ($[0] !== t) {
10084
- t12 = t("no_collections_configured");
10085
- $[0] = t;
10086
- $[1] = t12;
10087
- } else {
10088
- t12 = $[1];
10089
- }
10090
- let t22;
10091
- if ($[2] !== t12) {
10092
- t22 = /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(Typography, { variant: "label", className: "text-surface-400", children: t12 }) });
10093
- $[2] = t12;
10094
- $[3] = t22;
10095
- } else {
10096
- t22 = $[3];
10097
- }
10098
- return t22;
10099
- }
10100
- const topLevel = collections;
10101
- let t1;
10102
- if ($[4] !== t) {
10103
- t1 = t("collection_permissions");
10104
- $[4] = t;
10105
- $[5] = t1;
10106
- } else {
10107
- t1 = $[5];
10108
- }
10109
- let t2;
10110
- if ($[6] !== t1) {
10111
- t2 = /* @__PURE__ */ jsx(Typography, { variant: "label", className: "mb-2 block text-surface-500 dark:text-surface-400 uppercase tracking-wide text-xs", children: t1 });
10112
- $[6] = t1;
10113
- $[7] = t2;
10114
- } else {
10115
- t2 = $[7];
10116
- }
10117
- let t3;
10118
- if ($[8] !== t) {
10119
- t3 = t("collection");
10120
- $[8] = t;
10121
- $[9] = t3;
10122
- } else {
10123
- t3 = $[9];
10124
- }
10125
- let t4;
10126
- if ($[10] !== t3) {
10127
- t4 = /* @__PURE__ */ jsx(TableCell, { header: true, children: t3 });
10128
- $[10] = t3;
10129
- $[11] = t4;
10130
- } else {
10131
- t4 = $[11];
10132
- }
10133
- let t5;
10134
- if ($[12] !== t) {
10135
- t5 = CRUD_OPS.map((t62) => {
10136
- const {
10137
- op,
10138
- label
10139
- } = t62;
10140
- return /* @__PURE__ */ jsx(TableCell, { header: true, align: "center", className: "w-20", children: t(label) }, op);
10141
- });
10142
- $[12] = t;
10143
- $[13] = t5;
10144
- } else {
10145
- t5 = $[13];
10146
- }
10147
- let t6;
10148
- if ($[14] !== t4 || $[15] !== t5) {
10149
- t6 = /* @__PURE__ */ jsxs(TableHeader, { children: [
10150
- t4,
10151
- t5
10152
- ] });
10153
- $[14] = t4;
10154
- $[15] = t5;
10155
- $[16] = t6;
10156
- } else {
10157
- t6 = $[16];
10158
- }
10159
- let t7;
10160
- if ($[17] !== isAdmin || $[18] !== roleId || $[19] !== t || $[20] !== topLevel) {
10161
- let t82;
10162
- if ($[22] !== isAdmin || $[23] !== roleId || $[24] !== t) {
10163
- t82 = (collection) => {
10164
- const capabilities = getDataSourceCapabilities(collection.driver);
10165
- const rules = capabilities.supportsRLS && "securityRules" in collection ? collection.securityRules : void 0;
10166
- const noRules = !rules || rules.length === 0;
10167
- return /* @__PURE__ */ jsxs(TableRow, { children: [
10168
- /* @__PURE__ */ jsxs(TableCell, { children: [
10169
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
10170
- /* @__PURE__ */ jsx("span", { className: "font-medium", children: collection.name }),
10171
- noRules && !isAdmin && /* @__PURE__ */ jsx(Tooltip, { title: t("no_security_rules_defined"), children: /* @__PURE__ */ jsx(Chip, { size: "smallest", colorScheme: "gray", children: t("no_rules") }) })
10172
- ] }),
10173
- /* @__PURE__ */ jsx("span", { className: "text-xs text-surface-400 font-mono", children: collection.slug })
10174
- ] }),
10175
- CRUD_OPS.map((t92) => {
10176
- const {
10177
- op: op_0
10178
- } = t92;
10179
- return /* @__PURE__ */ jsx(TableCell, { align: "center", className: "w-20", children: /* @__PURE__ */ jsx(PermCell, { granted: isAdmin || hasRoleAccess(rules, roleId, op_0) }) }, op_0);
10180
- })
10181
- ] }, collection.slug);
10182
- };
10183
- $[22] = isAdmin;
10184
- $[23] = roleId;
10185
- $[24] = t;
10186
- $[25] = t82;
10187
- } else {
10188
- t82 = $[25];
10189
- }
10190
- t7 = topLevel.map(t82);
10191
- $[17] = isAdmin;
10192
- $[18] = roleId;
10193
- $[19] = t;
10194
- $[20] = topLevel;
10195
- $[21] = t7;
10196
- } else {
10197
- t7 = $[21];
10198
- }
10199
- let t8;
10200
- if ($[26] !== t7) {
10201
- t8 = /* @__PURE__ */ jsx(TableBody, { children: t7 });
10202
- $[26] = t7;
10203
- $[27] = t8;
10204
- } else {
10205
- t8 = $[27];
10206
- }
10207
- let t9;
10208
- if ($[28] !== t6 || $[29] !== t8) {
10209
- t9 = /* @__PURE__ */ jsx("div", { className: `rounded-lg overflow-hidden border w-full ${defaultBorderMixin}`, children: /* @__PURE__ */ jsxs(Table, { className: "w-full", children: [
10210
- t6,
10211
- t8
10212
- ] }) });
10213
- $[28] = t6;
10214
- $[29] = t8;
10215
- $[30] = t9;
10216
- } else {
10217
- t9 = $[30];
10218
- }
10219
- let t10;
10220
- if ($[31] !== t2 || $[32] !== t9) {
10221
- t10 = /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
10222
- t2,
10223
- t9
10224
- ] });
10225
- $[31] = t2;
10226
- $[32] = t9;
10227
- $[33] = t10;
10228
- } else {
10229
- t10 = $[33];
10230
- }
10231
- return t10;
10232
- }
10233
9765
  function viewSlugsEqual(a, b) {
10234
9766
  if (a === b) return true;
10235
9767
  if (!a || !b) return false;
@@ -10247,8 +9779,7 @@ function useResolvedViews(props) {
10247
9779
  data,
10248
9780
  plugins,
10249
9781
  adminMode = "content",
10250
- effectiveRoleController,
10251
- userManagement
9782
+ effectiveRoleController
10252
9783
  } = props;
10253
9784
  const [loading, setLoading] = useState(true);
10254
9785
  const [error, setError] = useState(void 0);
@@ -10280,24 +9811,6 @@ function useResolvedViews(props) {
10280
9811
  }, [adminMode, effectiveRoleController?.effectiveRole, authController]);
10281
9812
  const resolvedAuthControllerRef = useRef(resolvedAuthController);
10282
9813
  resolvedAuthControllerRef.current = resolvedAuthController;
10283
- const hasRoles = !!userManagement?.roles;
10284
- const rolesViewElement = useMemo(() => hasRoles ? /* @__PURE__ */ jsx(RolesView, {}) : null, [hasRoles]);
10285
- const injectedAdminViews = useMemo(() => {
10286
- const views = [];
10287
- const isUserAdmin = userManagement?.isAdmin !== false;
10288
- if (userManagement && isUserAdmin && userManagement.roles && rolesViewElement) {
10289
- views.push({
10290
- slug: "roles",
10291
- name: "Roles",
10292
- icon: "Shield",
10293
- view: rolesViewElement,
10294
- group: "Settings"
10295
- });
10296
- }
10297
- return views;
10298
- }, [userManagement, rolesViewElement]);
10299
- const injectedAdminViewsRef = useRef(injectedAdminViews);
10300
- injectedAdminViewsRef.current = injectedAdminViews;
10301
9814
  const initialLoading = resolvedAuthController.initialLoading;
10302
9815
  const user = resolvedAuthController.user;
10303
9816
  useEffect(() => {
@@ -10305,13 +9818,7 @@ function useResolvedViews(props) {
10305
9818
  let cancelled = false;
10306
9819
  (async () => {
10307
9820
  try {
10308
- const [newViews, newAdminViewsProp] = await Promise.all([resolveAppViews(viewsProp, resolvedAuthControllerRef.current, dataRef.current, pluginsRef.current), resolveAppViews(adminViewsProp, resolvedAuthControllerRef.current, dataRef.current)]);
10309
- const customSlugs = new Set(newAdminViewsProp.flatMap((v) => Array.isArray(v.slug) ? v.slug : [v.slug]));
10310
- const finalInjected = injectedAdminViewsRef.current.filter((v_0) => {
10311
- const slugs = Array.isArray(v_0.slug) ? v_0.slug : [v_0.slug];
10312
- return slugs.every((s) => !customSlugs.has(s));
10313
- });
10314
- const newAdminViews = [...newAdminViewsProp, ...finalInjected];
9821
+ const [newViews, newAdminViews] = await Promise.all([resolveAppViews(viewsProp, resolvedAuthControllerRef.current, dataRef.current, pluginsRef.current), resolveAppViews(adminViewsProp, resolvedAuthControllerRef.current, dataRef.current)]);
10315
9822
  if (!viewSlugsEqual(viewsRef.current, newViews)) {
10316
9823
  viewsRef.current = newViews;
10317
9824
  setResolvedViews(newViews);
@@ -10502,7 +10009,7 @@ function useTopLevelNavigation(props) {
10502
10009
  }), [topLevelNavigation]);
10503
10010
  }
10504
10011
  function useBuildNavigationStateController(props) {
10505
- const $ = c(38);
10012
+ const $ = c(37);
10506
10013
  const {
10507
10014
  authController,
10508
10015
  collections: collectionsProp,
@@ -10549,7 +10056,7 @@ function useBuildNavigationStateController(props) {
10549
10056
  refresh: refreshCollections
10550
10057
  } = useResolvedCollections(t1);
10551
10058
  let t2;
10552
- if ($[8] !== adminMode || $[9] !== adminViewsProp || $[10] !== authController || $[11] !== data || $[12] !== effectiveRoleController || $[13] !== plugins || $[14] !== userManagement || $[15] !== viewsProp) {
10059
+ if ($[8] !== adminMode || $[9] !== adminViewsProp || $[10] !== authController || $[11] !== data || $[12] !== effectiveRoleController || $[13] !== plugins || $[14] !== viewsProp) {
10553
10060
  t2 = {
10554
10061
  authController,
10555
10062
  views: viewsProp,
@@ -10557,8 +10064,7 @@ function useBuildNavigationStateController(props) {
10557
10064
  data,
10558
10065
  plugins,
10559
10066
  adminMode,
10560
- effectiveRoleController,
10561
- userManagement
10067
+ effectiveRoleController
10562
10068
  };
10563
10069
  $[8] = adminMode;
10564
10070
  $[9] = adminViewsProp;
@@ -10566,11 +10072,10 @@ function useBuildNavigationStateController(props) {
10566
10072
  $[11] = data;
10567
10073
  $[12] = effectiveRoleController;
10568
10074
  $[13] = plugins;
10569
- $[14] = userManagement;
10570
- $[15] = viewsProp;
10571
- $[16] = t2;
10075
+ $[14] = viewsProp;
10076
+ $[15] = t2;
10572
10077
  } else {
10573
- t2 = $[16];
10078
+ t2 = $[15];
10574
10079
  }
10575
10080
  const {
10576
10081
  views,
@@ -10580,7 +10085,7 @@ function useBuildNavigationStateController(props) {
10580
10085
  refresh: refreshViews
10581
10086
  } = useResolvedViews(t2);
10582
10087
  let t3;
10583
- if ($[17] !== adminMode || $[18] !== adminViews || $[19] !== collectionRegistryController || $[20] !== collections || $[21] !== navigationGroupMappings || $[22] !== plugins || $[23] !== urlController || $[24] !== views || $[25] !== viewsOrder) {
10088
+ if ($[16] !== adminMode || $[17] !== adminViews || $[18] !== collectionRegistryController || $[19] !== collections || $[20] !== navigationGroupMappings || $[21] !== plugins || $[22] !== urlController || $[23] !== views || $[24] !== viewsOrder) {
10584
10089
  t3 = {
10585
10090
  collections,
10586
10091
  views,
@@ -10592,40 +10097,40 @@ function useBuildNavigationStateController(props) {
10592
10097
  adminMode,
10593
10098
  collectionRegistryController
10594
10099
  };
10595
- $[17] = adminMode;
10596
- $[18] = adminViews;
10597
- $[19] = collectionRegistryController;
10598
- $[20] = collections;
10599
- $[21] = navigationGroupMappings;
10600
- $[22] = plugins;
10601
- $[23] = urlController;
10602
- $[24] = views;
10603
- $[25] = viewsOrder;
10604
- $[26] = t3;
10100
+ $[16] = adminMode;
10101
+ $[17] = adminViews;
10102
+ $[18] = collectionRegistryController;
10103
+ $[19] = collections;
10104
+ $[20] = navigationGroupMappings;
10105
+ $[21] = plugins;
10106
+ $[22] = urlController;
10107
+ $[23] = views;
10108
+ $[24] = viewsOrder;
10109
+ $[25] = t3;
10605
10110
  } else {
10606
- t3 = $[26];
10111
+ t3 = $[25];
10607
10112
  }
10608
10113
  const {
10609
10114
  topLevelNavigation
10610
10115
  } = useTopLevelNavigation(t3);
10611
10116
  let t4;
10612
- if ($[27] !== refreshCollections || $[28] !== refreshViews) {
10117
+ if ($[26] !== refreshCollections || $[27] !== refreshViews) {
10613
10118
  t4 = () => {
10614
10119
  refreshCollections();
10615
10120
  refreshViews();
10616
10121
  };
10617
- $[27] = refreshCollections;
10618
- $[28] = refreshViews;
10619
- $[29] = t4;
10122
+ $[26] = refreshCollections;
10123
+ $[27] = refreshViews;
10124
+ $[28] = t4;
10620
10125
  } else {
10621
- t4 = $[29];
10126
+ t4 = $[28];
10622
10127
  }
10623
10128
  const refreshNavigation = t4;
10624
10129
  let t5;
10625
10130
  const t6 = collectionsLoading || viewsLoading;
10626
10131
  const t7 = collectionsError ?? viewsError;
10627
10132
  let t8;
10628
- if ($[30] !== adminViews || $[31] !== plugins || $[32] !== refreshNavigation || $[33] !== t6 || $[34] !== t7 || $[35] !== topLevelNavigation || $[36] !== views) {
10133
+ if ($[29] !== adminViews || $[30] !== plugins || $[31] !== refreshNavigation || $[32] !== t6 || $[33] !== t7 || $[34] !== topLevelNavigation || $[35] !== views) {
10629
10134
  t8 = {
10630
10135
  views,
10631
10136
  adminViews,
@@ -10635,16 +10140,16 @@ function useBuildNavigationStateController(props) {
10635
10140
  refreshNavigation,
10636
10141
  plugins
10637
10142
  };
10638
- $[30] = adminViews;
10639
- $[31] = plugins;
10640
- $[32] = refreshNavigation;
10641
- $[33] = t6;
10642
- $[34] = t7;
10643
- $[35] = topLevelNavigation;
10644
- $[36] = views;
10645
- $[37] = t8;
10143
+ $[29] = adminViews;
10144
+ $[30] = plugins;
10145
+ $[31] = refreshNavigation;
10146
+ $[32] = t6;
10147
+ $[33] = t7;
10148
+ $[34] = topLevelNavigation;
10149
+ $[35] = views;
10150
+ $[36] = t8;
10646
10151
  } else {
10647
- t8 = $[37];
10152
+ t8 = $[36];
10648
10153
  }
10649
10154
  t5 = t8;
10650
10155
  return t5;
@@ -19050,10 +18555,10 @@ function EditorCollectionAction(t0) {
19050
18555
  }
19051
18556
  return t8;
19052
18557
  }
19053
- const ImportCollectionAction = lazy(() => import("./index-UQOMHwt1.js").then((m) => ({
18558
+ const ImportCollectionAction = lazy(() => import("./index-DJSL_SCr.js").then((m) => ({
19054
18559
  default: m.ImportCollectionAction
19055
18560
  })));
19056
- const ExportCollectionAction = lazy(() => import("./index-DY2k5TtG.js").then((m) => ({
18561
+ const ExportCollectionAction = lazy(() => import("./index-DHaOV-7A.js").then((m) => ({
19057
18562
  default: m.ExportCollectionAction
19058
18563
  })));
19059
18564
  function EntityCollectionViewActions(t0) {
@@ -19685,6 +19190,7 @@ function EntityCollectionCardView({
19685
19190
  if (!dataLoading) isLoadingMore.current = false;
19686
19191
  }, [dataLoading]);
19687
19192
  useEffect(() => {
19193
+ if (!loadMoreRef.current) return;
19688
19194
  const observer = new IntersectionObserver((entries) => {
19689
19195
  const {
19690
19196
  paginationEnabled: pe,
@@ -19702,11 +19208,9 @@ function EntityCollectionCardView({
19702
19208
  rootMargin: "400px",
19703
19209
  threshold: 0
19704
19210
  });
19705
- if (loadMoreRef.current) {
19706
- observer.observe(loadMoreRef.current);
19707
- }
19211
+ observer.observe(loadMoreRef.current);
19708
19212
  return () => observer.disconnect();
19709
- }, [setItemCount]);
19213
+ }, [setItemCount, data.length]);
19710
19214
  useEffect(() => {
19711
19215
  if (!containerRef.current || !initialScroll || hasRestoredScroll.current || data.length === 0) return;
19712
19216
  let attempts = 0;
@@ -19820,6 +19324,13 @@ function getScrollParent(element) {
19820
19324
  return document.documentElement;
19821
19325
  }
19822
19326
  function isComplexPropertyType(property) {
19327
+ if (property.type === "array") {
19328
+ const ofProp = "of" in property ? property.of : void 0;
19329
+ const innerProp = ofProp ? Array.isArray(ofProp) ? ofProp[0] : ofProp : void 0;
19330
+ if (innerProp && typeof innerProp === "object" && "enum" in innerProp && innerProp.enum) {
19331
+ return false;
19332
+ }
19333
+ }
19823
19334
  return property.type === "array" || property.type === "map" || property.type === "reference" || property.type === "relation";
19824
19335
  }
19825
19336
  function compactValueSummary(value, property) {
@@ -25237,7 +24748,7 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
25237
24748
  /* @__PURE__ */ jsx(EntityCollectionListView, { collection, tableController, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], size: listSize, emptyComponent, selectedEntityId: selectedEntityIdProp, getActionsForEntity, path, openEntityMode }, `list-view-${path}`)
25238
24749
  ] }) : innerView }, `split-list-view-${path}`) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col w-full h-full", children: [
25239
24750
  toolbarNode,
25240
- /* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col overflow-y-auto", children: viewMode === "list" ? /* @__PURE__ */ jsxs("div", { className: cls("flex flex-col w-full", selectedEntityIdProp === void 0 ? "max-w-6xl mx-auto px-3 md:px-4 lg:px-6 py-4" : ""), children: [
24751
+ /* @__PURE__ */ jsx("div", { className: cls("flex-1 flex flex-col", viewMode === "list" && "overflow-y-auto"), children: viewMode === "list" ? /* @__PURE__ */ jsxs("div", { className: cls("flex flex-col w-full", selectedEntityIdProp === void 0 ? "max-w-6xl mx-auto px-3 md:px-4 lg:px-6 py-4" : ""), children: [
25241
24752
  /* @__PURE__ */ jsx("div", { className: cls("grid transition-[grid-template-rows,transform,margin] duration-150 ease-out", selectedEntityIdProp === void 0 ? "grid-rows-[1fr] translate-y-0 mt-12 mb-6" : "grid-rows-[0fr] -translate-y-2 mt-0 mb-0"), children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden flex items-center gap-4", children: /* @__PURE__ */ jsx(Typography, { gutterBottom: true, variant: "h4", className: "grow mb-0", component: "h4", children: collection.name }) }) }),
25242
24753
  pluginInsights.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: pluginInsights }),
25243
24754
  innerView
@@ -26643,7 +26154,7 @@ function DrawerToggle(t0) {
26643
26154
  }
26644
26155
  let t14;
26645
26156
  if ($[31] !== t1 || $[32] !== t13 || $[33] !== t2) {
26646
- t14 = /* @__PURE__ */ jsx("div", { className: "shrink-0 mt-auto px-2 py-2", children: /* @__PURE__ */ jsx(Tooltip, { title: t1, side: "right", sideOffset: 12, asChild: true, open: t2, children: t13 }) });
26157
+ t14 = /* @__PURE__ */ jsx("div", { className: "shrink-0 mt-auto px-4 pt-0.5 pb-2", children: /* @__PURE__ */ jsx(Tooltip, { title: t1, side: "right", sideOffset: 12, asChild: true, open: t2, children: t13 }) });
26647
26158
  $[31] = t1;
26648
26159
  $[32] = t13;
26649
26160
  $[33] = t2;
@@ -26797,7 +26308,7 @@ function DrawerFooterActions({
26797
26308
  } else {
26798
26309
  avatarComponent = null;
26799
26310
  }
26800
- return /* @__PURE__ */ jsx("div", { className: "shrink-0 pb-1", ref: portalRef, children: avatarComponent && /* @__PURE__ */ jsxs("div", { className: "flex items-center px-[16px] py-1", children: [
26311
+ return /* @__PURE__ */ jsx("div", { className: "shrink-0 pt-2 pb-0", ref: portalRef, children: avatarComponent && /* @__PURE__ */ jsxs("div", { className: "flex items-center px-[16px] py-1", children: [
26801
26312
  /* @__PURE__ */ jsxs(Menu, { trigger: /* @__PURE__ */ jsx("div", { className: cls("shrink-0 flex items-center justify-center w-[44px] cursor-pointer", "rounded-md py-1", "hover:bg-surface-accent-100 dark:hover:bg-surface-800", "transition-colors duration-150"), role: "button", tabIndex: 0, "aria-label": t("user_menu") || "User menu", children: avatarComponent }), side: "top", align: "start", children: [
26802
26313
  user && /* @__PURE__ */ jsxs("div", { className: "px-4 py-2 mb-1", children: [
26803
26314
  user.displayName && /* @__PURE__ */ jsx(Typography, { variant: "body1", color: "secondary", children: user.displayName }),
@@ -27415,7 +26926,7 @@ function useLocalCollectionsConfigController(clientOrUrl, baseCollections = [],
27415
26926
  }
27416
26927
  const EMPTY_PLUGINS = [];
27417
26928
  const EMPTY_COLLECTIONS = [];
27418
- const CollectionsStudioView = lazy(() => import("./CollectionsStudioView-Bc3Rxxc2.js").then((n) => n.b).then((m) => ({
26929
+ const CollectionsStudioView = lazy(() => import("./CollectionsStudioView-C-Ts1rZt.js").then((n) => n.b).then((m) => ({
27419
26930
  default: m.CollectionsStudioView
27420
26931
  })));
27421
26932
  function RebaseNavigation({
@@ -27653,10 +27164,10 @@ function _temp$3(event) {
27653
27164
  event.preventDefault();
27654
27165
  event.stopPropagation();
27655
27166
  }
27656
- const CollectionEditorDialog = lazy(() => import("./CollectionEditorDialog-D0VqpLPO.js").then((m) => ({
27167
+ const CollectionEditorDialog = lazy(() => import("./CollectionEditorDialog-Cn8-tGyL.js").then((m) => ({
27657
27168
  default: m.CollectionEditorDialog
27658
27169
  })));
27659
- const PropertyFormDialog = lazy(() => import("./PropertyEditView-CvRSV-A2.js").then((n) => n.P).then((m) => ({
27170
+ const PropertyFormDialog = lazy(() => import("./PropertyEditView-BDNYkfNf.js").then((n) => n.P).then((m) => ({
27660
27171
  default: m.PropertyFormDialog
27661
27172
  })));
27662
27173
  function CollectionEditorDialogs() {
@@ -30750,7 +30261,7 @@ export {
30750
30261
  MapFieldBinding as Z,
30751
30262
  MapPropertyPreview as _,
30752
30263
  ArrayContainer as a,
30753
- isReferenceProperty as a$,
30264
+ mergeEntityActions as a$,
30754
30265
  MultiSelectFieldBinding as a0,
30755
30266
  NavigationCard as a1,
30756
30267
  NavigationStateContext as a2,
@@ -30761,98 +30272,96 @@ export {
30761
30272
  PropertyPreview as a7,
30762
30273
  ReadOnlyFieldBinding as a8,
30763
30274
  RebaseNavigation as a9,
30764
- VirtualTableInput as aA,
30765
- buildCollectionGenerationCallback as aB,
30766
- buildSidePanelsFromUrl as aC,
30767
- convertDataToEntity as aD,
30768
- convertFileToJson as aE,
30769
- copyEntityAction as aF,
30770
- deleteEntityAction as aG,
30771
- editEntityAction as aH,
30772
- flattenEntry as aI,
30773
- getBracketNotation as aJ,
30774
- getDefaultFieldConfig as aK,
30775
- getDefaultFieldId as aL,
30776
- getDefaultPropertiesOrder as aM,
30777
- getEntityPreviewKeys as aN,
30778
- getEntityTitlePropertyKey as aO,
30779
- getEntityViewWidth as aP,
30780
- getFieldConfig as aQ,
30781
- getFieldId as aR,
30782
- getFullId as aS,
30783
- getFullIdPath as aT,
30784
- getIconForProperty as aU,
30785
- getIconForWidget as aV,
30786
- getInferenceType as aW,
30787
- getPropertiesWithPropertiesOrder as aX,
30788
- getPropertyInPath as aY,
30789
- getResolvedPropertyInPath as aZ,
30790
- idToPropertiesPath as a_,
30275
+ buildSidePanelsFromUrl as aA,
30276
+ convertDataToEntity as aB,
30277
+ convertFileToJson as aC,
30278
+ copyEntityAction as aD,
30279
+ deleteEntityAction as aE,
30280
+ editEntityAction as aF,
30281
+ flattenEntry as aG,
30282
+ getBracketNotation as aH,
30283
+ getDefaultFieldConfig as aI,
30284
+ getDefaultFieldId as aJ,
30285
+ getDefaultPropertiesOrder as aK,
30286
+ getEntityPreviewKeys as aL,
30287
+ getEntityTitlePropertyKey as aM,
30288
+ getEntityViewWidth as aN,
30289
+ getFieldConfig as aO,
30290
+ getFieldId as aP,
30291
+ getFullId as aQ,
30292
+ getFullIdPath as aR,
30293
+ getIconForProperty as aS,
30294
+ getIconForWidget as aT,
30295
+ getInferenceType as aU,
30296
+ getPropertiesWithPropertiesOrder as aV,
30297
+ getPropertyInPath as aW,
30298
+ getResolvedPropertyInPath as aX,
30299
+ idToPropertiesPath as aY,
30300
+ isReferenceProperty as aZ,
30301
+ isRelationProperty as a_,
30791
30302
  ReferenceAsStringFieldBinding as aa,
30792
30303
  ReferenceFieldBinding as ab,
30793
30304
  ReferencePreview as ac,
30794
30305
  RelationPreview as ad,
30795
30306
  RepeatFieldBinding as ae,
30796
- RoleChip as af,
30797
- RolesView as ag,
30798
- Scaffold as ah,
30799
- SearchIconsView as ai,
30800
- SelectFieldBinding as aj,
30801
- SelectableTable as ak,
30802
- SelectableTableContext as al,
30803
- SideDialogs as am,
30804
- SideEntityControllerContext as an,
30805
- SideEntityProvider as ao,
30806
- SkeletonPropertyComponent as ap,
30807
- StorageThumbnail as aq,
30808
- StorageThumbnailInternal as ar,
30809
- StorageUploadFieldBinding as as,
30810
- StringPropertyPreview as at,
30811
- SwitchFieldBinding as au,
30812
- TextFieldBinding as av,
30813
- UrlComponentPreview as aw,
30814
- UrlContext as ax,
30815
- UserPreview as ay,
30816
- VectorFieldBinding as az,
30307
+ Scaffold as af,
30308
+ SearchIconsView as ag,
30309
+ SelectFieldBinding as ah,
30310
+ SelectableTable as ai,
30311
+ SelectableTableContext as aj,
30312
+ SideDialogs as ak,
30313
+ SideEntityControllerContext as al,
30314
+ SideEntityProvider as am,
30315
+ SkeletonPropertyComponent as an,
30316
+ StorageThumbnail as ao,
30317
+ StorageThumbnailInternal as ap,
30318
+ StorageUploadFieldBinding as aq,
30319
+ StringPropertyPreview as ar,
30320
+ SwitchFieldBinding as as,
30321
+ TextFieldBinding as at,
30322
+ UrlComponentPreview as au,
30323
+ UrlContext as av,
30324
+ UserPreview as aw,
30325
+ VectorFieldBinding as ax,
30326
+ VirtualTableInput as ay,
30327
+ buildCollectionGenerationCallback as az,
30817
30328
  ArrayCustomShapedFieldBinding as b,
30818
- isRelationProperty as b0,
30819
- mergeEntityActions as b1,
30820
- namespaceToPropertiesOrderPath as b2,
30821
- namespaceToPropertiesPath as b3,
30822
- processValueMapping as b4,
30823
- renderSkeletonCaptionText as b5,
30824
- renderSkeletonIcon as b6,
30825
- renderSkeletonImageThumbnail as b7,
30826
- renderSkeletonText as b8,
30827
- resetPasswordAction as b9,
30828
- validateCollectionJson as bA,
30829
- zodToFormErrors as bB,
30830
- resolveEntityAction as ba,
30831
- resolveEntityView as bb,
30832
- sanitizeUrl as bc,
30833
- unflattenObject as bd,
30834
- useApp as be,
30835
- useBreadcrumbsController as bf,
30836
- useBuildCollectionRegistryController as bg,
30837
- useBuildNavigationStateController as bh,
30838
- useBuildSideEntityController as bi,
30839
- useBuildUrlController as bj,
30840
- useCMSContext as bk,
30841
- useClearRestoreValue as bl,
30842
- useCollectionEditorController as bm,
30843
- useCollectionRegistryController as bn,
30844
- useCollectionsConfigController as bo,
30845
- useEntitySelectionDialog as bp,
30846
- useImportConfig as bq,
30847
- useLocalCollectionsConfigController as br,
30848
- useNavigationStateController as bs,
30849
- useResolvedCollections as bt,
30850
- useResolvedViews as bu,
30851
- useSelectionController as bv,
30852
- useSideDialogsController as bw,
30853
- useSideEntityController as bx,
30854
- useTopLevelNavigation as by,
30855
- useUrlController as bz,
30329
+ namespaceToPropertiesOrderPath as b0,
30330
+ namespaceToPropertiesPath as b1,
30331
+ processValueMapping as b2,
30332
+ renderSkeletonCaptionText as b3,
30333
+ renderSkeletonIcon as b4,
30334
+ renderSkeletonImageThumbnail as b5,
30335
+ renderSkeletonText as b6,
30336
+ resetPasswordAction as b7,
30337
+ resolveEntityAction as b8,
30338
+ resolveEntityView as b9,
30339
+ sanitizeUrl as ba,
30340
+ unflattenObject as bb,
30341
+ useApp as bc,
30342
+ useBreadcrumbsController as bd,
30343
+ useBuildCollectionRegistryController as be,
30344
+ useBuildNavigationStateController as bf,
30345
+ useBuildSideEntityController as bg,
30346
+ useBuildUrlController as bh,
30347
+ useCMSContext as bi,
30348
+ useClearRestoreValue as bj,
30349
+ useCollectionEditorController as bk,
30350
+ useCollectionRegistryController as bl,
30351
+ useCollectionsConfigController as bm,
30352
+ useEntitySelectionDialog as bn,
30353
+ useImportConfig as bo,
30354
+ useLocalCollectionsConfigController as bp,
30355
+ useNavigationStateController as bq,
30356
+ useResolvedCollections as br,
30357
+ useResolvedViews as bs,
30358
+ useSelectionController as bt,
30359
+ useSideDialogsController as bu,
30360
+ useSideEntityController as bv,
30361
+ useTopLevelNavigation as bw,
30362
+ useUrlController as bx,
30363
+ validateCollectionJson as by,
30364
+ zodToFormErrors as bz,
30856
30365
  ArrayEnumPreview as c,
30857
30366
  ArrayOfReferencesFieldBinding as d,
30858
30367
  ArrayOfReferencesPreview as e,
@@ -30878,4 +30387,4 @@ export {
30878
30387
  EntityCollectionTable as y,
30879
30388
  EntityCollectionView as z
30880
30389
  };
30881
- //# sourceMappingURL=util-ZM9gQuCv.js.map
30390
+ //# sourceMappingURL=util-0GYaJqL_.js.map