@compill/admin 1.0.104 → 1.0.105
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/dist/index.cjs +2054 -0
- package/dist/index.d.cts +565 -0
- package/dist/index.d.ts +565 -50
- package/dist/index.js +2000 -50
- package/package.json +17 -16
- package/dist/lib/SectionTitle.d.ts +0 -2
- package/dist/lib/SectionTitle.js +0 -4
- package/dist/lib/breadcrumbs/BreadCrumbs.d.ts +0 -15
- package/dist/lib/breadcrumbs/BreadCrumbs.js +0 -29
- package/dist/lib/buttons/DialogButton.d.ts +0 -7
- package/dist/lib/buttons/DialogButton.js +0 -15
- package/dist/lib/buttons/InvalidateButton.d.ts +0 -6
- package/dist/lib/buttons/InvalidateButton.js +0 -11
- package/dist/lib/buttons/NavigateButton.d.ts +0 -4
- package/dist/lib/buttons/NavigateButton.js +0 -12
- package/dist/lib/buttons/PublishButton.d.ts +0 -9
- package/dist/lib/buttons/PublishButton.js +0 -17
- package/dist/lib/buttons/UpdateButton.d.ts +0 -2
- package/dist/lib/buttons/UpdateButton.js +0 -11
- package/dist/lib/buttons/ViewButton.d.ts +0 -5
- package/dist/lib/buttons/ViewButton.js +0 -13
- package/dist/lib/cells/OrderCell.d.ts +0 -11
- package/dist/lib/cells/OrderCell.js +0 -26
- package/dist/lib/json/DetailsView.d.ts +0 -5
- package/dist/lib/json/DetailsView.js +0 -69
- package/dist/lib/json/EditItemView.d.ts +0 -2
- package/dist/lib/json/EditItemView.js +0 -6
- package/dist/lib/json/MultiQueryWrapper.d.ts +0 -5
- package/dist/lib/json/MultiQueryWrapper.js +0 -61
- package/dist/lib/json/QueryWrapper.d.ts +0 -6
- package/dist/lib/json/QueryWrapper.js +0 -29
- package/dist/lib/json/ScreenRenderer.d.ts +0 -6
- package/dist/lib/json/ScreenRenderer.js +0 -19
- package/dist/lib/json/ScreenTopBar.d.ts +0 -15
- package/dist/lib/json/ScreenTopBar.js +0 -18
- package/dist/lib/json/TabbedView.d.ts +0 -3
- package/dist/lib/json/TabbedView.js +0 -21
- package/dist/lib/json/buttons/ActionButton.d.ts +0 -14
- package/dist/lib/json/buttons/ActionButton.js +0 -11
- package/dist/lib/json/buttons/ConfirmationActionButton.d.ts +0 -26
- package/dist/lib/json/buttons/ConfirmationActionButton.js +0 -20
- package/dist/lib/json/dialog/DialogRenderer.d.ts +0 -11
- package/dist/lib/json/dialog/DialogRenderer.js +0 -14
- package/dist/lib/json/dialog/ItemDeleteDialog.d.ts +0 -17
- package/dist/lib/json/dialog/ItemDeleteDialog.js +0 -14
- package/dist/lib/json/dialog/ItemEditDialog.d.ts +0 -32
- package/dist/lib/json/dialog/ItemEditDialog.js +0 -77
- package/dist/lib/json/dialog/MultiQueryWrapperDialog.d.ts +0 -7
- package/dist/lib/json/dialog/MultiQueryWrapperDialog.js +0 -23
- package/dist/lib/json/dialog/QueryWrapperDialog.d.ts +0 -13
- package/dist/lib/json/dialog/QueryWrapperDialog.js +0 -20
- package/dist/lib/json/table/RefreshButton.d.ts +0 -3
- package/dist/lib/json/table/RefreshButton.js +0 -11
- package/dist/lib/json/table/TableRowActionsView.d.ts +0 -11
- package/dist/lib/json/table/TableRowActionsView.js +0 -36
- package/dist/lib/json/table/TableRowPublishPostButton.d.ts +0 -8
- package/dist/lib/json/table/TableRowPublishPostButton.js +0 -20
- package/dist/lib/json/table/TableView.d.ts +0 -3
- package/dist/lib/json/table/TableView.js +0 -65
- package/dist/lib/json/table/TableViewContext.d.ts +0 -14
- package/dist/lib/json/table/TableViewContext.js +0 -58
- package/dist/lib/json/table/useTableProps.d.ts +0 -3
- package/dist/lib/json/table/useTableProps.js +0 -57
- package/dist/lib/json/types/DetailsView.d.ts +0 -57
- package/dist/lib/json/types/DetailsView.js +0 -1
- package/dist/lib/json/types/EditItemDialog.d.ts +0 -4
- package/dist/lib/json/types/EditItemDialog.js +0 -1
- package/dist/lib/json/types/MultiQueryWrapper.d.ts +0 -18
- package/dist/lib/json/types/MultiQueryWrapper.js +0 -1
- package/dist/lib/json/types/MultiQueryWrapperDialog.d.ts +0 -13
- package/dist/lib/json/types/MultiQueryWrapperDialog.js +0 -1
- package/dist/lib/json/types/QueryWrapper.d.ts +0 -27
- package/dist/lib/json/types/QueryWrapper.js +0 -1
- package/dist/lib/json/types/QueryWrapperDialog.d.ts +0 -22
- package/dist/lib/json/types/QueryWrapperDialog.js +0 -1
- package/dist/lib/json/types/ScreenConfig.d.ts +0 -8
- package/dist/lib/json/types/ScreenConfig.js +0 -1
- package/dist/lib/json/types/TabbedView.d.ts +0 -22
- package/dist/lib/json/types/TabbedView.js +0 -1
- package/dist/lib/json/types/TableView.d.ts +0 -117
- package/dist/lib/json/types/TableView.js +0 -1
- package/dist/lib/layout/AdminLayout.d.ts +0 -13
- package/dist/lib/layout/AdminLayout.js +0 -15
- package/dist/lib/layout/ButtonBar.d.ts +0 -19
- package/dist/lib/layout/ButtonBar.js +0 -19
- package/dist/lib/layout/Content.d.ts +0 -9
- package/dist/lib/layout/Content.js +0 -9
- package/dist/lib/layout/PageTitleBar.d.ts +0 -6
- package/dist/lib/layout/PageTitleBar.js +0 -4
- package/dist/lib/layout/Sidebar.d.ts +0 -20
- package/dist/lib/layout/Sidebar.js +0 -12
- package/dist/lib/layout/menu/Menu.d.ts +0 -12
- package/dist/lib/layout/menu/Menu.js +0 -23
- package/dist/lib/layout/menu/MenuButton.d.ts +0 -6
- package/dist/lib/layout/menu/MenuButton.js +0 -5
- package/dist/lib/layout/menu/MenuConfig.d.ts +0 -13
- package/dist/lib/layout/menu/MenuConfig.js +0 -1
- package/dist/lib/layout/menu/MenuItem.d.ts +0 -11
- package/dist/lib/layout/menu/MenuItem.js +0 -11
- package/dist/lib/layout/menu/NextMenuItem.d.ts +0 -11
- package/dist/lib/layout/menu/NextMenuItem.js +0 -11
- package/dist/lib/layout/menu/SelectedIndicator.d.ts +0 -3
- package/dist/lib/layout/menu/SelectedIndicator.js +0 -4
- package/dist/lib/layout/menu/UserBlock.d.ts +0 -9
- package/dist/lib/layout/menu/UserBlock.js +0 -34
- package/dist/lib/modal/AttachDialog.d.ts +0 -30
- package/dist/lib/modal/AttachDialog.js +0 -73
- package/dist/lib/modal/FormActionDialog.d.ts +0 -23
- package/dist/lib/modal/FormActionDialog.js +0 -20
- package/dist/lib/page/PageContainer.d.ts +0 -2
- package/dist/lib/page/PageContainer.js +0 -5
- package/dist/lib/page/PageContentEditor.d.ts +0 -4
- package/dist/lib/page/PageContentEditor.js +0 -10
- package/dist/lib/page/PageMain.d.ts +0 -2
- package/dist/lib/page/PageMain.js +0 -5
- package/dist/lib/page/PageQueryStateContainer.d.ts +0 -21
- package/dist/lib/page/PageQueryStateContainer.js +0 -16
- package/dist/lib/page/PageSectionTitle.d.ts +0 -2
- package/dist/lib/page/PageSectionTitle.js +0 -4
- package/dist/lib/page/PageSidebar.d.ts +0 -2
- package/dist/lib/page/PageSidebar.js +0 -4
- package/dist/lib/page/PageSidebarSection.d.ts +0 -4
- package/dist/lib/page/PageSidebarSection.js +0 -5
- package/dist/lib/page/PageStateContainer.d.ts +0 -7
- package/dist/lib/page/PageStateContainer.js +0 -7
- package/dist/lib/page/PageSubSectionTitle.d.ts +0 -2
- package/dist/lib/page/PageSubSectionTitle.js +0 -4
- package/dist/lib/page/PageTitle.d.ts +0 -2
- package/dist/lib/page/PageTitle.js +0 -4
- package/dist/lib/page/PageTopBar.d.ts +0 -13
- package/dist/lib/page/PageTopBar.js +0 -78
- package/dist/lib/status/StatusBadge.d.ts +0 -4
- package/dist/lib/status/StatusBadge.js +0 -21
- package/dist/lib/table/TableColumnButton.d.ts +0 -1
- package/dist/lib/table/TableColumnButton.js +0 -53
- package/dist/lib/table/TableContainer.d.ts +0 -10
- package/dist/lib/table/TableContainer.js +0 -6
- package/dist/lib/table/TableContainerContext.d.ts +0 -18
- package/dist/lib/table/TableContainerContext.js +0 -40
- package/dist/lib/table/TableCreateButton.d.ts +0 -4
- package/dist/lib/table/TableCreateButton.js +0 -7
- package/dist/lib/table/TableFilterButton.d.ts +0 -2
- package/dist/lib/table/TableFilterButton.js +0 -8
- package/dist/lib/table/TableFilters.d.ts +0 -9
- package/dist/lib/table/TableFilters.js +0 -27
- package/dist/lib/table/TableMassActions.d.ts +0 -6
- package/dist/lib/table/TableMassActions.js +0 -9
- package/dist/lib/table/TableRowActionBar.d.ts +0 -10
- package/dist/lib/table/TableRowActionBar.js +0 -8
- package/dist/lib/table/TableRowActionButton.d.ts +0 -4
- package/dist/lib/table/TableRowActionButton.js +0 -5
- package/dist/lib/table/TableRowActionDialogButton.d.ts +0 -4
- package/dist/lib/table/TableRowActionDialogButton.js +0 -6
- package/dist/lib/table/TableRowDeleteButton.d.ts +0 -2
- package/dist/lib/table/TableRowDeleteButton.js +0 -6
- package/dist/lib/table/TableRowEditButton.d.ts +0 -2
- package/dist/lib/table/TableRowEditButton.js +0 -6
- package/dist/lib/table/TableRowNavigateButton.d.ts +0 -4
- package/dist/lib/table/TableRowNavigateButton.js +0 -14
- package/dist/lib/table/TableRowPublishPostButton.d.ts +0 -8
- package/dist/lib/table/TableRowPublishPostButton.js +0 -19
- package/dist/lib/table/TableRowViewButton.d.ts +0 -4
- package/dist/lib/table/TableRowViewButton.js +0 -13
- package/dist/lib/table/TableTopBar.d.ts +0 -8
- package/dist/lib/table/TableTopBar.js +0 -5
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compill/admin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.105",
|
|
4
4
|
"private": false,
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
9
10
|
"import": "./dist/index.js",
|
|
10
|
-
"
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|
|
@@ -33,19 +34,19 @@
|
|
|
33
34
|
"react-router-dom": "^6.11.2",
|
|
34
35
|
"react-hotkeys-hook": "^5.0.1",
|
|
35
36
|
"yup": "^1.1.0",
|
|
36
|
-
"@soperio/react": "1.0.
|
|
37
|
-
"@compill/admin-api": "1.0.
|
|
38
|
-
"@soperio/jsx-runtime": "1.0.
|
|
39
|
-
"@compill/api": "1.0.
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@compill/
|
|
43
|
-
"@compill/form": "1.0.
|
|
44
|
-
"@compill/
|
|
45
|
-
"@compill/
|
|
46
|
-
"@compill/
|
|
47
|
-
"@compill/
|
|
48
|
-
"@compill/
|
|
37
|
+
"@soperio/react": "1.0.19",
|
|
38
|
+
"@compill/admin-api": "1.0.58",
|
|
39
|
+
"@soperio/jsx-runtime": "1.0.19",
|
|
40
|
+
"@compill/api": "1.0.60",
|
|
41
|
+
"@valerya/ui": "1.0.18",
|
|
42
|
+
"@compill/auth": "1.0.80",
|
|
43
|
+
"@compill/components": "1.0.53",
|
|
44
|
+
"@compill/form": "1.0.70",
|
|
45
|
+
"@compill/env": "1.0.22",
|
|
46
|
+
"@compill/form-editor": "1.0.22",
|
|
47
|
+
"@compill/hooks": "1.0.46",
|
|
48
|
+
"@compill/editor": "1.0.82",
|
|
49
|
+
"@compill/table": "1.0.83"
|
|
49
50
|
},
|
|
50
51
|
"publishConfig": {
|
|
51
52
|
"access": "public"
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"dist"
|
|
55
56
|
],
|
|
56
57
|
"scripts": {
|
|
57
|
-
"build": "
|
|
58
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
58
59
|
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
59
60
|
"lint": "eslint . --max-warnings 0",
|
|
60
61
|
"check-types": "tsc --noEmit"
|
package/dist/lib/SectionTitle.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SoperioComponent } from "@soperio/react";
|
|
2
|
-
export interface Breadcrumb {
|
|
3
|
-
label: string;
|
|
4
|
-
path?: string;
|
|
5
|
-
}
|
|
6
|
-
interface BreadcrumbsProps extends SoperioComponent {
|
|
7
|
-
breadcrumbs: Breadcrumb[] | QueryBreadcrumbs;
|
|
8
|
-
}
|
|
9
|
-
export type QueryBreadcrumbs = {
|
|
10
|
-
queryFn: (...args: any) => Promise<any>;
|
|
11
|
-
queryField?: string;
|
|
12
|
-
generate: (results: any) => Breadcrumb[];
|
|
13
|
-
};
|
|
14
|
-
export declare function Breadcrumbs({ breadcrumbs, ...props }: BreadcrumbsProps): JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@soperio/jsx-runtime";
|
|
2
|
-
import { useApiQuery } from "@compill/api";
|
|
3
|
-
import { Shimmer } from "@compill/components";
|
|
4
|
-
import { mdiCircleSmall } from "@mdi/js";
|
|
5
|
-
import { Icon } from "@valerya/ui";
|
|
6
|
-
import { isArray } from "es-toolkit/compat";
|
|
7
|
-
import Link from "next/link";
|
|
8
|
-
import { useParams } from "react-router-dom";
|
|
9
|
-
export function Breadcrumbs({ breadcrumbs, ...props }) {
|
|
10
|
-
if (isArray(breadcrumbs)) {
|
|
11
|
-
return (_jsx("div", { dflex: true, alignItems: "center", trait: "typo.h5", ...props, children: breadcrumbs.map((b, index) => _jsx(BreadcrumbItem, { breadcrumb: b, showSeparator: index > 0 }, index)) }));
|
|
12
|
-
}
|
|
13
|
-
return _jsx(QueryBreadcrumbs, { queryFn: breadcrumbs.queryFn, queryField: breadcrumbs.queryField, generate: breadcrumbs.generate });
|
|
14
|
-
}
|
|
15
|
-
function QueryBreadcrumbs({ queryFn, queryField, generate, ...props }) {
|
|
16
|
-
const params = useParams();
|
|
17
|
-
const id = queryField ? params[queryField] : undefined;
|
|
18
|
-
const { data, isLoading, isError } = useApiQuery([""], queryFn, id);
|
|
19
|
-
if (isLoading || isError) {
|
|
20
|
-
return (_jsxs("div", { dflex: true, alignItems: "center", children: [_jsx(Shimmer, { h: "8", w: "24" }), _jsx(Icon, { path: mdiCircleSmall, mx: "1" }), _jsx(Shimmer, { h: "8", w: "20" })] }));
|
|
21
|
-
}
|
|
22
|
-
const breadcrumbs = generate(data);
|
|
23
|
-
return (_jsx("div", { dflex: true, alignItems: "center", trait: "typo.h5", ...props, children: breadcrumbs.map((b, index) => _jsx(BreadcrumbItem, { breadcrumb: b, showSeparator: index > 0 }, index)) }));
|
|
24
|
-
}
|
|
25
|
-
function BreadcrumbItem({ breadcrumb, showSeparator }) {
|
|
26
|
-
return (_jsxs(_Fragment, { children: [showSeparator && _jsx(Icon, { path: mdiCircleSmall, mx: "1" }), _jsx(Link, { href: `/${breadcrumb.path || "#"}`, children: _jsx("span", {
|
|
27
|
-
// onClick={breadcrumb.path ? handleClick : undefined}
|
|
28
|
-
hover_textDecoration: breadcrumb.path ? "underline" : undefined, cursor: breadcrumb.path ? "pointer" : undefined, children: breadcrumb.label }) })] }));
|
|
29
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@soperio/jsx-runtime";
|
|
2
|
-
import { Button } from "@valerya/ui";
|
|
3
|
-
import React from "react";
|
|
4
|
-
export function DialogButton({ buildDialog, ...props }) {
|
|
5
|
-
const [showDialog, setShowDialog] = React.useState(false);
|
|
6
|
-
const onShowDialog = React.useCallback((event) => {
|
|
7
|
-
event?.preventDefault();
|
|
8
|
-
event?.stopPropagation();
|
|
9
|
-
setShowDialog(true);
|
|
10
|
-
}, [setShowDialog]);
|
|
11
|
-
const onCloseDialog = React.useCallback(() => {
|
|
12
|
-
setShowDialog(false);
|
|
13
|
-
}, [setShowDialog]);
|
|
14
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: onShowDialog, ...props }), showDialog && buildDialog(onCloseDialog)] }));
|
|
15
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ButtonBarButtonProps } from "../layout/ButtonBar.js";
|
|
2
|
-
interface InvalidateButtonProps extends ButtonBarButtonProps {
|
|
3
|
-
pathOrPermalink: string;
|
|
4
|
-
}
|
|
5
|
-
export declare function InvalidateButton({ pathOrPermalink, ...props }: InvalidateButtonProps): JSX.Element;
|
|
6
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@soperio/jsx-runtime";
|
|
2
|
-
import { INVALIDATE_API } from "@compill/admin-api";
|
|
3
|
-
import { useApiMutation, useMutate } from "@compill/api";
|
|
4
|
-
import { mdiDatabaseRefreshOutline } from "@mdi/js";
|
|
5
|
-
import { ButtonBarButton } from "../layout/ButtonBar.js";
|
|
6
|
-
export function InvalidateButton({ pathOrPermalink, ...props }) {
|
|
7
|
-
const api = INVALIDATE_API.new(pathOrPermalink);
|
|
8
|
-
const mutation = useApiMutation(api.invalidate, api.queryKey);
|
|
9
|
-
const invalidate = useMutate(mutation, { successMsg: "Page successfully invalidated" });
|
|
10
|
-
return (_jsx(ButtonBarButton, { title: "Regenerate", disabled: mutation.isLoading, onClick: invalidate, icon: mdiDatabaseRefreshOutline, ...props }));
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@soperio/jsx-runtime";
|
|
2
|
-
import { mdiPost } from "@mdi/js";
|
|
3
|
-
import { Button, Icon } from "@valerya/ui";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { useNavigate } from "react-router-dom";
|
|
6
|
-
export function NavigateButton({ path, ...props }) {
|
|
7
|
-
const navigate = useNavigate();
|
|
8
|
-
const handleClick = React.useCallback(() => {
|
|
9
|
-
navigate(path);
|
|
10
|
-
}, [navigate, path]);
|
|
11
|
-
return (_jsx(Button, { type: "submit", scheme: "dark", variant: "glass", corners: "pill", w: "10", h: "10", onClick: handleClick, ...props, children: _jsx(Icon, { path: mdiPost }) }));
|
|
12
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { API } from "@compill/admin-api";
|
|
2
|
-
import { ButtonProps } from "@valerya/ui";
|
|
3
|
-
interface PublishButtonProps extends ButtonProps {
|
|
4
|
-
status: string;
|
|
5
|
-
queryId: string;
|
|
6
|
-
api: API<any>;
|
|
7
|
-
}
|
|
8
|
-
export declare function PublishButton({ status, queryId, api, ...props }: PublishButtonProps): JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@soperio/jsx-runtime";
|
|
2
|
-
import { useInvalidateMutation } from "@compill/api";
|
|
3
|
-
import { mdiEye, mdiEyeOff } from "@mdi/js";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { toast } from "react-toastify";
|
|
6
|
-
import { ButtonBarButton } from "../layout/ButtonBar.js";
|
|
7
|
-
export function PublishButton({ status, queryId, api, ...props }) {
|
|
8
|
-
const isDraft = status == "draft";
|
|
9
|
-
const mutation = useInvalidateMutation(isDraft ? api.publish : api.unpublish, api.queryKey, queryId, { networkMode: "always" });
|
|
10
|
-
const publish = React.useCallback(() => {
|
|
11
|
-
mutation.reset();
|
|
12
|
-
mutation.mutateAsync(queryId)
|
|
13
|
-
.then(() => toast.success(isDraft ? "Published!" : "Unpublished!"))
|
|
14
|
-
.catch(error => toast.error(`Error: ${error}`));
|
|
15
|
-
}, [mutation, queryId]);
|
|
16
|
-
return (_jsx(ButtonBarButton, { disabled: mutation.isLoading, onClick: publish, icon: isDraft ? mdiEye : mdiEyeOff, ...props, children: isDraft ? "Publish" : "Switch to draft" }));
|
|
17
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@soperio/jsx-runtime";
|
|
2
|
-
import { mdiCloudUpload } from "@mdi/js";
|
|
3
|
-
import { useFormikContext } from "formik";
|
|
4
|
-
import { useHotkeys } from "react-hotkeys-hook";
|
|
5
|
-
import { ButtonBarSubmitButton } from "../layout/ButtonBar.js";
|
|
6
|
-
export function UpdateButton({ ...props }) {
|
|
7
|
-
const { dirty, handleSubmit } = useFormikContext() ?? { dirty: false, handleSubmit: undefined, values: {} };
|
|
8
|
-
useHotkeys('ctrl+s', () => { if (dirty && !props.disabled)
|
|
9
|
-
handleSubmit(); }, { preventDefault: true }, [dirty, props, handleSubmit]);
|
|
10
|
-
return (_jsx(ButtonBarSubmitButton, { icon: mdiCloudUpload, ...props, children: "Update" }));
|
|
11
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@soperio/jsx-runtime";
|
|
2
|
-
import { mdiOpenInNew } from "@mdi/js";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { ButtonBarButton } from "../layout/ButtonBar.js";
|
|
5
|
-
export function ViewButton({ label, path, icon, ...props }) {
|
|
6
|
-
const openPage = React.useCallback(() => {
|
|
7
|
-
window.open(path, '_blank');
|
|
8
|
-
}, [path]);
|
|
9
|
-
return (_jsx(ButtonBarButton, { onClick: openPage, dflex: true, alignItems: "center", gap: "2", icon: icon || mdiOpenInNew, ...props, children: label }));
|
|
10
|
-
// return (
|
|
11
|
-
// <IconButton icon={icon ? icon : mdiOpenInNew} type="submit" scheme="dark" variant="glass" size="md" onClick={openPage} {...props}/>
|
|
12
|
-
// )
|
|
13
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
interface OrderApi {
|
|
2
|
-
moveUp: (id: string) => Promise<any>;
|
|
3
|
-
moveDown: (id: string) => Promise<any>;
|
|
4
|
-
queryKey: string[];
|
|
5
|
-
}
|
|
6
|
-
export declare function OrderCell({ api, postId, order }: {
|
|
7
|
-
api: OrderApi;
|
|
8
|
-
postId: string;
|
|
9
|
-
order: number;
|
|
10
|
-
}): JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
|
|
2
|
-
import { FlexCenter } from "@compill/components";
|
|
3
|
-
import { useInvalidateMutation } from "@compill/api";
|
|
4
|
-
import { mdiArrowDownBoldBox, mdiArrowUpBoldBox } from "@mdi/js";
|
|
5
|
-
import { Button, Icon } from "@valerya/ui";
|
|
6
|
-
import React from "react";
|
|
7
|
-
import { toast } from "react-toastify";
|
|
8
|
-
export function OrderCell({ api, postId, order }) {
|
|
9
|
-
const mutationDown = useInvalidateMutation(api.moveDown, api.queryKey);
|
|
10
|
-
const mutationUp = useInvalidateMutation(api.moveUp, api.queryKey);
|
|
11
|
-
const moveDown = React.useCallback((e) => {
|
|
12
|
-
e.stopPropagation();
|
|
13
|
-
mutationDown.mutateAsync(postId)
|
|
14
|
-
.catch(error => {
|
|
15
|
-
toast.error(`Error: ${error}`);
|
|
16
|
-
});
|
|
17
|
-
}, [mutationDown, postId]);
|
|
18
|
-
const moveUp = React.useCallback((e) => {
|
|
19
|
-
e.stopPropagation();
|
|
20
|
-
mutationUp.mutateAsync(postId)
|
|
21
|
-
.catch(error => {
|
|
22
|
-
toast.error(`Error: ${error}`);
|
|
23
|
-
});
|
|
24
|
-
}, [mutationUp, postId]);
|
|
25
|
-
return (_jsxs(FlexCenter, { placeContent: "start", numericFontVariant: "tabular-nums", children: [order, _jsx(Button, { ms: "3", variant: "borderless", scheme: "dark", onClick: moveUp, children: _jsx(Icon, { path: mdiArrowUpBoldBox }) }), _jsx(Button, { variant: "borderless", scheme: "dark", onClick: moveDown, children: _jsx(Icon, { path: mdiArrowDownBoldBox }) })] }));
|
|
26
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { SoperioComponent } from "@soperio/react";
|
|
2
|
-
import { DetailsViewConfig } from "./types/DetailsView.js";
|
|
3
|
-
export declare function DetailsView({ queryField, api, useNextRouter, processInput, screen, tabbed, ...props }: DetailsViewConfig & {
|
|
4
|
-
tabbed?: boolean;
|
|
5
|
-
} & SoperioComponent): JSX.Element;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
|
|
2
|
-
import { useInvalidateParentMutation, useMutate } from "@compill/api";
|
|
3
|
-
import { FormProvider, FormRenderer, TextArea } from "@compill/form";
|
|
4
|
-
import { runIfFn } from "@soperio/react";
|
|
5
|
-
import React from "react";
|
|
6
|
-
import { useParams } from "react-router-dom";
|
|
7
|
-
import { PageContainer } from "../page/PageContainer.js";
|
|
8
|
-
import { PageContentEditor } from "../page/PageContentEditor.js";
|
|
9
|
-
import { PageQueryStateContainer } from "../page/PageQueryStateContainer.js";
|
|
10
|
-
import { PageSidebar } from "../page/PageSidebar.js";
|
|
11
|
-
import { PageSidebarSection } from "../page/PageSidebarSection.js";
|
|
12
|
-
import { ScreenTopBar } from "./ScreenTopBar.js";
|
|
13
|
-
import { useRouter } from "next/router";
|
|
14
|
-
import { useInvalidatePage } from "@compill/admin-api";
|
|
15
|
-
function useQueryField(queryField, useNextRouter) {
|
|
16
|
-
if (useNextRouter) {
|
|
17
|
-
const router = useRouter();
|
|
18
|
-
return router.query[queryField];
|
|
19
|
-
}
|
|
20
|
-
const { [queryField]: id } = useParams();
|
|
21
|
-
return id;
|
|
22
|
-
}
|
|
23
|
-
export function DetailsView({ queryField, api, useNextRouter, processInput, screen, tabbed, ...props }) {
|
|
24
|
-
const id = useQueryField(queryField, useNextRouter);
|
|
25
|
-
const ref = React.useRef(null);
|
|
26
|
-
return (_jsx(PageQueryStateContainer, { api: api, apiFn: "get", queryId: id, ref: ref, p: "5", ...props, children: (item) => _jsx(Internal, { item: item, screen: screen, api: api, tabbed: tabbed, processInput: processInput, containerRef: ref }) }));
|
|
27
|
-
}
|
|
28
|
-
function Internal({ item, screen, api, processInput, tabbed, containerRef }) {
|
|
29
|
-
const pScreen = runIfFn(screen, item);
|
|
30
|
-
const { breadcrumbs, schema, initialValues, header, sections, buttonBar, type, invalidateParentQueryKey, invalidatePage } = pScreen;
|
|
31
|
-
const mutation = useInvalidateParentMutation((api.update), invalidateParentQueryKey ?? api.queryKey, { networkMode: "always" });
|
|
32
|
-
const invalidatePageFn = useInvalidatePage(invalidatePage || "");
|
|
33
|
-
const save = useMutate(mutation, {
|
|
34
|
-
processInput,
|
|
35
|
-
successMsg: (item, values) => `${item.title || item.name} updated.`,
|
|
36
|
-
errorMsg: (error, item) => `Error updating ${item.title || item.name}: ${error}`,
|
|
37
|
-
onSuccess: () => {
|
|
38
|
-
if (invalidatePage)
|
|
39
|
-
invalidatePageFn();
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
let editorMaxW = undefined;
|
|
43
|
-
if (!type || type == "post")
|
|
44
|
-
editorMaxW = "calc(1280px - 28rem)";
|
|
45
|
-
else if (type == "section")
|
|
46
|
-
editorMaxW = "calc(1280px - 22rem)";
|
|
47
|
-
return (_jsxs(FormProvider, { initialValues: runIfFn(initialValues, item), validationSchema: schema, onSubmit: save, enableReinitialize: true, children: [_jsx(ScreenTopBar, { tabbed: tabbed, api: api, breadcrumbs: breadcrumbs, buttonBar: buttonBar, item: item, isLoading: mutation.isLoading, trackingRef: containerRef?.current }), type == "form" && sections?.map((section, index) => (_jsx(Section, { section: section, item: item }, index))), (pScreen.type == "post" || pScreen.type == "section") &&
|
|
48
|
-
(_jsx("div", { p: "5", bgColor: "slate-100", rounded: "lg", children: _jsxs(PageContainer, { w: editorMaxW ? "auto" : "full", size: "x2", id: "pagecontainer", children: [header, _jsxs("div", { dflex: true, gap: "5", children: [_jsxs("div", { dflex: true, flexCol: true, gap: "8", flexGrow: true, children: [pScreen.editor?.type != "textarea" &&
|
|
49
|
-
(
|
|
50
|
-
// TODO Find a way to make this editor shrink in width when resizing the window...
|
|
51
|
-
_jsx(PageContentEditor, { name: "content", maxW: editorMaxW, minW: "144", shadow: true, rounded: "lg" })), pScreen.editor?.type == "textarea" &&
|
|
52
|
-
(_jsx(TextArea, { name: pScreen.editor?.name, maxW: editorMaxW, minW: editorMaxW, w: editorMaxW, minH: "128", rows: 25, bgColor: "white", border: "0", shadow: true, p: "5", textColor: "slate-800" })), pScreen.editorFooter] }), _jsx(PageSidebar, { children: sections?.map((section, index) => (_jsx(Section, { section: section, item: item, cardStyle: true }, index))) })] })] }) }))] }));
|
|
53
|
-
}
|
|
54
|
-
function Section({ section, item, cardStyle }) {
|
|
55
|
-
if (section.type === "section") {
|
|
56
|
-
const style = cardStyle ?
|
|
57
|
-
{
|
|
58
|
-
bgColor: "white",
|
|
59
|
-
rounded: "lg",
|
|
60
|
-
p: "5",
|
|
61
|
-
textSize: "sm",
|
|
62
|
-
shadow: true
|
|
63
|
-
} : {};
|
|
64
|
-
return (_jsx(PageSidebarSection, { title: section.title, ...style, children: _jsx(FormRenderer, { form: runIfFn(section.form, item) }) }));
|
|
65
|
-
}
|
|
66
|
-
if (section.type === "custom")
|
|
67
|
-
return runIfFn(section.component, item);
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@soperio/jsx-runtime";
|
|
2
|
-
import { runIfFn } from "@soperio/react";
|
|
3
|
-
import { ItemEditDialog } from "./dialog/ItemEditDialog.js";
|
|
4
|
-
export function EditItemView({ initialValues, ...props }) {
|
|
5
|
-
return (_jsx(ItemEditDialog, { ...props, initialValues: runIfFn(initialValues, null), show: true }));
|
|
6
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { MultiQueryWrapperConfig } from "./types/MultiQueryWrapper.js";
|
|
2
|
-
import { SoperioComponent } from "@soperio/react";
|
|
3
|
-
export declare function MultiQueryWrapper({ queries, config, tabbed, ...props }: Omit<MultiQueryWrapperConfig, "type"> & {
|
|
4
|
-
tabbed?: boolean;
|
|
5
|
-
} & SoperioComponent): JSX.Element;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@soperio/jsx-runtime";
|
|
2
|
-
import { useApiQueries } from "@compill/api";
|
|
3
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { useParams } from "react-router-dom";
|
|
6
|
-
import { ScreenRenderer } from "./ScreenRenderer.js";
|
|
7
|
-
import { isFunction, runIfFn } from "@soperio/react";
|
|
8
|
-
import { QueryLoadingState, RetryOnError } from "@compill/components";
|
|
9
|
-
function useQueries(queries) {
|
|
10
|
-
const params = useParams();
|
|
11
|
-
const { data, isFetching, isError } = useApiQueries(queries.map(q => {
|
|
12
|
-
if (!q.queryField) {
|
|
13
|
-
const api = runIfFn(q.api);
|
|
14
|
-
return {
|
|
15
|
-
queryKey: api.queryKey,
|
|
16
|
-
queryFn: q.fn == "get" ? api.get : api.getAll,
|
|
17
|
-
queryParam: q.params
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const id = params[q.queryField];
|
|
21
|
-
const api = runIfFn(q.api, id);
|
|
22
|
-
return {
|
|
23
|
-
queryKey: api.queryKey,
|
|
24
|
-
queryFn: q.fn == "get" ? api.get : api.getAll,
|
|
25
|
-
queryParam: q.fn == "getAll" ? q.params : isFunction(q.api) ? undefined : id
|
|
26
|
-
};
|
|
27
|
-
}));
|
|
28
|
-
let transformedData = undefined;
|
|
29
|
-
if (!isFetching && !isError) {
|
|
30
|
-
transformedData = data?.map((d, index) => queries[index].transformFn ? queries[index].transformFn?.(d) : d);
|
|
31
|
-
}
|
|
32
|
-
return { data: transformedData, isFetching, isError };
|
|
33
|
-
}
|
|
34
|
-
function useInvalidate(queries) {
|
|
35
|
-
const queryClient = useQueryClient();
|
|
36
|
-
const params = useParams();
|
|
37
|
-
const invalidate = React.useCallback(() => {
|
|
38
|
-
const queryKeys = [];
|
|
39
|
-
queries.forEach(q => {
|
|
40
|
-
if (!q.queryField || !isFunction(q.api)) {
|
|
41
|
-
queryKeys.push(q.api.queryKey);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
const id = params[q.queryField];
|
|
45
|
-
const api = runIfFn(q.api, id);
|
|
46
|
-
queryKeys.push(api.queryKey);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
queryClient.invalidateQueries({ predicate: (query) => queryKeys.includes(query.queryKey), });
|
|
50
|
-
}, [queries, queryClient, params]);
|
|
51
|
-
return invalidate;
|
|
52
|
-
}
|
|
53
|
-
export function MultiQueryWrapper({ queries, config, tabbed, ...props }) {
|
|
54
|
-
const { data, isFetching, isError } = useQueries(queries);
|
|
55
|
-
const invalidate = useInvalidate(queries);
|
|
56
|
-
if (isFetching)
|
|
57
|
-
return _jsx(QueryLoadingState, { w: "full", h: "100vh" });
|
|
58
|
-
if (isError || !data)
|
|
59
|
-
return _jsx(RetryOnError, { p: "0", w: "full", h: "100vh", onClick: invalidate });
|
|
60
|
-
return _jsx(ScreenRenderer, { config: config(...data), tabbed: tabbed, ...props });
|
|
61
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { QueryWrapperConfig } from "./types/QueryWrapper.js";
|
|
2
|
-
import { SoperioComponent } from "@soperio/react";
|
|
3
|
-
import { CRUD_MODEL } from "@compill/api";
|
|
4
|
-
export declare function QueryWrapper<T extends CRUD_MODEL, U>({ api, queryField, fn, transformFn, config, tabbed, ...props }: Omit<QueryWrapperConfig<T, U>, "type"> & {
|
|
5
|
-
tabbed?: boolean;
|
|
6
|
-
} & SoperioComponent): JSX.Element | null;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@soperio/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ScreenRenderer } from "./ScreenRenderer.js";
|
|
4
|
-
import { isFunction, runIfFn } from "@soperio/react";
|
|
5
|
-
import { useParams } from "react-router-dom";
|
|
6
|
-
import { useApiQuery } from "@compill/api";
|
|
7
|
-
function useApi(api, queryField) {
|
|
8
|
-
const params = useParams();
|
|
9
|
-
if (queryField === undefined)
|
|
10
|
-
return { id: undefined, api: api };
|
|
11
|
-
const { [queryField]: id } = params;
|
|
12
|
-
return { id, api: runIfFn(api, id) };
|
|
13
|
-
}
|
|
14
|
-
export function QueryWrapper({ api, queryField, fn, transformFn, config, tabbed, ...props }) {
|
|
15
|
-
const { id, api: mApi } = useApi(api, queryField);
|
|
16
|
-
const { data } = useApiQuery(mApi.queryKey, fn === "get" || fn === "getTransformed" ? mApi.get : mApi.getAll, isFunction(api) ? undefined : id);
|
|
17
|
-
const transformedData = React.useMemo(() => {
|
|
18
|
-
if (data && (fn === "getTransformed" || fn === "getAllTransformed")) {
|
|
19
|
-
if (!transformFn)
|
|
20
|
-
console.warn(`QueryWrapperDialog: you forgot to pass transformFn as parameter for fn ${fn}`);
|
|
21
|
-
return transformFn?.(data);
|
|
22
|
-
}
|
|
23
|
-
return data;
|
|
24
|
-
}, [data]);
|
|
25
|
-
// TODO states
|
|
26
|
-
if (!data)
|
|
27
|
-
return null;
|
|
28
|
-
return _jsx(ScreenRenderer, { config: config(transformedData), tabbed: tabbed, ...props });
|
|
29
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "@soperio/jsx-runtime";
|
|
2
|
-
import { DetailsView } from "./DetailsView.js";
|
|
3
|
-
import { QueryWrapper } from "./QueryWrapper.js";
|
|
4
|
-
import { TabbedView } from "./TabbedView.js";
|
|
5
|
-
import { TableView } from "./table/TableView.js";
|
|
6
|
-
import { MultiQueryWrapper } from "./MultiQueryWrapper.js";
|
|
7
|
-
export function ScreenRenderer({ config, tabbed, ...props }) {
|
|
8
|
-
if (config.type === "table")
|
|
9
|
-
return _jsx(TableView, { ...config, ...props });
|
|
10
|
-
if (config.type === "tabbed")
|
|
11
|
-
return _jsx(TabbedView, { ...config, ...props });
|
|
12
|
-
if (config.type === "details")
|
|
13
|
-
return _jsx(DetailsView, { ...config, tabbed: tabbed, ...props });
|
|
14
|
-
if (config.type === "query")
|
|
15
|
-
return _jsx(QueryWrapper, { ...config, tabbed: tabbed, ...props });
|
|
16
|
-
if (config.type === "multiQuery")
|
|
17
|
-
return _jsx(MultiQueryWrapper, { ...config, tabbed: tabbed, ...props });
|
|
18
|
-
return _jsx(_Fragment, {});
|
|
19
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { API } from "@compill/admin-api";
|
|
2
|
-
import { Breadcrumb } from "../breadcrumbs/BreadCrumbs.js";
|
|
3
|
-
import { DetailViewButton } from "./types/DetailsView.js";
|
|
4
|
-
import { CRUDAPI } from "@compill/api";
|
|
5
|
-
interface ScreenTopBarProps {
|
|
6
|
-
tabbed?: boolean;
|
|
7
|
-
breadcrumbs?: Breadcrumb[];
|
|
8
|
-
buttonBar?: DetailViewButton[];
|
|
9
|
-
api: CRUDAPI<any> | 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 {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@soperio/jsx-runtime";
|
|
2
|
-
import { API } from "@compill/admin-api";
|
|
3
|
-
import { InvalidateButton } from "../buttons/InvalidateButton.js";
|
|
4
|
-
import { PublishButton } from "../buttons/PublishButton.js";
|
|
5
|
-
import { UpdateButton } from "../buttons/UpdateButton.js";
|
|
6
|
-
import { ViewButton } from "../buttons/ViewButton.js";
|
|
7
|
-
import { PageTopBar, PageTopBarToolbar } from "../page/PageTopBar.js";
|
|
8
|
-
import React from "react";
|
|
9
|
-
import { ButtonBar } from "../layout/ButtonBar.js";
|
|
10
|
-
export function ScreenTopBar({ tabbed, breadcrumbs, api, item, isLoading, buttonBar, trackingRef }) {
|
|
11
|
-
return (_jsxs(_Fragment, { children: [tabbed &&
|
|
12
|
-
(_jsx(PageTopBarToolbar, { trackingRef: trackingRef, children: _jsx(Buttons, { api: api, item: item, isLoading: isLoading, buttonBar: buttonBar }) })), !tabbed &&
|
|
13
|
-
(_jsx(PageTopBar, { breadcrumbs: breadcrumbs, children: _jsx(Buttons, { api: api, item: item, isLoading: isLoading, buttonBar: buttonBar }) }))] }));
|
|
14
|
-
}
|
|
15
|
-
function Buttons({ api, item, isLoading, buttonBar }) {
|
|
16
|
-
return (_jsxs(_Fragment, { children: [buttonBar && buttonBar.length > 0 &&
|
|
17
|
-
(_jsx(ButtonBar, { children: buttonBar.map((button, index) => (_jsxs(React.Fragment, { children: [button.type === "link" && _jsx(ViewButton, { label: button.label, path: button.path, icon: button.icon }), button.type === "invalidate" && _jsx(InvalidateButton, { pathOrPermalink: button.pathOrPermalink }), button.type == "custom" && button.render(item)] }, index))) })), _jsxs(ButtonBar, { children: [api instanceof API && _jsx(PublishButton, { api: api, queryId: item.id, status: item.status, disabled: isLoading }), _jsx(UpdateButton, { disabled: isLoading })] })] }));
|
|
18
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
|
|
2
|
-
import { useParams } from "react-router-dom";
|
|
3
|
-
import { PageQueryStateContainer } from "../page/PageQueryStateContainer.js";
|
|
4
|
-
import { PageTabbedTopBar, PageTabbedTopBarProvider } from "../page/PageTopBar.js";
|
|
5
|
-
import { TabContainer } from "@compill/components";
|
|
6
|
-
import { runIfFn } from "@soperio/react";
|
|
7
|
-
import { ScreenRenderer } from "./ScreenRenderer.js";
|
|
8
|
-
export function TabbedView({ queryField, api, screen, ...props }) {
|
|
9
|
-
const { [queryField]: id } = useParams();
|
|
10
|
-
return (_jsx(PageQueryStateContainer, { queryId: id, api: api, apiFn: "get", p: "5", children: (city) => {
|
|
11
|
-
const { breadcrumbs, tabs } = runIfFn(screen, city);
|
|
12
|
-
return (_jsxs(PageTabbedTopBarProvider, { children: [_jsx(PageTabbedTopBar, { breadcrumbs: breadcrumbs, mb: "-3" }), _jsx(TabContainer, { tabs: tabs.map(tab => tab.label), saveKey: `tab-${id}`, mt: "-3", mb: "3", id: "fff", children: tabs.map((tab, index) => _jsx(TabView, { tab: tab }, index)) })] }));
|
|
13
|
-
} }));
|
|
14
|
-
}
|
|
15
|
-
function TabView({ tab }) {
|
|
16
|
-
if (!tab.component && !tab.config)
|
|
17
|
-
throw new Error(`Screen config for tabbed view: one of your tabs does not have a component or config declared: ${tab.label}`);
|
|
18
|
-
if (tab.component)
|
|
19
|
-
return tab.component();
|
|
20
|
-
return _jsx(ScreenRenderer, { config: tab.config, tabbed: true, p: "0" });
|
|
21
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MutationQueryFn, MutationQueryKey } from "@compill/api";
|
|
2
|
-
import { ButtonProps } from "@valerya/ui";
|
|
3
|
-
interface ActionButtonProps {
|
|
4
|
-
label: string;
|
|
5
|
-
buttonProps?: ButtonProps;
|
|
6
|
-
icon?: string;
|
|
7
|
-
queryKey: MutationQueryKey;
|
|
8
|
-
queryFn: MutationQueryFn<any, any>;
|
|
9
|
-
successMsg?: string;
|
|
10
|
-
errorMsg?: string;
|
|
11
|
-
invalidateParent?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare function ActionButton({ label, buttonProps, icon, queryKey, queryFn, successMsg, errorMsg, invalidateParent }: ActionButtonProps): JSX.Element;
|
|
14
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@soperio/jsx-runtime";
|
|
2
|
-
import { useApiMutation, useInvalidateParentMutation, useMutate } from "@compill/api";
|
|
3
|
-
import { Button, Icon } from "@valerya/ui";
|
|
4
|
-
export function ActionButton({ label, buttonProps, icon, queryKey, queryFn, successMsg, errorMsg, invalidateParent }) {
|
|
5
|
-
const mutation = invalidateParent ? useInvalidateParentMutation(queryFn, queryKey) : useApiMutation(queryFn, queryKey);
|
|
6
|
-
const mutate = useMutate(mutation, {
|
|
7
|
-
successMsg,
|
|
8
|
-
errorMsg
|
|
9
|
-
});
|
|
10
|
-
return (_jsxs(Button, { display: "flex", alignItems: "center", gap: "3", ...buttonProps, onClick: mutate, disabled: mutation.isLoading, children: [icon && _jsx(Icon, { path: icon }), label] }));
|
|
11
|
-
}
|