@firecms/core 3.0.0-canary.12 → 3.0.0-canary.121
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/ArrayContainer.d.ts +2 -1
- 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 +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 +2 -2
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +12 -2
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
- package/dist/components/EntityPreview.d.ts +6 -5
- 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/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 +3 -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 +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/FormikArrayContainer.d.ts +2 -1
- 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 -0
- 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/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 +2 -2
- package/dist/hooks/useValidateAuthenticator.d.ts +4 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +15748 -12448
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +19981 -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 +39 -5
- 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 +47 -41
- 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/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 +1 -1
- package/dist/util/plurals.d.ts +0 -2
- package/dist/util/property_utils.d.ts +1 -1
- package/dist/util/resolutions.d.ts +27 -13
- 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 +25 -0
- package/src/app/Scaffold.tsx +245 -0
- package/src/app/index.ts +4 -0
- package/src/app/useApp.tsx +32 -0
- package/src/components/ArrayContainer.tsx +15 -10
- package/src/components/CircularProgressCenter.tsx +1 -1
- package/src/components/ClearFilterSortButton.tsx +41 -0
- 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 +41 -35
- package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +32 -17
- 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 +7 -10
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +75 -51
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
- package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
- package/src/components/EntityPreview.tsx +38 -34
- package/src/components/EntityView.tsx +5 -5
- package/src/components/ErrorView.tsx +1 -1
- package/src/components/HomePage/DefaultHomePage.tsx +26 -19
- package/src/components/HomePage/NavigationCard.tsx +3 -3
- package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
- package/src/components/HomePage/SmallNavigationCard.tsx +5 -6
- package/src/components/PropertyIdCopyTooltip.tsx +48 -0
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +8 -6
- package/src/components/ReferenceWidget.tsx +22 -12
- package/src/components/SearchIconsView.tsx +11 -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 +89 -21
- package/src/components/VirtualTable/VirtualTable.tsx +70 -37
- 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 +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 +23 -2
- package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
- package/src/components/common/useTableSearchHelper.ts +53 -12
- package/src/components/index.tsx +3 -1
- package/src/contexts/DialogsProvider.tsx +2 -2
- package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +52 -37
- package/src/core/DefaultDrawer.tsx +179 -0
- package/src/core/DrawerNavigationItem.tsx +66 -0
- package/src/core/EntityEditView.tsx +716 -149
- package/src/core/EntitySidePanel.tsx +1 -2
- package/src/core/FireCMS.tsx +39 -44
- package/src/core/NavigationRoutes.tsx +7 -8
- package/src/core/SideDialogs.tsx +2 -0
- package/src/core/field_configs.tsx +7 -8
- package/src/core/index.tsx +3 -4
- package/src/form/PropertyFieldBinding.tsx +53 -21
- package/src/form/components/CustomIdField.tsx +4 -2
- package/src/form/components/FieldHelperText.tsx +4 -4
- package/src/form/components/FormikArrayContainer.tsx +4 -1
- 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 -0
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +26 -15
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +29 -24
- package/src/form/field_bindings/BlockFieldBinding.tsx +14 -12
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -14
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +52 -46
- package/src/form/field_bindings/MapFieldBinding.tsx +17 -17
- 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 +41 -30
- package/src/form/field_bindings/RepeatFieldBinding.tsx +32 -19
- 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 +6 -1
- 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 +19 -8
- 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 +71 -81
- 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 +10 -17
- 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 +24 -34
- 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 +1 -2
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +3 -2
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -2
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +3 -4
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +3 -4
- 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 +48 -7
- 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 +51 -45
- 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/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/navigation_utils.ts +6 -6
- package/src/util/objects.ts +25 -28
- package/src/util/permissions.ts +1 -0
- package/src/util/plurals.ts +0 -2
- package/src/util/property_utils.tsx +1 -1
- package/src/util/references.ts +3 -0
- package/src/util/resolutions.ts +74 -41
- 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/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/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/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
|
@@ -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,11 @@ export function StringNumberFilterField({
|
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
const multiple = multipleSelectOperations.includes(operation);
|
|
95
|
+
|
|
96
|
+
console.log("internalValue", { internalValue });
|
|
85
97
|
return (
|
|
86
98
|
|
|
87
|
-
<div className="flex w-[440px]
|
|
99
|
+
<div className="flex w-[440px]">
|
|
88
100
|
<div className={"w-[80px]"}>
|
|
89
101
|
<Select value={operation}
|
|
90
102
|
position={"item-aligned"}
|
|
@@ -100,11 +112,11 @@ export function StringNumberFilterField({
|
|
|
100
112
|
</Select>
|
|
101
113
|
</div>
|
|
102
114
|
|
|
103
|
-
<div className="flex-grow ml-2">
|
|
115
|
+
<div className="flex-grow ml-2 flex flex-col gap-2">
|
|
104
116
|
|
|
105
117
|
{!enumValues && <TextField
|
|
106
118
|
type={dataType === "number" ? "number" : undefined}
|
|
107
|
-
value={internalValue !== undefined ? String(internalValue) : ""}
|
|
119
|
+
value={internalValue !== undefined && internalValue != null ? String(internalValue) : ""}
|
|
108
120
|
onChange={(evt) => {
|
|
109
121
|
const val = dataType === "number"
|
|
110
122
|
? parseFloat(evt.target.value)
|
|
@@ -117,29 +129,33 @@ export function StringNumberFilterField({
|
|
|
117
129
|
</IconButton>}
|
|
118
130
|
/>}
|
|
119
131
|
|
|
120
|
-
{enumValues &&
|
|
121
|
-
|
|
132
|
+
{enumValues && !multiple &&
|
|
122
133
|
<Select
|
|
123
134
|
position={"item-aligned"}
|
|
124
|
-
value={internalValue
|
|
125
|
-
? (Array.isArray(internalValue) ? internalValue.map(e => String(e)) : String(internalValue))
|
|
126
|
-
: isArray ? [] : ""}
|
|
135
|
+
value={typeof internalValue === "string" ? internalValue : ""}
|
|
127
136
|
onValueChange={(value) => {
|
|
128
|
-
|
|
137
|
+
if (value !== "")
|
|
138
|
+
updateFilter(operation, dataType === "number" ? parseInt(value as string) : value as string)
|
|
129
139
|
}}
|
|
130
|
-
multiple={multiple}
|
|
131
140
|
endAdornment={internalValue && <IconButton
|
|
132
|
-
className="absolute right-
|
|
141
|
+
className="absolute right-2 top-3"
|
|
133
142
|
onClick={(e) => updateFilter(operation, undefined)}>
|
|
134
143
|
<ClearIcon/>
|
|
135
144
|
</IconButton>}
|
|
136
|
-
renderValue={(enumKey) =>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
renderValue={(enumKey) => {
|
|
146
|
+
if (enumKey === null)
|
|
147
|
+
return "Filter for null values";
|
|
148
|
+
if (enumKey === undefined)
|
|
149
|
+
return null;
|
|
150
|
+
|
|
151
|
+
return <EnumValuesChip
|
|
152
|
+
key={`select_value_${name}_${enumKey}`}
|
|
153
|
+
enumKey={enumKey}
|
|
154
|
+
enumValues={enumValues}
|
|
155
|
+
size={"small"}/>;
|
|
156
|
+
}}>
|
|
141
157
|
{enumValues.map((enumConfig) => (
|
|
142
|
-
<SelectItem key={`
|
|
158
|
+
<SelectItem key={`select_item_${name}_${enumConfig.id}`}
|
|
143
159
|
value={String(enumConfig.id)}>
|
|
144
160
|
<EnumValuesChip
|
|
145
161
|
enumKey={String(enumConfig.id)}
|
|
@@ -150,6 +166,58 @@ export function StringNumberFilterField({
|
|
|
150
166
|
</Select>
|
|
151
167
|
}
|
|
152
168
|
|
|
169
|
+
{enumValues && multiple &&
|
|
170
|
+
<MultiSelect
|
|
171
|
+
position={"item-aligned"}
|
|
172
|
+
value={Array.isArray(internalValue) ? internalValue.map(e => String(e)) : []}
|
|
173
|
+
onValueChange={(value) => {
|
|
174
|
+
updateFilter(operation, dataType === "number" ? value.map(v => parseInt(v)) : value)
|
|
175
|
+
}}
|
|
176
|
+
multiple={multiple}
|
|
177
|
+
endAdornment={internalValue && <IconButton
|
|
178
|
+
className="absolute right-2 top-3"
|
|
179
|
+
onClick={(e) => updateFilter(operation, undefined)}>
|
|
180
|
+
<ClearIcon/>
|
|
181
|
+
</IconButton>}
|
|
182
|
+
// renderValues={(enumKeys) => {
|
|
183
|
+
// console.log("renderValues", enumKeys);
|
|
184
|
+
// if (enumKeys === null)
|
|
185
|
+
// return "Filter for null values";
|
|
186
|
+
//
|
|
187
|
+
// return enumKeys.map(key => <EnumValuesChip
|
|
188
|
+
// key={`select_value_${name}_${enumKeys}`}
|
|
189
|
+
// enumKey={key}
|
|
190
|
+
// enumValues={enumValues}
|
|
191
|
+
// size={"small"}/>);
|
|
192
|
+
// }}
|
|
193
|
+
>
|
|
194
|
+
{enumValues.map((enumConfig) => (
|
|
195
|
+
<MultiSelectItem key={`select_value_${name}_${enumConfig.id}`}
|
|
196
|
+
value={String(enumConfig.id)}>
|
|
197
|
+
<EnumValuesChip
|
|
198
|
+
enumKey={String(enumConfig.id)}
|
|
199
|
+
enumValues={enumValues}
|
|
200
|
+
size={"small"}/>
|
|
201
|
+
</MultiSelectItem>
|
|
202
|
+
))}
|
|
203
|
+
</MultiSelect>
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
{!isArray && <Label
|
|
207
|
+
className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
|
|
208
|
+
htmlFor="null-filter"
|
|
209
|
+
>
|
|
210
|
+
<Checkbox id="null-filter"
|
|
211
|
+
checked={internalValue === null}
|
|
212
|
+
size={"small"}
|
|
213
|
+
onCheckedChange={(checked) => {
|
|
214
|
+
if (internalValue !== null)
|
|
215
|
+
updateFilter(operation, null);
|
|
216
|
+
else updateFilter(operation, undefined);
|
|
217
|
+
}}/>
|
|
218
|
+
Filter for null values
|
|
219
|
+
</Label>}
|
|
220
|
+
|
|
153
221
|
</div>
|
|
154
222
|
|
|
155
223
|
</div>
|
|
@@ -15,12 +15,11 @@ import {
|
|
|
15
15
|
VirtualTableWhereFilterOp
|
|
16
16
|
} from "./VirtualTableProps";
|
|
17
17
|
|
|
18
|
-
import { getRowHeight } from "./common";
|
|
19
18
|
import { VirtualTableContextProps } from "./types";
|
|
20
19
|
import { VirtualTableHeaderRow } from "./VirtualTableHeaderRow";
|
|
21
20
|
import { VirtualTableRow } from "./VirtualTableRow";
|
|
22
21
|
import { VirtualTableCell } from "./VirtualTableCell";
|
|
23
|
-
import { AssignmentIcon,
|
|
22
|
+
import { AssignmentIcon, CenteredView, cls, Typography } from "@firecms/ui";
|
|
24
23
|
|
|
25
24
|
const VirtualListContext = createContext<VirtualTableContextProps<any>>({} as any);
|
|
26
25
|
VirtualListContext.displayName = "VirtualListContext";
|
|
@@ -92,7 +91,8 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
92
91
|
data,
|
|
93
92
|
onResetPagination,
|
|
94
93
|
onEndReached,
|
|
95
|
-
|
|
94
|
+
endOffset = 600,
|
|
95
|
+
rowHeight = 54,
|
|
96
96
|
columns: columnsProp,
|
|
97
97
|
onRowClick,
|
|
98
98
|
onColumnResize,
|
|
@@ -108,9 +108,11 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
108
108
|
hoverRow,
|
|
109
109
|
createFilterField,
|
|
110
110
|
rowClassName,
|
|
111
|
+
style,
|
|
111
112
|
className,
|
|
112
113
|
endAdornment,
|
|
113
|
-
AddColumnComponent
|
|
114
|
+
AddColumnComponent,
|
|
115
|
+
debug
|
|
114
116
|
}: VirtualTableProps<T>) {
|
|
115
117
|
|
|
116
118
|
const sortByProperty: string | undefined = sortBy ? sortBy[0] : undefined;
|
|
@@ -128,10 +130,14 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
128
130
|
const [measureRef, bounds] = useMeasure();
|
|
129
131
|
|
|
130
132
|
const onColumnResizeInternal = useCallback((params: OnVirtualTableColumnResizeParams) => {
|
|
133
|
+
if (debug)
|
|
134
|
+
console.log("onColumnResizeInternal", params);
|
|
131
135
|
setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));
|
|
132
136
|
}, [columns]);
|
|
133
137
|
|
|
134
138
|
const onColumnResizeEndInternal = useCallback((params: OnVirtualTableColumnResizeParams) => {
|
|
139
|
+
if (debug)
|
|
140
|
+
console.log("onColumnResizeEndInternal", params);
|
|
135
141
|
setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));
|
|
136
142
|
if (onColumnResize) {
|
|
137
143
|
onColumnResize(params);
|
|
@@ -142,10 +148,14 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
142
148
|
const filterRef = useRef<VirtualTableFilterValues<any> | undefined>();
|
|
143
149
|
|
|
144
150
|
useEffect(() => {
|
|
151
|
+
if (debug)
|
|
152
|
+
console.log("Filter updated", filterInput);
|
|
145
153
|
filterRef.current = filterInput;
|
|
146
154
|
}, [filterInput]);
|
|
147
155
|
|
|
148
156
|
const scrollToTop = useCallback(() => {
|
|
157
|
+
if (debug)
|
|
158
|
+
console.log("scrollToTop");
|
|
149
159
|
endReachCallbackThreshold.current = 0;
|
|
150
160
|
if (tableRef.current) {
|
|
151
161
|
// scrollRef.current = [scrollRef.current[0], 0];
|
|
@@ -155,6 +165,9 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
155
165
|
|
|
156
166
|
const onColumnSort = useCallback((key: string) => {
|
|
157
167
|
|
|
168
|
+
if (debug)
|
|
169
|
+
console.log("onColumnSort", key);
|
|
170
|
+
|
|
158
171
|
const isDesc = sortByProperty === key && currentSort === "desc";
|
|
159
172
|
const isAsc = sortByProperty === key && currentSort === "asc";
|
|
160
173
|
const newSort = isAsc ? "desc" : (isDesc ? undefined : "asc");
|
|
@@ -181,21 +194,21 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
181
194
|
scrollToTop();
|
|
182
195
|
}, [checkFilterCombination, currentSort, onFilterUpdate, onResetPagination, onSortByUpdate, scrollToTop, sortByProperty]);
|
|
183
196
|
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
onSortByUpdate(undefined);
|
|
188
|
-
}, [onSortByUpdate]);
|
|
197
|
+
const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);
|
|
198
|
+
if (debug)
|
|
199
|
+
console.log("maxScroll", maxScroll);
|
|
189
200
|
|
|
190
|
-
const maxScroll = Math.max((data?.length ?? 0) * getRowHeight(size) - bounds.height, 0);
|
|
191
201
|
const onEndReachedInternal = useCallback((scrollOffset: number) => {
|
|
192
|
-
if (
|
|
202
|
+
if (debug)
|
|
203
|
+
console.log("onEndReachedInternal", scrollOffset, endReachCallbackThreshold.current + endOffset);
|
|
204
|
+
if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + endOffset) {
|
|
193
205
|
endReachCallbackThreshold.current = scrollOffset;
|
|
194
206
|
onEndReached();
|
|
195
207
|
}
|
|
196
208
|
}, [data?.length, onEndReached]);
|
|
197
209
|
|
|
198
210
|
const onScroll = useCallback(({
|
|
211
|
+
scrollDirection,
|
|
199
212
|
scrollOffset,
|
|
200
213
|
scrollUpdateWasRequested
|
|
201
214
|
}: {
|
|
@@ -203,11 +216,19 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
203
216
|
scrollOffset: number,
|
|
204
217
|
scrollUpdateWasRequested: boolean;
|
|
205
218
|
}) => {
|
|
206
|
-
if
|
|
219
|
+
if(debug)
|
|
220
|
+
console.log("onScroll", {
|
|
221
|
+
scrollDirection,
|
|
222
|
+
scrollOffset,
|
|
223
|
+
scrollUpdateWasRequested
|
|
224
|
+
});
|
|
225
|
+
if (!scrollUpdateWasRequested && (scrollOffset >= maxScroll - endOffset))
|
|
207
226
|
onEndReachedInternal(scrollOffset);
|
|
208
227
|
}, [maxScroll, onEndReachedInternal]);
|
|
209
228
|
|
|
210
229
|
const onFilterUpdateInternal = useCallback((column: VirtualTableColumn, filterForProperty?: [VirtualTableWhereFilterOp, any]) => {
|
|
230
|
+
if(debug)
|
|
231
|
+
console.log("onFilterUpdateInternal", column, filterForProperty);
|
|
211
232
|
|
|
212
233
|
endReachCallbackThreshold.current = 0;
|
|
213
234
|
const filter = filterRef.current;
|
|
@@ -225,24 +246,7 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
225
246
|
}
|
|
226
247
|
|
|
227
248
|
if (onFilterUpdate) onFilterUpdate(newFilterValue);
|
|
228
|
-
|
|
229
|
-
if (column.key !== sortByProperty) {
|
|
230
|
-
resetSort();
|
|
231
|
-
}
|
|
232
|
-
}, [checkFilterCombination, currentSort, onFilterUpdate, resetSort, sortByProperty]);
|
|
233
|
-
|
|
234
|
-
const buildErrorView = useCallback(() => (
|
|
235
|
-
<div
|
|
236
|
-
className="h-full flex flex-col items-center justify-center sticky left-0">
|
|
237
|
-
|
|
238
|
-
<Typography variant={"h6"}>
|
|
239
|
-
{"Error fetching data from the data source"}
|
|
240
|
-
</Typography>
|
|
241
|
-
|
|
242
|
-
{error?.message && <Markdown className={"px-4 break-all"} source={error.message}/>}
|
|
243
|
-
|
|
244
|
-
</div>
|
|
245
|
-
), [error?.message]);
|
|
249
|
+
}, [checkFilterCombination, currentSort, onFilterUpdate, sortByProperty]);
|
|
246
250
|
|
|
247
251
|
const buildEmptyView = useCallback(() => {
|
|
248
252
|
if (loading)
|
|
@@ -255,11 +259,22 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
255
259
|
}, [emptyComponent, loading]);
|
|
256
260
|
|
|
257
261
|
const empty = !loading && (data?.length ?? 0) === 0;
|
|
258
|
-
const customView = error
|
|
262
|
+
const customView = error
|
|
263
|
+
? <CenteredView maxWidth={"2xl"}
|
|
264
|
+
className="flex flex-col gap-2">
|
|
265
|
+
|
|
266
|
+
<Typography variant={"h6"}>
|
|
267
|
+
{"Error fetching data from the data source"}
|
|
268
|
+
</Typography>
|
|
269
|
+
|
|
270
|
+
{error?.message && <SafeLinkRenderer text={error.message}/>}
|
|
271
|
+
|
|
272
|
+
</CenteredView>
|
|
273
|
+
: (empty ? buildEmptyView() : undefined);
|
|
259
274
|
|
|
260
275
|
const virtualListController = {
|
|
261
276
|
data,
|
|
262
|
-
|
|
277
|
+
rowHeight: rowHeight,
|
|
263
278
|
cellRenderer,
|
|
264
279
|
columns,
|
|
265
280
|
currentSort,
|
|
@@ -278,23 +293,27 @@ export const VirtualTable = React.memo<VirtualTableProps<any>>(
|
|
|
278
293
|
AddColumnComponent
|
|
279
294
|
};
|
|
280
295
|
|
|
296
|
+
if(debug)
|
|
297
|
+
console.log("VirtualTable render", virtualListController);
|
|
298
|
+
|
|
281
299
|
// useTraceUpdate(virtualListController);
|
|
282
300
|
return (
|
|
283
301
|
<div
|
|
284
302
|
ref={measureRef}
|
|
285
|
-
|
|
303
|
+
style={style}
|
|
304
|
+
className={cls("h-full w-full", className)}>
|
|
286
305
|
<VirtualListContext.Provider
|
|
287
306
|
value={virtualListController}>
|
|
288
307
|
|
|
289
308
|
<MemoizedList
|
|
290
309
|
outerRef={tableRef}
|
|
291
|
-
key={
|
|
310
|
+
key={rowHeight}
|
|
292
311
|
width={bounds.width}
|
|
293
312
|
height={bounds.height}
|
|
294
313
|
itemCount={(data?.length ?? 0) + (endAdornment ? 1 : 0)}
|
|
295
314
|
onScroll={onScroll}
|
|
296
315
|
includeAddColumn={Boolean(AddColumnComponent)}
|
|
297
|
-
itemSize={
|
|
316
|
+
itemSize={rowHeight}/>
|
|
298
317
|
|
|
299
318
|
</VirtualListContext.Provider>
|
|
300
319
|
</div>
|
|
@@ -334,7 +353,7 @@ function MemoizedList({
|
|
|
334
353
|
onRowClick,
|
|
335
354
|
data,
|
|
336
355
|
columns,
|
|
337
|
-
|
|
356
|
+
rowHeight = 54,
|
|
338
357
|
cellRenderer,
|
|
339
358
|
hoverRow,
|
|
340
359
|
rowClassName,
|
|
@@ -367,7 +386,7 @@ function MemoizedList({
|
|
|
367
386
|
...style,
|
|
368
387
|
top: `calc(${style.top}px + 48px)`
|
|
369
388
|
}}
|
|
370
|
-
|
|
389
|
+
rowHeight={rowHeight}>
|
|
371
390
|
|
|
372
391
|
{columns.map((column: VirtualTableColumn, columnIndex: number) => {
|
|
373
392
|
const cellData = rowData && rowData[column.key];
|
|
@@ -403,3 +422,17 @@ function MemoizedList({
|
|
|
403
422
|
{Row}
|
|
404
423
|
</List>;
|
|
405
424
|
}
|
|
425
|
+
|
|
426
|
+
const SafeLinkRenderer: React.FC<{
|
|
427
|
+
text: string;
|
|
428
|
+
}> = ({ text }) => {
|
|
429
|
+
const urlRegex = /https?:\/\/[^\s]+/g;
|
|
430
|
+
const htmlContent = text.replace(urlRegex, (url) => {
|
|
431
|
+
// For each URL found, replace it with an HTML <a> tag
|
|
432
|
+
return `<a href="${url}" class="underline" target="_blank">Link</a><br/>`;
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
return (
|
|
436
|
+
<div className={"break-all"} dangerouslySetInnerHTML={{ __html: htmlContent }}/>
|
|
437
|
+
);
|
|
438
|
+
};
|
|
@@ -16,7 +16,7 @@ type VirtualTableCellProps<T extends any> = {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export const VirtualTableCell = React.memo<VirtualTableCellProps<any>>(
|
|
19
|
-
function VirtualTableCell<T
|
|
19
|
+
function VirtualTableCell<T>(props: VirtualTableCellProps<T>) {
|
|
20
20
|
// @ts-ignore
|
|
21
21
|
return props.rowData && props.cellRenderer(
|
|
22
22
|
{
|
|
@@ -30,14 +30,6 @@ export const VirtualTableCell = React.memo<VirtualTableCellProps<any>>(
|
|
|
30
30
|
width: props.column.width
|
|
31
31
|
} as CellRendererParams<T>
|
|
32
32
|
);
|
|
33
|
-
// return props.rowData && <props.cellRenderer
|
|
34
|
-
// rowData={props.rowData}
|
|
35
|
-
// rowIndex={props.rowIndex}
|
|
36
|
-
// isScrolling={false}
|
|
37
|
-
// column={props.column}
|
|
38
|
-
// columns={props.columns}
|
|
39
|
-
// columnIndex={props.columnIndex}
|
|
40
|
-
// width={props.column.width}/>
|
|
41
33
|
},
|
|
42
34
|
(a, b) => {
|
|
43
35
|
return equal(a.rowData, b.rowData) &&
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ArrowUpwardIcon,
|
|
8
8
|
Badge,
|
|
9
9
|
Button,
|
|
10
|
-
|
|
10
|
+
cls,
|
|
11
11
|
defaultBorderMixin,
|
|
12
12
|
FilterListIcon,
|
|
13
13
|
IconButton,
|
|
@@ -85,7 +85,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
|
|
|
85
85
|
return (
|
|
86
86
|
<ErrorBoundary>
|
|
87
87
|
<div
|
|
88
|
-
className={
|
|
88
|
+
className={cls("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center bg-gray-50 dark:bg-gray-900",
|
|
89
89
|
"text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200 ",
|
|
90
90
|
"hover:bg-gray-100 dark:hover:bg-gray-800 hover:bg-opacity-50 dark:hover:bg-opacity-50",
|
|
91
91
|
column.frozen ? "sticky left-0 z-10" : "relative z-0"
|
|
@@ -179,7 +179,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
|
|
|
179
179
|
|
|
180
180
|
{column.resizable && <div
|
|
181
181
|
ref={resizeHandleRef}
|
|
182
|
-
className={
|
|
182
|
+
className={cls(
|
|
183
183
|
"absolute h-full w-[6px] top-0 right-0 cursor-col-resize",
|
|
184
184
|
hovered && "bg-gray-300 dark:bg-gray-700"
|
|
185
185
|
)}
|
|
@@ -240,7 +240,7 @@ function FilterForm<M>({
|
|
|
240
240
|
}}
|
|
241
241
|
className={"text-gray-900 dark:text-white"}>
|
|
242
242
|
<div
|
|
243
|
-
className={
|
|
243
|
+
className={cls(defaultBorderMixin, "py-4 px-6 text-xs font-semibold uppercase border-b")}>
|
|
244
244
|
{column.title ?? id}
|
|
245
245
|
</div>
|
|
246
246
|
{filterField && <div className="m-4">
|
|
@@ -4,7 +4,7 @@ import { VirtualTableColumn, VirtualTableWhereFilterOp } from "./VirtualTablePro
|
|
|
4
4
|
import { ErrorBoundary } from "../ErrorBoundary";
|
|
5
5
|
import { VirtualTableHeader } from "./VirtualTableHeader";
|
|
6
6
|
import { VirtualTableContextProps } from "./types";
|
|
7
|
-
import {
|
|
7
|
+
import { cls, defaultBorderMixin } from "@firecms/ui";
|
|
8
8
|
|
|
9
9
|
export const VirtualTableHeaderRow = ({
|
|
10
10
|
columns,
|
|
@@ -100,7 +100,7 @@ export const VirtualTableHeaderRow = ({
|
|
|
100
100
|
|
|
101
101
|
return (
|
|
102
102
|
<div
|
|
103
|
-
className={
|
|
103
|
+
className={cls(defaultBorderMixin, "z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 h-12 border-b bg-gray-50 dark:bg-gray-900")}>
|
|
104
104
|
{columns.map((c, columnIndex) => {
|
|
105
105
|
const column = columns[columnIndex];
|
|
106
106
|
|