@firecms/core 3.0.0-alpha.57 → 3.0.0-alpha.58

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 (32) hide show
  1. package/dist/components/EntityCollectionTable/internal/default_entity_actions.d.ts +1 -0
  2. package/dist/{form/components → components}/LabelWithIcon.d.ts +1 -2
  3. package/dist/{form/components → components}/ReferenceWidget.d.ts +1 -1
  4. package/dist/components/index.d.ts +2 -0
  5. package/dist/form/components/index.d.ts +0 -1
  6. package/dist/index.es.js +3145 -2964
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/index.umd.js +5 -5
  9. package/dist/index.umd.js.map +1 -1
  10. package/dist/types/firecms_context.d.ts +9 -9
  11. package/package.json +3 -3
  12. package/src/components/EntityCollectionTable/internal/default_entity_actions.tsx +17 -2
  13. package/src/{form/components → components}/LabelWithIcon.tsx +1 -2
  14. package/src/{form/components → components}/ReferenceWidget.tsx +6 -6
  15. package/src/components/index.tsx +2 -0
  16. package/src/form/components/index.tsx +0 -1
  17. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +2 -1
  18. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +2 -1
  19. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -1
  20. package/src/form/field_bindings/DateTimeFieldBinding.tsx +2 -1
  21. package/src/form/field_bindings/KeyValueFieldBinding.tsx +3 -1
  22. package/src/form/field_bindings/MapFieldBinding.tsx +2 -1
  23. package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -1
  24. package/src/form/field_bindings/MultiSelectBinding.tsx +2 -1
  25. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -1
  26. package/src/form/field_bindings/ReferenceFieldBinding.tsx +2 -1
  27. package/src/form/field_bindings/RepeatFieldBinding.tsx +2 -1
  28. package/src/form/field_bindings/SelectFieldBinding.tsx +2 -1
  29. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +2 -1
  30. package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
  31. package/src/form/field_bindings/TextFieldBinding.tsx +2 -1
  32. package/src/types/firecms_context.tsx +10 -11
@@ -22,15 +22,6 @@ import { DialogsController } from "./dialogs_controller";
22
22
  * @see useFireCMSContext
23
23
  */
24
24
  export type FireCMSContext<UserType extends User = User, AuthControllerType extends AuthController<UserType> = AuthController<UserType>> = {
25
- /**
26
- * Format of the dates in the CMS.
27
- * Defaults to 'MMMM dd, yyyy, HH:mm:ss'
28
- */
29
- dateTimeFormat?: string;
30
- /**
31
- * Locale of the CMS, currently only affecting dates
32
- */
33
- locale?: Locale;
34
25
  /**
35
26
  * Connector to your database, e.g. your Firestore database
36
27
  */
@@ -99,6 +90,15 @@ export type FireCMSContext<UserType extends User = User, AuthControllerType exte
99
90
  * You can also define an entity view from the UI.
100
91
  */
101
92
  entityViews?: EntityCustomView[];
93
+ /**
94
+ * Format of the dates in the CMS.
95
+ * Defaults to 'MMMM dd, yyyy, HH:mm:ss'
96
+ */
97
+ dateTimeFormat?: string;
98
+ /**
99
+ * Locale of the CMS, currently only affecting dates
100
+ */
101
+ locale?: Locale;
102
102
  components?: {
103
103
  /**
104
104
  * Component to render when a reference is missing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
- "version": "3.0.0-alpha.57",
3
+ "version": "3.0.0-alpha.58",
4
4
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
5
5
  "funding": {
6
6
  "url": "https://github.com/sponsors/firecmsco"
@@ -45,7 +45,7 @@
45
45
  "generateIcons": "ts-node --esm src/icons/generateIcons.ts"
46
46
  },
47
47
  "dependencies": {
48
- "@firecms/ui": "^3.0.0-alpha.57",
48
+ "@firecms/ui": "^3.0.0-alpha.58",
49
49
  "@fontsource/ibm-plex-mono": "^5.0.8",
50
50
  "@fontsource/roboto": "^5.0.8",
51
51
  "@hello-pangea/dnd": "^16.5.0",
@@ -116,7 +116,7 @@
116
116
  "dist",
117
117
  "src"
118
118
  ],
119
- "gitHead": "81bd430a1a5f6d5365ae4dcab7290e7b8107832e",
119
+ "gitHead": "64c77fec3109f226216fe452ab828c9fcca6f7c8",
120
120
  "publishConfig": {
121
121
  "access": "public"
122
122
  }
@@ -1,6 +1,6 @@
1
1
  import { EntityAction } from "../../../types";
2
2
  import { DeleteEntityDialog } from "./DeleteEntityDialog";
3
- import { ArchiveIcon, DeleteIcon, FileCopyIcon, KeyboardTabIcon } from "@firecms/ui";
3
+ import { ArchiveIcon, DeleteIcon, FileCopyIcon, KeyboardTabIcon, OpenInNewIcon } from "@firecms/ui";
4
4
 
5
5
  export const editEntityAction: EntityAction = {
6
6
  icon: <KeyboardTabIcon/>,
@@ -61,12 +61,27 @@ export const archiveEntityAction: EntityAction = {
61
61
  onClick({
62
62
  entity,
63
63
  collection,
64
- context,
64
+ context: {
65
+ dataSource,
66
+ }
65
67
  }): Promise<void> {
66
68
  // Add your code here
67
69
  return Promise.resolve(undefined);
68
70
  }
69
71
  }
72
+ export const openWebsiteAction: EntityAction = {
73
+ icon: <OpenInNewIcon/>,
74
+ name: "See in website",
75
+ onClick({
76
+ entity,
77
+ collection,
78
+ context,
79
+ }): Promise<void> {
80
+ // open a new tab
81
+ window.open(`https://example.com/${entity.id}`, "_blank");
82
+ return Promise.resolve(undefined);
83
+ }
84
+ }
70
85
 
71
86
  export const deleteEntityAction: EntityAction = {
72
87
  icon: <DeleteIcon/>,
@@ -9,8 +9,7 @@ interface LabelWithIconProps {
9
9
  }
10
10
 
11
11
  /**
12
- * Render the label of a form field for a given property, with the corresponding
13
- * icon.
12
+ * Render the label of with an icon and the title of a property
14
13
  * @group Form custom fields
15
14
  */
16
15
  export function LabelWithIcon({
@@ -1,16 +1,16 @@
1
1
  import React, { useCallback, useMemo } from "react";
2
2
 
3
- import { Entity, EntityCollection, EntityReference, FilterValues, ResolvedProperty } from "../../types";
4
- import { getReferenceFrom, getReferencePreviewKeys } from "../../util";
5
- import { PropertyPreview, SkeletonPropertyComponent } from "../../preview";
6
- import { LabelWithIcon } from "../components";
3
+ import { Entity, EntityCollection, EntityReference, FilterValues, ResolvedProperty } from "../types";
4
+ import { getReferenceFrom, getReferencePreviewKeys } from "../util";
5
+ import { PropertyPreview, SkeletonPropertyComponent } from "../preview";
7
6
  import {
8
7
  useEntityFetch,
9
8
  useFireCMSContext,
10
9
  useNavigationController,
11
10
  useReferenceDialog,
12
11
  useSideEntityController
13
- } from "../../hooks";
12
+ } from "../hooks";
13
+ import { LabelWithIcon } from "../components";
14
14
  import {
15
15
  Button,
16
16
  ClearIcon,
@@ -22,7 +22,7 @@ import {
22
22
  Tooltip,
23
23
  Typography
24
24
  } from "@firecms/ui";
25
- import { ErrorBoundary, ErrorView } from "../../components";
25
+ import { ErrorBoundary, ErrorView } from "../components";
26
26
 
27
27
  /**
28
28
  * This field allows selecting reference/s.
@@ -26,3 +26,5 @@ export * from "./FireCMSLogo";
26
26
  export * from "./FireCMSAppBar";
27
27
 
28
28
  export * from "./ArrayContainer";
29
+ export * from "./ReferenceWidget";
30
+ export * from "./LabelWithIcon";
@@ -1,4 +1,3 @@
1
1
  export * from "./FormikArrayContainer";
2
- export * from "./LabelWithIcon";
3
2
  export * from "./SwitchControl";
4
3
  export * from "./FieldHelperText";
@@ -1,10 +1,11 @@
1
1
  import React from "react";
2
2
  import { FieldProps } from "../../types";
3
- import { FieldHelperText, LabelWithIcon } from "../components";
3
+ import { FieldHelperText } from "../components";
4
4
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
5
5
  import { useClearRestoreValue, useFireCMSContext } from "../../hooks";
6
6
  import { ExpandablePanel } from "@firecms/ui";
7
7
  import { getIconForProperty } from "../../util";
8
+ import { LabelWithIcon } from "../../components";
8
9
 
9
10
  /**
10
11
  * Array field used for custom
@@ -1,7 +1,8 @@
1
1
  import React, { useCallback, useMemo } from "react";
2
2
  import { Entity, EntityCollection, EntityReference, FieldProps, ResolvedProperty } from "../../types";
3
3
  import { ReferencePreview } from "../../preview";
4
- import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
4
+ import { FieldHelperText, FormikArrayContainer } from "../components";
5
+ import { LabelWithIcon } from "../../components";
5
6
  import { getIconForProperty, getReferenceFrom } from "../../util";
6
7
 
7
8
  import { useClearRestoreValue, useNavigationController, useReferenceDialog } from "../../hooks";
@@ -2,7 +2,8 @@ import React, { useCallback, useEffect, useState } from "react";
2
2
 
3
3
  import { FastField, FieldProps as FormikFieldProps, useFormikContext } from "formik";
4
4
 
5
- import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
5
+ import { FieldHelperText, FormikArrayContainer } from "../components";
6
+ import { LabelWithIcon } from "../../components";
6
7
  import { useClearRestoreValue } from "../../hooks";
7
8
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
8
9
  import { EnumValuesChip } from "../../preview";
@@ -2,7 +2,8 @@ import React from "react";
2
2
 
3
3
  import { FieldProps } from "../../types";
4
4
 
5
- import { FieldHelperText, LabelWithIcon } from "../components";
5
+ import { FieldHelperText } from "../components";
6
+ import { LabelWithIcon } from "../../components";
6
7
  import { useClearRestoreValue, useFireCMSContext } from "../../hooks";
7
8
  import { getIconForProperty } from "../../util";
8
9
  import { DateTimeField } from "@firecms/ui";
@@ -2,7 +2,9 @@ import React, { useEffect, useState } from "react";
2
2
  import { DataType, EntityReference, FieldProps, GeoPoint } from "../../types";
3
3
 
4
4
  import { ArrayContainer } from "../../components";
5
- import { FieldHelperText, LabelWithIcon } from "../components";
5
+ import { FieldHelperText } from "../components";
6
+
7
+ import { LabelWithIcon } from "../../components";
6
8
  import {
7
9
  AddIcon,
8
10
  ArrowDropDownIcon,
@@ -1,8 +1,9 @@
1
1
  import React from "react";
2
2
  import { FieldProps, Properties, ResolvedProperties } from "../../types";
3
3
 
4
+ import { LabelWithIcon } from "../../components";
4
5
  import { getIconForProperty, isHidden, pick } from "../../util";
5
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText } from "../components";
6
7
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
7
8
  import { ExpandablePanel, InputLabel, Select, SelectItem } from "@firecms/ui";
8
9
 
@@ -4,7 +4,8 @@ import React, { useDeferredValue, useEffect, useRef } from "react";
4
4
  import MarkdownIt from "markdown-it";
5
5
  import MdEditor, { Plugins } from "react-markdown-editor-lite";
6
6
 
7
- import { FieldHelperText, LabelWithIcon } from "../components";
7
+ import { FieldHelperText } from "../components";
8
+ import { LabelWithIcon } from "../../components";
8
9
  import { FieldProps } from "../../types";
9
10
  import { getIconForProperty } from "../../util";
10
11
  import {
@@ -1,7 +1,8 @@
1
1
  import React, { useCallback } from "react";
2
2
 
3
3
  import { EnumType, FieldProps, ResolvedProperty } from "../../types";
4
- import { FieldHelperText, LabelWithIcon } from "../components";
4
+ import { FieldHelperText } from "../components";
5
+ import { LabelWithIcon } from "../../components";
5
6
  import { useClearRestoreValue } from "../../hooks";
6
7
  import { EnumValuesChip } from "../../preview";
7
8
  import { enumToObjectEntries, getIconForProperty, getLabelOrConfigFrom } from "../../util";
@@ -3,7 +3,8 @@ import React from "react";
3
3
  import { Entity, FieldProps } from "../../types";
4
4
 
5
5
  import { PropertyPreview } from "../../preview";
6
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText } from "../components";
7
+ import { LabelWithIcon } from "../../components";
7
8
  import { getIconForProperty } from "../../util";
8
9
  import { cn, paperMixin } from "@firecms/ui";
9
10
  import { ErrorBoundary } from "../../components";
@@ -3,7 +3,8 @@ import React, { useCallback, useMemo } from "react";
3
3
  import { Entity, EntityCollection, EntityReference, FieldProps } from "../../types";
4
4
  import { useClearRestoreValue, useNavigationController, useReferenceDialog } from "../../hooks";
5
5
  import { ReadOnlyFieldBinding } from "./ReadOnlyFieldBinding";
6
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText } from "../components";
7
+ import { LabelWithIcon } from "../../components";
7
8
  import { ReferencePreview } from "../../preview";
8
9
  import { getIconForProperty, getReferenceFrom } from "../../util";
9
10
  import { Button } from "@firecms/ui";
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from "react";
2
2
  import { CMSType, FieldProps, ResolvedProperty } from "../../types";
3
- import { FieldHelperText, FormikArrayContainer, LabelWithIcon } from "../components";
3
+ import { FieldHelperText, FormikArrayContainer } from "../components";
4
+ import { LabelWithIcon } from "../../components";
4
5
  import { useClearRestoreValue } from "../../hooks";
5
6
  import { getIconForProperty } from "../../util";
6
7
  import { PropertyFieldBinding } from "../PropertyFieldBinding";
@@ -1,7 +1,8 @@
1
1
  import React, { useCallback } from "react";
2
2
 
3
3
  import { EnumType, FieldProps } from "../../types";
4
- import { FieldHelperText, LabelWithIcon } from "../components";
4
+ import { FieldHelperText } from "../components";
5
+ import { LabelWithIcon } from "../../components";
5
6
  import { useClearRestoreValue } from "../../hooks";
6
7
  import { EnumValuesChip } from "../../preview";
7
8
  import { getIconForProperty } from "../../util";
@@ -10,7 +10,8 @@ import {
10
10
  } from "../../types";
11
11
  import { useDropzone } from "react-dropzone";
12
12
  import { PreviewSize } from "../../preview";
13
- import { FieldHelperText, LabelWithIcon } from "../components";
13
+ import { FieldHelperText } from "../components";
14
+ import { LabelWithIcon } from "../../components";
14
15
 
15
16
  import { getIconForProperty, isReadOnly } from "../../util";
16
17
  import { useClearRestoreValue, useSnackbarController, useStorageSource } from "../../hooks";
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
2
 
3
3
  import { FieldProps } from "../../types";
4
- import { LabelWithIcon } from "../components";
5
4
  import { useClearRestoreValue } from "../../hooks";
6
5
  import { getIconForProperty } from "../../util";
7
6
  import { FieldHelperText } from "../components/FieldHelperText";
8
7
  import { BooleanSwitchWithLabel } from "@firecms/ui";
8
+ import { LabelWithIcon } from "../../components";
9
9
 
10
10
  type SwitchFieldProps = FieldProps<boolean>;
11
11
 
@@ -1,11 +1,12 @@
1
1
  import React, { useCallback } from "react";
2
2
 
3
3
  import { FieldProps, PreviewType } from "../../types";
4
- import { FieldHelperText, LabelWithIcon } from "../components";
4
+ import { FieldHelperText } from "../components";
5
5
  import { useClearRestoreValue } from "../../hooks";
6
6
  import { getIconForProperty } from "../../util";
7
7
  import { ClearIcon, Collapse, IconButton, TextField } from "@firecms/ui";
8
8
  import { PropertyPreview } from "../../preview";
9
+ import { LabelWithIcon } from "../../components";
9
10
 
10
11
  interface TextFieldProps<T extends string | number> extends FieldProps<T> {
11
12
  allowInfinity?: boolean
@@ -24,17 +24,6 @@ import { DialogsController } from "./dialogs_controller";
24
24
  */
25
25
  export type FireCMSContext<UserType extends User = User, AuthControllerType extends AuthController<UserType> = AuthController<UserType>> = {
26
26
 
27
- /**
28
- * Format of the dates in the CMS.
29
- * Defaults to 'MMMM dd, yyyy, HH:mm:ss'
30
- */
31
- dateTimeFormat?: string;
32
-
33
- /**
34
- * Locale of the CMS, currently only affecting dates
35
- */
36
- locale?: Locale;
37
-
38
27
  /**
39
28
  * Connector to your database, e.g. your Firestore database
40
29
  */
@@ -117,6 +106,16 @@ export type FireCMSContext<UserType extends User = User, AuthControllerType exte
117
106
  */
118
107
  entityViews?: EntityCustomView[];
119
108
 
109
+ /**
110
+ * Format of the dates in the CMS.
111
+ * Defaults to 'MMMM dd, yyyy, HH:mm:ss'
112
+ */
113
+ dateTimeFormat?: string;
114
+
115
+ /**
116
+ * Locale of the CMS, currently only affecting dates
117
+ */
118
+ locale?: Locale;
120
119
 
121
120
  components?: {
122
121