@firecms/core 3.4.0-canary.8635253 → 3.4.0-canary.9408c41
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 +4 -0
- package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +6 -1
- package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +3 -1
- package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +3 -1
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +8 -0
- package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +3 -1
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +3 -1
- package/dist/components/EntityCollectionView/useBoardDataController.d.ts +3 -1
- package/dist/components/ErrorBoundary.d.ts +1 -3
- package/dist/components/LicenseBanner.d.ts +23 -0
- package/dist/components/ReferenceTable/ReferenceSelectionTable.d.ts +10 -1
- package/dist/components/SelectableTable/filters/filter_text_input.d.ts +30 -0
- package/dist/components/SelectableTable/filters/filter_text_input.test.d.ts +1 -0
- package/dist/components/common/table_url_params.d.ts +24 -0
- package/dist/components/common/useDataSourceTableController.d.ts +9 -1
- package/dist/components/common/useTableSearchHelper.d.ts +9 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/contexts/LicenseStatusContext.d.ts +16 -0
- package/dist/core/EntityEditView.d.ts +9 -1
- package/dist/core/EntityEditViewFormActions.d.ts +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/plugin_translations.d.ts +38 -0
- package/dist/core/pro_plugins.d.ts +40 -0
- package/dist/de-DMp6cIY1.js +702 -0
- package/dist/de-DMp6cIY1.js.map +1 -0
- package/dist/editor/extensions/Image.d.ts +11 -0
- package/dist/editor/index.d.ts +2 -1
- package/dist/editor/lazy_editor.d.ts +6 -0
- package/dist/editor-BSo_aS1I.js +4563 -0
- package/dist/editor-BSo_aS1I.js.map +1 -0
- package/dist/form/EntityForm.d.ts +8 -1
- package/dist/form/EntityFormActions.d.ts +2 -0
- package/dist/fr-Cckz4IkR.js +702 -0
- package/dist/fr-Cckz4IkR.js.map +1 -0
- package/dist/hi-CDCoIqbu.js +702 -0
- package/dist/hi-CDCoIqbu.js.map +1 -0
- package/dist/hooks/data/delete.d.ts +1 -1
- package/dist/hooks/data/save.d.ts +1 -1
- package/dist/hooks/data/useCollectionFetch.d.ts +7 -1
- package/dist/hooks/data/useEntityFetch.d.ts +9 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useLicenseStatus.d.ts +16 -0
- package/dist/hooks/useProjectLog.d.ts +11 -6
- package/dist/hooks/useTranslation.d.ts +1 -1
- package/dist/i18n/__tests__/FireCMSi18nProvider.test.d.ts +1 -0
- package/dist/i18n/__tests__/nested_provider_lifecycle.test.d.ts +1 -0
- package/dist/index.es.js +3921 -11331
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +8950 -7585
- package/dist/index.umd.js.map +1 -1
- package/dist/it-BJCUqixj.js +702 -0
- package/dist/it-BJCUqixj.js.map +1 -0
- package/dist/pl-DgT_joFf.js +704 -0
- package/dist/pl-DgT_joFf.js.map +1 -0
- package/dist/pt-B3dN3x0X.js +704 -0
- package/dist/pt-B3dN3x0X.js.map +1 -0
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/collections.d.ts +14 -0
- package/dist/types/datasource.d.ts +67 -4
- package/dist/types/entities.d.ts +21 -1
- package/dist/types/entity_actions.d.ts +6 -0
- package/dist/types/entity_callbacks.d.ts +21 -0
- package/dist/types/firecms.d.ts +18 -1
- package/dist/types/firecms_context.d.ts +8 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/license.d.ts +54 -0
- package/dist/types/navigation.d.ts +34 -5
- package/dist/types/plugins.d.ts +22 -1
- package/dist/types/properties.d.ts +17 -1
- package/dist/types/side_entity_controller.d.ts +7 -0
- package/dist/types/translations.d.ts +41 -2
- package/dist/util/__tests__/collections.test.d.ts +1 -0
- package/dist/util/__tests__/urls.test.d.ts +1 -0
- package/dist/util/collections.d.ts +1 -1
- package/dist/util/date_fns_locales.d.ts +18 -0
- package/dist/util/entity_cache.d.ts +11 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/lazy_eager.d.ts +3 -3
- package/dist/util/navigation_from_path.d.ts +7 -0
- package/dist/util/navigation_utils.d.ts +87 -3
- package/dist/util/parent_references_from_path.d.ts +16 -0
- package/dist/util/paths.d.ts +28 -0
- package/dist/util/permissions.d.ts +10 -4
- package/dist/util/urls.d.ts +22 -0
- package/package.json +5 -6
- package/src/app/Scaffold.tsx +7 -0
- package/src/components/DeleteEntityDialog.tsx +2 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +2 -2
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +1 -0
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +7 -0
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +5 -1
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +12 -0
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +66 -15
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +6 -2
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +4 -0
- package/src/components/EntityCollectionView/useBoardDataController.tsx +17 -1
- package/src/components/EntityPreview.tsx +4 -1
- package/src/components/ErrorBoundary.tsx +12 -18
- package/src/components/LicenseBanner.tsx +209 -0
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +19 -2
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +33 -7
- package/src/components/SelectableTable/filters/filter_text_input.test.ts +184 -0
- package/src/components/SelectableTable/filters/filter_text_input.ts +71 -0
- package/src/components/common/default_entity_actions.tsx +22 -2
- package/src/components/common/table_url_params.ts +172 -0
- package/src/components/common/useDataSourceTableController.tsx +86 -179
- package/src/components/common/useTableSearchHelper.ts +26 -2
- package/src/components/index.tsx +1 -0
- package/src/contexts/LicenseStatusContext.tsx +50 -0
- package/src/contexts/SnackbarProvider.tsx +14 -1
- package/src/core/DefaultAppBar.tsx +28 -16
- package/src/core/EntityEditView.tsx +20 -3
- package/src/core/EntityEditViewFormActions.tsx +3 -2
- package/src/core/EntitySidePanel.tsx +8 -4
- package/src/core/FireCMS.tsx +73 -47
- package/src/core/SideDialogs.tsx +44 -1
- package/src/core/index.tsx +1 -0
- package/src/core/plugin_translations.ts +87 -0
- package/src/core/pro_plugins.ts +79 -0
- package/src/editor/components/SlashCommandMenu.tsx +4 -1
- package/src/editor/extensions/Image.ts +17 -1
- package/src/editor/hooks/useProseMirror.ts +5 -0
- package/src/editor/index.ts +11 -1
- package/src/editor/lazy_editor.tsx +33 -0
- package/src/form/EntityForm.tsx +31 -10
- package/src/form/EntityFormActions.tsx +2 -0
- package/src/hooks/data/delete.ts +8 -0
- package/src/hooks/data/save.ts +6 -1
- package/src/hooks/data/useCollectionFetch.tsx +21 -1
- package/src/hooks/data/useEntityFetch.tsx +35 -4
- package/src/hooks/index.tsx +2 -0
- package/src/hooks/useBuildNavigationController.tsx +70 -15
- package/src/hooks/useFireCMSContext.tsx +7 -3
- package/src/hooks/useLicenseStatus.tsx +32 -0
- package/src/hooks/useProjectLog.tsx +27 -9
- package/src/hooks/useResolvedNavigationFrom.tsx +3 -1
- package/src/hooks/useTranslation.ts +3 -1
- package/src/hooks/useValidateAuthenticator.tsx +4 -0
- package/src/i18n/FireCMSi18nProvider.tsx +199 -25
- package/src/i18n/__tests__/FireCMSi18nProvider.test.tsx +91 -0
- package/src/i18n/__tests__/nested_provider_lifecycle.test.tsx +67 -0
- package/src/internal/useBuildDataSource.ts +37 -15
- package/src/internal/useBuildSideEntityController.tsx +19 -5
- package/src/locales/de.ts +23 -2
- package/src/locales/en.ts +26 -3
- package/src/locales/es.ts +23 -2
- package/src/locales/fr.ts +23 -2
- package/src/locales/hi.ts +23 -2
- package/src/locales/it.ts +23 -2
- package/src/locales/pl.ts +23 -2
- package/src/locales/pt.ts +23 -2
- package/src/preview/components/DatePreview.tsx +2 -4
- package/src/preview/components/ReferencePreview.tsx +7 -3
- package/src/preview/components/StorageThumbnail.tsx +24 -2
- package/src/routes/FireCMSRoute.tsx +11 -3
- package/src/types/analytics.ts +3 -0
- package/src/types/collections.ts +16 -0
- package/src/types/datasource.ts +67 -4
- package/src/types/entities.ts +24 -1
- package/src/types/entity_actions.tsx +6 -0
- package/src/types/entity_callbacks.ts +24 -0
- package/src/types/firecms.tsx +19 -1
- package/src/types/firecms_context.tsx +9 -0
- package/src/types/index.ts +1 -0
- package/src/types/license.ts +62 -0
- package/src/types/navigation.ts +35 -5
- package/src/types/plugins.tsx +23 -1
- package/src/types/properties.ts +17 -0
- package/src/types/side_entity_controller.tsx +7 -0
- package/src/types/translations.ts +41 -2
- package/src/util/__tests__/collections.test.ts +32 -0
- package/src/util/__tests__/urls.test.ts +131 -0
- package/src/util/collections.ts +1 -1
- package/src/util/date_fns_locales.ts +168 -0
- package/src/util/entities.ts +3 -1
- package/src/util/entity_cache.ts +18 -0
- package/src/util/index.ts +2 -0
- package/src/util/lazy_eager.tsx +30 -8
- package/src/util/navigation_from_path.ts +25 -2
- package/src/util/navigation_utils.ts +214 -3
- package/src/util/parent_references_from_path.ts +42 -3
- package/src/util/paths.ts +40 -3
- package/src/util/permissions.ts +22 -10
- package/src/util/previews.ts +8 -1
- package/src/util/resolutions.ts +8 -0
- package/src/util/urls.ts +52 -0
- package/src/util/useStorageUploadController.tsx +6 -1
package/README.md
CHANGED
|
@@ -145,6 +145,10 @@ Keep in mind you need to update the dependencies in that project if you want to
|
|
|
145
145
|
use it as it is, without linking it to the library source code. More details in
|
|
146
146
|
its README
|
|
147
147
|
|
|
148
|
+
## Who builds this
|
|
149
|
+
|
|
150
|
+
Built and maintained by [Camberi](https://camberi.com?utm_source=firecms&utm_medium=referral&utm_campaign=built-by), a product engineering studio in Madrid and Munich that also builds for clients.
|
|
151
|
+
|
|
148
152
|
## Contact and support
|
|
149
153
|
|
|
150
154
|
If you need general support, you can open a GitHub issue.
|
|
@@ -11,6 +11,11 @@ interface CollectionTableToolbarProps {
|
|
|
11
11
|
onTextSearchClick?: () => void;
|
|
12
12
|
onTextSearch?: (searchString?: string) => void;
|
|
13
13
|
textSearchLoading?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Search term the search bar should start with, typically the one restored from the
|
|
16
|
+
* URL query params by the table controller.
|
|
17
|
+
*/
|
|
18
|
+
initialSearchString?: string;
|
|
14
19
|
}
|
|
15
|
-
export declare function CollectionTableToolbar({ actions, actionsStart, loading, onTextSearch, onTextSearchClick, textSearchLoading, title, viewModeToggle }: CollectionTableToolbarProps): React.JSX.Element;
|
|
20
|
+
export declare function CollectionTableToolbar({ actions, actionsStart, loading, onTextSearch, onTextSearchClick, textSearchLoading, initialSearchString, title, viewModeToggle }: CollectionTableToolbarProps): React.JSX.Element;
|
|
16
21
|
export {};
|
|
@@ -5,6 +5,8 @@ import { OnCellValueChangeParams } from "../../../common";
|
|
|
5
5
|
interface PopupFormFieldProps<M extends Record<string, any>> {
|
|
6
6
|
customFieldValidator?: CustomFieldValidator;
|
|
7
7
|
path: string;
|
|
8
|
+
/** `path` split at its real segment boundaries; forwarded to the datasource. */
|
|
9
|
+
pathSegments?: string[];
|
|
8
10
|
entityId: string;
|
|
9
11
|
tableKey: string;
|
|
10
12
|
propertyKey?: Extract<keyof M, string>;
|
|
@@ -20,7 +22,7 @@ interface PopupFormFieldProps<M extends Record<string, any>> {
|
|
|
20
22
|
onCellValueChange?: (params: OnCellValueChangeParams<any, any>) => Promise<void> | void;
|
|
21
23
|
}
|
|
22
24
|
export declare function PopupFormField<M extends Record<string, any>>(props: PopupFormFieldProps<M>): React.JSX.Element | null;
|
|
23
|
-
export declare function PopupFormFieldLoading<M extends Record<string, any>>({ tableKey, entityId, customFieldValidator, propertyKey, collection: inputCollection, path, cellRect, open, onClose, onCellValueChange, container }: PopupFormFieldProps<M>): React.JSX.Element | null;
|
|
25
|
+
export declare function PopupFormFieldLoading<M extends Record<string, any>>({ tableKey, entityId, customFieldValidator, propertyKey, collection: inputCollection, path, pathSegments, cellRect, open, onClose, onCellValueChange, container }: PopupFormFieldProps<M>): React.JSX.Element | null;
|
|
24
26
|
export declare function PopupFormFieldInternal<M extends Record<string, any>>({ tableKey, entityId, customFieldValidator, propertyKey, collection: inputCollection, path, cellRect, open, onClose, onCellValueChange, container, entity }: PopupFormFieldProps<M> & {
|
|
25
27
|
entity?: Entity<M>;
|
|
26
28
|
}): React.JSX.Element;
|
|
@@ -4,6 +4,8 @@ export type EntityCollectionBoardViewProps<M extends Record<string, any> = any>
|
|
|
4
4
|
collection: EntityCollection<M>;
|
|
5
5
|
tableController: EntityTableController<M>;
|
|
6
6
|
fullPath: string;
|
|
7
|
+
/** `fullPath` split at its real segment boundaries; forwarded to the datasource. */
|
|
8
|
+
pathSegments?: string[];
|
|
7
9
|
parentCollectionIds?: string[];
|
|
8
10
|
columnProperty: string;
|
|
9
11
|
onEntityClick?: (entity: Entity<M>) => void;
|
|
@@ -17,4 +19,4 @@ export type EntityCollectionBoardViewProps<M extends Record<string, any> = any>
|
|
|
17
19
|
/**
|
|
18
20
|
* Kanban board view for displaying entities grouped by a string enum property.
|
|
19
21
|
*/
|
|
20
|
-
export declare function EntityCollectionBoardView<M extends Record<string, any> = any>({ collection, tableController, fullPath, parentCollectionIds, columnProperty, onEntityClick, selectionController, selectionEnabled, highlightedEntities, emptyComponent, deletedEntities }: EntityCollectionBoardViewProps<M>): React.JSX.Element;
|
|
22
|
+
export declare function EntityCollectionBoardView<M extends Record<string, any> = any>({ collection, tableController, fullPath, pathSegments, parentCollectionIds, columnProperty, onEntityClick, selectionController, selectionEnabled, highlightedEntities, emptyComponent, deletedEntities }: EntityCollectionBoardViewProps<M>): React.JSX.Element;
|
|
@@ -13,6 +13,14 @@ export type EntityCollectionViewProps<M extends Record<string, any>> = {
|
|
|
13
13
|
* Full path using navigation ids.
|
|
14
14
|
*/
|
|
15
15
|
fullIdPath?: string;
|
|
16
|
+
/**
|
|
17
|
+
* `fullPath` split at its real segment boundaries, e.g. `["nodes", "node/42", "edges"]`.
|
|
18
|
+
* Forwarded to the datasource so a parent entity id containing "/" stays unambiguous.
|
|
19
|
+
*
|
|
20
|
+
* Optional, and never derived by splitting `fullPath` — a guess would be wrong in
|
|
21
|
+
* exactly the case the field exists for. Absent means "not known here", not "no slashes".
|
|
22
|
+
*/
|
|
23
|
+
pathSegments?: string[];
|
|
16
24
|
/**
|
|
17
25
|
* If this is a subcollection, specify the parent collection ids.
|
|
18
26
|
*/
|
|
@@ -3,6 +3,8 @@ import { EntityCollection, EntityTableController, SelectionController } from "..
|
|
|
3
3
|
export type EntityCollectionViewActionsProps<M extends Record<string, any>> = {
|
|
4
4
|
collection: EntityCollection<M>;
|
|
5
5
|
path: string;
|
|
6
|
+
/** `path` split at its real segment boundaries, when known. Never derived from `path`. */
|
|
7
|
+
pathSegments?: string[];
|
|
6
8
|
relativePath: string;
|
|
7
9
|
parentCollectionIds: string[];
|
|
8
10
|
selectionEnabled: boolean;
|
|
@@ -12,4 +14,4 @@ export type EntityCollectionViewActionsProps<M extends Record<string, any>> = {
|
|
|
12
14
|
tableController: EntityTableController<M>;
|
|
13
15
|
collectionEntitiesCount?: number;
|
|
14
16
|
};
|
|
15
|
-
export declare function EntityCollectionViewActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, onNewClick, onMultipleDeleteClick, selectionEnabled, path, selectionController, tableController, collectionEntitiesCount, }: EntityCollectionViewActionsProps<M>): React.JSX.Element;
|
|
17
|
+
export declare function EntityCollectionViewActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, onNewClick, onMultipleDeleteClick, selectionEnabled, path, pathSegments, selectionController, tableController, collectionEntitiesCount, }: EntityCollectionViewActionsProps<M>): React.JSX.Element;
|
|
@@ -3,6 +3,8 @@ import { EntityCollection, EntityTableController, ResolvedProperty, SelectionCon
|
|
|
3
3
|
export type EntityCollectionViewStartActionsProps<M extends Record<string, any>> = {
|
|
4
4
|
collection: EntityCollection<M>;
|
|
5
5
|
path: string;
|
|
6
|
+
/** `path` split at its real segment boundaries, when known. Never derived from `path`. */
|
|
7
|
+
pathSegments?: string[];
|
|
6
8
|
relativePath: string;
|
|
7
9
|
parentCollectionIds: string[];
|
|
8
10
|
selectionController: SelectionController<M>;
|
|
@@ -13,4 +15,4 @@ export type EntityCollectionViewStartActionsProps<M extends Record<string, any>>
|
|
|
13
15
|
*/
|
|
14
16
|
resolvedProperties?: Record<string, ResolvedProperty>;
|
|
15
17
|
};
|
|
16
|
-
export declare function EntityCollectionViewStartActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, path, selectionController, tableController, collectionEntitiesCount, resolvedProperties }: EntityCollectionViewStartActionsProps<M>): React.JSX.Element;
|
|
18
|
+
export declare function EntityCollectionViewStartActions<M extends Record<string, any>>({ collection, relativePath, parentCollectionIds, path, pathSegments, selectionController, tableController, collectionEntitiesCount, resolvedProperties }: EntityCollectionViewStartActionsProps<M>): React.JSX.Element;
|
|
@@ -38,6 +38,8 @@ export interface BoardDataController<M extends Record<string, any> = any, COLUMN
|
|
|
38
38
|
export interface UseBoardDataControllerProps<M extends Record<string, any> = any> {
|
|
39
39
|
/** Full path to the collection */
|
|
40
40
|
fullPath: string;
|
|
41
|
+
/** `fullPath` split at its real segment boundaries; forwarded to the datasource. */
|
|
42
|
+
pathSegments?: string[];
|
|
41
43
|
/** The entity collection configuration */
|
|
42
44
|
collection: EntityCollection<M>;
|
|
43
45
|
/** Property key used for column assignment */
|
|
@@ -57,4 +59,4 @@ export interface UseBoardDataControllerProps<M extends Record<string, any> = any
|
|
|
57
59
|
* Hook that manages per-column data loading for the Kanban board.
|
|
58
60
|
* Each column gets its own independent query to the data source.
|
|
59
61
|
*/
|
|
60
|
-
export declare function useBoardDataController<M extends Record<string, any> = any, COLUMN extends string = string>({ fullPath, collection, columnProperty, columns, orderProperty, pageSize, searchString, filterValues }: UseBoardDataControllerProps<M>): BoardDataController<M, COLUMN>;
|
|
62
|
+
export declare function useBoardDataController<M extends Record<string, any> = any, COLUMN extends string = string>({ fullPath, pathSegments, collection, columnProperty, columns, orderProperty, pageSize, searchString, filterValues }: UseBoardDataControllerProps<M>): BoardDataController<M, COLUMN>;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React, { ErrorInfo, PropsWithChildren } from "react";
|
|
2
2
|
export declare class ErrorBoundary extends React.Component<PropsWithChildren<Record<string, unknown>>, {
|
|
3
|
-
|
|
4
|
-
error?: Error;
|
|
3
|
+
error: Error | null;
|
|
5
4
|
}> {
|
|
6
5
|
constructor(props: any);
|
|
7
6
|
static getDerivedStateFromError(error: Error): {
|
|
8
|
-
hasError: boolean;
|
|
9
7
|
error: Error;
|
|
10
8
|
};
|
|
11
9
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* @group Components
|
|
4
|
+
*/
|
|
5
|
+
export interface LicenseBannerProps {
|
|
6
|
+
/**
|
|
7
|
+
* Applied to the banner's outer element when there is something to show.
|
|
8
|
+
*/
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Tells the user where their FireCMS PRO license stands: days left in the
|
|
14
|
+
* trial, a paused state, or a license that covers fewer projects than are
|
|
15
|
+
* linked to it. Renders nothing when licensed, when no license is needed, and
|
|
16
|
+
* while the status is unknown.
|
|
17
|
+
*
|
|
18
|
+
* The default `Scaffold` already renders it above the main content. Place it
|
|
19
|
+
* yourself only in a custom layout.
|
|
20
|
+
*
|
|
21
|
+
* @group Components
|
|
22
|
+
*/
|
|
23
|
+
export declare function LicenseBanner({ className, style }: LicenseBannerProps): React.JSX.Element | null;
|
|
@@ -18,6 +18,15 @@ export interface ReferenceSelectionInnerProps<M extends Record<string, any>> {
|
|
|
18
18
|
* dynamic. If not set, the dialog won't open.
|
|
19
19
|
*/
|
|
20
20
|
path: string;
|
|
21
|
+
/**
|
|
22
|
+
* `path` split at its real segment boundaries, when the caller knows them.
|
|
23
|
+
*
|
|
24
|
+
* Left undefined by default and deliberately NOT derived from `path`: a reference
|
|
25
|
+
* path comes from a property's configuration, so there is no entity chain to recover
|
|
26
|
+
* the boundaries from. Splitting it would silently produce the wrong segments for a
|
|
27
|
+
* subcollection under a slash-bearing parent id, which is worse than not answering.
|
|
28
|
+
*/
|
|
29
|
+
pathSegments?: string[];
|
|
21
30
|
/**
|
|
22
31
|
* If you are opening the dialog for the first time, you can select some
|
|
23
32
|
* entity ids to be displayed first.
|
|
@@ -55,4 +64,4 @@ export interface ReferenceSelectionInnerProps<M extends Record<string, any>> {
|
|
|
55
64
|
* You probably want to open this dialog as a side view using {@link useReferenceDialog}
|
|
56
65
|
* @group Components
|
|
57
66
|
*/
|
|
58
|
-
export declare function ReferenceSelectionTable<M extends Record<string, any>>({ onSingleEntitySelected, onMultipleEntitiesSelected, multiselect, collection, path: pathInput, selectedEntityIds: selectedEntityIdsProp, description, forceFilter, maxSelection, }: ReferenceSelectionInnerProps<M>): React.JSX.Element;
|
|
67
|
+
export declare function ReferenceSelectionTable<M extends Record<string, any>>({ onSingleEntitySelected, onMultipleEntitiesSelected, multiselect, collection, path: pathInput, pathSegments, selectedEntityIds: selectedEntityIdsProp, description, forceFilter, maxSelection, }: ReferenceSelectionInnerProps<M>): React.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type FilterTextInputParseResult = {
|
|
2
|
+
/**
|
|
3
|
+
* Whether the filter value should be updated with `value`.
|
|
4
|
+
* It is `false` for intermediate inputs that are not a valid value yet,
|
|
5
|
+
* like "-" or "0.", so that the text typed by the user can be kept as it is
|
|
6
|
+
* while the current filter value is left untouched.
|
|
7
|
+
*/
|
|
8
|
+
updateValue: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Parsed value, only relevant when `updateValue` is `true`.
|
|
11
|
+
* `undefined` means the filter should be cleared.
|
|
12
|
+
*/
|
|
13
|
+
value?: string | number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Turn the raw text of a filter input into the value used by the filter.
|
|
17
|
+
*
|
|
18
|
+
* The text shown to the user is never derived back from the parsed value, so
|
|
19
|
+
* intermediate states like "0.", ".0" or "-" survive while typing. Numbers are
|
|
20
|
+
* only committed to the filter once the text is a complete number, which makes
|
|
21
|
+
* values such as 0.01 reachable by typing them character by character.
|
|
22
|
+
*
|
|
23
|
+
* Note that `0` is a perfectly valid filter value, only an empty input clears
|
|
24
|
+
* the filter.
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseFilterTextInput(text: string, dataType: "string" | "number"): FilterTextInputParseResult;
|
|
27
|
+
/**
|
|
28
|
+
* Text a filter input should display for a given filter value.
|
|
29
|
+
*/
|
|
30
|
+
export declare function filterValueToText(value: unknown): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FilterValues } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* Internal helpers used by `useDataSourceTableController` to persist the state of a
|
|
4
|
+
* collection table (filters, sort and text search) in the URL query string.
|
|
5
|
+
*
|
|
6
|
+
* These functions are intentionally NOT re-exported by the package barrel files:
|
|
7
|
+
* they are pure and live in their own module only so that they can be unit tested.
|
|
8
|
+
* `encodeFilterAndSort` and `parseFilterAndSort` must stay exact inverses of each
|
|
9
|
+
* other, otherwise state written to the URL is silently dropped on reload.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Serialise the state of a collection table into a URL query string,
|
|
13
|
+
* without the leading `?`. Returns an empty string when there is no state to persist.
|
|
14
|
+
*/
|
|
15
|
+
export declare function encodeFilterAndSort(filterValues?: FilterValues<string>, sortBy?: [string, "asc" | "desc"] | undefined, searchString?: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Restore the state of a collection table from a URL query string.
|
|
18
|
+
* The inverse of {@link encodeFilterAndSort}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseFilterAndSort<M>(search: string): {
|
|
21
|
+
filterValues: FilterValues<string> | undefined;
|
|
22
|
+
sortBy?: [Extract<keyof M, string>, "asc" | "desc"];
|
|
23
|
+
searchString?: string;
|
|
24
|
+
};
|
|
@@ -5,6 +5,14 @@ export type DataSourceTableControllerProps<M extends Record<string, any> = any>
|
|
|
5
5
|
* Full path where the data of this table is located
|
|
6
6
|
*/
|
|
7
7
|
fullPath: string;
|
|
8
|
+
/**
|
|
9
|
+
* `fullPath` split at its real segment boundaries. Passed through to the datasource so
|
|
10
|
+
* a parent entity id containing "/" stays unambiguous.
|
|
11
|
+
*
|
|
12
|
+
* Optional, and never derived by splitting `fullPath` — a guess would be wrong in
|
|
13
|
+
* exactly the case the field exists for. Absent means "not known here", not "no slashes".
|
|
14
|
+
*/
|
|
15
|
+
pathSegments?: string[];
|
|
8
16
|
/**
|
|
9
17
|
* The collection that is represented by this config.
|
|
10
18
|
*/
|
|
@@ -40,4 +48,4 @@ export type DataSourceTableControllerProps<M extends Record<string, any> = any>
|
|
|
40
48
|
* @param forceFilterFromProps
|
|
41
49
|
* @param updateUrl
|
|
42
50
|
*/
|
|
43
|
-
export declare function useDataSourceTableController<M extends Record<string, any> = any, USER extends User = User>({ fullPath, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp, forceFilter: forceFilterFromProps, updateUrl }: DataSourceTableControllerProps<M>): EntityTableController<M>;
|
|
51
|
+
export declare function useDataSourceTableController<M extends Record<string, any> = any, USER extends User = User>({ fullPath, pathSegments, collection, scrollRestoration, entitiesDisplayedFirst, lastDeleteTimestamp, forceFilter: forceFilterFromProps, updateUrl }: DataSourceTableControllerProps<M>): EntityTableController<M>;
|
|
@@ -2,9 +2,17 @@ import { EntityCollection } from "../../types";
|
|
|
2
2
|
export interface UseTableSearchHelperParams<M extends Record<string, any>> {
|
|
3
3
|
collection: EntityCollection<M>;
|
|
4
4
|
fullPath: string;
|
|
5
|
+
/** `fullPath` split at its real segment boundaries, when known. Never derived from it. */
|
|
6
|
+
pathSegments?: string[];
|
|
5
7
|
parentCollectionIds?: string[];
|
|
8
|
+
/**
|
|
9
|
+
* Search term that is already being applied without the user having gone through the
|
|
10
|
+
* search bar, e.g. one restored from the URL query params. When set, text search is
|
|
11
|
+
* initialised automatically instead of waiting for a click on the search bar.
|
|
12
|
+
*/
|
|
13
|
+
initialSearchString?: string;
|
|
6
14
|
}
|
|
7
|
-
export declare function useTableSearchHelper<M extends Record<string, any>>({ collection, fullPath, parentCollectionIds }: UseTableSearchHelperParams<M>): {
|
|
15
|
+
export declare function useTableSearchHelper<M extends Record<string, any>>({ collection, fullPath, pathSegments, parentCollectionIds, initialSearchString }: UseTableSearchHelperParams<M>): {
|
|
8
16
|
textSearchLoading: boolean;
|
|
9
17
|
textSearchInitialised: boolean;
|
|
10
18
|
onTextSearchClick: (() => void) | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AccessResponse } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* License status of the enclosing `FireCMS`. `undefined` means there is no
|
|
5
|
+
* `FireCMS` above; `null` means the check has not answered (or was skipped).
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const LicenseStatusContext: React.Context<AccessResponse | null | undefined>;
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare function getLicenseStatusSnapshot(): AccessResponse | null;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare function getServerLicenseStatusSnapshot(): AccessResponse | null;
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare function subscribeLicenseStatus(listener: () => void): () => void;
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare function publishLicenseStatus(status: AccessResponse | null): void;
|
|
@@ -7,6 +7,8 @@ export type OnUpdateParams = {
|
|
|
7
7
|
entity: Entity<any>;
|
|
8
8
|
status: EntityStatus;
|
|
9
9
|
path: string;
|
|
10
|
+
/** `path` split at its real segment boundaries, when known. Never derived from `path`. */
|
|
11
|
+
pathSegments?: string[];
|
|
10
12
|
entityId?: string;
|
|
11
13
|
selectedTab?: string;
|
|
12
14
|
collection: EntityCollection<any>;
|
|
@@ -32,6 +34,12 @@ export interface EntityEditViewProps<M extends Record<string, any>> {
|
|
|
32
34
|
* The navigation path to the entity.
|
|
33
35
|
*/
|
|
34
36
|
fullIdPath?: string;
|
|
37
|
+
/**
|
|
38
|
+
* `path` split at its real segment boundaries, e.g. `["nodes", "node/42", "edges"]`.
|
|
39
|
+
* Forwarded to the datasource, and extended for any subcollection rendered inside this
|
|
40
|
+
* view, so a parent entity id containing "/" stays unambiguous.
|
|
41
|
+
*/
|
|
42
|
+
pathSegments?: string[];
|
|
35
43
|
collection: EntityCollection<M>;
|
|
36
44
|
entityId?: string;
|
|
37
45
|
databaseId?: string;
|
|
@@ -50,7 +58,7 @@ export interface EntityEditViewProps<M extends Record<string, any>> {
|
|
|
50
58
|
* an entity is opened.
|
|
51
59
|
*/
|
|
52
60
|
export declare function EntityEditView<M extends Record<string, any>, USER extends User>({ entityId, ...props }: EntityEditViewProps<M>): React.JSX.Element;
|
|
53
|
-
export declare function EntityEditViewInner<M extends Record<string, any>>({ path, fullIdPath, entityId, selectedTab: selectedTabProp, collection, parentCollectionIds, onValuesModified, onSaved, onTabChange, entity, initialDirtyValues, dataLoading, layout, barActions, status, setStatus, formProps, canEdit }: EntityEditViewProps<M> & {
|
|
61
|
+
export declare function EntityEditViewInner<M extends Record<string, any>>({ path, fullIdPath, pathSegments, entityId, selectedTab: selectedTabProp, collection, parentCollectionIds, onValuesModified, onSaved, onTabChange, entity, initialDirtyValues, dataLoading, layout, barActions, status, setStatus, formProps, canEdit }: EntityEditViewProps<M> & {
|
|
54
62
|
entity?: Entity<M>;
|
|
55
63
|
initialDirtyValues?: Partial<M>;
|
|
56
64
|
dataLoading: boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { EntityFormActionsProps } from "../form/EntityFormActions";
|
|
3
|
-
export declare function EntityEditViewFormActions({ collection, path, entity, layout, savingError, formex, disabled, status, pluginActions, openEntityMode, showDefaultActions, navigateBack, formContext }: EntityFormActionsProps): React.JSX.Element;
|
|
3
|
+
export declare function EntityEditViewFormActions({ collection, path, pathSegments, entity, layout, savingError, formex, disabled, status, pluginActions, openEntityMode, showDefaultActions, navigateBack, formContext }: EntityFormActionsProps): React.JSX.Element;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { i18n } from "i18next";
|
|
2
|
+
import { FireCMSPlugin } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Record of which bundles have already been written to which locale, so the
|
|
5
|
+
* same one is never written twice.
|
|
6
|
+
*
|
|
7
|
+
* Plugin translation objects are module-level constants and a lazily loaded one
|
|
8
|
+
* resolves to the same module object every time, so identity is a sound test.
|
|
9
|
+
*/
|
|
10
|
+
export type AppliedBundles = Map<string, Set<object>>;
|
|
11
|
+
export declare function createAppliedBundles(): AppliedBundles;
|
|
12
|
+
/**
|
|
13
|
+
* Write the plugins' strings for one language into a live i18next instance.
|
|
14
|
+
*
|
|
15
|
+
* Only the language in use is resolved, plus English, which every other language
|
|
16
|
+
* falls back to — a locale given as a function is a bundle that has not been
|
|
17
|
+
* downloaded yet, and downloading all of them would undo the point of deferring
|
|
18
|
+
* them. Plain records are applied for every locale, as before: they are already
|
|
19
|
+
* in the bundle, so there is nothing to save by holding them back.
|
|
20
|
+
*
|
|
21
|
+
* `applied` is what stops the injection feeding itself. A write raises a store
|
|
22
|
+
* event; the event repaints everything subscribed to this instance, including
|
|
23
|
+
* the component that owns the `plugins` array — the collection editor and SaaS
|
|
24
|
+
* plugin hooks both call `useTranslation` — and that array is an inline literal,
|
|
25
|
+
* so its fresh identity re-runs the effect that called this. react-i18next
|
|
26
|
+
* happens to stop re-rendering after one pass, but that is a bail-out rather
|
|
27
|
+
* than a guarantee, and the redundant writes are worth avoiding regardless.
|
|
28
|
+
*
|
|
29
|
+
* Returns a function that reports whether the caller is still mounted, so a
|
|
30
|
+
* bundle that arrives after unmount is dropped rather than written.
|
|
31
|
+
*/
|
|
32
|
+
export declare function applyPluginTranslations({ i18n, plugins, language, applied, isActive }: {
|
|
33
|
+
i18n: i18n;
|
|
34
|
+
plugins?: FireCMSPlugin<any, any, any>[];
|
|
35
|
+
language: string;
|
|
36
|
+
applied: AppliedBundles;
|
|
37
|
+
isActive?: () => boolean;
|
|
38
|
+
}): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AccessResponse, FireCMSPlugin } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Keys of the plugins that need a FireCMS PRO license.
|
|
4
|
+
*
|
|
5
|
+
* Kept in sync by hand with `PRO_PLUGIN_KEYS` in
|
|
6
|
+
* `saas_backend/functions/src/business_rules/licenses.ts`, which decides from
|
|
7
|
+
* the same list whether a project needs a license. Change both together.
|
|
8
|
+
*
|
|
9
|
+
* @group Core
|
|
10
|
+
*/
|
|
11
|
+
export declare const PRO_PLUGIN_KEYS: readonly string[];
|
|
12
|
+
/**
|
|
13
|
+
* Whether PRO features are paused for this license status. Any `blocked`
|
|
14
|
+
* response pauses them, whatever its `licenseState` (`expired` and
|
|
15
|
+
* `invalid_project` both come with it). An unknown status pauses nothing.
|
|
16
|
+
*
|
|
17
|
+
* @group Core
|
|
18
|
+
*/
|
|
19
|
+
export declare function isProPaused(licenseStatus?: AccessResponse | null): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether this plugin is dropped while PRO is paused.
|
|
22
|
+
*
|
|
23
|
+
* @group Core
|
|
24
|
+
*/
|
|
25
|
+
export declare function isPausedPlugin(plugin: Pick<FireCMSPlugin, "key">): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Where to get or fix the license for this status: the server's
|
|
28
|
+
* `subscribeUrl` when it is an https URL, otherwise the license page on
|
|
29
|
+
* app.firecms.co with the project, when known.
|
|
30
|
+
*
|
|
31
|
+
* @group Core
|
|
32
|
+
*/
|
|
33
|
+
export declare function getLicenseSubscribeUrl(licenseStatus?: AccessResponse | null): string;
|
|
34
|
+
/**
|
|
35
|
+
* The plugins that stay active under this license status. Returns the same
|
|
36
|
+
* array when nothing is dropped, so it can feed memo and effect dependencies.
|
|
37
|
+
*
|
|
38
|
+
* @group Core
|
|
39
|
+
*/
|
|
40
|
+
export declare function filterPausedPlugins<P extends Pick<FireCMSPlugin, "key">>(plugins: P[] | undefined, licenseStatus?: AccessResponse | null): P[] | undefined;
|