@topconsultnpm/sdkui-react-beta 6.9.24 → 6.9.26
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/choosers/TMDynDataListItemChooser.js +0 -4
- package/lib/components/editors/TMEditorStyled.js +2 -2
- package/lib/components/editors/TMMetadataEditor.d.ts +4 -1
- package/lib/components/editors/TMMetadataEditor.js +18 -18
- package/lib/components/editors/TMSummary.js +2 -2
- package/lib/components/editors/TMTextBox.js +2 -4
- package/lib/hooks/useQueryParametersDialog.js +0 -1
- package/package.json +1 -1
|
@@ -93,10 +93,6 @@ const TMDynDataListItemChooser = ({ tid, md, layoutMode = LayoutModes.None, quer
|
|
|
93
93
|
};
|
|
94
94
|
export default TMDynDataListItemChooser;
|
|
95
95
|
export const TMDynDataListItemChooserForm = (props) => {
|
|
96
|
-
// const renderDataGridColumns = [
|
|
97
|
-
// <Column key={0} dataField={"value"} caption={SDKUI_Localizator.Value} />,
|
|
98
|
-
// <Column key={1} dataField={"name"} caption={SDKUI_Localizator.Description} />
|
|
99
|
-
// ]
|
|
100
96
|
const renderDataGridColumns = props.searchResult?.dtdResult?.columns?.map((col, index) => {
|
|
101
97
|
let keyField = getDataColumnName(props.searchResult?.fromTID, col);
|
|
102
98
|
const isVisible = col.extendedProperties?.["Visibility"] != "Hidden";
|
|
@@ -18,7 +18,7 @@ export const StyledEditorContainer = styled.div `
|
|
|
18
18
|
`;
|
|
19
19
|
export const StyledEditor = styled.input `
|
|
20
20
|
width: ${props => props.$width};
|
|
21
|
-
padding: ${props => props.$type === 'password' ? '
|
|
21
|
+
padding: ${props => props.$type === 'password' ? '4px 10px 4px 13px' : props.$type === 'number' ? '4px 4px 5px 8px' : '4px 13px'};
|
|
22
22
|
border: 1px solid;
|
|
23
23
|
border-color: ${props => props.$isModified ? TMColors.isModified : TMColors.border_normal};
|
|
24
24
|
border-bottom: ${props => (props.$vil.length > 0) ? '3px' : '1px'} solid ;
|
|
@@ -96,7 +96,7 @@ export const StyledTextareaEditor = styled.textarea `
|
|
|
96
96
|
: TMColors.disabled};
|
|
97
97
|
border-radius: ${props => props.$borderRadius ?? TMEditorsDefaultBorderRadius}; /* Slightly increased radius for smoother corners */
|
|
98
98
|
min-width: ${props => (props.$isMobile ? '70px' : '100%')}; /* Adjust for mobile */
|
|
99
|
-
max-height: ${props => props.$maxHeight
|
|
99
|
+
max-height: ${props => props.$maxHeight ?? 'auto'};
|
|
100
100
|
resize: ${props => (props.$resize === false ? 'none' : 'both')};
|
|
101
101
|
&:focus {
|
|
102
102
|
outline: none;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { ValidationItem, LayoutModes, QueryOperators } from '@topconsultnpm/sdk-ts-beta';
|
|
2
3
|
import { DynDataListsToBeRefreshed, MIDsToBeUpdated } from '../choosers/TMDynDataListItemChooser';
|
|
3
4
|
interface ITMMetadataEditorProps {
|
|
@@ -13,10 +14,12 @@ interface ITMMetadataEditorProps {
|
|
|
13
14
|
layoutMode?: LayoutModes;
|
|
14
15
|
queryOperator?: QueryOperators;
|
|
15
16
|
isModifiedWhen?: boolean;
|
|
17
|
+
isEditableList?: boolean;
|
|
18
|
+
iconContextMenu?: React.ReactNode;
|
|
16
19
|
onValueChanged?: (value: any) => void;
|
|
17
20
|
onValueChange?: (value: any) => void;
|
|
18
21
|
onCascadeRefreshDynDataLists?: (dynDataListsToBeRefreshed: DynDataListsToBeRefreshed[]) => void;
|
|
19
22
|
onCascadeUpdateMIDs?: (midsToBeUpdated: MIDsToBeUpdated[]) => void;
|
|
20
23
|
}
|
|
21
|
-
declare const TMMetadataEditor: ({ isLexProt, layoutMode, queryOperator, isModifiedWhen, tid, mid, value, queryParamsDynDataList, containerElement, autoFocus, validationItems, disabled, onValueChanged, onValueChange, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs }: ITMMetadataEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare const TMMetadataEditor: ({ isLexProt, layoutMode, queryOperator, isEditableList, isModifiedWhen, tid, mid, value, queryParamsDynDataList, containerElement, autoFocus, validationItems, disabled, iconContextMenu, onValueChanged, onValueChange, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs }: ITMMetadataEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
25
|
export default TMMetadataEditor;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { MetadataDataDomains, MetadataDataTypes, DcmtTypeListCacheService, LayoutModes, AccessLevels, PlatformObjectValidator, QueryOperators } from '@topconsultnpm/sdk-ts-beta';
|
|
4
|
-
import { IconLayerGroup } from '../../helper';
|
|
5
4
|
import { TMColors } from '../../utils/theme';
|
|
6
|
-
import ShowAlert from '../base/TMAlert';
|
|
7
5
|
import TMDataListItemChooser from '../choosers/TMDataListItemChooser';
|
|
8
6
|
import TMDynDataListItemChooser from '../choosers/TMDynDataListItemChooser';
|
|
9
7
|
import TMUserChooser from '../choosers/TMUserChooser';
|
|
@@ -11,7 +9,10 @@ import TMDateBox from './TMDateBox';
|
|
|
11
9
|
import TMTextBox from './TMTextBox';
|
|
12
10
|
import { TMMetadataIcon } from '../viewers/TMMidViewer';
|
|
13
11
|
import TMTextArea from './TMTextArea';
|
|
14
|
-
const
|
|
12
|
+
const renderMetadataIcon = (tid, md, layoutMode, iconContextMenu) => {
|
|
13
|
+
return (_jsxs("div", { id: `md-${md?.id}`, style: { height: '100%', width: '100%' }, children: [_jsx(TMMetadataIcon, { layoutMode: layoutMode, md: md, tid: tid }), iconContextMenu] }));
|
|
14
|
+
};
|
|
15
|
+
const TMMetadataEditor = ({ isLexProt, layoutMode, queryOperator, isEditableList, isModifiedWhen = false, tid, mid, value, queryParamsDynDataList, containerElement, autoFocus, validationItems = [], disabled = false, iconContextMenu, onValueChanged, onValueChange, onCascadeRefreshDynDataLists, onCascadeUpdateMIDs }) => {
|
|
15
16
|
const [md, setMd] = useState();
|
|
16
17
|
useEffect(() => {
|
|
17
18
|
DcmtTypeListCacheService.GetAsync(tid).then((dtd) => {
|
|
@@ -36,44 +37,43 @@ const TMMetadataEditor = ({ isLexProt, layoutMode, queryOperator, isModifiedWhen
|
|
|
36
37
|
let maxLength = md?.length;
|
|
37
38
|
if (layoutMode === LayoutModes.None && showAsText)
|
|
38
39
|
maxLength = 1000;
|
|
39
|
-
let btnDistincValues = { text: 'Valori distinti', icon: _jsx(IconLayerGroup, { fontSize: 16 }), onClick: () => { ShowAlert({ message: "TODO Valori distinti", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } };
|
|
40
40
|
let isReadOnlyResult = isReadOnlyInternal();
|
|
41
41
|
if (value?.startsWith("{@QueryParam") || value == "{@UserName}" || value == "{@UserID}" || queryOperator == QueryOperators.Custom)
|
|
42
|
-
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ?
|
|
43
|
-
if (md?.dataDomain == MetadataDataDomains.DynamicDataList)
|
|
44
|
-
return _jsx(TMDynDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', readOnly: isReadOnlyResult, layoutMode: layoutMode, isModifiedWhen: isModifiedWhenInternal(), label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ?
|
|
42
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, type: 'text', maxLength: maxLength, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
|
|
43
|
+
if (md?.dataDomain == MetadataDataDomains.DynamicDataList && !isEditableList)
|
|
44
|
+
return _jsx(TMDynDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', readOnly: isReadOnlyResult, layoutMode: layoutMode, isModifiedWhen: isModifiedWhenInternal(), label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : undefined, validationItems: validationItems, disabled: disabled, md: md, tid: tid, queryParamsDynDataList: queryParamsDynDataList, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, onCascadeUpdateMIDs: onCascadeUpdateMIDs, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, allowMultipleSelection: multipleSelectionIsenabled, values: value ? [value] : [], showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
|
|
45
45
|
if (!IDs || IDs.length <= 0)
|
|
46
46
|
onValueChanged?.(undefined);
|
|
47
47
|
else
|
|
48
48
|
onValueChanged?.(IDs[0]);
|
|
49
49
|
} });
|
|
50
|
-
if (md?.dataDomain == MetadataDataDomains.DataList)
|
|
51
|
-
return _jsx(TMDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ?
|
|
50
|
+
if (md?.dataDomain == MetadataDataDomains.DataList && !isEditableList)
|
|
51
|
+
return _jsx(TMDataListItemChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, dataListId: md.dataListID, allowMultipleSelection: multipleSelectionIsenabled, values: value?.split(',').map((item) => !item.startsWith("'") ? item : item.slice(1, -1)) ?? [], showClearButton: !isReadOnlyResult, onValueChanged: (IDs) => {
|
|
52
52
|
if (!IDs || IDs.length <= 0)
|
|
53
53
|
onValueChanged?.(undefined);
|
|
54
54
|
else
|
|
55
55
|
onValueChanged?.(IDs.join(","));
|
|
56
56
|
} });
|
|
57
|
-
if (md?.dataDomain == MetadataDataDomains.UserID)
|
|
58
|
-
return _jsx(TMUserChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ?
|
|
57
|
+
if (md?.dataDomain == MetadataDataDomains.UserID && !isEditableList)
|
|
58
|
+
return _jsx(TMUserChooser, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', readOnly: isReadOnlyResult, isModifiedWhen: isModifiedWhenInternal(), label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : undefined, validationItems: validationItems, disabled: disabled, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, showClearButton: !isReadOnlyResult, allowMultipleSelection: multipleSelectionIsenabled, values: value?.split(',').map((item) => !item.startsWith("'") ? Number(item) : Number(item.slice(1, -1))) ?? [], onValueChanged: (IDs) => {
|
|
59
59
|
if (!IDs || IDs.length <= 0)
|
|
60
60
|
onValueChanged?.(undefined);
|
|
61
61
|
else
|
|
62
62
|
onValueChanged?.(IDs.join(","));
|
|
63
63
|
} });
|
|
64
64
|
if (showAsText)
|
|
65
|
-
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ?
|
|
65
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : 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) });
|
|
66
66
|
if (showAsNumber)
|
|
67
|
-
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ?
|
|
67
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : 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) });
|
|
68
68
|
switch (md?.dataType) {
|
|
69
|
-
case MetadataDataTypes.DateTime: return _jsx(TMDateBox, { placeholder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, icon: showLabelTop ?
|
|
70
|
-
case MetadataDataTypes.Number: return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ?
|
|
69
|
+
case MetadataDataTypes.DateTime: return _jsx(TMDateBox, { placeholder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : undefined, label: showLabelTop ? md?.nameLoc : undefined, validationItems: validationItems, disabled: disabled, width: '100%', value: value, showClearButton: !isReadOnlyResult, useDateSerializationFormat: true, containerElement: containerElement, onValueChange: (newValue) => { onValueChange?.(newValue ? newValue.toString() : undefined); onValueChanged?.(newValue ? newValue.toString() : undefined); } });
|
|
70
|
+
case MetadataDataTypes.Number: return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : 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) });
|
|
71
71
|
default:
|
|
72
72
|
if (showByTextarea) {
|
|
73
|
-
return _jsx(TMTextArea, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', rows: 1, readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ?
|
|
73
|
+
return _jsx(TMTextArea, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', rows: 1, readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : 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 });
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
|
-
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ?
|
|
76
|
+
return _jsx(TMTextBox, { placeHolder: layoutMode === LayoutModes.Ark ? md?.defaultValue ?? '' : '', isModifiedWhen: isModifiedWhenInternal(), readOnly: isReadOnlyResult, label: showLabelTop ? md?.nameLoc : undefined, icon: showLabelTop ? renderMetadataIcon(tid, md, layoutMode, iconContextMenu) : 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); } });
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
};
|
|
@@ -9,7 +9,7 @@ import TMTooltip from '../base/TMTooltip';
|
|
|
9
9
|
const StyledSummaryTemplateInput = styled.div `
|
|
10
10
|
width: ${props => props.$width};
|
|
11
11
|
height: ${props => props.$height};
|
|
12
|
-
padding: ${props => !props.$showBorder ? '0px 5px' : '
|
|
12
|
+
padding: ${props => !props.$showBorder ? '0px 5px' : '5px 5px'};
|
|
13
13
|
border: ${props => !props.$showBorder ? '' : '1px solid'};
|
|
14
14
|
background: ${props => props.$readOnly ? 'linear-gradient(white 20%, #d6d6d6 80%)' : props.$backgroundColor};
|
|
15
15
|
border-color: ${props => props.$isModified ? TMColors.isModified : TMColors.border_normal};
|
|
@@ -50,7 +50,7 @@ const TMSummary = ({ placeHolder, readOnly, labelColor, hasValue, borderRadius =
|
|
|
50
50
|
const renderTemplateField = () => {
|
|
51
51
|
return (_jsx(StyledSummaryTemplateInput, { "$readOnly": readOnly, tabIndex: 0, "$backgroundColor": backgroundColor, "$borderRadius": borderRadius, "$isModified": isModifiedWhen, "$vil": validationItems, "$disabled": disabled, "$showBorder": showBorder, "$fontSize": fontSize, "$width": width, "$height": height, onChange: onValueChanged, children: _jsxs("div", { onClick: () => { if (openEditorOnSummaryClick && !disabled)
|
|
52
52
|
onEditorClick?.(); }, onDoubleClick: () => { if (!openEditorOnSummaryClick && !disabled)
|
|
53
|
-
onEditorClick?.(); }, style: { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', width: '100%', minHeight: '16px', cursor: openEditorOnSummaryClick ? 'pointer' : 'default' }, children: [template, _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [showClearButton && hasValue && _jsx(StyledEditorButtonIcon2, { tabIndex: disabled ? -1 : 0, onKeyDown: (e) => e.code === 'Space' && onClearClick?.(), onClick: onClearClick, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Clear, children: _jsx(IconClearButton, {}) }) }), !openEditorOnSummaryClick && showEditButton && _jsx(StyledEditorButtonIcon2, { tabIndex: disabled ? -1 : 0, onKeyDown: (e) => e.code === 'Space' && onEditorClick?.(), onClick: onEditorClick, children: _jsx(TMTooltip, { content: iconeEditTooltip ?? SDKUI_Localizator.Update, children: iconEditButton ?? _jsx(IconPencil, {}) }) }), buttons.map((buttonItem) => {
|
|
53
|
+
onEditorClick?.(); }, style: { display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', width: '100%', minHeight: '16px', cursor: openEditorOnSummaryClick ? 'pointer' : 'default' }, children: [template, _jsxs("div", { style: { display: 'flex', flexDirection: 'row', gap: '3px', justifyContent: 'flex-start', alignItems: 'center', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [showClearButton && hasValue && _jsx(StyledEditorButtonIcon2, { tabIndex: disabled ? -1 : 0, onKeyDown: (e) => e.code === 'Space' && onClearClick?.(), onClick: onClearClick, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Clear, children: _jsx(IconClearButton, {}) }) }), !openEditorOnSummaryClick && showEditButton && _jsx(StyledEditorButtonIcon2, { tabIndex: disabled ? -1 : 0, onKeyDown: (e) => e.code === 'Space' && onEditorClick?.(), onClick: onEditorClick, children: _jsx(TMTooltip, { content: iconeEditTooltip ?? SDKUI_Localizator.Update, children: iconEditButton ?? _jsx(IconPencil, {}) }) }), buttons.map((buttonItem) => {
|
|
54
54
|
return (_jsx(StyledEditorButtonIcon2, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
|
|
55
55
|
})] })] }) }));
|
|
56
56
|
};
|
|
@@ -112,14 +112,12 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, scale, showCle
|
|
|
112
112
|
const getMaxValue = (curValue) => {
|
|
113
113
|
if (maxValue)
|
|
114
114
|
return maxValue;
|
|
115
|
-
// if (precision && (!scale || scale == 0)) return Number("9".repeat(precision ?? 0));
|
|
116
|
-
// console.log(Number("9".repeat((precision ?? 0) - (scale ?? 0)) + '.' + "9".repeat(scale ?? 0)));
|
|
117
115
|
if (precision || scale)
|
|
118
116
|
return Number("9".repeat((precision ?? 0) - (scale ?? 0)) + '.' + "9".repeat(scale ?? 0));
|
|
119
117
|
return Number(curValue);
|
|
120
118
|
};
|
|
121
119
|
const renderInputField = () => {
|
|
122
|
-
return (_jsxs(_Fragment, { children: [_jsx(StyledEditor, { ref: inputRef, id: `text-${id}`, autoFocus: autoFocus, readOnly: readOnly, type: currentType, disabled: disabled, value: currentValue, width: width || '100%', placeholder: placeHolder, maxLength: maxLength, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
|
|
120
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledEditor, { ref: inputRef, id: `text-${label}-${id}`, name: label, autoFocus: autoFocus, readOnly: readOnly, type: currentType, disabled: disabled, value: currentValue, width: width || '100%', placeholder: placeHolder, maxLength: maxLength, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
|
|
123
121
|
onBlur?.(currentValue); }, onChange: (e) => {
|
|
124
122
|
if (currentType === 'number') {
|
|
125
123
|
let number = Number(e.target.value);
|
|
@@ -148,7 +146,7 @@ const TMTextBox = ({ autoFocus, maxLength, labelColor, precision, scale, showCle
|
|
|
148
146
|
e.preventDefault();
|
|
149
147
|
}
|
|
150
148
|
}, "$isMobile": deviceType === DeviceType.MOBILE, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$maxValue": maxValue, "$width": width, "$type": currentType, "$borderRadius": borderRadius }), initialType === 'password' && currentValue && _jsx(StyledShowPasswordIcon, { onClick: toggleShowPassword, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: showPasswordIcon() }), initialType !== 'password' &&
|
|
151
|
-
_jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: '6px', top: label.length > 0 ? '20px' : '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [showClearButton && currentValue &&
|
|
149
|
+
_jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: type === 'number' ? '25px' : '6px', top: label.length > 0 ? '20px' : '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [showClearButton && currentValue &&
|
|
152
150
|
_jsx(StyledTextBoxEditorButton, { onClick: () => {
|
|
153
151
|
onValueChanged?.({ target: { value: undefined } });
|
|
154
152
|
onBlur?.(undefined);
|