@topconsultnpm/sdkui-react-beta 6.6.107 → 6.6.108
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.
|
@@ -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, title, children, isModal, exception, customToolbarElements, hasNavigation, showBackButton, 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, showBackButton, onClose, onSaveAsync, onNext, onPrev, canNext, canPrev, isModified, onShowList, validationItems = [], onUndo, onCancel, width, height }) => {
|
|
15
15
|
const [showList, setShowList] = useState(true);
|
|
16
16
|
const [showErrorGrid, setShowErrorGrid] = useState(false);
|
|
17
17
|
// let windowWidth = useWindowWidth()
|
|
@@ -66,7 +66,7 @@ const TMSaveForm = ({ id, formMode = FormModes.Update, title, children, isModal,
|
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
68
|
const doClose = () => {
|
|
69
|
-
if (!isModified) {
|
|
69
|
+
if (!isModified || skipIsModifiedCheck) {
|
|
70
70
|
onClose?.();
|
|
71
71
|
deviceType === DeviceType.MOBILE && setShowList(true), onShowList?.(true);
|
|
72
72
|
return;
|
|
@@ -92,11 +92,11 @@ const TMSaveForm = ({ id, formMode = FormModes.Update, title, children, isModal,
|
|
|
92
92
|
const warningsCount = validationItems.filter(o => o.ResultType == ResultTypes.WARNING).length;
|
|
93
93
|
const errorsCount = validationItems.filter(o => o.ResultType == ResultTypes.ERROR).length;
|
|
94
94
|
const renderSaveForm = () => {
|
|
95
|
-
return (_jsxs(TMLayoutContainer, { direction: 'vertical', children: [_jsx(TMLayoutItem, { height: 'max-content', children: _jsxs(StyledToolbarForm, { children: [showBackButton && _jsx(TMButton, { btnStyle: 'toolbar', color: 'tertiary', caption: SDKUI_Localizator.Back, icon: _jsx(IconArrowLeft, {}), elementStyle: { marginRight: '10px' }, onClick: () => { doClose(); } }), _jsx(TMButton, { caption: SDKUI_Localizator.Save, icon: _jsx(IconSave, {}), keyGesture: "alt+s", backgroundColor: errorsCount > 0 ? TMColors.error : isModified ? TMColors.success : TMColors.disabled, onClick: doSaveAsync, color: "success", btnStyle: "toolbar", disabled: !(isModified && errorsCount <= 0) }), hasNavigation && _jsx(TMButton, { caption: SDKUI_Localizator.Previous, icon: _jsx(IconArrowUp, {}), btnStyle: "toolbar", disabled: !canPrev || isModified || formMode == FormModes.Create || formMode == FormModes.Duplicate, onClick: doPrev }), hasNavigation && _jsx(TMButton, { caption: SDKUI_Localizator.Next, icon: _jsx(IconArrowDown, {}), btnStyle: "toolbar", disabled: !canNext || isModified || formMode == FormModes.Create || formMode == FormModes.Duplicate, onClick: doNext }), _jsx(TMButton, { caption: SDKUI_Localizator.Undo, icon: _jsx(IconUndo, {}), keyGesture: "alt+z", color: "tertiary", btnStyle: "toolbar", disabled: isModified ? false : true, onClick: onUndo }), customToolbarElements, warningsCount > 0 &&
|
|
95
|
+
return (_jsxs(TMLayoutContainer, { direction: 'vertical', children: [showToolbar && _jsx(TMLayoutItem, { height: 'max-content', children: _jsxs(StyledToolbarForm, { children: [showBackButton && _jsx(TMButton, { btnStyle: 'toolbar', color: 'tertiary', caption: SDKUI_Localizator.Back, icon: _jsx(IconArrowLeft, {}), elementStyle: { marginRight: '10px' }, onClick: () => { doClose(); } }), _jsx(TMButton, { caption: SDKUI_Localizator.Save, icon: _jsx(IconSave, {}), keyGesture: "alt+s", backgroundColor: errorsCount > 0 ? TMColors.error : isModified ? TMColors.success : TMColors.disabled, onClick: doSaveAsync, color: "success", btnStyle: "toolbar", disabled: !(isModified && errorsCount <= 0) }), hasNavigation && _jsx(TMButton, { caption: SDKUI_Localizator.Previous, icon: _jsx(IconArrowUp, {}), btnStyle: "toolbar", disabled: !canPrev || isModified || formMode == FormModes.Create || formMode == FormModes.Duplicate, onClick: doPrev }), hasNavigation && _jsx(TMButton, { caption: SDKUI_Localizator.Next, icon: _jsx(IconArrowDown, {}), btnStyle: "toolbar", disabled: !canNext || isModified || formMode == FormModes.Create || formMode == FormModes.Duplicate, onClick: doNext }), _jsx(TMButton, { caption: SDKUI_Localizator.Undo, icon: _jsx(IconUndo, {}), keyGesture: "alt+z", color: "tertiary", btnStyle: "toolbar", disabled: isModified ? false : true, onClick: onUndo }), customToolbarElements, warningsCount > 0 &&
|
|
96
96
|
_jsx(TMLayoutItem, { width: 'fit-content', height: '90%', children: _jsxs(StyledResultTypeContainer, { style: { marginLeft: '10px' }, onClick: () => setShowErrorGrid(!showErrorGrid), "$resultType": ResultTypes.WARNING, children: [" ", _jsx(IconWarning, { fontSize: 16 }), " ", _jsx("span", { children: warningsCount })] }) }), errorsCount > 0 &&
|
|
97
97
|
_jsx(TMLayoutItem, { width: 'fit-content', height: '90%', children: _jsxs(StyledResultTypeContainer, { style: { marginLeft: warningsCount <= 0 ? '10px' : '0' }, onClick: () => setShowErrorGrid(!showErrorGrid), "$resultType": ResultTypes.ERROR, children: [" ", _jsx(IconCloseCircle, { fontSize: 16 }), " ", _jsx("span", { children: errorsCount })] }) }), onShowList &&
|
|
98
98
|
_jsx("div", { style: { right: '10px', position: 'absolute' }, children: deviceType !== DeviceType.MOBILE && _jsx(TMButton, { caption: showList ? SDKUI_Localizator.List_Hide : SDKUI_Localizator.List_Show, icon: showList ? _jsx(IconHide, {}) : _jsx(IconShow, {}), keyGesture: "alt+h", onClick: () => { setShowList(!showList); onShowList?.(!showList); }, btnStyle: 'toolbar' }) }), (formMode == FormModes.Create || formMode == FormModes.Duplicate) &&
|
|
99
|
-
_jsx("div", { style: { right: '50px', position: 'absolute' }, children: deviceType !== DeviceType.MOBILE && onCancel && _jsx(TMButton, { icon: _jsx(IconCloseCircle, {}), onClick: onCancel, btnStyle: 'toolbar', caption: SDKUI_Localizator.Cancel, color: 'tertiary' }) })] }) }), _jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { separatorSize: 4, direction: 'vertical', start: showErrorGrid && validationItems.length > 0 ? ['80%', '20%'] : ['100%', '0'], min: ['0', '0'], children: [_jsx(TMCard, { showBorder: false, children: exception
|
|
99
|
+
_jsx("div", { style: { right: '50px', position: 'absolute' }, children: deviceType !== DeviceType.MOBILE && onCancel && _jsx(TMButton, { icon: _jsx(IconCloseCircle, {}), onClick: onCancel, btnStyle: 'toolbar', caption: SDKUI_Localizator.Cancel, color: 'tertiary' }) })] }) }), _jsx(TMLayoutItem, { height: showToolbar ? 'calc(100% - 35px)' : '100%', children: _jsxs(TMSplitterLayout, { separatorSize: 4, direction: 'vertical', start: showErrorGrid && validationItems.length > 0 ? ['80%', '20%'] : ['100%', '0'], min: ['0', '0'], children: [_jsx(TMCard, { showBorder: false, children: exception
|
|
100
100
|
?
|
|
101
101
|
_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' })
|
|
102
102
|
: _jsx(_Fragment, { children: children }) }), showErrorGrid && validationItems.length > 0 ? _jsx(TMCard, { scrollY: true, padding: false, showBorder: false, children: _jsx(TMValidationItemsList, { validationItems: validationItems }) }) : _jsx(_Fragment, {})] }) })] }));
|
|
@@ -34,33 +34,33 @@ export const TMMetadataIcon = ({ tid, md }) => {
|
|
|
34
34
|
let icon = null;
|
|
35
35
|
switch (md.dataDomain) {
|
|
36
36
|
case MetadataDataDomains.Computed:
|
|
37
|
-
icon = _jsx(IconMetadata_Computed, { fontSize: 16, color: md.isRequired ? TMColors.error : TMColors.text_normal });
|
|
37
|
+
icon = _jsx(IconMetadata_Computed, { fontSize: 16, color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal });
|
|
38
38
|
break;
|
|
39
39
|
case MetadataDataDomains.DataList:
|
|
40
|
-
icon = _jsx(IconMetadata_DataList, { fontSize: 16, color: md.isRequired ? TMColors.error : TMColors.text_normal });
|
|
40
|
+
icon = _jsx(IconMetadata_DataList, { fontSize: 16, color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal });
|
|
41
41
|
break;
|
|
42
42
|
case MetadataDataDomains.DynamicDataList:
|
|
43
|
-
icon = _jsx(IconMetadata_DynamicDataList, { fontSize: 16, color: md.isRequired ? TMColors.error : TMColors.text_normal });
|
|
43
|
+
icon = _jsx(IconMetadata_DynamicDataList, { fontSize: 16, color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal });
|
|
44
44
|
break;
|
|
45
45
|
case MetadataDataDomains.Numerator:
|
|
46
|
-
icon = _jsx(IconMetadata_Numerator, { fontSize: 16, color: md.isRequired ? TMColors.error : TMColors.text_normal });
|
|
46
|
+
icon = _jsx(IconMetadata_Numerator, { fontSize: 16, color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal });
|
|
47
47
|
break;
|
|
48
48
|
case MetadataDataDomains.Special:
|
|
49
|
-
icon = _jsx(IconMetadata_Special, { fontSize: 16, color: md.isRequired ? TMColors.error : TMColors.text_normal });
|
|
49
|
+
icon = _jsx(IconMetadata_Special, { fontSize: 16, color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal });
|
|
50
50
|
break;
|
|
51
51
|
case MetadataDataDomains.UserID:
|
|
52
|
-
icon = _jsx(IconMetadata_User, { fontSize: 16, color: md.isRequired ? TMColors.error : TMColors.text_normal });
|
|
52
|
+
icon = _jsx(IconMetadata_User, { fontSize: 16, color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal });
|
|
53
53
|
break;
|
|
54
54
|
default:
|
|
55
55
|
switch (md.dataType) {
|
|
56
56
|
case MetadataDataTypes.Varchar:
|
|
57
|
-
icon = _jsx(IconMetadata_Text, { fontSize: 16, color: md.isRequired ? TMColors.error : TMColors.text_normal });
|
|
57
|
+
icon = _jsx(IconMetadata_Text, { fontSize: 16, color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal });
|
|
58
58
|
break;
|
|
59
59
|
case MetadataDataTypes.Number:
|
|
60
|
-
icon = _jsx(IconMetadata_Numeric, { fontSize: 16, color: md.isRequired ? TMColors.error : TMColors.text_normal });
|
|
60
|
+
icon = _jsx(IconMetadata_Numeric, { fontSize: 16, color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal });
|
|
61
61
|
break;
|
|
62
62
|
case MetadataDataTypes.DateTime:
|
|
63
|
-
icon = _jsx(IconMetadata_Date, { fontSize: 16, color: md.isRequired ? TMColors.error : TMColors.text_normal });
|
|
63
|
+
icon = _jsx(IconMetadata_Date, { fontSize: 16, color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal });
|
|
64
64
|
break;
|
|
65
65
|
default:
|
|
66
66
|
icon = _jsx(_Fragment, {});
|
|
@@ -80,7 +80,7 @@ export const TMMetadataTooltip = ({ tid, md, children }) => {
|
|
|
80
80
|
};
|
|
81
81
|
const renderTooltipContent = (tid, md) => {
|
|
82
82
|
return (!md ? null
|
|
83
|
-
: _jsxs(StyledTooltipContainer, { children: [_jsx(StyledTooltipItem, { children: `${SDK_Globals.useLocalizedName ? md.nameLoc : md.name} (TID: ${tid}, MID: ${md.id})` }), md.description && _jsx(StyledTooltipItem, { children: md.description }), _jsx(StyledTooltipSeparatorItem, {}), _jsxs(StyledTooltipItem, { children: [md.dataType, " ", md.dataType == MetadataDataTypes.Varchar ? `(${md.length ?? 0})` : md.dataType == MetadataDataTypes.Number ? `(${md.length ?? 0},${md.scale ?? 0})` : '', md.isPrimaryKey === 1 ? ' (PK)' : ''] }), _jsx(StyledTooltipItem, {
|
|
83
|
+
: _jsxs(StyledTooltipContainer, { children: [_jsx(StyledTooltipItem, { children: `${SDK_Globals.useLocalizedName ? md.nameLoc : md.name} (TID: ${tid}, MID: ${md.id})` }), md.description && _jsx(StyledTooltipItem, { children: md.description }), _jsx(StyledTooltipSeparatorItem, {}), _jsxs(StyledTooltipItem, { children: [md.dataType, " ", md.dataType == MetadataDataTypes.Varchar ? `(${md.length ?? 0})` : md.dataType == MetadataDataTypes.Number ? `(${md.length ?? 0},${md.scale ?? 0})` : '', md.isPrimaryKey === 1 ? ' (PK)' : ''] }), _jsx(StyledTooltipItem, { style: { color: md.isRequired === 1 ? TMColors.error : TMColors.text_normal }, children: md.isRequired === 1 ? SDKUI_Localizator.Required : SDKUI_Localizator.RequiredNOT }), md.dataDomain && _jsx(StyledTooltipItem, { children: md.dataDomain }), md.isLexProt == 1 && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.Yes}` }), md.isLexProt == 2 && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.MetadataFlag}` }), md.isLexProt == 3 && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.Yes} (${SDKUI_Localizator.MetadataFlag})` }), md.isFreeSearchInput && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Search_Free}: ${SDKUI_Localizator.Yes}` }), md.isSpecialSearchOutput && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Search_Special}: ${SDKUI_Localizator.Yes}` }), md.format?.format && md.format.format != MetadataFormats.None && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Format}: ${LocalizeMetadataFormats(md.format.format)}` }), md.defaultValue && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Default}: ${_setDefaultValueForUI(md.defaultValue)}` }), md.fromTID && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.MetadataRoot}: ${md.isRootMID == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No}` }), md.templateMID && _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Template}: ${md.templateMID}` }), md.perm && _jsxs(_Fragment, { children: [_jsx(StyledTooltipItem, { "$color": 'primary', "$marginTop": '5px', children: SDKUI_Localizator.Perms }), _jsx(StyledTooltipSeparatorItem, {}), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Archive}: ${md.perm.canArchive}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.View_Metadato}: ${md.perm.canView}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Search}: ${md.perm.canSearch}` }), _jsx(StyledTooltipItem, { children: `${SDKUI_Localizator.Update}: ${md.perm.canUpdate}` })] })] }));
|
|
84
84
|
};
|
|
85
85
|
return (_jsx("div", { style: { pointerEvents: 'all' }, children: _jsx(TMTooltip, { content: renderTooltipContent(tid, md), children: children }) }));
|
|
86
86
|
};
|
package/lib/ts/types.d.ts
CHANGED