@irontec/ivoz-ui 1.5.2 → 1.6.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.
@@ -3,8 +3,9 @@ import { Link } from 'react-router-dom';
3
3
  import _ from '../../../services/translations/translate';
4
4
  import { SolidButton } from '../../shared/Button/Button.styles';
5
5
  import { useTranslation } from 'react-i18next';
6
- import { Fade } from '@mui/material';
6
+ import { Box, Fade } from '@mui/material';
7
7
  import { useStoreState } from '../../../store';
8
+ import { MultiselectMoreChildEntityLinks } from './Shared/MultiselectMoreChildEntityLinks';
8
9
  export const Empty = (props) => {
9
10
  const { entityService, className } = props;
10
11
  const { t } = useTranslation();
@@ -22,10 +23,17 @@ export const Empty = (props) => {
22
23
  singularTitle = t(translationKey, { count: 1 }).toLowerCase();
23
24
  pluralTitle = t(translationKey, { count: 2 }).toLowerCase();
24
25
  }
26
+ const globalActions = Object.values(entity.customActions).filter((action) => action.global);
25
27
  return (_jsx(Fade, Object.assign({ in: true, style: {
26
28
  transitionDelay: '750ms',
27
29
  }, unmountOnExit: true }, { children: _jsxs("section", Object.assign({ className: className }, { children: [_jsx("img", { src: 'assets/img/empty.svg', alt: '' }), _jsx("h3", { children: _('No {{entity}} yet', { entity: pluralTitle }) }), _jsx("p", { children: _('You haven’t created any {{entity}} yet.', {
28
30
  entity: singularTitle,
29
- }) }), create && (_jsx(Link, Object.assign({ to: location.pathname + '/create' }, { children: _jsx(SolidButton, { children: _('New {{entity}}', { entity: singularTitle }) }) })))] })) })));
31
+ }) }), create && (_jsxs(Box, Object.assign({ className: 'empty-actions' }, { children: [globalActions &&
32
+ globalActions.length < 2 &&
33
+ globalActions
34
+ .map((item) => item.action)
35
+ .map((Action, key) => {
36
+ return (_jsx(Action, { rows: [], selectedValues: [], entityService: entityService }, key));
37
+ }), globalActions && globalActions.length > 1 && (_jsx(MultiselectMoreChildEntityLinks, { childActions: globalActions, selectedValues: [], rows: [], entityService: entityService })), _jsx(Link, Object.assign({ to: location.pathname + '/create' }, { children: _jsx(SolidButton, { children: _('New {{entity}}', { entity: singularTitle }) }) }))] })))] })) })));
30
38
  };
31
39
  export default Empty;
@@ -20,5 +20,12 @@ export const StyledEmpty = styled(Empty)(() => {
20
20
  '& img': {
21
21
  maxWidth: '100%',
22
22
  },
23
+ '& .empty-actions': {
24
+ display: 'flex',
25
+ flexDirection: 'row',
26
+ '& a': {
27
+ marginLeft: '8px',
28
+ },
29
+ },
23
30
  };
24
31
  });
@@ -23,7 +23,7 @@ import useFirstColumn from './Content/hook/useFirstColumn';
23
23
  import { criteriaToArray, queryStringToCriteria } from './List.helpers';
24
24
  import useQueryStringParams from './useQueryStringParams';
25
25
  const List = function (props) {
26
- const { path, foreignKeyResolver, entityService, routeMap, className, List: EntityListDecorator, } = props;
26
+ const { path, foreignKeyResolver, entityService, routeMap, className, List: EntityListDecorator } = props;
27
27
  const location = useLocation();
28
28
  const match = useCurrentPathMatch();
29
29
  const params = useParams();
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ListContent } from '../../components/List/Content/';
3
3
  const List = (props) => {
4
- return _jsx(ListContent, Object.assign({}, props));
4
+ return (_jsx(ListContent, Object.assign({}, props)));
5
5
  };
6
6
  export default List;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@irontec/ivoz-ui",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "description": "UI library used in ivozprovider",
5
5
  "license": "GPL-3.0",
6
6
  "main": "index.js",