@irontec/ivoz-ui 1.4.6 → 1.5.0
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/components/List/List.d.ts +2 -2
- package/components/List/List.js +4 -5
- package/components/List/List.styles.d.ts +1 -1
- package/entities/DefaultEntityBehavior/List.d.ts +4 -0
- package/entities/DefaultEntityBehavior/List.js +6 -0
- package/entities/DefaultEntityBehavior.d.ts +1 -0
- package/entities/DefaultEntityBehavior.js +2 -0
- package/entities/EntityInterface.d.ts +2 -0
- package/package.json +1 -1
- package/store/list.d.ts +2 -0
- package/store/list.js +5 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { foreignKeyResolverType } from '../../entities/EntityInterface';
|
|
2
|
+
import EntityInterface, { foreignKeyResolverType } from '../../entities/EntityInterface';
|
|
3
3
|
import { RouteMap } from '../../router/routeMapParser';
|
|
4
4
|
import EntityService from '../../services/entity/EntityService';
|
|
5
|
-
declare type ListProps = {
|
|
5
|
+
export declare type ListProps = EntityInterface & {
|
|
6
6
|
path: string;
|
|
7
7
|
routeMap: RouteMap;
|
|
8
8
|
entityService: EntityService;
|
package/components/List/List.js
CHANGED
|
@@ -16,15 +16,14 @@ import useCancelToken from '../../hooks/useCancelToken';
|
|
|
16
16
|
import useCurrentPathMatch from '../../hooks/useCurrentPathMatch';
|
|
17
17
|
import useRouteChain from '../../hooks/useRouteChain';
|
|
18
18
|
import findRoute from '../../router/findRoute';
|
|
19
|
+
import { isPropertyFk } from '../../services';
|
|
19
20
|
import { useStoreActions, useStoreState } from '../../store';
|
|
20
21
|
import ErrorMessage from '../shared/ErrorMessage';
|
|
21
|
-
import
|
|
22
|
+
import useFirstColumn from './Content/hook/useFirstColumn';
|
|
22
23
|
import { criteriaToArray, queryStringToCriteria } from './List.helpers';
|
|
23
24
|
import useQueryStringParams from './useQueryStringParams';
|
|
24
|
-
import useFirstColumn from './Content/hook/useFirstColumn';
|
|
25
|
-
import { isPropertyFk } from '../../services';
|
|
26
25
|
const List = function (props) {
|
|
27
|
-
const { path, foreignKeyResolver, entityService, routeMap, className } = props;
|
|
26
|
+
const { path, foreignKeyResolver, entityService, routeMap, className, List: EntityListDecorator, } = props;
|
|
28
27
|
const location = useLocation();
|
|
29
28
|
const match = useCurrentPathMatch();
|
|
30
29
|
const params = useParams();
|
|
@@ -234,6 +233,6 @@ const List = function (props) {
|
|
|
234
233
|
return null;
|
|
235
234
|
}
|
|
236
235
|
const empty = (!rows || rows.length === 0) && queryStringCriteria.length === 0;
|
|
237
|
-
return (_jsx("div", Object.assign({ className: className }, { children: _jsxs(ErrorBoundary, { children: [_jsx(
|
|
236
|
+
return (_jsx("div", Object.assign({ className: className }, { children: _jsxs(ErrorBoundary, { children: [_jsx(EntityListDecorator, { empty: empty, childEntities: (currentRoute === null || currentRoute === void 0 ? void 0 : currentRoute.children) || [], path: path, ignoreColumn: ignoreColumn, preloadData: preload, entityService: entityService, cancelToken: cancelToken, match: match, routeChain: routeChain, location: location }), reqError && _jsx(ErrorMessage, { message: reqError })] }) })));
|
|
238
237
|
};
|
|
239
238
|
export default List;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Theme } from '@mui/material';
|
|
2
|
-
export declare const StyledList: import("@mui/styles").StyledComponent<Omit<{
|
|
2
|
+
export declare const StyledList: import("@mui/styles").StyledComponent<Omit<import("../../entities/EntityInterface").default & {
|
|
3
3
|
path: string;
|
|
4
4
|
routeMap: import("../..").RouteMap<import("../..").RouteMapItem>;
|
|
5
5
|
entityService: import("../../services/entity/EntityService").default<import("easy-peasy").StateMapper<import("easy-peasy").FilterActionTypes<import("../..").IvozStore>>>;
|
|
@@ -38,6 +38,7 @@ declare const DefaultEntityBehavior: {
|
|
|
38
38
|
properties: {};
|
|
39
39
|
acl: EntityAclType;
|
|
40
40
|
calculateAclByParentRow: calculateAclType;
|
|
41
|
+
List: (props: import("../components/List/Content/ListContent").ListContentProps) => JSX.Element | null;
|
|
41
42
|
ListDecorator: import("./EntityInterface").ListDecoratorType;
|
|
42
43
|
ChildDecorator: React.NamedExoticComponent<React.PropsWithChildren<ChildDecoratorProps>>;
|
|
43
44
|
customActions: {};
|
|
@@ -22,6 +22,7 @@ import marshaller from './DefaultEntityBehavior/Marshaller';
|
|
|
22
22
|
import unmarshaller from './DefaultEntityBehavior/Unmarshaller';
|
|
23
23
|
import validator from './DefaultEntityBehavior/Validator';
|
|
24
24
|
import View from './DefaultEntityBehavior/View';
|
|
25
|
+
import List from './DefaultEntityBehavior/List';
|
|
25
26
|
export const initialValues = {};
|
|
26
27
|
export const columns = [];
|
|
27
28
|
export const properties = {};
|
|
@@ -77,6 +78,7 @@ const DefaultEntityBehavior = {
|
|
|
77
78
|
properties,
|
|
78
79
|
acl,
|
|
79
80
|
calculateAclByParentRow,
|
|
81
|
+
List,
|
|
80
82
|
ListDecorator,
|
|
81
83
|
ChildDecorator: ChildDecoratorMemo,
|
|
82
84
|
customActions: {},
|
|
@@ -8,6 +8,7 @@ import { PartialPropertyList, PropertySpec } from '../services/api/ParsedApiSpec
|
|
|
8
8
|
import EntityService, { EntityValues, VisualToggleStates } from '../services/entity/EntityService';
|
|
9
9
|
import { EntityFormProps, FkChoices, fetchFksType } from './DefaultEntityBehavior';
|
|
10
10
|
import { IvozStoreState } from 'store';
|
|
11
|
+
import { ListContentProps } from '../components/List/Content/ListContent';
|
|
11
12
|
export declare type ListDecoratorPropsType = {
|
|
12
13
|
field: string;
|
|
13
14
|
row: any;
|
|
@@ -91,6 +92,7 @@ export default interface EntityInterface {
|
|
|
91
92
|
selectOptions?: () => Promise<SelectOptionsType>;
|
|
92
93
|
Form: () => Promise<React.FunctionComponent<EntityFormProps>>;
|
|
93
94
|
View: () => Promise<ViewType>;
|
|
95
|
+
List: React.FunctionComponent<ListContentProps>;
|
|
94
96
|
ListDecorator: ListDecoratorType;
|
|
95
97
|
ChildDecorator: ChildDecoratorType;
|
|
96
98
|
customActions: CustomActionsType;
|
package/package.json
CHANGED
package/store/list.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface ListState {
|
|
|
8
8
|
reloadTimestamp: number;
|
|
9
9
|
parentRow: EntityValues | undefined;
|
|
10
10
|
rows: Array<EntityValues>;
|
|
11
|
+
customData: undefined | unknown;
|
|
11
12
|
headers: Record<string, string>;
|
|
12
13
|
fkChoices: FkChoicesType;
|
|
13
14
|
}
|
|
@@ -15,6 +16,7 @@ interface ListActions {
|
|
|
15
16
|
reload: Action<ListState>;
|
|
16
17
|
setParentRow: Action<ListState, undefined | EntityValues>;
|
|
17
18
|
setRows: Action<ListState, Array<EntityValues>>;
|
|
19
|
+
setCustomData: Action<ListState, unknown>;
|
|
18
20
|
setHeaders: Action<ListState, Record<string, string>>;
|
|
19
21
|
setFkChoices: Action<ListState, FkChoicesType>;
|
|
20
22
|
reset: Thunk<ListState, undefined, unknown>;
|
package/store/list.js
CHANGED
|
@@ -12,6 +12,7 @@ const list = {
|
|
|
12
12
|
reloadTimestamp: 0,
|
|
13
13
|
parentRow: undefined,
|
|
14
14
|
rows: [],
|
|
15
|
+
customData: undefined,
|
|
15
16
|
headers: {},
|
|
16
17
|
fkChoices: {},
|
|
17
18
|
// actions
|
|
@@ -24,6 +25,9 @@ const list = {
|
|
|
24
25
|
setRows: action((state, rows) => {
|
|
25
26
|
state.rows = [...rows];
|
|
26
27
|
}),
|
|
28
|
+
setCustomData: action((state, customData) => {
|
|
29
|
+
state.customData = customData;
|
|
30
|
+
}),
|
|
27
31
|
setHeaders: action((state, headers) => {
|
|
28
32
|
state.headers = Object.assign({}, headers);
|
|
29
33
|
}),
|
|
@@ -33,6 +37,7 @@ const list = {
|
|
|
33
37
|
// thunks
|
|
34
38
|
reset: thunk((actions) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
39
|
actions.setRows([]);
|
|
40
|
+
actions.setCustomData(undefined);
|
|
36
41
|
actions.setHeaders({});
|
|
37
42
|
actions.setFkChoices({});
|
|
38
43
|
})),
|