@firecms/core 3.1.0-canary.9e89e98 → 3.1.0

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 (43) hide show
  1. package/dist/components/EntityCollectionTable/internal/popup_field/useDraggable.d.ts +2 -2
  2. package/dist/components/ErrorBoundary.d.ts +1 -1
  3. package/dist/components/VirtualTable/VirtualTableHeader.d.ts +1 -1
  4. package/dist/form/components/ErrorFocus.d.ts +1 -1
  5. package/dist/index.es.js +118 -54
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +118 -54
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/internal/useRestoreScroll.d.ts +1 -1
  10. package/dist/types/analytics.d.ts +1 -1
  11. package/dist/types/plugins.d.ts +16 -0
  12. package/dist/util/entities.d.ts +1 -1
  13. package/dist/util/resolutions.d.ts +2 -2
  14. package/package.json +9 -9
  15. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +1 -1
  16. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +11 -11
  17. package/src/components/EntityCollectionView/EntityBoardCard.tsx +1 -1
  18. package/src/components/EntityCollectionView/EntityCard.tsx +4 -0
  19. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +23 -3
  20. package/src/components/EntityCollectionView/EntityCollectionView.tsx +32 -3
  21. package/src/components/VirtualTable/VirtualTable.tsx +116 -113
  22. package/src/components/VirtualTable/VirtualTableHeader.tsx +42 -42
  23. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
  24. package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +3 -3
  25. package/src/core/DefaultAppBar.tsx +1 -1
  26. package/src/core/EntitySidePanel.tsx +28 -26
  27. package/src/core/field_configs.tsx +14 -9
  28. package/src/form/EntityForm.tsx +69 -60
  29. package/src/form/PropertyFieldBinding.tsx +3 -3
  30. package/src/form/components/ErrorFocus.tsx +3 -3
  31. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +1 -1
  32. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +83 -83
  33. package/src/hooks/useBuildNavigationController.tsx +4 -4
  34. package/src/hooks/useValidateAuthenticator.tsx +1 -1
  35. package/src/internal/useBuildDataSource.ts +1 -2
  36. package/src/preview/PropertyPreview.tsx +1 -0
  37. package/src/types/analytics.ts +10 -0
  38. package/src/types/plugins.tsx +18 -0
  39. package/src/util/entities.ts +1 -1
  40. package/src/util/join_collections.ts +10 -8
  41. package/src/util/previews.ts +2 -2
  42. package/src/util/property_utils.tsx +1 -1
  43. package/src/util/resolutions.ts +5 -3
@@ -42,52 +42,52 @@ type InnerElementProps = {
42
42
 
43
43
  // eslint-disable-next-line react/display-name
44
44
  const innerElementType = forwardRef<HTMLDivElement, InnerElementProps>(({
45
- children,
46
- ...rest
47
- }: InnerElementProps, ref) => {
48
-
49
- return (
50
- <VirtualListContext.Consumer>
51
- {(virtualTableProps) => {
52
- const customView = virtualTableProps.customView;
53
- return (
54
- <>
45
+ children,
46
+ ...rest
47
+ }: InnerElementProps, ref) => {
48
+
49
+ return (
50
+ <VirtualListContext.Consumer>
51
+ {(virtualTableProps) => {
52
+ const customView = virtualTableProps.customView;
53
+ return (
54
+ <>
55
+ <div
56
+ id={"virtual-table"}
57
+ style={{
58
+ position: "relative",
59
+ height: "100%"
60
+ }}>
55
61
  <div
56
- id={"virtual-table"}
62
+ ref={ref}
63
+ {...rest}
57
64
  style={{
58
- position: "relative",
59
- height: "100%"
65
+ ...rest?.style,
66
+ minHeight: "100%",
67
+ position: "relative"
60
68
  }}>
61
- <div
62
- ref={ref}
63
- {...rest}
64
- style={{
65
- ...rest?.style,
66
- minHeight: "100%",
67
- position: "relative"
68
- }}>
69
- <VirtualTableHeaderRow {...virtualTableProps} />
70
- {!customView && children}
71
- </div>
72
-
69
+ <VirtualTableHeaderRow {...virtualTableProps} />
70
+ {!customView && children}
73
71
  </div>
74
72
 
75
- {customView && <div style={{
76
- position: "sticky",
77
- top: "48px",
78
- flexGrow: 1,
79
- height: "calc(100% - 48px)",
80
- marginTop: "calc(48px - 100vh)",
81
- left: 0
82
- }}>{customView}</div>}
83
-
84
- </>
85
- );
86
- }}
87
- </VirtualListContext.Consumer>
88
- );
89
- })
90
- ;
73
+ </div>
74
+
75
+ {customView && <div style={{
76
+ position: "sticky",
77
+ top: "48px",
78
+ flexGrow: 1,
79
+ height: "calc(100% - 48px)",
80
+ marginTop: "calc(48px - 100vh)",
81
+ left: 0
82
+ }}>{customView}</div>}
83
+
84
+ </>
85
+ );
86
+ }}
87
+ </VirtualListContext.Consumer>
88
+ );
89
+ })
90
+ ;
91
91
 
92
92
  /**
93
93
  * This is a Table component that allows displaying arbitrary data, not
@@ -99,34 +99,34 @@ const innerElementType = forwardRef<HTMLDivElement, InnerElementProps>(({
99
99
  */
100
100
  export const VirtualTable = React.memo<VirtualTableProps<any>>(
101
101
  function VirtualTable<T extends Record<string, any>>({
102
- data,
103
- onResetPagination,
104
- onEndReached,
105
- endOffset = 600,
106
- rowHeight = 54,
107
- columns: columnsProp,
108
- onRowClick,
109
- onColumnResize,
110
- filter: filterInput,
111
- checkFilterCombination,
112
- onFilterUpdate,
113
- sortBy,
114
- error,
115
- emptyComponent,
116
- onSortByUpdate,
117
- onScroll: onScrollProp,
118
- loading,
119
- cellRenderer,
120
- hoverRow,
121
- createFilterField,
122
- rowClassName,
123
- style,
124
- className,
125
- endAdornment,
126
- AddColumnComponent,
127
- initialScroll = 0,
128
- onColumnsOrderChange,
129
- }: VirtualTableProps<T>) {
102
+ data,
103
+ onResetPagination,
104
+ onEndReached,
105
+ endOffset = 600,
106
+ rowHeight = 54,
107
+ columns: columnsProp,
108
+ onRowClick,
109
+ onColumnResize,
110
+ filter: filterInput,
111
+ checkFilterCombination,
112
+ onFilterUpdate,
113
+ sortBy,
114
+ error,
115
+ emptyComponent,
116
+ onSortByUpdate,
117
+ onScroll: onScrollProp,
118
+ loading,
119
+ cellRenderer,
120
+ hoverRow,
121
+ createFilterField,
122
+ rowClassName,
123
+ style,
124
+ className,
125
+ endAdornment,
126
+ AddColumnComponent,
127
+ initialScroll = 0,
128
+ onColumnsOrderChange,
129
+ }: VirtualTableProps<T>) {
130
130
 
131
131
  const sortByProperty: string | undefined = sortBy ? sortBy[0] : undefined;
132
132
  const currentSort: "asc" | "desc" | undefined = sortBy ? sortBy[1] : undefined;
@@ -234,7 +234,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
234
234
  }, [columns, onColumnResize]);
235
235
 
236
236
  // saving the current filter as a ref as a workaround for header closure
237
- const filterRef = useRef<VirtualTableFilterValues<any> | undefined>();
237
+ const filterRef = useRef<VirtualTableFilterValues<any> | undefined>(undefined);
238
238
 
239
239
  useEffect(() => {
240
240
  filterRef.current = filterInput;
@@ -285,10 +285,10 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
285
285
  }, [data?.length, onEndReached]);
286
286
 
287
287
  const onScroll = useCallback(({
288
- scrollDirection,
289
- scrollOffset,
290
- scrollUpdateWasRequested
291
- }: {
288
+ scrollDirection,
289
+ scrollOffset,
290
+ scrollUpdateWasRequested
291
+ }: {
292
292
  scrollDirection: "forward" | "backward",
293
293
  scrollOffset: number,
294
294
  scrollUpdateWasRequested: boolean;
@@ -327,21 +327,21 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
327
327
  const empty = !loading && (data?.length ?? 0) === 0;
328
328
  const customView = error
329
329
  ? <CenteredView maxWidth={"2xl"}
330
- className="flex flex-col gap-2">
330
+ className="flex flex-col gap-2">
331
331
 
332
332
  <Typography variant={"h6"}>
333
333
  {"Error"}
334
334
  </Typography>
335
335
 
336
- {error?.message && <SafeLinkRenderer text={error.message}/>}
336
+ {error?.message && <SafeLinkRenderer text={error.message} />}
337
337
 
338
338
  </CenteredView>
339
339
  : (empty
340
340
  ? (loading
341
- ? <CircularProgressCenter/>
341
+ ? <CircularProgressCenter />
342
342
  : <div
343
343
  className="flex flex-col overflow-auto items-center justify-center p-2 gap-2 h-full">
344
- <AssignmentIcon/>
344
+ <AssignmentIcon />
345
345
  {emptyComponent}
346
346
  </div>)
347
347
  : undefined);
@@ -397,7 +397,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
397
397
  itemCount={(data?.length ?? 0) + (endAdornment ? 1 : 0)}
398
398
  onScroll={draggingColumnId ? undefined : onScroll}
399
399
  includeAddColumn={Boolean(AddColumnComponent)}
400
- itemSize={rowHeight}/>
400
+ itemSize={rowHeight} />
401
401
 
402
402
  </VirtualListContext.Provider>
403
403
  </div>
@@ -429,13 +429,13 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
429
429
  );
430
430
  // Wrapper that applies sortable transforms to cells
431
431
  const SortableCellWrapper = ({
432
- columnKey,
433
- width,
434
- isDragging,
435
- isDraggable,
436
- frozen,
437
- children
438
- }: {
432
+ columnKey,
433
+ width,
434
+ isDragging,
435
+ isDraggable,
436
+ frozen,
437
+ children
438
+ }: {
439
439
  columnKey: string;
440
440
  width: number;
441
441
  isDragging: boolean;
@@ -454,6 +454,9 @@ const SortableCellWrapper = ({
454
454
  disabled: !isDraggable || frozen
455
455
  });
456
456
 
457
+ // Remove tabIndex from attributes to avoid capturing focus before cell content
458
+ const { tabIndex: _tabIndex, ...attrsWithoutTabIndex } = attributes;
459
+
457
460
  const style = {
458
461
  // Only use translate, ignore any scale transforms
459
462
  transform: transform ? `translateX(${transform.x}px)` : undefined,
@@ -472,7 +475,7 @@ const SortableCellWrapper = ({
472
475
  "flex-shrink-0",
473
476
  frozen && "sticky left-0 z-10 bg-white dark:bg-surface-950"
474
477
  )}
475
- {...attributes}
478
+ {...attrsWithoutTabIndex}
476
479
  >
477
480
  {children}
478
481
  </div>
@@ -480,15 +483,15 @@ const SortableCellWrapper = ({
480
483
  };
481
484
 
482
485
  function MemoizedList({
483
- outerRef,
484
- width,
485
- height,
486
- itemCount,
487
- onScroll,
488
- itemSize,
489
- includeAddColumn
490
- }: {
491
- outerRef: RefObject<HTMLDivElement>;
486
+ outerRef,
487
+ width,
488
+ height,
489
+ itemCount,
490
+ onScroll,
491
+ itemSize,
492
+ includeAddColumn
493
+ }: {
494
+ outerRef: RefObject<HTMLDivElement | null>;
492
495
  width: number;
493
496
  height: number;
494
497
  itemCount: number;
@@ -502,22 +505,22 @@ function MemoizedList({
502
505
  }) {
503
506
 
504
507
  const Row = useCallback(({
505
- index,
506
- style
507
- }: any) => {
508
+ index,
509
+ style
510
+ }: any) => {
508
511
  return <VirtualListContext.Consumer>
509
512
  {({
510
- onRowClick,
511
- data,
512
- columns,
513
- rowHeight = 54,
514
- cellRenderer,
515
- hoverRow,
516
- rowClassName,
517
- endAdornment,
518
- draggingColumnId,
519
- onColumnsOrderChange
520
- }) => {
513
+ onRowClick,
514
+ data,
515
+ columns,
516
+ rowHeight = 54,
517
+ cellRenderer,
518
+ hoverRow,
519
+ rowClassName,
520
+ endAdornment,
521
+ draggingColumnId,
522
+ onColumnsOrderChange
523
+ }) => {
521
524
 
522
525
  if (endAdornment && index === (data ?? []).length) {
523
526
  return <div style={{
@@ -569,12 +572,12 @@ function MemoizedList({
569
572
  rowData={rowData}
570
573
  cellData={cellData}
571
574
  rowIndex={index}
572
- columnIndex={columnIndex}/>
575
+ columnIndex={columnIndex} />
573
576
  </SortableCellWrapper>
574
577
  );
575
578
  })}
576
579
 
577
- {includeAddColumn && <div className={"w-20"}/>}
580
+ {includeAddColumn && <div className={"w-20"} />}
578
581
 
579
582
  </VirtualTableRow>
580
583
  );
@@ -605,6 +608,6 @@ const SafeLinkRenderer: React.FC<{
605
608
  });
606
609
 
607
610
  return (
608
- <div className={"break-all"} dangerouslySetInnerHTML={{ __html: htmlContent }}/>
611
+ <div className={"break-all"} dangerouslySetInnerHTML={{ __html: htmlContent }} />
609
612
  );
610
613
  };
@@ -34,7 +34,7 @@ export type FilterFormFieldProps<CustomProps> = {
34
34
  };
35
35
 
36
36
  type VirtualTableHeaderProps<M extends Record<string, any>> = {
37
- resizeHandleRef: RefObject<HTMLDivElement>;
37
+ resizeHandleRef: RefObject<HTMLDivElement | null>;
38
38
  columnIndex: number;
39
39
  isResizingIndex: number;
40
40
  column: VirtualTableColumn<any>;
@@ -51,20 +51,20 @@ type VirtualTableHeaderProps<M extends Record<string, any>> = {
51
51
 
52
52
  export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
53
53
  function VirtualTableHeader<M extends Record<string, any>>({
54
- resizeHandleRef,
55
- columnIndex,
56
- isResizingIndex,
57
- sort,
58
- onColumnSort,
59
- onFilterUpdate,
60
- filter,
61
- column,
62
- onClickResizeColumn,
63
- createFilterField,
64
- AdditionalHeaderWidget,
65
- isDragging,
66
- isDraggable
67
- }: VirtualTableHeaderProps<M>) {
54
+ resizeHandleRef,
55
+ columnIndex,
56
+ isResizingIndex,
57
+ sort,
58
+ onColumnSort,
59
+ onFilterUpdate,
60
+ filter,
61
+ column,
62
+ onClickResizeColumn,
63
+ createFilterField,
64
+ AdditionalHeaderWidget,
65
+ isDragging,
66
+ isDraggable
67
+ }: VirtualTableHeaderProps<M>) {
68
68
 
69
69
  const [onHover, setOnHover] = useState(false);
70
70
 
@@ -129,11 +129,11 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
129
129
  <>
130
130
 
131
131
  {AdditionalHeaderWidget &&
132
- <AdditionalHeaderWidget onHover={onHover || openFilter}/>}
132
+ <AdditionalHeaderWidget onHover={onHover || openFilter} />}
133
133
 
134
134
  {column.sortable && (sort || hovered || openFilter) &&
135
135
  <Badge color="secondary"
136
- invisible={!sort}>
136
+ invisible={!sort}>
137
137
  <IconButton
138
138
  size={"small"}
139
139
  className={onHover || openFilter ? "bg-white dark:bg-surface-950" : undefined}
@@ -142,11 +142,11 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
142
142
  }}
143
143
  >
144
144
  {!sort &&
145
- <ArrowUpwardIcon/>}
145
+ <ArrowUpwardIcon />}
146
146
  {sort === "asc" &&
147
- <ArrowUpwardIcon/>}
147
+ <ArrowUpwardIcon />}
148
148
  {sort === "desc" &&
149
- <ArrowUpwardIcon className={"rotate-180"}/>}
149
+ <ArrowUpwardIcon className={"rotate-180"} />}
150
150
  </IconButton>
151
151
  </Badge>
152
152
  }
@@ -154,7 +154,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
154
154
 
155
155
  {column.filter && createFilterField && <div>
156
156
  <Badge color="secondary"
157
- invisible={!filter}>
157
+ invisible={!filter}>
158
158
 
159
159
  <Popover
160
160
  open={openFilter}
@@ -166,16 +166,16 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
166
166
  className={onHover || openFilter ? "bg-white dark:bg-surface-950" : undefined}
167
167
  size={"small"}
168
168
  onClick={handleSettingsClick}>
169
- <FilterListIcon size={"small"}/>
169
+ <FilterListIcon size={"small"} />
170
170
  </IconButton>}
171
171
  >
172
172
  <FilterForm column={column}
173
- filter={filter}
174
- onHover={onHover}
175
- onFilterUpdate={update}
176
- createFilterField={createFilterField}
177
- hidden={hidden}
178
- setHidden={setHidden}/>
173
+ filter={filter}
174
+ onHover={onHover}
175
+ onFilterUpdate={update}
176
+ createFilterField={createFilterField}
177
+ hidden={hidden}
178
+ setHidden={setHidden} />
179
179
 
180
180
  </Popover>
181
181
 
@@ -204,14 +204,14 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
204
204
  }, equal) as React.FunctionComponent<VirtualTableHeaderProps<any>>;
205
205
 
206
206
  function FilterForm<M>({
207
- column,
208
- onFilterUpdate,
209
- filter,
210
- onHover,
211
- createFilterField,
212
- hidden,
213
- setHidden
214
- }: FilterFormProps<M>) {
207
+ column,
208
+ onFilterUpdate,
209
+ filter,
210
+ onHover,
211
+ createFilterField,
212
+ hidden,
213
+ setHidden
214
+ }: FilterFormProps<M>) {
215
215
 
216
216
  const id = column.key;
217
217
 
@@ -245,12 +245,12 @@ function FilterForm<M>({
245
245
  if (!filterField) return null;
246
246
  return (
247
247
  <form noValidate={true}
248
- onSubmit={(e) => {
249
- e.stopPropagation();
250
- e.preventDefault();
251
- submit();
252
- }}
253
- className={"text-surface-900 dark:text-white"}>
248
+ onSubmit={(e) => {
249
+ e.stopPropagation();
250
+ e.preventDefault();
251
+ submit();
252
+ }}
253
+ className={"text-surface-900 dark:text-white"}>
254
254
  <div
255
255
  className={cls(defaultBorderMixin, "py-4 px-6 typography-label border-b")}>
256
256
  {column.title ?? id}
@@ -26,7 +26,7 @@ const SortableColumnHeader = ({
26
26
  }: {
27
27
  column: VirtualTableColumn;
28
28
  columnIndex: number;
29
- columnRefs: React.RefObject<HTMLDivElement>[];
29
+ columnRefs: React.RefObject<HTMLDivElement | null>[];
30
30
  isResizing: number;
31
31
  onFilterUpdate: any;
32
32
  filter: [VirtualTableWhereFilterOp, any] | undefined;
@@ -79,7 +79,7 @@ export function VirtualTableSelect(props: {
79
79
  multiple
80
80
  ? <MultiSelect
81
81
  inputRef={ref}
82
- className="w-full h-full p-0 bg-transparent"
82
+ className="w-full h-full p-0 bg-transparent outline-none"
83
83
  position={"item-aligned"}
84
84
  disabled={disabled}
85
85
  includeClear={false}
@@ -104,8 +104,8 @@ export function VirtualTableSelect(props: {
104
104
  inputRef={ref}
105
105
  size={"large"}
106
106
  fullWidth={true}
107
- className="w-full h-full p-0 bg-transparent"
108
- inputClassName="focus:ring-0 focus-visible:ring-0 outline-none focus:outline-none focus-visible:outline-none"
107
+ className="w-full h-full p-0 bg-transparent outline-none [&_button]:ring-0 [&_button]:ring-offset-0"
108
+ inputClassName="ring-0 ring-offset-0 focus:ring-0 focus-visible:ring-0 outline-none focus:outline-none focus-visible:outline-none focus-visible:ring-offset-0"
109
109
  position={"item-aligned"}
110
110
  disabled={disabled}
111
111
  padding={false}
@@ -92,7 +92,7 @@ export const DefaultAppBar = function DefaultAppBar({
92
92
 
93
93
  const user = userProp ?? authController.user;
94
94
 
95
- let avatarComponent: JSX.Element | null;
95
+ let avatarComponent: React.ReactElement | null;
96
96
 
97
97
  if (user) {
98
98
  const initial = user?.displayName
@@ -105,7 +105,7 @@ export function EntitySidePanel(props: EntitySidePanelProps) {
105
105
  }, [collection?.name, setBlocked, setBlockedNavigationMessage]);
106
106
 
107
107
  if (!props || !collection) {
108
- return <div className={"w-full"}/>;
108
+ return <div className={"w-full"} />;
109
109
  }
110
110
 
111
111
  return (
@@ -120,32 +120,34 @@ export function EntitySidePanel(props: EntitySidePanelProps) {
120
120
  onValuesModified={onValuesModified}
121
121
  onSaved={onUpdate}
122
122
  barActions={({
123
- status,
124
- values
125
- }) => <>
126
- <IconButton
127
- className="self-center"
128
- onClick={onClose}>
129
- <CloseIcon size={"small"}/>
130
- </IconButton>
131
- {allowFullScreen && <IconButton
132
- className="self-center"
133
- onClick={() => {
134
- const key = (status === "new" || status === "copy") ? path + "#new" : path + "/" + entityId;
135
- saveEntityToMemoryCache(key, values);
136
- if (entityId)
137
- navigate(location.pathname);
138
- else
139
- navigate(location.pathname + "#new");
140
- }}>
141
- <OpenInFullIcon size={"small"}/>
142
- </IconButton>}
143
- </>}
123
+ status,
124
+ values
125
+ }) => <>
126
+ <IconButton
127
+ className="self-center"
128
+ size={"smallest"}
129
+ onClick={onClose}>
130
+ <CloseIcon size={"smallest"} />
131
+ </IconButton>
132
+ {allowFullScreen && <IconButton
133
+ className="self-center"
134
+ size={"smallest"}
135
+ onClick={() => {
136
+ const key = (status === "new" || status === "copy") ? path + "#new" : path + "/" + entityId;
137
+ saveEntityToMemoryCache(key, values);
138
+ if (entityId)
139
+ navigate(location.pathname);
140
+ else
141
+ navigate(location.pathname + "#new");
142
+ }}>
143
+ <OpenInFullIcon size={"smallest"} />
144
+ </IconButton>}
145
+ </>}
144
146
  onTabChange={({
145
- entityId,
146
- selectedTab,
147
- collection,
148
- }) => {
147
+ entityId,
148
+ selectedTab,
149
+ collection,
150
+ }) => {
149
151
  sideEntityController.replace({
150
152
  path,
151
153
  entityId,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
 
3
- import { ArrayProperty, FieldProps, Property, PropertyConfig, ResolvedProperty } from "../types";
3
+ import { ArrayProperty, FieldProps, NumberProperty, Property, PropertyConfig, ResolvedProperty, StringProperty } from "../types";
4
4
  import {
5
5
  ArrayCustomShapedFieldBinding,
6
6
  ArrayOfReferencesFieldBinding,
@@ -397,14 +397,19 @@ export function getDefaultFieldId(property: Property | ResolvedProperty) {
397
397
  return "custom_array";
398
398
  } else if (isPropertyBuilder(of)) {
399
399
  return "repeat";
400
- } else if (of?.dataType === "string" && of.enumValues) {
401
- return "multi_select";
402
- } else if (of?.dataType === "number" && of.enumValues) {
403
- return "multi_number_select";
404
- } else if (of?.dataType === "string" && of.storage) {
405
- return "multi_file_upload";
406
- } else if (of?.dataType === "reference") {
407
- return "multi_references";
400
+ } else if (of) {
401
+ const ofProperty = of as Property;
402
+ if (ofProperty.dataType === "string" && (ofProperty as StringProperty).enumValues) {
403
+ return "multi_select";
404
+ } else if (ofProperty.dataType === "number" && (ofProperty as NumberProperty).enumValues) {
405
+ return "multi_number_select";
406
+ } else if (ofProperty.dataType === "string" && (ofProperty as StringProperty).storage) {
407
+ return "multi_file_upload";
408
+ } else if (ofProperty.dataType === "reference") {
409
+ return "multi_references";
410
+ } else {
411
+ return "repeat";
412
+ }
408
413
  } else {
409
414
  return "repeat";
410
415
  }