@firecms/core 3.0.0-canary.8 → 3.0.0-canary.80
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.
- package/README.md +1 -1
- package/dist/app/AppBar.d.ts +12 -0
- package/dist/app/Drawer.d.ts +17 -0
- package/dist/app/Scaffold.d.ts +30 -0
- package/dist/app/index.d.ts +4 -0
- package/dist/app/useApp.d.ts +16 -0
- package/dist/components/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -11
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
- package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
- package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
- package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +11 -1
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityPreview.d.ts +5 -4
- package/dist/components/ReferenceWidget.d.ts +3 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +5 -6
- package/dist/components/VirtualTable/types.d.ts +3 -3
- package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/common/table_height.d.ts +5 -0
- package/dist/components/common/types.d.ts +4 -6
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/contexts/AuthControllerContext.d.ts +1 -1
- package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +5 -8
- package/dist/core/DefaultDrawer.d.ts +19 -0
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/EntityEditView.d.ts +17 -3
- package/dist/core/NavigationRoutes.d.ts +2 -2
- package/dist/core/index.d.ts +3 -4
- package/dist/form/PropertiesForm.d.ts +8 -0
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/form/components/FieldHelperText.d.ts +3 -3
- package/dist/form/components/StorageItemPreview.d.ts +4 -4
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -4
- package/dist/form/index.d.ts +0 -2
- package/dist/hooks/data/delete.d.ts +2 -2
- package/dist/hooks/data/save.d.ts +2 -3
- package/dist/hooks/data/useDataSource.d.ts +1 -1
- package/dist/hooks/data/useEntityFetch.d.ts +3 -3
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useBuildNavigationController.d.ts +1 -2
- package/dist/hooks/useProjectLog.d.ts +2 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +9816 -9546
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildDataSource.d.ts +1 -16
- package/dist/internal/useRestoreScroll.d.ts +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +6 -4
- package/dist/preview/components/ReferencePreview.d.ts +2 -1
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/types/auth.d.ts +31 -2
- package/dist/types/collections.d.ts +30 -5
- package/dist/types/datasource.d.ts +21 -14
- package/dist/types/entities.d.ts +5 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/entity_callbacks.d.ts +2 -2
- package/dist/types/fields.d.ts +31 -30
- package/dist/types/index.d.ts +1 -1
- package/dist/types/navigation.d.ts +5 -5
- package/dist/types/plugins.d.ts +16 -6
- package/dist/types/properties.d.ts +17 -4
- package/dist/types/roles.d.ts +31 -0
- package/dist/types/storage.d.ts +11 -3
- package/dist/types/user.d.ts +5 -0
- package/dist/util/collections.d.ts +1 -1
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +2 -2
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/resolutions.d.ts +13 -13
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/useStorageUploadController.d.ts +1 -1
- package/dist/util/useTraceUpdate.d.ts +1 -0
- package/package.json +130 -119
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +25 -0
- package/src/app/Scaffold.tsx +249 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +8 -10
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +19 -18
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +10 -6
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +38 -34
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +10 -2
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +16 -12
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +4 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +54 -29
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityPreview.tsx +14 -9
- package/src/components/EntityView.tsx +5 -5
- package/src/components/HomePage/DefaultHomePage.tsx +2 -2
- package/src/components/HomePage/NavigationCard.tsx +3 -3
- package/src/components/HomePage/SmallNavigationCard.tsx +5 -5
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +1 -0
- package/src/components/ReferenceWidget.tsx +22 -12
- package/src/components/SearchIconsView.tsx +5 -5
- package/src/components/SelectableTable/SelectableTable.tsx +5 -3
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +23 -8
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +28 -6
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
- package/src/components/VirtualTable/VirtualTable.tsx +38 -29
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +6 -6
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
- package/src/components/common/index.ts +1 -0
- package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
- package/src/components/common/types.tsx +4 -6
- package/src/components/common/useColumnsIds.tsx +10 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/components/common/useTableSearchHelper.ts +52 -12
- package/src/components/index.tsx +2 -1
- package/src/contexts/AuthControllerContext.tsx +1 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +51 -36
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +673 -134
- package/src/core/EntitySidePanel.tsx +1 -2
- package/src/core/FireCMS.tsx +38 -43
- package/src/core/NavigationRoutes.tsx +6 -7
- package/src/core/field_configs.tsx +2 -3
- package/src/core/index.tsx +3 -4
- package/src/form/PropertiesForm.tsx +81 -0
- package/src/form/PropertyFieldBinding.tsx +29 -7
- package/src/form/components/FieldHelperText.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +20 -11
- package/src/form/components/StorageUploadProgress.tsx +3 -3
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +8 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +8 -5
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -2
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +44 -39
- package/src/form/field_bindings/MapFieldBinding.tsx +11 -3
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +2 -2
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +2 -9
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +15 -13
- package/src/form/field_bindings/RepeatFieldBinding.tsx +10 -7
- package/src/form/field_bindings/SelectFieldBinding.tsx +3 -3
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +10 -39
- package/src/form/field_bindings/SwitchFieldBinding.tsx +1 -1
- package/src/form/index.tsx +4 -4
- package/src/form/validation.ts +1 -17
- package/src/hooks/data/delete.ts +3 -3
- package/src/hooks/data/save.ts +4 -2
- package/src/hooks/data/useDataSource.tsx +1 -1
- package/src/hooks/data/useEntityFetch.tsx +3 -3
- package/src/hooks/index.tsx +3 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
- package/src/hooks/useBuildModeController.tsx +11 -5
- package/src/hooks/useBuildNavigationController.tsx +137 -61
- package/src/hooks/useProjectLog.tsx +8 -6
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +115 -0
- package/src/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +54 -47
- package/src/internal/useBuildSideEntityController.tsx +88 -21
- package/src/preview/PropertyPreview.tsx +9 -16
- package/src/preview/PropertyPreviewProps.tsx +4 -8
- package/src/preview/components/BooleanPreview.tsx +4 -2
- package/src/preview/components/EnumValuesChip.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +21 -33
- package/src/preview/components/ReferencePreview.tsx +23 -23
- package/src/preview/components/StorageThumbnail.tsx +5 -1
- package/src/preview/components/UrlComponentPreview.tsx +44 -11
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +5 -5
- package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
- package/src/types/auth.tsx +41 -2
- package/src/types/collections.ts +35 -5
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +24 -17
- package/src/types/entities.ts +9 -1
- package/src/types/entity_actions.tsx +16 -3
- package/src/types/entity_callbacks.ts +2 -2
- package/src/types/fields.tsx +33 -33
- package/src/types/index.ts +1 -1
- package/src/types/navigation.ts +6 -7
- package/src/types/plugins.tsx +18 -8
- package/src/types/properties.ts +22 -6
- package/src/types/roles.ts +41 -0
- package/src/types/storage.ts +12 -3
- package/src/types/user.ts +7 -0
- package/src/util/collections.ts +1 -1
- package/src/util/entities.ts +5 -4
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +2 -2
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/navigation_utils.ts +6 -6
- package/src/util/objects.ts +25 -28
- package/src/util/permissions.ts +1 -0
- package/src/util/resolutions.ts +32 -31
- package/src/util/storage.ts +75 -21
- package/src/util/strings.ts +2 -2
- package/src/util/useStorageUploadController.tsx +21 -3
- package/src/util/useTraceUpdate.tsx +2 -1
- package/dist/components/VirtualTable/common.d.ts +0 -2
- package/dist/core/Drawer.d.ts +0 -23
- package/dist/core/Scaffold.d.ts +0 -55
- package/dist/core/SideEntityView.d.ts +0 -7
- package/dist/form/EntityForm.d.ts +0 -77
- package/dist/internal/useBuildCustomizationController.d.ts +0 -2
- package/dist/internal/useLocaleConfig.d.ts +0 -1
- package/dist/types/appcheck.d.ts +0 -26
- package/src/core/Drawer.tsx +0 -191
- package/src/core/Scaffold.tsx +0 -281
- package/src/core/SideEntityView.tsx +0 -38
- package/src/form/EntityForm.tsx +0 -728
- package/src/internal/useBuildCustomizationController.tsx +0 -5
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { MouseEvent, useCallback } from "react";
|
|
2
2
|
|
|
3
3
|
import { CollectionSize, Entity, EntityAction, EntityCollection, SelectionController } from "../../types";
|
|
4
|
-
import { Checkbox,
|
|
4
|
+
import { Checkbox, cls, IconButton, Menu, MenuItem, MoreVertIcon, Skeleton, Tooltip } from "@firecms/ui";
|
|
5
5
|
import { useFireCMSContext, useLargeLayout } from "../../hooks";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -72,7 +72,7 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
72
72
|
return (
|
|
73
73
|
<div
|
|
74
74
|
onClick={onClick}
|
|
75
|
-
className={
|
|
75
|
+
className={cls(
|
|
76
76
|
"h-full flex items-center justify-center flex-col bg-gray-50 dark:bg-gray-900 bg-opacity-90 dark:bg-opacity-90 z-10",
|
|
77
77
|
frozen ? "sticky left-0" : ""
|
|
78
78
|
)}
|
|
@@ -149,16 +149,14 @@ export const EntityCollectionRowActions = function EntityCollectionRowActions({
|
|
|
149
149
|
</div>}
|
|
150
150
|
|
|
151
151
|
{!hideId && size !== "xs" && (
|
|
152
|
-
<div
|
|
152
|
+
<div
|
|
153
|
+
className="w-[138px] text-center overflow-hidden truncate font-mono text-xs text-text-secondary dark:text-text-secondary-dark max-w-full text-ellipsis px-2"
|
|
154
|
+
onClick={(event) => {
|
|
155
|
+
event.stopPropagation();
|
|
156
|
+
}}>
|
|
153
157
|
|
|
154
158
|
{entity
|
|
155
|
-
?
|
|
156
|
-
onClick={(event) => {
|
|
157
|
-
event.stopPropagation();
|
|
158
|
-
}}
|
|
159
|
-
className={"font-mono select-all"}
|
|
160
|
-
variant={"caption"}
|
|
161
|
-
color={"secondary"}> {entity.id} </Typography>
|
|
159
|
+
? entity.id
|
|
162
160
|
: <Skeleton/>
|
|
163
161
|
}
|
|
164
162
|
</div>
|
|
@@ -5,7 +5,6 @@ import { ErrorBoundary } from "../ErrorBoundary";
|
|
|
5
5
|
import { useFireCMSContext, useLargeLayout } from "../../hooks";
|
|
6
6
|
import { CellRendererParams, VirtualTableColumn } from "../VirtualTable";
|
|
7
7
|
import { getValueInPath } from "../../util";
|
|
8
|
-
import { getRowHeight } from "../VirtualTable/common";
|
|
9
8
|
import { EntityCollectionRowActions } from "./EntityCollectionRowActions";
|
|
10
9
|
import { CollectionTableToolbar } from "./internal/CollectionTableToolbar";
|
|
11
10
|
import { EntityCollectionTableProps } from "./EntityCollectionTableProps";
|
|
@@ -15,7 +14,8 @@ import { renderSkeletonText } from "../../preview";
|
|
|
15
14
|
import { propertiesToColumns } from "./column_utils";
|
|
16
15
|
import { ErrorView } from "../ErrorView";
|
|
17
16
|
import { SelectableTable } from "../SelectableTable/SelectableTable";
|
|
18
|
-
|
|
17
|
+
import { cls } from "@firecms/ui";
|
|
18
|
+
import { getRowHeight } from "../common/table_height";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* This component is in charge of rendering a collection table with a high
|
|
@@ -43,6 +43,8 @@ import { SelectableTable } from "../SelectableTable/SelectableTable";
|
|
|
43
43
|
*/
|
|
44
44
|
export const EntityCollectionTable = function EntityCollectionTable<M extends Record<string, any>, UserType extends User>
|
|
45
45
|
({
|
|
46
|
+
className,
|
|
47
|
+
style,
|
|
46
48
|
forceFilter,
|
|
47
49
|
actionsStart,
|
|
48
50
|
actions,
|
|
@@ -73,13 +75,13 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
73
75
|
emptyComponent,
|
|
74
76
|
getIdColumnWidth,
|
|
75
77
|
onTextSearchClick,
|
|
76
|
-
textSearchLoading
|
|
78
|
+
textSearchLoading,
|
|
79
|
+
enablePopupIcon
|
|
77
80
|
}: EntityCollectionTableProps<M>) {
|
|
78
81
|
|
|
79
82
|
const ref = useRef<HTMLDivElement>(null);
|
|
80
83
|
|
|
81
84
|
const largeLayout = useLargeLayout();
|
|
82
|
-
const disabledFilterChange = Boolean(forceFilter);
|
|
83
85
|
const selectedEntities = (selectionController?.selectedEntities?.length > 0 ? selectionController?.selectedEntities : highlightedEntities)?.filter(Boolean);
|
|
84
86
|
|
|
85
87
|
const context: FireCMSContext<UserType> = useFireCMSContext();
|
|
@@ -88,8 +90,6 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
88
90
|
|
|
89
91
|
const selectedEntityIds = selectedEntities?.map(e => e.id);
|
|
90
92
|
|
|
91
|
-
const filterIsSet = !!tableController.filterValues && Object.keys(tableController.filterValues).length > 0;
|
|
92
|
-
|
|
93
93
|
const updateSize = useCallback((size: CollectionSize) => {
|
|
94
94
|
if (onSizeChanged)
|
|
95
95
|
onSizeChanged(size);
|
|
@@ -120,10 +120,8 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
120
120
|
const propertyKey = column.key;
|
|
121
121
|
|
|
122
122
|
let disabled = column.custom?.disabled;
|
|
123
|
-
const propertyValue = entity.values ? getValueInPath(entity.values, propertyKey) : undefined;
|
|
124
123
|
const property = getPropertyFor?.({
|
|
125
124
|
propertyKey,
|
|
126
|
-
propertyValue,
|
|
127
125
|
entity
|
|
128
126
|
}) ?? column.custom.resolvedProperty;
|
|
129
127
|
if (!property?.disabled) {
|
|
@@ -150,6 +148,7 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
150
148
|
height={getRowHeight(size)}
|
|
151
149
|
entity={entity}
|
|
152
150
|
disabled={disabled}
|
|
151
|
+
enablePopupIcon={enablePopupIcon}
|
|
153
152
|
path={entity.path}/>
|
|
154
153
|
: renderSkeletonText()
|
|
155
154
|
}
|
|
@@ -179,7 +178,10 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
179
178
|
|
|
180
179
|
const child = Builder
|
|
181
180
|
? <Builder entity={entity} context={context}/>
|
|
182
|
-
: <>{additionalField.value?.({
|
|
181
|
+
: <>{additionalField.value?.({
|
|
182
|
+
entity,
|
|
183
|
+
context
|
|
184
|
+
})}</>;
|
|
183
185
|
|
|
184
186
|
return (
|
|
185
187
|
<EntityTableCell
|
|
@@ -207,7 +209,6 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
207
209
|
properties,
|
|
208
210
|
sortable,
|
|
209
211
|
forceFilter,
|
|
210
|
-
disabledFilter: disabledFilterChange,
|
|
211
212
|
AdditionalHeaderWidget
|
|
212
213
|
});
|
|
213
214
|
|
|
@@ -237,10 +238,12 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
237
238
|
|
|
238
239
|
const columns: VirtualTableColumn[] = [
|
|
239
240
|
idColumn,
|
|
240
|
-
...displayedColumnIds
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
...(displayedColumnIds
|
|
242
|
+
? displayedColumnIds
|
|
243
|
+
.map((p) => {
|
|
244
|
+
return collectionColumns.find(c => c.key === p.key);
|
|
245
|
+
}).filter(Boolean)
|
|
246
|
+
: collectionColumns) as VirtualTableColumn[]
|
|
244
247
|
];
|
|
245
248
|
|
|
246
249
|
const cellRenderer = (props: CellRendererParams<any>) => {
|
|
@@ -288,15 +291,13 @@ export const EntityCollectionTable = function EntityCollectionTable<M extends Re
|
|
|
288
291
|
return (
|
|
289
292
|
|
|
290
293
|
<div ref={ref}
|
|
291
|
-
|
|
294
|
+
style={style}
|
|
295
|
+
className={cls("h-full w-full flex flex-col bg-white dark:bg-gray-950", className)}>
|
|
292
296
|
|
|
293
297
|
<CollectionTableToolbar
|
|
294
|
-
forceFilter={disabledFilterChange}
|
|
295
|
-
filterIsSet={filterIsSet}
|
|
296
298
|
onTextSearch={textSearchEnabled ? onTextSearch : undefined}
|
|
297
299
|
textSearchLoading={textSearchLoading}
|
|
298
300
|
onTextSearchClick={textSearchEnabled ? onTextSearchClick : undefined}
|
|
299
|
-
clearFilter={tableController.clearFilter}
|
|
300
301
|
size={size}
|
|
301
302
|
onSizeChanged={updateSize}
|
|
302
303
|
title={title}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
AdditionalFieldDelegate,
|
|
4
4
|
CollectionSize,
|
|
5
|
-
Entity,
|
|
5
|
+
Entity,
|
|
6
6
|
EntityTableController,
|
|
7
7
|
FilterValues,
|
|
8
8
|
ResolvedProperties,
|
|
@@ -12,13 +12,16 @@ import {
|
|
|
12
12
|
} from "../../types";
|
|
13
13
|
import { OnCellValueChange, OnColumnResizeParams, UniqueFieldValidator } from "../common/types";
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
/**
|
|
17
16
|
* @group Collection components
|
|
18
17
|
*/
|
|
19
18
|
export type EntityCollectionTableProps<M extends Record<string, any>,
|
|
20
19
|
UserType extends User = User> = {
|
|
21
20
|
|
|
21
|
+
className?: string;
|
|
22
|
+
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
|
|
22
25
|
/**
|
|
23
26
|
* Display these entities as selected
|
|
24
27
|
*/
|
|
@@ -92,7 +95,7 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
|
|
|
92
95
|
*/
|
|
93
96
|
tableController: EntityTableController<M>;
|
|
94
97
|
|
|
95
|
-
displayedColumnIds
|
|
98
|
+
displayedColumnIds?: PropertyColumnConfig[];
|
|
96
99
|
|
|
97
100
|
forceFilter?: FilterValues<Extract<keyof M, string>>;
|
|
98
101
|
|
|
@@ -131,15 +134,16 @@ export type EntityCollectionTableProps<M extends Record<string, any>,
|
|
|
131
134
|
onTextSearchClick?: () => void;
|
|
132
135
|
|
|
133
136
|
textSearchLoading?: boolean;
|
|
134
|
-
|
|
137
|
+
|
|
138
|
+
enablePopupIcon: boolean;
|
|
139
|
+
};
|
|
135
140
|
|
|
136
141
|
export type GetPropertyForProps<M extends Record<string, any>> = {
|
|
137
142
|
propertyKey: string,
|
|
138
|
-
propertyValue: any,
|
|
139
143
|
entity: Entity<M>
|
|
140
144
|
};
|
|
141
145
|
|
|
142
146
|
export type PropertyColumnConfig = {
|
|
143
147
|
key: string,
|
|
144
|
-
disabled
|
|
148
|
+
disabled?: boolean,
|
|
145
149
|
};
|
|
@@ -24,14 +24,13 @@ import { getPreviewSizeFrom } from "../../preview/util";
|
|
|
24
24
|
import { isReadOnly } from "../../util";
|
|
25
25
|
|
|
26
26
|
import { CustomFieldValidator, mapPropertyToYup } from "../../form/validation";
|
|
27
|
-
import { useFireCMSContext } from "../../hooks";
|
|
28
27
|
|
|
29
28
|
import { EntityTableCell } from "./internal/EntityTableCell";
|
|
30
29
|
import { EntityTableCellActions } from "./internal/EntityTableCellActions";
|
|
31
30
|
|
|
32
|
-
import { getRowHeight } from "../VirtualTable/common";
|
|
33
31
|
import { useSelectableTableController } from "../SelectableTable/SelectableTableContext";
|
|
34
32
|
import { useClearRestoreValue } from "../../form/useClearRestoreValue";
|
|
33
|
+
import { getRowHeight } from "../common/table_height";
|
|
35
34
|
|
|
36
35
|
export interface PropertyTableCellProps<T extends CMSType> {
|
|
37
36
|
propertyKey: string;
|
|
@@ -46,6 +45,7 @@ export interface PropertyTableCellProps<T extends CMSType> {
|
|
|
46
45
|
entity: Entity<any>;
|
|
47
46
|
path: string;
|
|
48
47
|
disabled: boolean;
|
|
48
|
+
enablePopupIcon?: boolean;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function isStorageProperty(property: ResolvedProperty) {
|
|
@@ -74,11 +74,10 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
74
74
|
path,
|
|
75
75
|
entity,
|
|
76
76
|
readonly,
|
|
77
|
-
disabled: disabledProp
|
|
77
|
+
disabled: disabledProp,
|
|
78
|
+
enablePopupIcon = true
|
|
78
79
|
}: PropertyTableCellProps<T>) {
|
|
79
80
|
|
|
80
|
-
const context = useFireCMSContext();
|
|
81
|
-
|
|
82
81
|
const {
|
|
83
82
|
onValueChange,
|
|
84
83
|
size,
|
|
@@ -95,6 +94,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
95
94
|
const internalValueRef = useRef(value);
|
|
96
95
|
|
|
97
96
|
const [error, setError] = useState<Error | undefined>();
|
|
97
|
+
const [validationError, setValidationError] = useState<Error | undefined>();
|
|
98
98
|
const [saved, setSaved] = useState<boolean>(false);
|
|
99
99
|
|
|
100
100
|
const onValueUpdated = useCallback(() => {
|
|
@@ -120,7 +120,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
120
120
|
useEffect(
|
|
121
121
|
() => {
|
|
122
122
|
if (!equal(value, internalValueRef.current)) {
|
|
123
|
-
|
|
123
|
+
setValidationError(undefined);
|
|
124
124
|
setInternalValue(value);
|
|
125
125
|
internalValueRef.current = value;
|
|
126
126
|
onValueUpdated();
|
|
@@ -136,32 +136,34 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
136
136
|
validation
|
|
137
137
|
.validate(value)
|
|
138
138
|
.then(() => {
|
|
139
|
-
|
|
139
|
+
setValidationError(undefined);
|
|
140
140
|
internalValueRef.current = value;
|
|
141
141
|
if (onValueChange) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
})
|
|
142
|
+
try {
|
|
143
|
+
onValueChange({
|
|
144
|
+
value,
|
|
145
|
+
propertyKey,
|
|
146
|
+
setError,
|
|
147
|
+
onValueUpdated,
|
|
148
|
+
data: entity,
|
|
149
|
+
});
|
|
150
|
+
} catch (e:any) {
|
|
151
|
+
console.error("onValueChange error", e);
|
|
152
|
+
setError(e);
|
|
153
|
+
}
|
|
154
|
+
|
|
151
155
|
}
|
|
152
156
|
})
|
|
153
157
|
.catch((e) => {
|
|
154
|
-
|
|
158
|
+
setValidationError(e);
|
|
155
159
|
});
|
|
156
160
|
};
|
|
157
161
|
|
|
158
162
|
useEffect(() => {
|
|
159
163
|
validation
|
|
160
164
|
.validate(internalValue)
|
|
161
|
-
.then(() =>
|
|
162
|
-
.catch(
|
|
163
|
-
setError(e);
|
|
164
|
-
});
|
|
165
|
+
.then(() => setValidationError(undefined))
|
|
166
|
+
.catch(setValidationError);
|
|
165
167
|
}, [internalValue, validation, propertyKey, property, entity]);
|
|
166
168
|
|
|
167
169
|
const updateValue = (newValue: any | null) => {
|
|
@@ -237,7 +239,6 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
237
239
|
height={getRowHeight(size)}
|
|
238
240
|
propertyKey={propertyKey}
|
|
239
241
|
property={property}
|
|
240
|
-
// entity={entity}
|
|
241
242
|
value={internalValue}
|
|
242
243
|
size={getPreviewSizeFrom(size)}
|
|
243
244
|
/>
|
|
@@ -247,7 +248,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
247
248
|
if (!customField && (!customPreview || selected)) {
|
|
248
249
|
const isAStorageProperty = isStorageProperty(property);
|
|
249
250
|
if (isAStorageProperty) {
|
|
250
|
-
innerComponent = <TableStorageUpload error={error}
|
|
251
|
+
innerComponent = <TableStorageUpload error={validationError ?? error}
|
|
251
252
|
disabled={disabled}
|
|
252
253
|
focused={selected}
|
|
253
254
|
selected={selected}
|
|
@@ -274,7 +275,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
274
275
|
valueType={"number"}
|
|
275
276
|
small={getPreviewSizeFrom(size) !== "medium"}
|
|
276
277
|
enumValues={numberProperty.enumValues}
|
|
277
|
-
error={error}
|
|
278
|
+
error={validationError ?? error}
|
|
278
279
|
internalValue={internalValue as string | number}
|
|
279
280
|
updateValue={updateValue}
|
|
280
281
|
/>;
|
|
@@ -282,7 +283,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
282
283
|
} else {
|
|
283
284
|
innerComponent = <VirtualTableNumberInput
|
|
284
285
|
align={align}
|
|
285
|
-
error={error}
|
|
286
|
+
error={validationError ?? error}
|
|
286
287
|
focused={selected}
|
|
287
288
|
disabled={disabled}
|
|
288
289
|
value={internalValue as number}
|
|
@@ -300,14 +301,14 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
300
301
|
valueType={"string"}
|
|
301
302
|
small={getPreviewSizeFrom(size) !== "medium"}
|
|
302
303
|
enumValues={stringProperty.enumValues}
|
|
303
|
-
error={error}
|
|
304
|
+
error={validationError ?? error}
|
|
304
305
|
internalValue={internalValue as string | number}
|
|
305
306
|
updateValue={updateValue}
|
|
306
307
|
/>;
|
|
307
308
|
fullHeight = true;
|
|
308
309
|
} else if (!stringProperty.storage) {
|
|
309
310
|
const multiline = Boolean(stringProperty.multiline) || Boolean(stringProperty.markdown);
|
|
310
|
-
innerComponent = <VirtualTableInput error={error}
|
|
311
|
+
innerComponent = <VirtualTableInput error={validationError ?? error}
|
|
311
312
|
disabled={disabled}
|
|
312
313
|
multiline={multiline}
|
|
313
314
|
focused={selected}
|
|
@@ -317,7 +318,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
317
318
|
allowScroll = true;
|
|
318
319
|
}
|
|
319
320
|
} else if (property.dataType === "boolean") {
|
|
320
|
-
innerComponent = <VirtualTableSwitch error={error}
|
|
321
|
+
innerComponent = <VirtualTableSwitch error={validationError ?? error}
|
|
321
322
|
disabled={disabled}
|
|
322
323
|
focused={selected}
|
|
323
324
|
internalValue={internalValue as boolean}
|
|
@@ -325,7 +326,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
325
326
|
/>;
|
|
326
327
|
} else if (property.dataType === "date") {
|
|
327
328
|
innerComponent = <VirtualTableDateField name={propertyKey as string}
|
|
328
|
-
error={error}
|
|
329
|
+
error={validationError ?? error}
|
|
329
330
|
disabled={disabled}
|
|
330
331
|
mode={property.mode}
|
|
331
332
|
focused={selected}
|
|
@@ -346,6 +347,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
346
347
|
path={property.path}
|
|
347
348
|
multiselect={false}
|
|
348
349
|
previewProperties={property.previewProperties}
|
|
350
|
+
includeId={property.includeId}
|
|
351
|
+
includeEntityLink={property.includeEntityLink}
|
|
349
352
|
title={property.name}
|
|
350
353
|
forceFilter={property.forceFilter}
|
|
351
354
|
/>;
|
|
@@ -368,7 +371,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
368
371
|
small={getPreviewSizeFrom(size) !== "medium"}
|
|
369
372
|
valueType={arrayProperty.of.dataType}
|
|
370
373
|
enumValues={arrayProperty.of.enumValues}
|
|
371
|
-
error={error}
|
|
374
|
+
error={validationError ?? error}
|
|
372
375
|
internalValue={internalValue as string | number}
|
|
373
376
|
updateValue={updateValue}
|
|
374
377
|
/>;
|
|
@@ -390,6 +393,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
390
393
|
previewProperties={arrayProperty.of.previewProperties}
|
|
391
394
|
title={arrayProperty.name}
|
|
392
395
|
forceFilter={arrayProperty.of.forceFilter}
|
|
396
|
+
includeId={arrayProperty.of.includeId}
|
|
397
|
+
includeEntityLink={arrayProperty.of.includeEntityLink}
|
|
393
398
|
/>;
|
|
394
399
|
}
|
|
395
400
|
allowScroll = false;
|
|
@@ -401,11 +406,10 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
401
406
|
|
|
402
407
|
if (!innerComponent) {
|
|
403
408
|
allowScroll = false;
|
|
404
|
-
showExpandIcon = selected && !innerComponent && !disabled && !readOnlyProperty;
|
|
409
|
+
showExpandIcon = enablePopupIcon && selected && !innerComponent && !disabled && !readOnlyProperty;
|
|
405
410
|
innerComponent = (
|
|
406
|
-
<PropertyPreview
|
|
411
|
+
<PropertyPreview width={width}
|
|
407
412
|
height={height}
|
|
408
|
-
// entity={entity}
|
|
409
413
|
propertyKey={propertyKey as string}
|
|
410
414
|
value={internalValue}
|
|
411
415
|
property={property}
|
|
@@ -426,7 +430,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
|
426
430
|
removePadding={removePadding}
|
|
427
431
|
fullHeight={fullHeight}
|
|
428
432
|
saved={saved}
|
|
429
|
-
error={error}
|
|
433
|
+
error={validationError ?? error}
|
|
430
434
|
align={align}
|
|
431
435
|
allowScroll={allowScroll}
|
|
432
436
|
showExpandIcon={showExpandIcon}
|
|
@@ -21,7 +21,6 @@ export interface PropertiesToColumnsParams<M extends Record<string, any>> {
|
|
|
21
21
|
properties: ResolvedProperties<M>;
|
|
22
22
|
sortable?: boolean;
|
|
23
23
|
forceFilter?: FilterValues<keyof M extends string ? keyof M : never>;
|
|
24
|
-
disabledFilter?: boolean;
|
|
25
24
|
AdditionalHeaderWidget?: React.ComponentType<{
|
|
26
25
|
property: ResolvedProperty,
|
|
27
26
|
propertyKey: string,
|
|
@@ -29,7 +28,8 @@ export interface PropertiesToColumnsParams<M extends Record<string, any>> {
|
|
|
29
28
|
}>;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
export function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forceFilter,
|
|
31
|
+
export function propertiesToColumns<M extends Record<string, any>>({ properties, sortable, forceFilter, AdditionalHeaderWidget }: PropertiesToColumnsParams<M>): VirtualTableColumn[] {
|
|
32
|
+
const disabledFilter = Boolean(forceFilter);
|
|
33
33
|
return Object.entries<ResolvedProperty>(properties)
|
|
34
34
|
.flatMap(([key, property]) => getColumnKeysForProperty(property, key))
|
|
35
35
|
.map(({
|
|
@@ -45,7 +45,7 @@ export function propertiesToColumns<M extends Record<string, any>>({ properties,
|
|
|
45
45
|
align: getTableCellAlignment(property),
|
|
46
46
|
icon: getIconForProperty(property, "small"),
|
|
47
47
|
title: property.name ?? key as string,
|
|
48
|
-
sortable: sortable
|
|
48
|
+
sortable: sortable,
|
|
49
49
|
filter: !disabledFilter && filterable,
|
|
50
50
|
width: getTablePropertyColumnWidth(property),
|
|
51
51
|
resizable: true,
|
|
@@ -22,6 +22,8 @@ type TableReferenceFieldProps = {
|
|
|
22
22
|
title?: string;
|
|
23
23
|
path: string;
|
|
24
24
|
forceFilter?: FilterValues<string>;
|
|
25
|
+
includeId?: boolean;
|
|
26
|
+
includeEntityLink?: boolean;
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
export function TableReferenceField(props: TableReferenceFieldProps) {
|
|
@@ -29,7 +31,7 @@ export function TableReferenceField(props: TableReferenceFieldProps) {
|
|
|
29
31
|
|
|
30
32
|
const navigationController = useNavigationController();
|
|
31
33
|
const { path } = props;
|
|
32
|
-
const collection = navigationController.getCollection
|
|
34
|
+
const collection = navigationController.getCollection(path);
|
|
33
35
|
if (!collection) {
|
|
34
36
|
if (customizationController.components?.missingReference) {
|
|
35
37
|
return <customizationController.components.missingReference path={path}/>;
|
|
@@ -55,7 +57,9 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
55
57
|
title,
|
|
56
58
|
disabled,
|
|
57
59
|
forceFilter,
|
|
58
|
-
collection
|
|
60
|
+
collection,
|
|
61
|
+
includeId,
|
|
62
|
+
includeEntityLink
|
|
59
63
|
} = props;
|
|
60
64
|
|
|
61
65
|
const onSingleEntitySelected = useCallback((entity: Entity<any>) => {
|
|
@@ -100,6 +104,8 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
100
104
|
hover={!disabled}
|
|
101
105
|
disabled={!path}
|
|
102
106
|
previewProperties={previewProperties}
|
|
107
|
+
includeId={includeId}
|
|
108
|
+
includeEntityLink={includeEntityLink}
|
|
103
109
|
/>;
|
|
104
110
|
else
|
|
105
111
|
return <EntityPreviewContainer
|
|
@@ -122,6 +128,8 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
122
128
|
hover={!disabled}
|
|
123
129
|
disabled={!path}
|
|
124
130
|
previewProperties={previewProperties}
|
|
131
|
+
includeId={includeId}
|
|
132
|
+
includeEntityLink={includeEntityLink}
|
|
125
133
|
/>
|
|
126
134
|
</div>
|
|
127
135
|
)
|
|
@@ -9,7 +9,7 @@ import { useSnackbarController, useStorageSource } from "../../../hooks";
|
|
|
9
9
|
import { getThumbnailMeasure } from "../../../preview/util";
|
|
10
10
|
import { StorageFieldItem, useStorageUploadController } from "../../../util/useStorageUploadController";
|
|
11
11
|
import { StorageUploadProgress } from "../../../form/components/StorageUploadProgress";
|
|
12
|
-
import {
|
|
12
|
+
import { cls, EditIcon, IconButton, Typography } from "@firecms/ui";
|
|
13
13
|
import { EntityTableCellActions } from "../internal/EntityTableCellActions";
|
|
14
14
|
|
|
15
15
|
const dropZoneClasses = "max-w-full box-border relative pt-[2px] items-center border border-transparent outline-none rounded-md duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] focus:border-primary-solid";
|
|
@@ -207,7 +207,7 @@ function StorageUpload({
|
|
|
207
207
|
onMouseEnter={() => setOnHover(true)}
|
|
208
208
|
onMouseMove={() => setOnHover(true)}
|
|
209
209
|
onMouseLeave={() => setOnHover(false)}
|
|
210
|
-
className={
|
|
210
|
+
className={cls(dropZoneClasses,
|
|
211
211
|
"relative w-full h-full flex",
|
|
212
212
|
`justify-${hasValue ? "start" : "center"}`,
|
|
213
213
|
isDragActive ? activeDropClasses : "",
|
|
@@ -3,7 +3,7 @@ import React, { useEffect } from "react";
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
5
|
CircularProgress,
|
|
6
|
-
|
|
6
|
+
cls,
|
|
7
7
|
defaultBorderMixin,
|
|
8
8
|
FilterListOffIcon,
|
|
9
9
|
SearchBar,
|
|
@@ -16,20 +16,27 @@ import { useLargeLayout } from "../../../hooks";
|
|
|
16
16
|
|
|
17
17
|
interface CollectionTableToolbarProps {
|
|
18
18
|
size: CollectionSize;
|
|
19
|
-
filterIsSet: boolean;
|
|
20
19
|
loading: boolean;
|
|
21
|
-
forceFilter?: boolean;
|
|
22
20
|
actionsStart?: React.ReactNode;
|
|
23
21
|
actions?: React.ReactNode;
|
|
24
22
|
title?: React.ReactNode,
|
|
25
23
|
onTextSearchClick?: () => void;
|
|
26
24
|
onTextSearch?: (searchString?: string) => void;
|
|
27
25
|
onSizeChanged: (size: CollectionSize) => void;
|
|
28
|
-
clearFilter?: () => void;
|
|
29
26
|
textSearchLoading?: boolean;
|
|
30
27
|
}
|
|
31
28
|
|
|
32
|
-
export function CollectionTableToolbar(
|
|
29
|
+
export function CollectionTableToolbar({
|
|
30
|
+
actions,
|
|
31
|
+
actionsStart,
|
|
32
|
+
loading,
|
|
33
|
+
onSizeChanged,
|
|
34
|
+
onTextSearch,
|
|
35
|
+
onTextSearchClick,
|
|
36
|
+
size,
|
|
37
|
+
textSearchLoading,
|
|
38
|
+
title
|
|
39
|
+
}: CollectionTableToolbarProps) {
|
|
33
40
|
|
|
34
41
|
const searchInputRef = React.useRef<HTMLInputElement>(null);
|
|
35
42
|
const largeLayout = useLargeLayout();
|
|
@@ -37,30 +44,20 @@ export function CollectionTableToolbar(props: CollectionTableToolbarProps) {
|
|
|
37
44
|
const searchLoading = React.useRef<boolean>(false);
|
|
38
45
|
|
|
39
46
|
useEffect(() => {
|
|
40
|
-
if (searchInputRef.current && searchLoading.current && !
|
|
47
|
+
if (searchInputRef.current && searchLoading.current && !textSearchLoading) {
|
|
41
48
|
searchInputRef.current.focus();
|
|
42
49
|
}
|
|
43
|
-
searchLoading.current =
|
|
44
|
-
}, [
|
|
45
|
-
|
|
46
|
-
const clearFilterButton = !props.forceFilter && props.filterIsSet && props.clearFilter &&
|
|
47
|
-
<Button
|
|
48
|
-
variant={"outlined"}
|
|
49
|
-
className="h-fit-content"
|
|
50
|
-
aria-label="filter clear"
|
|
51
|
-
onClick={props.clearFilter}
|
|
52
|
-
size={"small"}>
|
|
53
|
-
<FilterListOffIcon/>
|
|
54
|
-
Clear filter
|
|
55
|
-
</Button>;
|
|
50
|
+
searchLoading.current = textSearchLoading ?? false;
|
|
51
|
+
}, [textSearchLoading]);
|
|
52
|
+
|
|
56
53
|
|
|
57
54
|
const sizeSelect = (
|
|
58
55
|
<Tooltip title={"Table row size"} side={"right"} sideOffset={4}>
|
|
59
56
|
<Select
|
|
60
|
-
value={
|
|
57
|
+
value={size as string}
|
|
61
58
|
className="w-16 h-10"
|
|
62
59
|
size={"small"}
|
|
63
|
-
onValueChange={(v) =>
|
|
60
|
+
onValueChange={(v) => onSizeChanged(v as CollectionSize)}
|
|
64
61
|
renderValue={(v) => <div className={"font-medium"}>{v.toUpperCase()}</div>}
|
|
65
62
|
>
|
|
66
63
|
{["xs", "s", "m", "l", "xl"].map((size) => (
|
|
@@ -74,40 +71,38 @@ export function CollectionTableToolbar(props: CollectionTableToolbarProps) {
|
|
|
74
71
|
|
|
75
72
|
return (
|
|
76
73
|
<div
|
|
77
|
-
className={
|
|
74
|
+
className={cls(defaultBorderMixin, "no-scrollbar min-h-[56px] overflow-x-auto px-2 md:px-4 bg-gray-50 dark:bg-gray-900 border-b flex flex-row justify-between items-center w-full")}>
|
|
78
75
|
|
|
79
76
|
<div className="flex items-center gap-2 md:mr-4 mr-2">
|
|
80
77
|
|
|
81
|
-
{
|
|
82
|
-
{
|
|
78
|
+
{title && <div className={"hidden lg:block"}>
|
|
79
|
+
{title}
|
|
83
80
|
</div>}
|
|
84
81
|
|
|
85
82
|
{sizeSelect}
|
|
86
83
|
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
{clearFilterButton}
|
|
84
|
+
{actionsStart}
|
|
90
85
|
|
|
91
86
|
</div>
|
|
92
87
|
|
|
93
88
|
<div className="flex items-center gap-2">
|
|
94
89
|
|
|
95
90
|
{largeLayout && <div className="w-[22px]">
|
|
96
|
-
{
|
|
91
|
+
{loading &&
|
|
97
92
|
<CircularProgress size={"small"}/>}
|
|
98
93
|
</div>}
|
|
99
94
|
|
|
100
|
-
{(
|
|
95
|
+
{(onTextSearch || onTextSearchClick) &&
|
|
101
96
|
<SearchBar
|
|
102
97
|
key={"search-bar"}
|
|
103
98
|
inputRef={searchInputRef}
|
|
104
|
-
loading={
|
|
105
|
-
disabled={Boolean(
|
|
106
|
-
onClick={
|
|
107
|
-
onTextSearch={
|
|
99
|
+
loading={textSearchLoading}
|
|
100
|
+
disabled={Boolean(onTextSearchClick)}
|
|
101
|
+
onClick={onTextSearchClick}
|
|
102
|
+
onTextSearch={onTextSearchClick ? undefined : onTextSearch}
|
|
108
103
|
expandable={true}/>}
|
|
109
104
|
|
|
110
|
-
{
|
|
105
|
+
{actions}
|
|
111
106
|
|
|
112
107
|
</div>
|
|
113
108
|
|