@firecms/core 3.0.0-beta.2-pre.5 → 3.0.0-beta.3

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 (83) hide show
  1. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +2 -6
  2. package/dist/components/PropertyIdCopyTooltipContent.d.ts +3 -0
  3. package/dist/components/ReferenceWidget.d.ts +3 -3
  4. package/dist/components/index.d.ts +0 -1
  5. package/dist/core/SideEntityView.d.ts +7 -0
  6. package/dist/core/index.d.ts +0 -2
  7. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  8. package/dist/form/components/index.d.ts +1 -0
  9. package/dist/form/index.d.ts +1 -0
  10. package/dist/hooks/index.d.ts +2 -1
  11. package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
  12. package/dist/hooks/useBuildNavigationController.d.ts +1 -1
  13. package/dist/hooks/useProjectLog.d.ts +4 -0
  14. package/dist/index.es.js +3377 -3290
  15. package/dist/index.es.js.map +1 -1
  16. package/dist/index.umd.js +5 -5
  17. package/dist/index.umd.js.map +1 -1
  18. package/dist/internal/useBuildDataSource.d.ts +4 -0
  19. package/dist/types/entities.d.ts +1 -0
  20. package/dist/util/index.d.ts +2 -1
  21. package/dist/util/useDebouncedCallback.d.ts +1 -0
  22. package/package.json +12 -4
  23. package/src/components/ArrayContainer.tsx +3 -9
  24. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +33 -37
  25. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +36 -38
  26. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +2 -1
  27. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +1 -1
  28. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +17 -14
  29. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +10 -1
  30. package/src/components/EntityCollectionView/EntityCollectionView.tsx +15 -14
  31. package/src/components/PropertyIdCopyTooltipContent.tsx +28 -0
  32. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +0 -1
  33. package/src/components/ReferenceWidget.tsx +4 -4
  34. package/src/components/SelectableTable/SelectableTable.tsx +2 -2
  35. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +2 -2
  36. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -2
  37. package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -2
  38. package/src/components/index.tsx +0 -1
  39. package/src/core/Drawer.tsx +17 -15
  40. package/src/core/EntitySidePanel.tsx +1 -1
  41. package/src/{internal → core}/EntityView.tsx +4 -4
  42. package/src/core/FireCMS.tsx +4 -1
  43. package/src/core/Scaffold.tsx +5 -5
  44. package/src/core/SideEntityView.tsx +38 -0
  45. package/src/core/field_configs.tsx +11 -11
  46. package/src/core/index.tsx +0 -2
  47. package/src/form/EntityForm.tsx +16 -4
  48. package/src/form/PropertyFieldBinding.tsx +3 -8
  49. package/src/form/components/index.tsx +1 -0
  50. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +2 -3
  51. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -3
  52. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -3
  53. package/src/form/field_bindings/DateTimeFieldBinding.tsx +3 -3
  54. package/src/form/field_bindings/KeyValueFieldBinding.tsx +4 -4
  55. package/src/form/field_bindings/MapFieldBinding.tsx +9 -7
  56. package/src/form/field_bindings/MarkdownFieldBinding.tsx +1 -2
  57. package/src/form/field_bindings/MultiSelectBinding.tsx +2 -3
  58. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -2
  59. package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -4
  60. package/src/form/field_bindings/RepeatFieldBinding.tsx +6 -4
  61. package/src/form/field_bindings/SelectFieldBinding.tsx +2 -3
  62. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +3 -3
  63. package/src/form/field_bindings/SwitchFieldBinding.tsx +2 -3
  64. package/src/form/field_bindings/TextFieldBinding.tsx +3 -4
  65. package/src/form/index.tsx +1 -0
  66. package/src/hooks/index.tsx +3 -1
  67. package/src/{core → hooks}/useBuildModeController.tsx +1 -1
  68. package/src/hooks/useBuildNavigationController.tsx +30 -15
  69. package/src/hooks/useProjectLog.tsx +31 -0
  70. package/src/internal/useBuildDataSource.ts +7 -2
  71. package/src/preview/PropertyPreview.tsx +1 -1
  72. package/src/preview/components/ReferencePreview.tsx +1 -1
  73. package/src/types/entities.ts +4 -0
  74. package/src/util/index.ts +2 -1
  75. package/src/util/{useDebounce.ts → useDebouncedCallback.ts} +1 -1
  76. package/dist/hooks/useVerifyLicense.d.ts +0 -0
  77. package/dist/util/useDebounce.d.ts +0 -1
  78. package/src/hooks/useVerifyLicense.tsx +0 -1
  79. /package/dist/{internal → core}/EntityView.d.ts +0 -0
  80. /package/dist/{components → form/components}/LabelWithIcon.d.ts +0 -0
  81. /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
  82. /package/src/{components → form/components}/LabelWithIcon.tsx +0 -0
  83. /package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +0 -0
@@ -17,6 +17,10 @@ export declare function useBuildDataSource({ delegate, propertyConfigs, navigati
17
17
  * bindings.
18
18
  * Also, Firestore references are replaced with {@link EntityReference}
19
19
  * @param data
20
+ * @param buildReference
21
+ * @param buildGeoPoint
22
+ * @param buildDate
23
+ * @param buildDelete
20
24
  * @group Firestore
21
25
  */
22
26
  export declare function cmsToDelegateModel(data: any, buildReference: (reference: EntityReference) => any, buildGeoPoint: (geoPoint: GeoPoint) => any, buildDate: (date: Date) => any, buildDelete: () => any): any;
@@ -43,6 +43,7 @@ export declare class EntityReference<M extends Record<string, any> = any> {
43
43
  readonly path: string;
44
44
  constructor(id: string, path: string);
45
45
  get pathWithId(): string;
46
+ isEntityReference(): boolean;
46
47
  }
47
48
  export declare class GeoPoint {
48
49
  /**
@@ -7,7 +7,7 @@ export * from "./objects";
7
7
  export * from "./paths";
8
8
  export * from "./regexp";
9
9
  export * from "./navigation_utils";
10
- export * from "./useDebounce";
10
+ export * from "./useDebouncedCallback";
11
11
  export * from "./property_utils";
12
12
  export * from "./resolutions";
13
13
  export * from "./permissions";
@@ -20,3 +20,4 @@ export * from "./flatten_object";
20
20
  export * from "./make_properties_editable";
21
21
  export * from "./join_collections";
22
22
  export * from "./builders";
23
+ export * from "./useTraceUpdate";
@@ -0,0 +1 @@
1
+ export declare function useDebouncedCallback<T>(value: T, callback: () => void, immediate: boolean, timeoutMs?: number): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.2-pre.5",
4
+ "version": "3.0.0-beta.3",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -37,9 +37,17 @@
37
37
  "clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f",
38
38
  "generateIcons": "ts-node --esm src/icons/generateIcons.ts"
39
39
  },
40
+ "exports": {
41
+ ".": {
42
+ "import": "./dist/index.es.js",
43
+ "require": "./dist/index.umd.js",
44
+ "types": "./dist/src/index.d.ts"
45
+ },
46
+ "./package.json": "./package.json"
47
+ },
40
48
  "dependencies": {
41
- "@firecms/formex": "^3.0.0-beta.2-pre.5",
42
- "@firecms/ui": "^3.0.0-beta.2-pre.5",
49
+ "@firecms/formex": "^3.0.0-beta.3",
50
+ "@firecms/ui": "^3.0.0-beta.3",
43
51
  "@fontsource/ibm-plex-mono": "^5.0.8",
44
52
  "@fontsource/roboto": "^5.0.8",
45
53
  "@hello-pangea/dnd": "^16.5.0",
@@ -107,7 +115,7 @@
107
115
  "dist",
108
116
  "src"
109
117
  ],
110
- "gitHead": "5159646cfdb35e11cc510080bd3cff17104d0cb4",
118
+ "gitHead": "33cceff5d5bc2a7002cc5a3904b787e70bfb9c6e",
111
119
  "publishConfig": {
112
120
  "access": "public"
113
121
  }
@@ -7,7 +7,7 @@ import {
7
7
  AddIcon,
8
8
  Button,
9
9
  ContentCopyIcon,
10
- fieldBackgroundHoverMixin,
10
+ fieldBackgroundHoverMixin, HandleIcon,
11
11
  IconButton,
12
12
  Menu,
13
13
  MenuItem,
@@ -253,6 +253,7 @@ export function ArrayContainerItem({
253
253
  </div>;
254
254
  }
255
255
 
256
+
256
257
  export function ArrayItemOptions({
257
258
  direction,
258
259
  disabled,
@@ -291,14 +292,7 @@ export function ArrayItemOptions({
291
292
  setMenuOpen(false);
292
293
  }}
293
294
  className={`cursor-${disabled ? "inherit" : "grab"}`}>
294
- <svg width="24" height="24" viewBox="0 0 100 100" fill="none">
295
- <circle cx="28" cy="50" r="9" fill={"currentColor"}/>
296
- <circle cx="28" cy="21" r="9" fill={"currentColor"}/>
297
- <circle cx="71" cy="21" r="9" fill={"currentColor"}/>
298
- <circle cx="71" cy="50" r="9" fill={"currentColor"}/>
299
- <circle cx="71" cy="78" r="9" fill={"currentColor"}/>
300
- <circle cx="28" cy="78" r="9" fill={"currentColor"}/>
301
- </svg>
295
+ <HandleIcon/>
302
296
  </IconButton>
303
297
 
304
298
  <Menu
@@ -1,5 +1,4 @@
1
1
  import React, { MouseEvent, useCallback } from "react";
2
- import equal from "react-fast-compare"
3
2
 
4
3
  import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../types";
5
4
  import { Checkbox, cn, IconButton, Menu, MenuItem, MoreVertIcon, Skeleton, Tooltip, Typography } from "@firecms/ui";
@@ -14,46 +13,43 @@ import { useFireCMSContext, useLargeLayout } from "../../hooks";
14
13
  * @param selectionEnabled
15
14
  * @param size
16
15
  * @param toggleEntitySelection
17
- * @param onCopyClicked
18
- * @param onEditClicked
19
- * @param onDeleteClicked
20
16
  * @param hideId
21
17
  * @constructor
22
18
  *
23
19
  * @group Collection components
24
20
  */
25
- export const EntityCollectionRowActions = React.memo(function EntityCollectionRowActions({
26
- entity,
27
- collection,
28
- fullPath,
29
- width,
30
- frozen,
31
- isSelected,
32
- selectionEnabled,
33
- size,
34
- highlightEntity,
35
- onCollectionChange,
36
- unhighlightEntity,
37
- actions = [],
38
- hideId,
39
- selectionController,
40
- }:
41
- {
42
- entity: Entity<any>,
43
- collection?: EntityCollection<any>,
44
- fullPath?: string,
45
- width: number,
46
- frozen?: boolean,
47
- size: CollectionSize,
48
- isSelected?: boolean,
49
- selectionEnabled?: boolean,
50
- actions?: EntityAction[],
51
- hideId?: boolean,
52
- onCollectionChange?: () => void,
53
- selectionController?: SelectionController;
54
- highlightEntity?: (entity: Entity<any>) => void;
55
- unhighlightEntity?: (entity: Entity<any>) => void;
56
- }) {
21
+ export const EntityCollectionRowActions = function EntityCollectionRowActions({
22
+ entity,
23
+ collection,
24
+ fullPath,
25
+ width,
26
+ frozen,
27
+ isSelected,
28
+ selectionEnabled,
29
+ size,
30
+ highlightEntity,
31
+ onCollectionChange,
32
+ unhighlightEntity,
33
+ actions = [],
34
+ hideId,
35
+ selectionController,
36
+ }:
37
+ {
38
+ entity: Entity<any>,
39
+ collection?: EntityCollection<any>,
40
+ fullPath?: string,
41
+ width: number,
42
+ frozen?: boolean,
43
+ size: CollectionSize,
44
+ isSelected?: boolean,
45
+ selectionEnabled?: boolean,
46
+ actions?: EntityAction[],
47
+ hideId?: boolean,
48
+ onCollectionChange?: () => void,
49
+ selectionController?: SelectionController;
50
+ highlightEntity?: (entity: Entity<any>) => void;
51
+ unhighlightEntity?: (entity: Entity<any>) => void;
52
+ }) {
57
53
 
58
54
  const largeLayout = useLargeLayout();
59
55
 
@@ -171,4 +167,4 @@ export const EntityCollectionRowActions = React.memo(function EntityCollectionRo
171
167
  </div>
172
168
  );
173
169
 
174
- }, equal);
170
+ };
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useContext, useMemo, useRef } from "react";
1
+ import React, { useCallback, useMemo, useRef } from "react";
2
2
  import equal from "react-fast-compare";
3
3
  import { AdditionalFieldDelegate, CollectionSize, Entity, FireCMSContext, User } from "../../types";
4
4
  import { PropertyTableCell } from "./PropertyTableCell";
@@ -8,7 +8,6 @@ import { CellRendererParams, VirtualTableColumn } from "../VirtualTable";
8
8
  import { getValueInPath } from "../../util";
9
9
  import { getRowHeight } from "../VirtualTable/common";
10
10
  import { EntityCollectionRowActions } from "./EntityCollectionRowActions";
11
- import { EntityCollectionTableController } from "../common/types";
12
11
  import { CollectionTableToolbar } from "./internal/CollectionTableToolbar";
13
12
  import { EntityCollectionTableProps } from "./EntityCollectionTableProps";
14
13
  import { EntityTableCell } from "./internal/EntityTableCell";
@@ -111,12 +110,12 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
111
110
 
112
111
  const customFieldValidator: CustomFieldValidator | undefined = uniqueFieldValidator;
113
112
 
114
- const propertyCellRenderer = useCallback(({
115
- column,
116
- columnIndex,
117
- rowData,
118
- rowIndex
119
- }: CellRendererParams<any>) => {
113
+ const propertyCellRenderer = ({
114
+ column,
115
+ columnIndex,
116
+ rowData,
117
+ rowIndex
118
+ }: CellRendererParams<any>) => {
120
119
 
121
120
  const entity: Entity<M> = rowData;
122
121
 
@@ -158,7 +157,7 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
158
157
  }
159
158
  </ErrorBoundary>);
160
159
 
161
- }, [inlineEditing, size, selectedEntityIds]);
160
+ };
162
161
 
163
162
  const additionalCellRenderer = useCallback(({
164
163
  column,
@@ -205,30 +204,29 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
205
204
 
206
205
  }, [size, selectedEntityIds]);
207
206
 
208
- const collectionColumns: VirtualTableColumn[] = useMemo(() => {
209
- const columnsResult: VirtualTableColumn[] = propertiesToColumns({
210
- properties,
211
- sortable,
212
- forceFilter,
213
- disabledFilter: disabledFilterChange,
214
- AdditionalHeaderWidget
215
- });
216
-
217
- const additionalTableColumns: VirtualTableColumn[] = additionalFields
218
- ? additionalFields.map((additionalField) =>
219
- ({
220
- key: additionalField.key,
221
- align: "left",
222
- sortable: false,
223
- title: additionalField.name,
224
- width: additionalField.width ?? 200
225
- }))
226
- : [];
227
- return [...columnsResult, ...additionalTableColumns];
228
- },
229
- [additionalFields, disabledFilterChange, forceFilter, properties, sortable]);
230
-
231
- const idColumn: VirtualTableColumn = useMemo(() => ({
207
+ const collectionColumns: VirtualTableColumn[] = (() => {
208
+ const columnsResult: VirtualTableColumn[] = propertiesToColumns({
209
+ properties,
210
+ sortable,
211
+ forceFilter,
212
+ disabledFilter: disabledFilterChange,
213
+ AdditionalHeaderWidget
214
+ });
215
+
216
+ const additionalTableColumns: VirtualTableColumn[] = additionalFields
217
+ ? additionalFields.map((additionalField) =>
218
+ ({
219
+ key: additionalField.key,
220
+ align: "left",
221
+ sortable: false,
222
+ title: additionalField.name,
223
+ width: additionalField.width ?? 200
224
+ }))
225
+ : [];
226
+ return [...columnsResult, ...additionalTableColumns];
227
+ })();
228
+
229
+ const idColumn: VirtualTableColumn = {
232
230
  key: "id_ewcfedcswdf3",
233
231
  width: getIdColumnWidth?.() ?? (largeLayout ? 160 : 130),
234
232
  title: "ID",
@@ -237,17 +235,17 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
237
235
  headerAlign: "center",
238
236
  align: "center",
239
237
  AdditionalHeaderWidget: () => additionalIDHeaderWidget
240
- }), [getIdColumnWidth, largeLayout])
238
+ }
241
239
 
242
- const columns: VirtualTableColumn[] = useMemo(() => [
240
+ const columns: VirtualTableColumn[] = [
243
241
  idColumn,
244
242
  ...displayedColumnIds
245
243
  .map((p) => {
246
244
  return collectionColumns.find(c => c.key === p.key);
247
245
  }).filter(Boolean) as VirtualTableColumn[]
248
- ], [collectionColumns, displayedColumnIds, idColumn]);
246
+ ];
249
247
 
250
- const cellRenderer = useCallback((props: CellRendererParams<any>) => {
248
+ const cellRenderer = (props: CellRendererParams<any>) => {
251
249
  const column = props.column;
252
250
  const columns = props.columns;
253
251
  const columnKey = column.key;
@@ -287,7 +285,7 @@ export const EntityCollectionTable = React.memo<EntityCollectionTableProps<any>>
287
285
  <ErrorView error={e}/>
288
286
  </EntityTableCell>;
289
287
  }
290
- }, [additionalFieldsMap, tableRowActionsBuilder, size, additionalCellRenderer, propertyCellRenderer])
288
+ }
291
289
 
292
290
  return (
293
291
 
@@ -24,13 +24,14 @@ import { getPreviewSizeFrom } from "../../preview/util";
24
24
  import { isReadOnly } from "../../util";
25
25
 
26
26
  import { CustomFieldValidator, mapPropertyToYup } from "../../form/validation";
27
- import { useClearRestoreValue, useFireCMSContext } from "../../hooks";
27
+ import { useFireCMSContext } from "../../hooks";
28
28
 
29
29
  import { EntityTableCell } from "./internal/EntityTableCell";
30
30
  import { EntityTableCellActions } from "./internal/EntityTableCellActions";
31
31
 
32
32
  import { getRowHeight } from "../VirtualTable/common";
33
33
  import { useSelectableTableController } from "../SelectableTable/SelectableTableContext";
34
+ import { useClearRestoreValue } from "../../form/useClearRestoreValue";
34
35
 
35
36
  export interface PropertyTableCellProps<T extends CMSType, M extends Record<string, any>> {
36
37
  propertyKey: string;
@@ -96,7 +96,7 @@ export const TableReferenceFieldSuccess = React.memo(
96
96
  const valueNotSet = !internalValue || (Array.isArray(internalValue) && internalValue.length === 0);
97
97
 
98
98
  const buildSingleReferenceField = () => {
99
- if (internalValue instanceof EntityReference)
99
+ if (internalValue && !Array.isArray(internalValue) && internalValue.isEntityReference && internalValue.isEntityReference())
100
100
  return <ReferencePreview
101
101
  onClick={disabled ? undefined : handleOpen}
102
102
  size={getPreviewSizeFrom(size)}
@@ -8,7 +8,8 @@ import {
8
8
  FilterListOffIcon,
9
9
  SearchBar,
10
10
  Select,
11
- SelectItem
11
+ SelectItem,
12
+ Tooltip
12
13
  } from "@firecms/ui";
13
14
  import { CollectionSize } from "../../../types";
14
15
  import { useLargeLayout } from "../../../hooks";
@@ -54,19 +55,21 @@ export function CollectionTableToolbar(props: CollectionTableToolbarProps) {
54
55
  </Button>;
55
56
 
56
57
  const sizeSelect = (
57
- <Select
58
- value={props.size as string}
59
- className="w-16 h-10"
60
- size={"small"}
61
- onValueChange={(v) => props.onSizeChanged(v as CollectionSize)}
62
- renderValue={(v) => <div className={"font-medium"}>{v.toUpperCase()}</div>}
63
- >
64
- {["xs", "s", "m", "l", "xl"].map((size) => (
65
- <SelectItem key={size} value={size} className={"w-12 font-medium text-center"}>
66
- {size.toUpperCase()}
67
- </SelectItem>
68
- ))}
69
- </Select>
58
+ <Tooltip title={"Table row size"} side={"right"} sideOffset={4}>
59
+ <Select
60
+ value={props.size as string}
61
+ className="w-16 h-10"
62
+ size={"small"}
63
+ onValueChange={(v) => props.onSizeChanged(v as CollectionSize)}
64
+ renderValue={(v) => <div className={"font-medium"}>{v.toUpperCase()}</div>}
65
+ >
66
+ {["xs", "s", "m", "l", "xl"].map((size) => (
67
+ <SelectItem key={size} value={size} className={"w-12 font-medium text-center"}>
68
+ {size.toUpperCase()}
69
+ </SelectItem>
70
+ ))}
71
+ </Select>
72
+ </Tooltip>
70
73
  );
71
74
 
72
75
  return (
@@ -224,7 +224,15 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
224
224
  const formex = useCreateFormex<M>({
225
225
  initialValues: (entity?.values ?? {}) as EntityValues<M>,
226
226
  validation: (values) => {
227
- return validationSchema?.validate(values)
227
+ return validationSchema?.validate(values, { abortEarly: false })
228
+ .then(() => ({}))
229
+ .catch((e) => {
230
+ const errors: Record<string, string> = {};
231
+ e.inner.forEach((error: any) => {
232
+ errors[error.path] = error.message;
233
+ });
234
+ return errors;
235
+ });
228
236
  },
229
237
  validateOnInitialRender: true,
230
238
  onSubmit: (values, actions) => {
@@ -339,6 +347,7 @@ export function PopupFormFieldInternal<M extends Record<string, any>>({
339
347
  }
340
348
  const form = <div
341
349
  className={`text-gray-900 dark:text-white overflow-auto rounded rounded-md bg-white dark:bg-gray-950 ${!open ? "hidden" : ""} cursor-grab max-w-[100vw]`}>
350
+
342
351
  {internalForm}
343
352
 
344
353
  {savingError &&
@@ -53,7 +53,6 @@ import {
53
53
  Popover,
54
54
  SearchIcon,
55
55
  Skeleton,
56
- TextField,
57
56
  Tooltip,
58
57
  Typography
59
58
  } from "@firecms/ui";
@@ -434,7 +433,7 @@ export const EntityCollectionView = React.memo(
434
433
 
435
434
  const largeLayout = useLargeLayout();
436
435
 
437
- const getActionsForEntity = useCallback(({ entity, customEntityActions }: {
436
+ const getActionsForEntity = ({ entity, customEntityActions }: {
438
437
  entity?: Entity<M>,
439
438
  customEntityActions?: EntityAction[]
440
439
  }): EntityAction[] => {
@@ -447,7 +446,7 @@ export const EntityCollectionView = React.memo(
447
446
  if (customEntityActions)
448
447
  actions.push(...customEntityActions);
449
448
  return actions;
450
- }, [authController, collection, createEnabled, fullPath]);
449
+ };
451
450
 
452
451
  const getIdColumnWidth = useCallback(() => {
453
452
  const entityActions = getActionsForEntity({});
@@ -457,12 +456,12 @@ export const EntityCollectionView = React.memo(
457
456
  return (largeLayout ? (80 + actionsWidth) : (70 + actionsWidth)) + (collapsedActions.length > 0 ? (largeLayout ? 40 : 30) : 0);
458
457
  }, [largeLayout]);
459
458
 
460
- const tableRowActionsBuilder = useCallback(({
461
- entity,
462
- size,
463
- width,
464
- frozen
465
- }: {
459
+ const tableRowActionsBuilder = ({
460
+ entity,
461
+ size,
462
+ width,
463
+ frozen
464
+ }: {
466
465
  entity: Entity<any>,
467
466
  size: CollectionSize,
468
467
  width: number,
@@ -492,7 +491,7 @@ export const EntityCollectionView = React.memo(
492
491
  />
493
492
  );
494
493
 
495
- }, [isEntitySelected, collection, authController, fullPath, selectionEnabled, toggleEntitySelection, createEnabled]);
494
+ };
496
495
 
497
496
  const title = <Popover
498
497
  open={popOverOpen}
@@ -670,6 +669,7 @@ export const EntityCollectionView = React.memo(
670
669
  equal(a.isSubCollection, b.isSubCollection) &&
671
670
  equal(a.className, b.className) &&
672
671
  equal(a.properties, b.properties) &&
672
+ equal(a.propertiesOrder, b.propertiesOrder) &&
673
673
  equal(a.hideIdFromCollection, b.hideIdFromCollection) &&
674
674
  equal(a.inlineEditing, b.inlineEditing) &&
675
675
  equal(a.selectionEnabled, b.selectionEnabled) &&
@@ -804,13 +804,14 @@ function EntityIdHeaderWidget({
804
804
  }}
805
805
  className={"text-gray-900 dark:text-white w-96 max-w-full"}>
806
806
 
807
- <div className="flex p-4 w-full gap-4">
808
- <TextField
807
+ <div className="flex p-2 w-full gap-4">
808
+ <input
809
+ autoFocus={openPopup}
809
810
  placeholder={"Find entity by ID"}
810
- size={"small"}
811
+ // size={"small"}
811
812
  onChange={(e) => setSearchString(e.target.value)}
812
813
  value={searchString}
813
- className={"flex-grow"}/>
814
+ className={"flex-grow bg-transparent outline-none p-1"}/>
814
815
  <Button variant={"outlined"}
815
816
  disabled={!searchString}
816
817
  type={"submit"}
@@ -0,0 +1,28 @@
1
+ import { ContentPasteIcon, IconButton, Typography } from "@firecms/ui";
2
+ import { useCallback, useState } from "react";
3
+
4
+ export function PropertyIdCopyTooltipContent({ propertyId }: { propertyId: string }) {
5
+
6
+ const [copied, setCopied] = useState(false);
7
+
8
+ return (
9
+ <div className={"flex flex-row gap-2 items-center justify-center text-white"}>
10
+ <div>
11
+ <Typography variant={"caption"} className={"min-w-20 text-slate-400"}
12
+ color={"disabled"}>{copied ? "Copied" : "Property ID"}</Typography>
13
+ <Typography variant={"caption"} className={"text-white"}><code>{propertyId}</code></Typography>
14
+ </div>
15
+ {/* Copy to clipboard button*/}
16
+ <IconButton size={"small"}>
17
+ <ContentPasteIcon size={"smallest"}
18
+ className={"text-white"}
19
+ onClick={useCallback(() => {
20
+ navigator.clipboard.writeText(propertyId);
21
+ setCopied(true);
22
+ setTimeout(() => setCopied(false), 2000);
23
+ }, [propertyId])}
24
+ />
25
+ </IconButton>
26
+ </div>
27
+ );
28
+ }
@@ -266,7 +266,6 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
266
266
  forceFilter
267
267
  });
268
268
 
269
-
270
269
  const {
271
270
  textSearchLoading,
272
271
  textSearchInitialised,
@@ -9,13 +9,13 @@ import { Button, cn } from "@firecms/ui";
9
9
  export type ReferenceWidgetProps<M extends Record<string, any>> = {
10
10
  name?: string,
11
11
  multiselect?: boolean,
12
- value: EntityReference<M> | EntityReference<M>[] | null,
12
+ value: EntityReference | EntityReference[] | null,
13
13
  onReferenceSelected?: (params: {
14
- reference: EntityReference<M> | null,
14
+ reference: EntityReference | null,
15
15
  entity: Entity<M> | null
16
16
  }) => void,
17
17
  onMultipleReferenceSelected?: (params: {
18
- references: EntityReference<M>[] | null,
18
+ references: EntityReference[] | null,
19
19
  entities: Entity<M>[] | null
20
20
  }) => void,
21
21
  path: string,
@@ -113,7 +113,7 @@ export function ReferenceWidget<M extends Record<string, any>>({
113
113
  size={size}/>
114
114
  })}
115
115
  </div>
116
- } else if (value instanceof EntityReference) {
116
+ } else if (value?.isEntityReference && value?.isEntityReference()) {
117
117
  child = <ReferencePreview
118
118
  reference={value}
119
119
  onClick={onEntryClick}
@@ -115,6 +115,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
115
115
  onEntityClick,
116
116
  onColumnResize,
117
117
  hoverRow = true,
118
+ size,
118
119
  inlineEditing = false,
119
120
  tableController:
120
121
  {
@@ -145,7 +146,6 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
145
146
  }: SelectableTableProps<M>) {
146
147
 
147
148
  const ref = useRef<HTMLDivElement>(null);
148
- const [size, setSize] = React.useState<CollectionSize>("m");
149
149
 
150
150
  const [selectedCell, setSelectedCell] = React.useState<SelectedCellProps<M> | undefined>(undefined);
151
151
 
@@ -207,7 +207,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
207
207
  setPopupCell: setPopupCell as ((cell?: SelectedCellProps<M>) => void),
208
208
  select,
209
209
  onValueChange,
210
- size,
210
+ size: size ?? "m",
211
211
  selectedCell,
212
212
  }}
213
213
  >
@@ -60,7 +60,7 @@ export function ReferenceFilterField({
60
60
 
61
61
  const selectedEntityIds = internalValue
62
62
  ? (Array.isArray(internalValue) ? internalValue.map((ref) => {
63
- if (!(ref instanceof EntityReference)) {
63
+ if (!(ref?.isEntityReference && ref?.isEntityReference())) {
64
64
  return null;
65
65
  }
66
66
  return ref.id;
@@ -74,7 +74,7 @@ export function ReferenceFilterField({
74
74
  let newValue = val;
75
75
  if (prevOpIsArray !== newOpIsArray) {
76
76
  // @ts-ignore
77
- newValue = newOpIsArray ? (newValue instanceof EntityReference ? [newValue] : []) : undefined
77
+ newValue = newOpIsArray ? (newValue?.isEntityReference && newValue?.isEntityReference() ? [newValue] : []) : undefined
78
78
  }
79
79
 
80
80
  setOperation(op);
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef, useState } from "react";
2
2
 
3
- import { useDebounce } from "../../../util";
3
+ import { useDebouncedCallback } from "../../../util";
4
4
  import { TextareaAutosize } from "@firecms/ui";
5
5
 
6
6
  export function VirtualTableInput(props: {
@@ -43,7 +43,7 @@ export function VirtualTableInput(props: {
43
43
  }
44
44
  }, [internalValue, updateValue, value]);
45
45
 
46
- useDebounce(internalValue, doUpdate, !focused, 2000);
46
+ useDebouncedCallback(internalValue, doUpdate, !focused, 2000);
47
47
 
48
48
  useEffect(() => {
49
49
  if (ref.current && focused && !focusedState.current) {