@topconsultnpm/sdkui-react-beta 6.6.26 → 6.6.28
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/TMMetadataChooser.js +4 -4
- package/lib/components/choosers/TMUserChooser.js +5 -5
- package/lib/components/forms/TMChooserForm.d.ts +1 -1
- package/lib/components/forms/TMChooserForm.js +8 -4
- package/lib/components/sidebar/TMHeader.js +2 -1
- package/lib/ts/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -12,16 +12,16 @@ import TMButton from '../base/TMButton';
|
|
|
12
12
|
import TMSummary from '../editors/TMSummary';
|
|
13
13
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
14
14
|
import TMSpinner from '../base/TMSpinner';
|
|
15
|
-
const TMMetadataChooser = ({ tmSession, dataSource, buttons = [], inputDcmtTypesList, disabled, validationItems, getColorIndex, showCompleteMetadataName, qdShowOnlySelectItems, borderRadius = '4px', fontSize = FontSize.defaultFontSize, backgroundColor, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, allowSysMetadata, value, values, isModifiedWhen, tids, label, width, height, onValueChanged, showClearButton, qd, placeHolder }) => {
|
|
15
|
+
const TMMetadataChooser = ({ tmSession, dataSource, buttons = [], inputDcmtTypesList, disabled, validationItems, getColorIndex, showCompleteMetadataName, qdShowOnlySelectItems, borderRadius = '4px', fontSize = FontSize.defaultFontSize, backgroundColor, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, allowSysMetadata, value, values, isModifiedWhen, tids, label, width, height, onValueChanged, showClearButton, qd, placeHolder, onRefreshCache }) => {
|
|
16
16
|
const [showChooser, setShowChooser] = useState(false);
|
|
17
17
|
const renderTemplate = () => {
|
|
18
18
|
return (_jsxs(StyledDivHorizontal, { style: { width: 'max-content', height: '100%' }, children: [values && _jsx(TMMidViewer, { tmSession: tmSession, tid_mid: values[0], showIcon: true, showId: showId, showCompleteName: showCompleteMetadataName }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` }), (values == undefined || values.length == 0) && _jsx("p", { children: placeHolder })] }));
|
|
19
19
|
};
|
|
20
20
|
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { label: label, width: width, height: showBorder ? height : '24px', validationItems: validationItems, backgroundColor: backgroundColor, buttons: buttons, placeHolder: placeHolder, fontSize: fontSize, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), openEditorOnSummaryClick: openEditorOnSummaryClick, onEditorClick: () => !disabled && setShowChooser(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined }), showChooser &&
|
|
21
|
-
_jsx(TMMetadataChooserForm, { tmSession: tmSession, allowMultipleSelection: allowMultipleSelection, height: '500px', width: '600px', allowSysMetadata: allowSysMetadata, getColorIndex: getColorIndex, dataSource: dataSource, inputDcmtTypesList: inputDcmtTypesList, tids: tids, qd: qd, qdShowOnlySelectItems: qdShowOnlySelectItems, selectedIDs: values, onClose: () => setShowChooser(false), onChoose: (tid_mids) => { onValueChanged?.(tid_mids); } })] }));
|
|
21
|
+
_jsx(TMMetadataChooserForm, { tmSession: tmSession, allowMultipleSelection: allowMultipleSelection, height: '500px', width: '600px', allowSysMetadata: allowSysMetadata, getColorIndex: getColorIndex, dataSource: dataSource, inputDcmtTypesList: inputDcmtTypesList, tids: tids, qd: qd, qdShowOnlySelectItems: qdShowOnlySelectItems, selectedIDs: values, onRefreshCache: onRefreshCache, onClose: () => setShowChooser(false), onChoose: (tid_mids) => { onValueChanged?.(tid_mids); } })] }));
|
|
22
22
|
};
|
|
23
23
|
export default TMMetadataChooser;
|
|
24
|
-
export const TMMetadataChooserForm = ({ tmSession, tids, inputDcmtTypesList, qd, qdShowOnlySelectItems, selectedIDs, dataSource, allowMultipleSelection, allowSysMetadata = true, width, height, getColorIndex, onClose, onChoose }) => {
|
|
24
|
+
export const TMMetadataChooserForm = ({ tmSession, tids, inputDcmtTypesList, qd, qdShowOnlySelectItems, selectedIDs, dataSource, allowMultipleSelection, allowSysMetadata = true, width, height, getColorIndex, onClose, onChoose, onRefreshCache }) => {
|
|
25
25
|
const [showSysMetadata, setShowSysMetadata] = useState(false);
|
|
26
26
|
const [hasSysMetadata, setHasSysMetadata] = useState(false);
|
|
27
27
|
const [dcmtTypes, setDcmtTypes] = useState([]);
|
|
@@ -119,5 +119,5 @@ export const TMMetadataChooserForm = ({ tmSession, tids, inputDcmtTypesList, qd,
|
|
|
119
119
|
};
|
|
120
120
|
const convertID = (md) => { return { tid: md.customData1, mid: md.id, aliasTID: md.customData2 }; };
|
|
121
121
|
const customFilter = (items) => { return showSysMetadata ? items : items.filter(o => o.isSystem != 1); };
|
|
122
|
-
return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, selectedIDs: selectedIDs?.map((item) => item.mid), convertID: convertID, customFilter: customFilter, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: (data) => { return _jsx("p", { style: { textAlign: 'left', color: data.data.isRequired == 1 ? 'red' : '' }, children: data.value }); }, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: renderDataGridColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
|
|
122
|
+
return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, selectedIDs: selectedIDs?.map((item) => item.mid), convertID: convertID, customFilter: customFilter, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: (data) => { return _jsx("p", { style: { textAlign: 'left', color: data.data.isRequired == 1 ? 'red' : '' }, children: data.value }); }, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: renderDataGridColumns, summaryItems: renderSummaryItems, onRefreshCache: onRefreshCache, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
|
|
123
123
|
};
|
|
@@ -73,10 +73,10 @@ const getCompleteUserName = (domain, name) => {
|
|
|
73
73
|
};
|
|
74
74
|
const getUserIcon = (userLevel) => {
|
|
75
75
|
switch (userLevel) {
|
|
76
|
-
case UserLevels.Member: return _jsx(IconUserLevelMember, {});
|
|
77
|
-
case UserLevels.Administrator: return _jsx(IconUserLevelAdministrator, {});
|
|
78
|
-
case UserLevels.SystemAdministrator: return _jsx(IconUserLevelSystemAdministrator, {});
|
|
79
|
-
case UserLevels.AutonomousAdministrator: return _jsx(IconUserLevelAutonomousAdministrator, {});
|
|
80
|
-
default: return
|
|
76
|
+
case UserLevels.Member: return _jsx(IconUserLevelMember, { fontSize: 16 });
|
|
77
|
+
case UserLevels.Administrator: return _jsx(IconUserLevelAdministrator, { fontSize: 16 });
|
|
78
|
+
case UserLevels.SystemAdministrator: return _jsx(IconUserLevelSystemAdministrator, { fontSize: 16 });
|
|
79
|
+
case UserLevels.AutonomousAdministrator: return _jsx(IconUserLevelAutonomousAdministrator, { fontSize: 16 });
|
|
80
|
+
default: return _jsx(IconUserLevelMember, { fontSize: 16 });
|
|
81
81
|
}
|
|
82
82
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ITMChooserFormProps } from '../../ts';
|
|
2
|
-
declare const TMChooserForm: <T>({ children, title, allowMultipleSelection, hasShowOnlySelectedItems, allowGrouping, allowSorting, width, height, dataSource, selectedIDs, manageUseLocalizedName, hasShowId, keyName, customButtons, showDefaultColumns, columns, summaryItems, convertID, customFilter, getItems, cellRenderIcon, cellRenderNameAndDesc, onChoose, onClose, onShowIdChanged }: ITMChooserFormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const TMChooserForm: <T>({ children, title, allowMultipleSelection, hasShowOnlySelectedItems, allowGrouping, allowSorting, width, height, dataSource, selectedIDs, manageUseLocalizedName, hasShowId, keyName, customButtons, showDefaultColumns, columns, summaryItems, convertID, customFilter, getItems, cellRenderIcon, cellRenderNameAndDesc, onChoose, onClose, onShowIdChanged, onRefreshCache }: ITMChooserFormProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default TMChooserForm;
|
|
@@ -7,7 +7,7 @@ import { IconApply, IconHide, IconRefresh, IconShow, SDKUI_Globals, SDKUI_Locali
|
|
|
7
7
|
import TMButton from '../base/TMButton';
|
|
8
8
|
import TMToggleButton from '../base/TMToggleButton';
|
|
9
9
|
import TMModal from '../base/TMModal';
|
|
10
|
-
const TMChooserForm = ({ children, title, allowMultipleSelection, hasShowOnlySelectedItems = false, allowGrouping, allowSorting = true, width, height, dataSource, selectedIDs, manageUseLocalizedName = true, hasShowId = true, keyName = "id", customButtons, showDefaultColumns = true, columns, summaryItems, convertID, customFilter, getItems, cellRenderIcon, cellRenderNameAndDesc, onChoose, onClose, onShowIdChanged }) => {
|
|
10
|
+
const TMChooserForm = ({ children, title, allowMultipleSelection, hasShowOnlySelectedItems = false, allowGrouping, allowSorting = true, width, height, dataSource, selectedIDs, manageUseLocalizedName = true, hasShowId = true, keyName = "id", customButtons, showDefaultColumns = true, columns, summaryItems, convertID, customFilter, getItems, cellRenderIcon, cellRenderNameAndDesc, onChoose, onClose, onShowIdChanged, onRefreshCache }) => {
|
|
11
11
|
const [showId, setShowId] = useState(false);
|
|
12
12
|
const [showOnlySelectedItems, setShowOnlySelectedItems] = useState(selectedIDs != undefined && selectedIDs.length > 0);
|
|
13
13
|
const [selectedItems, setSelectedItems] = useState([]);
|
|
@@ -19,11 +19,15 @@ const TMChooserForm = ({ children, title, allowMultipleSelection, hasShowOnlySel
|
|
|
19
19
|
const renderTitle = () => { return title ? `${title} (${selectedItems.length} / ${customFilter ? customFilter(items).length : items.length})` : SDKUI_Localizator.Select; };
|
|
20
20
|
const doGetItems = (refreshCache) => {
|
|
21
21
|
if (dataSource) {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if (refreshCache)
|
|
23
|
+
onRefreshCache?.();
|
|
24
|
+
else {
|
|
25
|
+
setItems(dataSource);
|
|
26
|
+
setSelectedItems(dataSource.filter((o) => selectedIDs?.includes(o[keyName])));
|
|
27
|
+
}
|
|
24
28
|
return;
|
|
25
29
|
}
|
|
26
|
-
getItems
|
|
30
|
+
getItems?.(refreshCache).then((result) => {
|
|
27
31
|
setItems(result);
|
|
28
32
|
if (!refreshCache) {
|
|
29
33
|
setSelectedItems(result.filter((o) => selectedIDs?.includes(o[keyName])));
|
|
@@ -7,6 +7,7 @@ import { SDK_Globals, AuthenticationModes } from '@topconsultnpm/sdk-ts-beta';
|
|
|
7
7
|
import { FontSize, TMColors } from '../../utils/theme';
|
|
8
8
|
import { ButtonNames, TMMessageBoxManager } from '../base/TMPopUp';
|
|
9
9
|
import Logo from '../../assets/Toppy-generico.png';
|
|
10
|
+
import { ApplicationThemeColor } from './TMSidebarItem';
|
|
10
11
|
export var TMSearchContext;
|
|
11
12
|
(function (TMSearchContext) {
|
|
12
13
|
TMSearchContext["JOBS"] = "jobs";
|
|
@@ -16,7 +17,7 @@ export var TMSearchContext;
|
|
|
16
17
|
TMSearchContext["PLATFORM"] = "OrchestrationPlatform";
|
|
17
18
|
TMSearchContext["QE"] = "QueryEditor";
|
|
18
19
|
})(TMSearchContext || (TMSearchContext = {}));
|
|
19
|
-
const StyledHeaderContainer = styled.div ` width: 100%; height: 50px; /* background: #E85C36 0% 0% no-repeat padding-box; */ background: ${props => props.$appName === 'ORCHESTRATOR' ?
|
|
20
|
+
const StyledHeaderContainer = styled.div ` width: 100%; height: 50px; /* background: #E85C36 0% 0% no-repeat padding-box; */ background: ${props => props.$appName === 'ORCHESTRATOR' ? `linear-gradient(90deg, #f0f4fa, ${ApplicationThemeColor.ORCHESTRATOR})` : props.$appName === 'SURFER' ? `linear-gradient(90deg, #f0f4fa, ${ApplicationThemeColor.SURFER})` : `linear-gradient(90deg, #f0f4fa, ${ApplicationThemeColor.DESIGNER})`}; opacity: 1; display: flex; flex-direction: row; width: 100%; justify-content: space-between; align-items: center; `;
|
|
20
21
|
const StyledMenu = styled.div ` position: absolute; top: 50px; right: 0px; width: fit-content; height: fit-content; padding: 10px 20px; border: 1px solid #2459A420; background: #E2E9EF 0% 0% no-repeat padding-box; z-index: 20000022; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 10px; border: 1px solid #c9c9c9; border-top: none; `;
|
|
21
22
|
const StyledMenuItem = styled.p ` font-size: ${props => props.$fontSize}; display: flex; flex-direction: row; justify-content: flex-start; align-items: center; gap: 2px; cursor: pointer; color: gray; &:hover{ color: ${TMColors.primary}; transition: color 100ms ease; } `;
|
|
22
23
|
const StyledHeaderIcon = styled.div ` width: 50px; height: 50px; margin-left: 10px; display: flex; align-items: center; justify-content: center; color: ${props => props.$isSelected ? '#135596' : '#ffffff'}; transition: color ease 100ms; background-color: ${props => props.$isSelected && '#ffffff'}; cursor: pointer; &:hover { color: #ffffff; background-color: #0d3862; transition: color ease 100ms; } `;
|
package/lib/ts/types.d.ts
CHANGED
|
@@ -137,6 +137,7 @@ export interface ITMChooserFormProps<T> {
|
|
|
137
137
|
onChoose?: (selectedobjects?: any) => void;
|
|
138
138
|
onClose?: () => void;
|
|
139
139
|
onShowIdChanged?: () => void;
|
|
140
|
+
onRefreshCache?: () => void;
|
|
140
141
|
}
|
|
141
142
|
export interface ITMChooserProps extends ITMEditorBase {
|
|
142
143
|
allowMultipleSelection?: boolean;
|
|
@@ -149,4 +150,5 @@ export interface ITMChooserProps extends ITMEditorBase {
|
|
|
149
150
|
tmSession?: ITopMediaSession;
|
|
150
151
|
valueName?: any;
|
|
151
152
|
onValueChanged?: (value: any) => void;
|
|
153
|
+
onRefreshCache?: () => void;
|
|
152
154
|
}
|