@irontec/ivoz-ui 1.7.0 → 1.7.2
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.
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { jsx as _jsx,
|
|
10
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { Tooltip } from '@mui/material';
|
|
12
12
|
import { useState } from 'react';
|
|
13
13
|
import ConfirmDialog from '../../../../components/shared/ConfirmDialog';
|
|
@@ -49,6 +49,13 @@ const DeleteRowButton = (props) => {
|
|
|
49
49
|
});
|
|
50
50
|
const entity = entityService.getEntity();
|
|
51
51
|
const iden = entity.toStr(row);
|
|
52
|
-
|
|
52
|
+
const isIdenInt = Number.isInteger(parseInt(iden, 10));
|
|
53
|
+
const printStrongIden = () => {
|
|
54
|
+
if (!isIdenInt) {
|
|
55
|
+
return _jsx("strong", { children: iden });
|
|
56
|
+
}
|
|
57
|
+
return _jsx(_Fragment, {});
|
|
58
|
+
};
|
|
59
|
+
return (_jsxs(_Fragment, { children: [variant === 'icon' && (_jsx(Tooltip, Object.assign({ title: _('Delete'), placement: 'bottom', enterTouchDelay: 0, arrow: true }, { children: _jsx("span", { children: _jsx(LightButton, Object.assign({ disabled: disabled, onClick: () => !disabled && setShowDelete(true) }, { children: _jsx(StyledDeleteIcon, {}) })) }) }))), variant === 'text' && (_jsx(MoreMenuItem, Object.assign({ className: disabled ? 'disabled' : '', onClick: () => !disabled && setShowDelete(true) }, { children: _('Delete') }))), _jsx(ConfirmDialog, { text: _jsxs("span", { children: [_('You are about to remove'), " ", printStrongIden()] }), open: showDelete, doubleCheck: entity.deleteDoubleCheck || false, doubleCheckExpectedStr: iden, handleClose: handleHideDelete, handleApply: handleDelete })] }));
|
|
53
60
|
};
|
|
54
61
|
export default DeleteRowButton;
|
|
@@ -22,6 +22,11 @@ export default function ConfirmDialog(props) {
|
|
|
22
22
|
const val = event.target.value;
|
|
23
23
|
setInputVal(val || '');
|
|
24
24
|
}, []);
|
|
25
|
+
const handleKeyDown = (event) => {
|
|
26
|
+
if (event.key === 'Tab') {
|
|
27
|
+
event.stopPropagation();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
25
30
|
const sumbitEnabled = !doubleCheck || inputVal == doubleCheckExpectedStr;
|
|
26
|
-
return (_jsxs(Dialog, Object.assign({ open: open, TransitionComponent: Transition, keepMounted: true, onClose: handleClose, "aria-labelledby": 'alert-dialog-slide-title', "aria-describedby": 'alert-dialog-slide-description' }, { children: [_jsx(CloseRoundedIcon, { className: 'close-icon', onClick: handleClose }), _jsx("img", { src: 'assets/img/delete-dialog.svg', className: 'modal-icon' }), _jsx(DialogTitle, Object.assign({ id: 'alert-dialog-slide-title' }, { children: _('Remove element') })), _jsxs(DialogContent, { children: [_jsx(DialogContentText, Object.assign({ id: 'alert-dialog-slide-description' }, { children: text })), doubleCheck && (_jsx(StyledDialogContentText, Object.assign({ id: 'alert-dialog-double-check-description' }, { children: _('Please type the item name, as shown in bold font above, to continue') }))), doubleCheck && (_jsx(StyledSearchTextField, { type: 'text', hasChanged: false, defaultValue: inputVal, onChange: onChangeHandler }))] }), _jsxs(DialogActions, { children: [_jsx(OutlinedButton, Object.assign({ onClick: handleClose, sx: { flexGrow: '1' }, color: 'error' }, { children: _('No, keep it') })), _jsx(SolidButton, Object.assign({ disabled: !sumbitEnabled, onClick: handleApply, sx: { flexGrow: '1' }, color: 'error' }, { children: _('Yes, delete it') }))] })] })));
|
|
31
|
+
return (_jsxs(Dialog, Object.assign({ open: open, TransitionComponent: Transition, keepMounted: true, onClose: handleClose, "aria-labelledby": 'alert-dialog-slide-title', "aria-describedby": 'alert-dialog-slide-description', onKeyDown: handleKeyDown }, { children: [_jsx(CloseRoundedIcon, { className: 'close-icon', onClick: handleClose }), _jsx("img", { src: 'assets/img/delete-dialog.svg', className: 'modal-icon' }), _jsx(DialogTitle, Object.assign({ id: 'alert-dialog-slide-title' }, { children: _('Remove element') })), _jsxs(DialogContent, { children: [_jsx(DialogContentText, Object.assign({ id: 'alert-dialog-slide-description' }, { children: text })), doubleCheck && (_jsx(StyledDialogContentText, Object.assign({ id: 'alert-dialog-double-check-description' }, { children: _('Please type the item name, as shown in bold font above, to continue') }))), doubleCheck && (_jsx(StyledSearchTextField, { type: 'text', hasChanged: false, defaultValue: inputVal, onChange: onChangeHandler }))] }), _jsxs(DialogActions, { children: [_jsx(OutlinedButton, Object.assign({ onClick: handleClose, sx: { flexGrow: '1' }, color: 'error' }, { children: _('No, keep it') })), _jsx(SolidButton, Object.assign({ disabled: !sumbitEnabled, onClick: handleApply, sx: { flexGrow: '1' }, color: 'error' }, { children: _('Yes, delete it') }))] })] })));
|
|
27
32
|
}
|
|
@@ -17,6 +17,11 @@ export const ConfirmEditionDialog = (props) => {
|
|
|
17
17
|
const { open, handleClose, text, handleSave, formEvent } = props;
|
|
18
18
|
const TOTAL_TIME = 100;
|
|
19
19
|
const [progress, setProgress] = useState(TOTAL_TIME);
|
|
20
|
+
const handleKeyDown = (event) => {
|
|
21
|
+
if (event.key === 'Tab') {
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
20
25
|
useEffect(() => {
|
|
21
26
|
let timer = null;
|
|
22
27
|
if (open) {
|
|
@@ -36,7 +41,7 @@ export const ConfirmEditionDialog = (props) => {
|
|
|
36
41
|
}
|
|
37
42
|
};
|
|
38
43
|
}, [open]);
|
|
39
|
-
return (_jsxs(Dialog, Object.assign({ open: open, TransitionComponent: Transition, keepMounted: true, onClose: handleClose, "aria-labelledby": 'alert-dialog-slide-title', "aria-describedby": 'alert-dialog-slide-description' }, { children: [_jsx(CloseRoundedIcon, { className: 'close-icon', onClick: handleClose }), _jsx("img", { src: 'assets/img/warning-dialog.svg', className: 'modal-icon' }), _jsx(DialogTitle, Object.assign({ id: 'alert-dialog-slide-title' }, { children: _('Save element') })), _jsxs(DialogContent, { children: [_jsx(DialogContentText, Object.assign({ id: 'alert-dialog-slide-description' }, { children: text })), _jsx(LinearProgress, { variant: 'determinate', value: progress })] }), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: () => {
|
|
44
|
+
return (_jsxs(Dialog, Object.assign({ open: open, TransitionComponent: Transition, keepMounted: true, onClose: handleClose, onKeyDown: handleKeyDown, "aria-labelledby": 'alert-dialog-slide-title', "aria-describedby": 'alert-dialog-slide-description' }, { children: [_jsx(CloseRoundedIcon, { className: 'close-icon', onClick: handleClose }), _jsx("img", { src: 'assets/img/warning-dialog.svg', className: 'modal-icon' }), _jsx(DialogTitle, Object.assign({ id: 'alert-dialog-slide-title' }, { children: _('Save element') })), _jsxs(DialogContent, { children: [_jsx(DialogContentText, Object.assign({ id: 'alert-dialog-slide-description' }, { children: text })), _jsx(LinearProgress, { variant: 'determinate', value: progress })] }), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: () => {
|
|
40
45
|
handleClose();
|
|
41
46
|
} }, { children: "Cancel" })), _jsx(Button, Object.assign({ hidden: progress !== 0, onClick: () => {
|
|
42
47
|
if (formEvent) {
|