@topconsultnpm/sdkui-react 6.22.0-dev2.8 → 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
|
@@ -28,7 +28,7 @@ const StyledTextAreaEditorButton = styled.div `
|
|
|
28
28
|
// Define the TMTextArea component
|
|
29
29
|
const TMTextArea = (props) => {
|
|
30
30
|
// Extract properties from the props object
|
|
31
|
-
const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, showClearButton, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true, autoCalculateRows = true, fillHeight = false, name, id
|
|
31
|
+
const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, showClearButton, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true, autoCalculateRows = true, fillHeight = false, name, id } = props;
|
|
32
32
|
// Generate a unique id if not provided
|
|
33
33
|
const autoId = useId();
|
|
34
34
|
const effectiveId = id ?? autoId;
|
|
@@ -151,28 +151,20 @@ const TMTextArea = (props) => {
|
|
|
151
151
|
};
|
|
152
152
|
// Renders the textarea
|
|
153
153
|
const renderTextArea = () => {
|
|
154
|
-
const textareaElement = _jsxs(_Fragment, { children: [
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
onValueChanged?.({ target: { value: undefined } });
|
|
169
|
-
setCurrentValue('');
|
|
170
|
-
if (autoCalculateRows)
|
|
171
|
-
setCalculatedRows(1);
|
|
172
|
-
onBlur?.(undefined);
|
|
173
|
-
}, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
|
|
174
|
-
return (_jsx(StyledTextAreaEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
|
|
175
|
-
})] })] }), openFormulaItemsChooser(), _jsx(TMVilViewer, { vil: validationItems })] });
|
|
154
|
+
const textareaElement = _jsxs(_Fragment, { children: [_jsx(StyledTextareaEditor, { ref: inputRef, id: effectiveId, ...(name && { name }), autoFocus: autoFocus, readOnly: readOnly, disabled: disabled, value: currentValue, placeholder: placeHolder, rows: fillHeight ? undefined : calculatedRows, maxLength: maxLength, spellCheck: false, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
|
|
155
|
+
onBlur?.(currentValue); }, onChange: (e) => { setCurrentValue(e.target.value); onValueChanged?.(e); }, "$isMobile": deviceType === DeviceType.MOBILE, "$maxHeight": maxHeight, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$width": width, "$resize": resize, style: fillHeight ? { flex: 1, height: 0 } : undefined }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: '6px', top: calculatedRows === 1 ? (label.length > 0 ? '20px' : '7px') : (label.length > 0 ? '22px' : '7px'), pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
|
|
156
|
+
_jsx(StyledTextAreaEditorButton, { onClick: () => {
|
|
157
|
+
setShowFormulaItemsChooser(true);
|
|
158
|
+
}, children: _jsx(IconDataList, {}) }), showClearButton && currentValue &&
|
|
159
|
+
_jsx(StyledTextAreaEditorButton, { onClick: () => {
|
|
160
|
+
onValueChanged?.({ target: { value: undefined } });
|
|
161
|
+
setCurrentValue('');
|
|
162
|
+
if (autoCalculateRows)
|
|
163
|
+
setCalculatedRows(1);
|
|
164
|
+
onBlur?.(undefined);
|
|
165
|
+
}, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
|
|
166
|
+
return (_jsx(StyledTextAreaEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
|
|
167
|
+
})] }), openFormulaItemsChooser(), _jsx(TMVilViewer, { vil: validationItems })] });
|
|
176
168
|
// Wrap with context menu if formula items exist
|
|
177
169
|
if (formulaItems.length > 0) {
|
|
178
170
|
return (_jsx(TMContextMenu, { items: getFormulaMenuItems(), trigger: "right", children: textareaElement }));
|
|
@@ -14,8 +14,6 @@ export interface ITMTextBox extends ITMEditorBase {
|
|
|
14
14
|
value?: string | number;
|
|
15
15
|
fromModal?: boolean;
|
|
16
16
|
allowedPattern?: RegExp;
|
|
17
|
-
textTransform?: 'lowercase' | 'uppercase';
|
|
18
|
-
currencySymbol?: string;
|
|
19
17
|
onClick?: () => void;
|
|
20
18
|
onValueChanged?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
21
19
|
onBlur?: (value: string | undefined) => void;
|
|
@@ -34,7 +34,7 @@ const StyledTextBoxEditorButton = styled.div `
|
|
|
34
34
|
border-bottom-color: ${TMColors.primary};
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
|
-
const TMTextBox = ({ autoComplete = 'off', 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', onClick, onValueChanged, onBlur, onKeyDown, borderRadius, allowedPattern
|
|
37
|
+
const TMTextBox = ({ autoComplete = 'off', 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', onClick, onValueChanged, onBlur, onKeyDown, borderRadius, allowedPattern }) => {
|
|
38
38
|
const [initialType, setInitialType] = useState(type);
|
|
39
39
|
const [currentType, setCurrentType] = useState(type);
|
|
40
40
|
const [currentValue, setCurrentValue] = useState(value);
|
|
@@ -151,13 +151,6 @@ const TMTextBox = ({ autoComplete = 'off', autoFocus, maxLength, labelColor, pre
|
|
|
151
151
|
};
|
|
152
152
|
const handleInputChange = (e) => {
|
|
153
153
|
let inputValue = e.target.value;
|
|
154
|
-
// Applica textTransform direttamente durante la digitazione (non per i numeri)
|
|
155
|
-
if (currentType !== 'number') {
|
|
156
|
-
if (textTransform === 'lowercase')
|
|
157
|
-
inputValue = inputValue.toLowerCase();
|
|
158
|
-
else if (textTransform === 'uppercase')
|
|
159
|
-
inputValue = inputValue.toUpperCase();
|
|
160
|
-
}
|
|
161
154
|
// Validazione generica con RegEx
|
|
162
155
|
if (allowedPattern) {
|
|
163
156
|
// Soluzione 1: Confronto diretto (preferibile per un singolo carattere)
|
|
@@ -289,28 +282,24 @@ const TMTextBox = ({ autoComplete = 'off', autoFocus, maxLength, labelColor, pre
|
|
|
289
282
|
return 6 + (buttonCount * buttonWidth) + 8;
|
|
290
283
|
}
|
|
291
284
|
};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}, children: _jsx(IconDataList, {}) }), (showClearButton && currentValue) &&
|
|
311
|
-
_jsx(StyledTextBoxEditorButton, { onClick: () => { onValueChanged?.({ target: { value: undefined } }); onBlur?.(undefined); }, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
|
|
312
|
-
return (_jsx(StyledTextBoxEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
|
|
313
|
-
})] }), openFormulaItemsChooser(), formulaItems.length > 0 && (_jsx(TMContextMenu, { items: formulaMenuItems, target: `#text-${id}` }))] }), _jsx(TMVilViewer, { vil: validationItems })] }) }));
|
|
285
|
+
return (_jsxs("div", { style: { width: '100%', height: 'fit-content', cursor: onClick ? 'pointer' : undefined }, id: `text-${id}`, onClick: onClick, children: [_jsx(StyledEditor, { ref: inputRef, onContextMenu: (e) => e.stopPropagation(), id: `text-${label}-${id}`, name: label, autoFocus: autoFocus, readOnly: readOnly, type: currentType, disabled: disabled, value: displayedValue, width: width || '100%', placeholder: placeHolder, maxLength: maxLength, autoComplete: autoComplete, spellCheck: false, onFocus: () => setIsFocused(true), onBlur: (e) => { setIsFocused(false); if (currentValue != value)
|
|
286
|
+
onBlur?.(currentValue); }, onChange: handleInputChange, onKeyDown: (e) => {
|
|
287
|
+
if (currentType === 'number') {
|
|
288
|
+
if (!scale && (e.key == "." || e.key == ","))
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
}
|
|
291
|
+
onKeyDown?.(e);
|
|
292
|
+
}, "$isMobile": deviceType === DeviceType.MOBILE, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$maxValue": maxValue, "$width": width, "$type": currentType, "$borderRadius": borderRadius, style: { paddingRight: `${calculateRightPadding()}px`, cursor: onClick ? 'pointer' : undefined } }), (initialType === 'password' || initialType === 'secureText') && _jsx(StyledShowPasswordIcon, { onClick: toggleShowPassword, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: showPasswordIcon() }), (formulaItems.length > 0 || (showClearButton && currentValue) || buttons.length > 0) &&
|
|
293
|
+
_jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: type === 'number' ? '25px' : (initialType === 'password' ? '34px' : '6px'), top: label.length > 0 ? '20px' : '3px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [formulaItems.length > 0 &&
|
|
294
|
+
_jsx(StyledTextBoxEditorButton, { onClick: () => {
|
|
295
|
+
setShowFormulaItemsChooser(true);
|
|
296
|
+
}, children: _jsx(IconDataList, {}) }), showClearButton && currentValue &&
|
|
297
|
+
_jsx(StyledTextBoxEditorButton, { onClick: () => {
|
|
298
|
+
onValueChanged?.({ target: { value: undefined } });
|
|
299
|
+
onBlur?.(undefined);
|
|
300
|
+
}, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
|
|
301
|
+
return (_jsx(StyledTextBoxEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
|
|
302
|
+
})] }), openFormulaItemsChooser(), formulaItems.length > 0 && (_jsx(TMContextMenu, { items: formulaMenuItems, target: `#text-${id}` })), _jsx(TMVilViewer, { vil: validationItems })] }));
|
|
314
303
|
};
|
|
315
304
|
const renderedLeftLabelTextBox = () => {
|
|
316
305
|
return (_jsxs(TMLayoutContainer, { direction: 'horizontal', children: [icon && _jsx(TMLayoutItem, { width: '20px', children: _jsx(StyledEditorIcon, { "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: icon }) }), _jsx(TMLayoutItem, { children: _jsxs(StyledEditorContainer, { "$width": width, children: [label && _jsx(StyledEditorLabel, { "$color": labelColor, "$isFocused": isFocused, "$labelPosition": labelPosition, "$disabled": disabled, children: label }), renderInputField()] }) })] }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import TMDcmtPreview from './TMDcmtPreview';
|
|
4
|
-
import { AccessLevelsEx, AppModules, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, DossierCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, MetadataDataTypes,
|
|
4
|
+
import { AccessLevelsEx, AppModules, ArchiveConstraints, ArchiveEngineByID, DcmtTypeListCacheService, DossierCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, MetadataDataTypes, ObjectClasses, ResultTypes, SDK_Globals, SDK_Localizator, SystemMIDsAsNumber, SystemTIDs, Task_States, TID_DID, UpdateEngineByID, UserListCacheService, ValidationItem, WorkflowCacheService, WorkingGroupCacheService, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import { FormModes, SearchResultContext } from '../../../ts';
|
|
6
6
|
import { DeviceType, useDeviceType } from '../../base/TMDeviceProvider';
|
|
7
7
|
import { getWorkItemSetIDAsync, handleArchiveVisibility, searchResultToMetadataValues } from '../../../helper/queryHelper';
|
|
@@ -1619,8 +1619,6 @@ export const validateMetadataList = (mvdList = []) => {
|
|
|
1619
1619
|
if (isValidForValidation(mvd)) {
|
|
1620
1620
|
validateRequiredField(mvd, value, validationItems);
|
|
1621
1621
|
validateMaxLength(mvd, value, validationItems);
|
|
1622
|
-
validateCustomRegEx(mvd, value, validationItems);
|
|
1623
|
-
validateFormatRegEx(mvd, value, validationItems);
|
|
1624
1622
|
}
|
|
1625
1623
|
return validationItems;
|
|
1626
1624
|
}, []);
|
|
@@ -1643,58 +1641,8 @@ const validateMaxLength = (mvd, value, validationItems) => {
|
|
|
1643
1641
|
const isTextOrNumber = mvd.md?.dataType === MetadataDataTypes.Varchar || mvd.md?.dataType === MetadataDataTypes.Number;
|
|
1644
1642
|
const isFormula = FormulaHelper.isFormula(value);
|
|
1645
1643
|
if (isTextOrNumber && !isFormula && mvd.md?.length && value.replace(regex, '').length > maxLength) {
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1648
|
-
validationItems.push(new ValidationItem(ResultTypes.ERROR, fieldName, message));
|
|
1649
|
-
}
|
|
1650
|
-
};
|
|
1651
|
-
const validateCustomRegEx = (mvd, value, validationItems) => {
|
|
1652
|
-
const pattern = mvd.md?.format?.formatCustom;
|
|
1653
|
-
if (mvd.md?.format?.format !== MetadataFormats.CustomRegEx || !pattern)
|
|
1654
|
-
return;
|
|
1655
|
-
// Valore vuoto: ci pensa validateRequiredField; formule: non validabili con regex
|
|
1656
|
-
if (!value.trim() || FormulaHelper.isFormula(value))
|
|
1657
|
-
return;
|
|
1658
|
-
try {
|
|
1659
|
-
const regex = new RegExp(`^(?:${pattern})$`);
|
|
1660
|
-
if (!regex.test(value)) {
|
|
1661
|
-
const fieldName = mvd.md?.nameLoc ?? mvd.md?.name ?? SDKUI_Localizator.Field;
|
|
1662
|
-
const message = SDKUI_Localizator.FormatNotRespected.replaceParams(fieldName, pattern);
|
|
1663
|
-
validationItems.push(new ValidationItem(ResultTypes.ERROR, fieldName, message));
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
catch {
|
|
1667
|
-
// Pattern regex non valido: nessuna validazione, accetta qualsiasi valore
|
|
1668
|
-
}
|
|
1669
|
-
};
|
|
1670
|
-
// Regex predefinite per i formati standard (EMail, Partita IVA, Codice Fiscale)
|
|
1671
|
-
const FORMAT_REGEX_RULES = [
|
|
1672
|
-
{
|
|
1673
|
-
format: MetadataFormats.EMail,
|
|
1674
|
-
regex: /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,
|
|
1675
|
-
message: (name) => SDKUI_Localizator.InvalidEmailAddress.replaceParams(name)
|
|
1676
|
-
},
|
|
1677
|
-
{
|
|
1678
|
-
format: MetadataFormats.PartitaIva,
|
|
1679
|
-
regex: /^[0-9]{11}$/,
|
|
1680
|
-
message: (name) => SDKUI_Localizator.InvalidVatNumber.replaceParams(name)
|
|
1681
|
-
},
|
|
1682
|
-
{
|
|
1683
|
-
// Persone fisiche (16 caratteri, incluse le lettere di omocodia) o soggetti giuridici (11 cifre)
|
|
1684
|
-
format: MetadataFormats.CodiceFiscale,
|
|
1685
|
-
regex: /^(?:[A-Z]{6}[0-9LMNPQRSTUV]{2}[ABCDEHLMPRST][0-9LMNPQRSTUV]{2}[A-Z][0-9LMNPQRSTUV]{3}[A-Z]|[0-9]{11})$/i,
|
|
1686
|
-
message: (name) => SDKUI_Localizator.InvalidTaxCode.replaceParams(name)
|
|
1687
|
-
}
|
|
1688
|
-
];
|
|
1689
|
-
const validateFormatRegEx = (mvd, value, validationItems) => {
|
|
1690
|
-
const rule = FORMAT_REGEX_RULES.find(r => r.format === mvd.md?.format?.format);
|
|
1691
|
-
if (!rule)
|
|
1692
|
-
return;
|
|
1693
|
-
// Valore vuoto: ci pensa validateRequiredField; formule: non validabili con regex
|
|
1694
|
-
if (!value.trim() || FormulaHelper.isFormula(value))
|
|
1695
|
-
return;
|
|
1696
|
-
if (!rule.regex.test(value)) {
|
|
1697
|
-
validationItems.push(new ValidationItem(ResultTypes.ERROR, mvd.md?.nameLoc ?? "", rule.message(mvd.md?.nameLoc ?? SDKUI_Localizator.Field)));
|
|
1644
|
+
const message = `"${mvd.md.nameLoc ?? "no-name"}" ha superata massimo lunghezza di ${maxLength} caratteri.`;
|
|
1645
|
+
validationItems.push(new ValidationItem(ResultTypes.ERROR, mvd.md.nameLoc ?? "", message));
|
|
1698
1646
|
}
|
|
1699
1647
|
};
|
|
1700
1648
|
//#endregion Validation
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataDataDomains, RelationCacheService, RelationTypes, UserListCacheService, LayoutModes } from "@topconsultnpm/sdk-ts";
|
|
4
|
-
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus, IconChevronDown, IconChevronRight, SDKUI_Localizator, buildDcmtDisplayName, SDKUI_Globals, searchResultToMetadataValues
|
|
3
|
+
import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, MetadataDataDomains, RelationCacheService, RelationTypes, UserListCacheService, LayoutModes } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus, IconChevronDown, IconChevronRight, SDKUI_Localizator, buildDcmtDisplayName, SDKUI_Globals, searchResultToMetadataValues } from '../../../helper';
|
|
5
5
|
import ShowAlert from '../../base/TMAlert';
|
|
6
6
|
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
7
7
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -55,14 +55,35 @@ export const getDisplayValueByColumn = (col, value) => {
|
|
|
55
55
|
return value;
|
|
56
56
|
if (col.dataType === DataColumnTypes.Text)
|
|
57
57
|
return value;
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
const format = MetadataFormats[(col.extendedProperties?.["Format"] ?? "None")];
|
|
59
|
+
const formatCulture = col.extendedProperties?.["FormatCulture"] ?? window.navigator.language;
|
|
60
|
+
if (col.dataType === DataColumnTypes.DateTime) {
|
|
61
|
+
const date = new Date(value);
|
|
62
|
+
switch (format) {
|
|
63
|
+
case MetadataFormats.ShortDate: return date.toLocaleString(formatCulture, formatCulture == "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit" } : { dateStyle: 'short' });
|
|
64
|
+
case MetadataFormats.ShortTime: return date.toLocaleString(formatCulture, { timeStyle: 'short' });
|
|
65
|
+
case MetadataFormats.ShortDateLongTime: return date.toLocaleString(formatCulture, formatCulture == "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit", hour: '2-digit', minute: '2-digit', second: '2-digit' } : { dateStyle: 'short', timeStyle: 'medium' }).replace(',', '');
|
|
66
|
+
case MetadataFormats.ShortDateShortTime: return date.toLocaleString(formatCulture, formatCulture == "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit", hour: '2-digit', minute: '2-digit' } : { dateStyle: 'short', timeStyle: 'short' }).replace(',', '');
|
|
67
|
+
case MetadataFormats.LongDate: return date.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric" });
|
|
68
|
+
case MetadataFormats.LongTime: return date.toLocaleString(formatCulture, { timeStyle: 'medium' });
|
|
69
|
+
case MetadataFormats.LongDateLongTime: return date.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
|
70
|
+
case MetadataFormats.LongDateShortTime: return date.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: '2-digit', minute: '2-digit' });
|
|
71
|
+
default: return date.toLocaleString(formatCulture, { dateStyle: 'short' });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (col.dataType === DataColumnTypes.Number) {
|
|
75
|
+
return value.toLocaleString(formatCulture, { useGrouping: format == MetadataFormats.NumberWithThousandsSeparator });
|
|
76
|
+
}
|
|
77
|
+
if (format == MetadataFormats.None)
|
|
78
|
+
return value;
|
|
79
|
+
if (format == MetadataFormats.CurrencyEuro)
|
|
80
|
+
return value.toLocaleString(formatCulture, { style: 'currency', currency: "EUR" });
|
|
81
|
+
if (format == MetadataFormats.CurrencyDollar)
|
|
82
|
+
return value.toLocaleString(formatCulture, { style: 'currency', currency: "USD" });
|
|
83
|
+
if (format == MetadataFormats.CurrencyPound)
|
|
84
|
+
return value.toLocaleString(formatCulture, { style: 'currency', currency: "GBP" });
|
|
85
|
+
if (format == MetadataFormats.CurrencyYen)
|
|
86
|
+
return value.toLocaleString(formatCulture, { style: 'currency', currency: "JPY" });
|
|
66
87
|
return value;
|
|
67
88
|
};
|
|
68
89
|
/**
|
|
@@ -102,11 +123,9 @@ export const searchResultToDataSource = async (searchResult, hideSysMetadata) =>
|
|
|
102
123
|
? (mvd.md?.name ?? '').toUpperCase()
|
|
103
124
|
: (mvd.md?.name ?? '');
|
|
104
125
|
if (key) {
|
|
105
|
-
// Find the corresponding column by MID to format the value
|
|
106
|
-
const column = dtdResult?.columns?.find(c => Number(c.extendedProperties?.["MID"] ?? "0") === mvd.mid);
|
|
107
126
|
item[key] = {
|
|
108
127
|
md: mvd.md,
|
|
109
|
-
value:
|
|
128
|
+
value: mvd.value
|
|
110
129
|
};
|
|
111
130
|
}
|
|
112
131
|
}
|
|
@@ -5,7 +5,7 @@ import TMSavedQuerySelector from './TMSavedQuerySelector';
|
|
|
5
5
|
import TMTreeSelector from './TMTreeSelector';
|
|
6
6
|
import { TabPanel, Item } from 'devextreme-react/tab-panel';
|
|
7
7
|
import TMSearchQueryPanel, { refreshLastSearch } from './TMSearchQueryPanel';
|
|
8
|
-
import { getSysAllDcmtsSQD, IconFilter, IconRecentlyViewed, IconSavedQuery, IconTree,
|
|
8
|
+
import { getSysAllDcmtsSQD, IconFilter, IconRecentlyViewed, IconSavedQuery, IconTree, removeMruTid, SDKUI_Globals, SDKUI_Localizator, updateMruTids } from '../../../helper';
|
|
9
9
|
import TMSearchResult from './TMSearchResult';
|
|
10
10
|
import TMRecentsManager from '../../grids/TMRecentsManager';
|
|
11
11
|
import { SearchResultContext } from '../../../ts';
|
|
@@ -164,32 +164,6 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
164
164
|
console.error("Error refreshing search:", error);
|
|
165
165
|
}
|
|
166
166
|
};
|
|
167
|
-
const handleSearchCompleted = useCallback((searchResult, qd, append) => {
|
|
168
|
-
if (searchResult.length <= 0) {
|
|
169
|
-
// In ricerca normale un array vuoto resetta i risultati; in accoda si mantiene il set accumulato
|
|
170
|
-
if (!append)
|
|
171
|
-
setSearchResult(searchResult);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
const newResult = searchResult[0];
|
|
175
|
-
// In modalità accoda unisce il nuovo risultato a quello precedente (più recenti in cima).
|
|
176
|
-
setSearchResult(prev => {
|
|
177
|
-
if (append && prev.length > 0 && prev[0]?.fromTID === newResult?.fromTID) {
|
|
178
|
-
const merged = mergeSearchResultsAppend(prev[0], newResult);
|
|
179
|
-
return merged ? [merged] : searchResult;
|
|
180
|
-
}
|
|
181
|
-
return searchResult;
|
|
182
|
-
});
|
|
183
|
-
setLastQdSearched(qd);
|
|
184
|
-
setCurrentSearchView(TMSearchViews.Result);
|
|
185
|
-
// Salvataggio ultimi 10 TIDs
|
|
186
|
-
let fromTID = searchResult?.[0].fromTID;
|
|
187
|
-
let newMruTIDS = updateMruTids(SDKUI_Globals.userSettings.searchSettings.mruTIDs, fromTID);
|
|
188
|
-
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS;
|
|
189
|
-
setMruTIDs(newMruTIDS);
|
|
190
|
-
setCurrentMruTID(fromTID);
|
|
191
|
-
setShowSearchResults(true);
|
|
192
|
-
}, []);
|
|
193
167
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
194
168
|
const isTabletOrMobile = deviceType === DeviceType.TABLET || deviceType === DeviceType.MOBILE;
|
|
195
169
|
// --- JSX WRAPPERS ---
|
|
@@ -208,10 +182,23 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
208
182
|
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS;
|
|
209
183
|
setMruTIDs(newMruTIDS);
|
|
210
184
|
} }), [mruTIDs, currentMruTID, deviceType]);
|
|
211
|
-
const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { passToArchiveCallback: passToArchiveCallback, isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, inputMids: inputMids, maxDcmtsToBeReturned: maxDcmtsToBeReturned, onBackToResult: () => { setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted:
|
|
185
|
+
const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { passToArchiveCallback: passToArchiveCallback, isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, inputMids: inputMids, maxDcmtsToBeReturned: maxDcmtsToBeReturned, onBackToResult: () => { setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted: (searchResult, qd) => {
|
|
186
|
+
setSearchResult(searchResult);
|
|
187
|
+
if (searchResult.length <= 0)
|
|
188
|
+
return;
|
|
189
|
+
setLastQdSearched(qd);
|
|
190
|
+
setCurrentSearchView(TMSearchViews.Result);
|
|
191
|
+
// Salvataggio ultimi 10 TIDs
|
|
192
|
+
let fromTID = searchResult?.[0].fromTID;
|
|
193
|
+
let newMruTIDS = updateMruTids(SDKUI_Globals.userSettings.searchSettings.mruTIDs, fromTID);
|
|
194
|
+
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS;
|
|
195
|
+
setMruTIDs(newMruTIDS);
|
|
196
|
+
setCurrentMruTID(fromTID);
|
|
197
|
+
setShowSearchResults(true);
|
|
198
|
+
}, onSqdSaved: async (newSqd) => {
|
|
212
199
|
await loadDataSQDsAsync(true, newSqd.masterTID);
|
|
213
200
|
await setSQDAsync(newSqd);
|
|
214
|
-
} }), [fromDTD, showSearchResults, setShowSearchResults, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids, maxDcmtsToBeReturned
|
|
201
|
+
} }), [fromDTD, showSearchResults, setShowSearchResults, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids, maxDcmtsToBeReturned]);
|
|
215
202
|
const tmSavedQuerySelectorElement = useMemo(() => _jsxs(TabPanel, { width: "100%", height: "100%", showNavButtons: true, repaintChangesOnly: true, selectedIndex: currentSQDMode, onSelectedIndexChange: (index) => setCurrentSQDMode(index), children: [(currentTID || currentSQD) ? _jsx(Item, { title: fromDTD?.nameLoc, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: false, items: filteredByTIDSQDs, selectedId: currentSQD?.id, onRefreshData: () => { loadDataSQDsAsync(true); }, onItemClick: (sqd) => {
|
|
216
203
|
onSQDItemClick(sqd, setSQDAsync);
|
|
217
204
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync), refreshFavoriteSavedQueries: refreshFavoriteSavedQueries }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.AllFemale, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
|
|
@@ -12,7 +12,7 @@ interface ITMSearchQueryPanelProps {
|
|
|
12
12
|
onBack?: () => void;
|
|
13
13
|
onBackToResult?: () => void;
|
|
14
14
|
onSqdSaved?: (newSqd: SavedQueryDescriptor) => void;
|
|
15
|
-
onSearchCompleted?: (searchResult: SearchResultDescriptor[], qd: QueryDescriptor | undefined
|
|
15
|
+
onSearchCompleted?: (searchResult: SearchResultDescriptor[], qd: QueryDescriptor | undefined) => void;
|
|
16
16
|
onClosePanel?: () => void;
|
|
17
17
|
allowMaximize?: boolean;
|
|
18
18
|
onMaximizePanel?: () => void;
|
|
@@ -46,8 +46,6 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
46
46
|
let initialMaxItems = deviceType === DeviceType.MOBILE ? 8 : 12;
|
|
47
47
|
const appliedInputMidsRef = useRef(null);
|
|
48
48
|
const pendingMidsRef = useRef(null);
|
|
49
|
-
// Flag "accoda": impostato dall'azione secondaria del bottone Ricerca, consumato in executeSearch
|
|
50
|
-
const appendNextSearchRef = useRef(false);
|
|
51
49
|
useEffect(() => {
|
|
52
50
|
if (!SQD)
|
|
53
51
|
return;
|
|
@@ -124,10 +122,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
124
122
|
useEffect(() => {
|
|
125
123
|
if (shouldSearch && qd) {
|
|
126
124
|
const executeSearch = async () => {
|
|
127
|
-
|
|
128
|
-
const append = appendNextSearchRef.current;
|
|
129
|
-
appendNextSearchRef.current = false;
|
|
130
|
-
await searchAsync(qd, showAdvancedSearch, append);
|
|
125
|
+
await searchAsync(qd, showAdvancedSearch);
|
|
131
126
|
setShouldSearch(false); // Resetta il trigger dopo la ricerca
|
|
132
127
|
};
|
|
133
128
|
executeSearch();
|
|
@@ -172,9 +167,8 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
172
167
|
});
|
|
173
168
|
setQd({ ...qd, where: newWhere, orderBy: [] });
|
|
174
169
|
};
|
|
175
|
-
const searchAsync = async (qdInput, isAdvancedSearch
|
|
176
|
-
|
|
177
|
-
onSearchCompleted?.([], undefined); // reset results (solo in ricerca normale, non in accoda)
|
|
170
|
+
const searchAsync = async (qdInput, isAdvancedSearch) => {
|
|
171
|
+
onSearchCompleted?.([], undefined); // reset results
|
|
178
172
|
let searchParams = { isAdvancedSearch: isAdvancedSearch, lastQdParams: lastQdParams, confirmQueryParams: confirmQueryParams, setLastQdParamsCallback: setLastQdParams };
|
|
179
173
|
let searchResult = await searchByQdAsync(qdInput, searchParams);
|
|
180
174
|
let dcmtsFound = searchResult?.result?.dcmtsFound ?? 0;
|
|
@@ -186,7 +180,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
186
180
|
results.push(searchResult?.result);
|
|
187
181
|
// Before notifying onSearchComplete, let's set the panel to NOT active
|
|
188
182
|
setIsQueryPanelActive(false);
|
|
189
|
-
onSearchCompleted?.(results, searchResult?.qd
|
|
183
|
+
onSearchCompleted?.(results, searchResult?.qd);
|
|
190
184
|
}
|
|
191
185
|
};
|
|
192
186
|
const updateIsModalOpen = useCallback((isOpen) => {
|
|
@@ -220,24 +214,9 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
220
214
|
if (document.activeElement instanceof HTMLElement) {
|
|
221
215
|
document.activeElement.blur();
|
|
222
216
|
}
|
|
223
|
-
//
|
|
224
|
-
appendNextSearchRef.current = false;
|
|
217
|
+
// Attiva il flag di ricerca anche per il click del bottone
|
|
225
218
|
setShouldSearch(true);
|
|
226
219
|
}, []);
|
|
227
|
-
const handleSearchAndAppendClick = useCallback(() => {
|
|
228
|
-
// Propagazione blur
|
|
229
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
230
|
-
document.activeElement.blur();
|
|
231
|
-
}
|
|
232
|
-
// Ricerca e accoda: imposta il flag consumato da executeSearch
|
|
233
|
-
appendNextSearchRef.current = true;
|
|
234
|
-
setShouldSearch(true);
|
|
235
|
-
}, []);
|
|
236
|
-
const searchButtonSecondaryActions = useMemo(() => [{
|
|
237
|
-
name: SDKUI_Localizator.SearchAndAppend,
|
|
238
|
-
icon: _jsx(IconSearch, {}),
|
|
239
|
-
onClick: handleSearchAndAppendClick
|
|
240
|
-
}], [handleSearchAndAppendClick]);
|
|
241
220
|
const handleQdChanged = useCallback((newQd) => {
|
|
242
221
|
if (!deepCompare(qd, newQd)) {
|
|
243
222
|
setQd(newQd);
|
|
@@ -291,7 +270,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
291
270
|
}, [qd, fromDTD?.metadata, SQD?.masterTID]);
|
|
292
271
|
const handleCloseOutputConfig = useCallback(() => setShowOutputConfig(false), []);
|
|
293
272
|
const contextMenuItems = useMemo(() => [
|
|
294
|
-
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), name:
|
|
273
|
+
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), name: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
|
|
295
274
|
{ icon: _jsx(IconAddCircleOutline, {}), name: SDKUI_Localizator.SavedQueryNew, beginGroup: showBackToResultButton, onClick: () => { openSqdForm(FormModes.Create); } },
|
|
296
275
|
{ icon: _jsx(IconEdit, {}), name: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
|
297
276
|
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), beginGroup: true, name: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
@@ -374,7 +353,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
374
353
|
alignItems: 'center',
|
|
375
354
|
gap: '10px',
|
|
376
355
|
width: '100%'
|
|
377
|
-
}, children: [_jsx(TMButton, { btnStyle: 'advanced', icon: _jsx(IconSearch, {}), showTooltip: false, width: '
|
|
356
|
+
}, children: [_jsx(TMButton, { btnStyle: 'advanced', icon: _jsx(IconSearch, {}), showTooltip: false, width: '90px', caption: SDKUI_Localizator.Search, advancedColor: '#4A96D2', onClick: handleSearchButtonClick }), _jsx(TMButton, { width: '90px', btnStyle: 'advanced', advancedType: 'primary', showTooltip: false, caption: SDKUI_Localizator.Clear, icon: _jsx(IconClear, {}), advancedColor: 'white', color: 'primaryOutline', onClick: clearFilters }), (!showAdvancedSearch && qd?.where && qd.where.length > initialMaxItems) && (_jsx(TMButton, { width: '120px', btnStyle: isMobile ? 'icon' : 'advanced', advancedColor: TMColors.button_primary, caption: captionText, showTooltip: false, icon: isMobile ? (_jsx("div", { children: _jsx("p", { children: showAllMdWhere ? `-${diff}` : `+${diff}` }) })) : (_jsx("p", { children: showAllMdWhere ? `-${diff}` : `+${diff}` })), onClick: () => setShowAllMdWhere(!showAllMdWhere) }))] }), showFiltersConfig &&
|
|
378
357
|
_jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, filterMetadata: (o => o.perm?.canSearch === AccessLevels.Yes), qd: qd, selectedIDs: qd?.where?.map((w) => ({ tid: w.tid, mid: w.mid })), onClose: handleCloseFiltersConfig, onChoose: handleChooseFilters }), showOutputConfig &&
|
|
379
358
|
_jsx(TMMetadataOutputForm, { qd: qd, selectedSelectItems: qd?.select, allowSysMetadata: true, filterMetadata: (o => o.perm?.canView === AccessLevels.Yes || o.perm?.canUpdate === AccessLevels.Yes), onClose: handleCloseOutputConfig, onChoose: (selectItems) => {
|
|
380
359
|
setQd({ ...qd, select: selectItems });
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { LoadIndicator } from 'devextreme-react';
|
|
5
|
-
import { AppModules, DataColumnTypes, DataListViewModes, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, SDK_Globals, SystemMIDsAsNumber, UserListCacheService, } from '@topconsultnpm/sdk-ts';
|
|
6
|
-
import { deepCompare,
|
|
5
|
+
import { AppModules, DataColumnTypes, DataListViewModes, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, MetadataFormats, SDK_Globals, SystemMIDsAsNumber, UserListCacheService, } from '@topconsultnpm/sdk-ts';
|
|
6
|
+
import { deepCompare, generateUniqueColumnKeys, genUniqueId, getSearchToolbarVisibility, IconAll, IconBoard, IconDcmtTypeSys, IconDelete, IconMenuVertical, IconPlatform, IconRefresh, IconSearchCheck, IconShow, isApprovalWorkflowView, isSign4TopEnabled, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, SDKUI_Globals, SDKUI_Localizator } from '../../../helper';
|
|
7
7
|
import { CounterItemKey } from '../../base/TMCounterContainer';
|
|
8
8
|
import { getDcmtCicoStatus } from '../../../helper/checkinCheckoutManager';
|
|
9
9
|
import { DcmtOperationTypes, SearchResultContext, } from '../../../ts';
|
|
@@ -1000,14 +1000,42 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
|
|
|
1000
1000
|
const getDisplayFormat = useCallback((col) => {
|
|
1001
1001
|
if (col.dataType === DataColumnTypes.Text)
|
|
1002
1002
|
return undefined;
|
|
1003
|
-
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1003
|
+
const format = MetadataFormats[(col.extendedProperties?.["Format"] ?? "None")];
|
|
1004
|
+
const formatCulture = col.extendedProperties?.["FormatCulture"] ?? window.navigator.language;
|
|
1005
|
+
if (col.dataType === DataColumnTypes.DateTime) {
|
|
1006
|
+
return {
|
|
1007
|
+
formatter: function (value) {
|
|
1008
|
+
switch (format) {
|
|
1009
|
+
case MetadataFormats.ShortDate: return value.toLocaleString(formatCulture, formatCulture == "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit" } : { dateStyle: 'short' });
|
|
1010
|
+
case MetadataFormats.ShortTime: return value.toLocaleString(formatCulture, { timeStyle: 'short' });
|
|
1011
|
+
case MetadataFormats.ShortDateLongTime: return value.toLocaleString(formatCulture, formatCulture == "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit", hour: '2-digit', minute: '2-digit', second: '2-digit' } : { dateStyle: 'short', timeStyle: 'medium' }).replace(',', '');
|
|
1012
|
+
case MetadataFormats.ShortDateShortTime: return value.toLocaleString(formatCulture, formatCulture == "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit", hour: '2-digit', minute: '2-digit' } : { dateStyle: 'short', timeStyle: 'short' }).replace(',', '');
|
|
1013
|
+
case MetadataFormats.LongDate: return value.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric" });
|
|
1014
|
+
case MetadataFormats.LongTime: return value.toLocaleString(formatCulture, { timeStyle: 'medium' });
|
|
1015
|
+
case MetadataFormats.LongDateLongTime: return value.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
|
1016
|
+
case MetadataFormats.LongDateShortTime: return value.toLocaleString(formatCulture, { weekday: "long", year: "numeric", month: "long", day: "numeric", hour: '2-digit', minute: '2-digit' });
|
|
1017
|
+
default: return value.toLocaleString(formatCulture, formatCulture == "it-IT" ? { year: "numeric", month: "2-digit", day: "2-digit" } : { dateStyle: 'short' });
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
if (col.dataType === DataColumnTypes.Number) {
|
|
1023
|
+
return {
|
|
1024
|
+
formatter: function (value) {
|
|
1025
|
+
return value.toLocaleString(formatCulture, { useGrouping: format == MetadataFormats.NumberWithThousandsSeparator });
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
if (format == MetadataFormats.None)
|
|
1030
|
+
return undefined;
|
|
1031
|
+
if (format == MetadataFormats.CurrencyEuro)
|
|
1032
|
+
return { type: 'currency', precision: 2, currency: "EUR" };
|
|
1033
|
+
if (format == MetadataFormats.CurrencyDollar)
|
|
1034
|
+
return { type: 'currency', precision: 2, currency: "USD" };
|
|
1035
|
+
if (format == MetadataFormats.CurrencyPound)
|
|
1036
|
+
return { type: 'currency', precision: 2, currency: "GBP" };
|
|
1037
|
+
if (format == MetadataFormats.CurrencyYen)
|
|
1038
|
+
return { type: 'currency', currency: "JPY" };
|
|
1011
1039
|
return undefined;
|
|
1012
1040
|
}, []);
|
|
1013
1041
|
/**
|
|
@@ -107,7 +107,7 @@ export const TMMetadataTooltip = ({ tid, md, color, children, layoutMode = Layou
|
|
|
107
107
|
let isNumeratorInArk = md?.dataDomain === MetadataDataDomains.Numerator && layoutMode === LayoutModes.Ark;
|
|
108
108
|
const renderTooltipContent = (tid, md) => {
|
|
109
109
|
return (!md ? null
|
|
110
|
-
: _jsxs(StyledTooltipContainer, { children: [_jsx(StyledTooltipItem, { "$color": color, children: `${SDK_Globals.useLocalizedName ? md.nameLoc : md.name} (TID: ${tid}, MID: ${md.id})` }), md.description && _jsx(StyledTooltipItem, { "$color": color, children: md.description }), _jsx(StyledTooltipSeparatorItem, { color: color }), md.objectClass === ObjectClasses.Permission && _jsx(StyledTooltipItem, { style: { fontWeight: 600 }, children: 'Tipo documento NON autorizzato' }), _jsx(StyledTooltipSeparatorItem, { color: color }), _jsxs(StyledTooltipItem, { "$color": color, 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 && !isNumeratorInArk ? TMColors.error : color }, children: md.isRequired === 1 && !isNumeratorInArk ? SDKUI_Localizator.Required : SDKUI_Localizator.RequiredNOT }), md.dataDomain && _jsx(StyledTooltipItem, { "$color": color, children: md.dataDomain }), md.isLexProt == 1 && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.Yes}` }), md.isLexProt == 2 && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.MetadataFlag}` }), md.isLexProt == 3 && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.Yes} (${SDKUI_Localizator.MetadataFlag})` }), md.isFreeSearchInput && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.Search_Free}: ${SDKUI_Localizator.Yes}` }), md.isSpecialSearchOutput && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.Search_Special}: ${SDKUI_Localizator.Yes}` }), md.format?.format && md.format.format != MetadataFormats.None && _jsx(StyledTooltipItem, { color: color, children: `${SDKUI_Localizator.Format}: ${LocalizeMetadataFormats(md.format.format)}` }), md.
|
|
110
|
+
: _jsxs(StyledTooltipContainer, { children: [_jsx(StyledTooltipItem, { "$color": color, children: `${SDK_Globals.useLocalizedName ? md.nameLoc : md.name} (TID: ${tid}, MID: ${md.id})` }), md.description && _jsx(StyledTooltipItem, { "$color": color, children: md.description }), _jsx(StyledTooltipSeparatorItem, { color: color }), md.objectClass === ObjectClasses.Permission && _jsx(StyledTooltipItem, { style: { fontWeight: 600 }, children: 'Tipo documento NON autorizzato' }), _jsx(StyledTooltipSeparatorItem, { color: color }), _jsxs(StyledTooltipItem, { "$color": color, 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 && !isNumeratorInArk ? TMColors.error : color }, children: md.isRequired === 1 && !isNumeratorInArk ? SDKUI_Localizator.Required : SDKUI_Localizator.RequiredNOT }), md.dataDomain && _jsx(StyledTooltipItem, { "$color": color, children: md.dataDomain }), md.isLexProt == 1 && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.Yes}` }), md.isLexProt == 2 && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.MetadataFlag}` }), md.isLexProt == 3 && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.LexProt}: ${SDKUI_Localizator.Yes} (${SDKUI_Localizator.MetadataFlag})` }), md.isFreeSearchInput && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.Search_Free}: ${SDKUI_Localizator.Yes}` }), md.isSpecialSearchOutput && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.Search_Special}: ${SDKUI_Localizator.Yes}` }), md.format?.format && md.format.format != MetadataFormats.None && _jsx(StyledTooltipItem, { color: color, children: `${SDKUI_Localizator.Format}: ${LocalizeMetadataFormats(md.format.format)}` }), md.defaultValue && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.Default}: ${_setDefaultValueForUI(md.defaultValue)}` }), md.fromTID && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.MetadataRoot}: ${md.isRootMID == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No}` }), md.templateMID && _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.Template}: ${md.templateMID}` }), md.perm && _jsxs(_Fragment, { children: [_jsx(StyledTooltipItem, { "$color": 'primary', "$marginTop": '5px', children: SDKUI_Localizator.Perms }), _jsx(StyledTooltipSeparatorItem, { color: color }), _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.Archive}: ${md.perm.canArchive ?? SDKUI_Localizator.No}` }), _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.View_Metadato}: ${md.perm.canView ?? SDKUI_Localizator.No}` }), _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.Search}: ${md.perm.canSearch ?? SDKUI_Localizator.No}` }), _jsx(StyledTooltipItem, { "$color": color, children: `${SDKUI_Localizator.Update}: ${md.perm.canUpdate ?? SDKUI_Localizator.No}` })] })] }));
|
|
111
111
|
};
|
|
112
112
|
return (_jsx("div", { style: { pointerEvents: 'all' }, children: _jsx(TMTooltip, { content: renderTooltipContent(tid, md), children: children }) }));
|
|
113
113
|
};
|
|
@@ -9,7 +9,7 @@ export declare class Globalization {
|
|
|
9
9
|
static getDateTimeDisplayValueCompact(value: Date | string | undefined, displayType?: DateDisplayTypes, metadataFormat?: MetadataFormats): string;
|
|
10
10
|
static getDateDisplayFormat(displayType?: DateDisplayTypes): string;
|
|
11
11
|
static getNumberDisplayValue(value: Number, withThousandsSeparator?: boolean, numberDisplayFormat?: string): string;
|
|
12
|
-
static metadataFormatToDateDisplayFormat(format: MetadataFormats): "" | "dd/MM/yyyy" | "HH:mm" | "HH:mm:ss" | "MM/dd/yyyy
|
|
12
|
+
static metadataFormatToDateDisplayFormat(format: MetadataFormats): "" | "MM/dd/yyyy" | "dd/MM/yyyy" | "EEEE dd MMMM yyyy" | "HH:mm" | "HH:mm:ss" | "MM/dd/yyyy HH:mm:ss" | "dd/MM/yyyy HH:mm:ss" | "MM/dd/yyyy HH:mm" | "dd/MM/yyyy HH:mm" | "EEEE dd MMMM yyyy HH:mm" | "EEEE dd MMMM yyyy HH:mm:ss";
|
|
13
13
|
static getDecimalSeparator(): string | undefined;
|
|
14
14
|
static getThousandsSeparator(): string | undefined;
|
|
15
15
|
}
|