@firecms/core 3.0.0 → 3.1.0-canary.02232f4
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/components/AIIcon.d.ts +16 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +7 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +14 -0
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +6 -0
- package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +5 -4
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +6 -0
- package/dist/components/EntityCollectionTable/internal/popup_field/useDraggable.d.ts +2 -2
- package/dist/components/EntityCollectionView/Board.d.ts +2 -0
- package/dist/components/EntityCollectionView/BoardColumn.d.ts +42 -0
- package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +9 -0
- package/dist/components/EntityCollectionView/BoardSortableList.d.ts +14 -0
- package/dist/components/EntityCollectionView/CollectionDataErrorBanner.d.ts +4 -0
- package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +26 -0
- package/dist/components/EntityCollectionView/EntityCard.d.ts +19 -0
- package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +20 -0
- package/dist/components/EntityCollectionView/EntityCollectionCardView.d.ts +31 -0
- package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +2 -2
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +7 -3
- package/dist/components/EntityCollectionView/FiltersDialog.d.ts +14 -0
- package/dist/components/EntityCollectionView/ViewModeToggle.d.ts +44 -0
- package/dist/components/EntityCollectionView/board_types.d.ts +105 -0
- package/dist/components/EntityCollectionView/useBoardDataController.d.ts +60 -0
- package/dist/components/ErrorBoundary.d.ts +4 -2
- package/dist/components/HomePage/DefaultHomePage.d.ts +0 -1
- package/dist/components/LanguageToggle.d.ts +1 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +5 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/UnsavedChangesDialog.d.ts +1 -0
- package/dist/components/VirtualTable/VirtualTable.performance.test.d.ts +1 -0
- package/dist/components/VirtualTable/VirtualTableCell.d.ts +6 -0
- package/dist/components/VirtualTable/VirtualTableHeader.d.ts +4 -1
- package/dist/components/VirtualTable/VirtualTableHeaderRow.d.ts +1 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +17 -1
- package/dist/components/VirtualTable/fields/VirtualTableDateField.d.ts +1 -0
- package/dist/components/VirtualTable/types.d.ts +3 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/contexts/index.d.ts +10 -0
- package/dist/core/DrawerNavigationGroup.d.ts +45 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/editor/components/SlashCommandMenu.d.ts +6 -0
- package/dist/editor/components/editor-bubble-item.d.ts +8 -0
- package/dist/editor/components/editor-bubble.d.ts +8 -0
- package/dist/editor/components/image-bubble.d.ts +5 -0
- package/dist/editor/components/index.d.ts +16 -0
- package/dist/editor/components/table-bubble.d.ts +5 -0
- package/dist/editor/editor.d.ts +30 -0
- package/dist/editor/extensions/HighlightDecorationExtension.d.ts +24 -0
- package/dist/editor/extensions/Image/index.d.ts +6 -0
- package/dist/editor/extensions/Image.d.ts +6 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.d.ts +16 -0
- package/dist/editor/extensions/clipboard.d.ts +7 -0
- package/dist/editor/extensions/custom-keymap.d.ts +1 -0
- package/dist/editor/extensions/drag-and-drop.d.ts +9 -0
- package/dist/editor/hooks/useProseMirror.d.ts +13 -0
- package/dist/editor/hooks/useProseMirrorContext.d.ts +9 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/markdown.d.ts +5 -0
- package/dist/editor/nodeViews/ImageComponent.d.ts +3 -0
- package/dist/editor/nodeViews/ReactNodeView.d.ts +29 -0
- package/dist/editor/nodeViews/TaskItemComponent.d.ts +3 -0
- package/dist/editor/nodeViews/index.d.ts +6 -0
- package/dist/editor/plugins/index.d.ts +2 -0
- package/dist/editor/plugins/inputrules.d.ts +6 -0
- package/dist/editor/plugins/placeholderPlugin.d.ts +3 -0
- package/dist/editor/plugins/slashCommandPlugin.d.ts +12 -0
- package/dist/editor/schema.d.ts +2 -0
- package/dist/editor/selectors/ai-selector.d.ts +0 -0
- package/dist/editor/selectors/color-selector.d.ts +10 -0
- package/dist/editor/selectors/link-selector.d.ts +8 -0
- package/dist/editor/selectors/node-selector.d.ts +15 -0
- package/dist/editor/selectors/text-buttons.d.ts +1 -0
- package/dist/editor/types.d.ts +5 -0
- package/dist/editor/useProseMirror.d.ts +16 -0
- package/dist/editor/utils/prosemirror-utils.d.ts +6 -0
- package/dist/editor/utils/remove_classes.d.ts +1 -0
- package/dist/editor/utils/useDebouncedCallback.d.ts +1 -0
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/form/components/LocalChangesMenu.d.ts +2 -2
- package/dist/form/components/StorageUploadProgress.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
- package/dist/form/validation.d.ts +3 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useBreadcrumbsController.d.ts +16 -0
- package/dist/hooks/useBuildNavigationController.d.ts +0 -1
- package/dist/hooks/useCollapsedGroups.d.ts +6 -3
- package/dist/hooks/useTranslation.d.ts +17 -0
- package/dist/i18n/FireCMSi18nProvider.d.ts +33 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.es.js +31028 -16080
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +29955 -15028
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useRestoreScroll.d.ts +1 -1
- package/dist/locales/de.d.ts +2 -0
- package/dist/locales/en.d.ts +10 -0
- package/dist/locales/es.d.ts +10 -0
- package/dist/locales/fr.d.ts +2 -0
- package/dist/locales/hi.d.ts +2 -0
- package/dist/locales/it.d.ts +2 -0
- package/dist/locales/pt.d.ts +7 -0
- package/dist/preview/PropertyPreviewProps.d.ts +5 -0
- package/dist/preview/components/DatePreview.d.ts +13 -3
- package/dist/preview/components/ImagePreview.d.ts +5 -1
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/collections.d.ts +88 -2
- package/dist/types/customization_controller.d.ts +2 -1
- package/dist/types/datasource.d.ts +0 -1
- package/dist/types/entities.d.ts +1 -0
- package/dist/types/firecms.d.ts +2 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/navigation.d.ts +2 -2
- package/dist/types/plugins.d.ts +69 -1
- package/dist/types/properties.d.ts +277 -12
- package/dist/types/storage.d.ts +9 -0
- package/dist/types/translations.d.ts +669 -0
- package/dist/util/__tests__/conditions.test.d.ts +1 -0
- package/dist/util/__tests__/objects.test.d.ts +1 -0
- package/dist/util/conditions.d.ts +26 -0
- package/dist/util/entities.d.ts +2 -3
- package/dist/util/index.d.ts +3 -1
- package/dist/util/lazy_eager.d.ts +7 -0
- package/dist/util/objects.d.ts +1 -0
- package/dist/util/property_utils.d.ts +2 -1
- package/dist/util/resolutions.d.ts +3 -3
- package/dist/util/useStorageUploadController.d.ts +11 -2
- package/package.json +52 -12
- package/src/app/Scaffold.tsx +20 -19
- package/src/components/AIIcon.tsx +41 -0
- package/src/components/ArrayContainer.tsx +7 -8
- package/src/components/ClearFilterSortButton.tsx +25 -19
- package/src/components/ConfirmationDialog.tsx +4 -4
- package/src/components/DeleteEntityDialog.tsx +12 -11
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +82 -43
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +130 -79
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +121 -104
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +132 -103
- package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +6 -3
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +24 -44
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +90 -49
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +3 -2
- package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +11 -11
- package/src/components/EntityCollectionView/Board.tsx +324 -0
- package/src/components/EntityCollectionView/BoardColumn.tsx +158 -0
- package/src/components/EntityCollectionView/BoardColumnTitle.tsx +45 -0
- package/src/components/EntityCollectionView/BoardSortableList.tsx +174 -0
- package/src/components/EntityCollectionView/CollectionDataErrorBanner.tsx +43 -0
- package/src/components/EntityCollectionView/EntityBoardCard.tsx +212 -0
- package/src/components/EntityCollectionView/EntityCard.tsx +235 -0
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +706 -0
- package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +236 -0
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +531 -209
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +35 -22
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +86 -15
- package/src/components/EntityCollectionView/FiltersDialog.tsx +252 -0
- package/src/components/EntityCollectionView/ViewModeToggle.tsx +202 -0
- package/src/components/EntityCollectionView/board_types.ts +113 -0
- package/src/components/EntityCollectionView/useBoardDataController.tsx +490 -0
- package/src/components/EntityJsonPreview.tsx +2 -1
- package/src/components/EntityPreview.tsx +1 -1
- package/src/components/EntityView.tsx +3 -2
- package/src/components/ErrorBoundary.tsx +27 -15
- package/src/components/ErrorTooltip.tsx +2 -1
- package/src/components/HomePage/DefaultHomePage.tsx +65 -22
- package/src/components/HomePage/HomePageDnD.tsx +59 -42
- package/src/components/HomePage/NavigationCard.tsx +20 -18
- package/src/components/HomePage/NavigationGroup.tsx +20 -17
- package/src/components/HomePage/RenameGroupDialog.tsx +15 -15
- package/src/components/HomePage/SmallNavigationCard.tsx +10 -9
- package/src/components/LanguageToggle.tsx +66 -0
- package/src/components/NotFoundPage.tsx +5 -3
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +12 -17
- package/src/components/ReferenceWidget.tsx +5 -6
- package/src/components/SearchIconsView.tsx +3 -1
- package/src/components/SelectableTable/SelectableTable.tsx +75 -67
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +7 -6
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +50 -40
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +53 -40
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +60 -58
- package/src/components/UnsavedChangesDialog.tsx +6 -6
- package/src/components/UserDisplay.tsx +4 -4
- package/src/components/VirtualTable/VirtualTable.performance.test.tsx +387 -0
- package/src/components/VirtualTable/VirtualTable.tsx +277 -121
- package/src/components/VirtualTable/VirtualTableCell.tsx +18 -2
- package/src/components/VirtualTable/VirtualTableHeader.tsx +76 -64
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +163 -42
- package/src/components/VirtualTable/VirtualTableProps.tsx +21 -2
- package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +3 -0
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +19 -6
- package/src/components/VirtualTable/types.tsx +3 -0
- package/src/components/common/default_entity_actions.tsx +4 -0
- package/src/components/common/useColumnsIds.tsx +95 -3
- package/src/components/common/useDataSourceTableController.tsx +12 -4
- package/src/components/index.tsx +5 -0
- package/src/contexts/BreacrumbsContext.tsx +15 -8
- package/src/contexts/index.ts +10 -0
- package/src/core/DefaultAppBar.tsx +49 -32
- package/src/core/DefaultDrawer.tsx +49 -57
- package/src/core/DrawerNavigationGroup.tsx +120 -0
- package/src/core/DrawerNavigationItem.tsx +4 -3
- package/src/core/EntityEditView.tsx +94 -50
- package/src/core/EntityEditViewFormActions.tsx +24 -17
- package/src/core/EntitySidePanel.tsx +34 -30
- package/src/core/FireCMS.tsx +33 -6
- package/src/core/SideDialogs.tsx +4 -2
- package/src/core/field_configs.tsx +18 -11
- package/src/core/index.tsx +1 -0
- package/src/editor/components/SlashCommandMenu.tsx +516 -0
- package/src/editor/components/editor-bubble-item.tsx +32 -0
- package/src/editor/components/editor-bubble.tsx +118 -0
- package/src/editor/components/image-bubble.tsx +156 -0
- package/src/editor/components/index.ts +14 -0
- package/src/editor/components/table-bubble.tsx +165 -0
- package/src/editor/editor.tsx +455 -0
- package/src/editor/extensions/HighlightDecorationExtension.ts +114 -0
- package/src/editor/extensions/Image/index.ts +133 -0
- package/src/editor/extensions/Image.ts +159 -0
- package/src/editor/extensions/TextLoadingDecorationExtension.tsx +107 -0
- package/src/editor/extensions/clipboard.ts +72 -0
- package/src/editor/extensions/custom-keymap.ts +24 -0
- package/src/editor/extensions/drag-and-drop.tsx +480 -0
- package/src/editor/hooks/useProseMirror.ts +124 -0
- package/src/editor/hooks/useProseMirrorContext.ts +15 -0
- package/src/editor/index.ts +2 -0
- package/src/editor/markdown.ts +172 -0
- package/src/editor/nodeViews/ImageComponent.tsx +20 -0
- package/src/editor/nodeViews/ReactNodeView.tsx +89 -0
- package/src/editor/nodeViews/TaskItemComponent.tsx +29 -0
- package/src/editor/nodeViews/index.ts +35 -0
- package/src/editor/plugins/index.ts +58 -0
- package/src/editor/plugins/inputrules.ts +82 -0
- package/src/editor/plugins/placeholderPlugin.ts +55 -0
- package/src/editor/plugins/slashCommandPlugin.ts +61 -0
- package/src/editor/schema.ts +240 -0
- package/src/editor/selectors/ai-selector.tsx +111 -0
- package/src/editor/selectors/color-selector.tsx +200 -0
- package/src/editor/selectors/link-selector.tsx +118 -0
- package/src/editor/selectors/node-selector.tsx +157 -0
- package/src/editor/selectors/text-buttons.tsx +86 -0
- package/src/editor/types.ts +6 -0
- package/src/editor/useProseMirror.ts +126 -0
- package/src/editor/utils/prosemirror-utils.ts +108 -0
- package/src/editor/utils/remove_classes.ts +17 -0
- package/src/editor/utils/useDebouncedCallback.ts +25 -0
- package/src/form/EntityForm.tsx +150 -75
- package/src/form/EntityFormActions.tsx +19 -12
- package/src/form/PropertyFieldBinding.tsx +68 -51
- package/src/form/components/ErrorFocus.tsx +3 -3
- package/src/form/components/LocalChangesMenu.tsx +19 -19
- package/src/form/components/StorageItemPreview.tsx +5 -3
- package/src/form/components/StorageUploadProgress.tsx +22 -6
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +18 -5
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +22 -10
- package/src/form/field_bindings/BlockFieldBinding.tsx +26 -9
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +18 -17
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +46 -25
- package/src/form/field_bindings/MapFieldBinding.tsx +88 -70
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +93 -52
- package/src/form/field_bindings/MultiSelectFieldBinding.tsx +15 -1
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +25 -11
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +25 -11
- package/src/form/field_bindings/RepeatFieldBinding.tsx +21 -6
- package/src/form/field_bindings/SelectFieldBinding.tsx +7 -5
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +110 -92
- package/src/form/field_bindings/SwitchFieldBinding.tsx +31 -14
- package/src/form/field_bindings/TextFieldBinding.tsx +77 -38
- package/src/form/field_bindings/UserSelectFieldBinding.tsx +7 -5
- package/src/form/validation.ts +245 -160
- package/src/hooks/index.tsx +1 -0
- package/src/hooks/useBreadcrumbsController.tsx +18 -0
- package/src/hooks/useBuildNavigationController.tsx +91 -41
- package/src/hooks/useCollapsedGroups.ts +18 -9
- package/src/hooks/useTranslation.ts +31 -0
- package/src/hooks/useValidateAuthenticator.tsx +1 -1
- package/src/i18n/FireCMSi18nProvider.tsx +160 -0
- package/src/index.ts +5 -0
- package/src/internal/useBuildDataSource.ts +68 -34
- package/src/internal/useBuildSideDialogsController.tsx +11 -8
- package/src/internal/useBuildSideEntityController.tsx +24 -24
- package/src/internal/useRestoreScroll.tsx +26 -14
- package/src/locales/de.ts +718 -0
- package/src/locales/en.ts +730 -0
- package/src/locales/es.ts +730 -0
- package/src/locales/fr.ts +718 -0
- package/src/locales/hi.ts +718 -0
- package/src/locales/it.ts +718 -0
- package/src/locales/pt.ts +727 -0
- package/src/preview/PropertyPreview.tsx +43 -33
- package/src/preview/PropertyPreviewProps.tsx +6 -0
- package/src/preview/components/DatePreview.tsx +72 -4
- package/src/preview/components/EmptyValue.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +37 -21
- package/src/preview/components/ReferencePreview.tsx +8 -2
- package/src/preview/components/StorageThumbnail.tsx +16 -12
- package/src/preview/components/UrlComponentPreview.tsx +32 -27
- package/src/preview/components/UserPreview.tsx +3 -1
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +9 -7
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +11 -9
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +26 -24
- package/src/preview/property_previews/MapPropertyPreview.tsx +49 -27
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +61 -56
- package/src/routes/CustomCMSRoute.tsx +1 -0
- package/src/routes/FireCMSRoute.tsx +87 -65
- package/src/types/analytics.ts +10 -0
- package/src/types/collections.ts +97 -3
- package/src/types/customization_controller.tsx +2 -1
- package/src/types/datasource.ts +54 -56
- package/src/types/entities.ts +10 -0
- package/src/types/firecms.tsx +2 -1
- package/src/types/index.ts +1 -0
- package/src/types/navigation.ts +2 -2
- package/src/types/plugins.tsx +77 -1
- package/src/types/properties.ts +369 -37
- package/src/types/storage.ts +11 -1
- package/src/types/translations.ts +752 -0
- package/src/util/__tests__/conditions.test.ts +506 -0
- package/src/util/__tests__/objects.test.ts +196 -0
- package/src/util/callbacks.ts +6 -3
- package/src/util/collections.ts +51 -6
- package/src/util/conditions.ts +339 -0
- package/src/util/entities.ts +29 -30
- package/src/util/entity_cache.ts +2 -1
- package/src/util/index.ts +3 -1
- package/src/util/join_collections.ts +10 -8
- package/src/util/lazy_eager.tsx +33 -0
- package/src/util/objects.ts +46 -13
- package/src/util/{references.ts → previews.ts} +16 -2
- package/src/util/property_utils.tsx +37 -11
- package/src/util/resolutions.ts +62 -58
- package/src/util/useStorageUploadController.tsx +34 -30
- /package/dist/util/{references.d.ts → previews.d.ts} +0 -0
package/dist/util/entities.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CMSType, DataType, Entity, EntityReference, EntityStatus, EntityValues, PropertiesOrBuilders, Property, PropertyBuilder, PropertyOrBuilder, ResolvedProperties, ResolvedProperty } from "../types";
|
|
2
2
|
export declare function isReadOnly(property: Property<any> | ResolvedProperty<any>): boolean;
|
|
3
3
|
export declare function isHidden(property: Property | ResolvedProperty): boolean;
|
|
4
|
-
export declare function isPropertyBuilder<T extends CMSType, M extends Record<string, any
|
|
4
|
+
export declare function isPropertyBuilder<T extends CMSType = CMSType, M extends Record<string, any> = any>(propertyOrBuilder?: PropertyOrBuilder<T, M> | Property | ResolvedProperty): propertyOrBuilder is PropertyBuilder<T, M>;
|
|
5
5
|
export declare function getDefaultValuesFor<M extends Record<string, any>>(properties: PropertiesOrBuilders<M> | ResolvedProperties<M>): Partial<EntityValues<M>>;
|
|
6
6
|
export declare function getDefaultValueFor(property?: PropertyOrBuilder): {} | null | undefined;
|
|
7
7
|
export declare function getDefaultValueForDataType(dataType: DataType): {} | null;
|
|
@@ -9,12 +9,11 @@ export declare function getDefaultValueForDataType(dataType: DataType): {} | nul
|
|
|
9
9
|
* Update the automatic values in an entity before save
|
|
10
10
|
* @group Datasource
|
|
11
11
|
*/
|
|
12
|
-
export declare function updateDateAutoValues<M extends Record<string, any>>({ inputValues, properties, status, timestampNowValue
|
|
12
|
+
export declare function updateDateAutoValues<M extends Record<string, any>>({ inputValues, properties, status, timestampNowValue }: {
|
|
13
13
|
inputValues: Partial<EntityValues<M>>;
|
|
14
14
|
properties: ResolvedProperties<M>;
|
|
15
15
|
status: EntityStatus;
|
|
16
16
|
timestampNowValue: any;
|
|
17
|
-
setDateToMidnight: (input?: any) => any | undefined;
|
|
18
17
|
}): EntityValues<M>;
|
|
19
18
|
/**
|
|
20
19
|
* Add missing required fields, expected in the collection, to the values of an entity
|
package/dist/util/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export * from "./icon_list";
|
|
|
16
16
|
export * from "./icon_synonyms";
|
|
17
17
|
export * from "./icons";
|
|
18
18
|
export * from "./plurals";
|
|
19
|
-
export * from "./
|
|
19
|
+
export * from "./previews";
|
|
20
20
|
export * from "./flatten_object";
|
|
21
21
|
export * from "./make_properties_editable";
|
|
22
22
|
export * from "./join_collections";
|
|
@@ -24,3 +24,5 @@ export * from "./builders";
|
|
|
24
24
|
export * from "./useTraceUpdate";
|
|
25
25
|
export * from "./storage";
|
|
26
26
|
export * from "./callbacks";
|
|
27
|
+
export * from "./conditions";
|
|
28
|
+
export * from "./lazy_eager";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Returns a React.lazy component that is also preloaded immediately using
|
|
4
|
+
* requestIdleCallback or setTimeout.
|
|
5
|
+
* This ensures that chunks are split, but fetched in the background before they are actually needed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function lazyEager<T extends React.ComponentType<any>>(factory: () => Promise<any>, exportName?: string): React.LazyExoticComponent<T>;
|
package/dist/util/objects.d.ts
CHANGED
|
@@ -10,3 +10,4 @@ export declare function removeUndefined(value: any, removeEmptyStrings?: boolean
|
|
|
10
10
|
export declare function removeNulls(value: any): any;
|
|
11
11
|
export declare function isEmptyObject(obj: object): boolean;
|
|
12
12
|
export declare function removePropsIfExisting(source: any, comparison: any): any;
|
|
13
|
+
export declare function jsonStringifyReplacer(key: string, value: any): any;
|
|
@@ -15,7 +15,8 @@ export declare function getPropertyInPath<M extends Record<string, any>>(propert
|
|
|
15
15
|
export declare function getResolvedPropertyInPath(properties: Record<string, ResolvedProperty>, path: string): ResolvedProperty | undefined;
|
|
16
16
|
export declare function getBracketNotation(path: string): string;
|
|
17
17
|
/**
|
|
18
|
-
* Get properties
|
|
18
|
+
* Get properties sorted by their order, but include ALL properties.
|
|
19
|
+
* Nested keys (like "data.mode") in propertiesOrder are ignored - they're for column ordering.
|
|
19
20
|
* @param properties
|
|
20
21
|
* @param propertiesOrder
|
|
21
22
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayProperty, AuthController, CMSType, CustomizationController, EntityAction, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
|
|
1
|
+
import { ArrayProperty, AuthController, CMSType, CustomizationController, EntityAction, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, Property, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
|
|
2
2
|
export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence, propertyConfigs, ignoreMissingFields, authController }: {
|
|
3
3
|
collection: EntityCollection<M> | ResolvedEntityCollection<M>;
|
|
4
4
|
path: string;
|
|
@@ -17,7 +17,7 @@ export declare const resolveCollection: <M extends Record<string, any>>({ collec
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function resolveProperty<T extends CMSType = CMSType, M extends Record<string, any> = any>({ propertyOrBuilder, fromBuilder, ignoreMissingFields, ...props }: {
|
|
19
19
|
propertyKey?: string;
|
|
20
|
-
propertyOrBuilder: PropertyOrBuilder<T, M> | ResolvedProperty<T
|
|
20
|
+
propertyOrBuilder: PropertyOrBuilder<T, M> | ResolvedProperty<T> | PropertyOrBuilder | Property | ResolvedProperty | undefined;
|
|
21
21
|
values?: Partial<M>;
|
|
22
22
|
previousValues?: Partial<M>;
|
|
23
23
|
path?: string;
|
|
@@ -54,7 +54,7 @@ export declare function resolveArrayProperty<T extends any[], M>({ propertyKey,
|
|
|
54
54
|
propertyConfigs?: Record<string, PropertyConfig>;
|
|
55
55
|
ignoreMissingFields?: boolean;
|
|
56
56
|
authController: AuthController;
|
|
57
|
-
}): ResolvedArrayProperty;
|
|
57
|
+
}): ResolvedArrayProperty | null;
|
|
58
58
|
/**
|
|
59
59
|
* Resolve enums and arrays for properties
|
|
60
60
|
* @param properties
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrayProperty, EntityValues, ResolvedArrayProperty, ResolvedStringProperty, StorageConfig, StorageSource, StringProperty } from "../types";
|
|
1
|
+
import { ArrayProperty, EntityValues, ImageResize, ResolvedArrayProperty, ResolvedStringProperty, StorageConfig, StorageSource, StringProperty } from "../types";
|
|
2
2
|
import { PreviewSize } from "../preview";
|
|
3
3
|
/**
|
|
4
4
|
* Internal representation of an item in the storage
|
|
@@ -30,8 +30,17 @@ export declare function useStorageUploadController<M extends object>({ entityId,
|
|
|
30
30
|
storage: StorageConfig;
|
|
31
31
|
fileNameBuilder: (file: File) => Promise<string>;
|
|
32
32
|
storagePathBuilder: (file: File) => string;
|
|
33
|
-
onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, metadata?: any) => Promise<void>;
|
|
33
|
+
onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, metadata?: any, uploadedUrl?: string) => Promise<void>;
|
|
34
34
|
onFileUploadError: (entry: StorageFieldItem) => void;
|
|
35
35
|
onFilesAdded: (acceptedFiles: File[]) => Promise<void>;
|
|
36
36
|
multipleFilesSupported: boolean;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Check if a file is an image type supported for resizing
|
|
40
|
+
*/
|
|
41
|
+
export declare function isImageFile(file: File): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Resize and compress an image using compressorjs.
|
|
44
|
+
* Supports both the new imageResize API and legacy imageCompression for backward compatibility.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resizeImage(file: File, imageResize?: StorageConfig["imageResize"], legacyCompression?: ImageResize): Promise<File>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.1.0-canary.02232f4",
|
|
5
5
|
"description": "Awesome Firebase/Firestore-based headless open-source CMS",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/firecmsco"
|
|
@@ -53,30 +53,55 @@
|
|
|
53
53
|
"@dnd-kit/core": "^6.3.1",
|
|
54
54
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
55
55
|
"@dnd-kit/sortable": "^10.0.0",
|
|
56
|
-
"@firecms/
|
|
57
|
-
"@firecms/
|
|
58
|
-
"@
|
|
56
|
+
"@firecms/formex": "^3.1.0-canary.02232f4",
|
|
57
|
+
"@firecms/ui": "^3.1.0-canary.02232f4",
|
|
58
|
+
"@floating-ui/dom": "^1.7.4",
|
|
59
59
|
"@radix-ui/react-portal": "^1.1.10",
|
|
60
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
60
61
|
"clsx": "^2.1.1",
|
|
61
62
|
"compressorjs": "^1.2.1",
|
|
62
63
|
"date-fns": "^3.6.0",
|
|
63
64
|
"fuse.js": "^7.1.0",
|
|
64
65
|
"history": "^5.3.0",
|
|
66
|
+
"i18next": "^23.16.4",
|
|
67
|
+
"json-logic-js": "^2.0.5",
|
|
65
68
|
"markdown-it": "^14.1.0",
|
|
69
|
+
"markdown-it-ins": "^4.0.0",
|
|
70
|
+
"markdown-it-mark": "^4.0.0",
|
|
71
|
+
"markdown-it-task-lists": "^2.1.1",
|
|
66
72
|
"notistack": "^3.0.2",
|
|
67
73
|
"object-hash": "^3.0.0",
|
|
68
74
|
"prism-react-renderer": "^2.4.1",
|
|
75
|
+
"prosemirror-commands": "^1.6.0",
|
|
76
|
+
"prosemirror-dropcursor": "^1.8.1",
|
|
77
|
+
"prosemirror-example-setup": "^1.2.3",
|
|
78
|
+
"prosemirror-gapcursor": "^1.3.2",
|
|
79
|
+
"prosemirror-history": "^1.4.1",
|
|
80
|
+
"prosemirror-inputrules": "^1.5.1",
|
|
81
|
+
"prosemirror-keymap": "^1.2.2",
|
|
82
|
+
"prosemirror-markdown": "^1.13.0",
|
|
83
|
+
"prosemirror-model": "^1.22.3",
|
|
84
|
+
"prosemirror-schema-basic": "^1.2.3",
|
|
85
|
+
"prosemirror-schema-list": "^1.4.1",
|
|
86
|
+
"prosemirror-state": "^1.4.3",
|
|
87
|
+
"prosemirror-tables": "^1.8.5",
|
|
88
|
+
"prosemirror-transform": "^1.10.0",
|
|
89
|
+
"prosemirror-view": "^1.33.8",
|
|
69
90
|
"react-dropzone": "^14.3.8",
|
|
70
91
|
"react-fast-compare": "^3.2.2",
|
|
92
|
+
"react-i18next": "^14.1.3",
|
|
93
|
+
"react-image-crop": "^11.0.10",
|
|
94
|
+
"react-markdown": "^9.1.0",
|
|
95
|
+
"react-moveable": "^0.56.0",
|
|
71
96
|
"react-transition-group": "^4.4.5",
|
|
72
97
|
"react-use-measure": "^2.1.7",
|
|
73
98
|
"react-window": "^1.8.11",
|
|
74
99
|
"vite-plugin-static-copy": "3.1.4",
|
|
75
|
-
"yup": "^
|
|
100
|
+
"yup": "^1.7.1"
|
|
76
101
|
},
|
|
77
102
|
"peerDependencies": {
|
|
78
|
-
"react": ">=18.0.0",
|
|
79
|
-
"react-dom": ">=18.0.0",
|
|
103
|
+
"react": ">=18.3.1 || >=19.0.0",
|
|
104
|
+
"react-dom": ">=18.3.1 || >=19.0.0",
|
|
80
105
|
"react-router": "^6.28.0",
|
|
81
106
|
"react-router-dom": "^6.28.0"
|
|
82
107
|
},
|
|
@@ -85,16 +110,19 @@
|
|
|
85
110
|
"@testing-library/react": "^16.3.0",
|
|
86
111
|
"@testing-library/user-event": "^14.6.1",
|
|
87
112
|
"@types/jest": "^29.5.14",
|
|
113
|
+
"@types/json-logic-js": "^2.0.8",
|
|
88
114
|
"@types/node": "^20.19.17",
|
|
89
115
|
"@types/object-hash": "^3.0.6",
|
|
90
|
-
"@types/react": "^
|
|
91
|
-
"@types/react-dom": "^
|
|
116
|
+
"@types/react": "^19.2.3",
|
|
117
|
+
"@types/react-dom": "^19.2.3",
|
|
92
118
|
"@types/react-measure": "^2.0.12",
|
|
93
119
|
"@vitejs/plugin-react": "^4.7.0",
|
|
94
120
|
"babel-plugin-react-compiler": "^19.0.0-beta-af1b7da-20250417",
|
|
95
121
|
"cross-env": "^7.0.3",
|
|
122
|
+
"eslint-plugin-i18next": "^6.1.3",
|
|
96
123
|
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
97
124
|
"jest": "^29.7.0",
|
|
125
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
98
126
|
"npm-run-all": "^4.1.5",
|
|
99
127
|
"react-router": "^6.30.2",
|
|
100
128
|
"react-router-dom": "^6.30.2",
|
|
@@ -108,15 +136,27 @@
|
|
|
108
136
|
"dist",
|
|
109
137
|
"src"
|
|
110
138
|
],
|
|
111
|
-
"gitHead": "
|
|
139
|
+
"gitHead": "6281205d9f39f85991e1d8533474bfb9a542ed03",
|
|
112
140
|
"publishConfig": {
|
|
113
141
|
"access": "public"
|
|
114
142
|
},
|
|
115
143
|
"eslintConfig": {
|
|
116
144
|
"extends": [
|
|
117
145
|
"react-app",
|
|
118
|
-
"react-app/jest"
|
|
119
|
-
|
|
146
|
+
"react-app/jest",
|
|
147
|
+
"plugin:i18next/recommended"
|
|
148
|
+
],
|
|
149
|
+
"plugins": [
|
|
150
|
+
"i18next"
|
|
151
|
+
],
|
|
152
|
+
"rules": {
|
|
153
|
+
"i18next/no-literal-string": [
|
|
154
|
+
"warn",
|
|
155
|
+
{
|
|
156
|
+
"markupOnly": true
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
120
160
|
},
|
|
121
161
|
"jest": {
|
|
122
162
|
"transform": {
|
package/src/app/Scaffold.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import equal from "react-fast-compare"
|
|
|
4
4
|
import { useLargeLayout } from "../hooks";
|
|
5
5
|
import { ErrorBoundary } from "../components";
|
|
6
6
|
import { AppContext } from "./useApp";
|
|
7
|
+
import { useTranslation } from "../hooks/useTranslation";
|
|
7
8
|
|
|
8
9
|
export const DRAWER_WIDTH = 280;
|
|
9
10
|
|
|
@@ -123,7 +124,7 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
|
|
|
123
124
|
<main
|
|
124
125
|
className="flex flex-col flex-grow overflow-auto">
|
|
125
126
|
|
|
126
|
-
{hasAppBar && <DrawerHeader/>}
|
|
127
|
+
{hasAppBar && <DrawerHeader />}
|
|
127
128
|
|
|
128
129
|
<div
|
|
129
130
|
className={cls(defaultBorderMixin, "flex-grow overflow-auto m-0 ", {
|
|
@@ -163,6 +164,7 @@ function DrawerWrapper(props: {
|
|
|
163
164
|
onMouseLeave: () => void
|
|
164
165
|
}) {
|
|
165
166
|
|
|
167
|
+
const { t } = useTranslation();
|
|
166
168
|
const width = !props.displayed ? 0 : (props.open ? DRAWER_WIDTH : 72);
|
|
167
169
|
const innerDrawer = <div
|
|
168
170
|
className={"relative h-full no-scrollbar overflow-y-auto overflow-x-hidden"}
|
|
@@ -173,33 +175,32 @@ function DrawerWrapper(props: {
|
|
|
173
175
|
>
|
|
174
176
|
|
|
175
177
|
{!props.open && props.displayed && (
|
|
176
|
-
<Tooltip title="
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
<Tooltip title={t("open_menu")}
|
|
179
|
+
side="right"
|
|
180
|
+
sideOffset={12}
|
|
181
|
+
asChild={true}>
|
|
180
182
|
<div
|
|
181
183
|
className="ml-2 fixed top-1 left-2 sm:top-2 sm:left-2 !bg-surface-50 dark:!bg-surface-900 rounded-full w-fit z-20">
|
|
182
184
|
<IconButton
|
|
183
185
|
color="inherit"
|
|
184
|
-
aria-label="
|
|
186
|
+
aria-label={t("open_menu")}
|
|
185
187
|
onClick={() => props.setDrawerOpen(true)}
|
|
186
188
|
size="large"
|
|
187
189
|
>
|
|
188
|
-
<MenuIcon/>
|
|
190
|
+
<MenuIcon size="small" />
|
|
189
191
|
</IconButton>
|
|
190
192
|
</div>
|
|
191
193
|
</Tooltip>
|
|
192
194
|
)}
|
|
193
195
|
|
|
194
196
|
<div
|
|
195
|
-
className={`z-20 absolute right-0 top-4 ${
|
|
196
|
-
|
|
197
|
-
} transition-opacity duration-200 ease-in-out`}>
|
|
197
|
+
className={`z-20 absolute right-0 top-4 ${props.open ? "opacity-100" : "opacity-0 invisible"
|
|
198
|
+
} transition-opacity duration-200 ease-in-out`}>
|
|
198
199
|
<IconButton
|
|
199
|
-
aria-label="
|
|
200
|
+
aria-label={t("close_drawer")}
|
|
200
201
|
onClick={() => props.setDrawerOpen(false)}
|
|
201
202
|
>
|
|
202
|
-
<ChevronLeftIcon/>
|
|
203
|
+
<ChevronLeftIcon />
|
|
203
204
|
</IconButton>
|
|
204
205
|
</div>
|
|
205
206
|
|
|
@@ -216,19 +217,19 @@ function DrawerWrapper(props: {
|
|
|
216
217
|
return <>
|
|
217
218
|
<IconButton
|
|
218
219
|
color="inherit"
|
|
219
|
-
aria-label="
|
|
220
|
+
aria-label={t("open_menu")}
|
|
220
221
|
onClick={() => props.setDrawerOpen(true)}
|
|
221
222
|
size="large"
|
|
222
223
|
className="absolute sm:top-2 sm:left-4 top-1 left-2"
|
|
223
224
|
>
|
|
224
|
-
<MenuIcon/>
|
|
225
|
+
<MenuIcon />
|
|
225
226
|
</IconButton>
|
|
226
227
|
<Sheet side={"left"}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
transparent={true}
|
|
229
|
+
open={props.open}
|
|
230
|
+
onOpenChange={props.setDrawerOpen}
|
|
231
|
+
title={t("navigation_drawer")}
|
|
232
|
+
overlayClassName={"bg-white bg-opacity-80 bg-white/80"}
|
|
232
233
|
>
|
|
233
234
|
{innerDrawer}
|
|
234
235
|
</Sheet>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AutoAwesomeIcon } from "@firecms/ui";
|
|
3
|
+
import { useTranslation } from "../hooks";
|
|
4
|
+
|
|
5
|
+
export interface AIIconProps {
|
|
6
|
+
size?: "smallest" | "small" | "medium" | "large";
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* AI-styled AutoAwesome icon with gradient coloring.
|
|
12
|
+
* Used consistently across AI features for visual identification.
|
|
13
|
+
*/
|
|
14
|
+
export function AIIcon({ size = "small", className }: AIIconProps) {
|
|
15
|
+
return (
|
|
16
|
+
<AutoAwesomeIcon
|
|
17
|
+
size={size}
|
|
18
|
+
className={className}
|
|
19
|
+
style={{
|
|
20
|
+
background: "linear-gradient(to right, var(--color-primary), var(--color-secondary))",
|
|
21
|
+
WebkitBackgroundClip: "text",
|
|
22
|
+
WebkitTextFillColor: "transparent",
|
|
23
|
+
backgroundClip: "text"
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Small animated dot indicator for AI-modified elements.
|
|
31
|
+
* Shows a pulsing gradient dot.
|
|
32
|
+
*/
|
|
33
|
+
export function AIModifiedIndicator({ className }: { className?: string }) {
|
|
34
|
+
const { t } = useTranslation();
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
className={`w-2 h-2 rounded-full bg-gradient-to-r from-primary to-secondary animate-pulse ${className ?? ""}`}
|
|
38
|
+
title={t("ai_modified")}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -13,6 +13,7 @@ import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
|
|
13
13
|
import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
14
14
|
import { CSS } from "@dnd-kit/utilities";
|
|
15
15
|
import { getHashValue } from "../util";
|
|
16
|
+
import { useTranslation } from "../hooks";
|
|
16
17
|
import {
|
|
17
18
|
AddIcon,
|
|
18
19
|
Button,
|
|
@@ -186,7 +187,7 @@ export function ArrayContainerItem({
|
|
|
186
187
|
<div
|
|
187
188
|
ref={nodeRef}
|
|
188
189
|
style={style}
|
|
189
|
-
className={`relative ${!isDragging ? "hover\\:bg-surface-accent-50 dark\\:hover\\:bg-surface-800 dark\\:hover\\:bg-opacity-20" : ""} rounded-md opacity-100`}
|
|
190
|
+
className={`relative ${!isDragging ? "hover\\:bg-surface-accent-50 dark\\:hover\\:bg-surface-800 dark\\:hover\\:bg-opacity-20 dark\\:hover\\:bg-surface-800/20" : ""} rounded-md opacity-100`}
|
|
190
191
|
>
|
|
191
192
|
<div className="flex items-start">
|
|
192
193
|
<div className="flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark">
|
|
@@ -235,6 +236,7 @@ export function ArrayItemOptions({
|
|
|
235
236
|
canAddElements?: boolean;
|
|
236
237
|
addInIndex?: (index: number) => void;
|
|
237
238
|
}) {
|
|
239
|
+
const { t } = useTranslation();
|
|
238
240
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
239
241
|
const iconRef = useRef<HTMLDivElement>(null);
|
|
240
242
|
useOutsideAlerter(iconRef, () => {
|
|
@@ -296,7 +298,7 @@ export function ArrayItemOptions({
|
|
|
296
298
|
}}
|
|
297
299
|
>
|
|
298
300
|
<RemoveIcon size={"small"}/>
|
|
299
|
-
|
|
301
|
+
{t("remove")}
|
|
300
302
|
</MenuItem>
|
|
301
303
|
<MenuItem
|
|
302
304
|
dense
|
|
@@ -306,7 +308,7 @@ export function ArrayItemOptions({
|
|
|
306
308
|
}}
|
|
307
309
|
>
|
|
308
310
|
<ContentCopyIcon size={"small"}/>
|
|
309
|
-
|
|
311
|
+
{t("copy")}
|
|
310
312
|
</MenuItem>
|
|
311
313
|
{addInIndex && (
|
|
312
314
|
<MenuItem
|
|
@@ -317,7 +319,7 @@ export function ArrayItemOptions({
|
|
|
317
319
|
}}
|
|
318
320
|
>
|
|
319
321
|
<KeyboardArrowUpIcon size={"small"}/>
|
|
320
|
-
|
|
322
|
+
{t("add_on_top")}
|
|
321
323
|
</MenuItem>
|
|
322
324
|
)}
|
|
323
325
|
{addInIndex && (
|
|
@@ -329,7 +331,7 @@ export function ArrayItemOptions({
|
|
|
329
331
|
}}
|
|
330
332
|
>
|
|
331
333
|
<KeyboardArrowDownIcon size={"small"}/>
|
|
332
|
-
|
|
334
|
+
{t("add_below")}
|
|
333
335
|
</MenuItem>
|
|
334
336
|
)}
|
|
335
337
|
</Menu>
|
|
@@ -484,11 +486,9 @@ export function ArrayContainer<T>({
|
|
|
484
486
|
<Button
|
|
485
487
|
variant={"text"}
|
|
486
488
|
size={size === "small" ? "small" : "medium"}
|
|
487
|
-
color="primary"
|
|
488
489
|
disabled={disabled || (value?.length ?? 0) >= max}
|
|
489
490
|
startIcon={<AddIcon/>}
|
|
490
491
|
onClick={insertInEnd}
|
|
491
|
-
className={"ml-3.5"}
|
|
492
492
|
>
|
|
493
493
|
{addLabel ?? "Add"}
|
|
494
494
|
</Button>
|
|
@@ -527,7 +527,6 @@ export function ArrayContainer<T>({
|
|
|
527
527
|
<Button
|
|
528
528
|
variant={"text"}
|
|
529
529
|
size={size === "small" ? "small" : "medium"}
|
|
530
|
-
color="primary"
|
|
531
530
|
disabled={disabled || (value?.length ?? 0) >= max}
|
|
532
531
|
startIcon={<AddIcon/>}
|
|
533
532
|
onClick={insertInEnd}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { Button,
|
|
1
|
+
import { FilterListOffIcon, Button, Tooltip } from "@firecms/ui";
|
|
2
2
|
import { EntityTableController } from "../types";
|
|
3
|
+
import { useTranslation } from "../hooks";
|
|
3
4
|
|
|
4
5
|
export function ClearFilterSortButton({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
tableController,
|
|
7
|
+
enabled
|
|
8
|
+
}: {
|
|
8
9
|
enabled: boolean;
|
|
9
10
|
tableController: EntityTableController
|
|
10
11
|
}) {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
|
|
11
14
|
if (!enabled) {
|
|
12
15
|
return null;
|
|
13
16
|
}
|
|
@@ -18,24 +21,27 @@ export function ClearFilterSortButton({
|
|
|
18
21
|
if ((filterIsSet || sortIsSet) && (tableController.clearFilter || tableController.setSortBy)) {
|
|
19
22
|
let label;
|
|
20
23
|
if (filterIsSet && sortIsSet) {
|
|
21
|
-
label = "
|
|
24
|
+
label = t("clear_filter_sort");
|
|
22
25
|
} else if (filterIsSet) {
|
|
23
|
-
label = "
|
|
26
|
+
label = t("clear_filter");
|
|
24
27
|
} else {
|
|
25
|
-
label = "
|
|
28
|
+
label = t("clear_sort");
|
|
26
29
|
}
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
return (
|
|
31
|
+
<Tooltip title={label}>
|
|
32
|
+
<Button
|
|
33
|
+
size={"small"}
|
|
34
|
+
variant={"text"}
|
|
35
|
+
aria-label={label}
|
|
36
|
+
onClick={() => {
|
|
37
|
+
tableController.clearFilter?.();
|
|
38
|
+
tableController.setSortBy?.(undefined);
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
<FilterListOffIcon size="small" />
|
|
42
|
+
</Button>
|
|
43
|
+
</Tooltip>
|
|
44
|
+
);
|
|
39
45
|
}
|
|
40
46
|
return null;
|
|
41
47
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, LoadingButton } from "@firecms/ui";
|
|
4
|
+
import { useTranslation } from "../hooks/useTranslation";
|
|
4
5
|
|
|
5
6
|
export function ConfirmationDialog({
|
|
6
7
|
open,
|
|
@@ -17,6 +18,7 @@ export function ConfirmationDialog({
|
|
|
17
18
|
title: React.ReactNode,
|
|
18
19
|
body?: React.ReactNode,
|
|
19
20
|
}) {
|
|
21
|
+
const { t } = useTranslation();
|
|
20
22
|
return (
|
|
21
23
|
<Dialog
|
|
22
24
|
open={open}
|
|
@@ -29,18 +31,16 @@ export function ConfirmationDialog({
|
|
|
29
31
|
|
|
30
32
|
<DialogActions>
|
|
31
33
|
<Button
|
|
32
|
-
color={"primary"}
|
|
33
34
|
variant={"text"}
|
|
34
35
|
onClick={onCancel}
|
|
35
|
-
autoFocus>
|
|
36
|
+
autoFocus>{t("cancel")}</Button>
|
|
36
37
|
|
|
37
38
|
<LoadingButton
|
|
38
|
-
color="primary"
|
|
39
39
|
type="submit"
|
|
40
40
|
loading={loading}
|
|
41
41
|
onClick={onAccept}
|
|
42
42
|
autoFocus>
|
|
43
|
-
|
|
43
|
+
{t("ok")}
|
|
44
44
|
</LoadingButton>
|
|
45
45
|
</DialogActions>
|
|
46
46
|
</Dialog>
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "../hooks";
|
|
12
12
|
import { resolveCollection } from "../util";
|
|
13
13
|
import { EntityView } from "./EntityView";
|
|
14
|
+
import { useTranslation } from "../hooks/useTranslation";
|
|
14
15
|
|
|
15
16
|
export interface DeleteEntityDialogProps<M extends Record<string, any>> {
|
|
16
17
|
entityOrEntitiesToDelete?: Entity<M> | Entity<M>[],
|
|
@@ -39,6 +40,8 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
39
40
|
const dataSource = useDataSource(collection);
|
|
40
41
|
const customizationController = useCustomizationController();
|
|
41
42
|
const snackbarController = useSnackbarController();
|
|
43
|
+
const { t } = useTranslation();
|
|
44
|
+
|
|
42
45
|
const [loading, setLoading] = useState(false);
|
|
43
46
|
|
|
44
47
|
const context = useFireCMSContext();
|
|
@@ -66,7 +69,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
66
69
|
const onDeleteFailure = useCallback((entity: Entity<any>, e: Error) => {
|
|
67
70
|
snackbarController.open({
|
|
68
71
|
type: "error",
|
|
69
|
-
message: "
|
|
72
|
+
message: t("error_deleting", { message: e?.message })
|
|
70
73
|
});
|
|
71
74
|
|
|
72
75
|
console.error("Error deleting entity");
|
|
@@ -76,7 +79,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
76
79
|
const onPreDeleteHookError = useCallback((entity: Entity<any>, e: Error) => {
|
|
77
80
|
snackbarController.open({
|
|
78
81
|
type: "error",
|
|
79
|
-
message: "
|
|
82
|
+
message: t("error_before_delete", { message: e?.message })
|
|
80
83
|
});
|
|
81
84
|
console.error(e);
|
|
82
85
|
}, [resolvedCollection.name]);
|
|
@@ -153,7 +156,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
153
156
|
|
|
154
157
|
let content: React.ReactNode;
|
|
155
158
|
if (entityOrEntities && multipleEntities) {
|
|
156
|
-
content = <>
|
|
159
|
+
content = <>{t("multiple_entities")}</>;
|
|
157
160
|
} else {
|
|
158
161
|
const entity = entityOrEntities as Entity<M> | undefined;
|
|
159
162
|
content = entity
|
|
@@ -165,8 +168,8 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
const dialogTitle = multipleEntities
|
|
168
|
-
? <><b>{resolvedCollection.name}</b>:
|
|
169
|
-
:
|
|
171
|
+
? <><b>{resolvedCollection.name}</b>: {t("confirm_multiple_delete")}</>
|
|
172
|
+
: t("delete_entity_confirm_title", { entityName: resolvedCollection.singularName ?? resolvedCollection.name });
|
|
170
173
|
|
|
171
174
|
return (
|
|
172
175
|
<Dialog
|
|
@@ -187,17 +190,15 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
|
|
|
187
190
|
|
|
188
191
|
<Button onClick={handleCancel}
|
|
189
192
|
disabled={loading}
|
|
190
|
-
variant="text"
|
|
191
|
-
|
|
192
|
-
Cancel
|
|
193
|
+
variant="text">
|
|
194
|
+
{t("cancel")}
|
|
193
195
|
</Button>
|
|
194
196
|
<Button
|
|
195
197
|
autoFocus
|
|
196
198
|
disabled={loading}
|
|
197
199
|
onClick={handleOk}
|
|
198
|
-
variant="filled"
|
|
199
|
-
|
|
200
|
-
Ok
|
|
200
|
+
variant="filled">
|
|
201
|
+
{t("ok")}
|
|
201
202
|
</Button>
|
|
202
203
|
</DialogActions>
|
|
203
204
|
|