@topconsultnpm/sdkui-react-beta 6.13.85 → 6.13.86
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.
|
@@ -48,8 +48,8 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
|
48
48
|
}
|
|
49
49
|
}, [inputSqdID]);
|
|
50
50
|
useEffect(() => {
|
|
51
|
+
setSearchResult([]);
|
|
51
52
|
if (!currentTID || currentTID <= 0) {
|
|
52
|
-
setSearchResult([]);
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
DcmtTypeListCacheService.GetAsync(currentTID).then(async (dtd) => {
|
|
@@ -138,7 +138,7 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
|
138
138
|
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS.filter(tid => tid != undefined && tid != null);
|
|
139
139
|
setMruTIDs(newMruTIDS);
|
|
140
140
|
} }), [mruTIDs, currentMruTID, deviceType]);
|
|
141
|
-
const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: currentSQD, onSearchCompleted: (searchResult, qd) => {
|
|
141
|
+
const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, onBackToResult: () => { setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted: (searchResult, qd) => {
|
|
142
142
|
setSearchResult(searchResult);
|
|
143
143
|
if (searchResult.length <= 0)
|
|
144
144
|
return;
|
|
@@ -159,7 +159,7 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
|
159
159
|
}, onSqdSaved: async (newSqd) => {
|
|
160
160
|
await loadDataSQDsAsync(true, newSqd.masterTID);
|
|
161
161
|
await setSQDAsync(newSqd);
|
|
162
|
-
} }), [fromDTD, currentSQD, isExpertMode, mruTIDs]);
|
|
162
|
+
} }), [fromDTD, currentSQD, isExpertMode, mruTIDs, searchResult]);
|
|
163
163
|
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) => {
|
|
164
164
|
onSQDItemClick(sqd, setSQDAsync);
|
|
165
165
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync) }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.Alls2, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
|
|
@@ -226,9 +226,9 @@ const TMRecentsManagerWrapper = ({ mruTIDs, currentMruTID, deviceType, onSelecte
|
|
|
226
226
|
onDeletedTID?.(tid);
|
|
227
227
|
} }));
|
|
228
228
|
};
|
|
229
|
-
const TMSearchQueryPanelWrapper = ({ fromDTD, SQD, isExpertMode, onSearchCompleted, onSqdSaved }) => {
|
|
229
|
+
const TMSearchQueryPanelWrapper = ({ fromDTD, SQD, isExpertMode, showBackToResultButton, onSearchCompleted, onSqdSaved, onBackToResult }) => {
|
|
230
230
|
const { setPanelVisibilityById, toggleMaximize } = useTMPanelManagerContext();
|
|
231
|
-
return (_jsx(TMSearchQueryPanel, { onClosePanel: () => setPanelVisibilityById('TMSearchQueryPanel', false), onMaximizePanel: () => toggleMaximize('TMSearchQueryPanel'), isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: SQD, onSearchCompleted: onSearchCompleted, onSqdSaved: onSqdSaved }));
|
|
231
|
+
return (_jsx(TMSearchQueryPanel, { onClosePanel: () => setPanelVisibilityById('TMSearchQueryPanel', false), onMaximizePanel: () => toggleMaximize('TMSearchQueryPanel'), isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: SQD, onSearchCompleted: onSearchCompleted, onSqdSaved: onSqdSaved, showBackToResultButton: showBackToResultButton, onBackToResult: onBackToResult }));
|
|
232
232
|
};
|
|
233
233
|
const TMSavedQuerySelectorWrapper = ({ items, selectedId, allowShowSearch, manageDefault, onRefreshData, onItemClick, onDeleted }) => {
|
|
234
234
|
const { setPanelVisibilityById } = useTMPanelManagerContext();
|
|
@@ -5,7 +5,9 @@ interface ITMSearchQueryPanelProps {
|
|
|
5
5
|
fromDTD?: DcmtTypeDescriptor;
|
|
6
6
|
SQD?: SavedQueryDescriptor;
|
|
7
7
|
isExpertMode?: boolean;
|
|
8
|
+
showBackToResultButton?: boolean;
|
|
8
9
|
onBack?: () => void;
|
|
10
|
+
onBackToResult?: () => void;
|
|
9
11
|
onSqdSaved?: (newSqd: SavedQueryDescriptor) => void;
|
|
10
12
|
onFocusedMetadataChanged?: (tid_mid: TID_MID | undefined) => void;
|
|
11
13
|
onSearchCompleted?: (searchResult: SearchResultDescriptor[], qd: QueryDescriptor | undefined) => void;
|
|
@@ -4,7 +4,7 @@ import { PlatformObjectValidator, WhereItem, SDK_Localizator, OrderByItem, Selec
|
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import TMSearchQueryEditor from './TMSearchQueryEditor';
|
|
6
6
|
import Logo from '../../../assets/Toppy-generico.png';
|
|
7
|
-
import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, IconAddCircleOutline, IconEdit,
|
|
7
|
+
import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, IconAddCircleOutline, IconEdit, IconEasy, IconAdvanced, deepCompare, IconSearch, IconClear, getDefaultOperator, prepareQdForSearchAsync, IsParametricQuery, SDKUI_Globals, IconArrowRight } from '../../../helper';
|
|
8
8
|
import { useQueryParametersDialog } from '../../../hooks/useQueryParametersDialog';
|
|
9
9
|
import { FormModes } from '../../../ts';
|
|
10
10
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -23,7 +23,7 @@ import TMQueryEditor from '../../query/TMQueryEditor';
|
|
|
23
23
|
import TMSavedQueryForm from './TMSavedQueryForm';
|
|
24
24
|
import { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
|
25
25
|
import TMShowAllOrMaxItemsButton from '../../base/TMShowAllOrMaxItemsButton';
|
|
26
|
-
const TMSearchQueryPanel = ({ fromDTD, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, onSearchCompleted, onFocusedMetadataChanged, onSqdSaved, onBack, onClosePanel, onMaximizePanel }) => {
|
|
26
|
+
const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, onSearchCompleted, onFocusedMetadataChanged, onSqdSaved, onBack, onClosePanel, onMaximizePanel, onBackToResult }) => {
|
|
27
27
|
const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
|
|
28
28
|
const [qd, setQd] = useState();
|
|
29
29
|
const [lastQdParams, setLastQdParams] = useState([]);
|
|
@@ -37,7 +37,6 @@ const TMSearchQueryPanel = ({ fromDTD, isExpertMode = SDKUI_Globals.userSettings
|
|
|
37
37
|
const [showOrderByConfig, setShowOrderByConfig] = useState(false);
|
|
38
38
|
const [showDistinctValuesPanel, setShowDistinctValuesPanel] = useState(false);
|
|
39
39
|
const [focusedTidMid, setFocusedTidMid] = useState();
|
|
40
|
-
const [keepStatePanelIsActive, setKeepStatePanelIsActive] = useState(false);
|
|
41
40
|
const deviceType = useDeviceType();
|
|
42
41
|
let initialMaxItems = deviceType === DeviceType.MOBILE ? 8 : 12;
|
|
43
42
|
useEffect(() => {
|
|
@@ -117,12 +116,14 @@ const TMSearchQueryPanel = ({ fromDTD, isExpertMode = SDKUI_Globals.userSettings
|
|
|
117
116
|
};
|
|
118
117
|
}, [qd, showAdvancedSearch]);
|
|
119
118
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
120
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: !isMobile, onMaximize: isMobile ? undefined : onMaximizePanel, onHeaderDoubleClick: isMobile ? undefined : onMaximizePanel, onBack: onBack,
|
|
119
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: !isMobile, onMaximize: isMobile ? undefined : onMaximizePanel, onHeaderDoubleClick: isMobile ? undefined : onMaximizePanel, onBack: onBack,
|
|
120
|
+
// keepActiveState={keepStatePanelIsActive}
|
|
121
|
+
toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
|
|
121
122
|
_jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false }), items: [
|
|
122
|
-
{ icon: _jsx(
|
|
123
|
+
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), text: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
|
|
124
|
+
{ icon: _jsx(IconAddCircleOutline, {}), beginGroup: true, text: SDKUI_Localizator.SavedQueryNew, onClick: () => { openSqdForm(FormModes.Create); } },
|
|
123
125
|
{ icon: _jsx(IconEdit, {}), text: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
|
124
|
-
{ icon: _jsx(
|
|
125
|
-
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), text: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
126
|
+
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), beginGroup: true, text: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
126
127
|
{ icon: _jsx(IconEdit, {}), beginGroup: true, text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, onClick: () => { setShowFiltersConfig(true); } },
|
|
127
128
|
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
|
|
128
129
|
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
|