@topconsultnpm/sdkui-react-beta 6.12.98 → 6.12.99

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.
@@ -10,6 +10,7 @@ interface ITMModal {
10
10
  resizable?: boolean;
11
11
  onClose?: () => void;
12
12
  hidePopup?: boolean;
13
+ askClosingConfirm?: boolean;
13
14
  }
14
15
  declare const TMModal: React.FC<ITMModal>;
15
16
  export default TMModal;
@@ -38,7 +38,7 @@ const StyledModalContext = styled.div `
38
38
  overflow: auto;
39
39
  height: 100%;
40
40
  `;
41
- const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClose, children, width = '100%', height = '100%', fontSize = FontSize.defaultFontSize, hidePopup = true }) => {
41
+ const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClose, children, width = '100%', height = '100%', fontSize = FontSize.defaultFontSize, hidePopup = true, askClosingConfirm = false }) => {
42
42
  const [initialWidth, setInitialWidth] = useState(width);
43
43
  const [initialHeight, setInitialHeight] = useState(height);
44
44
  const [showPopup, setShowPopup] = useState(false);
@@ -59,7 +59,7 @@ const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClos
59
59
  setInitialHeight(e.height.toString());
60
60
  };
61
61
  const onHiding = (e) => {
62
- if (isModal)
62
+ if (askClosingConfirm)
63
63
  e.cancel = true;
64
64
  if (hidePopup)
65
65
  setShowPopup(false);
@@ -514,7 +514,7 @@ const TMDcmtForm = ({ showHeader = true, onSaveRecents, layoutMode = LayoutModes
514
514
  }
515
515
  });
516
516
  };
517
- return (_jsx(_Fragment, { children: (isModal && onClose) ? _jsx(_Fragment, { children: _jsx(TMModal, { title: titleModal, onClose: handleClose, width: widthModal ?? '100%', height: heightModal ?? '100%', hidePopup: false, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block', padding: "4px" }, children: renderDcmtForm() }) }) })
517
+ return (_jsx(_Fragment, { children: (isModal && onClose) ? _jsx(_Fragment, { children: _jsx(TMModal, { title: titleModal, onClose: handleClose, width: widthModal ?? '100%', height: heightModal ?? '100%', hidePopup: false, askClosingConfirm: true, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block', padding: "4px" }, children: renderDcmtForm() }) }) })
518
518
  : renderDcmtForm() }));
519
519
  };
520
520
  export default TMDcmtForm;
@@ -11,7 +11,7 @@ import { TMColors } from '../../utils/theme';
11
11
  import TMValidationItemsList from '../grids/TMValidationItemsList';
12
12
  import TMModal from '../base/TMModal';
13
13
  import { DeviceType, useDeviceType } from '../base/TMDeviceProvider';
14
- const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipIsModifiedCheck = false, title, children, isModal, exception, customToolbarElements, hasNavigation, showSaveButton = true, showBackButton, showWarningsCount = true, showErrorCount = true, showUndoButton = true, onClose, onSaveAsync, onNext, onPrev, canNext, canPrev, isModified, onShowList, validationItems = [], onUndo, onCancel, width, height }) => {
14
+ const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipIsModifiedCheck = false, title, children, isModal, exception, customToolbarElements, hasNavigation, showSaveButton = true, showBackButton, showWarningsCount = true, showErrorCount = true, showUndoButton = true, onClose, onSaveAsync, onNext, onPrev, canNext, canPrev, isModified, onShowList, validationItems = [], onUndo, onCancel, width, height, askClosingConfirm = false }) => {
15
15
  const [showList, setShowList] = useState(true);
16
16
  const [showErrorGrid, setShowErrorGrid] = useState(false);
17
17
  const deviceType = useDeviceType();
@@ -102,7 +102,7 @@ const TMSaveForm = ({ id, formMode = FormModes.Update, showToolbar = true, skipI
102
102
  _jsx("div", { style: { width: '100%', height: '100%', marginTop: '50px', display: 'flex', alignItems: 'center', justifyContent: 'center', flexDirection: 'column', color: getColor('error') }, children: 'Si è verificato un errore' })
103
103
  : _jsx(_Fragment, { children: children }) }), showErrorGrid && validationItems.length > 0 ? _jsx(TMCard, { scrollY: true, padding: false, showBorder: false, children: _jsx(TMValidationItemsList, { validationItems: validationItems }) }) : _jsx(_Fragment, {})] }) }), (isModal && onClose) && _jsx("div", { id: "TMSaveFormShowConfirmForClose-" + id })] }));
104
104
  };
105
- return (_jsx(_Fragment, { children: (isModal && onClose) ? _jsx(_Fragment, { children: _jsx(TMModal, { title: `${title} - ${LocalizeFormModes(formMode)}`, onClose: doClose, width: width ?? '100%', height: height ?? '100%', hidePopup: false, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block' }, children: renderSaveForm() }) }) })
105
+ return (_jsx(_Fragment, { children: (isModal && onClose) ? _jsx(_Fragment, { children: _jsx(TMModal, { title: `${title} - ${LocalizeFormModes(formMode)}`, onClose: doClose, width: width ?? '100%', height: height ?? '100%', hidePopup: false, askClosingConfirm: askClosingConfirm, children: _jsx("div", { style: { width: "100%", height: "100%", display: 'block' }, children: renderSaveForm() }) }) })
106
106
  : renderSaveForm() }));
107
107
  };
108
108
  export default TMSaveForm;
package/lib/ts/types.d.ts CHANGED
@@ -145,6 +145,7 @@ export interface ITMSaveFormBaseProps {
145
145
  /** Delegate che consente di ripristinare il descrittore originale */
146
146
  onUndo?: () => void;
147
147
  resizable?: boolean;
148
+ askClosingConfirm?: boolean;
148
149
  }
149
150
  export interface ITMApplyFormProps<T> extends ITMApplyFormBaseProps {
150
151
  /** Descrittore di input */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.12.98",
3
+ "version": "6.12.99",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",