@compill/admin 1.0.70 → 1.0.72
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/index.cjs.js +18 -11
- package/index.esm.js +18 -11
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/json/DetailsView.d.ts +1 -1
- package/src/lib/json/types/DetailsView.d.ts +1 -0
- package/src/lib/layout/menu/MenuItem.d.ts +1 -1
- package/src/lib/layout/menu/NextMenuItem.d.ts +1 -1
package/index.cjs.js
CHANGED
@@ -18,10 +18,10 @@ var react = require('@soperio/react');
|
|
18
18
|
var editor = require('@compill/editor');
|
19
19
|
var admin = require('@compill/admin');
|
20
20
|
var reactDom = require('react-dom');
|
21
|
+
var router = require('next/router');
|
21
22
|
var table = require('@compill/table');
|
22
23
|
var hooks = require('@compill/hooks');
|
23
24
|
var env = require('@compill/env');
|
24
|
-
var router = require('next/router');
|
25
25
|
var reactQuery = require('@tanstack/react-query');
|
26
26
|
var Image = require('next/image');
|
27
27
|
|
@@ -1135,18 +1135,27 @@ function Buttons$1({
|
|
1135
1135
|
});
|
1136
1136
|
}
|
1137
1137
|
|
1138
|
+
function useQueryField(queryField, useNextRouter) {
|
1139
|
+
if (useNextRouter) {
|
1140
|
+
const router$1 = router.useRouter();
|
1141
|
+
return router$1.query[queryField];
|
1142
|
+
}
|
1143
|
+
const {
|
1144
|
+
[queryField]: id
|
1145
|
+
} = reactRouterDom.useParams();
|
1146
|
+
return id;
|
1147
|
+
}
|
1138
1148
|
function DetailsView(_a) {
|
1139
1149
|
var {
|
1140
1150
|
queryField,
|
1141
1151
|
api,
|
1152
|
+
useNextRouter,
|
1142
1153
|
processInput,
|
1143
1154
|
screen,
|
1144
1155
|
tabbed
|
1145
1156
|
} = _a,
|
1146
|
-
props = __rest$1(_a, ["queryField", "api", "processInput", "screen", "tabbed"]);
|
1147
|
-
const
|
1148
|
-
[queryField]: id
|
1149
|
-
} = reactRouterDom.useParams();
|
1157
|
+
props = __rest$1(_a, ["queryField", "api", "useNextRouter", "processInput", "screen", "tabbed"]);
|
1158
|
+
const id = useQueryField(queryField, useNextRouter);
|
1150
1159
|
const ref = React__default["default"].useRef(null);
|
1151
1160
|
return jsxRuntime.jsx(PageQueryStateContainer, Object.assign({
|
1152
1161
|
api: api,
|
@@ -2895,10 +2904,9 @@ function MenuItem(_a) {
|
|
2895
2904
|
path,
|
2896
2905
|
depth,
|
2897
2906
|
darkMode,
|
2898
|
-
subMenu
|
2899
|
-
children
|
2907
|
+
subMenu
|
2900
2908
|
} = _a,
|
2901
|
-
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"
|
2909
|
+
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"]);
|
2902
2910
|
const location = reactRouterDom.useLocation();
|
2903
2911
|
const selected = path == "/" ? location.pathname == "/" : location.pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
|
2904
2912
|
const match = reactRouterDom.useMatch("/" + path) != null;
|
@@ -2934,10 +2942,9 @@ function NextMenuItem(_a) {
|
|
2934
2942
|
path,
|
2935
2943
|
depth,
|
2936
2944
|
darkMode,
|
2937
|
-
subMenu
|
2938
|
-
children
|
2945
|
+
subMenu
|
2939
2946
|
} = _a,
|
2940
|
-
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"
|
2947
|
+
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"]);
|
2941
2948
|
const {
|
2942
2949
|
pathname
|
2943
2950
|
} = router.useRouter();
|
package/index.esm.js
CHANGED
@@ -14,10 +14,10 @@ import { createContext as createContext$1, runIfFn, isFunction } from '@soperio/
|
|
14
14
|
import { Editor } from '@compill/editor';
|
15
15
|
import { PageSectionTitle as PageSectionTitle$1, ButtonBarDialogButton as ButtonBarDialogButton$1, TableRowActionButton as TableRowActionButton$1, DialogButton as DialogButton$1 } from '@compill/admin';
|
16
16
|
import { createPortal } from 'react-dom';
|
17
|
+
import { useRouter } from 'next/router';
|
17
18
|
import { TableContextProvider, useTableContext, Table } from '@compill/table';
|
18
19
|
import { useOpenLink, useBoolean } from '@compill/hooks';
|
19
20
|
import { Env } from '@compill/env';
|
20
|
-
import { useRouter } from 'next/router';
|
21
21
|
import { useQueryClient } from '@tanstack/react-query';
|
22
22
|
import Image from 'next/image';
|
23
23
|
|
@@ -1125,18 +1125,27 @@ function Buttons$1({
|
|
1125
1125
|
});
|
1126
1126
|
}
|
1127
1127
|
|
1128
|
+
function useQueryField(queryField, useNextRouter) {
|
1129
|
+
if (useNextRouter) {
|
1130
|
+
const router = useRouter();
|
1131
|
+
return router.query[queryField];
|
1132
|
+
}
|
1133
|
+
const {
|
1134
|
+
[queryField]: id
|
1135
|
+
} = useParams();
|
1136
|
+
return id;
|
1137
|
+
}
|
1128
1138
|
function DetailsView(_a) {
|
1129
1139
|
var {
|
1130
1140
|
queryField,
|
1131
1141
|
api,
|
1142
|
+
useNextRouter,
|
1132
1143
|
processInput,
|
1133
1144
|
screen,
|
1134
1145
|
tabbed
|
1135
1146
|
} = _a,
|
1136
|
-
props = __rest$1(_a, ["queryField", "api", "processInput", "screen", "tabbed"]);
|
1137
|
-
const
|
1138
|
-
[queryField]: id
|
1139
|
-
} = useParams();
|
1147
|
+
props = __rest$1(_a, ["queryField", "api", "useNextRouter", "processInput", "screen", "tabbed"]);
|
1148
|
+
const id = useQueryField(queryField, useNextRouter);
|
1140
1149
|
const ref = React.useRef(null);
|
1141
1150
|
return jsx(PageQueryStateContainer, Object.assign({
|
1142
1151
|
api: api,
|
@@ -2885,10 +2894,9 @@ function MenuItem(_a) {
|
|
2885
2894
|
path,
|
2886
2895
|
depth,
|
2887
2896
|
darkMode,
|
2888
|
-
subMenu
|
2889
|
-
children
|
2897
|
+
subMenu
|
2890
2898
|
} = _a,
|
2891
|
-
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"
|
2899
|
+
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"]);
|
2892
2900
|
const location = useLocation();
|
2893
2901
|
const selected = path == "/" ? location.pathname == "/" : location.pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
|
2894
2902
|
const match = useMatch("/" + path) != null;
|
@@ -2924,10 +2932,9 @@ function NextMenuItem(_a) {
|
|
2924
2932
|
path,
|
2925
2933
|
depth,
|
2926
2934
|
darkMode,
|
2927
|
-
subMenu
|
2928
|
-
children
|
2935
|
+
subMenu
|
2929
2936
|
} = _a,
|
2930
|
-
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"
|
2937
|
+
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu"]);
|
2931
2938
|
const {
|
2932
2939
|
pathname
|
2933
2940
|
} = useRouter();
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
@@ -21,6 +21,7 @@ export * from "./lib/json/types/TableView";
|
|
21
21
|
export * from "./lib/layout/AdminLayout";
|
22
22
|
export * from "./lib/layout/ButtonBar";
|
23
23
|
export * from "./lib/layout/menu/Menu";
|
24
|
+
export * from "./lib/layout/menu/MenuConfig";
|
24
25
|
export * from "./lib/modal/AttachDialog";
|
25
26
|
export * from "./lib/modal/FormActionDialog";
|
26
27
|
export * from "./lib/page/PageContainer";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { SoperioComponent } from "@soperio/react";
|
3
3
|
import { DetailsViewConfig } from "./types/DetailsView";
|
4
|
-
export declare function DetailsView({ queryField, api, processInput, screen, tabbed, ...props }: DetailsViewConfig & {
|
4
|
+
export declare function DetailsView({ queryField, api, useNextRouter, processInput, screen, tabbed, ...props }: DetailsViewConfig & {
|
5
5
|
tabbed?: boolean;
|
6
6
|
} & SoperioComponent): JSX.Element;
|
@@ -8,5 +8,5 @@ interface MenuItemProps extends SoperioComponent, ParentComponent {
|
|
8
8
|
darkMode?: boolean;
|
9
9
|
subMenu?: Item[];
|
10
10
|
}
|
11
|
-
export declare function MenuItem({ icon, path, depth, darkMode, subMenu,
|
11
|
+
export declare function MenuItem({ icon, path, depth, darkMode, subMenu, ...props }: MenuItemProps): JSX.Element;
|
12
12
|
export {};
|
@@ -8,5 +8,5 @@ interface NextMenuItemProps extends SoperioComponent, ParentComponent {
|
|
8
8
|
darkMode?: boolean;
|
9
9
|
subMenu?: Item[];
|
10
10
|
}
|
11
|
-
export declare function NextMenuItem({ icon, path, depth, darkMode, subMenu,
|
11
|
+
export declare function NextMenuItem({ icon, path, depth, darkMode, subMenu, ...props }: NextMenuItemProps): JSX.Element;
|
12
12
|
export {};
|