@firecms/core 3.0.0-alpha.73 → 3.0.0-alpha.74

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 (54) hide show
  1. package/dist/components/{EntityCollectionTable/internal/DeleteEntityDialog.d.ts → DeleteEntityDialog.d.ts} +1 -1
  2. package/dist/components/EntityCollectionTable/{internal/EntityCollectionRowActions.d.ts → EntityCollectionRowActions.d.ts} +3 -3
  3. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  4. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +3 -3
  5. package/dist/components/EntityCollectionTable/{internal/PropertyTableCell.d.ts → PropertyTableCell.d.ts} +2 -2
  6. package/dist/components/EntityCollectionTable/SimpleEntityCollectionTable.d.ts +95 -0
  7. package/dist/components/EntityCollectionTable/column_utils.d.ts +16 -0
  8. package/dist/components/EntityCollectionTable/index.d.ts +4 -0
  9. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -1
  10. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
  11. package/dist/components/EntityCollectionTable/types.d.ts +2 -2
  12. package/dist/components/EntityCollectionTable/useDataSourceEntityCollectionTableController.d.ts +3 -3
  13. package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +2 -2
  14. package/dist/components/VirtualTable/VirtualTableCell.d.ts +1 -1
  15. package/dist/components/VirtualTable/VirtualTableProps.d.ts +2 -3
  16. package/dist/components/VirtualTable/types.d.ts +1 -1
  17. package/dist/form/components/FieldHelperText.d.ts +1 -1
  18. package/dist/index.es.js +3505 -3304
  19. package/dist/index.es.js.map +1 -1
  20. package/dist/index.umd.js +5 -5
  21. package/dist/index.umd.js.map +1 -1
  22. package/dist/types/collections.d.ts +2 -2
  23. package/dist/types/plugins.d.ts +2 -0
  24. package/package.json +3 -3
  25. package/src/components/{EntityCollectionTable/internal/DeleteEntityDialog.tsx → DeleteEntityDialog.tsx} +4 -4
  26. package/src/components/EntityCollectionTable/{internal/EntityCollectionRowActions.tsx → EntityCollectionRowActions.tsx} +4 -4
  27. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +13 -48
  28. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +3 -3
  29. package/src/components/EntityCollectionTable/{internal/PropertyTableCell.tsx → PropertyTableCell.tsx} +19 -18
  30. package/src/components/EntityCollectionTable/SimpleEntityCollectionTable.tsx +369 -0
  31. package/src/components/EntityCollectionTable/column_utils.tsx +74 -0
  32. package/src/components/EntityCollectionTable/index.tsx +4 -0
  33. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +1 -1
  34. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +1 -2
  35. package/src/components/EntityCollectionTable/internal/default_entity_actions.tsx +1 -1
  36. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +18 -18
  37. package/src/components/EntityCollectionTable/types.tsx +2 -2
  38. package/src/components/EntityCollectionTable/useDataSourceEntityCollectionTableController.tsx +3 -3
  39. package/src/components/EntityCollectionView/EntityCollectionView.tsx +4 -4
  40. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +2 -2
  41. package/src/components/ReferenceSelectionInner.tsx +1 -1
  42. package/src/components/VirtualTable/VirtualTableCell.tsx +9 -13
  43. package/src/components/VirtualTable/VirtualTableProps.tsx +3 -4
  44. package/src/components/VirtualTable/types.tsx +1 -1
  45. package/src/core/FireCMS.tsx +2 -2
  46. package/src/form/EntityForm.tsx +2 -4
  47. package/src/form/PropertyFieldBinding.tsx +2 -0
  48. package/src/form/components/FieldHelperText.tsx +2 -2
  49. package/src/form/field_bindings/DateTimeFieldBinding.tsx +2 -1
  50. package/src/form/field_bindings/MapFieldBinding.tsx +3 -9
  51. package/src/internal/useBuildSideEntityController.tsx +1 -0
  52. package/src/preview/components/BooleanPreview.tsx +1 -1
  53. package/src/types/collections.ts +2 -2
  54. package/src/types/plugins.tsx +4 -2
@@ -1,4 +1,4 @@
1
- import { Entity, EntityCallbacks, EntityCollection } from "../../../types";
1
+ import { Entity, EntityCallbacks, EntityCollection } from "../types";
2
2
  export interface DeleteEntityDialogProps<M extends Record<string, any>> {
3
3
  entityOrEntitiesToDelete?: Entity<M> | Entity<M>[];
4
4
  path: string;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../../types";
2
+ import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../types";
3
3
  /**
4
4
  *
5
5
  * @param entity
@@ -19,12 +19,12 @@ import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionContro
19
19
  */
20
20
  export declare const EntityCollectionRowActions: React.NamedExoticComponent<{
21
21
  entity: Entity<any>;
22
- collection?: EntityCollection<any, import("../../../types").User> | undefined;
22
+ collection?: EntityCollection<any, import("../../types").User> | undefined;
23
23
  fullPath?: string | undefined;
24
24
  width: number;
25
25
  frozen?: boolean | undefined;
26
26
  size: CollectionSize;
27
- isSelected: boolean;
27
+ isSelected?: boolean | undefined;
28
28
  selectionEnabled?: boolean | undefined;
29
29
  actions?: EntityAction[] | undefined;
30
30
  hideId?: boolean | undefined;
@@ -18,7 +18,7 @@ export declare const useEntityCollectionTableController: () => EntityCollectionT
18
18
  * options you see in collections in the top level navigation, you can
19
19
  * check {@link EntityCollectionView}.
20
20
  *
21
- * The data displayed in the table is managed by a {@link TableController}.
21
+ * The data displayed in the table is managed by a {@link EntityTableController}.
22
22
  * You can build the default, bound to a path in the datasource, by using the hook
23
23
  * {@link useDataSourceEntityCollectionTableController}
24
24
  *
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { AdditionalFieldDelegate, CollectionSize, Entity, FilterValues, ResolvedProperties, ResolvedProperty, SelectionController, TableController, User } from "../../types";
2
+ import { AdditionalFieldDelegate, CollectionSize, Entity, FilterValues, ResolvedProperties, ResolvedProperty, SelectionController, EntityTableController, User } from "../../types";
3
3
  import { OnCellValueChange, UniqueFieldValidator } from "./types";
4
4
  /**
5
5
  * @group Collection components
@@ -69,9 +69,9 @@ export type EntityCollectionTableProps<M extends Record<string, any>, UserType e
69
69
  /**
70
70
  * Controller holding the logic for the table
71
71
  * {@link useDataSourceEntityCollectionTableController}
72
- * {@link TableController}
72
+ * {@link EntityTableController}
73
73
  */
74
- tableController: TableController<M>;
74
+ tableController: EntityTableController<M>;
75
75
  displayedColumnIds: PropertyColumnConfig[];
76
76
  forceFilter?: FilterValues<Extract<keyof M, string>>;
77
77
  textSearchEnabled?: boolean;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { CMSType, Entity, ResolvedProperty } from "../../../types";
3
- import { CustomFieldValidator } from "../../../form/validation";
2
+ import { CMSType, Entity, ResolvedProperty } from "../../types";
3
+ import { CustomFieldValidator } from "../../form/validation";
4
4
  export interface PropertyTableCellProps<T extends CMSType, M extends Record<string, any>> {
5
5
  propertyKey: string;
6
6
  columnIndex: number;
@@ -0,0 +1,95 @@
1
+ import React from "react";
2
+ import { CollectionSize, Entity, EntityTableController, FilterValues } from "../../types";
3
+ import { CellRendererParams, VirtualTableColumn } from "../VirtualTable";
4
+ import { OnCellValueChange } from "./types";
5
+ import { OnColumnResizeParams } from "./EntityCollectionTableProps";
6
+ export type SimpleEntityCollectionTableProps<M extends Record<string, any>> = {
7
+ /**
8
+ * List of entities that will be displayed as selected;
9
+ */
10
+ highlightedEntities?: Entity<M>[];
11
+ /**
12
+ * Override the title in the toolbar
13
+ */
14
+ title?: React.ReactNode;
15
+ /**
16
+ * Callback when a cell value changes.
17
+ */
18
+ onValueChange?: OnCellValueChange<any, M>;
19
+ columns: VirtualTableColumn[];
20
+ cellRenderer: React.ComponentType<CellRendererParams<Entity<M>>>;
21
+ /**
22
+ * Builder for creating the buttons in each row
23
+ * @param entity
24
+ * @param size
25
+ */
26
+ tableRowActionsBuilder?: (params: {
27
+ entity: Entity<M>;
28
+ size: CollectionSize;
29
+ width: number;
30
+ frozen?: boolean;
31
+ }) => React.ReactNode;
32
+ /**
33
+ * Callback when anywhere on the table is clicked
34
+ */
35
+ onEntityClick?(entity: Entity<M>): void;
36
+ /**
37
+ * Callback when a column is resized
38
+ */
39
+ onColumnResize?(params: OnColumnResizeParams): void;
40
+ /**
41
+ * Callback when the selected size of the table is changed
42
+ */
43
+ onSizeChanged?(size: CollectionSize): void;
44
+ /**
45
+ * Should apply a different style to a row when hovering
46
+ */
47
+ hoverRow?: boolean;
48
+ /**
49
+ * Additional component that renders actions such as buttons in the
50
+ * collection toolbar, displayed on the left side
51
+ */
52
+ actionsStart?: React.ReactNode;
53
+ /**
54
+ * Additional component that renders actions such as buttons in the
55
+ * collection toolbar, displayed on the right side
56
+ */
57
+ actions?: React.ReactNode;
58
+ /**
59
+ * Controller holding the logic for the table
60
+ * {@link useDataSourceEntityCollectionTableController}
61
+ * {@link EntityTableController}
62
+ */
63
+ tableController: EntityTableController<M>;
64
+ filterable?: boolean;
65
+ sortable?: boolean;
66
+ inlineEditing?: boolean;
67
+ textSearchEnabled?: boolean;
68
+ emptyComponent?: React.ReactNode;
69
+ forceFilter?: FilterValues<keyof M extends string ? keyof M : never>;
70
+ };
71
+ /**
72
+ * This component is in charge of rendering a collection table with a high
73
+ * degree of customization.
74
+ *
75
+ * This component is used internally by {@link EntityCollectionView} and
76
+ * {@link useReferenceDialog}
77
+ *
78
+ * Please note that you only need to use this component if you are building
79
+ * a custom view. If you just need to create a default view you can do it
80
+ * exclusively with config options.
81
+ *
82
+ * If you want to bind a {@link EntityCollection} to a table with the default
83
+ * options you see in collections in the top level navigation, you can
84
+ * check {@link EntityCollectionView}.
85
+ *
86
+ * The data displayed in the table is managed by a {@link EntityTableController}.
87
+ * You can build the default, bound to a path in the datasource, by using the hook
88
+ * {@link useDataSourceEntityCollectionTableController}
89
+ *
90
+ * @see EntityCollectionTableProps
91
+ * @see EntityCollectionView
92
+ * @see VirtualTable
93
+ * @group Components
94
+ */
95
+ export declare const SimpleEntityCollectionTable: React.NamedExoticComponent<SimpleEntityCollectionTableProps<any>>;
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import { FilterValues, ResolvedProperties, ResolvedProperty } from "../../types";
3
+ import { VirtualTableColumn } from "../VirtualTable";
4
+ export declare function buildIdColumn(largeLayout?: boolean): VirtualTableColumn;
5
+ export interface PropertiesToColumnsParams<M extends Record<string, any>> {
6
+ properties: ResolvedProperties<M>;
7
+ sortable?: boolean;
8
+ forceFilter?: FilterValues<keyof M extends string ? keyof M : never>;
9
+ disabledFilter?: boolean;
10
+ AdditionalHeaderWidget?: (props: {
11
+ property: ResolvedProperty;
12
+ propertyKey: string;
13
+ onHover: boolean;
14
+ }) => React.ReactNode;
15
+ }
16
+ export declare function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forceFilter, disabledFilter, AdditionalHeaderWidget }: PropertiesToColumnsParams<M>): VirtualTableColumn[];
@@ -1,4 +1,8 @@
1
1
  export { EntityCollectionTable } from "./EntityCollectionTable";
2
2
  export type { EntityCollectionTableProps, OnColumnResizeParams } from "./EntityCollectionTableProps";
3
3
  export type { UniqueFieldValidator, OnCellValueChange, OnCellValueChangeParams } from "./types";
4
+ export * from "./PropertyTableCell";
5
+ export * from "./SimpleEntityCollectionTable";
6
+ export * from "./EntityCollectionRowActions";
4
7
  export * from "./useDataSourceEntityCollectionTableController";
8
+ export * from "./column_utils";
@@ -4,7 +4,7 @@ interface CollectionTableToolbarProps {
4
4
  size: CollectionSize;
5
5
  filterIsSet: boolean;
6
6
  loading: boolean;
7
- forceFilter: boolean;
7
+ forceFilter?: boolean;
8
8
  actionsStart?: React.ReactNode;
9
9
  actions?: React.ReactNode;
10
10
  title?: React.ReactNode;
@@ -16,7 +16,7 @@ interface PopupFormFieldProps<M extends Record<string, any>> {
16
16
  * Callback when the value of a cell has been edited
17
17
  * @param params
18
18
  */
19
- onCellValueChange?: (params: OnCellValueChangeParams<any, M>) => Promise<void>;
19
+ onCellValueChange?: (params: OnCellValueChangeParams<any, M>) => Promise<void> | void;
20
20
  }
21
21
  export declare function PopupFormField<M extends Record<string, any>>(props: PopupFormFieldProps<M>): import("react/jsx-runtime").JSX.Element | null;
22
22
  export declare function PopupFormFieldInternal<M extends Record<string, any>>({ tableKey, entity: entityProp, customFieldValidator, propertyKey, collection: inputCollection, path, cellRect, open, onClose, onCellValueChange, container }: PopupFormFieldProps<M>): import("react/jsx-runtime").JSX.Element;
@@ -28,7 +28,7 @@ export type EntityCollectionTableController<M extends Record<string, any>> = {
28
28
  * Props passed in a callback when the content of a cell in a table has been edited
29
29
  * @group Collection components
30
30
  */
31
- export interface OnCellValueChangeParams<T, M extends Record<string, any>> {
31
+ export interface OnCellValueChangeParams<T = any, M extends Record<string, any> = any> {
32
32
  value: T;
33
33
  propertyKey: string;
34
34
  entity: Entity<M>;
@@ -50,4 +50,4 @@ export type UniqueFieldValidator = (props: {
50
50
  * Callback when a cell has changed in a table
51
51
  * @group Collection components
52
52
  */
53
- export type OnCellValueChange<T, M extends Record<string, any>> = (params: OnCellValueChangeParams<T, M>) => Promise<void>;
53
+ export type OnCellValueChange<T, M extends Record<string, any>> = (params: OnCellValueChangeParams<T, M>) => Promise<void> | void;
@@ -1,4 +1,4 @@
1
- import { Entity, EntityCollection, FilterValues, TableController, User } from "../../types";
1
+ import { Entity, EntityCollection, FilterValues, EntityTableController, User } from "../../types";
2
2
  export type DataSourceEntityCollectionTableControllerProps<M extends Record<string, any> = any> = {
3
3
  /**
4
4
  * Full path where the data of this table is located
@@ -20,7 +20,7 @@ export type DataSourceEntityCollectionTableControllerProps<M extends Record<stri
20
20
  * Use this hook to build a controller for the {@link EntityCollectionTable}.
21
21
  * This controller is bound to data in a path in your specified datasource.
22
22
  *
23
- * Note that you can build your own hook returning a {@link TableController}
23
+ * Note that you can build your own hook returning a {@link EntityTableController}
24
24
  * if you would like to display different data.
25
25
  *
26
26
  * @param fullPath
@@ -29,4 +29,4 @@ export type DataSourceEntityCollectionTableControllerProps<M extends Record<stri
29
29
  * @param lastDeleteTimestamp
30
30
  * @param forceFilterFromProps
31
31
  */
32
- export declare function useDataSourceEntityCollectionTableController<M extends Record<string, any> = any, UserType extends User = User>({ fullPath, collection, entitiesDisplayedFirst, lastDeleteTimestamp, forceFilter: forceFilterFromProps, }: DataSourceEntityCollectionTableControllerProps<M>): TableController<M>;
32
+ export declare function useDataSourceEntityCollectionTableController<M extends Record<string, any> = any, UserType extends User = User>({ fullPath, collection, entitiesDisplayedFirst, lastDeleteTimestamp, forceFilter: forceFilterFromProps, }: DataSourceEntityCollectionTableControllerProps<M>): EntityTableController<M>;
@@ -1,4 +1,4 @@
1
- import { EntityCollection, SelectionController, TableController } from "../../types";
1
+ import { EntityCollection, SelectionController, EntityTableController } from "../../types";
2
2
  export type EntityCollectionViewActionsProps<M extends Record<string, any>> = {
3
3
  collection: EntityCollection<M>;
4
4
  path: string;
@@ -8,7 +8,7 @@ export type EntityCollectionViewActionsProps<M extends Record<string, any>> = {
8
8
  onNewClick: () => void;
9
9
  onMultipleDeleteClick: () => void;
10
10
  selectionController: SelectionController<M>;
11
- tableController: TableController<M>;
11
+ tableController: EntityTableController<M>;
12
12
  collectionEntitiesCount: number;
13
13
  };
14
14
  export declare function EntityCollectionViewActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, onNewClick, onMultipleDeleteClick, selectionEnabled, path, selectionController, tableController, collectionEntitiesCount }: EntityCollectionViewActionsProps<M>): import("react/jsx-runtime").JSX.Element;
@@ -8,7 +8,7 @@ type VirtualTableCellProps<T extends any> = {
8
8
  cellData: any;
9
9
  rowIndex: any;
10
10
  columnIndex: number;
11
- cellRenderer: (params: CellRendererParams<T>) => React.ReactNode;
11
+ cellRenderer: React.ComponentType<CellRendererParams<T>>;
12
12
  };
13
13
  export declare const VirtualTableCell: React.NamedExoticComponent<VirtualTableCellProps<any>>;
14
14
  export {};
@@ -24,7 +24,7 @@ export interface VirtualTableProps<T extends Record<string, any>> {
24
24
  * Custom cell renderer
25
25
  * The renderer receives props `{ cellData, columns, column, columnIndex, rowData, rowIndex, container, isScrolling }`
26
26
  */
27
- cellRenderer: (params: CellRendererParams<T>) => React.ReactNode;
27
+ cellRenderer: React.ComponentType<CellRendererParams<T>>;
28
28
  /**
29
29
  * If enabled, content is loaded in batch
30
30
  */
@@ -116,8 +116,7 @@ export interface VirtualTableProps<T extends Record<string, any>> {
116
116
  */
117
117
  AddColumnComponent?: React.ComponentType;
118
118
  }
119
- export type CellRendererParams<T extends any> = {
120
- cellData?: any;
119
+ export type CellRendererParams<T extends any = any> = {
121
120
  column: VirtualTableColumn;
122
121
  columns: VirtualTableColumn[];
123
122
  columnIndex: number;
@@ -16,7 +16,7 @@ export type VirtualTableContextProps<T extends any> = {
16
16
  data?: T[];
17
17
  size?: VirtualTableSize;
18
18
  columns: VirtualTableColumn[];
19
- cellRenderer: (params: CellRendererParams<T>) => React.ReactNode;
19
+ cellRenderer: React.ComponentType<CellRendererParams<T>>;
20
20
  currentSort: "asc" | "desc" | undefined;
21
21
  filter?: VirtualTableFilterValues<any>;
22
22
  onRowClick?: (props: OnRowClickParams<any>) => void;
@@ -4,7 +4,7 @@ import { ResolvedProperty } from "../../types";
4
4
  * as well as the error message if any.
5
5
  */
6
6
  export declare function FieldHelperText({ error, showError, property, includeDescription, disabled }: {
7
- error: string;
7
+ error?: string;
8
8
  showError: boolean;
9
9
  property: ResolvedProperty;
10
10
  includeDescription?: boolean;