@topconsultnpm/sdkui-react 6.21.0-dev3.35 → 6.21.0-dev3.37

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.
@@ -311,6 +311,23 @@ const TMExceptionBox = ({ resizable = false, exception, title = `${SDK_Globals.a
311
311
  navigator.clipboard.writeText(e);
312
312
  ShowAlert({ mode: 'success', duration: 3000, message: SDKUI_Localizator.CopiedSuccessfully, title: 'Success' });
313
313
  };
314
+ const handleClose = useCallback(() => {
315
+ onClose?.();
316
+ setIsVisible(false);
317
+ }, [onClose]);
318
+ const handleKeyDown = useCallback((e) => {
319
+ if (e.key === 'Enter' || e.key === 'Escape') {
320
+ e.preventDefault();
321
+ e.stopPropagation();
322
+ handleClose();
323
+ }
324
+ }, [handleClose]);
325
+ useEffect(() => {
326
+ if (!isVisible)
327
+ return;
328
+ window.addEventListener('keydown', handleKeyDown, true);
329
+ return () => window.removeEventListener('keydown', handleKeyDown, true);
330
+ }, [isVisible, handleKeyDown]);
314
331
  const ExceptionToolbar = () => {
315
332
  return (_jsxs(StyledExeptionToolbar, { children: [_jsx(TMButton, { color: 'primaryOutline', btnStyle: 'text', onClick: () => copyToClipBoard(getFullMessage()), caption: SDKUI_Localizator.CopyToClipboard, showTooltip: false }), _jsx(TMButton, { btnStyle: 'text', onClick: () => { onClose?.(); setIsVisible(false); }, caption: SDKUI_Localizator.Close, showTooltip: false, color: 'error' })] }));
316
333
  };
@@ -10,6 +10,7 @@ interface TMWizardProps {
10
10
  initialData: any;
11
11
  title: string;
12
12
  description: string;
13
+ initialStep?: number;
13
14
  validateOnlyCurrentStep?: boolean;
14
15
  onClose: () => void;
15
16
  onFinish: (data: any) => void;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // TMWizard.tsx
3
- import React, { useState } from 'react';
3
+ import React, { useState, useEffect } from 'react';
4
4
  import styled from 'styled-components';
5
5
  import { ResultTypes } from '@topconsultnpm/sdk-ts';
6
6
  import TMButton from '../base/TMButton';
@@ -40,9 +40,11 @@ const ControlsContainer = styled.div `
40
40
  padding: 15px 20px;
41
41
  border-top: 1px solid #eee;
42
42
  `;
43
- const TMWizard = ({ steps, validateOnlyCurrentStep = true, onClose, onFinish, initialData, title, description }) => {
44
- const [currentStep, setCurrentStep] = useState(0);
43
+ const TMWizard = ({ steps, validateOnlyCurrentStep = true, onClose, onFinish, initialData, title, description, initialStep = 0 }) => {
44
+ const [currentStep, setCurrentStep] = useState(initialStep);
45
45
  const [formData, setFormData] = useState(initialData);
46
+ useEffect(() => { setCurrentStep(initialStep); }, [initialStep]);
47
+ useEffect(() => { setFormData(initialData); }, [initialData]);
46
48
  const stepValidationErrors = steps.map((step, index) => {
47
49
  if (validateOnlyCurrentStep) {
48
50
  if (index <= currentStep) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev3.35",
3
+ "version": "6.21.0-dev3.37",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",