@compill/admin 1.0.25

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.
Files changed (66) hide show
  1. package/index.d.ts +44 -0
  2. package/index.js +248 -0
  3. package/index.mjs +42211 -0
  4. package/index.umd.js +248 -0
  5. package/lib/SectionTitle.d.ts +3 -0
  6. package/lib/breadcrumbs/BreadCrumbs.d.ts +9 -0
  7. package/lib/buttons/DialogButton.d.ts +7 -0
  8. package/lib/buttons/IconButton.d.ts +5 -0
  9. package/lib/buttons/InvalidateButton.d.ts +7 -0
  10. package/lib/buttons/NavigateButton.d.ts +5 -0
  11. package/lib/buttons/PublishButton.d.ts +10 -0
  12. package/lib/buttons/UpdateButton.d.ts +3 -0
  13. package/lib/buttons/ViewButton.d.ts +6 -0
  14. package/lib/cells/OrderCell.d.ts +12 -0
  15. package/lib/json/DetailsView.d.ts +6 -0
  16. package/lib/json/EditItemView.d.ts +3 -0
  17. package/lib/json/MultiQueryWrapper.d.ts +6 -0
  18. package/lib/json/QueryWrapper.d.ts +7 -0
  19. package/lib/json/ScreenRenderer.d.ts +7 -0
  20. package/lib/json/ScreenTopBar.d.ts +15 -0
  21. package/lib/json/TabbedView.d.ts +4 -0
  22. package/lib/json/dialog/DialogRenderer.d.ts +12 -0
  23. package/lib/json/dialog/ItemDeleteDialog.d.ts +11 -0
  24. package/lib/json/dialog/ItemEditDialog.d.ts +32 -0
  25. package/lib/json/dialog/MultiQueryWrapperDialog.d.ts +8 -0
  26. package/lib/json/dialog/QueryWrapperDialog.d.ts +14 -0
  27. package/lib/json/table/TableRowActionsView.d.ts +12 -0
  28. package/lib/json/table/TableRowPublishPostButton.d.ts +9 -0
  29. package/lib/json/table/TableView.d.ts +4 -0
  30. package/lib/json/table/TableViewContext.d.ts +16 -0
  31. package/lib/json/table/useTableProps.d.ts +3 -0
  32. package/lib/json/types/DetailsView.d.ts +51 -0
  33. package/lib/json/types/EditItemDialog.d.ts +4 -0
  34. package/lib/json/types/MultiQueryWrapper.d.ts +18 -0
  35. package/lib/json/types/MultiQueryWrapperDialog.d.ts +13 -0
  36. package/lib/json/types/QueryWrapper.d.ts +27 -0
  37. package/lib/json/types/QueryWrapperDialog.d.ts +22 -0
  38. package/lib/json/types/ScreenConfig.d.ts +8 -0
  39. package/lib/json/types/TabbedView.d.ts +23 -0
  40. package/lib/json/types/TableView.d.ts +77 -0
  41. package/lib/modal/AttachDialog.d.ts +31 -0
  42. package/lib/modal/FormActionDialog.d.ts +23 -0
  43. package/lib/modal/ItemEditDialog.d.ts +33 -0
  44. package/lib/page/PageContainer.d.ts +3 -0
  45. package/lib/page/PageContentEditor.d.ts +5 -0
  46. package/lib/page/PageMain.d.ts +3 -0
  47. package/lib/page/PageQueryStateContainer.d.ts +12 -0
  48. package/lib/page/PageSectionTitle.d.ts +3 -0
  49. package/lib/page/PageSidebar.d.ts +3 -0
  50. package/lib/page/PageSidebarSection.d.ts +5 -0
  51. package/lib/page/PageStateContainer.d.ts +7 -0
  52. package/lib/page/PageSubSectionTitle.d.ts +3 -0
  53. package/lib/page/PageTitle.d.ts +3 -0
  54. package/lib/page/PageTopBar.d.ts +13 -0
  55. package/lib/status/StatusBadge.d.ts +5 -0
  56. package/lib/table/TableContainer.d.ts +3 -0
  57. package/lib/table/TableCreateButton.d.ts +3 -0
  58. package/lib/table/TableFilterButton.d.ts +3 -0
  59. package/lib/table/TableRowActionBar.d.ts +11 -0
  60. package/lib/table/TableRowDeleteButton.d.ts +3 -0
  61. package/lib/table/TableRowEditButton.d.ts +3 -0
  62. package/lib/table/TableRowNavigateButton.d.ts +5 -0
  63. package/lib/table/TableRowPublishPostButton.d.ts +9 -0
  64. package/lib/table/TableRowViewButton.d.ts +5 -0
  65. package/lib/table/TableTopBar.d.ts +8 -0
  66. package/package.json +13 -0
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ParentComponent, SoperioComponent } from "@soperio/react";
3
+ export declare function SectionTitle({ children, ...props }: SoperioComponent & ParentComponent): JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { SoperioComponent } from "@soperio/react";
3
+ export interface Breadcrumb {
4
+ label: string;
5
+ path?: string;
6
+ }
7
+ export declare function Breadcrumbs({ breadcrumbs, ...props }: {
8
+ breadcrumbs: Breadcrumb[];
9
+ } & SoperioComponent): JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { ParentComponent, SoperioComponent } from "@soperio/react";
2
+ import { ButtonProps } from "@valerya/ui";
3
+ import React from "react";
4
+ export interface DialogButtonProps extends SoperioComponent, ParentComponent, ButtonProps {
5
+ buildDialog: (onClose: () => void) => React.ReactNode;
6
+ }
7
+ export declare function DialogButton({ buildDialog, ...props }: DialogButtonProps): JSX.Element;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from "@valerya/ui";
3
+ export declare function IconButton({ icon, ...props }: {
4
+ icon: string;
5
+ } & ButtonProps): JSX.Element;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from "@valerya/ui";
3
+ interface InvalidateButtonProps extends ButtonProps {
4
+ pathOrPermalink: string;
5
+ }
6
+ export declare function InvalidateButton({ pathOrPermalink, ...props }: InvalidateButtonProps): JSX.Element;
7
+ export {};
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from "@valerya/ui";
3
+ export declare function NavigateButton({ path, ...props }: {
4
+ path: string;
5
+ } & ButtonProps): JSX.Element;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { API } from '../../../../admin-api/src/index.ts';
3
+ import { ButtonProps } from "@valerya/ui";
4
+ interface PublishButtonProps extends ButtonProps {
5
+ status: string;
6
+ queryId: string;
7
+ api: API<any>;
8
+ }
9
+ export declare function PublishButton({ status, queryId, api, ...props }: PublishButtonProps): JSX.Element;
10
+ export {};
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from "@valerya/ui";
3
+ export declare function UpdateButton({ ...props }: ButtonProps): JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from "@valerya/ui";
3
+ export declare function ViewButton({ path, icon, ...props }: {
4
+ path: string;
5
+ icon?: string;
6
+ } & ButtonProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ interface OrderApi {
3
+ moveUp: (id: string) => Promise<any>;
4
+ moveDown: (id: string) => Promise<any>;
5
+ queryKey: string[];
6
+ }
7
+ export declare function OrderCell({ api, postId, order }: {
8
+ api: OrderApi;
9
+ postId: string;
10
+ order: number;
11
+ }): JSX.Element;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { SoperioComponent } from "@soperio/react";
3
+ import { DetailsViewConfig } from "./types/DetailsView";
4
+ export declare function DetailsView({ queryField, api, processInput, screen, tabbed, ...props }: DetailsViewConfig & {
5
+ tabbed?: boolean;
6
+ } & SoperioComponent): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ItemEditDialogProps } from "./dialog/ItemEditDialog";
3
+ export declare function EditItemView({ initialValues, ...props }: Omit<ItemEditDialogProps, "show">): JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { MultiQueryWrapperConfig } from "./types/MultiQueryWrapper";
3
+ import { SoperioComponent } from "@soperio/react";
4
+ export declare function MultiQueryWrapper({ queries, config, tabbed, ...props }: Omit<MultiQueryWrapperConfig, "type"> & {
5
+ tabbed?: boolean;
6
+ } & SoperioComponent): JSX.Element;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { QueryWrapperConfig } from "./types/QueryWrapper";
3
+ import { SoperioComponent } from "@soperio/react";
4
+ import { CRUD_MODEL } from '../../../../api/src/index.ts';
5
+ export declare function QueryWrapper<T extends CRUD_MODEL, U>({ api, queryField, fn, transformFn, config, tabbed, ...props }: Omit<QueryWrapperConfig<T, U>, "type"> & {
6
+ tabbed?: boolean;
7
+ } & SoperioComponent): JSX.Element | null;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { ScreenConfig } from "./types/ScreenConfig";
3
+ import { SoperioComponent } from "@soperio/react";
4
+ export declare function ScreenRenderer({ config, tabbed, ...props }: {
5
+ config: ScreenConfig;
6
+ tabbed?: boolean;
7
+ } & SoperioComponent): JSX.Element;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { API } from '../../../../admin-api/src/index.ts';
3
+ import { Breadcrumb } from "../breadcrumbs/BreadCrumbs";
4
+ import { DetailViewButton } from "./types/DetailsView";
5
+ interface ScreenTopBarProps {
6
+ tabbed?: boolean;
7
+ breadcrumbs?: Breadcrumb[];
8
+ buttonBar?: DetailViewButton[];
9
+ api: API<any>;
10
+ item: any;
11
+ isLoading: boolean;
12
+ trackingRef?: Element | null;
13
+ }
14
+ export declare function ScreenTopBar({ tabbed, breadcrumbs, api, item, isLoading, buttonBar, trackingRef }: ScreenTopBarProps): JSX.Element;
15
+ export {};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TabbedViewConfig } from "./types/TabbedView";
3
+ import { SoperioComponent } from "@soperio/react";
4
+ export declare function TabbedView({ queryField, api, screen, ...props }: TabbedViewConfig & SoperioComponent): JSX.Element;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { EditItemDialogConfig } from "../types/EditItemDialog";
3
+ import { QueryWrapperDialogConfig } from "../types/QueryWrapperDialog";
4
+ import { MultiQueryWrapperDialogConfig } from "../types/MultiQueryWrapperDialog";
5
+ interface DialogRendererProps {
6
+ config: EditItemDialogConfig | QueryWrapperDialogConfig<any> | MultiQueryWrapperDialogConfig;
7
+ onClose: () => void;
8
+ invalidateQueryKey?: string[];
9
+ queryId?: string;
10
+ }
11
+ export declare function DialogRenderer({ config, onClose, invalidateQueryKey, queryId }: DialogRendererProps): JSX.Element | null;
12
+ export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { CRUDAPI } from '../../../../../api/src/index.ts';
3
+ import { ModalProps } from "@valerya/ui";
4
+ export interface ItemDeleteDialogProps extends ModalProps {
5
+ itemLabel: string;
6
+ queryId: string;
7
+ api: CRUDAPI<any>;
8
+ invalidateQueriesOnSuccess?: boolean;
9
+ invalidateQueryKey?: string[];
10
+ }
11
+ export declare function ItemDeleteDialog({ itemLabel, queryId, api, invalidateQueriesOnSuccess, invalidateQueryKey, size, show, onClose, ...props }: ItemDeleteDialogProps): JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { CRUDAPI } from '../../../../../api/src/index.ts';
2
+ import { FormRendererConfig } from '../../../../../form/src/index.ts';
3
+ import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
4
+ import { ModalProps } from "@valerya/ui";
5
+ import { FormikConfig } from "formik";
6
+ import React from "react";
7
+ export interface ItemEditDialogProps<TFormData extends {} = any, TResultData extends {} = any> extends Omit<ModalProps, "id" | "children" | "title" | "position"> {
8
+ itemLabel?: string;
9
+ queryId?: string;
10
+ api: CRUDAPI<any>;
11
+ initialValues?: any;
12
+ queryFetchOptions?: UseQueryOptions;
13
+ querySaveOptions?: UseMutationOptions<TResultData, unknown, TFormData>;
14
+ onSuccess?: (item: TResultData, response: any) => void;
15
+ onFetchError?: () => void;
16
+ fetchErrorMsg?: string;
17
+ onSaveError?: (item: TFormData) => void;
18
+ saveErrorMsg?: string;
19
+ fetchToFormData?: (item: TResultData) => TFormData;
20
+ formToQueryData?: (TFormData: any) => Partial<TResultData>;
21
+ invalidateQueriesOnSuccess?: boolean;
22
+ invalidateQueryKey?: string[];
23
+ retryText?: string;
24
+ cancelLabel?: string;
25
+ saveLabel?: string;
26
+ title?: ((item?: TResultData) => string);
27
+ formikProps: Omit<FormikConfig<any>, "initialValues" | "onSubmit">;
28
+ form: React.ReactNode | FormRendererConfig | ((item: TResultData) => FormRendererConfig);
29
+ show: boolean;
30
+ onClose: () => void;
31
+ }
32
+ export declare function ItemEditDialog<TFormData extends {}, TResultData extends {}>({ initialValues, itemLabel, queryId, api, queryFetchOptions, querySaveOptions, onSuccess, onFetchError, fetchErrorMsg, onSaveError, saveErrorMsg, fetchToFormData, formToQueryData, invalidateQueriesOnSuccess, invalidateQueryKey, retryText, cancelLabel, saveLabel, size, title, form, show, onClose, formikProps, ...props }: ItemEditDialogProps<TFormData, TResultData>): JSX.Element;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { MultiQueryWrapperDialogConfig } from "../types/MultiQueryWrapperDialog";
3
+ export type MultiQueryWrapperDialogProps = Omit<MultiQueryWrapperDialogConfig, "type"> & {
4
+ queryId?: string;
5
+ onClose: () => void;
6
+ invalidateQueryKey?: string[];
7
+ };
8
+ export declare function MultiQueryWrapperDialog({ queries, config, onClose, queryId, invalidateQueryKey }: MultiQueryWrapperDialogProps): JSX.Element;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { CRUDAPI, CRUD_MODEL } from '../../../../../api/src/index.ts';
3
+ import { QueryWrapperDialogConfig } from "../types/QueryWrapperDialog";
4
+ import { EditItemDialogConfig } from "../types/EditItemDialog";
5
+ export type QueryWrapperDialogProps<T extends CRUD_MODEL, U> = Omit<QueryWrapperDialogConfig<T, U>, "type"> & {
6
+ api: CRUDAPI<any>;
7
+ fn: "get" | "getTransformed" | "getAll" | "getAllTransformed";
8
+ transformFn?: (data: T) => U;
9
+ config: (data?: T | U) => Omit<EditItemDialogConfig, "type">;
10
+ onClose: () => void;
11
+ queryId?: string;
12
+ invalidateQueryKey?: string[];
13
+ };
14
+ export declare function QueryWrapperDialog<T extends CRUD_MODEL, U>({ api, fn, transformFn, config, onClose, queryId, invalidateQueryKey }: QueryWrapperDialogProps<T, U>): JSX.Element | null;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { TableRowAction } from "../types/TableView";
3
+ import { API } from '../../../../../admin-api/src/index.ts';
4
+ interface TableRowActionViewProps {
5
+ row: any;
6
+ onAction: (action: TableRowAction, item: any) => void;
7
+ rowActions?: TableRowAction[];
8
+ api: API<any>;
9
+ queryKey: string[];
10
+ }
11
+ export declare function TableRowActionsView({ row, onAction, rowActions, api, queryKey }: TableRowActionViewProps): JSX.Element;
12
+ export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from "@valerya/ui";
3
+ import { API } from '../../../../../admin-api/src/index.ts';
4
+ export declare function TableRowPublishPostButton({ id, api, status, invalidateQueryKey, ...props }: {
5
+ id: string;
6
+ api: API<any>;
7
+ status: "draft" | "published";
8
+ invalidateQueryKey?: string[];
9
+ } & ButtonProps): JSX.Element;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { SoperioComponent } from "@soperio/react";
3
+ import { TableViewConfig } from "../types/TableView";
4
+ export declare function TableView({ title, queryField, screen, ...props }: TableViewConfig & SoperioComponent): JSX.Element;
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import { CustomDialog, TableRowAction, TableViewDeleteItem } from "../types/TableView";
3
+ import { EditItemDialogConfig } from "../types/EditItemDialog";
4
+ import { QueryWrapperDialogConfig } from "../types/QueryWrapperDialog";
5
+ type TableViewContextProps = {
6
+ onAction: (action: TableRowAction, item: any) => void;
7
+ dialog?: React.ReactNode;
8
+ };
9
+ declare const useContext: () => TableViewContextProps;
10
+ export interface TableViewProviderProps extends React.PropsWithChildren {
11
+ queryKey: string[];
12
+ editView?: CustomDialog | EditItemDialogConfig | QueryWrapperDialogConfig<any>;
13
+ deleteItem?: TableViewDeleteItem;
14
+ }
15
+ declare function TableViewProvider({ editView, deleteItem, queryKey, children }: TableViewProviderProps): JSX.Element;
16
+ export { TableViewProvider, useContext as useTableViewContext };
@@ -0,0 +1,3 @@
1
+ import { TableRowAction, TableViewTable } from "../types/TableView";
2
+ import { API } from '../../../../../admin-api/src/index.ts';
3
+ export declare function useTableProps(api: API<any>, table: TableViewTable, rowActions?: TableRowAction[]): any;
@@ -0,0 +1,51 @@
1
+ /// <reference types="react" />
2
+ import { API } from '../../../../../admin-api/src/index.ts';
3
+ import * as Yup from "yup";
4
+ import { Breadcrumb } from "../../breadcrumbs/BreadCrumbs";
5
+ import { FormRendererConfig } from '../../../../../form/src/index.ts';
6
+ export type DetailsViewConfig<T = any> = {
7
+ type: "details";
8
+ api: API<T>;
9
+ queryField: string;
10
+ processInput?: (input: T) => any;
11
+ screen: Screen | ((data: T) => Screen);
12
+ };
13
+ type Screen = {
14
+ invalidateParentQueryKey?: string[];
15
+ breadcrumbs?: Breadcrumb[];
16
+ initialValues: any | ((data: any) => any);
17
+ schema: Yup.Schema;
18
+ header?: React.ReactNode;
19
+ sections?: DetailSection[];
20
+ buttonBar?: DetailViewButton[];
21
+ editor?: DetailEditor;
22
+ editorFooter?: React.ReactNode;
23
+ type?: "post" | "section";
24
+ };
25
+ type DetailEditor = {
26
+ type?: "blockEditor";
27
+ name: string;
28
+ } | {
29
+ type?: "textarea";
30
+ name: string;
31
+ };
32
+ export type DetailSection = {
33
+ type: "section";
34
+ title: string;
35
+ form: FormRendererConfig | ((item: any) => FormRendererConfig);
36
+ } | {
37
+ type: "custom";
38
+ component: ((item: any) => React.ReactNode);
39
+ };
40
+ export type DetailViewButton = {
41
+ type: "invalidate";
42
+ pathOrPermalink: string;
43
+ } | {
44
+ type: "link";
45
+ path: string;
46
+ icon?: string;
47
+ } | {
48
+ type: "custom";
49
+ render: (item: any) => React.ReactNode;
50
+ };
51
+ export {};
@@ -0,0 +1,4 @@
1
+ import { ItemEditDialogProps } from "../dialog/ItemEditDialog";
2
+ export type EditItemDialogConfig = Omit<ItemEditDialogProps, "show" | "onClose"> & {
3
+ type: "dialog";
4
+ };
@@ -0,0 +1,18 @@
1
+ import { CRUDAPI } from '../../../../../api/src/index.ts';
2
+ import { DetailsViewConfig } from "./DetailsView";
3
+ import { TabbedViewConfig } from "./TabbedView";
4
+ import { TableViewConfig } from "./TableView";
5
+ type SubScreen = TableViewConfig | DetailsViewConfig | TabbedViewConfig;
6
+ export type QueryDef = {
7
+ api: CRUDAPI<any> | ((id: string) => CRUDAPI<any>);
8
+ fn: "get" | "getAll";
9
+ queryField?: string;
10
+ transformFn?: (data: any) => any;
11
+ params?: any;
12
+ };
13
+ export type MultiQueryWrapperConfig = {
14
+ type: "multiQuery";
15
+ queries: QueryDef[];
16
+ config: (...data: any[]) => SubScreen;
17
+ };
18
+ export {};
@@ -0,0 +1,13 @@
1
+ import { CRUDAPI } from '../../../../../api/src/index.ts';
2
+ import { EditItemDialogConfig } from "./EditItemDialog";
3
+ export type QueryDef = {
4
+ api: CRUDAPI<any>;
5
+ fn: "get" | "getAll";
6
+ transformFn?: (data: any) => any;
7
+ cache?: boolean;
8
+ };
9
+ export type MultiQueryWrapperDialogConfig = {
10
+ type: "multiQuery";
11
+ queries: QueryDef[];
12
+ config: (...data: any[]) => Omit<EditItemDialogConfig, "type">;
13
+ };
@@ -0,0 +1,27 @@
1
+ import { CRUDAPI, CRUD_MODEL } from '../../../../../api/src/index.ts';
2
+ import { DetailsViewConfig } from "./DetailsView";
3
+ import { TabbedViewConfig } from "./TabbedView";
4
+ import { TableViewConfig } from "./TableView";
5
+ type SubScreen<T extends CRUD_MODEL, U> = TableViewConfig | DetailsViewConfig | TabbedViewConfig | QueryWrapperConfig<T, U>;
6
+ export type QueryWrapperConfig<T extends CRUD_MODEL, U = T> = {
7
+ type: "query";
8
+ api: CRUDAPI<T> | ((id: string | number) => CRUDAPI<T>);
9
+ queryField?: string;
10
+ } & ({
11
+ fn: "get";
12
+ transformFn?: undefined;
13
+ config: (data: T) => SubScreen<T, U>;
14
+ } | {
15
+ fn: "getTransformed";
16
+ transformFn: (data: T) => U;
17
+ config: (data: U) => SubScreen<T, U>;
18
+ } | {
19
+ fn: "getAll";
20
+ transformFn?: undefined;
21
+ config: (data: T[]) => SubScreen<T, U>;
22
+ } | {
23
+ fn: "getAllTransformed";
24
+ transformFn: (data: T[]) => U;
25
+ config: (data: U) => SubScreen<T, U>;
26
+ });
27
+ export {};
@@ -0,0 +1,22 @@
1
+ import { CRUDAPI, CRUD_MODEL } from '../../../../../api/src/index.ts';
2
+ import { EditItemDialogConfig } from "./EditItemDialog";
3
+ export type QueryWrapperDialogConfig<T extends CRUD_MODEL, U = T> = {
4
+ type: "query";
5
+ api: CRUDAPI<any>;
6
+ } & ({
7
+ fn: "get";
8
+ transformFn?: undefined;
9
+ config: (data: T) => Omit<EditItemDialogConfig, "type">;
10
+ } | {
11
+ fn: "getTransformed";
12
+ transformFn: (data: T) => U;
13
+ config: (data: U) => Omit<EditItemDialogConfig, "type">;
14
+ } | {
15
+ fn: "getAll";
16
+ transformFn?: undefined;
17
+ config: (data: T[]) => Omit<EditItemDialogConfig, "type">;
18
+ } | {
19
+ fn: "getAllTransformed";
20
+ transformFn: (data: T[]) => U;
21
+ config: (data: U) => Omit<EditItemDialogConfig, "type">;
22
+ });
@@ -0,0 +1,8 @@
1
+ import { ItemEditDialogProps } from "../dialog/ItemEditDialog";
2
+ import { DetailsViewConfig } from "./DetailsView";
3
+ import { MultiQueryWrapperConfig } from "./MultiQueryWrapper";
4
+ import { QueryWrapperConfig } from "./QueryWrapper";
5
+ import { TabbedViewConfig } from "./TabbedView";
6
+ import { TableViewConfig } from "./TableView";
7
+ export type ScreenConfig = TableViewConfig | DetailsViewConfig | TabbedViewConfig | QueryWrapperConfig<any, any> | MultiQueryWrapperConfig;
8
+ export type TableViewEditItem = Omit<ItemEditDialogProps, "show" | "onClose">;
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import { CRUDAPI } from '../../../../../api/src/index.ts';
3
+ import { Breadcrumb } from "../../breadcrumbs/BreadCrumbs";
4
+ import { DetailsViewConfig } from "./DetailsView";
5
+ import { QueryWrapperConfig } from "./QueryWrapper";
6
+ import { TableViewConfig } from "./TableView";
7
+ import { MultiQueryWrapperConfig } from "./MultiQueryWrapper";
8
+ export type TabbedViewConfig<T extends any = any> = {
9
+ type: "tabbed";
10
+ queryField: string;
11
+ api: CRUDAPI<any>;
12
+ screen: Screen | ((data: T) => Screen);
13
+ };
14
+ type Screen = {
15
+ breadcrumbs: Breadcrumb[];
16
+ tabs: Tab[];
17
+ };
18
+ export type Tab = {
19
+ label: string;
20
+ config?: TableViewConfig | DetailsViewConfig | QueryWrapperConfig<any> | MultiQueryWrapperConfig | TabbedViewConfig;
21
+ component?: () => React.ReactNode;
22
+ };
23
+ export {};
@@ -0,0 +1,77 @@
1
+ /// <reference types="react" />
2
+ import { API } from '../../../../../admin-api/src/index.ts';
3
+ import { FormRendererConfig } from '../../../../../form/src/index.ts';
4
+ import { TableProps } from '../../../../../table/src/index.ts';
5
+ import { ModalProps } from "@valerya/ui";
6
+ import { Breadcrumb } from "../../breadcrumbs/BreadCrumbs";
7
+ import { ItemDeleteDialogProps } from "../dialog/ItemDeleteDialog";
8
+ import { EditItemDialogConfig } from "./EditItemDialog";
9
+ import { QueryWrapperDialogConfig } from "./QueryWrapperDialog";
10
+ type Screen = {
11
+ api: API<any>;
12
+ breadcrumbs?: Breadcrumb[];
13
+ buttonBar?: TableViewButtonConfig[];
14
+ filters?: TableFilters;
15
+ massActions?: TableMassActions;
16
+ editView?: TableViewEditView;
17
+ deleteItem?: TableViewDeleteItem;
18
+ table: TableViewTable;
19
+ rowActions?: TableRowAction[];
20
+ };
21
+ export type TableViewConfig = {
22
+ type: "table";
23
+ title: string;
24
+ queryField?: string;
25
+ screen: Screen | ((id: string) => Screen);
26
+ };
27
+ export type CustomDialog = {
28
+ type: "customDialog";
29
+ render: (props: ModalProps) => React.ReactNode;
30
+ };
31
+ export type TableViewEditView = CustomDialog | EditItemDialogConfig | QueryWrapperDialogConfig<any>;
32
+ export type TableViewTable = Omit<TableProps, "onRowClick" | "queryKey" | "queryFn"> & {
33
+ onRowClick?: {
34
+ type: "navigate";
35
+ path: string | ((item: any) => string);
36
+ } | {
37
+ type: "link";
38
+ path: string | ((item: any) => string);
39
+ };
40
+ };
41
+ export type TableViewDeleteItem = Omit<ItemDeleteDialogProps, "show" | "onClose" | "itemLabel" | "queryId"> & {
42
+ itemLabel: string | ((item: any) => string);
43
+ };
44
+ export type TableRowAction = {
45
+ type: "link";
46
+ path: string | ((item: any) => string);
47
+ } | {
48
+ type: "view";
49
+ path: string | ((item: any) => string);
50
+ } | {
51
+ type: "edit";
52
+ } | {
53
+ type: "delete";
54
+ } | {
55
+ type: "publish";
56
+ } | {
57
+ type: "custom";
58
+ component: (item: any, queryKey: string[], icon?: string, label?: string) => React.ReactNode;
59
+ icon?: string;
60
+ label?: string;
61
+ };
62
+ export type TableViewButtonBar = TableViewButtonConfig[];
63
+ type TableViewButtonConfig = {
64
+ type: "create";
65
+ } | {
66
+ type: "invalidate";
67
+ pathOrPermalink: string;
68
+ } | {
69
+ type: "custom";
70
+ render: () => React.ReactNode;
71
+ };
72
+ type TableFilters = {
73
+ form: FormRendererConfig;
74
+ initialValues: any | ((data: any) => any);
75
+ };
76
+ type TableMassActions = {};
77
+ export {};
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ import { QueryFunctionContext } from "@tanstack/react-query";
3
+ import { ModalProps } from "@valerya/ui";
4
+ import { FormikConfig } from "formik";
5
+ interface AttachDialogProps<T> extends Omit<ModalProps, "id" | "children" | "title" | "position"> {
6
+ queryId?: string;
7
+ queryKey: string[];
8
+ queryFetchFn: (context: QueryFunctionContext) => Promise<T>;
9
+ queryFetchAllFn: (context: QueryFunctionContext) => Promise<T>;
10
+ queryFetchAllKey: string[];
11
+ querySaveFn: ({ resources }: {
12
+ resources: string[];
13
+ }) => Promise<any>;
14
+ matchKey: string;
15
+ show: boolean;
16
+ onClose: () => void;
17
+ itemLabel?: string;
18
+ onSuccess?: (response: any) => void;
19
+ onFetchError?: () => void;
20
+ fetchErrorMsg?: string;
21
+ onSaveError?: () => void;
22
+ saveErrorMsg?: string;
23
+ invalidateQueriesOnSuccess?: boolean;
24
+ retryText?: string;
25
+ cancelLabel?: string;
26
+ saveLabel?: string;
27
+ formikProps?: Omit<FormikConfig<any>, "initialValues" | "onSubmit">;
28
+ getItemName?: (item: any) => string;
29
+ }
30
+ export declare function AttachDialog({ queryId, queryKey, queryFetchFn, queryFetchAllKey, queryFetchAllFn, querySaveFn, matchKey, size, show, onClose, itemLabel, onSuccess, onFetchError, fetchErrorMsg, onSaveError, saveErrorMsg, invalidateQueriesOnSuccess, retryText, cancelLabel, saveLabel, formikProps, getItemName, ...props }: AttachDialogProps<any>): JSX.Element;
31
+ export {};
@@ -0,0 +1,23 @@
1
+ import { UseMutateOptions } from '../../../../api/src/index.ts';
2
+ import { FormRendererConfig } from '../../../../form/src/index.ts';
3
+ import { UseMutationOptions } from "@tanstack/react-query";
4
+ import { ModalProps } from "@valerya/ui";
5
+ import { FormikConfig } from "formik";
6
+ import React from "react";
7
+ export interface FormActionDialogProps<TFormData extends {} = any, TResultData extends {} = any> extends Omit<ModalProps, "id" | "children" | "title" | "position" | "onError">, UseMutateOptions<TResultData, TFormData> {
8
+ itemLabel?: string;
9
+ queryId?: string;
10
+ queryKey: string[];
11
+ initialValues: any;
12
+ queryFn: (item: TFormData) => Promise<TResultData>;
13
+ queryOptions?: UseMutationOptions<TResultData, unknown, TFormData>;
14
+ invalidateQueriesOnSuccess?: boolean;
15
+ cancelLabel?: string;
16
+ saveLabel?: string;
17
+ title: string;
18
+ formikProps?: Omit<FormikConfig<TFormData>, "initialValues" | "onSubmit">;
19
+ form: React.ReactNode | FormRendererConfig;
20
+ show: boolean;
21
+ onClose: () => void;
22
+ }
23
+ export declare function FormActionDialog<TFormData extends {}, TResultData extends {}>({ initialValues, itemLabel, queryId, queryKey, queryFn, queryOptions, onSuccess, successMsg, showSuccessMsg, onError, errorMsg, showErrorMsg, processInput, invalidateQueriesOnSuccess, cancelLabel, saveLabel, size, title, form, show, onClose, formikProps, ...props }: FormActionDialogProps<TFormData, TResultData>): JSX.Element;
@@ -0,0 +1,33 @@
1
+ import { FormRendererConfig } from '../../../../form/src/index.ts';
2
+ import { UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
3
+ import { ModalProps } from "@valerya/ui";
4
+ import { FormikConfig } from "formik";
5
+ import React from "react";
6
+ export interface ItemEditDialogProps<TFormData extends {} = any, TResultData extends {} = any> extends Omit<ModalProps, "id" | "children" | "title" | "position"> {
7
+ itemLabel?: string;
8
+ queryId?: string;
9
+ queryKey: string[];
10
+ initialValues?: any;
11
+ queryFetchFn: (...args: any[]) => Promise<TResultData>;
12
+ queryFetchOptions?: UseQueryOptions;
13
+ querySaveFn: (item: TFormData) => Promise<TResultData>;
14
+ querySaveOptions?: UseMutationOptions<TResultData, unknown, TFormData>;
15
+ onSuccess?: (item: TResultData, response: any) => void;
16
+ onFetchError?: () => void;
17
+ fetchErrorMsg?: string;
18
+ onSaveError?: (item: TFormData) => void;
19
+ saveErrorMsg?: string;
20
+ fetchToFormData?: (item: TResultData) => TFormData;
21
+ formToQueryData?: (TFormData: any) => Partial<TResultData>;
22
+ invalidateQueriesOnSuccess?: boolean;
23
+ invalidateQueryKey?: string[];
24
+ retryText?: string;
25
+ cancelLabel?: string;
26
+ saveLabel?: string;
27
+ title?: ((item?: TResultData) => string);
28
+ formikProps: Omit<FormikConfig<any>, "initialValues" | "onSubmit">;
29
+ form: React.ReactNode | FormRendererConfig | ((item: TResultData) => FormRendererConfig);
30
+ show: boolean;
31
+ onClose: () => void;
32
+ }
33
+ export declare function ItemEditDialog<TFormData extends {}, TResultData extends {}>({ initialValues, itemLabel, queryId, queryKey, queryFetchFn, queryFetchOptions, querySaveFn, querySaveOptions, onSuccess, onFetchError, fetchErrorMsg, onSaveError, saveErrorMsg, fetchToFormData, formToQueryData, invalidateQueriesOnSuccess, invalidateQueryKey, retryText, cancelLabel, saveLabel, size, title, form, show, onClose, formikProps, ...props }: ItemEditDialogProps<TFormData, TResultData>): JSX.Element;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { ContainerProps } from "@valerya/ui";
3
+ export declare function PageContainer({ children, ...props }: ContainerProps): JSX.Element;