@topconsultnpm/sdkui-react 6.22.0-dev1.11 → 6.22.0-dev1.13
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.d.ts +2 -0
- package/lib/components/choosers/TMDynDataListItemChooser.js +4 -6
- package/lib/components/query/TMQueryEditor.js +1 -1
- package/lib/hooks/useDocumentOperations.js +1 -1
- package/lib/hooks/usePreventFileDrop.js +14 -3
- package/package.json +1 -1
|
@@ -38,5 +38,7 @@ interface ITMDynDataListItemChooserFormProps extends ITMChooserFormProps<DataLis
|
|
|
38
38
|
layoutMode?: LayoutModes;
|
|
39
39
|
dynDL?: DynamicDataListDescriptor;
|
|
40
40
|
searchResult?: SearchResultDescriptor;
|
|
41
|
+
/** Se presente, sono i parametri da passare alla query per recuperare il dataSource */
|
|
42
|
+
queryParamsDynDataList?: string[];
|
|
41
43
|
}
|
|
42
44
|
export declare const TMDynDataListItemChooserForm: (props: ITMDynDataListItemChooserFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -122,7 +122,7 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
|
|
|
122
122
|
updateIsModalOpen?.(true);
|
|
123
123
|
}
|
|
124
124
|
}, elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, openEditorOnSummaryClick: openChooserBySingleClick, label: label, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showChooser &&
|
|
125
|
-
_jsx(TMDynDataListItemChooserForm, { TID: tid, MID: md?.id, dynDL: dynDl, title: titleForm, allowMultipleSelection: allowMultipleSelection, searchResult: dataSource, selectedIDs: values, onClose: () => {
|
|
125
|
+
_jsx(TMDynDataListItemChooserForm, { TID: tid, MID: md?.id, dynDL: dynDl, title: titleForm, allowMultipleSelection: allowMultipleSelection, searchResult: dataSource, selectedIDs: values, queryParamsDynDataList: queryParamsDynDataList, onClose: () => {
|
|
126
126
|
setShowChooser(false);
|
|
127
127
|
updateIsModalOpen?.(false);
|
|
128
128
|
summaryInputRef.current?.focus();
|
|
@@ -167,7 +167,7 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
|
|
|
167
167
|
export default TMDynDataListItemChooser;
|
|
168
168
|
const cellRenderIcon = () => _jsx(IconDetails, {});
|
|
169
169
|
export const TMDynDataListItemChooserForm = (props) => {
|
|
170
|
-
const { TID, MID, layoutMode, dynDL, searchResult, selectedIDs, title, width, height, onChoose } = props;
|
|
170
|
+
const { TID, MID, layoutMode, dynDL, searchResult, selectedIDs, title, width, height, onChoose, queryParamsDynDataList } = props;
|
|
171
171
|
// Generate unique keys for all columns
|
|
172
172
|
const uniqueKeys = generateUniqueColumnKeys(searchResult?.dtdResult?.columns, searchResult?.fromTID);
|
|
173
173
|
const dataColumns = searchResult?.dtdResult?.columns?.map((col, index) => {
|
|
@@ -184,12 +184,10 @@ export const TMDynDataListItemChooserForm = (props) => {
|
|
|
184
184
|
});
|
|
185
185
|
const keyValue = uniqueKeys[dynDL?.selectItemForValue ?? 0] ?? '';
|
|
186
186
|
const getItems = async (refreshCache) => {
|
|
187
|
-
if (!searchResult)
|
|
188
|
-
return [];
|
|
189
187
|
if (refreshCache)
|
|
190
188
|
DataListCacheService.RemoveAll();
|
|
191
189
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.DataList} ...` });
|
|
192
|
-
let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(TID, MID, layoutMode, [])
|
|
190
|
+
let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(TID, MID, layoutMode, queryParamsDynDataList ?? [])
|
|
193
191
|
.catch((err) => { TMSpinner.hide(); TMExceptionBoxManager.show({ exception: err }); });
|
|
194
192
|
TMSpinner.hide();
|
|
195
193
|
return result ? searchResultDescriptorToSimpleArray(result) ?? [] : [];
|
|
@@ -200,5 +198,5 @@ export const TMDynDataListItemChooserForm = (props) => {
|
|
|
200
198
|
titleDataList += `: ${title}`;
|
|
201
199
|
return titleDataList;
|
|
202
200
|
};
|
|
203
|
-
return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, width: width, height: height, keyName: keyValue ?? '', showDefaultColumns: false, hasShowId: false, columns: dataColumns, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon,
|
|
201
|
+
return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, width: width, height: height, keyName: keyValue ?? '', showDefaultColumns: false, hasShowId: false, columns: dataColumns, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, getItems: getItems, onClose: props.onClose, onChoose: (IDs) => onChoose?.(IDs) }));
|
|
204
202
|
};
|
|
@@ -986,7 +986,7 @@ const TMQdWhereItemValue = ({ whereItem, index, queryParamsDynDataList, onlyEdit
|
|
|
986
986
|
_jsxs(StyledDivHorizontal, { children: [(editingMode == EditingModes.Chooser) &&
|
|
987
987
|
_jsxs(_Fragment, { children: [showDataListChooseForm && !isEditableList &&
|
|
988
988
|
_jsx(TMDataListItemChooserForm, { height: '500px', width: '450px', allowMultipleSelection: whereItem.operator == QueryOperators.In || whereItem.operator == QueryOperators.NotIn, dataListId: md?.dataListID, selectedIDs: whereItem.value1?.split(',').map((item) => !item.startsWith("'") ? item : item.slice(1, -1)) ?? [], onClose: () => setShowDataListChooseForm(false), onChoose: (IDs) => { IDs && normalizeValue(IDs.length == 1 ? IDs[0] : IDs.map((item) => `${item}`).join(","), true); } }), showDynDataListChooseForm && !isEditableList &&
|
|
989
|
-
_jsx(TMDynDataListItemChooserForm, { TID: whereItem.tid, MID: md?.id, height: '500px', width: '450px', dynDL: dynDl, allowMultipleSelection: whereItem.operator == QueryOperators.In || whereItem.operator == QueryOperators.NotIn, searchResult: dataSource, selectedIDs: [whereItem.value1], onClose: () => setShowDynDataListChooseForm(false), onChoose: (IDs) => {
|
|
989
|
+
_jsx(TMDynDataListItemChooserForm, { TID: whereItem.tid, MID: md?.id, height: '500px', width: '450px', dynDL: dynDl, allowMultipleSelection: whereItem.operator == QueryOperators.In || whereItem.operator == QueryOperators.NotIn, searchResult: dataSource, selectedIDs: [whereItem.value1], queryParamsDynDataList: queryParamsDynDataList, onClose: () => setShowDynDataListChooseForm(false), onChoose: (IDs) => {
|
|
990
990
|
IDs && normalizeValue(IDs.length == 1 ? IDs[0] : IDs.map((item) => `${item}`).join(","), true);
|
|
991
991
|
if (!dynDl)
|
|
992
992
|
return;
|
|
@@ -912,7 +912,7 @@ export const useDocumentOperations = (props) => {
|
|
|
912
912
|
name: SDKUI_Localizator.ArchiveDetailDocument,
|
|
913
913
|
operationType: 'multiRow',
|
|
914
914
|
disabled: canArchiveDetailRelation !== true,
|
|
915
|
-
onClick: async () => await archiveDetailDocuments
|
|
915
|
+
onClick: async () => await archiveDetailDocuments(selectedDcmtInfos?.[0]?.TID)
|
|
916
916
|
},
|
|
917
917
|
{
|
|
918
918
|
id: 'rel-mst',
|
|
@@ -3,13 +3,24 @@ const usePreventFileDrop = (allowedDropZones) => {
|
|
|
3
3
|
useEffect(() => {
|
|
4
4
|
const isOverAllowedZone = (event) => allowedDropZones.some((ref) => ref.current?.contains(event.target));
|
|
5
5
|
const handleDragOver = (event) => {
|
|
6
|
-
if (
|
|
6
|
+
if (isOverAllowedZone(event)) {
|
|
7
|
+
// Riafferma "copy" ad ogni dragover: altrimenti un "none"
|
|
8
|
+
// impostato mentre si era fuori zona resta e mostra "not-allowed"
|
|
9
|
+
if (event.dataTransfer)
|
|
10
|
+
event.dataTransfer.dropEffect = "copy";
|
|
11
|
+
document.body.style.cursor = "default";
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
7
14
|
event.preventDefault();
|
|
8
|
-
event.dataTransfer
|
|
15
|
+
if (event.dataTransfer)
|
|
16
|
+
event.dataTransfer.dropEffect = "none";
|
|
9
17
|
}
|
|
10
18
|
};
|
|
11
19
|
const handleDragEnter = (event) => {
|
|
12
|
-
if (
|
|
20
|
+
if (isOverAllowedZone(event)) {
|
|
21
|
+
document.body.style.cursor = "default";
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
13
24
|
document.body.style.cursor = "not-allowed";
|
|
14
25
|
}
|
|
15
26
|
};
|