@irontec/ivoz-ui 1.7.0 → 1.7.3

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, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
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
- 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'), " ", _jsx("strong", { children: iden })] }), open: showDelete, doubleCheck: entity.deleteDoubleCheck || false, doubleCheckExpectedStr: iden, handleClose: handleHideDelete, handleApply: handleDelete })] }));
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;
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import AddIcon from '@mui/icons-material/Add';
3
3
  import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
4
4
  import { Box, useMediaQuery, useTheme } from '@mui/material';
5
- import { memo, useEffect, useState } from 'react';
5
+ import { memo, useEffect, useMemo, useState } from 'react';
6
6
  import { LightButton, TonalButton, } from '../../../../components/shared/Button/Button.styles';
7
7
  import { isPropertyFk, isPropertyScalar, } from '../../../../services/api/ParsedApiSpecInterface';
8
8
  import { StyledDropdown } from '../../../../services/form/Field/Dropdown/Dropdown.styles';
@@ -18,13 +18,16 @@ export default function ContentFilterRow(props) {
18
18
  if (!filters[name]) {
19
19
  return null;
20
20
  }
21
- const filterChoices = {};
22
- for (const filter of filters[name]) {
23
- filterChoices[filter] = FilterIconFactory({
24
- name: filter,
25
- includeLabel: true,
26
- });
27
- }
21
+ const filterChoices = useMemo(() => {
22
+ const choices = {};
23
+ for (const filter of filters[name]) {
24
+ choices[filter] = FilterIconFactory({
25
+ name: filter,
26
+ includeLabel: true,
27
+ });
28
+ }
29
+ return choices;
30
+ }, [filters, name]);
28
31
  const [type, setType] = useState(row.type);
29
32
  const [value, setValue] = useState(row.value);
30
33
  useEffect(() => {
@@ -74,7 +77,7 @@ export default function ContentFilterRow(props) {
74
77
  setValue('');
75
78
  }, onBlur: () => {
76
79
  /* noop */
77
- }, choices: fieldNames, error: false, errorMsg: '', hasChanged: false }), _jsx(StyledDropdownMemo, { name: 'type', label: '', value: type, required: false, disabled: false, onChange: ({ target }) => {
80
+ }, choices: fieldNames, error: false, errorMsg: '', hasChanged: false }), _jsx(StyledDropdown, { name: 'type', label: '', value: type, required: false, disabled: false, onChange: ({ target }) => {
78
81
  setType(target.value);
79
82
  }, onBlur: () => {
80
83
  /* noop */
@@ -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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@irontec/ivoz-ui",
3
- "version": "1.7.0",
3
+ "version": "1.7.3",
4
4
  "description": "UI library used in ivozprovider",
5
5
  "license": "GPL-3.0",
6
6
  "main": "index.js",