@topconsultnpm/sdkui-react 6.21.0-dev1.9 → 6.21.0-dev2.10

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.
Files changed (87) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +2 -2
  2. package/lib/components/NewComponents/ContextMenu/styles.d.ts +43 -19
  3. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +1 -1
  4. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +79 -27
  5. package/lib/components/base/Styled.d.ts +76 -40
  6. package/lib/components/base/TMAccordionNew.d.ts +1 -0
  7. package/lib/components/base/TMAccordionNew.js +5 -5
  8. package/lib/components/base/TMAreaManager.js +47 -14
  9. package/lib/components/base/TMFileManagerDataGridView.js +2 -2
  10. package/lib/components/base/TMFileManagerUtils.d.ts +6 -2
  11. package/lib/components/base/TMPanel.js +1 -0
  12. package/lib/components/base/TMTreeView.d.ts +5 -3
  13. package/lib/components/choosers/TMDataListItemChooser.js +56 -2
  14. package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
  15. package/lib/components/choosers/TMDynDataListItemChooser.js +51 -23
  16. package/lib/components/editors/TMDateBox.js +4 -2
  17. package/lib/components/editors/TMDropDown.js +2 -2
  18. package/lib/components/editors/TMEditorStyled.d.ts +42 -10
  19. package/lib/components/editors/TMFormulaEditor.js +15 -3
  20. package/lib/components/editors/TMMetadataEditor.js +4 -3
  21. package/lib/components/editors/TMMetadataValues.js +1 -1
  22. package/lib/components/editors/TMTextArea.d.ts +2 -0
  23. package/lib/components/editors/TMTextArea.js +6 -3
  24. package/lib/components/features/archive/TMArchive.js +1 -1
  25. package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -0
  26. package/lib/components/features/documents/TMDcmtBlog.js +2 -2
  27. package/lib/components/features/documents/TMDcmtForm.js +49 -21
  28. package/lib/components/features/documents/TMDcmtFormActionButtons.js +259 -60
  29. package/lib/components/features/documents/TMDcmtPreview.d.ts +5 -3
  30. package/lib/components/features/documents/TMDragDropOverlay.js +7 -2
  31. package/lib/components/features/documents/TMFileUploader.js +5 -4
  32. package/lib/components/features/documents/TMMasterDetailDcmts.js +25 -51
  33. package/lib/components/features/documents/TMRelationViewer.js +1 -0
  34. package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
  35. package/lib/components/features/search/TMSearch.js +2 -0
  36. package/lib/components/features/search/TMSearchQueryEditor.js +13 -1
  37. package/lib/components/features/search/TMSearchQueryPanel.d.ts +3 -3
  38. package/lib/components/features/search/TMSearchResult.js +15 -2
  39. package/lib/components/features/search/TMViewHistoryDcmt.js +7 -2
  40. package/lib/components/features/workflow/TMWorkflowPopup.js +3 -0
  41. package/lib/components/features/workflow/diagram/DiagramItemForm.js +5 -1
  42. package/lib/components/features/workflow/diagram/WFDiagram.js +7 -1
  43. package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +1 -1
  44. package/lib/components/features/workflow/diagram/xmlParser.js +13 -14
  45. package/lib/components/forms/Login/ChangePasswordInputs.d.ts +1 -1
  46. package/lib/components/forms/Login/TMLoginForm.js +15 -5
  47. package/lib/components/forms/TMChooserForm.js +25 -2
  48. package/lib/components/grids/TMBlogAttachments.d.ts +1 -0
  49. package/lib/components/grids/TMBlogAttachments.js +38 -12
  50. package/lib/components/grids/TMBlogsPost.js +8 -2
  51. package/lib/components/grids/TMBlogsPostUtils.js +11 -17
  52. package/lib/components/index.d.ts +1 -0
  53. package/lib/components/index.js +1 -0
  54. package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +5 -2
  55. package/lib/components/pages/TMPage.js +4 -2
  56. package/lib/components/query/TMQueryCountButton.d.ts +11 -0
  57. package/lib/components/query/TMQueryCountButton.js +32 -0
  58. package/lib/components/query/TMQueryEditor.d.ts +10 -6
  59. package/lib/components/query/TMQueryEditor.js +42 -5
  60. package/lib/components/query/TMQuerySummary.js +3 -2
  61. package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -2
  62. package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
  63. package/lib/components/viewers/TMDataListItemViewer.js +2 -2
  64. package/lib/components/viewers/TMTidViewer.js +1 -1
  65. package/lib/helper/GlobalStyles.js +6 -0
  66. package/lib/helper/SDKUI_Globals.d.ts +2 -0
  67. package/lib/helper/SDKUI_Localizator.d.ts +1 -0
  68. package/lib/helper/SDKUI_Localizator.js +10 -0
  69. package/lib/helper/TMPdfViewer.js +143 -86
  70. package/lib/helper/TMUtils.d.ts +4 -9
  71. package/lib/helper/TMUtils.js +12 -74
  72. package/lib/helper/checkinCheckoutManager.d.ts +6 -1
  73. package/lib/helper/checkinCheckoutManager.js +203 -9
  74. package/lib/helper/helpers.js +8 -6
  75. package/lib/hooks/useCheckInOutOperations.d.ts +1 -1
  76. package/lib/hooks/useCheckInOutOperations.js +9 -4
  77. package/lib/hooks/useDcmtOperations.d.ts +1 -0
  78. package/lib/hooks/useDcmtOperations.js +75 -5
  79. package/lib/hooks/useDocumentOperations.js +17 -4
  80. package/lib/hooks/useForm.js +20 -14
  81. package/lib/hooks/useInputDialog.d.ts +2 -0
  82. package/lib/hooks/useInputDialog.js +37 -0
  83. package/lib/hooks/useQueryParametersDialog.js +5 -5
  84. package/lib/services/platform_services.d.ts +1 -1
  85. package/lib/services/platform_services.js +8 -0
  86. package/lib/ts/types.d.ts +1 -0
  87. package/package.json +11 -12
@@ -1,19 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import FileManager, { Column, Details, ItemView, Permissions, Notifications, ContextMenu, Toolbar, Item } from 'devextreme-react/file-manager';
4
- import { FileDescriptor, FileFormats, FileTransferModes, SDK_Localizator, SDK_Globals } from '@topconsultnpm/sdk-ts';
4
+ import { FileDescriptor, FileFormats, FileTransferModes, SDK_Localizator, SDK_Globals, AppModules } from '@topconsultnpm/sdk-ts';
5
5
  import CustomFileSystemProvider from 'devextreme/file_management/custom_provider';
6
6
  import FileSystemError from "devextreme/file_management/error";
7
7
  import Button from "devextreme/ui/button";
8
- import { alert, confirm } from "devextreme/ui/dialog";
8
+ import { alert, custom } from "devextreme/ui/dialog";
9
9
  import { loadMessages } from 'devextreme/localization';
10
- import { Globalization, IconAll, IconCloud, IconFolder, IconFolderForCSS, IconSelected, SDKUI_Localizator, svgToString } from '../../helper';
10
+ import { getFileManagerFolderColor, Globalization, IconAll, IconCloud, IconFolder, IconFolderForCSS, IconSelected, SDKUI_Localizator, svgToString } from '../../helper';
11
11
  import { TMExceptionBoxManager } from './TMPopUp';
12
12
  import ShowAlert from './TMAlert';
13
13
  import { TMLayoutWaitingContainer } from './TMWaitPanel';
14
14
  import TMCounterContainer, { CounterItemKey } from './TMCounterContainer';
15
15
  import { IconPdf, IconTxt, IconXls, IconDocx, IconImage, IconZip, IconXml, IconMp4, IconEmail, IconPpt, IconSigned, IconExe, IconHtml, IconDwg, IconDicom, IconSlddrw } from '../../assets/thumbnails';
16
- import { TMColors } from '../../utils/theme';
17
16
  import styled from 'styled-components';
18
17
  import { renderToStaticMarkup } from 'react-dom/server';
19
18
  export class TMFileSystemItem {
@@ -25,8 +24,10 @@ export class TMFileSystemItem {
25
24
  }
26
25
  }
27
26
  let abortController = new AbortController();
28
- const svgString = encodeURIComponent(renderToStaticMarkup(_jsx(IconFolderForCSS, { fill: "#9fc6e7" })));
29
- const svgDataUrl = `data:image/svg+xml,${svgString}`;
27
+ const generateSvgDataUrl = (color) => {
28
+ const svgString = encodeURIComponent(renderToStaticMarkup(_jsx(IconFolderForCSS, { fill: color })));
29
+ return `data:image/svg+xml,${svgString}`;
30
+ };
30
31
  const StyledFileManagerWrapper = styled.div `
31
32
  .dx-filemanager .dx-treeview-item .dx-icon-folder {
32
33
  display: none !important;
@@ -44,7 +45,7 @@ const StyledFileManagerWrapper = styled.div `
44
45
  width: 20px;
45
46
  height: 20px;
46
47
  transform: translateY(-50%);
47
- background-image: url("${svgDataUrl}");
48
+ background-image: url("${props => generateSvgDataUrl(props.$folderColor)}");
48
49
  background-size: contain;
49
50
  background-repeat: no-repeat;
50
51
  display: inline-block;
@@ -252,8 +253,24 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
252
253
  else {
253
254
  msg = SDKUI_Localizator.FileManager_QuestionAlreadyExistsFiles.replaceParams(resolvesForExistingFiles.length.toString());
254
255
  }
255
- const result = confirm(msg, SDKUI_Localizator.Attention);
256
- result.then((dialogResult) => {
256
+ const confirmDialog = custom({
257
+ title: SDKUI_Localizator.Attention,
258
+ messageHtml: `<div style="padding: 15px; font-size: 1rem; max-width: 500px; word-wrap: break-word; overflow-wrap: break-word;">${msg}</div>`,
259
+ buttons: [
260
+ {
261
+ text: SDKUI_Localizator.Yes ?? "Yes",
262
+ onClick: () => true,
263
+ type: "default",
264
+ stylingMode: "contained"
265
+ },
266
+ {
267
+ text: SDKUI_Localizator.No ?? "No",
268
+ onClick: () => false,
269
+ stylingMode: "outlined"
270
+ }
271
+ ]
272
+ });
273
+ confirmDialog.show().then((dialogResult) => {
257
274
  resolvesForNonExistingFiles.forEach((res) => {
258
275
  res({
259
276
  cancel: false,
@@ -390,7 +407,9 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
390
407
  const deleteItem = async (item) => {
391
408
  const ad = item.dataItem.dataItem;
392
409
  const aid = ad.id;
393
- const subFolder = item.parentPath === ad.name ? '' : item.parentPath.replace(ad.name + '/', '');
410
+ const subFolderOld = item.parentPath === ad.name ? '' : item.parentPath.replace(ad.name + '/', '');
411
+ const subFolder = getSubFolder(item.parentPath, ad.name);
412
+ console.log("Delete item with subfolder: ", subFolder, " old subfolder: ", subFolderOld);
394
413
  const tms = props.tmSession ?? SDK_Globals.tmSession;
395
414
  if (item.isDirectory) {
396
415
  await tms?.NewAreaEngine().DeleteFoldersAsync(aid, subFolder, [item.name]).catch((err) => { throw new FileSystemError(5, item, err.message ?? SDKUI_Localizator.GetFolderDeletionErrorMessage); });
@@ -594,16 +613,29 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
594
613
  throw new FileSystemError(5, undefined, error.message ?? SDKUI_Localizator.Error);
595
614
  }
596
615
  };
616
+ const getSubFolder = (dir, startStr) => {
617
+ //Se devo controllare che inizi per il nome dell'area, se non inizia ritorno la dir così com'è (caso di file aperto da percorso completo)
618
+ if (startStr && !dir.startsWith(startStr)) {
619
+ return dir;
620
+ }
621
+ //In tutti gli altri casi rimuovo la prima cartella del percorso (che corrisponde al nome dell'area) e la restituisco come subfolder
622
+ const parts = dir.split("/");
623
+ console.log(parts);
624
+ let subFolder = parts.slice(1).join("/");
625
+ console.log(subFolder);
626
+ return subFolder;
627
+ };
597
628
  const onCurrentDirectoryChanged = (e) => {
598
629
  setCurrentRoute(e.directory.path);
599
630
  setFocusedFileSystemItem(e.directory);
631
+ console.log("Current directory changed: ", e.directory);
600
632
  if (e.directory.path === '' && e.directory.name === '')
601
633
  return;
602
634
  let ad = e.directory.dataItem.dataItem;
603
635
  if (!ad)
604
636
  return;
605
637
  let aid = ad.id;
606
- let subFolder = e.directory.path.replace(ad.name + '/', '').replace(ad.name, '');
638
+ let subFolder = getSubFolder(e.directory.path);
607
639
  setAreaFolder(getAreaPath(aid, subFolder));
608
640
  e.component.option("fileSystemProvider").getItems(e.directory).then((items) => {
609
641
  setParentDirectoryFileSystemItems(items);
@@ -632,7 +664,7 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
632
664
  };
633
665
  const customizeIcon = useCallback((fileSystemItem) => {
634
666
  if (fileSystemItem.isDirectory) {
635
- return svgToString(_jsx(IconFolder, { fontSize: 20, color: TMColors.iconLight }));
667
+ return svgToString(_jsx(IconFolder, { fontSize: 20, color: getFileManagerFolderColor(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER) }));
636
668
  }
637
669
  else {
638
670
  const fileExtension = fileSystemItem.getFileExtension();
@@ -723,11 +755,12 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
723
755
  alert(`"${e.name}" ${SDKUI_Localizator.FolderExist}`, SDKUI_Localizator.Attention);
724
756
  }
725
757
  };
726
- return (_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsxs(StyledFileManagerWrapper, { style: { width: "100%", height: "100%" }, children: [_jsxs(FileManager, { width: props.width, ref: fileManagerRef, height: `calc(${props.height} - 30px)`, onItemMoving: onItemCopying, onItemCopying: onItemCopying, onFileUploading: onFileUploading, fileSystemProvider: areaProvider, customizeThumbnail: customizeIcon, rootFolderName: SDK_Localizator.Areas, onSelectionChanged: onSelectionChanged, onDirectoryCreating: onDirectoryCreating, onFocusedItemChanged: onFocusedItemChanged, onSelectedFileOpened: onSelectedFileOpened, onContextMenuItemClick: onContextMenuItemClick,
758
+ const folderColor = getFileManagerFolderColor(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER);
759
+ return (_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsxs(StyledFileManagerWrapper, { "$folderColor": folderColor, style: { width: "100%", height: "100%" }, children: [_jsxs(FileManager, { width: props.width, ref: fileManagerRef, height: `calc(${props.height} - 30px)`, onItemMoving: onItemCopying, onItemCopying: onItemCopying, onFileUploading: onFileUploading, fileSystemProvider: areaProvider, customizeThumbnail: customizeIcon, rootFolderName: SDK_Localizator.Areas, onSelectionChanged: onSelectionChanged, onDirectoryCreating: onDirectoryCreating, onFocusedItemChanged: onFocusedItemChanged, onSelectedFileOpened: onSelectedFileOpened, onContextMenuItemClick: onContextMenuItemClick,
727
760
  /* onItemMoved={() => setCounter(counter => counter + 1)}
728
761
  onItemCopied={() => setCounter(counter => counter + 1)}
729
762
  onItemDeleted={() => setCounter(counter => counter - 1)}
730
763
  onFileUploaded={() => setCounter(counter => counter + 1)} */
731
- onCurrentDirectoryChanged: onCurrentDirectoryChanged, selectionMode: props.selectionMode === 'single' ? 'single' : selectionMode, children: [_jsxs(Toolbar, { children: [_jsx(Item, { name: "showNavPane", visible: true }), _jsx(Item, { name: "create", visible: true }), _jsx(Item, { name: "upload", visible: true }), _jsx(Item, { name: "separator", location: 'after' }), _jsx(Item, { name: "switchView", visible: true }), _jsx(Item, { name: "refresh", visible: true })] }), _jsx(ContextMenu, { items: ["create", "upload", "rename", "move", "copy", "delete", "refresh", "download"] }), _jsx(Permissions, { copy: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areasRoots.has(focusedFileSystemItem.name), move: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areasRoots.has(focusedFileSystemItem.name), create: focusedFileSystemItem && focusedFileSystemItem.name !== "", upload: focusedFileSystemItem && focusedFileSystemItem.name !== "", rename: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areasRoots.has(focusedFileSystemItem.name), delete: focusedFileSystemItem && focusedFileSystemItem.name !== "" && !areasRoots.has(focusedFileSystemItem.name), download: true }), _jsx(ItemView, { children: _jsxs(Details, { children: [_jsx(Column, { dataField: "thumbnail", cssClass: 'file-thumbnail' }, "thumbnail"), _jsx(Column, { dataField: "name", caption: SDKUI_Localizator.Name }, "name"), _jsx(Column, { dataField: 'size', width: '120px', alignment: 'center', dataType: 'number', caption: SDKUI_Localizator.File_Size }, "size"), _jsx(Column, { dataField: 'dateModified', width: '160px', alignment: 'center', dataType: 'datetime', caption: SDKUI_Localizator.Date_Modified }, "dateModified")] }) }), _jsx(Notifications, { showPopup: true, showPanel: true })] }), _jsx("div", { style: { width: "100%", height: "30px", overflowY: "hidden" }, children: _jsx(TMCounterContainer, { items: counterValues }) })] }) }));
764
+ onCurrentDirectoryChanged: onCurrentDirectoryChanged, selectionMode: props.selectionMode === 'single' ? 'single' : selectionMode, children: [_jsxs(Toolbar, { children: [_jsx(Item, { name: "showNavPane", visible: true }), _jsx(Item, { name: "create", visible: true }), _jsx(Item, { name: "upload", visible: true }), _jsx(Item, { name: "separator", location: 'after' }), _jsx(Item, { name: "switchView", visible: true }), _jsx(Item, { name: "refresh", visible: true })] }), _jsx(ContextMenu, { items: ["create", "upload", "rename", "move", "copy", "delete", "refresh", "download"] }), _jsx(Permissions, { copy: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, move: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, create: focusedFileSystemItem && focusedFileSystemItem.name !== "", upload: focusedFileSystemItem && focusedFileSystemItem.name !== "", rename: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, delete: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, download: true }), _jsx(ItemView, { children: _jsxs(Details, { children: [_jsx(Column, { dataField: "thumbnail", cssClass: 'file-thumbnail' }, "thumbnail"), _jsx(Column, { dataField: "name", caption: SDKUI_Localizator.Name }, "name"), _jsx(Column, { dataField: 'size', width: '120px', alignment: 'center', dataType: 'number', caption: SDKUI_Localizator.File_Size }, "size"), _jsx(Column, { dataField: 'dateModified', width: '160px', alignment: 'center', dataType: 'datetime', caption: SDKUI_Localizator.Date_Modified }, "dateModified")] }) }), _jsx(Notifications, { showPopup: true, showPanel: true })] }), _jsx("div", { style: { width: "100%", height: "30px", overflowY: "hidden" }, children: _jsx(TMCounterContainer, { items: counterValues }) })] }) }));
732
765
  };
733
766
  export default TMAreaManager;
@@ -59,7 +59,7 @@ const TMFileManagerDataGridView = (props) => {
59
59
  const lockMode = checkoutDate && checkoutUsedId && userID && userID !== checkoutUsedId;
60
60
  const editLockTooltipText = _jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [editMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: "#28a745", fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), lockMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: "#28a745", fontWeight: "bold" }, className: "dx-icon-lock" }), SDKUI_Localizator.ExtractedFromOtherUser] }))] }), _jsx("hr", {}), _jsxs("div", { style: { textAlign: "left" }, children: [_jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedBy }), ": ", findCheckOutUserName(checkOutUserName, checkOutUserID) ?? '-', " (ID: ", checkOutUserID, ")"] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedOn }), ": ", Globalization.getDateTimeDisplayValue(checkoutDate?.toString())] })] }), _jsx("hr", {}), _jsx("ul", { children: _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Version }), ": ", version ?? 1] }) }), _jsx("hr", {}), _jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Type }), ": ", ext] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.CreationTime }), ": ", Globalization.getDateTimeDisplayValue(creationTime?.toString())] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.LastUpdateTime }), ": ", Globalization.getDateTimeDisplayValue(lastUpdateTime?.toString())] })] })] })] });
61
61
  return _jsxs("div", { style: { display: "inline-flex", alignItems: "center", gap: "4px" }, children: [editMode && _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: "#28a745", fontWeight: "bold" }, className: "dx-icon-edit" }) }), lockMode && _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: "#28a745", fontWeight: "bold" }, className: "dx-icon-lock" }) }), renderHighlightedText(cellData.value, searchText, false)] });
62
- }, [searchText]);
62
+ }, [searchText, findCheckOutUserName]);
63
63
  const cellExtRender = useCallback((cellData) => {
64
64
  const item = cellData.data;
65
65
  const tooltipContent = (_jsxs("div", { style: { textAlign: 'left' }, children: [_jsxs("div", { children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "ID:" }), " ", item.id ?? '-'] }), _jsxs("div", { children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "DID:" }), " ", item.did ?? '-'] }), _jsxs("div", { children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "TID:" }), " ", item.tid ?? '-'] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Name, ":"] }), " ", item.name ?? '-'] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Author, ":"] }), " ", item.updaterName ?? '-'] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Version, ":"] }), " ", item.version] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Size, ":"] }), " ", formatBytes(item.size ?? 0)] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.CreationTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(item.creationTime)] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.LastUpdateTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(item.lastUpdateTime)] })] }));
@@ -85,7 +85,7 @@ const TMFileManagerDataGridView = (props) => {
85
85
  { dataField: "lastUpdateTime", caption: SDKUI_Localizator.LastUpdateTime, dataType: 'datetime', format: 'dd/MM/yyyy HH:mm', cellRender: cellDatetimeRender },
86
86
  { dataField: "creationTime", caption: SDKUI_Localizator.CreationTime, dataType: 'datetime', format: 'dd/MM/yyyy HH:mm', cellRender: cellDatetimeRender },
87
87
  ];
88
- }, [searchText]);
88
+ }, [searchText, cellNameRender]);
89
89
  return _jsx(TMDataGrid, { dataSource: items ?? [], dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onCellDblClick: onCellDblClick, customContextMenuItems: fileContextMenuItems, showSearchPanel: false, noDataText: SDKUI_Localizator.FolderIsEmpty }, items.length);
90
90
  };
91
91
  export default TMFileManagerDataGridView;
@@ -40,11 +40,15 @@ export declare const colors: {
40
40
  LIGHT_YELLOW: string;
41
41
  MEDIUM_GREEN: string;
42
42
  };
43
- export declare const TMFileItemContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
43
+ export declare const TMFileItemContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$backgroundColor" | "$textColor" | "$bgHoverColor"> & {
44
44
  $backgroundColor?: string;
45
45
  $textColor?: string;
46
46
  $bgHoverColor?: string;
47
- }>> & string;
47
+ }, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$backgroundColor" | "$textColor" | "$bgHoverColor"> & {
48
+ $backgroundColor?: string;
49
+ $textColor?: string;
50
+ $bgHoverColor?: string;
51
+ }, never>>> & string;
48
52
  export declare const findFileItems: (items: Array<FileItem>, id: number) => FileItem | undefined;
49
53
  export declare const setFolderTreeViewItems: (items: Array<FileItem>) => Array<TMFileManagerTreeViewDirectory>;
50
54
  export declare const buildFolderHierarchy: (fileSystemTree: WGTreeDescriptor | undefined, draftsFile: SearchResultDescriptor | undefined, archivedDocuments: Array<SearchResultDescriptor> | undefined, participants: Array<UserDescriptor> | undefined) => {
@@ -26,6 +26,7 @@ const StyledPanelContainer = styled.div `
26
26
  height: ${({ $isMaximized }) => $isMaximized ? `calc(100vh - 50px - (${Gutters.getGutters()}px * 2))` : '100%'};
27
27
  z-index: ${({ $isMaximized }) => $isMaximized ? 2000 : 'auto'};
28
28
  margin: ${({ $isMaximized }) => $isMaximized ? `${Gutters.getGutters()}px` : '0'};
29
+ outline: none;
29
30
  /* transition: all 0.2s; */
30
31
  `;
31
32
  const StyledPanelHeader = styled.div `
@@ -30,7 +30,9 @@ interface ITMTreeViewProps<T extends ITMTreeItem> {
30
30
  }
31
31
  declare const TMTreeView: <T extends ITMTreeItem>({ dataSource, focusedItem, selectedItems, allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, onItemContextMenu, autoSelectChildren, itemsPerPage, showLoadMoreButton }: ITMTreeViewProps<T>) => import("react/jsx-runtime").JSX.Element;
32
32
  export default TMTreeView;
33
- export declare const StyledTreeNode: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
33
+ export declare const StyledTreeNode: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$isSelected"> & {
34
34
  $isSelected?: boolean;
35
- }>> & string;
36
- export declare const StyledStickyPaginator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
35
+ }, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$isSelected"> & {
36
+ $isSelected?: boolean;
37
+ }, never>>> & string;
38
+ export declare const StyledStickyPaginator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
@@ -1,17 +1,71 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useMemo, useRef, useState } from 'react';
2
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { SDK_Localizator, DataListCacheService } from '@topconsultnpm/sdk-ts';
4
4
  import { StyledDivHorizontal } from '../base/Styled';
5
5
  import { IconSearch, SDKUI_Localizator, TMImageLibrary } from '../../helper';
6
+ import { TMColors } from '../../utils/theme';
6
7
  import TMSpinner from '../base/TMSpinner';
8
+ import TMTooltip from '../base/TMTooltip';
7
9
  import TMSummary from '../editors/TMSummary';
8
10
  import TMChooserForm from '../forms/TMChooserForm';
9
11
  import TMDataListItemViewer from '../viewers/TMDataListItemViewer';
12
+ import { useDataListItem } from '../../hooks/useDataListItem';
10
13
  const TMDataListItemChooser = ({ labelColor, width = '100%', dataListId, icon, backgroundColor, showBorder = true, readOnly, openChooserBySingleClick, buttons = [], elementStyle, allowMultipleSelection, values, isModifiedWhen, label, placeHolder, titleForm, showClearButton = false, validationItems = [], onValueChanged, updateIsModalOpen }) => {
14
+ const { loadDataListsAsync, getDataListItem, convertToDataListValue } = useDataListItem();
15
+ const [dataListLoaded, setDataListLoaded] = useState(false);
16
+ useEffect(() => {
17
+ const loadData = async () => {
18
+ if (dataListId) {
19
+ try {
20
+ setDataListLoaded(false);
21
+ await loadDataListsAsync(new Set([dataListId]));
22
+ setDataListLoaded(true);
23
+ }
24
+ catch (err) {
25
+ console.error(`Error loading DataList with ID ${dataListId}:`, err);
26
+ setDataListLoaded(false);
27
+ }
28
+ }
29
+ else {
30
+ setDataListLoaded(false);
31
+ }
32
+ };
33
+ loadData();
34
+ }, [dataListId, loadDataListsAsync]);
11
35
  const [showChooser, setShowChooser] = useState(false);
36
+ const getDisplayValue = (value) => {
37
+ if (!dataListId || !dataListLoaded)
38
+ return value;
39
+ const item = getDataListItem(dataListId, convertToDataListValue(value));
40
+ return item?.name ?? value;
41
+ };
12
42
  const renderTemplate = () => {
43
+ const MIN_COUNT_FOR_BADGE = 1;
44
+ const MAX_VISIBLE_ITEMS = 3;
45
+ const MAX_TOOLTIP_ITEMS = 50;
13
46
  const isPlaceholder = values?.[0] === placeHolder;
14
- return (_jsxs(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [values && values.length > 0 && _jsx(TMDataListItemViewer, { dataListId: dataListId, value: values?.[0] }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
47
+ const remainingCount = (values?.length ?? 0) - MAX_VISIBLE_ITEMS;
48
+ const totalCount = values?.length ?? 0;
49
+ const displayValues = values?.map(v => getDisplayValue(v)) ?? [];
50
+ const allValuesTooltip = displayValues.length > MAX_TOOLTIP_ITEMS
51
+ ? displayValues.slice(0, MAX_TOOLTIP_ITEMS).join(', ') + ` ... (+${values.length - MAX_TOOLTIP_ITEMS})`
52
+ : displayValues.join(', ');
53
+ return (_jsxs(StyledDivHorizontal, { style: { width: '100%', justifyContent: 'flex-start', color: isPlaceholder ? '#a9a9a9' : 'inherit', alignItems: 'center' }, children: [values && values.length > 0 && _jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: '2px' }, children: [totalCount > MIN_COUNT_FOR_BADGE && _jsx(TMTooltip, { content: _jsx("div", { style: { maxWidth: '300px', wordWrap: 'break-word', whiteSpace: 'pre-wrap' }, children: allValuesTooltip }), children: _jsx(StyledDivHorizontal, { style: { alignItems: 'center', gap: '4px' }, children: _jsx("span", { style: {
54
+ backgroundColor: TMColors.primary + '15',
55
+ color: TMColors.primary,
56
+ borderRadius: '4px',
57
+ padding: '2px 6px',
58
+ fontSize: '11px',
59
+ fontWeight: 600,
60
+ letterSpacing: '0.3px'
61
+ }, children: totalCount }) }) }), values.slice(0, MAX_VISIBLE_ITEMS).map((v, index) => (_jsx(React.Fragment, { children: _jsxs("span", { style: { display: 'inline-flex', alignItems: 'center' }, children: [_jsx(TMDataListItemViewer, { dataListId: dataListId, value: v, width: 'auto', showTooltip: false }), index < Math.min(values.length, MAX_VISIBLE_ITEMS) - 1 && _jsx("span", { style: { marginLeft: 0 }, children: "," })] }) }, index)))] }), values && values.length > MAX_VISIBLE_ITEMS &&
62
+ _jsx(TMTooltip, { content: _jsx("div", { style: { maxWidth: '300px', wordWrap: 'break-word', whiteSpace: 'pre-wrap' }, children: (() => {
63
+ const remainingValues = values.slice(MAX_VISIBLE_ITEMS);
64
+ const remainingDisplayValues = remainingValues.map(v => getDisplayValue(v));
65
+ return remainingDisplayValues.length > MAX_TOOLTIP_ITEMS
66
+ ? remainingDisplayValues.slice(0, MAX_TOOLTIP_ITEMS).join(', ') + ` ... (+${remainingValues.length - MAX_TOOLTIP_ITEMS})`
67
+ : remainingDisplayValues.join(', ');
68
+ })() }), children: _jsx("p", { style: { marginLeft: '10px' }, children: `(+${remainingCount} ${remainingCount === 1 ? 'altro' : 'altri'})` }) })] }));
15
69
  };
16
70
  const summaryInputRef = useRef(null);
17
71
  return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { ref: summaryInputRef, placeHolder: placeHolder, labelColor: labelColor, width: width, icon: icon, buttons: buttons, readOnly: readOnly, backgroundColor: backgroundColor, showBorder: showBorder, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => {
@@ -39,4 +39,4 @@ interface ITMDynDataListItemChooserFormProps extends ITMChooserFormProps<DataLis
39
39
  dynDL?: DynamicDataListDescriptor;
40
40
  searchResult?: SearchResultDescriptor;
41
41
  }
42
- export declare const TMDynDataListItemChooserForm: React.FunctionComponent<ITMDynDataListItemChooserFormProps>;
42
+ export declare const TMDynDataListItemChooserForm: (props: ITMDynDataListItemChooserFormProps) => import("react/jsx-runtime").JSX.Element;
@@ -53,17 +53,20 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
53
53
  return await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(tid, md?.id, layoutMode, queryParamsDynDataList ?? [])
54
54
  .catch((err) => { throw err; });
55
55
  };
56
- const getDescription = () => {
57
- if (!Array.isArray(values))
58
- return "";
59
- if (!values || values.length <= 0)
60
- return "";
61
- if (!values[0])
56
+ const getValueDescription = (value) => {
57
+ if (!value)
62
58
  return "";
63
59
  if (!dynDl)
64
- return values?.[0];
65
- let description = dataSource?.dtdResult?.rows?.filter(o => o[dynDl.selectItemForValue ?? 0] == values?.[0])?.[0]?.[dynDl.selectItemForDescription ?? 0];
66
- return description ?? values?.[0];
60
+ return value;
61
+ let description = dataSource?.dtdResult?.rows?.filter(o => o[dynDl.selectItemForValue ?? 0] == value)?.[0]?.[dynDl.selectItemForDescription ?? 0];
62
+ return description ?? value;
63
+ };
64
+ const getDescriptions = (maxItems = 3) => {
65
+ if (!Array.isArray(values))
66
+ return [];
67
+ if (!values || values.length <= 0)
68
+ return [];
69
+ return values.slice(0, maxItems).map(v => getValueDescription(v)).filter(d => d !== "");
67
70
  };
68
71
  const getIcon = () => {
69
72
  if (!Array.isArray(values))
@@ -75,14 +78,38 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
75
78
  if (FormulaHelper.isFormula(values?.[0]))
76
79
  return null;
77
80
  if (!dynDl)
78
- return _jsx(IconDetails, {});
79
- let description = dataSource?.dtdResult?.rows?.filter(o => o[dynDl.selectItemForValue ?? 0] == values?.[0])?.[0]?.[dynDl.selectItemForDescription ?? 0];
80
- return description ? _jsx(IconDetails, {}) :
81
+ return null;
82
+ let description = dataSource?.dtdResult?.rows?.filter(o => o[dynDl.selectItemForValue ?? 0]?.toString().toLowerCase() === values?.[0]?.toString().toLowerCase())?.[0]?.[dynDl.selectItemForDescription ?? 0];
83
+ return description ? null :
81
84
  _jsx(TMTooltip, { content: SDKUI_Localizator.ValueNotPresent, children: _jsx(IconWarning, { color: TMColors.warning }) });
82
85
  };
83
86
  const renderTemplate = () => {
87
+ const MIN_COUNT_FOR_BADGE = 1;
88
+ const MAX_VISIBLE_ITEMS = 3;
89
+ const MAX_TOOLTIP_ITEMS = 50;
84
90
  const isPlaceholder = values?.[0] === placeHolder;
85
- return (_jsxs(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [dataSource && _jsxs(StyledDivHorizontal, { children: [getIcon(), _jsx("p", { style: { marginLeft: '5px' }, children: getDescription() })] }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
91
+ const descriptions = getDescriptions(MAX_VISIBLE_ITEMS);
92
+ const remainingCount = (values?.length ?? 0) - MAX_VISIBLE_ITEMS;
93
+ const totalCount = values?.length ?? 0;
94
+ const allDescriptionsArray = values?.map(v => getValueDescription(v)).filter(d => d !== "") ?? [];
95
+ const allDescriptions = allDescriptionsArray.length > MAX_TOOLTIP_ITEMS
96
+ ? allDescriptionsArray.slice(0, MAX_TOOLTIP_ITEMS).join(', ') + ` ... (+${allDescriptionsArray.length - MAX_TOOLTIP_ITEMS})`
97
+ : allDescriptionsArray.join(', ');
98
+ return (_jsxs(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit', alignItems: 'center' }, children: [dataSource && descriptions.length > 0 && _jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: '8px' }, children: [totalCount > MIN_COUNT_FOR_BADGE && _jsx(TMTooltip, { content: _jsx("div", { style: { maxWidth: '300px', wordWrap: 'break-word', whiteSpace: 'pre-wrap' }, children: allDescriptions }), children: _jsx(StyledDivHorizontal, { style: { alignItems: 'center', gap: '4px' }, children: _jsx("span", { style: {
99
+ backgroundColor: TMColors.primary + '15',
100
+ color: TMColors.primary,
101
+ borderRadius: '4px',
102
+ padding: '2px 6px',
103
+ fontSize: '11px',
104
+ fontWeight: 600,
105
+ letterSpacing: '0.3px'
106
+ }, children: totalCount }) }) }), getIcon(), _jsx("p", { children: descriptions.join(', ') })] }), values && values.length > MAX_VISIBLE_ITEMS &&
107
+ _jsx(TMTooltip, { content: _jsx("div", { style: { maxWidth: '300px', wordWrap: 'break-word', whiteSpace: 'pre-wrap' }, children: (() => {
108
+ const remainingArray = values.slice(MAX_VISIBLE_ITEMS).map(v => getValueDescription(v));
109
+ return remainingArray.length > MAX_TOOLTIP_ITEMS
110
+ ? remainingArray.slice(0, MAX_TOOLTIP_ITEMS).join(', ') + ` ... (+${remainingArray.length - MAX_TOOLTIP_ITEMS})`
111
+ : remainingArray.join(', ');
112
+ })() }), children: _jsx("p", { style: { marginLeft: '10px' }, children: `(+${remainingCount} ${remainingCount === 1 ? 'altro' : 'altri'})` }) })] }));
86
113
  };
87
114
  return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { placeHolder: placeHolder, width: width, icon: icon, labelColor: labelColor, backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, readOnly: readOnly, hasValue: values && values.length > 0, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => {
88
115
  if (!readOnly) {
@@ -135,9 +162,10 @@ const TMDynDataListItemChooser = ({ tid, md, width = '100%', titleForm, openChoo
135
162
  export default TMDynDataListItemChooser;
136
163
  const cellRenderIcon = () => _jsx(IconDetails, {});
137
164
  export const TMDynDataListItemChooserForm = (props) => {
165
+ const { TID, MID, layoutMode, dynDL, searchResult, selectedIDs, title, width, height, onChoose } = props;
138
166
  // Generate unique keys for all columns
139
- const uniqueKeys = generateUniqueColumnKeys(props.searchResult?.dtdResult?.columns, props.searchResult?.fromTID);
140
- const dataColumns = props.searchResult?.dtdResult?.columns?.map((col, index) => {
167
+ const uniqueKeys = generateUniqueColumnKeys(searchResult?.dtdResult?.columns, searchResult?.fromTID);
168
+ const dataColumns = searchResult?.dtdResult?.columns?.map((col, index) => {
141
169
  const isVisible = col.extendedProperties?.["Visibility"] != "Hidden";
142
170
  const dataType = () => {
143
171
  switch (col.dataType) {
@@ -149,23 +177,23 @@ export const TMDynDataListItemChooserForm = (props) => {
149
177
  };
150
178
  return { dataField: uniqueKeys[index], caption: col.caption, visible: isVisible, dataType: dataType(), format: col.dataType === DataColumnTypes.DateTime ? Globalization.getDateDisplayFormat() : "" };
151
179
  });
152
- const keyValue = uniqueKeys[props.dynDL?.selectItemForValue ?? 0] ?? '';
180
+ const keyValue = uniqueKeys[dynDL?.selectItemForValue ?? 0] ?? '';
153
181
  const getItems = async (refreshCache) => {
154
- if (!props.searchResult)
182
+ if (!searchResult)
155
183
  return [];
156
184
  if (refreshCache)
157
185
  DataListCacheService.RemoveAll();
158
186
  TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.DataList} ...` });
159
- let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(props.TID, props.MID, props.layoutMode, [])
187
+ let result = await SDK_Globals.tmSession?.NewSearchEngine().GetDynDataListValuesAsync(TID, MID, layoutMode, [])
160
188
  .catch((err) => { TMSpinner.hide(); TMExceptionBoxManager.show({ exception: err }); });
161
189
  TMSpinner.hide();
162
190
  return result ? searchResultDescriptorToSimpleArray(result) ?? [] : [];
163
191
  };
164
192
  const getTitle = () => {
165
- let title = SDK_Localizator.DataList;
166
- if (props.title)
167
- title += `: ${props.title}`;
168
- return title;
193
+ let titleDataList = SDK_Localizator.DataList;
194
+ if (title)
195
+ titleDataList += `: ${title}`;
196
+ return titleDataList;
169
197
  };
170
- return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, width: props.width, height: props.height, keyName: keyValue ?? '', showDefaultColumns: false, hasShowId: false, columns: dataColumns, selectedIDs: props.selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: searchResultDescriptorToSimpleArray(props.searchResult) ?? [], getItems: getItems, onClose: props.onClose, onChoose: (IDs) => props.onChoose?.(IDs) }));
198
+ return (_jsx(TMChooserForm, { title: getTitle(), allowMultipleSelection: props.allowMultipleSelection, width: width, height: height, keyName: keyValue ?? '', showDefaultColumns: false, hasShowId: false, columns: dataColumns, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, dataSource: searchResultDescriptorToSimpleArray(searchResult) ?? [], getItems: getItems, onClose: props.onClose, onChoose: (IDs) => onChoose?.(IDs) }));
171
199
  };
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef } from 'react';
2
+ import { useEffect, useId, useRef } from 'react';
3
3
  import { DateBox } from 'devextreme-react';
4
4
  import { DateDisplayTypes, Globalization } from '../../helper';
5
5
  import { TMColors } from '../../utils/theme';
6
6
  import TMVilViewer from '../base/TMVilViewer';
7
7
  const TMDateBox = (props) => {
8
8
  const resetTimeToZero = props.resetTimeToZeroOnKeyPress ?? true;
9
+ const autoId = useId();
10
+ const effectiveInputAttr = { id: autoId, ...props.inputAttr };
9
11
  useEffect(() => {
10
12
  let htmlElement = dateBoxRef?.current?.instance().element();
11
13
  if (!htmlElement)
@@ -63,7 +65,7 @@ const TMDateBox = (props) => {
63
65
  return "datetime";
64
66
  return props.dateDisplayType == DateDisplayTypes.Date ? "date" : "time";
65
67
  };
66
- return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', padding: props.padding }, children: [props.icon && (_jsx("span", { style: { marginRight: '8px', marginTop: '8px', display: 'flex', alignItems: 'center' }, children: props.icon })), _jsxs("div", { onContextMenu: (e) => e.stopPropagation(), style: { display: 'flex', flexDirection: 'column', gap: '5px', width: '100%' }, children: [_jsx(DateBox, { readOnly: props.readOnly, ref: dateBoxRef, showClearButton: props.showClearButton, dateSerializationFormat: props.useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: props.disabled, displayFormat: props.displayFormat ?? Globalization.getDateDisplayFormat(props.dateDisplayType), dropDownOptions: dropDownOptions, label: props.label, labelMode: 'static', type: getType(), useMaskBehavior: true, height: '28px', value: props.value, width: props.width, valueChangeEvent: 'keyup input change', onValueChange: (e) => { props.onValueChange?.(e); }, onInitialized: (e) => { props.onInitialized?.(e); }, onContentReady: (e) => { props.onContentReady?.(e); }, placeholder: props.placeholder, onKeyUp: (e) => {
68
+ return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', padding: props.padding }, children: [props.icon && (_jsx("span", { style: { marginRight: '8px', marginTop: '8px', display: 'flex', alignItems: 'center' }, children: props.icon })), _jsxs("div", { onContextMenu: (e) => e.stopPropagation(), style: { display: 'flex', flexDirection: 'column', gap: '5px', width: '100%' }, children: [_jsx(DateBox, { readOnly: props.readOnly, ref: dateBoxRef, showClearButton: props.showClearButton, dateSerializationFormat: props.useDateSerializationFormat ? 'yyyy-MM-ddTHH:mm:ss' : undefined, disabled: props.disabled, displayFormat: props.displayFormat ?? Globalization.getDateDisplayFormat(props.dateDisplayType), dropDownOptions: dropDownOptions, label: props.label, labelMode: 'static', type: getType(), useMaskBehavior: true, height: '28px', value: props.value, width: props.width, valueChangeEvent: 'keyup input change', onValueChange: (e) => { props.onValueChange?.(e); }, onInitialized: (e) => { props.onInitialized?.(e); }, onContentReady: (e) => { props.onContentReady?.(e); }, placeholder: props.placeholder, ...(props.name && { name: props.name }), inputAttr: effectiveInputAttr, onKeyUp: (e) => {
67
69
  if (e.event?.code == "Space") {
68
70
  const currentDate = new Date();
69
71
  currentDate.setHours(0, 0, 0, 0);
@@ -54,9 +54,9 @@ const StyledDropDownEditorButton = styled.div `
54
54
  align-items: center;
55
55
  cursor: pointer;
56
56
  `;
57
- const TMDropDown = ({ validationItems = [], disabled = false, elementStyle, isModifiedWhen, labelPosition = 'left', label, icon, width = '100%', fontSize = FontSize.defaultFontSize, dataSource, value, onValueChanged, buttons = [], }) => {
57
+ const TMDropDown = ({ validationItems = [], disabled = false, elementStyle, isModifiedWhen, labelPosition = 'left', label, icon, width = '100%', fontSize = FontSize.defaultFontSize, dataSource, value, onValueChanged, buttons = [], placeHolder, }) => {
58
58
  const [isFocused, setIsFocused] = useState(false);
59
- const renderedLeftLabelTextBox = () => (_jsxs(TMLayoutContainer, { direction: 'horizontal', children: [icon && _jsx(TMLayoutItem, { width: '20px', children: _jsx(StyledEditorIcon, { "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: icon }) }), _jsx(TMLayoutItem, { children: _jsxs(StyledEditorContainer, { "$width": width, children: [label && _jsx(StyledEditorLabel, { "$isFocused": isFocused, "$labelPosition": labelPosition, "$disabled": disabled, children: label }), _jsxs(StyledDropDownWrapper, { "$width": width, children: [_jsx(StyledDropDown, { value: value, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), "$disabled": disabled, disabled: disabled, "$fontSize": fontSize, "$isModified": isModifiedWhen, "$vil": validationItems, onChange: onValueChanged, children: dataSource?.map((data, index) => (_jsx("option", { value: data.value, children: data.display }, index))) }), buttons.length > 0 && (_jsx(ButtonsContainer, { children: buttons.map((buttonItem) => (_jsx(StyledDropDownEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text))) })), _jsx(CustomArrow, {})] }), _jsx(TMVilViewer, { vil: validationItems })] }) })] }));
59
+ const renderedLeftLabelTextBox = () => (_jsxs(TMLayoutContainer, { direction: 'horizontal', children: [icon && _jsx(TMLayoutItem, { width: '20px', children: _jsx(StyledEditorIcon, { "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, children: icon }) }), _jsx(TMLayoutItem, { children: _jsxs(StyledEditorContainer, { "$width": width, children: [label && _jsx(StyledEditorLabel, { "$isFocused": isFocused, "$labelPosition": labelPosition, "$disabled": disabled, children: label }), _jsxs(StyledDropDownWrapper, { "$width": width, children: [_jsxs(StyledDropDown, { value: value, onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), "$disabled": disabled, disabled: disabled, "$fontSize": fontSize, "$isModified": isModifiedWhen, "$vil": validationItems, onChange: onValueChanged, children: [placeHolder && _jsx("option", { value: "", disabled: true, hidden: true, children: placeHolder }), dataSource?.map((data, index) => (_jsx("option", { value: data.value, children: data.display }, index)))] }), buttons.length > 0 && (_jsx(ButtonsContainer, { children: buttons.map((buttonItem) => (_jsx(StyledDropDownEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text))) })), _jsx(CustomArrow, {})] }), _jsx(TMVilViewer, { vil: validationItems })] }) })] }));
60
60
  return _jsx("div", { style: elementStyle, children: renderedLeftLabelTextBox() });
61
61
  };
62
62
  export default TMDropDown;
@@ -2,10 +2,22 @@ import { ValidationItem } from '@topconsultnpm/sdk-ts';
2
2
  export declare const TMEditorsDefaultBorderRadius = "5px";
3
3
  export declare const TMEditorsDefaultLabelFontSize = "0.9rem";
4
4
  export declare const editorColorManager: (validationItems: ValidationItem[]) => string;
5
- export declare const StyledEditorContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
5
+ export declare const StyledEditorContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$width"> & {
6
6
  $width: string;
7
- }>> & string;
8
- export declare const StyledEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, {
7
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$width"> & {
8
+ $width: string;
9
+ }, never>>> & string;
10
+ export declare const StyledEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "$disabled" | "$isMobile" | "$width" | "$type" | "$borderRadius" | "$fontSize" | "$vil" | "$isModified" | "$maxValue"> & {
11
+ $vil: ValidationItem[];
12
+ $width: string;
13
+ $type: string;
14
+ $isModified: boolean;
15
+ $maxValue: number;
16
+ $fontSize: string;
17
+ $disabled: boolean;
18
+ $isMobile?: boolean;
19
+ $borderRadius?: string;
20
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "$disabled" | "$isMobile" | "$width" | "$type" | "$borderRadius" | "$fontSize" | "$vil" | "$isModified" | "$maxValue"> & {
9
21
  $vil: ValidationItem[];
10
22
  $width: string;
11
23
  $type: string;
@@ -15,20 +27,40 @@ export declare const StyledEditor: import("styled-components/dist/types").IStyle
15
27
  $disabled: boolean;
16
28
  $isMobile?: boolean;
17
29
  $borderRadius?: string;
18
- }>> & string;
19
- export declare const StyledEditorIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
30
+ }, never>>> & string;
31
+ export declare const StyledEditorIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$disabled" | "$vil" | "$isModified"> & {
20
32
  $vil: ValidationItem[];
21
33
  $disabled: boolean;
22
34
  $isModified: boolean;
23
- }>> & string;
24
- export declare const StyledEditorLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
35
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$disabled" | "$vil" | "$isModified"> & {
36
+ $vil: ValidationItem[];
37
+ $disabled: boolean;
38
+ $isModified: boolean;
39
+ }, never>>> & string;
40
+ export declare const StyledEditorLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$color" | "$disabled" | "$fontSize" | "$isFocused" | "$labelPosition"> & {
25
41
  $isFocused: boolean;
26
42
  $labelPosition: "right" | "left" | "top";
27
43
  $disabled: boolean;
28
44
  $fontSize?: string;
29
45
  $color?: string;
30
- }>> & string;
31
- export declare const StyledTextareaEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, {
46
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$color" | "$disabled" | "$fontSize" | "$isFocused" | "$labelPosition"> & {
47
+ $isFocused: boolean;
48
+ $labelPosition: "right" | "left" | "top";
49
+ $disabled: boolean;
50
+ $fontSize?: string;
51
+ $color?: string;
52
+ }, never>>> & string;
53
+ export declare const StyledTextareaEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "$maxHeight" | "$disabled" | "$isMobile" | "$width" | "$borderRadius" | "$fontSize" | "$vil" | "$isModified" | "$resize"> & {
54
+ $vil: ValidationItem[];
55
+ $width: string;
56
+ $isModified: boolean;
57
+ $fontSize: string;
58
+ $disabled: boolean;
59
+ $isMobile?: boolean;
60
+ $maxHeight?: string;
61
+ $borderRadius?: string;
62
+ $resize?: boolean;
63
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "$maxHeight" | "$disabled" | "$isMobile" | "$width" | "$borderRadius" | "$fontSize" | "$vil" | "$isModified" | "$resize"> & {
32
64
  $vil: ValidationItem[];
33
65
  $width: string;
34
66
  $isModified: boolean;
@@ -38,4 +70,4 @@ export declare const StyledTextareaEditor: import("styled-components/dist/types"
38
70
  $maxHeight?: string;
39
71
  $borderRadius?: string;
40
72
  $resize?: boolean;
41
- }>> & string;
73
+ }, never>>> & string;
@@ -132,12 +132,24 @@ const TMFormulaEditor = (props) => {
132
132
  const renderTreeViewItem = useCallback((item) => {
133
133
  return (_jsxs(StyledDivHorizontal, { style: { display: 'flex', gap: '5px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }, children: [renderFormulaIcon(item.icon, item.tid, item.md), _jsx("p", { style: { verticalAlign: 'middle', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }, children: item.text })] }));
134
134
  }, []);
135
+ const translateDescInFormula = (text) => {
136
+ switch (text) {
137
+ case `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithoutLogin})`:
138
+ return `[dbo].[TM_GetViewLink](NULL, NULL, NULL, 0, {@TID}, {@DID}, 1, NULL, 0)`;
139
+ case `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithLogin})`:
140
+ return `[dbo].[TM_GetViewLink](NULL, 'ASKLOGIN', NULL, 0, {@TID}, {@DID}, 1, NULL, 0)`;
141
+ case `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithDate})`:
142
+ return `[dbo].[TM_GetViewLink](NULL, NULL, NULL, 0, {@TID}, {@DID}, 1, CONVERT(VARCHAR, {@CreationTime}+30, 126), 0)`;
143
+ break;
144
+ }
145
+ return text;
146
+ };
135
147
  const handleTreeViewItemClick = (e) => {
136
148
  if (!e)
137
149
  return;
138
150
  if (e.itemData?.hasItems)
139
151
  return;
140
- insertText(e.itemData?.text);
152
+ insertText(translateDescInFormula(e.itemData?.text));
141
153
  };
142
154
  return (_jsx(TMApplyForm, { isModal: props.isModal, formMode: props.formMode, isModified: formData.expression !== formDataOrig.expression, exception: exception, validationItems: validationItems, title: SDKUI_Localizator.Formula, hasNavigation: false, showBack: props.showBack, height: '600px', width: '800px', onApply: () => applyData(), onClose: props.onClose, onUndo: () => {
143
155
  setFormData(formDataOrig);
@@ -705,13 +717,13 @@ export class FormulaHelper {
705
717
  static jsonItems_LoadFunctions_Link() {
706
718
  let items = [{
707
719
  id: '3_4_1',
708
- text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithLogin})`,
720
+ text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithoutLogin})`,
709
721
  icon: FormulaIconTypes.Function,
710
722
  expanded: false,
711
723
  hasItems: false,
712
724
  }, {
713
725
  id: '3_4_2',
714
- text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithoutLogin})`,
726
+ text: `TM_GetViewLink (${SDKUI_Localizator.FormulaEditor_Function_TM_GetViewLink_WithLogin})`,
715
727
  icon: FormulaIconTypes.Function,
716
728
  expanded: false,
717
729
  hasItems: false,