@topconsultnpm/sdkui-react-beta 6.16.43 → 6.16.44
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.
|
@@ -274,12 +274,7 @@ const searchByQdAsync = async (qdInput, searchParams) => {
|
|
|
274
274
|
let result;
|
|
275
275
|
let qdSearch;
|
|
276
276
|
try {
|
|
277
|
-
qdSearch = await prepareQdForSearchAsync(qdInput);
|
|
278
|
-
// In modalità easy rimuovi filtri non valorizzati
|
|
279
|
-
if (!searchParams.isAdvancedSearch) {
|
|
280
|
-
qdSearch.where = qdSearch?.where?.filter(o => PlatformObjectValidator.WhereItemHasValues(o));
|
|
281
|
-
qdSearch.where?.forEach(o => o.or = false); // props.easyOr
|
|
282
|
-
}
|
|
277
|
+
qdSearch = await prepareQdForSearchAsync(qdInput, !searchParams.isAdvancedSearch);
|
|
283
278
|
qdSearch.select?.forEach(o => { o.visibility ??= SelectItemVisibilities.Visible; });
|
|
284
279
|
if (IsParametricQuery(qdSearch)) {
|
|
285
280
|
const qdParams = await searchParams.confirmQueryParams?.(qdSearch, searchParams.lastQdParams) ?? [];
|
|
@@ -9,7 +9,8 @@ export declare const getDcmtTypesByQdAsync: (qd: QueryDescriptor) => Promise<imp
|
|
|
9
9
|
export declare const displayMetadataValue: (md: MetadataDescriptor | undefined, value: string | undefined, valueEmptyDescription?: string) => string;
|
|
10
10
|
export declare const IsParametricQuery: (qd: QueryDescriptor | undefined) => boolean;
|
|
11
11
|
export declare const addHiddenSelectItem: (select: SelectItem[], tid: number | undefined, mid: SystemMIDsAsNumber) => void;
|
|
12
|
-
export declare const prepareQdForSearchAsync: (qdInput?: QueryDescriptor) => Promise<QueryDescriptor>;
|
|
12
|
+
export declare const prepareQdForSearchAsync: (qdInput?: QueryDescriptor, removeWhereItemNoValue?: boolean) => Promise<QueryDescriptor>;
|
|
13
|
+
export declare function addWhereClausesForConnect(qd: QueryDescriptor): void;
|
|
13
14
|
export declare function getDefaultOperator(dataDomain: MetadataDataDomains | undefined, dataType: MetadataDataTypes | undefined): QueryOperators.Equal | QueryOperators.Contain | QueryOperators.In;
|
|
14
15
|
export declare const getQD: (tid: number | undefined, easyOr: boolean) => Promise<QueryDescriptor | undefined>;
|
|
15
16
|
export declare const getWorkItemSetIDAsync: (vid: number, did: number) => Promise<string | undefined>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessLevels, MetadataDataDomains, DcmtTypeListCacheService, SystemMIDsAsNumber, MetadataDataTypes, QueryDescriptor, QueryFunctions, SelectItem, SelectItemVisibilities, FromItem, LayoutModes, QueryOperators, SavedQueryDescriptor, SearchEngine, WhereItem, OrderByItem, SDK_Globals, AppModules, SystemTIDs, WorkItemMetadataNames } from '@topconsultnpm/sdk-ts-beta';
|
|
1
|
+
import { AccessLevels, MetadataDataDomains, DcmtTypeListCacheService, SystemMIDsAsNumber, MetadataDataTypes, QueryDescriptor, QueryFunctions, SelectItem, SelectItemVisibilities, FromItem, LayoutModes, QueryOperators, SavedQueryDescriptor, SearchEngine, WhereItem, OrderByItem, SDK_Globals, AppModules, SystemTIDs, WorkItemMetadataNames, PlatformObjectValidator } from '@topconsultnpm/sdk-ts-beta';
|
|
2
2
|
import { DateDisplayTypes, Globalization } from './Globalization';
|
|
3
3
|
import { DraftsMIDs, MetadataValueDescriptorEx } from '../ts';
|
|
4
4
|
import { SDKUI_Localizator } from './SDKUI_Localizator';
|
|
@@ -55,12 +55,17 @@ export const addHiddenSelectItem = (select, tid, mid) => {
|
|
|
55
55
|
si.visibility = SelectItemVisibilities.Hidden;
|
|
56
56
|
select.push(si);
|
|
57
57
|
};
|
|
58
|
-
export const prepareQdForSearchAsync = async (qdInput) => {
|
|
58
|
+
export const prepareQdForSearchAsync = async (qdInput, removeWhereItemNoValue) => {
|
|
59
59
|
let qd = new QueryDescriptor();
|
|
60
60
|
qd.init({ ...qdInput });
|
|
61
61
|
let fromTID = qd?.from?.tid;
|
|
62
62
|
qd.select ??= [];
|
|
63
63
|
qd.orderBy ??= [];
|
|
64
|
+
// In modalità easy rimuovi filtri non valorizzati
|
|
65
|
+
if (removeWhereItemNoValue) {
|
|
66
|
+
qd.where = qd?.where?.filter(o => PlatformObjectValidator.WhereItemHasValues(o));
|
|
67
|
+
qd.where?.forEach(o => o.or = false); // props.easyOr
|
|
68
|
+
}
|
|
64
69
|
let qdWithAggrFunctions = qd.select?.some(o => o.function != QueryFunctions.None && o.function != undefined);
|
|
65
70
|
if (!qd.isDistinct && !qdWithAggrFunctions) {
|
|
66
71
|
addHiddenSelectItem(qd.select, fromTID, SystemMIDsAsNumber.TID);
|
|
@@ -101,16 +106,17 @@ export const prepareQdForSearchAsync = async (qdInput) => {
|
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
108
|
qd.isLexProt = 1;
|
|
104
|
-
//Apply Filters for Connectors
|
|
109
|
+
// Apply Filters for Connectors
|
|
105
110
|
addWhereClausesForConnect(qd);
|
|
106
111
|
return qd;
|
|
107
112
|
};
|
|
108
|
-
function addWhereClausesForConnect(qd) {
|
|
113
|
+
export function addWhereClausesForConnect(qd) {
|
|
109
114
|
switch (SDK_Globals.tmSession?.SessionDescr?.appModuleID) {
|
|
110
115
|
case AppModules.EXCEL_CONNECTOR:
|
|
111
116
|
case AppModules.OUTLOOK_CONNECTOR:
|
|
112
117
|
case AppModules.POWERPOINT_CONNECTOR:
|
|
113
118
|
case AppModules.WORD_CONNECTOR:
|
|
119
|
+
case AppModules.SURFER:
|
|
114
120
|
break; // Continua l'esecuzione per questi moduli
|
|
115
121
|
default:
|
|
116
122
|
return; // Esci dalla funzione per tutti gli altri moduli
|
|
@@ -129,7 +135,7 @@ function addWhereClausesForConnect(qd) {
|
|
|
129
135
|
}
|
|
130
136
|
qd.where ??= [];
|
|
131
137
|
// ( <filtri utente> ) AND FileCount > 0 [AND FileExt IN (....)]
|
|
132
|
-
if (qd.where.length
|
|
138
|
+
if (qd.where.length >= 2) {
|
|
133
139
|
qd.where[0].leftBrackets = '(' + qd.where[0].leftBrackets;
|
|
134
140
|
qd.where[qd.where.length - 1].rightBrackets += ')';
|
|
135
141
|
}
|