@topconsultnpm/sdkui-react-beta 6.12.122 → 6.12.123

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.
@@ -1,4 +1,4 @@
1
1
  import { InvoiceRetrieveFormats } from '@topconsultnpm/sdk-ts-beta';
2
2
  import { ITMEnumDataBinding } from '../../ts';
3
- declare const TMInvoiceRetrieveFormats: ({ value, valueOrig, onValueChanged, valuesToExclude, label }: ITMEnumDataBinding<InvoiceRetrieveFormats>) => import("react/jsx-runtime").JSX.Element;
3
+ declare const TMInvoiceRetrieveFormats: ({ value, valueOrig, onValueChanged, valuesToExclude, label, width }: ITMEnumDataBinding<InvoiceRetrieveFormats>) => import("react/jsx-runtime").JSX.Element;
4
4
  export default TMInvoiceRetrieveFormats;
@@ -3,7 +3,7 @@ import { InvoiceRetrieveFormats } from '@topconsultnpm/sdk-ts-beta';
3
3
  import { LocalizeInvoiceRetrieveFormats, SDKUI_Localizator } from '../../helper';
4
4
  import { TMMargin } from '../../utils/theme';
5
5
  import TMDropDown from '../editors/TMDropDown';
6
- const TMInvoiceRetrieveFormats = ({ value, valueOrig, onValueChanged, valuesToExclude, label = SDKUI_Localizator.InvoiceRetrieveFormat }) => {
6
+ const TMInvoiceRetrieveFormats = ({ value, valueOrig, onValueChanged, valuesToExclude, label = SDKUI_Localizator.InvoiceRetrieveFormat, width = "100%" }) => {
7
7
  const getDataSource = () => {
8
8
  let dataSource = [];
9
9
  for (let item of Object.values(InvoiceRetrieveFormats)) {
@@ -17,6 +17,6 @@ const TMInvoiceRetrieveFormats = ({ value, valueOrig, onValueChanged, valuesToEx
17
17
  }
18
18
  return dataSource;
19
19
  };
20
- return (_jsx(TMDropDown, { label: label, elementStyle: { marginBottom: TMMargin.defultMargin }, dataSource: getDataSource(), value: value, onValueChanged: (e) => { onValueChanged?.(e.target.value); }, isModifiedWhen: value != valueOrig }));
20
+ return (_jsx(TMDropDown, { label: label, elementStyle: { marginBottom: TMMargin.defultMargin }, dataSource: getDataSource(), value: value, onValueChanged: (e) => { onValueChanged?.(e.target.value); }, isModifiedWhen: value != valueOrig, width: width }));
21
21
  };
22
22
  export default TMInvoiceRetrieveFormats;
@@ -1,4 +1,4 @@
1
1
  import { OrderRetrieveFormats } from '@topconsultnpm/sdk-ts-beta';
2
2
  import { ITMEnumDataBinding } from '../../ts';
3
- declare const TMOrderRetrieveFormats: ({ value, valueOrig, onValueChanged, valuesToExclude, label }: ITMEnumDataBinding<OrderRetrieveFormats>) => import("react/jsx-runtime").JSX.Element;
3
+ declare const TMOrderRetrieveFormats: ({ value, valueOrig, onValueChanged, valuesToExclude, label, width }: ITMEnumDataBinding<OrderRetrieveFormats>) => import("react/jsx-runtime").JSX.Element;
4
4
  export default TMOrderRetrieveFormats;
@@ -3,7 +3,7 @@ import { OrderRetrieveFormats } from '@topconsultnpm/sdk-ts-beta';
3
3
  import { LocalizeOrderRetrieveFormats, SDKUI_Localizator } from '../../helper';
4
4
  import { TMMargin } from '../../utils/theme';
5
5
  import TMDropDown from '../editors/TMDropDown';
6
- const TMOrderRetrieveFormats = ({ value, valueOrig, onValueChanged, valuesToExclude, label = SDKUI_Localizator.OrderRetrieveFormat }) => {
6
+ const TMOrderRetrieveFormats = ({ value, valueOrig, onValueChanged, valuesToExclude, label = SDKUI_Localizator.OrderRetrieveFormat, width = "100%" }) => {
7
7
  const getDataSource = () => {
8
8
  let dataSource = [];
9
9
  for (let item of Object.values(OrderRetrieveFormats)) {
@@ -17,6 +17,6 @@ const TMOrderRetrieveFormats = ({ value, valueOrig, onValueChanged, valuesToExcl
17
17
  }
18
18
  return dataSource;
19
19
  };
20
- return (_jsx(TMDropDown, { label: label, elementStyle: { marginBottom: TMMargin.defultMargin }, dataSource: getDataSource(), value: value, isModifiedWhen: value != valueOrig, onValueChanged: (e) => { onValueChanged?.(e.target.value); }, width: '100%' }));
20
+ return (_jsx(TMDropDown, { label: label, elementStyle: { marginBottom: TMMargin.defultMargin }, dataSource: getDataSource(), value: value, isModifiedWhen: value != valueOrig, onValueChanged: (e) => { onValueChanged?.(e.target.value); }, width: width }));
21
21
  };
22
22
  export default TMOrderRetrieveFormats;
@@ -5,6 +5,7 @@ interface ITMTextBox extends ITMEditorBase {
5
5
  autoFocus?: boolean;
6
6
  formulaItems?: string[];
7
7
  maxValue?: number;
8
+ minValue?: number;
8
9
  maxLength?: number;
9
10
  precision?: number;
10
11
  scale?: number;
@@ -32,7 +32,7 @@ const StyledTextBoxEditorButton = styled.div `
32
32
  border-bottom-color: ${TMColors.primary};
33
33
  }
34
34
  `;
35
- const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = false, scale, showClearButton, validationItems = [], label = '', readOnly = false, formulaItems = [], buttons = [], isModifiedWhen, placeHolder, elementStyle, width = '100%', maxValue, fontSize = FontSize.defaultFontSize, icon, labelPosition = 'left', value, disabled = false, type = 'text', onValueChanged, onBlur, borderRadius }) => {
35
+ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = false, scale, showClearButton, validationItems = [], label = '', readOnly = false, formulaItems = [], buttons = [], isModifiedWhen, placeHolder, elementStyle, width = '100%', maxValue, minValue, fontSize = FontSize.defaultFontSize, icon, labelPosition = 'left', value, disabled = false, type = 'text', onValueChanged, onBlur, borderRadius }) => {
36
36
  const [initialType, setInitialType] = useState(type);
37
37
  const [currentType, setCurrentType] = useState(type);
38
38
  const [currentValue, setCurrentValue] = useState(value);
@@ -50,13 +50,32 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
50
50
  }
51
51
  }, [value]);
52
52
  useEffect(() => {
53
- if (currentType === 'number' && maxValue) {
54
- if (currentValue && parseInt(currentValue) > maxValue) {
55
- setCurrentValue(maxValue.toString());
56
- ShowAlert({ mode: 'warning', message: `Max value is ${maxValue}`, duration: 3000, title: 'Textbox Warning' });
53
+ if (currentType === 'number') {
54
+ if (currentValue) {
55
+ const numericValue = parseFloat(currentValue);
56
+ // Check maxValue
57
+ if (maxValue && numericValue > maxValue) {
58
+ setCurrentValue(maxValue.toString());
59
+ ShowAlert({
60
+ mode: 'warning',
61
+ message: `Max value is ${maxValue}`,
62
+ duration: 3000,
63
+ title: 'Textbox Warning',
64
+ });
65
+ }
66
+ // Check minValue
67
+ if (minValue && numericValue < minValue) {
68
+ setCurrentValue(minValue.toString());
69
+ ShowAlert({
70
+ mode: 'warning',
71
+ message: `Min value is ${minValue}`,
72
+ duration: 3000,
73
+ title: 'Textbox Warning',
74
+ });
75
+ }
57
76
  }
58
77
  }
59
- }, [maxValue, currentValue, currentType]);
78
+ }, [maxValue, minValue, currentValue, currentType]);
60
79
  // Handle autofocus behavior on mount
61
80
  useEffect(() => {
62
81
  if (autoFocus && inputRef.current) {
@@ -127,18 +146,38 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, fromModal = fa
127
146
  if (currentType === 'number') {
128
147
  let number = Number(e.target.value);
129
148
  let max = getMaxValue(e.target.value);
149
+ // Check maxValue
130
150
  if (number > max) {
131
- ShowAlert({ mode: 'warning', message: `Max value is ${max}`, duration: 3000, title: 'Textbox Warning' });
151
+ ShowAlert({
152
+ mode: 'warning',
153
+ message: `Max value is ${max}`,
154
+ duration: 3000,
155
+ title: 'Textbox Warning',
156
+ });
132
157
  return;
133
158
  }
134
- let decimalSeparatorIndex = number.toString().indexOf(".");
159
+ // Check minValue
160
+ if (minValue && number < minValue) {
161
+ ShowAlert({
162
+ mode: 'warning',
163
+ message: `Min value is ${minValue}`,
164
+ duration: 3000,
165
+ title: 'Textbox Warning',
166
+ });
167
+ return;
168
+ }
169
+ let decimalSeparatorIndex = number
170
+ .toString()
171
+ .indexOf('.');
135
172
  if (!scale && decimalSeparatorIndex >= 0)
136
173
  return;
137
174
  // Controllo lunghezza decimali
138
175
  if (scale) {
139
176
  if (decimalSeparatorIndex >= 0) {
140
- let result = Number(number.toString().substring(decimalSeparatorIndex + 1));
141
- if (result > Number("9".repeat(scale ?? 0)))
177
+ let result = Number(number
178
+ .toString()
179
+ .substring(decimalSeparatorIndex + 1));
180
+ if (result > Number('9'.repeat(scale ?? 0)))
142
181
  return;
143
182
  }
144
183
  }
@@ -21,10 +21,10 @@ const fontSizes = [
21
21
  const SettingsAppearance = ({ landingPagesOptions }) => {
22
22
  const [, setForceUpdate] = useState(0); // Dummy state to force re-renders
23
23
  const triggerUIUpdate = () => setForceUpdate((prev) => prev + 1); // Increment dummy state to re-render
24
- return (_jsxs(TMLayoutContainer, { children: [landingPagesOptions && _jsx("p", { style: { fontSize: '1.h1rem', fontWeight: 'bold', marginBottom: '5px' }, children: 'Pagina iniziale' }), landingPagesOptions && _jsx(TMDropDown, { dataSource: landingPagesOptions, value: SDKUI_Globals.userSettings.landingPage, width: '250px', onValueChanged: (e) => {
24
+ return (_jsxs(TMLayoutContainer, { children: [landingPagesOptions && _jsx("p", { style: { fontSize: '1.h1rem', fontWeight: 'bold', marginBottom: '5px' }, children: 'Pagina iniziale' }), landingPagesOptions && _jsx(TMDropDown, { dataSource: landingPagesOptions, value: SDKUI_Globals.userSettings.landingPage, width: '230px', onValueChanged: (e) => {
25
25
  SDKUI_Globals.userSettings.landingPage = e.target.value;
26
26
  triggerUIUpdate();
27
- } }), _jsx("p", { style: { fontSize: '1.h1rem', fontWeight: 'bold', marginTop: '10px' }, children: 'Font' }), _jsx(TMDropDown, { label: SDKUI_Localizator.Size, dataSource: fontSizes, width: '150px', value: SDKUI_Globals.userSettings.themeSettings.fontSize, onValueChanged: (e) => {
27
+ } }), _jsx("p", { style: { fontSize: '1.h1rem', fontWeight: 'bold', marginTop: '10px' }, children: 'Font' }), _jsx(TMDropDown, { label: SDKUI_Localizator.Size, dataSource: fontSizes, width: '230px', value: SDKUI_Globals.userSettings.themeSettings.fontSize, onValueChanged: (e) => {
28
28
  let newpx = e.target.value;
29
29
  SDKUI_Globals.userSettings.themeSettings.fontSize = newpx;
30
30
  triggerUIUpdate();
@@ -21,10 +21,7 @@ const TMDataListItemViewer = ({ dataListId, value, viewMode = DataListViewModes.
21
21
  return null;
22
22
  if (!value)
23
23
  return null;
24
- return dataListItem ?
25
- _jsx(TMTooltip, { content: dataListItem.value, children: _jsx(TMImageLibrary, { imageID: dataListItem.imageID }) })
26
- :
27
- _jsx(TMTooltip, { content: SDKUI_Localizator.ValueNotPresent, children: _jsx(IconWarning, { color: TMColors.warning }) });
24
+ return dataListItem ? _jsx(TMImageLibrary, { imageID: dataListItem.imageID }) : _jsx(IconWarning, { color: TMColors.warning });
28
25
  };
29
26
  const getDescription = () => {
30
27
  if (!dataListId)
@@ -33,7 +30,7 @@ const TMDataListItemViewer = ({ dataListId, value, viewMode = DataListViewModes.
33
30
  return undefined;
34
31
  return dataListItem ? dataListItem.name : value.toString();
35
32
  };
36
- return (_jsxs(StyledDivHorizontal, { children: [getIcon(), _jsx("p", { style: { textAlign: 'left', marginLeft: showIcon ? '5px' : '', opacity: dataListItem ? 1 : 0.5 }, children: getDescription() })] }));
33
+ return (_jsx(TMTooltip, { content: dataListItem ? dataListItem.value : SDKUI_Localizator.ValueNotPresent, children: _jsxs(StyledDivHorizontal, { children: [getIcon(), _jsx("p", { style: { textAlign: 'left', marginLeft: showIcon ? '5px' : '', opacity: dataListItem ? 1 : 0.5 }, children: getDescription() })] }) }));
37
34
  };
38
35
  export default TMDataListItemViewer;
39
36
  export const cellRenderDataListItem = (data, dataListId, viewMode) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.12.122",
3
+ "version": "6.12.123",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",