@topconsultnpm/sdkui-react-beta 6.6.0 → 6.6.2

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.
@@ -1,10 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Fragment, useEffect, useState } from 'react';
3
- import { SDK_Localizator, AccessLevels, OnJoinItem, JoinTypes, PlatformObjectValidator, MetadataDataDomains, DcmtTypeListCacheService, JoinItem, SystemMIDsAsNumber, MetadataDataTypes, OrderByItem, QueryDescriptor, QueryFunctions, QueryOperators, ResultTypes, SelectItem, SDK_Globals, UserListCacheService, WhereItem, SearchEngine, SelectItemVisibilities, DataListCacheService, QueryValidatorOptions, TMPropertyNames, AppModules } from '@topconsultnpm/sdk-ts-beta';
2
+ import { useEffect, useState } from 'react';
3
+ import { SDK_Localizator, AccessLevels, OnJoinItem, JoinTypes, PlatformObjectValidator, MetadataDataDomains, DcmtTypeListCacheService, JoinItem, SystemMIDsAsNumber, MetadataDataTypes, OrderByItem, QueryDescriptor, QueryFunctions, QueryOperators, ResultTypes, SelectItem, SDK_Globals, UserListCacheService, WhereItem, SearchEngine, SelectItemVisibilities, DataListCacheService, QueryValidatorOptions, TMPropertyNames, AppModules, LayoutModes } from '@topconsultnpm/sdk-ts-beta';
4
4
  import styled from 'styled-components';
5
- import TMQueryResult from './TMQueryResult';
6
5
  import Accordion, { Item } from 'devextreme-react/accordion';
7
- import { SDKUI_Localizator, IconSettings, IconSearch, IconCount, getQueryCountAsync, calcIsModified, IconClear, IconAddCircleOutline, IconDotsVerticalCircleOutline, IconHide, IconShow, IconDraggabledots, genUniqueId, LocalizeQueryOperators, LocalizeQueryFunctions, LocalizeQueryJoinTypes, IconArchiveDoc, IconArrowRight, IconCloseCircle, IconCopy, IconDcmtTypeOnlyMetadata, IconDelete, IconDownload, IconDuplicate, IconEdit, IconMail, IconMenuVertical, IconPreview, IconStar, IconSuccessCirlce, IconUndo, IconExportTo, IconAdvanced, IconArrowSortedDown, IconArrowSortedUp, IconArrowUnsorted, IconBatchUpdate, IconCheckFile, IconCheckIn, IconConvertFilePdf, IconEasy, IconRecursiveOps, IconRelation, IconShare, IconSharedDcmt, IconSignature, IconSubstFile, IconSync } from '../../helper';
6
+ import { SDKUI_Localizator, IconSearch, IconCount, getQueryCountAsync, calcIsModified, IconClear, IconAddCircleOutline, IconDotsVerticalCircleOutline, IconHide, IconShow, IconDraggabledots, genUniqueId, LocalizeQueryOperators, LocalizeQueryFunctions, LocalizeQueryJoinTypes, IconArchiveDoc, IconArrowRight } from '../../helper';
8
7
  import { displayMetadataValue, getDcmtTypesByQdAsync, getTIDsByQd } from '../../helper/queryHelper';
9
8
  import { useOutsideClick } from '../../hooks/useOutsideClick';
10
9
  import { FormModes } from '../../ts';
@@ -17,10 +16,10 @@ import TMSpinner from '../base/TMSpinner';
17
16
  import { TMTabItemBadge } from '../base/TMTab';
18
17
  import TMTooltip from '../base/TMTooltip';
19
18
  import TMVilViewer from '../base/TMVilViewer';
20
- import { TMDataListItemChooserForm } from '../choosers/TMDataListItemChooser';
19
+ import TMDataListItemChooser, { TMDataListItemChooserForm } from '../choosers/TMDataListItemChooser';
21
20
  import TMDcmtTypeChooser from '../choosers/TMDcmtTypeChooser';
22
21
  import TMMetadataChooser from '../choosers/TMMetadataChooser';
23
- import { TMUserChooserForm } from '../choosers/TMUserChooser';
22
+ import TMUserChooser, { TMUserChooserForm } from '../choosers/TMUserChooser';
24
23
  import TMCheckBox from '../editors/TMCheckBox';
25
24
  import TMDateBox from '../editors/TMDateBox';
26
25
  import TMTextBox from '../editors/TMTextBox';
@@ -28,23 +27,25 @@ import TMApplyForm from '../forms/TMApplyForm';
28
27
  import { getDisplayAlias } from '../viewers/TMMidViewer';
29
28
  import { useApplyForm } from '../../hooks/useForm';
30
29
  import ShowAlert from '../base/TMAlert';
31
- const StyledRowItem = styled.div ` display: flex; flex-direction: row; align-items: center; justify-content: flex-start; margin-bottom: 5px; gap: 3px; `;
32
- const StyledItemWrapper = styled.div ` border-radius: ${props => props.$borderRadius ? props.$borderRadius : '4px'}; padding: 4px; font-size: 1rem; user-select: none; width: max-content; `;
33
- const StyledAccordionItemContainer = styled.div ` width: 100%; padding: 2px; display: flex; flex-direction: column; overflow-x: auto; align-items: flex-start; margin-left: 5px; gap: 3px; max-height: 300px; `;
34
- const StyledAccordionItemContent = styled.div ` width: 100%; pointer-events: ${props => props.$disabled ? 'none' : ''}; `;
35
- const colorValue = 'rgba(224,224,224,.5)';
36
- const colorBrackets = 'rgba(209,52,56,.3)';
37
- const colorOperator = 'rgba(16,124,16,.3)'; //'#b8dbf0'
38
- const color1 = '#F5DD9C';
39
- const color2 = 'rgba(15,108,189,.3)';
40
- const color3 = 'rgb(199, 236, 172)';
41
- const color4 = 'rgb(223, 204, 251)';
42
- const color5 = 'rgb(249, 181, 114)';
43
- const color6 = 'rgb(170, 215, 217)';
44
- const color7 = 'rgb(243, 208, 215)';
45
- const color8 = 'rgb(236, 202, 156)';
46
- const color9 = 'rgb(137, 185, 173)';
47
- const colorX = 'rgb(246, 245, 242)';
30
+ import TMDynDataListItemChooser, { IsParametricQuery, TMDynDataListItemChooserForm } from '../choosers/TMDynDataListItemChooser';
31
+ import TMQueryResultForm, { SearchResultContext } from './TMQueryResultForm';
32
+ export const StyledRowItem = styled.div ` display: flex; flex-direction: row; align-items: center; justify-content: flex-start; margin-bottom: 5px; gap: 3px; `;
33
+ export const StyledItemWrapper = styled.div ` border-radius: ${props => props.$borderRadius ? props.$borderRadius : '4px'}; padding: 4px; font-size: 1rem; user-select: none; width: max-content; `;
34
+ export const StyledAccordionItemContainer = styled.div ` width: 100%; padding: 2px; display: flex; flex-direction: column; overflow-x: auto; align-items: flex-start; margin-left: 5px; gap: 3px; max-height: 300px; `;
35
+ export const StyledAccordionItemContent = styled.div ` width: 100%; pointer-events: ${props => props.$disabled ? 'none' : ''}; `;
36
+ export const colorValue = 'rgba(224,224,224,.5)';
37
+ export const colorBrackets = 'rgba(209,52,56,.3)';
38
+ export const colorOperator = 'rgba(16,124,16,.3)'; //'#b8dbf0'
39
+ export const color1 = '#F5DD9C';
40
+ export const color2 = 'rgba(15,108,189,.3)';
41
+ export const color3 = 'rgb(199, 236, 172)';
42
+ export const color4 = 'rgb(223, 204, 251)';
43
+ export const color5 = 'rgb(249, 181, 114)';
44
+ export const color6 = 'rgb(170, 215, 217)';
45
+ export const color7 = 'rgb(243, 208, 215)';
46
+ export const color8 = 'rgb(236, 202, 156)';
47
+ export const color9 = 'rgb(137, 185, 173)';
48
+ export const colorX = 'rgb(246, 245, 242)';
48
49
  export var Descriptors;
49
50
  (function (Descriptors) {
50
51
  Descriptors[Descriptors["Query"] = 3] = "Query";
@@ -60,10 +61,8 @@ export function useOrchApplyForm(d, formMode, inputData, onApplied, parameters)
60
61
  const [validationItems, setValidationItems] = useState([]);
61
62
  return { formData, setFormData, formDataOrig, validationItems, setValidationItems, exception, applyData };
62
63
  }
63
- const TMQueryEditor = ({ formMode, inputData, onlyAdvancedSearchMode = true, isModal, showDistinct = false, showToolbar = true, validateSelect = true, validateOrderBy = true, raiseWarningForOnlyMetadataDcmtTypes = false, onApplied, onClose, height = 'auto', borderRadius = '4px', searchText, showApply, showUndo, showBack, onFromTIDChanged }) => {
64
+ const TMQueryEditor = ({ formMode, inputData, onQDChanged, runQdImmediately = false, isModal, showDistinct = false, showToolbar = true, validateSelect = true, validateOrderBy = true, raiseWarningForOnlyMetadataDcmtTypes = false, onApplied, onClose, height = 'auto', borderRadius = '4px', searchText, showApply, showUndo, showBack, onFromTIDChanged }) => {
64
65
  const { formData, setFormData, formDataOrig, validationItems, setValidationItems, exception, applyData } = useOrchApplyForm(Descriptors.Query, formMode, inputData, onApplied);
65
- const [isAdvancedSearch, setIsAdvancedSearch] = useState(onlyAdvancedSearchMode);
66
- const [isEasyModeConfigurable, setIsEasyModeConfigurable] = useState(false);
67
66
  const [dcmtTypesList, setDcmtTypesList] = useState([]);
68
67
  const [resultSearch, setResultSearch] = useState();
69
68
  const [elapsedTime, setElapsedTime] = useState(0);
@@ -72,6 +71,8 @@ const TMQueryEditor = ({ formMode, inputData, onlyAdvancedSearchMode = true, isM
72
71
  const [showCompleteMetadataName, setShowCompleteMetadataName] = useState(false);
73
72
  const [showResultSearch, setShowResultSearch] = useState(false);
74
73
  const [fromCount, setFromCount] = useState(0);
74
+ const [dynDataListsToBeRefreshed, setDynDataListsToBeRefreshed] = useState([]);
75
+ useEffect(() => { setShowResultSearch(false); }, [inputData]);
75
76
  useEffect(() => {
76
77
  if (!formData)
77
78
  return;
@@ -79,16 +80,18 @@ const TMQueryEditor = ({ formMode, inputData, onlyAdvancedSearchMode = true, isM
79
80
  validateQd();
80
81
  setFromCount((formData.from?.tid && formData.from?.tid > 0 ? 1 : 0) + (formData.join?.length ?? 0));
81
82
  }, [formData.from, formData.join]);
82
- useEffect(() => {
83
- validateQd();
84
- }, [formData.select, formData.where, formData.orderBy, formData.maxDcmtsToBeReturned, isAdvancedSearch]);
83
+ useEffect(() => { validateQd(); }, [formData.select, formData.where, formData.orderBy, formData.maxDcmtsToBeReturned]);
84
+ //Se non c'è la toolbar significa che il qd deve essere gestito dall'esterno
85
+ useEffect(() => { if (!showToolbar)
86
+ onQDChanged?.(formData); }, [formData]);
87
+ useEffect(() => { if (runQdImmediately)
88
+ onSearchAsync().catch((err) => { TMExceptionBoxManager.show({ exception: err }); }); }, [runQdImmediately]);
85
89
  const validateQd = () => {
86
90
  let vil = [];
87
91
  let qvo = new QueryValidatorOptions();
88
92
  qvo.DoSelectValidation = validateSelect;
89
93
  qvo.DoOrderByValidation = validateOrderBy;
90
94
  qvo.RaiseWarningForOnlyMetadataDcmtTypes = raiseWarningForOnlyMetadataDcmtTypes;
91
- qvo.DoWhereHasItemsValidation = isAdvancedSearch;
92
95
  PlatformObjectValidator.QueryValidatorAsync(formData, vil, qvo).then(() => { setValidationItems(vil); });
93
96
  };
94
97
  const errorsCount = validationItems.filter((o) => o.ResultType == ResultTypes.ERROR).length;
@@ -567,81 +570,7 @@ const TMQueryEditor = ({ formMode, inputData, onlyAdvancedSearchMode = true, isM
567
570
  };
568
571
  // #endregion
569
572
  // #region Ricerca
570
- const renderResultSearchForm = () => {
571
- return (_jsx(TMApplyForm, { isModal: isModal, formMode: FormModes.None, showApply: false, showUndo: false, hasNavigation: false, onClose: () => { setShowResultSearch(false); }, customToolbarElements: SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.ORCHESTRATOR ? [] :
572
- [
573
- _jsx(TMButton, { caption: "Sincronizza elementi query", icon: _jsx(IconSync, {}), btnStyle: 'toolbar', fontSize: '1.3rem', elementStyle: { marginRight: '10px' }, onClick: () => { ShowAlert({ message: "TODO Sync Query", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }, "btn1"),
574
- _jsx(TMButton, { caption: "Download documento", icon: _jsx(IconDownload, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Download documento", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }, "btn2"),
575
- _jsx(TMButton, { caption: "Apri form", icon: _jsx(IconPreview, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Apri form", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }, "btn3"),
576
- _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { icon: _jsx(IconCheckIn, {}), caption: 'Check in', btnStyle: 'toolbar', fontSize: '1.3rem' }), items: [
577
- { icon: _jsx(IconCheckIn, {}), text: "Check out", onClick: () => ShowAlert({ message: "TODO Check out", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
578
- { icon: _jsx(IconCheckIn, {}), text: "Modifica file", onClick: () => ShowAlert({ message: "TODO Modifica file", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
579
- { icon: _jsx(IconCheckIn, {}), text: "Annulla check out", onClick: () => ShowAlert({ message: "TODO Annulla check out", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
580
- { icon: _jsx(IconCheckIn, {}), text: "Check in", onClick: () => ShowAlert({ message: "TODO Check in", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
581
- { icon: _jsx(IconCheckIn, {}), text: "Cronologia", onClick: () => ShowAlert({ message: "TODO Cronologia", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
582
- ] }, "btn4"),
583
- _jsx(TMButton, { caption: "Aggiungi a preferiti", icon: _jsx(IconStar, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }, "btn5"),
584
- _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'toolbar', caption: 'Operazioni ricorsive', icon: _jsx(IconRecursiveOps, {}) }), items: [
585
- {
586
- icon: _jsx(IconMail, {}), text: "Invia per posta", items: [
587
- { icon: _jsx(IconMail, {}), text: "I documenti selezionati", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
588
- { icon: _jsx(IconMail, {}), text: "I documenti di primo livello e tutti i documenti correlati", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
589
- { icon: _jsx(IconMail, {}), text: "I documenti di primo livello e i documenti correlati personalizzando l'operazione", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
590
- ]
591
- },
592
- {
593
- icon: _jsx(IconDcmtTypeOnlyMetadata, {}), text: "Unisci in un file PDF", items: [
594
- { icon: _jsx(IconDcmtTypeOnlyMetadata, {}), text: "I documenti selezionati", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
595
- { icon: _jsx(IconDcmtTypeOnlyMetadata, {}), text: "I documenti di primo livello e tutti i documenti correlati", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
596
- { icon: _jsx(IconDcmtTypeOnlyMetadata, {}), text: "I documenti di primo livello e i documenti correlati personalizzando l'operazione", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
597
- ]
598
- },
599
- {
600
- icon: _jsx(IconCopy, {}), text: "Copia in una cartella", items: [
601
- { icon: _jsx(IconCopy, {}), text: "I documenti selezionati", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
602
- { icon: _jsx(IconCopy, {}), text: "I documenti di primo livello e tutti i documenti correlati", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
603
- { icon: _jsx(IconCopy, {}), text: "I documenti di primo livello e i documenti correlati personalizzando l'operazione", onClick: () => ShowAlert({ message: "TODO", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
604
- ]
605
- },
606
- ] }, "btn6"),
607
- _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { icon: _jsx(IconRelation, {}), caption: 'Correlazioni', btnStyle: 'toolbar', fontSize: '1.3rem' }), items: [
608
- { icon: _jsx(IconRelation, {}), text: "Abbina documenti molti a molti", onClick: () => ShowAlert({ message: "TODO Abbina documenti molti a molti", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
609
- { icon: _jsx(IconRelation, {}), text: "Disabbina documenti molti a molti", onClick: () => ShowAlert({ message: "TODO Disabbina documenti molti a molti", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
610
- { icon: _jsx(IconRelation, {}), text: "Archivia documento dettaglio", beginGroup: true, onClick: () => ShowAlert({ message: "TODO Archivia documento dettaglio", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
611
- { icon: _jsx(IconRelation, {}), text: "Archivia documento master", onClick: () => ShowAlert({ message: "TODO Archivia documento master", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
612
- { icon: _jsx(IconRelation, {}), text: "Documenti master", beginGroup: true, onClick: () => ShowAlert({ message: "TODO Documenti master", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
613
- ] }, "btn7"),
614
- _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { icon: _jsx(IconSignature, {}), btnStyle: 'toolbar', caption: 'Firma', fontSize: '1.3rem' }), items: [
615
- { icon: _jsx(IconSignature, {}), text: "Informazioni di firma", onClick: () => ShowAlert({ message: "TODO Informazioni di firma", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
616
- { icon: _jsx(IconSignature, {}), text: "Verifica firma", onClick: () => ShowAlert({ message: "TODO Verifica firma", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
617
- { icon: _jsx(IconSignature, {}), text: "Firma e marca", onClick: () => ShowAlert({ message: "TODO Firma e marca", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
618
- ] }, "btn7"),
619
- _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'toolbar', caption: 'Cancellazione', icon: _jsx(IconDelete, {}) }), items: [
620
- { icon: _jsx(IconDelete, {}), text: "Cancellazione logica", onClick: () => ShowAlert({ message: "TODO Cancellazione logica", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
621
- { icon: _jsx(IconUndo, {}), text: "Ripristina", onClick: () => ShowAlert({ message: "TODO Ripristina", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
622
- { icon: _jsx(IconCloseCircle, {}), text: "Cancellazione fisica", onClick: () => ShowAlert({ message: "TODO Cancellazione fisica", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
623
- ] }, "btn8"),
624
- _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'toolbar', caption: 'Altro', icon: _jsx(IconMenuVertical, {}) }), items: [
625
- { icon: _jsx(IconArchiveDoc, {}), text: "Passa ad archiviazione", onClick: () => ShowAlert({ message: "TODO Passa ad archiviazione", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
626
- { icon: _jsx(IconDuplicate, {}), text: "Duplica documento", onClick: () => ShowAlert({ message: "TODO Duplica documento", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
627
- { icon: _jsx(IconSubstFile, { fontSize: 18 }), text: "Aggiungi/sostituisci file", onClick: () => ShowAlert({ message: "TODO Aggiungi/sostituisci file", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
628
- { icon: _jsx(IconConvertFilePdf, { fontSize: 18 }), text: "Conversione file", onClick: () => ShowAlert({ message: "TODO Conversione file", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
629
- { icon: _jsx(IconCheckFile, { fontSize: 18 }), text: "Controllo file", onClick: () => ShowAlert({ message: "TODO Controllo file", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
630
- { icon: _jsx(IconBatchUpdate, { fontSize: 18 }), text: "Modifica multipla", onClick: () => ShowAlert({ message: "TODO Modifica multipla", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
631
- { icon: _jsx(IconShare, { fontSize: 18 }), text: "Archiviazione condivisa", beginGroup: true, onClick: () => ShowAlert({ message: "TODO Archiviazione condivisa", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
632
- { icon: _jsx(IconSharedDcmt, { fontSize: 18 }), text: "Documenti condivisi", onClick: () => ShowAlert({ message: "TODO Documenti condivisi", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
633
- {
634
- icon: _jsx(IconSearch, {}), text: "Trova tutti i riferimenti", beginGroup: true, items: [
635
- { icon: _jsx(IconSearch, {}), text: "Trova tutti i riferimenti", onClick: () => ShowAlert({ message: "TODO Trova tutti i riferimenti", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
636
- { icon: _jsx(IconSearch, {}), text: "Trova tutti i riferimenti (anche nello storico)", onClick: () => ShowAlert({ message: "TODO Trova tutti i riferimenti (anche nello storico)", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
637
- ]
638
- },
639
- { icon: _jsx(IconExportTo, { fontSize: 18 }), text: "Esporta in...", onClick: () => ShowAlert({ message: "TODO Esporta in", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
640
- { icon: _jsx(IconShow, {}), text: "Mostra footer", onClick: () => ShowAlert({ message: "TODO Mostra footer", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
641
- { icon: _jsx(IconSettings, {}), text: SDKUI_Localizator.ShowHideMetadataSystemDesc, onClick: () => ShowAlert({ message: "TODO ShowHideMetadataSystem", mode: 'info', title: `${"TODO"}`, duration: 3000 }) },
642
- ] }, "btn9")
643
- ], children: _jsx(TMQueryResult, { result: resultSearch, elapsedTime: elapsedTime, searchText: searchText }) }));
644
- };
573
+ const renderResultSearchForm = _jsx(TMQueryResultForm, { context: SearchResultContext.METADATA_SEARCH, onClose: () => { setShowResultSearch(false); }, isModal: isModal, result1: resultSearch, elapsedTime: elapsedTime, searchText: searchText });
645
574
  const onSearchAsync = async () => {
646
575
  try {
647
576
  TMSpinner.show({ description: `Esecuzione query ...`, backgroundColor: 'transparent' });
@@ -712,10 +641,7 @@ const TMQueryEditor = ({ formMode, inputData, onlyAdvancedSearchMode = true, isM
712
641
  }
713
642
  }
714
643
  }
715
- // In modalità easy rimuovi filtri non valorizzati
716
- if (!isAdvancedSearch)
717
- qd.where = qd?.where?.filter(o => PlatformObjectValidator.WhereItemHasValues(o));
718
- let result = await SDK_Globals.tmSession?.NewSearchEngine().SearchByIDAsync(qd, 6);
644
+ let result = await SDK_Globals.tmSession?.NewSearchEngine().SearchByIDAsync(qd);
719
645
  let dcmtsFound = result?.dcmtsFound ?? 0;
720
646
  if (dcmtsFound <= 0)
721
647
  TMMessageBoxManager.show({ title: SDK_Globals.appModule, message: "Nessun documento trovato", buttons: [ButtonNames.OK] });
@@ -800,24 +726,7 @@ const TMQueryEditor = ({ formMode, inputData, onlyAdvancedSearchMode = true, isM
800
726
  }
801
727
  };
802
728
  // #endregion
803
- const renderButtonSort = (tid_mid) => {
804
- const oi = formData.orderBy?.find(o => o.tid == tid_mid.tid && o.mid == tid_mid.mid);
805
- if (!oi)
806
- return _jsx(TMButton, { btnStyle: 'icon', padding: '0px 10px', icon: _jsx(IconArrowUnsorted, { fontSize: 16, color: TMColors.button_icon }), caption: 'Nessun ordinamento', onClick: () => {
807
- const orderByCopy = formData?.orderBy?.map((oi) => { return oi; }) ?? [];
808
- let oi = new OrderByItem();
809
- oi.tid = tid_mid.tid;
810
- oi.mid = tid_mid.mid;
811
- oi.asc = true;
812
- orderByCopy.push(oi);
813
- setFormData({ ...formData, orderBy: orderByCopy });
814
- } });
815
- if (oi.asc)
816
- return _jsx(TMButton, { btnStyle: 'icon', padding: '0px 10px', icon: _jsx(IconArrowSortedUp, { fontSize: 16, color: "green" }), caption: 'Ordinamento crescente', onClick: () => { onChange_OrderByItem_Asc(false, oi, formData.orderBy?.indexOf(oi) ?? 0); } });
817
- else
818
- return _jsx(TMButton, { btnStyle: 'icon', padding: '0px 10px', icon: _jsx(IconArrowSortedDown, { fontSize: 16, color: "orange" }), caption: 'Ordinamento decrescente', onClick: () => { formData.orderBy && onRemove_OrderByItem(formData.orderBy?.indexOf(oi)); } });
819
- };
820
- return (_jsxs(_Fragment, { children: [_jsx(TMApplyForm, { isModal: false, formMode: formMode, isModified: calcIsModified(formData, formDataOrig), exception: exception, validationItems: validationItems, hasNavigation: false, customToolbarElements: _jsxs(_Fragment, { children: [_jsx(TMButton, { keyGesture: 'alt+1', btnStyle: 'toolbar', caption: SDKUI_Localizator.Search, color: 'tertiary', icon: _jsx(IconSearch, {}), disabled: errorsCount > 0, onClick: onSearchAsync }), _jsx(TMButton, { keyGesture: 'alt+2', btnStyle: 'toolbar', caption: SDKUI_Localizator.Count, icon: _jsx(IconCount, {}), disabled: errorsCount > 0, onClick: () => getQueryCountAsync(formData, true) }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { keyGesture: 'alt+3', caption: "Passa ad archiviazione", icon: _jsx(IconArchiveDoc, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Passa ad archiviazione", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { keyGesture: 'alt+4', caption: "Vai a risultato", icon: _jsx(IconArrowRight, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Vai a risultato", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), !onlyAdvancedSearchMode && _jsx(TMButton, { elementStyle: { marginLeft: '30px' }, caption: isAdvancedSearch ? "Modalità avanzata" : "Modalità facilitata", icon: isAdvancedSearch ? _jsx(IconAdvanced, { fontSize: 18 }) : _jsx(IconEasy, { fontSize: 18 }), color: isAdvancedSearch ? 'primary' : 'success', btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { setIsAdvancedSearch(!isAdvancedSearch); } }), !isAdvancedSearch && _jsx(TMButton, { caption: "Configura", icon: _jsx(IconEdit, {}), btnStyle: 'toolbar', color: isEasyModeConfigurable ? 'success' : 'primary', fontSize: '1.3rem', onClick: () => { setIsEasyModeConfigurable(!isEasyModeConfigurable); } }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx("p", { style: { fontWeight: 600, marginLeft: '30px' }, children: dcmtTypesList.find(o => o.id == formData.from?.tid)?.nameLoc })] }), showToolbar: showToolbar, showApply: showApply, showUndo: showUndo, showBack: showBack, onApply: () => applyData(), onClose: () => onClose?.(), onUndo: () => setFormData(formDataOrig), children: _jsxs(Accordion, { height: height, multiple: true, collapsible: true, repaintChangesOnly: true, deferRendering: false, animationDuration: 0, onContentReady: (e) => {
729
+ return (_jsxs(_Fragment, { children: [_jsx(TMApplyForm, { isModal: false, formMode: formMode, isModified: calcIsModified(formData, formDataOrig), exception: exception, validationItems: validationItems, hasNavigation: false, customToolbarElements: _jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Search, color: 'tertiary', icon: _jsx(IconSearch, {}), disabled: errorsCount > 0, onClick: onSearchAsync }), _jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Count, icon: _jsx(IconCount, {}), disabled: errorsCount > 0, onClick: () => getQueryCountAsync(formData, true) }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { caption: "Passa ad archiviazione", icon: _jsx(IconArchiveDoc, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Passa ad archiviazione", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { caption: "Vai a risultato", icon: _jsx(IconArrowRight, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Vai a risultato", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } })] }), showToolbar: showToolbar, showApply: showApply, showUndo: showUndo, showBack: showBack, onApply: () => applyData(), onClose: () => onClose?.(), onUndo: () => setFormData(formDataOrig), children: _jsxs(Accordion, { elementAttr: { class: 'tm-query-dx-accordion' }, height: height, multiple: true, collapsible: true, repaintChangesOnly: true, deferRendering: false, animationDuration: 0, onContentReady: (e) => {
821
730
  let items = e.component.option("items");
822
731
  if (items && items.length > 0) {
823
732
  for (let i = 0; i < items.length; i++) {
@@ -828,7 +737,7 @@ const TMQueryEditor = ({ formMode, inputData, onlyAdvancedSearchMode = true, isM
828
737
  }
829
738
  }
830
739
  }
831
- }, children: [(!isReadOnly || fromCount > 0) && isAdvancedSearch && _jsx(Item, { title: SDKUI_Localizator.Source, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, fromCount, validationItems.filter((o) => [TMPropertyNames.fromTid, TMPropertyNames.join].includes(o.PropertyName))), children: _jsx(StyledAccordionItemContainer, { style: { maxHeight: fromCount > 0 ? '330px' : '100%' }, children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, style: { height: '100%' }, children: [_jsxs(StyledRowItem, { children: [!isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconClear, { color: TMColors.button_icon }), caption: SDKUI_Localizator.Remove, onClick: () => { let qd = SearchEngine.NewQueryDescriptor(); setFormData({ ...qd }); } }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', elementStyle: { opacity: !formData?.from?.tid ? 0.4 : 1 }, disabled: !formData?.from?.tid, icon: _jsx(IconAddCircleOutline, { color: TMColors.button_icon }), caption: SDKUI_Localizator.AddBelow, onClick: onAdd_JoinItem }), _jsx("div", { style: { pointerEvents: 'all' }, children: _jsx(TMDropDownMenu, { content: _jsx(IconDotsVerticalCircleOutline, { color: TMColors.button_icon }), items: [
740
+ }, children: [(!isReadOnly || fromCount > 0) && _jsx(Item, { title: SDKUI_Localizator.Source, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, fromCount, validationItems.filter((o) => [TMPropertyNames.fromTid, TMPropertyNames.join].includes(o.PropertyName))), children: _jsx(StyledAccordionItemContainer, { style: { maxHeight: fromCount > 0 ? '330px' : '100%' }, children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, style: { height: '100%' }, children: [_jsxs(StyledRowItem, { children: [!isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconClear, { color: TMColors.button_icon }), caption: SDKUI_Localizator.Remove, onClick: () => { let qd = SearchEngine.NewQueryDescriptor(); setFormData({ ...qd }); } }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', elementStyle: { opacity: !formData?.from?.tid ? 0.4 : 1 }, disabled: !formData?.from?.tid, icon: _jsx(IconAddCircleOutline, { color: TMColors.button_icon }), caption: SDKUI_Localizator.AddBelow, onClick: onAdd_JoinItem }), _jsx("div", { style: { pointerEvents: 'all' }, children: _jsx(TMDropDownMenu, { content: _jsx(IconDotsVerticalCircleOutline, { color: TMColors.button_icon }), items: [
832
741
  { icon: showId ? _jsx(IconHide, { color: TMColors.button_icon }) : _jsx(IconShow, { color: TMColors.button_icon }), text: showId ? SDKUI_Localizator.ID_Hide : SDKUI_Localizator.ID_Show, onClick: () => setShowId(!showId) },
833
742
  { icon: showCompleteMetadataName ? _jsx(IconHide, { color: TMColors.primary }) : _jsx(IconShow, { color: TMColors.primary }), text: showCompleteMetadataName ? SDKUI_Localizator.Hide_CompleteName : SDKUI_Localizator.Show_CompleteName, onClick: () => setShowCompleteMetadataName(!showCompleteMetadataName) }
834
743
  ] }) }), _jsx(TMDcmtTypeChooser, { disabled: isReadOnly, placeHolder: `<${SDKUI_Localizator.DcmtTypeSelect} ...>`, borderRadius: borderRadius, openEditorOnSummaryClick: true, showBorder: false, showId: showId, backgroundColor: getColorIndex({ tid: formData.from?.tid, alias: undefined }), values: [formData.from?.tid], validationItems: validationItems.filter((o) => o.PropertyName === TMPropertyNames.fromTid), onValueChanged: (tids) => { let qd = SearchEngine.NewQueryDescriptor(); qd.from.tid = tids[0]; setFormData({ ...qd }); onFromTIDChanged?.(tids[0]); } })] }), formData?.join?.map((ji, index) => {
@@ -855,38 +764,48 @@ const TMQueryEditor = ({ formMode, inputData, onlyAdvancedSearchMode = true, isM
855
764
  }
856
765
  ] }), _jsx(TMMetadataChooser, { disabled: isReadOnly, getColorIndex: getColorIndex, showCompleteMetadataName: showCompleteMetadataName, openEditorOnSummaryClick: true, showBorder: false, borderRadius: borderRadius, showId: showId, backgroundColor: getColorIndex({ tid: onItem.leftTID, alias: onItem.leftAlias }), qd: formData, values: onItem.leftTID ? [{ tid: onItem.leftTID, mid: onItem.leftMID, aliasTID: onItem.leftAlias }] : [], onValueChanged: (values) => { values.length > 0 && onChange_OnJoinMetadatoLeft(values[0], index, indexOn); } }), _jsx(TMDropDownMenu, { backgroundColor: colorOperator, color: 'green', borderRadius: borderRadius, content: _jsx(StyledItemWrapper, { children: LocalizeQueryOperators(onItem.operator) }), items: [] }), _jsx(TMMetadataChooser, { disabled: isReadOnly, getColorIndex: getColorIndex, showCompleteMetadataName: showCompleteMetadataName, openEditorOnSummaryClick: true, showBorder: false, borderRadius: borderRadius, showId: showId, backgroundColor: getColorIndex({ tid: onItem.rightTID, alias: onItem.rightAlias }), qd: formData, values: onItem.rightTID ? [{ tid: onItem.rightTID, mid: onItem.rightMID, aliasTID: onItem.rightAlias }] : [], onValueChanged: (values) => { values.length > 0 && onChange_OnJoinMetadatoRight(values[0], index, indexOn); } })] }, indexOn));
857
766
  })] }, `${ji.tid}_${index}`));
858
- }), _jsx(TMVilViewer, { vil: validationItems.filter((o) => o.PropertyName === TMPropertyNames.join) })] }) }) }), fromCount > 0 && (isAdvancedSearch || isEasyModeConfigurable) && (!isReadOnly || selectCount > 0) && _jsx(Item, { title: SDK_Localizator.QuerySelect, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, selectCount, validationItems.filter((o) => o.PropertyName == TMPropertyNames.select)), children: _jsx(StyledAccordionItemContainer, { children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, children: [_jsx(TMVilViewer, { vil: validationItems.filter((o) => o.PropertyName === TMPropertyNames.select) }), (!formData?.select || formData?.select.length <= 0) && !isReadOnly &&
767
+ }), _jsx(TMVilViewer, { vil: validationItems.filter((o) => o.PropertyName === TMPropertyNames.join) })] }) }) }), fromCount > 0 && (!isReadOnly || selectCount > 0) && _jsx(Item, { title: SDK_Localizator.QuerySelect, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, selectCount, validationItems.filter((o) => o.PropertyName == TMPropertyNames.select)), children: _jsx(StyledAccordionItemContainer, { children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, children: [_jsx(TMVilViewer, { vil: validationItems.filter((o) => o.PropertyName === TMPropertyNames.select) }), (!formData?.select || formData?.select.length <= 0) && !isReadOnly &&
859
768
  _jsxs(StyledRowItem, { children: [_jsx(TMButton, { btnStyle: 'normal', disabled: !formData?.from?.tid, caption: SDKUI_Localizator.Add, onClick: onAdd_SelectItem }), dcmtTypesList.length == 1
860
769
  ? _jsx(TMButton, { btnStyle: 'normal', disabled: !formData?.from?.tid, caption: SDKUI_Localizator.AddAlls, onClick: () => { onAddAll_SelectItem(qdTIDs[0]); } })
861
770
  : _jsx(TMDropDownMenu, { backgroundColor: 'white', borderRadius: '3px', content: _jsx(TMButton, { btnStyle: 'normal', disabled: !formData?.from?.tid, caption: SDKUI_Localizator.AddAlls }), items: qdTIDs.map((tid_alias) => ({ text: `${getDisplayAlias(getDcmtTypeName(tid_alias.tid), tid_alias.alias)}`, onClick: () => { onAddAll_SelectItem(tid_alias); } })) })] }), formData?.select?.map((si, index) => {
862
771
  return (_jsxs(StyledRowItem, { onDragEnd: dragEnd, onDragOver: dragOver, onDrop: (e) => dropSelect(e, si), children: [!isReadOnly && _jsx(StyledDraggableDiv, { draggable: true, onDragStart: (e) => dragStart(e, si), children: _jsx(IconDraggabledots, { fontSize: 15, color: TMColors.button_icon }) }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconClear, { color: TMColors.button_icon }), caption: SDKUI_Localizator.Remove, onClick: () => onRemove_SelectItem(index) }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconAddCircleOutline, { color: TMColors.button_icon }), caption: SDKUI_Localizator.AddBelow, onClick: () => onAdd_SelectItem(index + 1) }), !isReadOnly && _jsx(TMDropDownMenu, { content: _jsx(TMTooltip, { content: SDK_Localizator.toCaseWord(SDKUI_Localizator.OneMore), children: _jsx(IconDotsVerticalCircleOutline, { color: TMColors.button_icon }) }), items: getSelectMenuItems(index) }), (!isReadOnly || (si.function && si.function != QueryFunctions.None)) && _jsx(TMDropDownMenu, { backgroundColor: colorOperator, color: 'green', borderRadius: borderRadius, content: _jsx(StyledItemWrapper, { children: si.function === QueryFunctions.None ? "..." : LocalizeQueryFunctions(si.function) }), items: getQueryFunctionsMenuItems(si, index) }), _jsx(TMMetadataChooser, { disabled: isReadOnly, getColorIndex: getColorIndex, showCompleteMetadataName: showCompleteMetadataName, openEditorOnSummaryClick: true, showBorder: false, borderRadius: borderRadius, showId: showId, backgroundColor: getColorIndex({ tid: si.tid, alias: si.alias }), qd: formData, values: [{ tid: si.tid, mid: si.mid, aliasTID: si.alias }], onValueChanged: (values) => { values.length > 0 && onChange_SelectItem_MID(values[0], index); } }), (!isReadOnly || si.as) && _jsx(TMQdEditableItem, { value: si.as, backgroundColor: colorValue, placeHolder: `<${SDKUI_Localizator.Query_EnterAlias}...>`, width: '100%', onValueChanged: (value) => { onChange_SelectItem_As(value, index); } })] }, `${si.tid}_${si.mid}_${index}`));
863
- })] }) }) }), fromCount > 0 && (!isReadOnly || whereCount > 0) && _jsx(Item, { title: SDK_Localizator.QueryWhere, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, whereCount, validationItems.filter((o) => o.PropertyName == TMPropertyNames.where)), children: isAdvancedSearch
864
- ?
865
- _jsx(StyledAccordionItemContainer, { children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, children: [_jsx(TMVilViewer, { vil: validationItems.filter((o) => o.PropertyName === TMPropertyNames.where) }), (!formData?.where || formData?.where.length <= 0) && !isReadOnly &&
866
- _jsx(StyledRowItem, { children: _jsx(TMButton, { btnStyle: 'normal', disabled: !formData?.from?.tid, caption: SDKUI_Localizator.Add, onClick: onAdd_WhereItem }) }), formData?.where?.map((wi, index) => {
867
- return (_jsxs(StyledRowItem, { onDragEnd: dragEnd, onDragOver: dragOver, onDrop: (e) => dropWhere(e, wi), children: [!isReadOnly && _jsx(StyledDraggableDiv, { draggable: true, onDragStart: (e) => dragStart(e, wi), children: _jsx(IconDraggabledots, { fontSize: 15, color: TMColors.button_icon }) }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconClear, { color: TMColors.button_icon }), caption: SDKUI_Localizator.Remove, onClick: () => onRemove_WhereItem(index) }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconAddCircleOutline, { color: TMColors.button_icon }), caption: SDKUI_Localizator.AddBelow, onClick: () => onAdd_WhereItem(index + 1) }), !isReadOnly && _jsx(TMDropDownMenu, { content: _jsx(TMTooltip, { content: SDK_Localizator.toCaseWord(SDKUI_Localizator.OneMore), children: _jsx(IconDotsVerticalCircleOutline, { color: TMColors.button_icon }) }), items: [
868
- { text: SDKUI_Localizator.AddAbove, onClick: () => onAdd_WhereItem(index) },
869
- { text: SDKUI_Localizator.AddBelow, onClick: () => onAdd_WhereItem(index + 1) },
870
- { text: SDKUI_Localizator.Remove, onClick: () => onRemove_WhereItem(index) },
871
- { text: SDKUI_Localizator.RemoveAll, onClick: () => setFormData({ ...formData, where: undefined }) },
872
- {
873
- text: "Imposta parametro", items: [
874
- { text: "{@UserName}", onClick: () => onChange_WhereItem_Values("{@UserName}", undefined, index) },
875
- { text: "{@UserID}", onClick: () => onChange_WhereItem_Values("{@UserID}", undefined, index) },
876
- { text: "{@QueryParam...N}", onClick: () => onChange_WhereItem_Values(calcQueryParamN(), undefined, index) }
877
- ]
878
- },
879
- ] }), _jsx(TMDropDownMenu, { disabled: index == 0, color: 'green', content: _jsx("div", { style: { fontSize: '1rem' }, children: wi.or ? 'OR' : 'AND' }), items: [
880
- { text: 'AND', onClick: () => onChange_WhereItem_Or(false, index) },
881
- { text: 'OR', onClick: () => onChange_WhereItem_Or(true, index) }
882
- ] }), _jsx(TMQdEditableItem, { value: wi.leftBrackets, backgroundColor: colorBrackets, onValueChanged: (value) => { onChange_WhereItem_Brackets(value, true, index); } }), _jsx(TMMetadataChooser, { disabled: isReadOnly, getColorIndex: getColorIndex, showCompleteMetadataName: showCompleteMetadataName, openEditorOnSummaryClick: true, showBorder: false, borderRadius: borderRadius, showId: showId, backgroundColor: getColorIndex({ tid: wi.tid, alias: wi.alias }), qd: formData, values: [{ tid: wi.tid, mid: wi.mid, aliasTID: wi.alias }], onValueChanged: (values) => { values.length > 0 && onChange_WhereItem_Metadato(values[0], index); } }), _jsx(TMDropDownMenu, { backgroundColor: colorOperator, color: 'green', borderRadius: borderRadius, content: _jsx(StyledDivHorizontal, { children: _jsx(StyledItemWrapper, { children: LocalizeQueryOperators(wi.operator) }) }), items: getQueryOperatorsMenuItems(wi, index) }), _jsx(TMQdWhereItemValue, { whereItem: wi, index: index, onValueChanged: (values) => { onChange_WhereItem_Values(values[0], values[1], index); } }), _jsx(TMQdEditableItem, { value: wi.rightBrackets, backgroundColor: colorBrackets, onValueChanged: (value) => { onChange_WhereItem_Brackets(value, false, index); } })] }, `${wi.tid}_${wi.mid}_${index}`));
883
- })] }) })
884
- :
885
- _jsx("div", { style: { display: 'grid', alignItems: 'center', overflow: 'auto', height: '100%', paddingRight: '5px', gridTemplateColumns: 'minmax(0, max-content) minmax(0, max-content) minmax(0, max-content) minmax(50%, 1fr) minmax(0, max-content)' }, children: formData?.where?.map((wi, index) => {
886
- return (_jsxs(Fragment, { children: [_jsxs("div", { style: { gridColumn: 1, display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsx("div", { children: PlatformObjectValidator.WhereItemHasValues(wi) && _jsx(IconSuccessCirlce, { fontSize: 18, color: 'green' }) }), isEasyModeConfigurable && _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconClear, { color: TMColors.button_icon }), caption: SDKUI_Localizator.Remove, onClick: () => onRemove_WhereItem(index) }), isEasyModeConfigurable && _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconAddCircleOutline, { color: TMColors.button_icon }), caption: SDKUI_Localizator.AddBelow, onClick: () => onAdd_WhereItem(index + 1) })] }), _jsx("div", { style: { gridColumn: 2, display: 'flex', paddingLeft: '4px', paddingRight: '4px', height: '24px', borderRadius: borderRadius, fontSize: '1rem' }, children: _jsx(TMMetadataChooser, { width: '100%', disabled: !isEasyModeConfigurable, showCompleteMetadataName: showCompleteMetadataName, openEditorOnSummaryClick: true, showBorder: false, showId: showId, qd: formData, values: [{ tid: wi.tid, mid: wi.mid, aliasTID: wi.alias }], onValueChanged: (values) => { values.length > 0 && onChange_WhereItem_Metadato(values[0], index); } }) }), _jsx("div", { style: { gridColumn: 3 }, children: _jsx(TMDropDownMenu, { backgroundColor: colorOperator, color: 'green', borderRadius: borderRadius, content: _jsx(StyledDivHorizontal, { children: _jsx(StyledItemWrapper, { children: LocalizeQueryOperators(wi.operator) }) }), items: getQueryOperatorsMenuItems(wi, index) }) }), _jsx("div", { style: { gridColumn: 4, paddingLeft: '4px' }, children: _jsx(TMQdWhereItemValue, { onlyEditing: true, whereItem: wi, index: index, onValueChanged: (values) => {
887
- onChange_WhereItem_Values(values[0], values[1], index);
888
- } }) }), !isEasyModeConfigurable && _jsx("div", { style: { gridColumn: 5, display: 'flex', alignItems: 'center' }, children: renderButtonSort({ tid: wi.tid, mid: wi.mid, aliasTID: wi.alias }) })] }, `${wi.tid}_${wi.mid}_${index}`));
889
- }) }) }), fromCount > 0 && (isAdvancedSearch || isEasyModeConfigurable) && (!isReadOnly || orderByCount > 0) && _jsx(Item, { title: SDK_Localizator.QueryOrderBy, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, orderByCount, validationItems.filter((o) => o.PropertyName == TMPropertyNames.orderBy)), children: _jsx(StyledAccordionItemContainer, { children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, children: [(!formData?.orderBy || formData?.orderBy.length <= 0) && !isReadOnly &&
772
+ })] }) }) }), fromCount > 0 && (!isReadOnly || whereCount > 0) && _jsx(Item, { title: SDK_Localizator.QueryWhere, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, whereCount, validationItems.filter((o) => o.PropertyName == TMPropertyNames.where)), children: _jsx(StyledAccordionItemContainer, { children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, children: [_jsx(TMVilViewer, { vil: validationItems.filter((o) => o.PropertyName === TMPropertyNames.where) }), (!formData?.where || formData?.where.length <= 0) && !isReadOnly &&
773
+ _jsx(StyledRowItem, { children: _jsx(TMButton, { btnStyle: 'normal', disabled: !formData?.from?.tid, caption: SDKUI_Localizator.Add, onClick: onAdd_WhereItem }) }), formData?.where?.map((wi, index) => {
774
+ return (_jsxs(StyledRowItem, { onDragEnd: dragEnd, onDragOver: dragOver, onDrop: (e) => dropWhere(e, wi), children: [!isReadOnly && _jsx(StyledDraggableDiv, { draggable: true, onDragStart: (e) => dragStart(e, wi), children: _jsx(IconDraggabledots, { fontSize: 15, color: TMColors.button_icon }) }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconClear, { color: TMColors.button_icon }), caption: SDKUI_Localizator.Remove, onClick: () => onRemove_WhereItem(index) }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconAddCircleOutline, { color: TMColors.button_icon }), caption: SDKUI_Localizator.AddBelow, onClick: () => onAdd_WhereItem(index + 1) }), !isReadOnly && _jsx(TMDropDownMenu, { content: _jsx(TMTooltip, { content: SDK_Localizator.toCaseWord(SDKUI_Localizator.OneMore), children: _jsx(IconDotsVerticalCircleOutline, { color: TMColors.button_icon }) }), items: [
775
+ { text: SDKUI_Localizator.AddAbove, onClick: () => onAdd_WhereItem(index) },
776
+ { text: SDKUI_Localizator.AddBelow, onClick: () => onAdd_WhereItem(index + 1) },
777
+ { text: SDKUI_Localizator.Remove, onClick: () => onRemove_WhereItem(index) },
778
+ { text: SDKUI_Localizator.RemoveAll, onClick: () => setFormData({ ...formData, where: undefined }) },
779
+ {
780
+ text: "Imposta parametro", items: [
781
+ { text: "{@UserName}", onClick: () => onChange_WhereItem_Values("{@UserName}", undefined, index) },
782
+ { text: "{@UserID}", onClick: () => onChange_WhereItem_Values("{@UserID}", undefined, index) },
783
+ { text: "{@QueryParam...N}", onClick: () => onChange_WhereItem_Values(calcQueryParamN(), undefined, index) }
784
+ ]
785
+ },
786
+ ] }), _jsx(TMDropDownMenu, { disabled: index == 0, color: 'green', content: _jsx("div", { style: { fontSize: '1rem' }, children: wi.or ? 'OR' : 'AND' }), items: [
787
+ { text: 'AND', onClick: () => onChange_WhereItem_Or(false, index) },
788
+ { text: 'OR', onClick: () => onChange_WhereItem_Or(true, index) }
789
+ ] }), _jsx(TMQdEditableItem, { value: wi.leftBrackets, backgroundColor: colorBrackets, onValueChanged: (value) => { onChange_WhereItem_Brackets(value, true, index); } }), _jsx(TMMetadataChooser, { disabled: isReadOnly, getColorIndex: getColorIndex, showCompleteMetadataName: showCompleteMetadataName, openEditorOnSummaryClick: true, showBorder: false, borderRadius: borderRadius, showId: showId, backgroundColor: getColorIndex({ tid: wi.tid, alias: wi.alias }), qd: formData, values: [{ tid: wi.tid, mid: wi.mid, aliasTID: wi.alias }], onValueChanged: (values) => { values.length > 0 && onChange_WhereItem_Metadato(values[0], index); } }), _jsx(TMDropDownMenu, { backgroundColor: colorOperator, color: 'green', borderRadius: borderRadius, content: _jsx(StyledDivHorizontal, { children: _jsx(StyledItemWrapper, { children: LocalizeQueryOperators(wi.operator) }) }), items: getQueryOperatorsMenuItems(wi, index) }), _jsx(TMQdWhereItemValue, { whereItem: wi, index: index, queryParamsDynDataList: dynDataListsToBeRefreshed.find(o => o.mid == wi.mid)?.queryParams ?? [], onCascadeRefreshDynDataLists: (ddlToBeRefreshed) => {
790
+ let newDynDataListsToBeRefreshed = [];
791
+ for (const item of dynDataListsToBeRefreshed) {
792
+ let index = ddlToBeRefreshed.findIndex(o => o.mid == item.mid || (o.mid == -1 && o.midStarter == item.midStarter));
793
+ if (index >= 0)
794
+ continue;
795
+ newDynDataListsToBeRefreshed.push(item);
796
+ }
797
+ for (const item of ddlToBeRefreshed) {
798
+ if (item.queryParams.length <= 0)
799
+ continue;
800
+ if (!item.mid)
801
+ continue;
802
+ if (item.mid <= 0)
803
+ continue;
804
+ newDynDataListsToBeRefreshed.push(item);
805
+ }
806
+ setDynDataListsToBeRefreshed(newDynDataListsToBeRefreshed);
807
+ }, onValueChanged: (values) => { onChange_WhereItem_Values(values[0], values[1], index); } }), _jsx(TMQdEditableItem, { value: wi.rightBrackets, backgroundColor: colorBrackets, onValueChanged: (value) => { onChange_WhereItem_Brackets(value, false, index); } })] }, `${wi.tid}_${wi.mid}_${index}`));
808
+ })] }) }) }), fromCount > 0 && (!isReadOnly || orderByCount > 0) && _jsx(Item, { title: SDK_Localizator.QueryOrderBy, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, orderByCount, validationItems.filter((o) => o.PropertyName == TMPropertyNames.orderBy)), children: _jsx(StyledAccordionItemContainer, { children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, children: [(!formData?.orderBy || formData?.orderBy.length <= 0) && !isReadOnly &&
890
809
  _jsx(StyledRowItem, { children: _jsx(TMButton, { btnStyle: 'normal', disabled: !formData?.from?.tid, caption: SDKUI_Localizator.Add, onClick: onAdd_OrderByItem }) }), formData?.orderBy?.map((oi, index) => {
891
810
  return (_jsxs(StyledRowItem, { onDragEnd: dragEnd, onDragOver: dragOver, onDrop: (e) => dropOrderBy(e, oi), children: [!isReadOnly && _jsx(StyledDraggableDiv, { draggable: true, onDragStart: (e) => dragStart(e, oi), children: _jsx(IconDraggabledots, { fontSize: 15, color: TMColors.button_icon }) }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconClear, { color: TMColors.button_icon }), caption: SDKUI_Localizator.Remove, onClick: () => onRemove_OrderByItem(index) }), !isReadOnly && _jsx(TMButton, { btnStyle: 'icon', padding: '3px 0px', icon: _jsx(IconAddCircleOutline, { color: TMColors.button_icon }), caption: SDKUI_Localizator.AddBelow, onClick: () => onAdd_OrderByItem(index + 1) }), !isReadOnly && _jsx(TMDropDownMenu, { content: _jsx(TMTooltip, { content: SDK_Localizator.toCaseWord(SDKUI_Localizator.OneMore), children: _jsx(IconDotsVerticalCircleOutline, { color: TMColors.button_icon }) }), items: [
892
811
  { text: SDKUI_Localizator.AddAbove, onClick: () => onAdd_OrderByItem(index) },
@@ -897,10 +816,18 @@ const TMQueryEditor = ({ formMode, inputData, onlyAdvancedSearchMode = true, isM
897
816
  { text: 'ASC', onClick: () => onChange_OrderByItem_Asc(true, oi, index) },
898
817
  { text: 'DESC', onClick: () => onChange_OrderByItem_Asc(false, oi, index) }
899
818
  ] })] }, `${oi.tid}_${oi.mid}_${index}`));
900
- })] }) }) }), fromCount > 0 && isAdvancedSearch && _jsx(Item, { title: SDKUI_Localizator.Options, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, undefined, []), children: _jsx(StyledAccordionItemContainer, { children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, children: [showDistinct && _jsx(TMCheckBox, { label: SDK_Localizator.QueryDistinct, value: formData.isDistinct, onValueChanged: () => { setFormData({ ...formData, isDistinct: !formData.isDistinct }); } }), _jsx(TMTextBox, { type: 'number', width: '200px', label: SDKUI_Localizator.MaxDcmtsToBeReturned, validationItems: validationItems.filter((o) => o.PropertyName == TMPropertyNames.maxDcmtsToBeReturned), value: formData.maxDcmtsToBeReturned, onBlur: (newValue) => setFormData({ ...formData, maxDcmtsToBeReturned: Number(newValue) }) })] }) }) })] }) }), showResultSearch && _jsxs(StyledModalContainer, { children: [" ", renderResultSearchForm(), " "] })] }));
819
+ })] }) }) }), fromCount > 0 && _jsx(Item, { title: SDKUI_Localizator.Options, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, undefined, []), children: _jsx(StyledAccordionItemContainer, { children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, children: [showDistinct && _jsx(TMCheckBox, { label: SDK_Localizator.QueryDistinct, value: formData.isDistinct, onValueChanged: () => { setFormData({ ...formData, isDistinct: !formData.isDistinct }); } }), _jsx(TMTextBox, { type: 'number', width: '200px', label: SDKUI_Localizator.MaxDcmtsToBeReturned, validationItems: validationItems.filter((o) => o.PropertyName == TMPropertyNames.maxDcmtsToBeReturned), value: formData.maxDcmtsToBeReturned, onBlur: (newValue) => setFormData({ ...formData, maxDcmtsToBeReturned: Number(newValue) }) })] }) }) })] }) }), showResultSearch && _jsxs(StyledModalContainer, { children: [" ", renderResultSearchForm, " "] })] }));
901
820
  };
902
821
  export default TMQueryEditor;
903
- const TMQdWhereItemValue = ({ whereItem, index, onlyEditing = false, onValueChanged }) => {
822
+ const TMQdEditableItem = ({ value, placeHolder, width, backgroundColor, onValueChanged }) => {
823
+ const [isComponentVisible, setIsComponentVisible] = useState(false);
824
+ const ref = useOutsideClick(() => { setIsComponentVisible(false); });
825
+ return (_jsx("div", { ref: ref, children: isComponentVisible ?
826
+ _jsx(TMTextBox, { elementStyle: { marginLeft: '5px', marginRight: '5px' }, width: width ?? '50px', autoFocus: true, value: value ?? '', onBlur: (newValue) => onValueChanged(newValue) })
827
+ :
828
+ _jsx(StyledItemWrapper, { onClick: () => setIsComponentVisible(true), style: { backgroundColor: backgroundColor, cursor: 'pointer' }, children: value ?? placeHolder }) }));
829
+ };
830
+ const TMQdWhereItemValue = ({ whereItem, index, queryParamsDynDataList, onlyEditing = false, onValueChanged, onCascadeRefreshDynDataLists }) => {
904
831
  let EditingModes;
905
832
  (function (EditingModes) {
906
833
  EditingModes[EditingModes["None"] = 0] = "None";
@@ -914,6 +841,9 @@ const TMQdWhereItemValue = ({ whereItem, index, onlyEditing = false, onValueChan
914
841
  const [editingMode, setEditingMode] = useState(EditingModes.Editing);
915
842
  const [showDataListChooseForm, setShowDataListChooseForm] = useState(false);
916
843
  const [dataList, setDataList] = useState();
844
+ const [showDynDataListChooseForm, setShowDynDataListChooseForm] = useState(false);
845
+ const [dynDl, setDynDl] = useState();
846
+ const [dataSource, setDataSource] = useState();
917
847
  const [showUserChooseForm, setShowUserChooseForm] = useState(false);
918
848
  const [users, setUsers] = useState();
919
849
  const [containerElement, setContainerElement] = useState();
@@ -963,6 +893,20 @@ const TMQdWhereItemValue = ({ whereItem, index, onlyEditing = false, onValueChan
963
893
  setDataList(dataList);
964
894
  });
965
895
  break;
896
+ case MetadataDataDomains.DynamicDataList:
897
+ setEditingMode(EditingModes.Chooser);
898
+ if (dynDl != undefined)
899
+ return;
900
+ TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${"Lista dati dinamica"} ...` });
901
+ let d = mdOut?.dynDL_Cfgs?.[0];
902
+ if (mdOut?.dynDL_IsMultiCfg == 1)
903
+ d = mdOut?.dynDL_Cfgs?.[1];
904
+ setDynDl(d);
905
+ mdOut?.id && SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(whereItem.tid, mdOut?.id, LayoutModes.None, queryParamsDynDataList ?? []).then((result) => {
906
+ TMSpinner.hide();
907
+ setDataSource(result);
908
+ }).catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
909
+ break;
966
910
  case MetadataDataDomains.UserID:
967
911
  setEditingMode(EditingModes.Chooser);
968
912
  if (users !== undefined)
@@ -981,6 +925,17 @@ const TMQdWhereItemValue = ({ whereItem, index, onlyEditing = false, onValueChan
981
925
  setCurrentValue1(whereItem.value1);
982
926
  setCurrentValue2(whereItem.value2);
983
927
  }, [whereItem]);
928
+ useEffect(() => {
929
+ if (!IsParametricQuery(dynDl?.qd))
930
+ return;
931
+ if ((queryParamsDynDataList?.length ?? 0) <= 0) {
932
+ setDataSource(undefined);
933
+ return;
934
+ }
935
+ SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(whereItem.tid, whereItem.mid, LayoutModes.None, queryParamsDynDataList ?? []).then((result) => {
936
+ setDataSource(result);
937
+ }).catch((err) => { TMExceptionBoxManager.show({ exception: err }); });
938
+ }, [queryParamsDynDataList]);
984
939
  const getMetadata = async () => {
985
940
  let dtd = await DcmtTypeListCacheService.GetAsync(whereItem.tid, true);
986
941
  return dtd?.metadata?.find(o => o.id === whereItem.mid);
@@ -1005,40 +960,96 @@ const TMQdWhereItemValue = ({ whereItem, index, onlyEditing = false, onValueChan
1005
960
  case MetadataDataDomains.DataList:
1006
961
  setShowDataListChooseForm(true);
1007
962
  break;
963
+ case MetadataDataDomains.DynamicDataList:
964
+ setShowDynDataListChooseForm(true);
965
+ break;
1008
966
  case MetadataDataDomains.UserID:
1009
967
  setShowUserChooseForm(true);
1010
968
  break;
1011
969
  }
1012
970
  };
971
+ const mdValueEmptyDescr = `<${SDKUI_Localizator.Search_EnterValue}...>`;
1013
972
  return (_jsxs("div", { ref: ref, id: containerId, style: { width: isEditing && whereItem.operator == QueryOperators.Custom && !onlyEditing ? "100%" : undefined }, children: [(isEditing || onlyEditing) &&
1014
- _jsxs(StyledRowItem, { children: [showValue1 && _jsx(TMQdWhereItemValueEditor, { value: whereItem.value1, autoFocus: !onlyEditing, dataType: md?.dataType, containerElement: containerElement, numberOfOperands: numberOfOperands, onValueChange: (value) => setCurrentValue1(value), onValueChanged: (value) => { normalizeValue(value, true); } }), showValue2 && _jsx(TMQdWhereItemValueEditor, { value: whereItem.value2, autoFocus: !onlyEditing, dataType: md?.dataType, containerElement: containerElement, numberOfOperands: numberOfOperands, onValueChange: (value) => setCurrentValue2(value), onValueChanged: (value) => { normalizeValue(value, false); } })] }), !isEditing && !onlyEditing && (showValue1 || showValue2) &&
973
+ _jsxs(StyledRowItem, { children: [showValue1 && _jsx(TMQdWhereItemValueEditor, { tid: whereItem.tid, value: whereItem.value1, allowMultipleSelection: whereItem.operator == QueryOperators.In || whereItem.operator == QueryOperators.NotIn, autoFocus: !onlyEditing, md: md, containerElement: containerElement, numberOfOperands: numberOfOperands, onValueChange: (value) => setCurrentValue1(value), onValueChanged: (value) => { normalizeValue(value, true); } }), showValue2 && _jsx(TMQdWhereItemValueEditor, { tid: whereItem.tid, value: whereItem.value2, allowMultipleSelection: whereItem.operator == QueryOperators.In || whereItem.operator == QueryOperators.NotIn, autoFocus: !onlyEditing, md: md, containerElement: containerElement, numberOfOperands: numberOfOperands, onValueChange: (value) => setCurrentValue2(value), onValueChanged: (value) => { normalizeValue(value, false); } })] }), !isEditing && !onlyEditing && (showValue1 || showValue2) &&
1015
974
  _jsxs(StyledDivHorizontal, { children: [editingMode == EditingModes.Chooser &&
1016
975
  _jsxs(_Fragment, { children: [showDataListChooseForm &&
1017
- _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); } }), showUserChooseForm &&
976
+ _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 &&
977
+ _jsx(TMDynDataListItemChooserForm, { TID: whereItem.tid, MID: md?.id, height: '500px', width: '450px', dynDL: dynDl, allowMultipleSelection: false, searchResult: dataSource, selectedIDs: [whereItem.value1], onClose: () => setShowDynDataListChooseForm(false), onChoose: (IDs) => {
978
+ IDs && normalizeValue(IDs.length == 1 ? IDs[0] : IDs.map((item) => `${item}`).join(","), true);
979
+ if (!dynDl)
980
+ return;
981
+ if (!dynDl.onValueChanged_DynDataListsToBeRefreshed)
982
+ return;
983
+ let row = dataSource?.dtdResult?.rows?.filter(o => o[dynDl.selectItemForValue ?? 0] == IDs?.[0]);
984
+ if (!row)
985
+ return;
986
+ let toBeRefreshed = [];
987
+ for (const t of dynDl.onValueChanged_DynDataListsToBeRefreshed) {
988
+ let mid = t.item1;
989
+ let queryParams = [];
990
+ if ((t.item2 ?? 0) >= 0)
991
+ queryParams.push(row[0][t.item2 ?? 0]);
992
+ if ((t.item3 ?? 0) >= 0)
993
+ queryParams.push(row[0][t.item3 ?? 0]);
994
+ if ((t.item4 ?? 0) >= 0)
995
+ queryParams.push(row[0][t.item4 ?? 0]);
996
+ if ((t.item5 ?? 0) >= 0)
997
+ queryParams.push(row[0][t.item5 ?? 0]);
998
+ toBeRefreshed.push({ mid: mid, queryParams: queryParams, midStarter: md?.id });
999
+ }
1000
+ onCascadeRefreshDynDataLists?.(toBeRefreshed);
1001
+ // // onCascade
1002
+ // let newDynDataListsToBeRefreshed = [];
1003
+ // for (const item of dynDataListsToBeRefreshed) {
1004
+ // let index = toBeRefreshed.findIndex(o => o.mid == item.mid || (o.mid == -1 && o.midStarter == item.midStarter));
1005
+ // if (index >= 0) continue;
1006
+ // newDynDataListsToBeRefreshed.push(item);
1007
+ // }
1008
+ // for (const item of toBeRefreshed) {
1009
+ // if (item.queryParams.length <= 0) continue;
1010
+ // if (!item.mid) continue;
1011
+ // if (item.mid <= 0) continue;
1012
+ // newDynDataListsToBeRefreshed.push(item);
1013
+ // }
1014
+ // setDynDataListsToBeRefreshed(newDynDataListsToBeRefreshed);
1015
+ } }), showUserChooseForm &&
1018
1016
  _jsx(TMUserChooserForm, { height: '550px', width: '600px', allowMultipleSelection: whereItem.operator == QueryOperators.In || whereItem.operator == QueryOperators.NotIn, dataSource: users, selectedIDs: whereItem.value1?.split(',').map((item) => !item.startsWith("'") ? Number(item) : Number(item.slice(1, -1))) ?? [], onClose: () => setShowUserChooseForm(false), onChoose: (IDs) => { IDs && normalizeValue(IDs.length == 1 ? IDs[0].toString() : IDs.map((item) => item).join(","), true); } })] }), _jsx(StyledItemWrapper, { onClick: () => { (editingMode == EditingModes.Editing) ? setIsEditing(true) : chooseValue(); }, style: { backgroundColor: colorValue, cursor: 'pointer', width: '100%' }, children: numberOfOperands == 11 || numberOfOperands == 12 || numberOfOperands == 99
1019
- ? _jsx(_Fragment, { children: whereItem.value1 ?? `<${SDKUI_Localizator.Search_EnterValue}...>` })
1020
- : _jsxs(_Fragment, { children: [displayMetadataValue(md, whereItem.value1, `<${SDKUI_Localizator.Search_EnterValue}...>`), numberOfOperands == 2 && (whereItem.value2 && whereItem.value2 != '' ? ` - ${displayMetadataValue(md, whereItem.value2, `<${SDKUI_Localizator.Search_EnterValue}...>`)}` : ' - ?')] }) })] })] }));
1017
+ ? _jsx(_Fragment, { children: whereItem.value1 ?? mdValueEmptyDescr })
1018
+ : _jsxs(_Fragment, { children: [displayMetadataValue(md, whereItem.value1, mdValueEmptyDescr), numberOfOperands == 2 && (whereItem.value2 && whereItem.value2 != '' ? ` - ${displayMetadataValue(md, whereItem.value2, mdValueEmptyDescr)}` : ' - ?')] }) })] })] }));
1021
1019
  };
1022
- const TMQdEditableItem = ({ value, placeHolder, width, backgroundColor, onValueChanged }) => {
1023
- const [isComponentVisible, setIsComponentVisible] = useState(false);
1024
- const ref = useOutsideClick(() => { setIsComponentVisible(false); });
1025
- return (_jsx("div", { ref: ref, children: isComponentVisible ?
1026
- _jsx(TMTextBox, { elementStyle: { marginLeft: '5px', marginRight: '5px' }, width: width ?? '50px', autoFocus: true, value: value ?? '', onBlur: (newValue) => onValueChanged(newValue) })
1027
- :
1028
- _jsx(StyledItemWrapper, { onClick: () => setIsComponentVisible(true), style: { backgroundColor: backgroundColor, cursor: 'pointer' }, children: value ?? placeHolder }) }));
1029
- };
1030
- const TMQdWhereItemValueEditor = ({ value, containerElement, autoFocus, numberOfOperands, dataType, onValueChanged, onValueChange }) => {
1020
+ export const TMQdWhereItemValueEditor = ({ tid, value, queryParamsDynDataList, containerElement, allowMultipleSelection, autoFocus, numberOfOperands, md, onValueChanged, onValueChange, onCascadeRefreshDynDataLists }) => {
1031
1021
  if (value?.startsWith("{@QueryParam") || value == "{@UserName}" || value == "{@UserID}")
1032
- return _jsx(TMTextBox, { elementStyle: { width: '100%' }, type: 'text', autoFocus: autoFocus, value: value || '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
1022
+ return _jsx(TMTextBox, { elementStyle: { width: '100%' }, type: 'text', maxLength: md?.length, autoFocus: autoFocus, value: value || '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
1023
+ if (md?.dataDomain == MetadataDataDomains.DynamicDataList)
1024
+ return _jsx(TMDynDataListItemChooser, { md: md, tid: tid, queryParamsDynDataList: queryParamsDynDataList, onCascadeRefreshDynDataLists: onCascadeRefreshDynDataLists, elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, allowMultipleSelection: allowMultipleSelection, values: value ? [value] : [], hasClear: false, onValueChanged: (IDs) => {
1025
+ if (!IDs || IDs.length <= 0)
1026
+ onValueChanged?.(undefined);
1027
+ else
1028
+ onValueChanged?.(IDs[0]);
1029
+ } });
1030
+ if (md?.dataDomain == MetadataDataDomains.DataList)
1031
+ return _jsx(TMDataListItemChooser, { elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, dataListId: md.dataListID, allowMultipleSelection: allowMultipleSelection, values: value?.split(',').map((item) => !item.startsWith("'") ? item : item.slice(1, -1)) ?? [], hasClear: false, onValueChanged: (IDs) => {
1032
+ if (!IDs || IDs.length <= 0)
1033
+ onValueChanged?.(undefined);
1034
+ else
1035
+ onValueChanged?.(IDs.join(","));
1036
+ } });
1037
+ if (md?.dataDomain == MetadataDataDomains.UserID)
1038
+ return _jsx(TMUserChooser, { elementStyle: { width: '100%' }, backgroundColor: TMColors.default_background, placeHolder: " ", hasClear: true, allowMultipleSelection: allowMultipleSelection, values: value?.split(',').map((item) => !item.startsWith("'") ? Number(item) : Number(item.slice(1, -1))) ?? [], onValueChanged: (IDs) => {
1039
+ if (!IDs || IDs.length <= 0)
1040
+ onValueChanged?.(undefined);
1041
+ else
1042
+ onValueChanged?.(IDs.join(","));
1043
+ } });
1033
1044
  switch (numberOfOperands) {
1034
1045
  case 11:
1035
- case 99: return _jsx(TMTextBox, { elementStyle: { width: '100%' }, type: 'text', autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
1036
- case 12: return _jsx(TMTextBox, { elementStyle: { width: '100%' }, type: 'number', autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
1046
+ case 99: return _jsx(TMTextBox, { elementStyle: { width: '100%' }, type: 'text', maxLength: md?.length, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
1047
+ case 12: return _jsx(TMTextBox, { elementStyle: { width: '100%' }, type: 'number', precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
1037
1048
  default:
1038
- switch (dataType) {
1039
- case MetadataDataTypes.DateTime: return _jsx(TMDateBox, { width: '100%', value: value, useDateSerializationFormat: true, containerElement: containerElement, onValueChange: (newValue) => { onValueChange?.(newValue.toString()); onValueChanged?.(newValue); } });
1040
- case MetadataDataTypes.Number: return _jsx(TMTextBox, { elementStyle: { width: '100%' }, type: 'number', autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
1041
- default: return _jsx(TMTextBox, { type: 'text', elementStyle: { width: '100%' }, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => { onValueChanged?.(newValue); } });
1049
+ switch (md?.dataType) {
1050
+ case MetadataDataTypes.DateTime: return _jsx(TMDateBox, { width: '100%', value: value, useDateSerializationFormat: true, containerElement: containerElement, onValueChange: (newValue) => { onValueChange?.(newValue ? newValue.toString() : undefined); onValueChanged?.(newValue ? newValue.toString() : undefined); } });
1051
+ case MetadataDataTypes.Number: return _jsx(TMTextBox, { elementStyle: { width: '100%' }, type: 'number', precision: md?.length, scale: md?.scale, autoFocus: autoFocus, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => onValueChanged?.(newValue) });
1052
+ default: return _jsx(TMTextBox, { type: 'text', elementStyle: { width: '100%' }, autoFocus: autoFocus, maxLength: md?.length, value: value ?? '', onValueChanged: (e) => onValueChange?.(e.target.value), onBlur: (newValue) => { onValueChanged?.(newValue); } });
1042
1053
  }
1043
1054
  }
1044
1055
  };