@firecms/core 3.0.0-canary.14 → 3.0.0-canary.141
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 +3 -3
- package/dist/app/AppBar.d.ts +12 -0
- package/dist/app/Drawer.d.ts +16 -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/ArrayContainer.d.ts +16 -5
- package/dist/components/CircularProgressCenter.d.ts +1 -1
- package/dist/components/ClearFilterSortButton.d.ts +5 -0
- package/dist/components/{DeleteConfirmationDialog.d.ts → ConfirmationDialog.d.ts} +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -12
- 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 +3 -1
- 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 +7 -4
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +12 -2
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityCollectionView/utils.d.ts +3 -0
- package/dist/components/EntityPreview.d.ts +7 -6
- package/dist/components/ErrorView.d.ts +1 -1
- package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
- package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -1
- package/dist/components/PropertyConfigBadge.d.ts +2 -1
- package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
- 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 +15 -12
- 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 +4 -2
- 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 +10 -0
- package/dist/core/EntityEditView.d.ts +18 -4
- package/dist/core/FireCMS.d.ts +1 -1
- package/dist/core/NavigationRoutes.d.ts +3 -3
- package/dist/core/index.d.ts +3 -4
- 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/LabelWithIcon.d.ts +1 -1
- package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
- package/dist/form/components/StorageItemPreview.d.ts +4 -4
- package/dist/form/components/index.d.ts +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
- 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/MarkdownEditorFieldBinding.d.ts +11 -0
- package/dist/form/field_bindings/{MultiSelectBinding.d.ts → MultiSelectFieldBinding.d.ts} +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -5
- package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
- package/dist/form/index.d.ts +3 -5
- package/dist/form/useClearRestoreValue.d.ts +2 -2
- package/dist/hooks/data/save.d.ts +1 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useBuildNavigationController.d.ts +1 -2
- package/dist/hooks/useProjectLog.d.ts +8 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +4 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +16760 -13321
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +20120 -587
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useBuildDataSource.d.ts +1 -16
- package/dist/preview/PropertyPreviewProps.d.ts +6 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +3 -2
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/types/auth.d.ts +3 -3
- package/dist/types/collections.d.ts +41 -6
- package/dist/types/datasource.d.ts +55 -35
- package/dist/types/entities.d.ts +6 -1
- package/dist/types/entity_actions.d.ts +14 -0
- package/dist/types/entity_overrides.d.ts +2 -2
- package/dist/types/fields.d.ts +63 -41
- package/dist/types/firecms.d.ts +4 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/navigation.d.ts +6 -5
- package/dist/types/plugins.d.ts +14 -4
- package/dist/types/properties.d.ts +34 -21
- package/dist/types/property_config.d.ts +0 -2
- package/dist/types/side_dialogs_controller.d.ts +10 -0
- package/dist/types/storage.d.ts +86 -3
- package/dist/util/entities.d.ts +2 -2
- package/dist/util/icon_list.d.ts +5 -1
- package/dist/util/icon_synonyms.d.ts +1 -97
- package/dist/util/icons.d.ts +3 -2
- package/dist/util/index.d.ts +1 -0
- package/dist/util/navigation_utils.d.ts +2 -2
- package/dist/util/objects.d.ts +2 -1
- package/dist/util/plurals.d.ts +0 -2
- package/dist/util/property_utils.d.ts +3 -3
- package/dist/util/resolutions.d.ts +30 -16
- package/dist/util/storage.d.ts +23 -2
- package/dist/util/useStorageUploadController.d.ts +3 -3
- package/package.json +128 -119
- package/src/app/AppBar.tsx +18 -0
- package/src/app/Drawer.tsx +24 -0
- package/src/app/Scaffold.tsx +243 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/ArrayContainer.tsx +51 -24
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +41 -0
- package/src/components/{DeleteConfirmationDialog.tsx → ConfirmationDialog.tsx} +1 -1
- package/src/components/DeleteEntityDialog.tsx +1 -1
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +12 -19
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +21 -20
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +10 -6
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +47 -39
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +31 -16
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +14 -6
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +32 -30
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +19 -7
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +72 -67
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +138 -86
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
- package/src/components/EntityCollectionView/utils.ts +19 -0
- package/src/components/EntityPreview.tsx +43 -39
- package/src/components/EntityView.tsx +6 -6
- package/src/components/ErrorView.tsx +1 -1
- package/src/components/HomePage/DefaultHomePage.tsx +25 -19
- package/src/components/HomePage/NavigationCard.tsx +3 -3
- package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
- package/src/components/HomePage/NavigationGroup.tsx +1 -1
- package/src/components/HomePage/SmallNavigationCard.tsx +5 -6
- package/src/components/PropertyConfigBadge.tsx +9 -3
- package/src/components/PropertyIdCopyTooltip.tsx +48 -0
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +8 -7
- package/src/components/ReferenceWidget.tsx +22 -12
- package/src/components/SearchIconsView.tsx +10 -7
- 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 +28 -6
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +88 -21
- package/src/components/VirtualTable/VirtualTable.tsx +77 -46
- package/src/components/VirtualTable/VirtualTableCell.tsx +1 -9
- package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
- package/src/components/VirtualTable/VirtualTableProps.tsx +18 -14
- package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +4 -4
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -1
- package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -1
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +14 -28
- package/src/components/VirtualTable/types.tsx +2 -3
- package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +8 -4
- 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 +23 -12
- package/src/components/common/useTableSearchHelper.ts +53 -12
- package/src/components/index.tsx +4 -2
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/core/DefaultAppBar.tsx +176 -0
- package/src/core/DefaultDrawer.tsx +183 -0
- package/src/core/DrawerNavigationItem.tsx +66 -0
- package/src/core/EntityEditView.tsx +716 -153
- package/src/core/EntitySidePanel.tsx +1 -2
- package/src/core/FireCMS.tsx +53 -52
- package/src/core/NavigationRoutes.tsx +7 -8
- package/src/core/SideDialogs.tsx +1 -0
- package/src/core/field_configs.tsx +7 -8
- package/src/core/index.tsx +3 -4
- package/src/form/PropertyFieldBinding.tsx +74 -35
- package/src/form/components/CustomIdField.tsx +4 -2
- package/src/form/components/FieldHelperText.tsx +4 -4
- package/src/form/components/LabelWithIcon.tsx +27 -19
- package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
- package/src/form/components/StorageItemPreview.tsx +21 -11
- package/src/form/components/StorageUploadProgress.tsx +3 -4
- package/src/form/components/index.tsx +1 -1
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +29 -17
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +45 -35
- package/src/form/field_bindings/BlockFieldBinding.tsx +51 -32
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -14
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +54 -45
- package/src/form/field_bindings/MapFieldBinding.tsx +65 -48
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +150 -0
- package/src/form/field_bindings/{MultiSelectBinding.tsx → MultiSelectFieldBinding.tsx} +25 -20
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +11 -16
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +42 -31
- package/src/form/field_bindings/RepeatFieldBinding.tsx +52 -34
- package/src/form/field_bindings/SelectFieldBinding.tsx +20 -13
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +36 -46
- package/src/form/field_bindings/SwitchFieldBinding.tsx +9 -5
- package/src/form/field_bindings/TextFieldBinding.tsx +26 -23
- package/src/form/index.tsx +4 -9
- package/src/form/useClearRestoreValue.tsx +2 -2
- package/src/form/validation.ts +1 -17
- package/src/hooks/data/delete.ts +2 -1
- package/src/hooks/data/save.ts +9 -5
- package/src/hooks/data/useDataSource.tsx +11 -3
- package/src/hooks/index.tsx +1 -0
- package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
- package/src/hooks/useBuildModeController.tsx +11 -5
- package/src/hooks/useBuildNavigationController.tsx +91 -31
- package/src/hooks/useProjectLog.tsx +32 -10
- package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
- package/src/hooks/useValidateAuthenticator.tsx +21 -41
- package/src/index.ts +1 -0
- package/src/internal/useBuildDataSource.ts +72 -82
- package/src/internal/useBuildSideDialogsController.tsx +1 -0
- package/src/internal/useBuildSideEntityController.tsx +102 -22
- package/src/internal/useUnsavedChangesDialog.tsx +3 -1
- package/src/preview/PropertyPreview.tsx +11 -18
- package/src/preview/PropertyPreviewProps.tsx +7 -1
- package/src/preview/components/BooleanPreview.tsx +2 -2
- package/src/preview/components/EnumValuesChip.tsx +2 -2
- package/src/preview/components/ImagePreview.tsx +25 -35
- package/src/preview/components/ReferencePreview.tsx +23 -34
- package/src/preview/components/StorageThumbnail.tsx +5 -1
- package/src/preview/components/UrlComponentPreview.tsx +44 -11
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +4 -3
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +2 -3
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -2
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +4 -5
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +4 -5
- package/src/preview/property_previews/MapPropertyPreview.tsx +6 -6
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +2 -2
- package/src/preview/property_previews/StringPropertyPreview.tsx +3 -3
- package/src/preview/util.ts +2 -2
- package/src/types/auth.tsx +3 -3
- package/src/types/collections.ts +50 -8
- package/src/types/customization_controller.tsx +0 -1
- package/src/types/datasource.ts +65 -43
- package/src/types/entities.ts +11 -1
- package/src/types/entity_actions.tsx +16 -3
- package/src/types/entity_overrides.tsx +2 -2
- package/src/types/fields.tsx +69 -45
- package/src/types/firecms.tsx +5 -0
- package/src/types/index.ts +0 -1
- package/src/types/navigation.ts +7 -7
- package/src/types/plugins.tsx +16 -6
- package/src/types/properties.ts +39 -22
- package/src/types/property_config.tsx +0 -2
- package/src/types/side_dialogs_controller.tsx +13 -0
- package/src/types/storage.ts +94 -3
- package/src/util/entities.ts +6 -5
- 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 +8 -2
- package/src/util/index.ts +1 -0
- package/src/util/make_properties_editable.ts +13 -5
- package/src/util/navigation_utils.ts +6 -6
- package/src/util/objects.ts +45 -28
- package/src/util/permissions.ts +1 -0
- package/src/util/plurals.ts +0 -2
- package/src/util/property_utils.tsx +11 -4
- package/src/util/references.ts +3 -0
- package/src/util/resolutions.ts +79 -46
- package/src/util/storage.ts +79 -21
- package/src/util/strings.ts +2 -2
- package/src/util/useStorageUploadController.tsx +33 -7
- package/src/util/useTraceUpdate.tsx +1 -0
- package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
- 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/form/components/FormikArrayContainer.d.ts +0 -18
- package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
- 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/FireCMSAppBar.tsx +0 -165
- package/src/components/PropertyIdCopyTooltipContent.tsx +0 -28
- 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/form/components/FormikArrayContainer.tsx +0 -44
- package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -695
- package/src/internal/useBuildCustomizationController.tsx +0 -5
- package/src/internal/useLocaleConfig.tsx +0 -18
- package/src/types/appcheck.ts +0 -29
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { coolIconKeys, debounce, Icon, IconButton, iconKeys, SearchBar, Tooltip } from "@firecms/ui";
|
|
4
|
-
import {
|
|
4
|
+
import { iconSynonyms, iconsSearch } from "../util";
|
|
5
5
|
|
|
6
6
|
const UPDATE_SEARCH_INDEX_WAIT_MS = 220;
|
|
7
7
|
|
|
8
|
-
if (process.env.NODE_ENV !== "production") {
|
|
9
|
-
Object.keys(
|
|
8
|
+
if (iconSynonyms && process.env.NODE_ENV !== "production") {
|
|
9
|
+
Object.keys(iconSynonyms).forEach((icon: string) => {
|
|
10
10
|
if (!iconKeys.includes(icon)) {
|
|
11
|
-
console.warn(`The icon ${icon} no longer exists. Remove it from \`
|
|
11
|
+
console.warn(`The icon ${icon} no longer exists. Remove it from \`iconSynonyms\``);
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
}
|
|
@@ -31,7 +31,9 @@ export function SearchIconsView({
|
|
|
31
31
|
setKeys(null);
|
|
32
32
|
} else {
|
|
33
33
|
const searchResult = iconsSearch.search(value);
|
|
34
|
-
|
|
34
|
+
const limit = 50;
|
|
35
|
+
const limited = searchResult.slice(0, limit);
|
|
36
|
+
setKeys(limited.map((e) => e.item.key));
|
|
35
37
|
}
|
|
36
38
|
}, UPDATE_SEARCH_INDEX_WAIT_MS), []
|
|
37
39
|
);
|
|
@@ -48,7 +50,7 @@ export function SearchIconsView({
|
|
|
48
50
|
return (
|
|
49
51
|
<>
|
|
50
52
|
<SearchBar
|
|
51
|
-
autoFocus
|
|
53
|
+
autoFocus={false}
|
|
52
54
|
innerClassName={"w-full sticky top-0 z-10"}
|
|
53
55
|
onTextSearch={(value?: string) => setQuery(value ?? "")}
|
|
54
56
|
placeholder="Search for more icons…"
|
|
@@ -57,7 +59,8 @@ export function SearchIconsView({
|
|
|
57
59
|
<div className={"flex max-w-full flex-wrap mt-4"}>
|
|
58
60
|
{icons.map((icon: string) => {
|
|
59
61
|
return (
|
|
60
|
-
<Tooltip title={icon} key={icon}
|
|
62
|
+
<Tooltip title={icon} key={icon}
|
|
63
|
+
asChild={true}>
|
|
61
64
|
<IconButton
|
|
62
65
|
shape={"square"}
|
|
63
66
|
toggled={selectedIcon === icon}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "../../types";
|
|
11
11
|
import { CellRendererParams, VirtualTable, VirtualTableColumn } from "../VirtualTable";
|
|
12
12
|
import { enumToObjectEntries } from "../../util";
|
|
13
|
-
import { OnCellValueChange, OnColumnResizeParams } from "../common
|
|
13
|
+
import { OnCellValueChange, OnColumnResizeParams } from "../common";
|
|
14
14
|
import { FilterFormFieldProps } from "../VirtualTable/VirtualTableHeader";
|
|
15
15
|
import { ReferenceFilterField } from "./filters/ReferenceFilterField";
|
|
16
16
|
import { StringNumberFilterField } from "./filters/StringNumberFilterField";
|
|
@@ -18,6 +18,7 @@ import { BooleanFilterField } from "./filters/BooleanFilterField";
|
|
|
18
18
|
import { DateTimeFilterField } from "./filters/DateTimeFilterField";
|
|
19
19
|
import { useOutsideAlerter } from "@firecms/ui";
|
|
20
20
|
import { SelectableTableContext } from "./SelectableTableContext";
|
|
21
|
+
import { getRowHeight } from "../common/table_height";
|
|
21
22
|
|
|
22
23
|
export type SelectableTableProps<M extends Record<string, any>> = {
|
|
23
24
|
|
|
@@ -115,7 +116,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
115
116
|
onEntityClick,
|
|
116
117
|
onColumnResize,
|
|
117
118
|
hoverRow = true,
|
|
118
|
-
size,
|
|
119
|
+
size = "m",
|
|
119
120
|
inlineEditing = false,
|
|
120
121
|
tableController:
|
|
121
122
|
{
|
|
@@ -127,8 +128,6 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
127
128
|
setFilterValues,
|
|
128
129
|
sortBy,
|
|
129
130
|
setSortBy,
|
|
130
|
-
setSearchString,
|
|
131
|
-
clearFilter,
|
|
132
131
|
itemCount,
|
|
133
132
|
setItemCount,
|
|
134
133
|
pageSize = 50,
|
|
@@ -222,9 +221,8 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
222
221
|
onEndReached={loadNextPage}
|
|
223
222
|
onResetPagination={resetPagination}
|
|
224
223
|
error={dataLoadingError}
|
|
225
|
-
paginationEnabled={paginationEnabled}
|
|
226
224
|
onColumnResize={onColumnResize}
|
|
227
|
-
|
|
225
|
+
rowHeight={getRowHeight(size)}
|
|
228
226
|
loading={dataLoading}
|
|
229
227
|
filter={filterValues}
|
|
230
228
|
onFilterUpdate={setFilterValues ? onFilterUpdate : undefined}
|
|
@@ -247,7 +245,8 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
|
|
|
247
245
|
);
|
|
248
246
|
|
|
249
247
|
},
|
|
250
|
-
|
|
248
|
+
() => false,
|
|
249
|
+
// equal
|
|
251
250
|
);
|
|
252
251
|
|
|
253
252
|
function createFilterField({
|
|
@@ -280,6 +279,7 @@ function createFilterField({
|
|
|
280
279
|
isArray={isArray}
|
|
281
280
|
path={baseProperty.path}
|
|
282
281
|
title={resolvedProperty?.name}
|
|
282
|
+
includeId={baseProperty.includeId}
|
|
283
283
|
previewProperties={baseProperty?.previewProperties}
|
|
284
284
|
hidden={hidden}
|
|
285
285
|
setHidden={setHidden}/>;
|
|
@@ -32,7 +32,7 @@ export function BooleanFilterField({
|
|
|
32
32
|
const valueSet = !!value;
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<div className="w-[
|
|
35
|
+
<div className="w-[300px]">
|
|
36
36
|
<BooleanSwitchWithLabel
|
|
37
37
|
value={valueSetToTrue}
|
|
38
38
|
allowIndeterminate={true}
|
|
@@ -44,6 +44,5 @@ export function BooleanFilterField({
|
|
|
44
44
|
: `${title} is false`}
|
|
45
45
|
/>
|
|
46
46
|
</div>
|
|
47
|
-
)
|
|
48
|
-
;
|
|
47
|
+
);
|
|
49
48
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { VirtualTableWhereFilterOp } from "../../VirtualTable";
|
|
3
|
-
import { DateTimeField, Select, SelectItem } from "@firecms/ui";
|
|
3
|
+
import { Checkbox, DateTimeField, Label, Select, SelectItem } from "@firecms/ui";
|
|
4
4
|
import { useCustomizationController } from "../../../hooks";
|
|
5
5
|
|
|
6
6
|
interface DateTimeFilterFieldProps {
|
|
@@ -43,10 +43,10 @@ export function DateTimeFilterField({
|
|
|
43
43
|
|
|
44
44
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
45
45
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);
|
|
46
|
-
const [internalValue, setInternalValue] = useState<Date | undefined>(fieldValue);
|
|
46
|
+
const [internalValue, setInternalValue] = useState<Date | null | undefined>(fieldValue);
|
|
47
47
|
|
|
48
|
-
function updateFilter(op: VirtualTableWhereFilterOp, val: Date | undefined) {
|
|
49
|
-
let newValue: Date | undefined = val;
|
|
48
|
+
function updateFilter(op: VirtualTableWhereFilterOp, val: Date | undefined | null) {
|
|
49
|
+
let newValue: Date | null | undefined = val;
|
|
50
50
|
const prevOpIsArray = multipleSelectOperations.includes(operation);
|
|
51
51
|
const newOpIsArray = multipleSelectOperations.includes(op);
|
|
52
52
|
if (prevOpIsArray !== newOpIsArray) {
|
|
@@ -73,7 +73,7 @@ export function DateTimeFilterField({
|
|
|
73
73
|
|
|
74
74
|
return (
|
|
75
75
|
|
|
76
|
-
<div className="flex w-[440px]
|
|
76
|
+
<div className="flex w-[440px]">
|
|
77
77
|
<div className="w-[80px]">
|
|
78
78
|
<Select value={operation}
|
|
79
79
|
onValueChange={(value) => {
|
|
@@ -88,19 +88,34 @@ export function DateTimeFilterField({
|
|
|
88
88
|
</Select>
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
|
-
<div className="flex-grow ml-2">
|
|
91
|
+
<div className="flex-grow ml-2 flex flex-col gap-2">
|
|
92
92
|
|
|
93
93
|
<DateTimeField
|
|
94
94
|
mode={mode}
|
|
95
95
|
size={"medium"}
|
|
96
96
|
locale={locale}
|
|
97
|
-
value={internalValue}
|
|
97
|
+
value={internalValue ?? undefined}
|
|
98
98
|
onChange={(dateValue: Date | null) => {
|
|
99
99
|
updateFilter(operation, dateValue === null ? undefined : dateValue);
|
|
100
100
|
}}
|
|
101
101
|
clearable={true}
|
|
102
102
|
/>
|
|
103
103
|
|
|
104
|
+
<Label
|
|
105
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
|
|
106
|
+
htmlFor="null-filter"
|
|
107
|
+
>
|
|
108
|
+
<Checkbox id="null-filter"
|
|
109
|
+
checked={internalValue === null}
|
|
110
|
+
size={"small"}
|
|
111
|
+
onCheckedChange={(checked) => {
|
|
112
|
+
if (internalValue !== null)
|
|
113
|
+
updateFilter(operation, null);
|
|
114
|
+
else updateFilter(operation, undefined);
|
|
115
|
+
}}/>
|
|
116
|
+
Filter for null values
|
|
117
|
+
</Label>
|
|
118
|
+
|
|
104
119
|
</div>
|
|
105
120
|
|
|
106
121
|
</div>
|
|
@@ -4,7 +4,7 @@ import { Entity, EntityCollection, EntityReference } from "../../../types";
|
|
|
4
4
|
import { ReferencePreview } from "../../../preview";
|
|
5
5
|
import { getReferenceFrom } from "../../../util";
|
|
6
6
|
import { useNavigationController, useReferenceDialog } from "../../../hooks";
|
|
7
|
-
import { Button, Select, SelectItem } from "@firecms/ui";
|
|
7
|
+
import { Button, Checkbox, Label, Select, SelectItem } from "@firecms/ui";
|
|
8
8
|
|
|
9
9
|
interface ReferenceFilterFieldProps {
|
|
10
10
|
name: string,
|
|
@@ -13,6 +13,7 @@ interface ReferenceFilterFieldProps {
|
|
|
13
13
|
isArray?: boolean;
|
|
14
14
|
path?: string;
|
|
15
15
|
title?: string;
|
|
16
|
+
includeId?: boolean;
|
|
16
17
|
previewProperties?: string[];
|
|
17
18
|
hidden: boolean;
|
|
18
19
|
setHidden: (hidden: boolean) => void;
|
|
@@ -40,6 +41,7 @@ export function ReferenceFilterField({
|
|
|
40
41
|
isArray,
|
|
41
42
|
path,
|
|
42
43
|
title,
|
|
44
|
+
includeId = true,
|
|
43
45
|
previewProperties,
|
|
44
46
|
setHidden
|
|
45
47
|
}: ReferenceFilterFieldProps) {
|
|
@@ -54,7 +56,7 @@ export function ReferenceFilterField({
|
|
|
54
56
|
|
|
55
57
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
56
58
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);
|
|
57
|
-
const [internalValue, setInternalValue] = useState<EntityReference | EntityReference[] | undefined>(fieldValue);
|
|
59
|
+
const [internalValue, setInternalValue] = useState<EntityReference | EntityReference[] | undefined | null>(fieldValue);
|
|
58
60
|
|
|
59
61
|
const selectedEntityIds = internalValue
|
|
60
62
|
? (Array.isArray(internalValue) ? internalValue.map((ref) => {
|
|
@@ -65,7 +67,7 @@ export function ReferenceFilterField({
|
|
|
65
67
|
}).filter(Boolean) as string[] : [internalValue.id])
|
|
66
68
|
: [];
|
|
67
69
|
|
|
68
|
-
function updateFilter(op: VirtualTableWhereFilterOp, val?: EntityReference | EntityReference[]) {
|
|
70
|
+
function updateFilter(op: VirtualTableWhereFilterOp, val?: EntityReference | EntityReference[] | null) {
|
|
69
71
|
|
|
70
72
|
const prevOpIsArray = multipleSelectOperations.includes(operation);
|
|
71
73
|
const newOpIsArray = multipleSelectOperations.includes(op);
|
|
@@ -134,7 +136,8 @@ export function ReferenceFilterField({
|
|
|
134
136
|
onClick={doOpenDialog}
|
|
135
137
|
reference={reference}
|
|
136
138
|
hover={true}
|
|
137
|
-
|
|
139
|
+
includeId={includeId}
|
|
140
|
+
includeEntityLink={false}
|
|
138
141
|
/>
|
|
139
142
|
);
|
|
140
143
|
};
|
|
@@ -142,7 +145,7 @@ export function ReferenceFilterField({
|
|
|
142
145
|
return (
|
|
143
146
|
|
|
144
147
|
<div className="flex w-[440px] flex-row">
|
|
145
|
-
<div className="w-[
|
|
148
|
+
<div className="w-[140px]">
|
|
146
149
|
<Select value={operation}
|
|
147
150
|
onValueChange={(value) => {
|
|
148
151
|
updateFilter(value as VirtualTableWhereFilterOp, internalValue);
|
|
@@ -156,21 +159,40 @@ export function ReferenceFilterField({
|
|
|
156
159
|
</Select>
|
|
157
160
|
</div>
|
|
158
161
|
|
|
159
|
-
<div className="flex-grow ml-2 h-full">
|
|
162
|
+
<div className="flex-grow ml-2 h-full gap-2 flex flex-col">
|
|
160
163
|
|
|
161
164
|
{internalValue && Array.isArray(internalValue) && <div>
|
|
162
165
|
{internalValue.map((ref, index) => buildEntry(ref))}
|
|
163
166
|
</div>}
|
|
167
|
+
|
|
164
168
|
{internalValue && !Array.isArray(internalValue) && <div>
|
|
165
169
|
{buildEntry(internalValue)}
|
|
166
170
|
</div>}
|
|
171
|
+
|
|
167
172
|
{(!internalValue || (Array.isArray(internalValue) && internalValue.length === 0)) &&
|
|
168
173
|
<Button onClick={doOpenDialog}
|
|
169
174
|
variant={"outlined"}
|
|
175
|
+
size={"large"}
|
|
170
176
|
className="h-full w-full">
|
|
171
177
|
{multiple ? "Select references" : "Select reference"}
|
|
172
178
|
</Button>
|
|
173
179
|
}
|
|
180
|
+
|
|
181
|
+
{!isArray && <Label
|
|
182
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
|
|
183
|
+
htmlFor="null-filter"
|
|
184
|
+
>
|
|
185
|
+
<Checkbox id="null-filter"
|
|
186
|
+
checked={internalValue === null}
|
|
187
|
+
size={"small"}
|
|
188
|
+
onCheckedChange={(checked) => {
|
|
189
|
+
if (internalValue !== null)
|
|
190
|
+
updateFilter(operation, null);
|
|
191
|
+
else updateFilter(operation, undefined);
|
|
192
|
+
}}/>
|
|
193
|
+
Filter for null values
|
|
194
|
+
</Label>}
|
|
195
|
+
|
|
174
196
|
</div>
|
|
175
197
|
|
|
176
198
|
</div>
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { EnumValuesChip } from "../../../preview";
|
|
3
3
|
import { VirtualTableWhereFilterOp } from "../../VirtualTable";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Checkbox,
|
|
6
|
+
ClearIcon,
|
|
7
|
+
IconButton,
|
|
8
|
+
Label,
|
|
9
|
+
MultiSelect,
|
|
10
|
+
MultiSelectItem,
|
|
11
|
+
Select,
|
|
12
|
+
SelectItem,
|
|
13
|
+
TextField
|
|
14
|
+
} from "@firecms/ui";
|
|
5
15
|
import { EnumValueConfig } from "../../../types";
|
|
6
16
|
|
|
7
17
|
interface StringNumberFilterFieldProps {
|
|
@@ -50,15 +60,15 @@ export function StringNumberFilterField({
|
|
|
50
60
|
|
|
51
61
|
const [fieldOperation, fieldValue] = value || [possibleOperations[0], undefined];
|
|
52
62
|
const [operation, setOperation] = useState<VirtualTableWhereFilterOp>(fieldOperation);
|
|
53
|
-
const [internalValue, setInternalValue] = useState<string | number | string[] | number[] | undefined>(fieldValue);
|
|
63
|
+
const [internalValue, setInternalValue] = useState<string | number | string[] | number[] | null | undefined>(fieldValue);
|
|
54
64
|
|
|
55
|
-
function updateFilter(op: VirtualTableWhereFilterOp, val: string | number | string[] | number[] | undefined) {
|
|
65
|
+
function updateFilter(op: VirtualTableWhereFilterOp, val: string | number | string[] | number[] | null | undefined) {
|
|
56
66
|
let newValue = val;
|
|
57
67
|
const prevOpIsArray = multipleSelectOperations.includes(operation);
|
|
58
68
|
const newOpIsArray = multipleSelectOperations.includes(op);
|
|
59
69
|
if (prevOpIsArray !== newOpIsArray) {
|
|
60
70
|
// @ts-ignore
|
|
61
|
-
newValue = newOpIsArray ? (typeof val === "string" || typeof val === "number" ? [val] : []) :
|
|
71
|
+
newValue = newOpIsArray ? (typeof val === "string" || typeof val === "number" ? [val] : []) : undefined;
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
if (typeof newValue === "number" && isNaN(newValue))
|
|
@@ -82,9 +92,10 @@ export function StringNumberFilterField({
|
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
const multiple = multipleSelectOperations.includes(operation);
|
|
95
|
+
|
|
85
96
|
return (
|
|
86
97
|
|
|
87
|
-
<div className="flex w-[440px]
|
|
98
|
+
<div className="flex w-[440px]">
|
|
88
99
|
<div className={"w-[80px]"}>
|
|
89
100
|
<Select value={operation}
|
|
90
101
|
position={"item-aligned"}
|
|
@@ -100,11 +111,11 @@ export function StringNumberFilterField({
|
|
|
100
111
|
</Select>
|
|
101
112
|
</div>
|
|
102
113
|
|
|
103
|
-
<div className="flex-grow ml-2">
|
|
114
|
+
<div className="flex-grow ml-2 flex flex-col gap-2">
|
|
104
115
|
|
|
105
116
|
{!enumValues && <TextField
|
|
106
117
|
type={dataType === "number" ? "number" : undefined}
|
|
107
|
-
value={internalValue !== undefined ? String(internalValue) : ""}
|
|
118
|
+
value={internalValue !== undefined && internalValue != null ? String(internalValue) : ""}
|
|
108
119
|
onChange={(evt) => {
|
|
109
120
|
const val = dataType === "number"
|
|
110
121
|
? parseFloat(evt.target.value)
|
|
@@ -117,29 +128,33 @@ export function StringNumberFilterField({
|
|
|
117
128
|
</IconButton>}
|
|
118
129
|
/>}
|
|
119
130
|
|
|
120
|
-
{enumValues &&
|
|
121
|
-
|
|
131
|
+
{enumValues && !multiple &&
|
|
122
132
|
<Select
|
|
123
133
|
position={"item-aligned"}
|
|
124
|
-
value={internalValue
|
|
125
|
-
? (Array.isArray(internalValue) ? internalValue.map(e => String(e)) : String(internalValue))
|
|
126
|
-
: isArray ? [] : ""}
|
|
134
|
+
value={typeof internalValue === "string" ? internalValue : ""}
|
|
127
135
|
onValueChange={(value) => {
|
|
128
|
-
|
|
136
|
+
if (value !== "")
|
|
137
|
+
updateFilter(operation, dataType === "number" ? parseInt(value as string) : value as string)
|
|
129
138
|
}}
|
|
130
|
-
multiple={multiple}
|
|
131
139
|
endAdornment={internalValue && <IconButton
|
|
132
|
-
className="absolute right-
|
|
140
|
+
className="absolute right-2 top-3"
|
|
133
141
|
onClick={(e) => updateFilter(operation, undefined)}>
|
|
134
142
|
<ClearIcon/>
|
|
135
143
|
</IconButton>}
|
|
136
|
-
renderValue={(enumKey) =>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
144
|
+
renderValue={(enumKey) => {
|
|
145
|
+
if (enumKey === null)
|
|
146
|
+
return "Filter for null values";
|
|
147
|
+
if (enumKey === undefined)
|
|
148
|
+
return null;
|
|
149
|
+
|
|
150
|
+
return <EnumValuesChip
|
|
151
|
+
key={`select_value_${name}_${enumKey}`}
|
|
152
|
+
enumKey={enumKey}
|
|
153
|
+
enumValues={enumValues}
|
|
154
|
+
size={"small"}/>;
|
|
155
|
+
}}>
|
|
141
156
|
{enumValues.map((enumConfig) => (
|
|
142
|
-
<SelectItem key={`
|
|
157
|
+
<SelectItem key={`select_item_${name}_${enumConfig.id}`}
|
|
143
158
|
value={String(enumConfig.id)}>
|
|
144
159
|
<EnumValuesChip
|
|
145
160
|
enumKey={String(enumConfig.id)}
|
|
@@ -150,6 +165,58 @@ export function StringNumberFilterField({
|
|
|
150
165
|
</Select>
|
|
151
166
|
}
|
|
152
167
|
|
|
168
|
+
{enumValues && multiple &&
|
|
169
|
+
<MultiSelect
|
|
170
|
+
position={"item-aligned"}
|
|
171
|
+
value={Array.isArray(internalValue) ? internalValue.map(e => String(e)) : []}
|
|
172
|
+
onValueChange={(value) => {
|
|
173
|
+
updateFilter(operation, dataType === "number" ? value.map(v => parseInt(v)) : value)
|
|
174
|
+
}}
|
|
175
|
+
multiple={multiple}
|
|
176
|
+
endAdornment={internalValue && <IconButton
|
|
177
|
+
className="absolute right-2 top-3"
|
|
178
|
+
onClick={(e) => updateFilter(operation, undefined)}>
|
|
179
|
+
<ClearIcon/>
|
|
180
|
+
</IconButton>}
|
|
181
|
+
// renderValues={(enumKeys) => {
|
|
182
|
+
// console.log("renderValues", enumKeys);
|
|
183
|
+
// if (enumKeys === null)
|
|
184
|
+
// return "Filter for null values";
|
|
185
|
+
//
|
|
186
|
+
// return enumKeys.map(key => <EnumValuesChip
|
|
187
|
+
// key={`select_value_${name}_${enumKeys}`}
|
|
188
|
+
// enumKey={key}
|
|
189
|
+
// enumValues={enumValues}
|
|
190
|
+
// size={"small"}/>);
|
|
191
|
+
// }}
|
|
192
|
+
>
|
|
193
|
+
{enumValues.map((enumConfig) => (
|
|
194
|
+
<MultiSelectItem key={`select_value_${name}_${enumConfig.id}`}
|
|
195
|
+
value={String(enumConfig.id)}>
|
|
196
|
+
<EnumValuesChip
|
|
197
|
+
enumKey={String(enumConfig.id)}
|
|
198
|
+
enumValues={enumValues}
|
|
199
|
+
size={"small"}/>
|
|
200
|
+
</MultiSelectItem>
|
|
201
|
+
))}
|
|
202
|
+
</MultiSelect>
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
{!isArray && <Label
|
|
206
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
|
|
207
|
+
htmlFor="null-filter"
|
|
208
|
+
>
|
|
209
|
+
<Checkbox id="null-filter"
|
|
210
|
+
checked={internalValue === null}
|
|
211
|
+
size={"small"}
|
|
212
|
+
onCheckedChange={(checked) => {
|
|
213
|
+
if (internalValue !== null)
|
|
214
|
+
updateFilter(operation, null);
|
|
215
|
+
else updateFilter(operation, undefined);
|
|
216
|
+
}}/>
|
|
217
|
+
Filter for null values
|
|
218
|
+
</Label>}
|
|
219
|
+
|
|
153
220
|
</div>
|
|
154
221
|
|
|
155
222
|
</div>
|