@firecms/core 3.0.0-alpha.15 → 3.0.0-alpha.17

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 (28) hide show
  1. package/dist/components/Chip.d.ts +1 -0
  2. package/dist/core/Scaffold.d.ts +1 -1
  3. package/dist/core/components/CircularProgressCenter.d.ts +4 -1
  4. package/dist/core/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +1 -1
  5. package/dist/core/components/EntityCollectionTable/index.d.ts +1 -1
  6. package/dist/core/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +3 -3
  7. package/dist/core/components/EntityCollectionTable/types.d.ts +1 -9
  8. package/dist/core/components/EntityCollectionTable/useEntityCollectionTableController.d.ts +21 -0
  9. package/dist/core/components/FieldConfigBadge.d.ts +2 -2
  10. package/dist/core/components/HomePage/{FireCMSHomePage.d.ts → DefaultHomePage.d.ts} +1 -1
  11. package/dist/core/components/HomePage/index.d.ts +1 -1
  12. package/dist/core/form_field_configs.d.ts +6 -4
  13. package/dist/core/util/collections.d.ts +1 -13
  14. package/dist/core/util/navigation_from_path.d.ts +1 -1
  15. package/dist/core/util/property_utils.d.ts +2 -2
  16. package/dist/core/util/resolutions.d.ts +2 -1
  17. package/dist/index.es.js +11639 -11544
  18. package/dist/index.es.js.map +1 -1
  19. package/dist/index.umd.js +14 -14
  20. package/dist/index.umd.js.map +1 -1
  21. package/dist/types/collections.d.ts +5 -18
  22. package/dist/types/field_config.d.ts +16 -18
  23. package/dist/types/firecms.d.ts +9 -1
  24. package/dist/types/firecms_context.d.ts +9 -0
  25. package/dist/types/plugins.d.ts +2 -2
  26. package/dist/types/properties.d.ts +6 -0
  27. package/package.json +3 -8
  28. package/dist/core/components/EntityCollectionTable/useCollectionTableController.d.ts +0 -13
@@ -154,23 +154,16 @@ export interface EntityCollection<M extends Record<string, any> = any, Additiona
154
154
  initialSort?: [Extract<keyof M, string>, "asc" | "desc"];
155
155
  /**
156
156
  * Array of builders for rendering additional panels in an entity view.
157
- * Useful if you need to render custom views
157
+ * Useful if you need to render custom views.
158
+ * You can either define the custom view inline or pass a reference to
159
+ * a custom view defined in the main configuration under `entityViews`
158
160
  */
159
- views?: EntityCustomView<M>[];
161
+ entityViews?: (string | EntityCustomView<M>)[];
160
162
  /**
161
163
  * You can add additional fields to the collection view by implementing
162
164
  * an additional field delegate.
163
165
  */
164
166
  additionalFields?: AdditionalFieldDelegate<M, AdditionalKey, UserType>[];
165
- /**
166
- * DEPRECATED: Use `additionalFields` instead
167
- *
168
- * This prop will be removed in the final version
169
- *
170
- * You can add additional fields to the collection view by implementing
171
- * an additional field delegate.
172
- */
173
- additionalColumns?: AdditionalFieldDelegate<M, AdditionalKey, UserType>[];
174
167
  /**
175
168
  * Default size of the rendered collection
176
169
  */
@@ -317,11 +310,6 @@ export interface AdditionalFieldDelegate<M extends Record<string, any> = any, Ad
317
310
  * Width of the generated column in pixels
318
311
  */
319
312
  width?: number;
320
- /**
321
- * DEPRECATED: Use `Builder` instead
322
- * Builder for the content of the cell for this column
323
- */
324
- builder?: React.ComponentType<AdditionalFieldDelegateProps<M, UserType>>;
325
313
  /**
326
314
  * Builder for the content of the cell for this column
327
315
  */
@@ -409,8 +397,7 @@ export type TableController<M extends Record<string, any> = any> = {
409
397
  setPopupCell?: (popupCell?: SelectedCellProps<M>) => void;
410
398
  };
411
399
  export type SelectedCellProps<M extends Record<string, any>> = {
412
- propertyKey: keyof M;
413
- columnIndex: number;
400
+ propertyKey: Extract<keyof M, string>;
414
401
  cellRect: DOMRect;
415
402
  width: number;
416
403
  height: number;
@@ -1,36 +1,34 @@
1
- import { CMSType, DataType, PropertyOrBuilder } from "./properties";
2
- import { FieldProps } from "./fields";
1
+ import React from "react";
2
+ import { CMSType, PropertyOrBuilder } from "./properties";
3
3
  /**
4
4
  * This is the configuration object for the field component generated for a
5
5
  * property.
6
6
  * These configs are generated by default for the properties defined in your
7
- * collections' configuration, but you can define your own to be used
7
+ * collections' configuration, but you can define your own to be used.
8
8
  */
9
9
  export type FieldConfig<T extends CMSType = any> = {
10
+ /**
11
+ * Key used to identify this field type.
12
+ */
13
+ key: string;
10
14
  /**
11
15
  * Name of this field type.
12
16
  * This is not the name of the property.
13
17
  */
14
18
  name: string;
15
19
  /**
16
- * Data type related to this field.
17
- */
18
- dataType: DataType;
19
- /**
20
- * You can define a custom Field component to be used for this field.
21
- * Your custom Field is responsible for rendering the property value
22
- * and updating it when the user changes it.
20
+ * Default config for the property.
21
+ * This property or builder will be used as the base values for the resulting property.
22
+ * You can also use a builder function to generate the base property.
23
+ * You can use a builder function to generate the property based on the values or the path.
24
+ * You can also define a custom Field as a React component to be used for this property.
23
25
  */
24
- Field?: React.ComponentType<FieldProps<T>>;
26
+ property: PropertyOrBuilder<T>;
25
27
  /**
26
- * You can define a default config for the property.
27
- * Whenever this field is used, this property or builder will be used as
28
- * the base values for the resulting property.
29
- * Any props that are defined in the property will override the
30
- * ones specified in `baseProperty`.
31
- * You can also use a builder function to generate the base property.
28
+ * Optional icon to be used in the field selector.
29
+ * Use a 24x24 component, in order not to break the layout.
30
+ * Any FireCMS icon can be used.
32
31
  */
33
- defaultProperty?: PropertyOrBuilder<T>;
34
32
  Icon?: React.ComponentType;
35
33
  /**
36
34
  * CSS color, used only in some plugins like the field selector.
@@ -1,7 +1,7 @@
1
1
  import { User } from "./user";
2
2
  import { AuthController } from "./auth";
3
3
  import { DataSource } from "./datasource";
4
- import { EntityCollection } from "./collections";
4
+ import { EntityCollection, EntityCustomView } from "./collections";
5
5
  import { CMSView } from "./navigation";
6
6
  import { FireCMSContext } from "./firecms_context";
7
7
  import { FieldConfig } from "./field_config";
@@ -79,6 +79,14 @@ export type FireCMSProps<UserType extends User> = {
79
79
  * the `fieldConfig` prop of a property in a collection.
80
80
  */
81
81
  fields?: Record<string, FieldConfig>;
82
+ /**
83
+ * List of additional custom views for entities.
84
+ * You can use the key to reference the custom view in
85
+ * the `entityViews` prop of a collection.
86
+ *
87
+ * You can also define an entity view from the UI.
88
+ */
89
+ entityViews?: EntityCustomView[];
82
90
  /**
83
91
  * Format of the dates in the CMS.
84
92
  * Defaults to 'MMMM dd, yyyy, HH:mm:ss'
@@ -12,6 +12,7 @@ import { SideDialogsController } from "./side_dialogs_controller";
12
12
  import { FireCMSPlugin } from "./plugins";
13
13
  import { CMSAnalyticsEvent } from "./analytics";
14
14
  import { FieldConfig } from "./field_config";
15
+ import { EntityCustomView } from "./collections";
15
16
  /**
16
17
  * Context that includes the internal controllers and contexts used by the app.
17
18
  * Some controllers and context included in this context can be accessed
@@ -83,4 +84,12 @@ export type FireCMSContext<UserType extends User = User, AuthControllerType exte
83
84
  * the `fieldConfig` prop of a property in a collection.
84
85
  */
85
86
  fields: Record<string, FieldConfig>;
87
+ /**
88
+ * List of additional custom views for entities.
89
+ * You can use the key to reference the custom view in
90
+ * the `entityViews` prop of a collection.
91
+ *
92
+ * You can also define an entity view from the UI.
93
+ */
94
+ entityViews?: EntityCustomView[];
86
95
  };
@@ -2,7 +2,6 @@ import React, { PropsWithChildren } from "react";
2
2
  import { FireCMSContext } from "./firecms_context";
3
3
  import { CollectionActionsProps, EntityCollection } from "./collections";
4
4
  import { User } from "./user";
5
- import { FieldConfigId } from "./field_config";
6
5
  import { FieldProps, FormContext } from "./fields";
7
6
  import { CMSType, Property } from "./properties";
8
7
  import { EntityStatus } from "./entities";
@@ -62,6 +61,7 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any> = {
62
61
  props?: PROPS;
63
62
  };
64
63
  homePage?: {
64
+ additionalChildrenStart?: React.ReactNode;
65
65
  /**
66
66
  * Use this component to add custom actions to the navigation card
67
67
  * in the home page.
@@ -117,7 +117,7 @@ export interface PluginFormActionProps<UserType extends User = User> {
117
117
  currentEntityId?: string;
118
118
  }
119
119
  export type PluginFieldBuilderParams<T extends CMSType = CMSType, M extends Record<string, any> = any> = {
120
- fieldConfigId: FieldConfigId;
120
+ fieldConfigId: string;
121
121
  propertyKey: string;
122
122
  property: Property<T> | ResolvedProperty<T>;
123
123
  Field: React.ComponentType<FieldProps<T, any, M>>;
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { FieldProps } from "./fields";
2
3
  import { PropertyPreviewProps } from "../preview";
3
4
  import { ChipColorKey, ChipColorScheme } from "./colors";
@@ -97,6 +98,11 @@ export interface BaseProperty<T extends CMSType, CustomProps = any> {
97
98
  * This value will be set by default for new entities.
98
99
  */
99
100
  defaultValue?: T;
101
+ /**
102
+ * Should this property be editable. If set to true, the user will be able to modify the property and
103
+ * save the new config. The saved config will then become the source of truth.
104
+ */
105
+ editable?: boolean;
100
106
  }
101
107
  /**
102
108
  * @category Entity properties
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
- "version": "3.0.0-alpha.15",
3
+ "version": "3.0.0-alpha.17",
4
4
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
5
5
  "funding": {
6
6
  "url": "https://github.com/sponsors/firecmsco"
@@ -20,11 +20,6 @@
20
20
  "import": "./dist/index.es.js",
21
21
  "require": "./dist/index.umd.js",
22
22
  "types": "./dist/index.d.ts"
23
- },
24
- "./components": {
25
- "import": "./dist/components/index.es.js",
26
- "require": "./dist/components/index.umd.js",
27
- "types": "./dist/components/index.d.ts"
28
23
  }
29
24
  },
30
25
  "keywords": [
@@ -52,7 +47,7 @@
52
47
  "@fontsource/ibm-plex-mono": "^5.0.8",
53
48
  "@fontsource/roboto": "^5.0.8",
54
49
  "@hello-pangea/dnd": "^16.3.0",
55
- "@material-design-icons/font": "latest",
50
+ "@material-design-icons/font": "^0.14.13",
56
51
  "@radix-ui/react-checkbox": "^1.0.4",
57
52
  "@radix-ui/react-collapsible": "^1.0.3",
58
53
  "@radix-ui/react-dialog": "^1.0.5",
@@ -135,7 +130,7 @@
135
130
  "files": [
136
131
  "dist"
137
132
  ],
138
- "gitHead": "f94cd1f1f796c317827ca3afdbcf504a40647986",
133
+ "gitHead": "3a2be58e39f08f1c1fe0d993acfab648e0513c53",
139
134
  "publishConfig": {
140
135
  "access": "public"
141
136
  }
@@ -1,13 +0,0 @@
1
- import { Entity, EntityCollection, FilterValues, TableController, User } from "../../../types";
2
- export type CollectionTableControllerProps<M extends Record<string, any> = any> = {
3
- fullPath: string;
4
- collection: EntityCollection<M>;
5
- /**
6
- * List of entities that will be displayed on top, no matter the ordering.
7
- * This is used for reference fields selection
8
- */
9
- entitiesDisplayedFirst?: Entity<M>[];
10
- lastDeleteTimestamp?: number;
11
- forceFilter?: FilterValues<string>;
12
- };
13
- export declare function useCollectionTableController<M extends Record<string, any> = any, UserType extends User = User>({ fullPath, collection, entitiesDisplayedFirst, lastDeleteTimestamp, forceFilter: forceFilterFromProps }: CollectionTableControllerProps<M>): TableController<M>;