@firecms/core 3.0.0-canary.117 → 3.0.0-canary.119

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,9 +1,10 @@
1
1
  import React from "react";
2
- export declare function DrawerNavigationItem({ name, icon, drawerOpen, tooltipsOpen, url, onClick }: {
2
+ export declare function DrawerNavigationItem({ name, icon, drawerOpen, adminMenuOpen, tooltipsOpen, url, onClick }: {
3
3
  icon: React.ReactElement;
4
4
  name: string;
5
5
  tooltipsOpen: boolean;
6
6
  drawerOpen: boolean;
7
+ adminMenuOpen?: boolean;
7
8
  url: string;
8
9
  onClick?: () => void;
9
10
  }): import("react/jsx-runtime").JSX.Element;
@@ -8,5 +8,5 @@ interface TextFieldBindingProps<T extends string | number> extends FieldProps<T>
8
8
  * and tables to the specified properties.
9
9
  * @group Form fields
10
10
  */
11
- export declare function TextFieldBinding<T extends string | number>({ context, propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, size }: TextFieldBindingProps<T>): import("react/jsx-runtime").JSX.Element;
11
+ export declare function TextFieldBinding<T extends string | number>({ propertyKey, value, setValue, error, showError, disabled, autoFocus, property, includeDescription, size }: TextFieldBindingProps<T>): import("react/jsx-runtime").JSX.Element;
12
12
  export {};
package/dist/index.es.js CHANGED
@@ -5630,7 +5630,7 @@ function ArrayOneOfPreview({
5630
5630
  (value2, index) => /* @__PURE__ */ jsx(
5631
5631
  React__default.Fragment,
5632
5632
  {
5633
- children: /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "m-1 border-b last:border-b-0"), children: /* @__PURE__ */ jsx(ErrorBoundary, { children: value2 && /* @__PURE__ */ jsx(
5633
+ children: /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "m-1 border-b last:border-b-0 py-2"), children: /* @__PURE__ */ jsx(ErrorBoundary, { children: value2 && /* @__PURE__ */ jsx(
5634
5634
  PropertyPreview,
5635
5635
  {
5636
5636
  propertyKey,
@@ -6125,7 +6125,7 @@ function ArrayOfMapsPreview({
6125
6125
  return /* @__PURE__ */ jsx(
6126
6126
  "div",
6127
6127
  {
6128
- className: "border-b last:border-b-0",
6128
+ className: "border-b last:border-b-0 py-2",
6129
6129
  children: mapProperties && mapProperties.map(
6130
6130
  (key) => /* @__PURE__ */ jsx(
6131
6131
  "div",
@@ -6388,8 +6388,6 @@ function VirtualTableSelect(props) {
6388
6388
  className: "w-full h-full p-0 bg-transparent",
6389
6389
  position: "item-aligned",
6390
6390
  disabled,
6391
- padding: false,
6392
- includeFocusOutline: false,
6393
6391
  value: validValue ? internalValue.map((v) => v.toString()) : [],
6394
6392
  onMultiValueChange: onChange,
6395
6393
  renderValue,
@@ -13906,7 +13904,7 @@ function SelectFieldBinding({
13906
13904
  setValue(null);
13907
13905
  }, [setValue]);
13908
13906
  return /* @__PURE__ */ jsxs(Fragment, { children: [
13909
- /* @__PURE__ */ jsx(PropertyIdCopyTooltip, { propertyKey, children: /* @__PURE__ */ jsx(
13907
+ /* @__PURE__ */ jsx(
13910
13908
  Select,
13911
13909
  {
13912
13910
  size: size === "medium" ? "medium" : "small",
@@ -13914,7 +13912,7 @@ function SelectFieldBinding({
13914
13912
  disabled,
13915
13913
  position: "item-aligned",
13916
13914
  inputClassName: cls("w-full"),
13917
- label: /* @__PURE__ */ jsx(
13915
+ label: /* @__PURE__ */ jsx(PropertyIdCopyTooltip, { propertyKey, children: /* @__PURE__ */ jsx(
13918
13916
  LabelWithIcon,
13919
13917
  {
13920
13918
  icon: getIconForProperty(property, "small"),
@@ -13922,7 +13920,7 @@ function SelectFieldBinding({
13922
13920
  title: property.name,
13923
13921
  className: "text-text-secondary dark:text-text-secondary-dark ml-3.5"
13924
13922
  }
13925
- ),
13923
+ ) }),
13926
13924
  endAdornment: property.clearable && /* @__PURE__ */ jsx(
13927
13925
  IconButton,
13928
13926
  {
@@ -13962,7 +13960,7 @@ function SelectFieldBinding({
13962
13960
  );
13963
13961
  })
13964
13962
  }
13965
- ) }),
13963
+ ),
13966
13964
  /* @__PURE__ */ jsx(
13967
13965
  FieldHelperText,
13968
13966
  {
@@ -14647,7 +14645,6 @@ function StorageUpload({
14647
14645
  ) });
14648
14646
  }
14649
14647
  function TextFieldBinding({
14650
- context,
14651
14648
  propertyKey,
14652
14649
  value,
14653
14650
  setValue,
@@ -15276,7 +15273,7 @@ function MapFieldBinding({
15276
15273
  }
15277
15274
  const mapFormView = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "py-1 flex flex-col space-y-2", children: Object.entries(mapProperties).filter(([_, property2]) => !isHidden(property2)).map(
15278
15275
  ([entryKey, childProperty], index) => {
15279
- const fieldProps = {
15276
+ const fieldBindingProps = {
15280
15277
  propertyKey: `${propertyKey}.${entryKey}`,
15281
15278
  disabled,
15282
15279
  property: childProperty,
@@ -15290,7 +15287,7 @@ function MapFieldBinding({
15290
15287
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(
15291
15288
  PropertyFieldBinding,
15292
15289
  {
15293
- ...fieldProps
15290
+ ...fieldBindingProps
15294
15291
  }
15295
15292
  ) }) }, `map-${propertyKey}-${index}`);
15296
15293
  }
@@ -15971,8 +15968,15 @@ function RepeatFieldBinding({
15971
15968
  }) {
15972
15969
  if (!property.of)
15973
15970
  throw Error("RepeatFieldBinding misconfiguration. Property `of` not set");
15974
- if (!property.resolvedProperties || !Array.isArray(property.resolvedProperties))
15975
- throw Error("RepeatFieldBinding - Internal error: Expected array in 'property.resolvedProperties'");
15971
+ let resolvedProperties = property.resolvedProperties;
15972
+ if (!resolvedProperties) {
15973
+ resolvedProperties = getArrayResolvedProperties({
15974
+ propertyValue: value,
15975
+ propertyKey,
15976
+ property,
15977
+ ignoreMissingFields: false
15978
+ });
15979
+ }
15976
15980
  const expanded = property.expanded === void 0 ? true : property.expanded;
15977
15981
  const ofProperty = property.of;
15978
15982
  const [lastAddedId, setLastAddedId] = useState();
@@ -15982,7 +15986,7 @@ function RepeatFieldBinding({
15982
15986
  setValue
15983
15987
  });
15984
15988
  const buildEntry = (index, internalId) => {
15985
- const childProperty = property.resolvedProperties[index] ?? ofProperty;
15989
+ const childProperty = resolvedProperties[index] ?? ofProperty;
15986
15990
  const fieldProps = {
15987
15991
  propertyKey: `${propertyKey}.${index}`,
15988
15992
  disabled,
@@ -16922,6 +16926,22 @@ function resolveProperty({
16922
16926
  resolved: true
16923
16927
  } : null;
16924
16928
  }
16929
+ function getArrayResolvedProperties({
16930
+ propertyKey,
16931
+ propertyValue,
16932
+ property,
16933
+ ...props
16934
+ }) {
16935
+ const of = property.of;
16936
+ return Array.isArray(propertyValue) ? propertyValue.map((v, index) => {
16937
+ return resolveProperty({
16938
+ propertyKey: `${propertyKey}.${index}`,
16939
+ propertyOrBuilder: of,
16940
+ ...props,
16941
+ index
16942
+ });
16943
+ }).filter((e) => Boolean(e)) : [];
16944
+ }
16925
16945
  function resolveArrayProperty({
16926
16946
  propertyKey,
16927
16947
  property,
@@ -16947,15 +16967,13 @@ function resolveArrayProperty({
16947
16967
  };
16948
16968
  } else {
16949
16969
  const of = property.of;
16950
- const resolvedProperties = Array.isArray(propertyValue) ? propertyValue.map((v, index) => {
16951
- return resolveProperty({
16952
- propertyKey: `${propertyKey}.${index}`,
16953
- propertyOrBuilder: of,
16954
- ignoreMissingFields,
16955
- ...props,
16956
- index
16957
- });
16958
- }).filter((e) => Boolean(e)) : [];
16970
+ const resolvedProperties = getArrayResolvedProperties({
16971
+ propertyValue,
16972
+ propertyKey,
16973
+ property,
16974
+ ignoreMissingFields,
16975
+ ...props
16976
+ });
16959
16977
  const ofProperty = resolveProperty({
16960
16978
  propertyOrBuilder: of,
16961
16979
  ignoreMissingFields,
@@ -19346,6 +19364,7 @@ function DrawerNavigationItem({
19346
19364
  name,
19347
19365
  icon,
19348
19366
  drawerOpen,
19367
+ adminMenuOpen,
19349
19368
  tooltipsOpen,
19350
19369
  url,
19351
19370
  onClick
@@ -19394,7 +19413,7 @@ function DrawerNavigationItem({
19394
19413
  return /* @__PURE__ */ jsx(
19395
19414
  Tooltip,
19396
19415
  {
19397
- open: drawerOpen ? false : tooltipsOpen,
19416
+ open: drawerOpen || adminMenuOpen ? false : tooltipsOpen,
19398
19417
  side: "right",
19399
19418
  title: name,
19400
19419
  children: listItem
@@ -19411,12 +19430,12 @@ function DefaultDrawer({
19411
19430
  closeDrawer,
19412
19431
  logo
19413
19432
  } = useApp();
19433
+ const [adminMenuOpen, setAdminMenuOpen] = React__default.useState(false);
19414
19434
  const analyticsController = useAnalyticsController();
19415
19435
  const navigation = useNavigationController();
19416
- const tooltipsOpen = drawerHovered && !drawerOpen;
19436
+ const tooltipsOpen = drawerHovered && !drawerOpen && !adminMenuOpen;
19417
19437
  const largeLayout = useLargeLayout();
19418
19438
  const navigate = useNavigate();
19419
- const [adminMenuOpen, setAdminMenuOpen] = React__default.useState(false);
19420
19439
  if (!navigation.topLevelNavigation)
19421
19440
  throw Error("Navigation not ready in Drawer");
19422
19441
  const {
@@ -19461,6 +19480,7 @@ function DefaultDrawer({
19461
19480
  {
19462
19481
  icon: /* @__PURE__ */ jsx(IconForView, { collectionOrView: view.collection ?? view.view }),
19463
19482
  tooltipsOpen,
19483
+ adminMenuOpen,
19464
19484
  drawerOpen,
19465
19485
  onClick: () => onClick(view),
19466
19486
  url: view.url,
@@ -19475,6 +19495,7 @@ function DefaultDrawer({
19475
19495
  adminViews.length > 0 && /* @__PURE__ */ jsx(
19476
19496
  Menu,
19477
19497
  {
19498
+ side: "right",
19478
19499
  open: adminMenuOpen,
19479
19500
  onOpenChange: setAdminMenuOpen,
19480
19501
  trigger: /* @__PURE__ */ jsxs(
@@ -19787,6 +19808,7 @@ export {
19787
19808
  enumToObjectEntries,
19788
19809
  flattenObject,
19789
19810
  fullPathToCollectionSegments,
19811
+ getArrayResolvedProperties,
19790
19812
  getArrayValuesCount,
19791
19813
  getBracketNotation,
19792
19814
  getCollectionByPathOrId,