@rebasepro/admin 0.12.0 → 0.12.1-canary.gdfba2a1

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.
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { $t as CollectionTableBinding, A as getFieldId, Ct as convertDataToEntity, Dt as useImportConfig, Et as getInferenceType, Ft as FieldCaption, In as useCollectionRegistryController, Nt as PropertyConfigBadge, Ot as ImportSaveInProgress, Pt as SearchIconsView, St as DataNewPropertiesMapping, Zt as useSelectionController, _ as useCollectionsConfigController, i as namespaceToPropertiesOrderPath, in as useUrlController, k as getFieldConfig, kt as ImportFileUpload, l as validateCollectionJson, m as toSerializableCollectionConfig, n as getFullIdPath, o as CollectionGenerationApiError, on as useNavigationStateController, r as idToPropertiesPath, t as getFullId, vt as useCollectionEditorController, xt as ImportNewPropertyFieldPreview } from "./util-B5fJm1FA.js";
3
- import { a as updatePropertyFromWidget, c as useAIModifiedPaths, i as supportedFields, l as useSafeSnackbarController, n as PropertyForm, o as PropertyTree, r as PropertyFormDialog, s as AIModifiedPathsProvider } from "./PropertyEditView-DH3XZC2x.js";
2
+ import { $t as CollectionTableBinding, A as getFieldId, Ct as convertDataToEntity, Dt as useImportConfig, Et as getInferenceType, Ft as FieldCaption, In as useCollectionRegistryController, Nt as PropertyConfigBadge, Ot as ImportSaveInProgress, Pt as SearchIconsView, St as DataNewPropertiesMapping, Zt as useSelectionController, _ as useCollectionsConfigController, i as namespaceToPropertiesOrderPath, in as useUrlController, k as getFieldConfig, kt as ImportFileUpload, l as validateCollectionJson, m as toSerializableCollectionConfig, n as getFullIdPath, o as CollectionGenerationApiError, on as useNavigationStateController, r as idToPropertiesPath, t as getFullId, vt as useCollectionEditorController, xt as ImportNewPropertyFieldPreview } from "./util-BwZuV81o.js";
3
+ import { a as updatePropertyFromWidget, c as useAIModifiedPaths, i as supportedFields, l as useSafeSnackbarController, n as PropertyForm, o as PropertyTree, r as PropertyFormDialog, s as AIModifiedPathsProvider } from "./PropertyEditView-D2b9_nbC.js";
4
4
  import * as React$1 from "react";
5
5
  import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { Alert, AppWindow, ArrowLeftIcon, BooleanSwitchWithLabel, Button, Card, CheckIcon, Chip, CircularProgress, CircularProgressCenter, CodeIcon, ColumnsIcon, Container, CopyIcon, DebouncedTextField, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, FileIcon, FileSearchIcon, FileTextIcon, IconButton, KanbanIcon, KeyIcon, LayoutGridIcon, ListIcon, LoadingButton, Menu, MultiSelect, MultiSelectItem, PanelLeftIcon, Paper, PlusIcon, Select, SelectItem, ShoppingCartIcon, SquareIcon, Tab, TableIcon, Tabs, TextField, ToggleButtonGroup, Tooltip, Trash2Icon, Typography, UserIcon, XIcon, cls, coolIconKeys, defaultBorderMixin, iconSize } from "@rebasepro/ui";
@@ -875,7 +875,8 @@ function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyE
875
875
  return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));
876
876
  };
877
877
  const updatePropertiesOrder = (newPropertiesOrder, namespace) => {
878
- setFieldValue(namespaceToPropertiesOrderPath(namespace), newPropertiesOrder, false);
878
+ const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);
879
+ setFieldValue(propertiesOrderPath, newPropertiesOrder, false);
879
880
  currentPropertiesOrderRef.current[namespace ?? ""] = newPropertiesOrder;
880
881
  };
881
882
  const deleteProperty = (propertyKey, namespace) => {
@@ -884,7 +885,10 @@ function CollectionPropertiesEditorForm({ showErrors, isNewCollection, propertyE
884
885
  if (!fullId) throw Error("collection editor miss config");
885
886
  setFieldValue(idToPropertiesPath(fullId), void 0, false);
886
887
  const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);
887
- if (currentPropertiesOrder) updatePropertiesOrder(currentPropertiesOrder.filter((p) => p !== propertyKey), namespace);
888
+ if (currentPropertiesOrder) {
889
+ const newPropertiesOrder = currentPropertiesOrder.filter((p) => p !== propertyKey);
890
+ updatePropertiesOrder(newPropertiesOrder, namespace);
891
+ }
888
892
  setNewPropertyDialogOpen(false);
889
893
  setSelectedPropertyIndex(void 0);
890
894
  setSelectedPropertyKey(void 0);
@@ -1177,7 +1181,8 @@ function CollectionJsonImportDialog({ open, onClose, onImport }) {
1177
1181
  setErrors([]);
1178
1182
  return;
1179
1183
  }
1180
- setErrors(validateCollectionJson(value).errors);
1184
+ const result = validateCollectionJson(value);
1185
+ setErrors(result.errors);
1181
1186
  }, []);
1182
1187
  const handleImport = useCallback(() => {
1183
1188
  const result = validateCollectionJson(jsonValue);
@@ -2077,7 +2082,8 @@ function CollectionEditorImportMapping({ importConfig, propertyConfigs }) {
2077
2082
  return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));
2078
2083
  };
2079
2084
  const updatePropertiesOrder = (newPropertiesOrder, namespace) => {
2080
- setFieldValue(namespaceToPropertiesOrderPath(namespace), newPropertiesOrder, false);
2085
+ const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);
2086
+ setFieldValue(propertiesOrderPath, newPropertiesOrder, false);
2081
2087
  currentPropertiesOrderRef.current[namespace ?? ""] = newPropertiesOrder;
2082
2088
  };
2083
2089
  if (previousId && previousId !== id) {
@@ -2400,7 +2406,7 @@ function CollectionRLSTab() {
2400
2406
  if (Array.isArray(res)) return res;
2401
2407
  return [];
2402
2408
  };
2403
- setDbPolicies(extractRows(result).map((p) => {
2409
+ const policies = extractRows(result).map((p) => {
2404
2410
  let parsedRoles = [];
2405
2411
  const r = p.roles || p.ROLES;
2406
2412
  if (Array.isArray(r)) parsedRoles = r;
@@ -2414,7 +2420,8 @@ function CollectionRLSTab() {
2414
2420
  qual: p.qual || p.QUAL || null,
2415
2421
  with_check: p.with_check || p.WITH_CHECK || null
2416
2422
  };
2417
- }));
2423
+ });
2424
+ setDbPolicies(policies);
2418
2425
  } catch (e) {
2419
2426
  console.error("Failed to fetch DB policies", e);
2420
2427
  } finally {
@@ -2684,7 +2691,7 @@ function InlinePolicyEditor({ policy, table, availableRoles, rolesUnavailable, o
2684
2691
  * from what users hold, so a role that is referenced here but assigned to
2685
2692
  * nobody would otherwise vanish from its own policy on the next save.
2686
2693
  */
2687
- const roleOptions = useMemo(() => Array.from(new Set([...availableRoles, ...roles])).sort(), [availableRoles, roles]);
2694
+ const roleOptions = useMemo(() => Array.from(/* @__PURE__ */ new Set([...availableRoles, ...roles])).sort(), [availableRoles, roles]);
2688
2695
  const addCustomRole = () => {
2689
2696
  const trimmed = customRole.trim();
2690
2697
  if (!trimmed || roles.includes(trimmed)) {
@@ -3371,10 +3378,11 @@ function CollectionEditorInternal({ isNewCollection, configController, editedCol
3371
3378
  showErrors: submitCount > 0,
3372
3379
  isNewCollection,
3373
3380
  onPropertyError: (propertyKey, namespace, error) => {
3374
- propertyErrorsRef.current = removeUndefined({
3381
+ const current = removeUndefined({
3375
3382
  ...propertyErrorsRef.current,
3376
3383
  [getFullIdPath(propertyKey, namespace)]: removeUndefined(error, true)
3377
3384
  }, true);
3385
+ propertyErrorsRef.current = current;
3378
3386
  formController.validate();
3379
3387
  },
3380
3388
  getUser,
@@ -3537,4 +3545,4 @@ var validateId = (value, isNewCollection, existingPaths, existingIds) => {
3537
3545
  //#endregion
3538
3546
  export { CollectionEditorDialog as n, CollectionEditorDialog_exports as r, CollectionEditor as t };
3539
3547
 
3540
- //# sourceMappingURL=CollectionEditorDialog-Dpc75wIZ.js.map
3548
+ //# sourceMappingURL=CollectionEditorDialog-B8j6HArJ.js.map