@topconsultnpm/sdkui-react 6.19.0-dev2.11 → 6.19.0-dev2.12
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.
|
@@ -2,6 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { MetadataDescriptor, QueryDescriptor, ValidationItem } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { ITMChooserFormProps, ITMChooserProps, TID_MID } from '../../ts';
|
|
4
4
|
import { TID_Alias } from '../../helper/queryHelper';
|
|
5
|
+
type MetadataDescriptorWithKey = MetadataDescriptor & {
|
|
6
|
+
uniqueKey: string;
|
|
7
|
+
};
|
|
5
8
|
interface ITMMetadataChooserProps extends ITMChooserProps {
|
|
6
9
|
/** Allows you to view system metadata */
|
|
7
10
|
allowSysMetadata?: boolean;
|
|
@@ -32,7 +35,7 @@ interface ITMMetadataChooserProps extends ITMChooserProps {
|
|
|
32
35
|
}
|
|
33
36
|
declare const TMMetadataChooser: React.FunctionComponent<ITMMetadataChooserProps>;
|
|
34
37
|
export default TMMetadataChooser;
|
|
35
|
-
interface ITMMetadataChooserFormProps extends ITMChooserFormProps<
|
|
38
|
+
interface ITMMetadataChooserFormProps extends ITMChooserFormProps<MetadataDescriptorWithKey> {
|
|
36
39
|
/** Allows you to view system metadata */
|
|
37
40
|
allowSysMetadata?: boolean;
|
|
38
41
|
/** TIDs of document types to retrieve metadata from */
|
|
@@ -50,15 +50,19 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
|
|
|
50
50
|
dtd.customData2 = alias;
|
|
51
51
|
if (!qdShowOnlySelectItems) {
|
|
52
52
|
dtd.metadata?.forEach((md) => {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const mdWithKey = md;
|
|
54
|
+
mdWithKey.customData1 = dtd.id;
|
|
55
|
+
mdWithKey.customData2 = alias;
|
|
56
|
+
mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
|
|
55
57
|
});
|
|
56
58
|
}
|
|
57
59
|
else {
|
|
58
60
|
let newMetadata = dtd.metadata?.filter(o => qd.select?.some(s => s.tid == dtd.id && s.mid == o.id && ((s.alias ?? '') == alias)));
|
|
59
61
|
newMetadata?.forEach((md) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
const mdWithKey = md;
|
|
63
|
+
mdWithKey.customData1 = dtd.id;
|
|
64
|
+
mdWithKey.customData2 = alias;
|
|
65
|
+
mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${alias}`;
|
|
62
66
|
});
|
|
63
67
|
}
|
|
64
68
|
let mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
|
|
@@ -81,7 +85,11 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
|
|
|
81
85
|
continue;
|
|
82
86
|
}
|
|
83
87
|
let mds = filterMetadata ? dtd.metadata?.filter(filterMetadata) : dtd.metadata;
|
|
84
|
-
mds?.forEach((md) => {
|
|
88
|
+
mds?.forEach((md) => {
|
|
89
|
+
const mdWithKey = md;
|
|
90
|
+
mdWithKey.customData1 = dtd?.id;
|
|
91
|
+
mdWithKey.uniqueKey = `${dtd.id}_${md.id}_${md.customData2 ?? ''}`;
|
|
92
|
+
});
|
|
85
93
|
dtdList.push({ ...dtd, metadata: mds });
|
|
86
94
|
}
|
|
87
95
|
}
|
|
@@ -130,5 +138,5 @@ export const TMMetadataChooserForm = ({ tmSession, tids, qd, filterMetadata, qdS
|
|
|
130
138
|
const cellRenderNameAndDesc = useCallback((data) => {
|
|
131
139
|
return _jsx("p", { style: { textAlign: 'left', color: data.data.isRequired == 1 ? 'red' : '' }, children: data.value });
|
|
132
140
|
}, []);
|
|
133
|
-
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, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: dataColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => { onChoose?.(IDs); } }));
|
|
141
|
+
return (_jsx(TMChooserForm, { title: SDK_Localizator.Metadatas, allowMultipleSelection: allowMultipleSelection, allowSorting: false, allowGrouping: dcmtTypes.length > 1, width: width, height: height, keyName: 'uniqueKey', selectedIDs: selectedIDs?.map((item) => `${item.tid}_${item.mid}_${item.aliasTID ?? ''}`), convertID: convertID, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: dataSource, getItems: getItems, customButtons: renderCustomButtons(), columns: dataColumns, summaryItems: renderSummaryItems, onClose: onClose, onChoose: (IDs) => { onChoose?.(IDs); } }));
|
|
134
142
|
};
|