@irontec/ivoz-ui 1.3.16 → 1.3.17
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.
|
@@ -5,6 +5,7 @@ import DeleteRowButton from '../CTA/DeleteRowButton';
|
|
|
5
5
|
import ChildEntityLink from './ChildEntityLink';
|
|
6
6
|
import { MoreChildEntityLinks } from './MoreChildEntityLinks';
|
|
7
7
|
const ChildEntityLinks = (props) => {
|
|
8
|
+
var _a;
|
|
8
9
|
const { entityService, childEntities, row, detail, edit, deleteMapItem } = props;
|
|
9
10
|
const match = useCurrentPathMatch();
|
|
10
11
|
const entity = entityService.getEntity();
|
|
@@ -16,6 +17,7 @@ const ChildEntityLinks = (props) => {
|
|
|
16
17
|
const childEntitiesCopy = [...childEntities];
|
|
17
18
|
const visibleChildEntitiesSlice = childEntitiesCopy.length <= 2 ? 3 : 2;
|
|
18
19
|
const visibleChildEntities = childEntitiesCopy.splice(0, visibleChildEntitiesSlice - firstActionButtonNum);
|
|
20
|
+
const isEditable = (_a = row.editable) !== null && _a !== void 0 ? _a : true;
|
|
19
21
|
return (_jsxs(_Fragment, { children: [detail, edit, visibleChildEntities.map((routeMapItem, key) => {
|
|
20
22
|
if (isActionItem(routeMapItem) &&
|
|
21
23
|
isSingleRowActionItem(routeMapItem, routeMapItem.action)) {
|
|
@@ -25,6 +27,6 @@ const ChildEntityLinks = (props) => {
|
|
|
25
27
|
return null;
|
|
26
28
|
}
|
|
27
29
|
return (_jsx(ChildDecorator, Object.assign({ variant: 'icon', routeMapItem: routeMapItem, row: row, entityService: entityService, disabled: routeMapItem.disabled }, { children: _jsx(ChildEntityLink, { routeMapItem: routeMapItem, row: row }) }), key));
|
|
28
|
-
}), childEntitiesCopy.length === 0 && deleteMapItem && (_jsx(ChildDecorator, Object.assign({ variant: 'icon', routeMapItem: deleteMapItem, row: row, entityService: entityService, disabled: deleteMapItem.disabled }, { children: _jsx(DeleteRowButton, { disabled: deleteMapItem.disabled, row: row, entityService: entityService }) }))), childEntitiesCopy.length > 0 && (_jsx(MoreChildEntityLinks, { childEntities: childEntitiesCopy, row: row, entityService: entityService, deleteMapItem: deleteMapItem }))] }));
|
|
30
|
+
}), childEntitiesCopy.length === 0 && deleteMapItem && (_jsx(ChildDecorator, Object.assign({ variant: 'icon', routeMapItem: deleteMapItem, row: row, entityService: entityService, disabled: deleteMapItem.disabled || !isEditable }, { children: _jsx(DeleteRowButton, { disabled: deleteMapItem.disabled || !isEditable, row: row, entityService: entityService }) }))), childEntitiesCopy.length > 0 && (_jsx(MoreChildEntityLinks, { childEntities: childEntitiesCopy, row: row, entityService: entityService, deleteMapItem: deleteMapItem }))] }));
|
|
29
31
|
};
|
|
30
32
|
export default ChildEntityLinks;
|
|
@@ -8,10 +8,12 @@ import buildLink from './BuildLink';
|
|
|
8
8
|
import { MoreChildEntityLinksWrapper } from './MoreChildEntityLinksWrapper';
|
|
9
9
|
export const MoreMenuItem = MenuItem;
|
|
10
10
|
export const MoreChildEntityLinks = (props) => {
|
|
11
|
+
var _a;
|
|
11
12
|
const { childEntities, row, entityService, deleteMapItem } = props;
|
|
12
13
|
const match = useCurrentPathMatch();
|
|
13
14
|
const entity = entityService.getEntity();
|
|
14
15
|
const ChildDecorator = entity.ChildDecorator;
|
|
16
|
+
const isEditable = (_a = row.editable) !== null && _a !== void 0 ? _a : true;
|
|
15
17
|
return (_jsxs(MoreChildEntityLinksWrapper, { children: [childEntities.map((routeMapItem, key) => {
|
|
16
18
|
var _a;
|
|
17
19
|
if (isActionItem(routeMapItem) &&
|
|
@@ -29,5 +31,5 @@ export const MoreChildEntityLinks = (props) => {
|
|
|
29
31
|
params: match.params,
|
|
30
32
|
});
|
|
31
33
|
return (_jsx(MoreMenuItem, { children: _jsx(ChildDecorator, Object.assign({ variant: 'text', routeMapItem: routeMapItem, row: row, entityService: entityService, disabled: routeMapItem.disabled }, { children: _jsx(StyledTableRowChildEntityLink, Object.assign({ to: link, parentEntity: entity, parentRow: row }, { children: title })) }), key) }, key));
|
|
32
|
-
}), deleteMapItem && (_jsx(ChildDecorator, Object.assign({ variant: 'text', routeMapItem: deleteMapItem, row: row, entityService: entityService, disabled: deleteMapItem.disabled }, { children: _jsx(DeleteRowButton, { variant: 'text', row: row, entityService: entityService, disabled: deleteMapItem === null || deleteMapItem === void 0 ? void 0 : deleteMapItem.disabled }) })))] }));
|
|
34
|
+
}), deleteMapItem && (_jsx(ChildDecorator, Object.assign({ variant: 'text', routeMapItem: deleteMapItem, row: row, entityService: entityService, disabled: deleteMapItem.disabled || !isEditable }, { children: _jsx(DeleteRowButton, { variant: 'text', row: row, entityService: entityService, disabled: (deleteMapItem === null || deleteMapItem === void 0 ? void 0 : deleteMapItem.disabled) || !isEditable }) })))] }));
|
|
33
35
|
};
|
|
@@ -53,17 +53,16 @@ const ContentTable = (props) => {
|
|
|
53
53
|
const checked = selectedValues.length > 0;
|
|
54
54
|
const showDetail = acl.detail && !acl.update;
|
|
55
55
|
return (_jsxs(StyledTable, Object.assign({ size: 'medium', className: className }, { children: [_jsx(ContentTableHead, { entityService: entityService, ignoreColumn: ignoreColumn, multiselect: multiselect, selectAll: selectAllHandlers, checked: checked, indeterminateSelectAll: checked && indeterminateSelectAll }), _jsx(TableBody, { children: rows.map((row, key) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
56
|
+
var _a, _b;
|
|
57
|
+
const checked = selectedValues.indexOf((_a = row === null || row === void 0 ? void 0 : row.id) === null || _a === void 0 ? void 0 : _a.toString()) > -1;
|
|
58
|
+
const isEditable = (_b = row.editable) !== null && _b !== void 0 ? _b : true;
|
|
59
59
|
return (_jsxs(TableRow, { children: [multiselect && (_jsx(TableCell, { children: _jsx(Checkbox, { name: `${row.id}`, checked: checked, onChange: handleChange }) })), Object.keys(columns).map((columnKey) => {
|
|
60
60
|
if (columnKey === ignoreColumn) {
|
|
61
|
-
selectableIdx++;
|
|
62
61
|
return null;
|
|
63
62
|
}
|
|
64
63
|
const column = columns[columnKey];
|
|
65
64
|
return (_jsx(TableColumnMemo, { columnName: columnKey, column: column, row: row, entityService: entityService }, columnKey));
|
|
66
|
-
}), _jsx(StyledActionsTableCell, { children: _jsx(Box, Object.assign({ className: 'actions-cell' }, { children: _jsx(ChildEntityLinks, { childEntities: childEntities, entityService: entityService, row: row, detail: showDetail && (_jsx(ChildDecorator, Object.assign({ variant: 'icon', routeMapItem: detailMapItem, row: row, entityService: entityService }, { children: _jsx(ViewRowButton, { row: row, path: path }) }))), edit: (acl.update || !showDetail) && (_jsx(ChildDecorator, Object.assign({ variant: 'icon', routeMapItem: updateRouteMapItem, row: row, entityService: entityService, disabled: !acl.update }, { children: _jsx(EditRowButton, { disabled: !acl.update, row: row, path: path }) }))), deleteMapItem: deleteMapItem }) })) }, 'actions')] }, `${key}-${row.id}`));
|
|
65
|
+
}), _jsx(StyledActionsTableCell, { children: _jsx(Box, Object.assign({ className: 'actions-cell' }, { children: _jsx(ChildEntityLinks, { childEntities: childEntities, entityService: entityService, row: row, detail: showDetail && (_jsx(ChildDecorator, Object.assign({ variant: 'icon', routeMapItem: detailMapItem, row: row, entityService: entityService }, { children: _jsx(ViewRowButton, { row: row, path: path }) }))), edit: (acl.update || !showDetail) && (_jsx(ChildDecorator, Object.assign({ variant: 'icon', routeMapItem: updateRouteMapItem, row: row, entityService: entityService, disabled: !acl.update || !isEditable }, { children: _jsx(EditRowButton, { disabled: !acl.update || !isEditable, row: row, path: path }) }))), deleteMapItem: deleteMapItem }) })) }, 'actions')] }, `${key}-${row.id}`));
|
|
67
66
|
}) })] })));
|
|
68
67
|
};
|
|
69
68
|
export default ContentTable;
|