@firecms/core 3.0.0-canary.1 → 3.0.0-canary.100
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 +2 -2
- 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/CircularProgressCenter.d.ts +1 -1
- package/dist/components/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -12
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +2 -2
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +3 -2
- 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 +13 -4
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityCollectionView/useSelectionController.d.ts +2 -0
- package/dist/components/EntityPreview.d.ts +26 -7
- package/dist/components/EntityView.d.ts +11 -0
- package/dist/components/ErrorView.d.ts +1 -1
- package/dist/components/FieldCaption.d.ts +5 -0
- package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
- package/dist/components/HomePage/NavigationCard.d.ts +8 -0
- package/dist/components/HomePage/{NavigationCollectionCard.d.ts → NavigationCardBinding.d.ts} +3 -3
- package/dist/components/HomePage/SmallNavigationCard.d.ts +6 -0
- package/dist/components/HomePage/index.d.ts +3 -1
- package/dist/components/ReferenceWidget.d.ts +6 -4
- 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 +16 -13
- 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/useColumnsIds.d.ts +2 -1
- package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
- package/dist/components/index.d.ts +6 -4
- package/dist/contexts/AuthControllerContext.d.ts +1 -1
- package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
- package/dist/core/DefaultDrawer.d.ts +19 -0
- package/dist/core/DrawerNavigationItem.d.ts +9 -0
- package/dist/core/EntityEditView.d.ts +36 -0
- package/dist/core/FireCMS.d.ts +1 -1
- package/dist/core/NavigationRoutes.d.ts +3 -3
- package/dist/core/index.d.ts +3 -6
- package/dist/form/PropertiesForm.d.ts +8 -0
- package/dist/form/PropertyFieldBinding.d.ts +1 -1
- 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 -3
- package/dist/form/components/StorageUploadProgress.d.ts +1 -1
- package/dist/form/components/index.d.ts +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -4
- package/dist/form/field_bindings/TextFieldBinding.d.ts +2 -2
- package/dist/form/index.d.ts +1 -2
- package/dist/form/validation.d.ts +1 -1
- 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 +2 -2
- package/dist/hooks/data/useEntityFetch.d.ts +3 -3
- package/dist/hooks/index.d.ts +4 -1
- package/dist/{core → hooks}/useBuildModeController.d.ts +1 -1
- package/dist/hooks/useBuildNavigationController.d.ts +6 -4
- package/dist/hooks/useProjectLog.d.ts +6 -2
- package/dist/hooks/useStorageSource.d.ts +2 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +16400 -12423
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19713 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildDataSource.d.ts +1 -12
- package/dist/preview/PropertyPreview.d.ts +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +6 -4
- package/dist/preview/components/BooleanPreview.d.ts +5 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +3 -8
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/auth.d.ts +38 -2
- package/dist/types/collections.d.ts +45 -8
- package/dist/types/datasource.d.ts +34 -20
- package/dist/types/entities.d.ts +6 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/entity_callbacks.d.ts +2 -2
- package/dist/types/entity_overrides.d.ts +6 -0
- package/dist/types/fields.d.ts +36 -30
- package/dist/types/index.d.ts +2 -1
- package/dist/types/navigation.d.ts +15 -14
- package/dist/types/permissions.d.ts +5 -1
- package/dist/types/plugins.d.ts +31 -23
- package/dist/types/properties.d.ts +34 -21
- package/dist/types/property_config.d.ts +2 -2
- 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 +9 -1
- package/dist/util/entities.d.ts +1 -1
- package/dist/util/icon_list.d.ts +5 -1
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +9 -3
- package/dist/util/index.d.ts +1 -0
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/objects.d.ts +1 -1
- package/dist/util/permissions.d.ts +4 -4
- package/dist/util/plurals.d.ts +0 -2
- package/dist/util/references.d.ts +4 -2
- package/dist/util/resolutions.d.ts +15 -14
- 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 +128 -119
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +25 -0
- package/src/app/Scaffold.tsx +251 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/ArrayContainer.tsx +1 -1
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/DeleteEntityDialog.tsx +4 -4
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +11 -21
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +276 -279
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +9 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +49 -45
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +20 -18
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +17 -9
- 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 +95 -92
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +5 -6
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +42 -0
- package/src/components/EntityPreview.tsx +210 -70
- package/src/components/EntityView.tsx +84 -0
- package/src/components/ErrorView.tsx +1 -1
- package/src/components/FieldCaption.tsx +14 -0
- package/src/components/HomePage/DefaultHomePage.tsx +37 -24
- package/src/components/HomePage/NavigationCard.tsx +69 -0
- package/src/components/HomePage/NavigationCardBinding.tsx +116 -0
- package/src/components/HomePage/SmallNavigationCard.tsx +45 -0
- package/src/components/HomePage/index.tsx +3 -1
- package/src/components/PropertyIdCopyTooltipContent.tsx +2 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +4 -4
- package/src/components/ReferenceWidget.tsx +26 -16
- package/src/components/SearchIconsView.tsx +9 -6
- package/src/components/SelectableTable/SelectableTable.tsx +7 -7
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +38 -24
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
- package/src/components/VirtualTable/VirtualTable.tsx +70 -37
- package/src/components/VirtualTable/VirtualTableCell.tsx +1 -1
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +19 -15
- 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 +11 -7
- 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 +23 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +12 -1
- package/src/components/common/useTableSearchHelper.ts +52 -12
- package/src/components/index.tsx +6 -4
- package/src/contexts/AuthControllerContext.tsx +1 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +60 -37
- package/src/core/DefaultDrawer.tsx +177 -0
- package/src/core/DrawerNavigationItem.tsx +62 -0
- package/src/core/EntityEditView.tsx +1130 -0
- package/src/core/EntitySidePanel.tsx +3 -4
- package/src/core/FireCMS.tsx +55 -44
- package/src/core/NavigationRoutes.tsx +15 -8
- package/src/core/SideDialogs.tsx +1 -0
- package/src/core/field_configs.tsx +2 -3
- package/src/core/index.tsx +3 -6
- package/src/form/PropertiesForm.tsx +81 -0
- package/src/form/PropertyFieldBinding.tsx +38 -9
- package/src/form/components/FieldHelperText.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +21 -10
- package/src/form/components/StorageUploadProgress.tsx +9 -8
- package/src/form/components/index.tsx +1 -0
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +10 -8
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +18 -18
- package/src/form/field_bindings/BlockFieldBinding.tsx +4 -5
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +3 -3
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +62 -57
- package/src/form/field_bindings/MapFieldBinding.tsx +28 -20
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +3 -4
- package/src/form/field_bindings/MultiSelectBinding.tsx +2 -3
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +4 -11
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +21 -17
- package/src/form/field_bindings/RepeatFieldBinding.tsx +14 -11
- package/src/form/field_bindings/SelectFieldBinding.tsx +5 -6
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +28 -40
- package/src/form/field_bindings/SwitchFieldBinding.tsx +3 -4
- package/src/form/field_bindings/TextFieldBinding.tsx +10 -9
- package/src/form/index.tsx +5 -4
- package/src/form/validation.ts +4 -21
- package/src/hooks/data/delete.ts +3 -3
- package/src/hooks/data/save.ts +4 -2
- package/src/hooks/data/useCollectionFetch.tsx +1 -1
- package/src/hooks/data/useDataSource.tsx +7 -2
- package/src/hooks/data/useEntityFetch.tsx +4 -4
- package/src/hooks/index.tsx +6 -1
- package/src/{core → hooks}/useBuildLocalConfigurationPersistence.tsx +8 -10
- package/src/{core → hooks}/useBuildModeController.tsx +12 -6
- package/src/hooks/useBuildNavigationController.tsx +208 -92
- package/src/hooks/useProjectLog.tsx +30 -9
- package/src/hooks/useReferenceDialog.tsx +2 -2
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useStorageSource.tsx +7 -2
- package/src/hooks/useValidateAuthenticator.tsx +115 -0
- package/src/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +56 -44
- package/src/internal/useBuildSideEntityController.tsx +88 -21
- package/src/preview/PropertyPreview.tsx +11 -18
- package/src/preview/PropertyPreviewProps.tsx +4 -8
- package/src/preview/components/BooleanPreview.tsx +19 -4
- package/src/preview/components/EnumValuesChip.tsx +2 -2
- package/src/preview/components/ImagePreview.tsx +21 -33
- package/src/preview/components/ReferencePreview.tsx +74 -166
- 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 +8 -7
- package/src/types/analytics.ts +1 -0
- package/src/types/auth.tsx +51 -2
- package/src/types/collections.ts +52 -8
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +41 -24
- package/src/types/entities.ts +13 -1
- package/src/types/entity_actions.tsx +17 -0
- package/src/types/entity_callbacks.ts +2 -2
- package/src/types/entity_overrides.tsx +7 -0
- package/src/types/fields.tsx +39 -33
- package/src/types/firecms.tsx +0 -1
- package/src/types/index.ts +2 -1
- package/src/types/navigation.ts +17 -17
- package/src/types/permissions.ts +6 -1
- package/src/types/plugins.tsx +38 -31
- package/src/types/properties.ts +40 -22
- package/src/types/property_config.tsx +2 -2
- package/src/types/roles.ts +41 -0
- package/src/types/side_entity_controller.tsx +1 -0
- package/src/types/storage.ts +12 -3
- package/src/types/user.ts +7 -0
- package/src/util/collections.ts +22 -0
- package/src/util/entities.ts +5 -4
- package/src/util/enums.ts +1 -1
- package/src/util/icon_list.ts +15 -10
- package/src/util/icon_synonyms.ts +3 -99
- package/src/util/icons.tsx +11 -3
- package/src/util/index.ts +1 -0
- package/src/util/navigation_utils.ts +6 -6
- package/src/util/objects.ts +25 -28
- package/src/util/permissions.ts +12 -8
- package/src/util/plurals.ts +0 -2
- package/src/util/references.ts +36 -5
- package/src/util/resolutions.ts +44 -39
- 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/form/EntityForm.d.ts +0 -77
- package/dist/internal/EntityView.d.ts +0 -22
- 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/components/HomePage/NavigationCollectionCard.tsx +0 -146
- package/src/core/Drawer.tsx +0 -164
- package/src/core/Scaffold.tsx +0 -281
- package/src/form/EntityForm.tsx +0 -720
- package/src/internal/EntityView.tsx +0 -578
- package/src/internal/useBuildCustomizationController.tsx +0 -5
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
- /package/dist/{components → form/components}/LabelWithIcon.d.ts +0 -0
- /package/dist/{core → hooks}/useBuildLocalConfigurationPersistence.d.ts +0 -0
- /package/src/{components → form/components}/LabelWithIcon.tsx +0 -0
|
@@ -24,15 +24,15 @@ 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";
|
|
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";
|
|
32
|
+
import { useClearRestoreValue } from "../../form/useClearRestoreValue";
|
|
33
|
+
import { getRowHeight } from "../common/table_height";
|
|
34
34
|
|
|
35
|
-
export interface PropertyTableCellProps<T extends CMSType
|
|
35
|
+
export interface PropertyTableCellProps<T extends CMSType> {
|
|
36
36
|
propertyKey: string;
|
|
37
37
|
columnIndex: number;
|
|
38
38
|
align: "right" | "left" | "center";
|
|
@@ -45,6 +45,7 @@ export interface PropertyTableCellProps<T extends CMSType, M extends Record<stri
|
|
|
45
45
|
entity: Entity<any>;
|
|
46
46
|
path: string;
|
|
47
47
|
disabled: boolean;
|
|
48
|
+
enablePopupIcon?: boolean;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
function isStorageProperty(property: ResolvedProperty) {
|
|
@@ -61,7 +62,7 @@ function isStorageProperty(property: ResolvedProperty) {
|
|
|
61
62
|
return false;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
export const PropertyTableCell = React.memo<PropertyTableCellProps<any
|
|
65
|
+
export const PropertyTableCell = React.memo<PropertyTableCellProps<any>>(
|
|
65
66
|
function PropertyTableCell<T extends CMSType, M extends Record<string, any>>({
|
|
66
67
|
propertyKey,
|
|
67
68
|
customFieldValidator,
|
|
@@ -73,10 +74,9 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
73
74
|
path,
|
|
74
75
|
entity,
|
|
75
76
|
readonly,
|
|
76
|
-
disabled: disabledProp
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const context = useFireCMSContext();
|
|
77
|
+
disabled: disabledProp,
|
|
78
|
+
enablePopupIcon = true
|
|
79
|
+
}: PropertyTableCellProps<T>) {
|
|
80
80
|
|
|
81
81
|
const {
|
|
82
82
|
onValueChange,
|
|
@@ -94,6 +94,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
94
94
|
const internalValueRef = useRef(value);
|
|
95
95
|
|
|
96
96
|
const [error, setError] = useState<Error | undefined>();
|
|
97
|
+
const [validationError, setValidationError] = useState<Error | undefined>();
|
|
97
98
|
const [saved, setSaved] = useState<boolean>(false);
|
|
98
99
|
|
|
99
100
|
const onValueUpdated = useCallback(() => {
|
|
@@ -119,7 +120,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
119
120
|
useEffect(
|
|
120
121
|
() => {
|
|
121
122
|
if (!equal(value, internalValueRef.current)) {
|
|
122
|
-
|
|
123
|
+
setValidationError(undefined);
|
|
123
124
|
setInternalValue(value);
|
|
124
125
|
internalValueRef.current = value;
|
|
125
126
|
onValueUpdated();
|
|
@@ -135,32 +136,34 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
135
136
|
validation
|
|
136
137
|
.validate(value)
|
|
137
138
|
.then(() => {
|
|
138
|
-
|
|
139
|
+
setValidationError(undefined);
|
|
139
140
|
internalValueRef.current = value;
|
|
140
141
|
if (onValueChange) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
})
|
|
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
|
+
|
|
150
155
|
}
|
|
151
156
|
})
|
|
152
157
|
.catch((e) => {
|
|
153
|
-
|
|
158
|
+
setValidationError(e);
|
|
154
159
|
});
|
|
155
160
|
};
|
|
156
161
|
|
|
157
162
|
useEffect(() => {
|
|
158
163
|
validation
|
|
159
164
|
.validate(internalValue)
|
|
160
|
-
.then(() =>
|
|
161
|
-
.catch(
|
|
162
|
-
setError(e);
|
|
163
|
-
});
|
|
165
|
+
.then(() => setValidationError(undefined))
|
|
166
|
+
.catch(setValidationError);
|
|
164
167
|
}, [internalValue, validation, propertyKey, property, entity]);
|
|
165
168
|
|
|
166
169
|
const updateValue = (newValue: any | null) => {
|
|
@@ -236,7 +239,6 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
236
239
|
height={getRowHeight(size)}
|
|
237
240
|
propertyKey={propertyKey}
|
|
238
241
|
property={property}
|
|
239
|
-
// entity={entity}
|
|
240
242
|
value={internalValue}
|
|
241
243
|
size={getPreviewSizeFrom(size)}
|
|
242
244
|
/>
|
|
@@ -246,7 +248,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
246
248
|
if (!customField && (!customPreview || selected)) {
|
|
247
249
|
const isAStorageProperty = isStorageProperty(property);
|
|
248
250
|
if (isAStorageProperty) {
|
|
249
|
-
innerComponent = <TableStorageUpload error={error}
|
|
251
|
+
innerComponent = <TableStorageUpload error={validationError ?? error}
|
|
250
252
|
disabled={disabled}
|
|
251
253
|
focused={selected}
|
|
252
254
|
selected={selected}
|
|
@@ -273,7 +275,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
273
275
|
valueType={"number"}
|
|
274
276
|
small={getPreviewSizeFrom(size) !== "medium"}
|
|
275
277
|
enumValues={numberProperty.enumValues}
|
|
276
|
-
error={error}
|
|
278
|
+
error={validationError ?? error}
|
|
277
279
|
internalValue={internalValue as string | number}
|
|
278
280
|
updateValue={updateValue}
|
|
279
281
|
/>;
|
|
@@ -281,7 +283,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
281
283
|
} else {
|
|
282
284
|
innerComponent = <VirtualTableNumberInput
|
|
283
285
|
align={align}
|
|
284
|
-
error={error}
|
|
286
|
+
error={validationError ?? error}
|
|
285
287
|
focused={selected}
|
|
286
288
|
disabled={disabled}
|
|
287
289
|
value={internalValue as number}
|
|
@@ -299,14 +301,14 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
299
301
|
valueType={"string"}
|
|
300
302
|
small={getPreviewSizeFrom(size) !== "medium"}
|
|
301
303
|
enumValues={stringProperty.enumValues}
|
|
302
|
-
error={error}
|
|
304
|
+
error={validationError ?? error}
|
|
303
305
|
internalValue={internalValue as string | number}
|
|
304
306
|
updateValue={updateValue}
|
|
305
307
|
/>;
|
|
306
308
|
fullHeight = true;
|
|
307
309
|
} else if (!stringProperty.storage) {
|
|
308
310
|
const multiline = Boolean(stringProperty.multiline) || Boolean(stringProperty.markdown);
|
|
309
|
-
innerComponent = <VirtualTableInput error={error}
|
|
311
|
+
innerComponent = <VirtualTableInput error={validationError ?? error}
|
|
310
312
|
disabled={disabled}
|
|
311
313
|
multiline={multiline}
|
|
312
314
|
focused={selected}
|
|
@@ -316,7 +318,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
316
318
|
allowScroll = true;
|
|
317
319
|
}
|
|
318
320
|
} else if (property.dataType === "boolean") {
|
|
319
|
-
innerComponent = <VirtualTableSwitch error={error}
|
|
321
|
+
innerComponent = <VirtualTableSwitch error={validationError ?? error}
|
|
320
322
|
disabled={disabled}
|
|
321
323
|
focused={selected}
|
|
322
324
|
internalValue={internalValue as boolean}
|
|
@@ -324,7 +326,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
324
326
|
/>;
|
|
325
327
|
} else if (property.dataType === "date") {
|
|
326
328
|
innerComponent = <VirtualTableDateField name={propertyKey as string}
|
|
327
|
-
error={error}
|
|
329
|
+
error={validationError ?? error}
|
|
328
330
|
disabled={disabled}
|
|
329
331
|
mode={property.mode}
|
|
330
332
|
focused={selected}
|
|
@@ -345,6 +347,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
345
347
|
path={property.path}
|
|
346
348
|
multiselect={false}
|
|
347
349
|
previewProperties={property.previewProperties}
|
|
350
|
+
includeId={property.includeId}
|
|
351
|
+
includeEntityLink={property.includeEntityLink}
|
|
348
352
|
title={property.name}
|
|
349
353
|
forceFilter={property.forceFilter}
|
|
350
354
|
/>;
|
|
@@ -367,7 +371,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
367
371
|
small={getPreviewSizeFrom(size) !== "medium"}
|
|
368
372
|
valueType={arrayProperty.of.dataType}
|
|
369
373
|
enumValues={arrayProperty.of.enumValues}
|
|
370
|
-
error={error}
|
|
374
|
+
error={validationError ?? error}
|
|
371
375
|
internalValue={internalValue as string | number}
|
|
372
376
|
updateValue={updateValue}
|
|
373
377
|
/>;
|
|
@@ -389,6 +393,8 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
389
393
|
previewProperties={arrayProperty.of.previewProperties}
|
|
390
394
|
title={arrayProperty.name}
|
|
391
395
|
forceFilter={arrayProperty.of.forceFilter}
|
|
396
|
+
includeId={arrayProperty.of.includeId}
|
|
397
|
+
includeEntityLink={arrayProperty.of.includeEntityLink}
|
|
392
398
|
/>;
|
|
393
399
|
}
|
|
394
400
|
allowScroll = false;
|
|
@@ -400,16 +406,14 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
400
406
|
|
|
401
407
|
if (!innerComponent) {
|
|
402
408
|
allowScroll = false;
|
|
403
|
-
showExpandIcon = selected && !innerComponent && !disabled && !readOnlyProperty;
|
|
409
|
+
showExpandIcon = enablePopupIcon && selected && !innerComponent && !disabled && !readOnlyProperty;
|
|
404
410
|
innerComponent = (
|
|
405
|
-
<PropertyPreview
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
property={property}
|
|
412
|
-
size={getPreviewSizeFrom(size)}
|
|
411
|
+
<PropertyPreview width={width}
|
|
412
|
+
height={height}
|
|
413
|
+
propertyKey={propertyKey as string}
|
|
414
|
+
value={internalValue}
|
|
415
|
+
property={property}
|
|
416
|
+
size={getPreviewSizeFrom(size)}
|
|
413
417
|
/>
|
|
414
418
|
);
|
|
415
419
|
}
|
|
@@ -426,7 +430,7 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, 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}
|
|
@@ -446,9 +450,9 @@ export const PropertyTableCell = React.memo<PropertyTableCellProps<any, any>>(
|
|
|
446
450
|
);
|
|
447
451
|
|
|
448
452
|
},
|
|
449
|
-
areEqual) as React.FunctionComponent<PropertyTableCellProps<any
|
|
453
|
+
areEqual) as React.FunctionComponent<PropertyTableCellProps<any>>;
|
|
450
454
|
|
|
451
|
-
function areEqual(prevProps: PropertyTableCellProps<any
|
|
455
|
+
function areEqual(prevProps: PropertyTableCellProps<any>, nextProps: PropertyTableCellProps<any>) {
|
|
452
456
|
return prevProps.height === nextProps.height &&
|
|
453
457
|
prevProps.propertyKey === nextProps.propertyKey &&
|
|
454
458
|
prevProps.align === nextProps.align &&
|
|
@@ -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,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useState } from "react";
|
|
2
2
|
import equal from "react-fast-compare"
|
|
3
3
|
|
|
4
|
-
import { ReferencePreview
|
|
4
|
+
import { ReferencePreview } from "../../../preview";
|
|
5
5
|
import { CollectionSize, Entity, EntityCollection, EntityReference, FilterValues } from "../../../types";
|
|
6
6
|
|
|
7
7
|
import { getPreviewSizeFrom } from "../../../preview/util";
|
|
@@ -9,6 +9,7 @@ import { getReferenceFrom } from "../../../util";
|
|
|
9
9
|
import { useCustomizationController, useNavigationController, useReferenceDialog } from "../../../hooks";
|
|
10
10
|
import { ErrorView } from "../../ErrorView";
|
|
11
11
|
import { Button } from "@firecms/ui";
|
|
12
|
+
import { EntityPreviewContainer } from "../../EntityPreview";
|
|
12
13
|
|
|
13
14
|
type TableReferenceFieldProps = {
|
|
14
15
|
name: string;
|
|
@@ -21,6 +22,8 @@ type TableReferenceFieldProps = {
|
|
|
21
22
|
title?: string;
|
|
22
23
|
path: string;
|
|
23
24
|
forceFilter?: FilterValues<string>;
|
|
25
|
+
includeId?: boolean;
|
|
26
|
+
includeEntityLink?: boolean;
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
export function TableReferenceField(props: TableReferenceFieldProps) {
|
|
@@ -28,7 +31,7 @@ export function TableReferenceField(props: TableReferenceFieldProps) {
|
|
|
28
31
|
|
|
29
32
|
const navigationController = useNavigationController();
|
|
30
33
|
const { path } = props;
|
|
31
|
-
const collection = navigationController.getCollection
|
|
34
|
+
const collection = navigationController.getCollection(path);
|
|
32
35
|
if (!collection) {
|
|
33
36
|
if (customizationController.components?.missingReference) {
|
|
34
37
|
return <customizationController.components.missingReference path={path}/>;
|
|
@@ -54,19 +57,17 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
54
57
|
title,
|
|
55
58
|
disabled,
|
|
56
59
|
forceFilter,
|
|
57
|
-
collection
|
|
60
|
+
collection,
|
|
61
|
+
includeId,
|
|
62
|
+
includeEntityLink
|
|
58
63
|
} = props;
|
|
59
64
|
|
|
60
|
-
const [onHover, setOnHover] = useState(false);
|
|
61
|
-
|
|
62
|
-
const hoverTrue = useCallback(() => setOnHover(true), []);
|
|
63
|
-
const hoverFalse = useCallback(() => setOnHover(false), []);
|
|
64
|
-
|
|
65
65
|
const onSingleEntitySelected = useCallback((entity: Entity<any>) => {
|
|
66
66
|
updateValue(entity ? getReferenceFrom(entity) : null);
|
|
67
67
|
}, [updateValue]);
|
|
68
68
|
|
|
69
69
|
const onMultipleEntitiesSelected = useCallback((entities: Entity<any>[]) => {
|
|
70
|
+
console.log("onMultipleEntitiesSelected", entities);
|
|
70
71
|
updateValue(entities.map((e) => getReferenceFrom(e)));
|
|
71
72
|
}, [updateValue]);
|
|
72
73
|
|
|
@@ -96,36 +97,40 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
96
97
|
const valueNotSet = !internalValue || (Array.isArray(internalValue) && internalValue.length === 0);
|
|
97
98
|
|
|
98
99
|
const buildSingleReferenceField = () => {
|
|
99
|
-
if (internalValue
|
|
100
|
+
if (internalValue && !Array.isArray(internalValue) && internalValue.isEntityReference && internalValue.isEntityReference())
|
|
100
101
|
return <ReferencePreview
|
|
101
102
|
onClick={disabled ? undefined : handleOpen}
|
|
102
103
|
size={getPreviewSizeFrom(size)}
|
|
103
104
|
reference={internalValue as EntityReference}
|
|
104
|
-
|
|
105
|
+
hover={!disabled}
|
|
105
106
|
disabled={!path}
|
|
106
107
|
previewProperties={previewProperties}
|
|
108
|
+
includeId={includeId}
|
|
109
|
+
includeEntityLink={includeEntityLink}
|
|
107
110
|
/>;
|
|
108
111
|
else
|
|
109
|
-
return <
|
|
112
|
+
return <EntityPreviewContainer
|
|
110
113
|
onClick={disabled ? undefined : handleOpen}
|
|
111
114
|
size={getPreviewSizeFrom(size)}>
|
|
112
115
|
<ErrorView title="Value is not a reference." error={"Click to edit"}/>
|
|
113
|
-
</
|
|
116
|
+
</EntityPreviewContainer>;
|
|
114
117
|
};
|
|
115
118
|
|
|
116
119
|
const buildMultipleReferenceField = () => {
|
|
117
120
|
if (Array.isArray(internalValue))
|
|
118
121
|
return <>
|
|
119
122
|
{internalValue.map((reference, index) =>
|
|
120
|
-
<div className="
|
|
123
|
+
<div className="w-full my-0.5"
|
|
121
124
|
key={`preview_array_ref_${name}_${index}`}>
|
|
122
125
|
<ReferencePreview
|
|
123
126
|
onClick={disabled ? undefined : handleOpen}
|
|
124
127
|
size={"tiny"}
|
|
125
128
|
reference={reference}
|
|
126
|
-
|
|
129
|
+
hover={!disabled}
|
|
127
130
|
disabled={!path}
|
|
128
131
|
previewProperties={previewProperties}
|
|
132
|
+
includeId={includeId}
|
|
133
|
+
includeEntityLink={includeEntityLink}
|
|
129
134
|
/>
|
|
130
135
|
</div>
|
|
131
136
|
)
|
|
@@ -139,10 +144,7 @@ export const TableReferenceFieldSuccess = React.memo(
|
|
|
139
144
|
return <ErrorView error={"The specified collection does not exist"}/>;
|
|
140
145
|
|
|
141
146
|
return (
|
|
142
|
-
<div className="w-full"
|
|
143
|
-
onMouseEnter={hoverTrue}
|
|
144
|
-
onMouseMove={hoverTrue}
|
|
145
|
-
onMouseLeave={hoverFalse}>
|
|
147
|
+
<div className="w-full group">
|
|
146
148
|
|
|
147
149
|
{internalValue && !multiselect && buildSingleReferenceField()}
|
|
148
150
|
|
|
@@ -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";
|
|
@@ -51,7 +51,7 @@ export function TableStorageUpload(props: {
|
|
|
51
51
|
entity,
|
|
52
52
|
path,
|
|
53
53
|
previewSize,
|
|
54
|
-
updateValue
|
|
54
|
+
updateValue,
|
|
55
55
|
} = props;
|
|
56
56
|
|
|
57
57
|
const storageSource = useStorageSource();
|
|
@@ -137,7 +137,7 @@ function StorageUpload({
|
|
|
137
137
|
storage,
|
|
138
138
|
onFilesAdded,
|
|
139
139
|
onFileUploadComplete,
|
|
140
|
-
storagePathBuilder
|
|
140
|
+
storagePathBuilder,
|
|
141
141
|
}: StorageUploadProps) {
|
|
142
142
|
|
|
143
143
|
const [onHover, setOnHover] = useState(false);
|
|
@@ -179,10 +179,18 @@ function StorageUpload({
|
|
|
179
179
|
onDropRejected: (fileRejections, event) => {
|
|
180
180
|
for (const fileRejection of fileRejections) {
|
|
181
181
|
for (const error of fileRejection.errors) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
console.log("Error uploading file: ", error);
|
|
183
|
+
if (error.code === "file-too-large") {
|
|
184
|
+
snackbarContext.open({
|
|
185
|
+
type: "error",
|
|
186
|
+
message: `Error uploading file: File is larger than ${storage.maxSize} bytes`
|
|
187
|
+
});
|
|
188
|
+
} else if (error.code === "file-invalid-type") {
|
|
189
|
+
snackbarContext.open({
|
|
190
|
+
type: "error",
|
|
191
|
+
message: "Error uploading file: File type is not supported"
|
|
192
|
+
});
|
|
193
|
+
}
|
|
186
194
|
}
|
|
187
195
|
}
|
|
188
196
|
}
|
|
@@ -207,7 +215,7 @@ function StorageUpload({
|
|
|
207
215
|
onMouseEnter={() => setOnHover(true)}
|
|
208
216
|
onMouseMove={() => setOnHover(true)}
|
|
209
217
|
onMouseLeave={() => setOnHover(false)}
|
|
210
|
-
className={
|
|
218
|
+
className={cls(dropZoneClasses,
|
|
211
219
|
"relative w-full h-full flex",
|
|
212
220
|
`justify-${hasValue ? "start" : "center"}`,
|
|
213
221
|
isDragActive ? activeDropClasses : "",
|
|
@@ -293,7 +301,7 @@ export function TableStorageItemPreview({
|
|
|
293
301
|
|
|
294
302
|
return (
|
|
295
303
|
<div
|
|
296
|
-
className={"relative
|
|
304
|
+
className={"relative p-2 max-w-full"}
|
|
297
305
|
>
|
|
298
306
|
|
|
299
307
|
{value &&
|
|
@@ -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
|
|