@topconsultnpm/sdkui-react 6.22.0-dev2.7 → 6.22.0-t1
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.
- package/lib/components/base/TMButton.d.ts +0 -13
- package/lib/components/base/TMButton.js +5 -137
- package/lib/components/base/TMDataGridExportForm.js +30 -39
- package/lib/components/editors/TMDateBox.d.ts +1 -16
- package/lib/components/editors/TMDateBox.js +22 -90
- package/lib/components/editors/TMMetadataEditor.js +20 -19
- package/lib/components/editors/TMTextArea.d.ts +0 -1
- package/lib/components/editors/TMTextArea.js +15 -23
- package/lib/components/editors/TMTextBox.d.ts +0 -2
- package/lib/components/editors/TMTextBox.js +19 -30
- package/lib/components/features/documents/TMDcmtForm.js +3 -55
- package/lib/components/features/documents/TMRelationViewer.js +32 -13
- package/lib/components/features/search/TMSearch.js +16 -29
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -1
- package/lib/components/features/search/TMSearchQueryPanel.js +7 -28
- package/lib/components/features/search/TMSearchResult.js +38 -10
- package/lib/components/viewers/TMMidViewer.js +1 -1
- package/lib/helper/Globalization.d.ts +1 -1
- package/lib/helper/SDKUI_Localizator.d.ts +0 -11
- package/lib/helper/SDKUI_Localizator.js +0 -110
- package/lib/helper/TMUtils.d.ts +1 -29
- package/lib/helper/TMUtils.js +10 -249
- package/lib/helper/helpers.d.ts +0 -11
- package/lib/helper/helpers.js +0 -32
- package/package.json +2 -2
|
@@ -3,17 +3,6 @@ import { ITMEditorBase } from './TMEditorBase';
|
|
|
3
3
|
export type ButtonColors = 'error' | 'warning' | 'success' | 'info' | 'primary' | 'secondary' | 'tertiary' | 'standard' | 'primaryOutline' | 'secondaryOutline' | 'tertiaryOutline' | 'errorOutline' | 'warningOutline' | 'successOutline' | 'infoOutline';
|
|
4
4
|
export type ButtonStyle = 'normal' | 'toolbar' | 'icon' | 'text' | 'advanced';
|
|
5
5
|
export type AdvancedButtonType = 'success' | 'error' | 'tertiary' | 'primary';
|
|
6
|
-
/** Azione secondaria mostrata nel dropdown "split button" (freccia a destra) */
|
|
7
|
-
export interface ITMButtonSecondaryAction {
|
|
8
|
-
/** Etichetta mostrata nella voce di menu */
|
|
9
|
-
name: string;
|
|
10
|
-
/** Icona opzionale a sinistra della voce */
|
|
11
|
-
icon?: React.ReactNode;
|
|
12
|
-
/** Callback al click della voce */
|
|
13
|
-
onClick?: () => void;
|
|
14
|
-
/** Disabilita la singola voce */
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
}
|
|
17
6
|
export interface ITMButton extends ITMEditorBase {
|
|
18
7
|
color?: ButtonColors;
|
|
19
8
|
btnStyle?: ButtonStyle;
|
|
@@ -28,8 +17,6 @@ export interface ITMButton extends ITMEditorBase {
|
|
|
28
17
|
showTooltip?: boolean;
|
|
29
18
|
onClick?: VoidFunction;
|
|
30
19
|
onMouseDown?: (e: any) => any;
|
|
31
|
-
/** Azioni secondarie: se valorizzate, il bottone mostra una freccia a destra che apre un dropdown con queste azioni */
|
|
32
|
-
secondaryActions?: ITMButtonSecondaryAction[];
|
|
33
20
|
}
|
|
34
21
|
declare const TMButton: React.ForwardRefExoticComponent<ITMButton & React.RefAttributes<HTMLButtonElement>>;
|
|
35
22
|
export default TMButton;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, forwardRef
|
|
3
|
-
import { createPortal } from 'react-dom';
|
|
2
|
+
import { useState, forwardRef } from 'react';
|
|
4
3
|
import styled from 'styled-components';
|
|
5
|
-
import { getColor
|
|
4
|
+
import { getColor } from '../../helper';
|
|
6
5
|
import { FontSize, TMColors } from '../../utils/theme';
|
|
7
6
|
import TMTooltip from './TMTooltip';
|
|
8
7
|
const StyledNormalButton = styled.button.withConfig({ shouldForwardProp: prop => !['text'].includes(prop) }) `
|
|
@@ -150,132 +149,10 @@ const StyledAdvancedButtonText = styled.div `
|
|
|
150
149
|
border-top-right-radius: 10px;
|
|
151
150
|
border-bottom-right-radius: 10px;
|
|
152
151
|
padding: 5px;
|
|
153
|
-
padding-right: ${props => props.$reserveArrow ? '26px' : '5px'};
|
|
154
|
-
`;
|
|
155
|
-
const StyledSplitContainer = styled.div `
|
|
156
|
-
display: inline-flex;
|
|
157
|
-
align-items: stretch;
|
|
158
|
-
position: relative;
|
|
159
|
-
`;
|
|
160
|
-
const StyledSplitArrow = styled.button `
|
|
161
|
-
position: absolute;
|
|
162
|
-
right: 4px;
|
|
163
|
-
top: 50%;
|
|
164
|
-
transform: translateY(-50%);
|
|
165
|
-
z-index: 2;
|
|
166
|
-
display: flex;
|
|
167
|
-
align-items: center;
|
|
168
|
-
justify-content: center;
|
|
169
|
-
width: 20px;
|
|
170
|
-
height: 20px;
|
|
171
|
-
padding: 0;
|
|
172
|
-
border: none;
|
|
173
|
-
border-radius: 6px;
|
|
174
|
-
cursor: ${props => props.$isDisabled ? 'default' : 'pointer'};
|
|
175
|
-
color: white;
|
|
176
|
-
background-color: rgba(255, 255, 255, 0.22);
|
|
177
|
-
transition: background-color ease 150ms;
|
|
178
|
-
&:hover { background-color: ${props => props.$isDisabled ? 'rgba(255, 255, 255, 0.22)' : 'rgba(255, 255, 255, 0.38)'}; }
|
|
179
|
-
& svg {
|
|
180
|
-
transition: transform ease 150ms;
|
|
181
|
-
transform: rotate(${props => props.$isOpen ? '180deg' : '0deg'});
|
|
182
|
-
}
|
|
183
|
-
`;
|
|
184
|
-
const StyledDropdown = styled.div `
|
|
185
|
-
position: fixed;
|
|
186
|
-
left: ${props => props.$left}px;
|
|
187
|
-
top: ${props => props.$top}px;
|
|
188
|
-
transform: translateY(-100%);
|
|
189
|
-
transform-origin: bottom left;
|
|
190
|
-
min-width: ${props => props.$minWidth}px;
|
|
191
|
-
background: #ffffff;
|
|
192
|
-
border-radius: 14px;
|
|
193
|
-
box-shadow: 0 10px 30px rgba(20, 40, 80, 0.20);
|
|
194
|
-
border: 1px solid rgba(74, 150, 210, 0.18);
|
|
195
|
-
padding: 5px;
|
|
196
|
-
z-index: 100000;
|
|
197
|
-
display: flex;
|
|
198
|
-
flex-direction: column;
|
|
199
|
-
gap: 2px;
|
|
200
|
-
animation: tmSplitDropdownIn cubic-bezier(0.2, 0.8, 0.2, 1) 150ms;
|
|
201
|
-
@keyframes tmSplitDropdownIn {
|
|
202
|
-
from { opacity: 0; transform: translateY(calc(-100% + 8px)); }
|
|
203
|
-
to { opacity: 1; transform: translateY(-100%); }
|
|
204
|
-
}
|
|
205
|
-
`;
|
|
206
|
-
const StyledDropdownItem = styled.button `
|
|
207
|
-
display: flex;
|
|
208
|
-
align-items: center;
|
|
209
|
-
gap: 9px;
|
|
210
|
-
width: 100%;
|
|
211
|
-
padding: 5px 9px;
|
|
212
|
-
border: none;
|
|
213
|
-
border-radius: 8px;
|
|
214
|
-
background: transparent;
|
|
215
|
-
text-align: left;
|
|
216
|
-
font-size: ${FontSize.defaultFontSize};
|
|
217
|
-
font-weight: 500;
|
|
218
|
-
color: ${props => props.$disabled ? '#b4b4b4' : '#2c3e50'};
|
|
219
|
-
cursor: ${props => props.$disabled ? 'default' : 'pointer'};
|
|
220
|
-
transition: background ease 150ms, color ease 150ms;
|
|
221
|
-
&:hover {
|
|
222
|
-
background: ${props => props.$disabled ? 'transparent' : 'linear-gradient(135deg, rgba(74, 150, 210, 0.16) 0%, rgba(37, 89, 165, 0.16) 100%)'};
|
|
223
|
-
color: ${props => props.$disabled ? '#b4b4b4' : '#2559A5'};
|
|
224
|
-
}
|
|
225
|
-
& > .tm-split-item-icon {
|
|
226
|
-
display: flex;
|
|
227
|
-
align-items: center;
|
|
228
|
-
justify-content: center;
|
|
229
|
-
width: 22px;
|
|
230
|
-
height: 22px;
|
|
231
|
-
flex-shrink: 0;
|
|
232
|
-
border-radius: 6px;
|
|
233
|
-
background: rgba(74, 150, 210, 0.14);
|
|
234
|
-
color: #4A96D2;
|
|
235
|
-
transition: background ease 150ms, color ease 150ms;
|
|
236
|
-
}
|
|
237
|
-
&:hover > .tm-split-item-icon {
|
|
238
|
-
background: ${props => props.$disabled ? 'rgba(74, 150, 210, 0.14)' : '#4A96D2'};
|
|
239
|
-
color: ${props => props.$disabled ? '#4A96D2' : '#ffffff'};
|
|
240
|
-
}
|
|
241
152
|
`;
|
|
242
153
|
const TMButton = forwardRef((props, ref) => {
|
|
243
|
-
const { width, height, keyGesture, btnStyle = 'normal', advancedColor, advancedType = 'primary', color = 'primary', fontSize = FontSize.defaultFontSize, disabled = false, showTooltip = true, caption, icon, description, padding, elementStyle, onClick = () => { }, onMouseDown = () => { }
|
|
154
|
+
const { width, height, keyGesture, btnStyle = 'normal', advancedColor, advancedType = 'primary', color = 'primary', fontSize = FontSize.defaultFontSize, disabled = false, showTooltip = true, caption, icon, description, padding, elementStyle, onClick = () => { }, onMouseDown = () => { } } = props;
|
|
244
155
|
const [isHovered, setIsHovered] = useState(false);
|
|
245
|
-
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
246
|
-
const [dropdownPos, setDropdownPos] = useState({ left: 0, top: 0, minWidth: 200 });
|
|
247
|
-
const splitContainerRef = useRef(null);
|
|
248
|
-
const dropdownRef = useRef(null);
|
|
249
|
-
const hasSecondaryActions = !!secondaryActions && secondaryActions.length > 0;
|
|
250
|
-
useEffect(() => {
|
|
251
|
-
if (!isDropdownOpen)
|
|
252
|
-
return;
|
|
253
|
-
const handlePointerDown = (e) => {
|
|
254
|
-
const target = e.target;
|
|
255
|
-
if (splitContainerRef.current?.contains(target) || dropdownRef.current?.contains(target))
|
|
256
|
-
return;
|
|
257
|
-
setIsDropdownOpen(false);
|
|
258
|
-
};
|
|
259
|
-
const handleKeyDown = (e) => { if (e.key === 'Escape')
|
|
260
|
-
setIsDropdownOpen(false); };
|
|
261
|
-
document.addEventListener('mousedown', handlePointerDown);
|
|
262
|
-
document.addEventListener('touchstart', handlePointerDown);
|
|
263
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
264
|
-
return () => {
|
|
265
|
-
document.removeEventListener('mousedown', handlePointerDown);
|
|
266
|
-
document.removeEventListener('touchstart', handlePointerDown);
|
|
267
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
268
|
-
};
|
|
269
|
-
}, [isDropdownOpen]);
|
|
270
|
-
const toggleDropdown = () => {
|
|
271
|
-
if (disabled)
|
|
272
|
-
return;
|
|
273
|
-
if (!isDropdownOpen && splitContainerRef.current) {
|
|
274
|
-
const rect = splitContainerRef.current.getBoundingClientRect();
|
|
275
|
-
setDropdownPos({ left: rect.left, top: rect.top - 6, minWidth: Math.max(rect.width, 200) });
|
|
276
|
-
}
|
|
277
|
-
setIsDropdownOpen(prev => !prev);
|
|
278
|
-
};
|
|
279
156
|
const renderedButton = () => {
|
|
280
157
|
if (btnStyle === 'normal') {
|
|
281
158
|
return (_jsx(StyledNormalButton, { ref: ref, width: width, height: height, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: caption }));
|
|
@@ -287,7 +164,7 @@ const TMButton = forwardRef((props, ref) => {
|
|
|
287
164
|
return (_jsx(StyledIconButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, padding: padding, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: icon }));
|
|
288
165
|
}
|
|
289
166
|
else if (btnStyle === 'advanced') {
|
|
290
|
-
return (_jsxs(StyledAdvancedButton, { ref: ref, "$width": width ?? '90px', "$height": height ?? '30px', onMouseOver: () => !disabled && setIsHovered(true), onMouseOut: () => setIsHovered(false), "$isDisabled": disabled, "$isPrimaryOutline": advancedType === 'primary' && (advancedColor === 'primaryOutline' || color === 'primaryOutline'), onClick: () => !disabled && onClick?.(), onMouseDown: (e) => !disabled && onMouseDown?.(e), children: [_jsx(StyledAdvancedButtonIcon, { "$color": advancedColor, "$isVisible": isHovered, "$isDisabled": disabled, "$type": advancedType, children: icon }), _jsx(StyledAdvancedButtonText, { "$color": advancedColor, "$isDisabled": disabled, "$type": advancedType,
|
|
167
|
+
return (_jsxs(StyledAdvancedButton, { ref: ref, "$width": width ?? '90px', "$height": height ?? '30px', onMouseOver: () => !disabled && setIsHovered(true), onMouseOut: () => setIsHovered(false), "$isDisabled": disabled, "$isPrimaryOutline": advancedType === 'primary' && (advancedColor === 'primaryOutline' || color === 'primaryOutline'), onClick: () => !disabled && onClick?.(), onMouseDown: (e) => !disabled && onMouseDown?.(e), children: [_jsx(StyledAdvancedButtonIcon, { "$color": advancedColor, "$isVisible": isHovered, "$isDisabled": disabled, "$type": advancedType, children: icon }), _jsx(StyledAdvancedButtonText, { "$color": advancedColor, "$isDisabled": disabled, "$type": advancedType, children: caption })] }));
|
|
291
168
|
}
|
|
292
169
|
else {
|
|
293
170
|
return (_jsx(StyledTextButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: caption }));
|
|
@@ -298,15 +175,6 @@ const TMButton = forwardRef((props, ref) => {
|
|
|
298
175
|
_jsxs(_Fragment, { children: [caption &&
|
|
299
176
|
_jsx(StyledButtonTooltipHeader, { "$description": description, children: _jsx(StyledButtonTooltipItem, { "$color": color, children: caption }) }), description && _jsx(StyledButtonTooltipItem, { children: description })] }));
|
|
300
177
|
};
|
|
301
|
-
|
|
302
|
-
? _jsx(TMTooltip, { hideAfterDelay: true, content: renderTooltip(), children: renderedButton() })
|
|
303
|
-
: renderedButton();
|
|
304
|
-
const renderSplitButton = () => (_jsxs(StyledSplitContainer, { ref: splitContainerRef, children: [buttonWithTooltip, _jsx(StyledSplitArrow, { type: 'button', "$isDisabled": disabled, "$isOpen": isDropdownOpen, "aria-haspopup": 'menu', "aria-expanded": isDropdownOpen, onClick: (e) => { e.stopPropagation(); toggleDropdown(); }, onMouseDown: (e) => e.stopPropagation(), children: _jsx(IconChevronDown, { fontSize: 14 }) }), isDropdownOpen && createPortal(_jsx(StyledDropdown, { ref: dropdownRef, role: 'menu', "$left": dropdownPos.left, "$top": dropdownPos.top, "$minWidth": dropdownPos.minWidth, children: secondaryActions.map((action, idx) => (_jsxs(StyledDropdownItem, { type: 'button', role: 'menuitem', "$disabled": action.disabled, disabled: action.disabled, onClick: () => {
|
|
305
|
-
if (action.disabled)
|
|
306
|
-
return;
|
|
307
|
-
setIsDropdownOpen(false);
|
|
308
|
-
action.onClick?.();
|
|
309
|
-
}, children: [action.icon && _jsx("span", { className: 'tm-split-item-icon', children: action.icon }), _jsx("span", { children: action.name })] }, `${action.name}-${idx}`))) }), document.body)] }));
|
|
310
|
-
return (_jsx("div", { style: elementStyle, children: hasSecondaryActions ? renderSplitButton() : buttonWithTooltip }));
|
|
178
|
+
return (_jsx("div", { style: elementStyle, children: showTooltip ? _jsx(TMTooltip, { hideAfterDelay: true, content: renderTooltip(), children: renderedButton() }) : renderedButton() }));
|
|
311
179
|
});
|
|
312
180
|
export default TMButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { Workbook } from 'devextreme-exceljs-fork';
|
|
4
|
-
import { buildValueToLabelMapFromDataColumns,
|
|
4
|
+
import { buildValueToLabelMapFromDataColumns, getExceptionMessage, SDKUI_Localizator } from '../../helper';
|
|
5
5
|
import TMCheckBox from '../editors/TMCheckBox';
|
|
6
6
|
import TMButton from './TMButton';
|
|
7
7
|
import TMModal from './TMModal';
|
|
@@ -96,52 +96,43 @@ const TMDataGridExportForm = (props) => {
|
|
|
96
96
|
if (mapForField) {
|
|
97
97
|
result = mapForField.get(value) ?? value;
|
|
98
98
|
}
|
|
99
|
+
else {
|
|
100
|
+
result = value;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// If the column is a datetime type, attempt to format it as a locale date string
|
|
104
|
+
if (col.dataType === 'datetime' && result) {
|
|
105
|
+
const parsedDate = new Date(result);
|
|
106
|
+
if (!isNaN(parsedDate.getTime())) {
|
|
107
|
+
result = parsedDate.toLocaleDateString();
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
return formatValueForExport(result, dataCol, col.dataType);
|
|
110
|
+
// Return the cleaned string value, stripping double quotes to avoid CSV formatting issues
|
|
111
|
+
return (result ?? '').toString().replace(/"/g, '');
|
|
103
112
|
};
|
|
104
113
|
switch (formatSelected) {
|
|
105
114
|
case 'csv': {
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// Crea la prima riga del CSV con le intestazioni delle colonne
|
|
111
|
-
const rows = [
|
|
112
|
-
(exportSelectedFormatColumns
|
|
113
|
-
? [SDKUI_Localizator.SelectedSingular, ...visibleColumns.map(getHeader)]
|
|
114
|
-
: visibleColumns.map(getHeader)).join(';')
|
|
115
|
-
];
|
|
116
|
-
// Scorre tutte le righe da esportare
|
|
115
|
+
const getHeaderName = (col) => col.caption ?? col.dataField;
|
|
116
|
+
const headers = !exportSelectedFormatColumns ? visibleColumns.map(getHeaderName) : [SDKUI_Localizator.SelectedSingular, ...visibleColumns.map(getHeaderName)];
|
|
117
|
+
const csvRows = [];
|
|
118
|
+
csvRows.push(headers.join(';'));
|
|
117
119
|
rowsToExport.forEach((item, idx) => {
|
|
118
|
-
// Recupera l'indice originale della riga per verificare la selezione
|
|
119
120
|
const originalIndex = exportSelectedOnly ? selectedRowKeys[idx] : dataSource.indexOf(item);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
const rowValues = [];
|
|
122
|
+
if (exportSelectedFormatColumns) {
|
|
123
|
+
const status = selectedSet.has(originalIndex) ? SDKUI_Localizator.SelectedSingular : SDKUI_Localizator.Deselected;
|
|
124
|
+
rowValues.push(status || '');
|
|
125
|
+
}
|
|
126
|
+
visibleColumns.forEach(col => {
|
|
127
|
+
if (col.dataField) {
|
|
128
|
+
rowValues.push(getValue(col, item[col.dataField]));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
csvRows.push(rowValues.join(';'));
|
|
131
132
|
});
|
|
132
|
-
|
|
133
|
-
const blob = new Blob(['\uFEFF', rows.join('\r\n')], { type: 'text/csv;charset=utf-8;' });
|
|
134
|
-
// Avvia il download del file generato
|
|
133
|
+
const blob = new Blob([csvRows.join('\r\n')], { type: 'text/csv;charset=utf-8;' });
|
|
135
134
|
downloadFile(blob, formatSelected);
|
|
136
|
-
|
|
137
|
-
result.push({
|
|
138
|
-
rowIndex: 1,
|
|
139
|
-
id1: 1,
|
|
140
|
-
id2: 0,
|
|
141
|
-
description: SDKUI_Localizator.OperationSuccess,
|
|
142
|
-
resultType: ResultTypes.SUCCESS
|
|
143
|
-
});
|
|
144
|
-
// Termina il caso CSV nello switch
|
|
135
|
+
result.push({ rowIndex: 1, id1: 1, id2: 0, description: SDKUI_Localizator.OperationSuccess, resultType: ResultTypes.SUCCESS });
|
|
145
136
|
break;
|
|
146
137
|
}
|
|
147
138
|
case 'xlsx': {
|
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ValidationItem } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { IDateBoxOptions } from 'devextreme-react/date-box';
|
|
4
4
|
import { DateDisplayTypes } from '../../helper';
|
|
5
5
|
interface ITMDateBoxProps extends IDateBoxOptions {
|
|
6
|
-
/** Tipo di picker da mostrare: Date (solo calendario), Time (solo ora), DateTime (entrambi). Determina quali controlli appaiono nel dropdown. */
|
|
7
6
|
dateDisplayType?: DateDisplayTypes;
|
|
8
|
-
/** Lista di errori/warning di validazione da mostrare sotto il campo */
|
|
9
7
|
validationItems?: ValidationItem[];
|
|
10
|
-
/** Se true, evidenzia il campo come modificato (bordo e testo colorati) */
|
|
11
8
|
isModifiedWhen?: boolean;
|
|
12
|
-
/** Se true, serializza la data nel formato ISO 'yyyy-MM-ddTHH:mm:ss' */
|
|
13
9
|
useDateSerializationFormat?: boolean;
|
|
14
|
-
/** Elemento DOM contenitore per il dropdown del calendario */
|
|
15
10
|
containerElement?: Element;
|
|
16
|
-
/** Pulsanti aggiuntivi da mostrare nel campo */
|
|
17
11
|
buttons?: any;
|
|
18
|
-
/** Se true (default), resetta l'ora a 00:00:00 quando si preme un tasto */
|
|
19
12
|
resetTimeToZeroOnKeyPress?: boolean;
|
|
20
|
-
/** Icona da mostrare a sinistra del campo */
|
|
21
13
|
icon?: any;
|
|
22
|
-
/** Padding del contenitore esterno */
|
|
23
14
|
padding?: string;
|
|
24
|
-
/** Cultura/locale per la formattazione (es. 'en-gb', 'it-it'). Usata per tradurre i nomi dei mesi/giorni nella lingua corretta. */
|
|
25
|
-
formatCulture?: string;
|
|
26
|
-
/** Formato di visualizzazione della data (es. ShortDate='17/07/2026', LongDate='17 July 2026'). Determina come la data viene rappresentata come stringa nel campo. */
|
|
27
|
-
metadataFormat?: MetadataFormats;
|
|
28
|
-
/** Messaggio personalizzato per data non valida. Se non specificato, genera automaticamente un messaggio con esempio del formato (es. 'Formato richiesto: 20/07/2026') */
|
|
29
|
-
invalidDateMessage?: string;
|
|
30
15
|
}
|
|
31
16
|
declare const TMDateBox: React.FC<ITMDateBoxProps>;
|
|
32
17
|
export default TMDateBox;
|
|
@@ -1,103 +1,35 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useId,
|
|
2
|
+
import { useEffect, useId, useRef } from 'react';
|
|
3
3
|
import { DateBox } from 'devextreme-react';
|
|
4
|
-
import {
|
|
5
|
-
import { DateDisplayTypes, Globalization, SDKUI_Localizator } from '../../helper';
|
|
4
|
+
import { DateDisplayTypes, Globalization } from '../../helper';
|
|
6
5
|
import { TMColors } from '../../utils/theme';
|
|
7
6
|
import TMVilViewer from '../base/TMVilViewer';
|
|
8
|
-
import { formatDateTimeByMetadataFormat } from '../../helper/TMUtils';
|
|
9
7
|
const TMDateBox = (props) => {
|
|
10
|
-
const
|
|
11
|
-
const resetTimeToZero = resetTimeToZeroOnKeyPress ?? true;
|
|
8
|
+
const resetTimeToZero = props.resetTimeToZeroOnKeyPress ?? true;
|
|
12
9
|
const autoId = useId();
|
|
13
|
-
const effectiveInputAttr = { id: autoId, ...inputAttr };
|
|
14
|
-
// Determina se il formato richiede nomi testuali (mesi/giorni) che dipendono dalla cultura
|
|
15
|
-
const requiresTextualFormat = useMemo(() => {
|
|
16
|
-
// Solo i formati con "Long" nella data hanno nomi di mesi/giorni che variano per cultura
|
|
17
|
-
return metadataFormat === MetadataFormats.LongDate ||
|
|
18
|
-
metadataFormat === MetadataFormats.LongDateShortTime ||
|
|
19
|
-
metadataFormat === MetadataFormats.LongDateLongTime;
|
|
20
|
-
}, [metadataFormat]);
|
|
21
|
-
// Funzione di formattazione personalizzata per rispettare formatCulture
|
|
22
|
-
// Usata SOLO per formati con nomi testuali (LongDate, LongDateShortTime, LongDateLongTime) e se formatCulture è specificato
|
|
23
|
-
const customDisplayFormat = useMemo(() => {
|
|
24
|
-
// Usa funzione custom solo se c'è formatCulture E il formato richiede nomi testuali
|
|
25
|
-
if (!formatCulture || !requiresTextualFormat)
|
|
26
|
-
return undefined;
|
|
27
|
-
// Restituisce una funzione che DevExtreme userà per formattare la data
|
|
28
|
-
return (date) => {
|
|
29
|
-
try {
|
|
30
|
-
if (!date)
|
|
31
|
-
return '';
|
|
32
|
-
// Assicurati che sia un oggetto Date valido
|
|
33
|
-
const dateObj = date instanceof Date ? date : new Date(date);
|
|
34
|
-
if (isNaN(dateObj.getTime()))
|
|
35
|
-
return '';
|
|
36
|
-
return formatDateTimeByMetadataFormat(dateObj, metadataFormat, formatCulture);
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
// Fallback: restituisce stringa ISO o vuota in caso di errore
|
|
40
|
-
try {
|
|
41
|
-
return date instanceof Date ? date.toISOString() : String(date ?? '');
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
return '';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}, [formatCulture, metadataFormat, requiresTextualFormat]);
|
|
49
|
-
// Genera il messaggio di errore con esempio del formato supportato
|
|
50
|
-
const computedInvalidDateMessage = useMemo(() => {
|
|
51
|
-
try {
|
|
52
|
-
if (invalidDateMessage)
|
|
53
|
-
return invalidDateMessage;
|
|
54
|
-
// Genera un esempio usando la data corrente
|
|
55
|
-
const exampleDate = new Date();
|
|
56
|
-
let exampleFormatted;
|
|
57
|
-
if (customDisplayFormat) {
|
|
58
|
-
// Usa la funzione custom se disponibile
|
|
59
|
-
exampleFormatted = customDisplayFormat(exampleDate);
|
|
60
|
-
}
|
|
61
|
-
else if (typeof displayFormat === 'string') {
|
|
62
|
-
// Usa formatDateTimeByMetadataFormat se abbiamo un formato stringa
|
|
63
|
-
exampleFormatted = formatDateTimeByMetadataFormat(exampleDate, metadataFormat, formatCulture) || displayFormat;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
// Fallback: usa il formato di Globalization o localizzazione standard
|
|
67
|
-
const globFormat = Globalization.getDateDisplayFormat(dateDisplayType);
|
|
68
|
-
exampleFormatted = typeof globFormat === 'string' ? globFormat : exampleDate.toLocaleDateString(formatCulture || 'it-IT');
|
|
69
|
-
}
|
|
70
|
-
if (!exampleFormatted)
|
|
71
|
-
return SDKUI_Localizator.ValueMustBeDateOrTime;
|
|
72
|
-
return `${SDKUI_Localizator.RequiredFormat}: ${exampleFormatted}`;
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
// In caso di errore, usa il messaggio generico tradotto
|
|
76
|
-
return SDKUI_Localizator.ValueMustBeDateOrTime;
|
|
77
|
-
}
|
|
78
|
-
}, [invalidDateMessage, customDisplayFormat, displayFormat, dateDisplayType, metadataFormat, formatCulture]);
|
|
10
|
+
const effectiveInputAttr = { id: autoId, ...props.inputAttr };
|
|
79
11
|
useEffect(() => {
|
|
80
12
|
let htmlElement = dateBoxRef?.current?.instance().element();
|
|
81
13
|
if (!htmlElement)
|
|
82
14
|
return;
|
|
83
|
-
let borderColor = isModifiedWhen ? TMColors.tertiary : TMColors.border_normal;
|
|
84
|
-
let textColor = isModifiedWhen ? TMColors.isModified : TMColors.text_normal;
|
|
15
|
+
let borderColor = props.isModifiedWhen ? TMColors.tertiary : TMColors.border_normal;
|
|
16
|
+
let textColor = props.isModifiedWhen ? TMColors.isModified : TMColors.text_normal;
|
|
85
17
|
let inputContainer = htmlElement.getElementsByClassName("dx-texteditor-input-container")[0];
|
|
86
18
|
if (inputContainer) {
|
|
87
|
-
inputContainer.style.background = readOnly ? 'linear-gradient(white 20%, #d6d6d6 80%)' : '';
|
|
88
|
-
inputContainer.style.color = readOnly ? '#525252' : textColor;
|
|
19
|
+
inputContainer.style.background = props.readOnly ? 'linear-gradient(white 20%, #d6d6d6 80%)' : '';
|
|
20
|
+
inputContainer.style.color = props.readOnly ? '#525252' : textColor;
|
|
89
21
|
}
|
|
90
22
|
let input = htmlElement.querySelector(".dx-texteditor-input");
|
|
91
23
|
if (input) {
|
|
92
|
-
if (!readOnly) {
|
|
24
|
+
if (!props.readOnly) {
|
|
93
25
|
input.style.color = textColor;
|
|
94
26
|
}
|
|
95
27
|
input.style.fontSize = 'var(--base-font-size)';
|
|
96
28
|
input.style.fontFamily = 'var(--base-font-family)';
|
|
97
29
|
}
|
|
98
|
-
let
|
|
99
|
-
if (
|
|
100
|
-
|
|
30
|
+
let label = htmlElement.getElementsByClassName("dx-label")[0];
|
|
31
|
+
if (label) {
|
|
32
|
+
label.style.borderBottomColor = borderColor;
|
|
101
33
|
}
|
|
102
34
|
let labelBefore = htmlElement.getElementsByClassName("dx-label-before")[0];
|
|
103
35
|
if (labelBefore) {
|
|
@@ -111,13 +43,13 @@ const TMDateBox = (props) => {
|
|
|
111
43
|
labelAfter.style.borderTopColor = borderColor;
|
|
112
44
|
labelAfter.style.borderInlineEndColor = borderColor;
|
|
113
45
|
}
|
|
114
|
-
}, [isModifiedWhen, readOnly]);
|
|
46
|
+
}, [props.isModifiedWhen, props.readOnly]);
|
|
115
47
|
const dateBoxRef = useRef(null);
|
|
116
48
|
// soluzione tratta da https://supportcenter.devexpress.com/ticket/details/t1025617/setting-default-time-in-datebox
|
|
117
49
|
const dropDownOptions = {
|
|
118
|
-
container: containerElement,
|
|
50
|
+
container: props.containerElement,
|
|
119
51
|
onShown: (e) => {
|
|
120
|
-
if (value != undefined)
|
|
52
|
+
if (props.value != undefined)
|
|
121
53
|
return;
|
|
122
54
|
let dateBoxInstance = dateBoxRef.current?.instance();
|
|
123
55
|
const currentDate = new Date();
|
|
@@ -127,13 +59,13 @@ const TMDateBox = (props) => {
|
|
|
127
59
|
}
|
|
128
60
|
};
|
|
129
61
|
const getType = () => {
|
|
130
|
-
if (type != undefined)
|
|
131
|
-
return type;
|
|
132
|
-
if (!dateDisplayType || dateDisplayType == DateDisplayTypes.DateTime)
|
|
62
|
+
if (props.type != undefined)
|
|
63
|
+
return props.type;
|
|
64
|
+
if (!props.dateDisplayType || props.dateDisplayType == DateDisplayTypes.DateTime)
|
|
133
65
|
return "datetime";
|
|
134
|
-
return dateDisplayType == DateDisplayTypes.Date ? "date" : "time";
|
|
66
|
+
return props.dateDisplayType == DateDisplayTypes.Date ? "date" : "time";
|
|
135
67
|
};
|
|
136
|
-
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', padding: padding }, children: [icon && (_jsx("span", { style: { marginRight: '8px', marginTop: '8px', display: 'flex', alignItems: 'center' }, children: icon })), _jsxs("div", { onContextMenu: (e) => e.stopPropagation(), style: { display: 'flex', flexDirection: 'column', gap: '5px', width: '100%' }, children: [_jsx(DateBox, { readOnly: readOnly, ref: dateBoxRef, showClearButton: showClearButton, dateSerializationFormat: useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: disabled, displayFormat:
|
|
68
|
+
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', padding: props.padding }, children: [props.icon && (_jsx("span", { style: { marginRight: '8px', marginTop: '8px', display: 'flex', alignItems: 'center' }, children: props.icon })), _jsxs("div", { onContextMenu: (e) => e.stopPropagation(), style: { display: 'flex', flexDirection: 'column', gap: '5px', width: '100%' }, children: [_jsx(DateBox, { readOnly: props.readOnly, ref: dateBoxRef, showClearButton: props.showClearButton, dateSerializationFormat: props.useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: props.disabled, displayFormat: props.displayFormat ?? Globalization.getDateDisplayFormat(props.dateDisplayType), dropDownOptions: dropDownOptions, label: props.label, labelMode: 'static', type: getType(), useMaskBehavior: true, height: '28px', value: props.value, width: props.width, valueChangeEvent: 'keyup input change', onValueChange: (e) => { props.onValueChange?.(e); }, onInitialized: (e) => { props.onInitialized?.(e); }, onContentReady: (e) => { props.onContentReady?.(e); }, placeholder: props.placeholder, ...(props.name && { name: props.name }), inputAttr: effectiveInputAttr, onKeyUp: (e) => {
|
|
137
69
|
if (e.event?.code == "Space") {
|
|
138
70
|
const currentDate = new Date();
|
|
139
71
|
currentDate.setHours(0, 0, 0, 0);
|
|
@@ -141,7 +73,7 @@ const TMDateBox = (props) => {
|
|
|
141
73
|
}
|
|
142
74
|
}, onValueChanged: (e) => {
|
|
143
75
|
if (resetTimeToZero) {
|
|
144
|
-
if (value != undefined)
|
|
76
|
+
if (props.value != undefined)
|
|
145
77
|
return;
|
|
146
78
|
if (!e.value)
|
|
147
79
|
return;
|
|
@@ -149,6 +81,6 @@ const TMDateBox = (props) => {
|
|
|
149
81
|
currentDate.setHours(0, 0, 0, 0);
|
|
150
82
|
e.component.option("value", currentDate.toISOString());
|
|
151
83
|
}
|
|
152
|
-
} }), _jsx(TMVilViewer, { vil: validationItems })] })] }));
|
|
84
|
+
} }), _jsx(TMVilViewer, { vil: props.validationItems })] })] }));
|
|
153
85
|
};
|
|
154
86
|
export default TMDateBox;
|
|
@@ -10,10 +10,21 @@ import TMTextBox from './TMTextBox';
|
|
|
10
10
|
import { TMMetadataIcon } from '../viewers/TMMidViewer';
|
|
11
11
|
import TMTextArea from './TMTextArea';
|
|
12
12
|
import { DateDisplayTypes } from '../../helper/Globalization';
|
|
13
|
-
import { getCurrencySymbol, getDevExtremeDateDisplayFormat } from '../../helper/TMUtils';
|
|
14
13
|
const renderMetadataIcon = (tid, md, layoutMode, isMetadataSelected, showLabel) => {
|
|
15
14
|
return (_jsx(TMMetadataIcon, { isMetadataSelected: isMetadataSelected, layoutMode: layoutMode, md: md, tid: tid, elementStyle: showLabel ? { position: 'relative', top: '4px' } : undefined }));
|
|
16
15
|
};
|
|
16
|
+
const getDateDisplayFormat = (format) => {
|
|
17
|
+
format = format ?? MetadataFormats.None;
|
|
18
|
+
switch (format) {
|
|
19
|
+
case MetadataFormats.LongTime: return "longTime";
|
|
20
|
+
case MetadataFormats.ShortTime: return "shortTime";
|
|
21
|
+
case MetadataFormats.ShortDateLongTime:
|
|
22
|
+
case MetadataFormats.ShortDateShortTime:
|
|
23
|
+
case MetadataFormats.LongDateLongTime:
|
|
24
|
+
case MetadataFormats.LongDateShortTime: return "shortDateShortTime";
|
|
25
|
+
default: return "shortDate";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
17
28
|
const getDateDisplayType = (format) => {
|
|
18
29
|
format = format ?? MetadataFormats.None;
|
|
19
30
|
switch (format) {
|
|
@@ -26,13 +37,6 @@ const getDateDisplayType = (format) => {
|
|
|
26
37
|
default: return DateDisplayTypes.Date;
|
|
27
38
|
}
|
|
28
39
|
};
|
|
29
|
-
const getTextTransform = (format) => {
|
|
30
|
-
switch (format) {
|
|
31
|
-
case MetadataFormats.LowerCase: return 'lowercase';
|
|
32
|
-
case MetadataFormats.UpperCase: return 'uppercase';
|
|
33
|
-
default: return undefined;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
40
|
const TMMetadataEditor = ({ isSelected = false, customLabel, isReadOnly, isLexProt, layoutMode, queryOperator, isEditable, isModifiedWhen = false, tid, mid, value, queryParamsDynDataList, containerElement, autoFocus, validationItems = [], disabled = false, openChooserBySingleClick = true, onValueChanged, onValueChange, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs, updateIsModalOpen }) => {
|
|
37
41
|
const [md, setMd] = useState();
|
|
38
42
|
useEffect(() => {
|
|
@@ -100,26 +104,23 @@ const TMMetadataEditor = ({ isSelected = false, customLabel, isReadOnly, isLexPr
|
|
|
100
104
|
else
|
|
101
105
|
onValueChanged?.(IDs.join(","));
|
|
102
106
|
}, updateIsModalOpen: updateIsModalOpen });
|
|
103
|
-
if (showAsText)
|
|
104
|
-
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', showClearButton: !isReadOnlyResult, maxLength: maxLength, autoFocus: autoFocus, value: value ?? '',
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'number', showClearButton: !isReadOnlyResult, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', currencySymbol: getCurrencySymbol(md?.format?.format), onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
108
|
-
}
|
|
107
|
+
if (showAsText)
|
|
108
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', showClearButton: !isReadOnlyResult, maxLength: maxLength, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
109
|
+
if (showAsNumber)
|
|
110
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'number', showClearButton: !isReadOnlyResult, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
109
111
|
switch (md?.dataType) {
|
|
110
112
|
case MetadataDataTypes.DateTime:
|
|
111
|
-
return _jsx(TMDateBox, { placeholder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', dateDisplayType: getDateDisplayType(md.format?.format), displayFormat:
|
|
113
|
+
return _jsx(TMDateBox, { placeholder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', dateDisplayType: getDateDisplayType(md.format?.format), displayFormat: getDateDisplayFormat(md.format?.format), isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, icon: showLabelTop ? icon : undefined, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, validationItems: validationItems, disabled: disabled, width: '100%', value: value, showClearButton: !isReadOnlyResult, useDateSerializationFormat: true, containerElement: containerElement, onValueChange: (newValue) => {
|
|
112
114
|
onValueChange?.(newValue ? newValue.toString() : undefined);
|
|
113
115
|
onValueChanged?.(newValue ? newValue.toString() : undefined);
|
|
114
116
|
} });
|
|
115
|
-
case MetadataDataTypes.Number:
|
|
116
|
-
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'number', showClearButton: !isReadOnlyResult, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', currencySymbol: getCurrencySymbol(md?.format?.format), onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
117
|
+
case MetadataDataTypes.Number: return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'number', showClearButton: !isReadOnlyResult, precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
117
118
|
default:
|
|
118
119
|
if (showByTextarea) {
|
|
119
|
-
return _jsx(TMTextArea, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', rows: 1, readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, isModifiedWhen: isModifiedWhenInternal(), validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, showClearButton: !isReadOnlyResult, autoFocus: autoFocus, maxLength: maxLength, value: value ?? '',
|
|
120
|
+
return _jsx(TMTextArea, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', rows: 1, readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, isModifiedWhen: isModifiedWhenInternal(), validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, showClearButton: !isReadOnlyResult, autoFocus: autoFocus, maxLength: maxLength, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => { onValueChanged?.(newValue); }, resize: false });
|
|
120
121
|
}
|
|
121
122
|
else {
|
|
122
|
-
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, disabled: disabled, validationItems: validationItems, type: 'text', elementStyle: { width: '100%' }, showClearButton: !isReadOnlyResult, autoFocus: autoFocus, maxLength: maxLength, value: value ?? '',
|
|
123
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: (modulesWithLabelTop || showLabelTop) ? (customLabel ?? md?.nameLoc) : undefined, icon: showLabelTop ? icon : undefined, disabled: disabled, validationItems: validationItems, type: 'text', elementStyle: { width: '100%' }, showClearButton: !isReadOnlyResult, autoFocus: autoFocus, maxLength: maxLength, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => { onValueChanged?.(newValue); } });
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
};
|