@topconsultnpm/sdkui-react 6.20.0-dev1.3 → 6.20.0-dev1.30

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 (64) hide show
  1. package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +3 -3
  2. package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -0
  3. package/lib/components/NewComponents/ContextMenu/hooks.js +8 -4
  4. package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -1
  5. package/lib/components/NewComponents/ContextMenu/styles.js +41 -8
  6. package/lib/components/NewComponents/ContextMenu/types.d.ts +1 -0
  7. package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +38 -30
  8. package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +8 -0
  9. package/lib/components/NewComponents/FloatingMenuBar/styles.js +30 -19
  10. package/lib/components/base/TMAccordion.js +2 -2
  11. package/lib/components/base/TMCustomButton.js +41 -5
  12. package/lib/components/base/TMDataGrid.d.ts +2 -2
  13. package/lib/components/base/TMDataGrid.js +16 -5
  14. package/lib/components/editors/TMHtmlEditor.js +1 -1
  15. package/lib/components/editors/TMMetadataValues.js +20 -2
  16. package/lib/components/features/documents/TMDcmtBlog.d.ts +1 -7
  17. package/lib/components/features/documents/TMDcmtBlog.js +29 -2
  18. package/lib/components/features/documents/TMDcmtForm.js +268 -168
  19. package/lib/components/features/documents/TMDcmtPreview.js +37 -66
  20. package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
  21. package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +6 -11
  22. package/lib/components/features/search/TMSearchQueryPanel.js +13 -12
  23. package/lib/components/features/search/TMSearchResult.js +74 -111
  24. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +1 -1
  25. package/lib/components/features/search/TMSearchResultsMenuItems.js +26 -43
  26. package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
  27. package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
  28. package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
  29. package/lib/components/forms/Login/LoginValidatorService.js +7 -2
  30. package/lib/components/forms/Login/TMLoginForm.js +34 -6
  31. package/lib/css/tm-sdkui.css +1 -1
  32. package/lib/helper/SDKUI_Globals.d.ts +13 -14
  33. package/lib/helper/SDKUI_Globals.js +9 -0
  34. package/lib/helper/SDKUI_Localizator.d.ts +8 -0
  35. package/lib/helper/SDKUI_Localizator.js +98 -0
  36. package/lib/helper/TMPdfViewer.d.ts +8 -0
  37. package/lib/helper/TMPdfViewer.js +187 -0
  38. package/lib/helper/TMUtils.d.ts +3 -1
  39. package/lib/helper/TMUtils.js +51 -0
  40. package/lib/helper/checkinCheckoutManager.d.ts +85 -0
  41. package/lib/helper/checkinCheckoutManager.js +348 -0
  42. package/lib/helper/devextremeCustomMessages.d.ts +30 -0
  43. package/lib/helper/devextremeCustomMessages.js +30 -0
  44. package/lib/helper/helpers.js +7 -1
  45. package/lib/helper/index.d.ts +2 -0
  46. package/lib/helper/index.js +2 -0
  47. package/lib/helper/queryHelper.js +29 -0
  48. package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
  49. package/lib/hooks/useCheckInOutOperations.js +223 -0
  50. package/lib/services/platform_services.d.ts +1 -1
  51. package/package.json +5 -2
  52. package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
  53. package/lib/components/NewComponents/Notification/Notification.js +0 -60
  54. package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
  55. package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
  56. package/lib/components/NewComponents/Notification/index.d.ts +0 -2
  57. package/lib/components/NewComponents/Notification/index.js +0 -2
  58. package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
  59. package/lib/components/NewComponents/Notification/styles.js +0 -180
  60. package/lib/components/NewComponents/Notification/types.d.ts +0 -18
  61. package/lib/components/NewComponents/Notification/types.js +0 -1
  62. package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
  63. package/lib/helper/cicoHelper.d.ts +0 -31
  64. package/lib/helper/cicoHelper.js +0 -155
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
3
- import DataGrid, { Column, HeaderFilter, Selection, Scrolling, LoadPanel, SearchPanel, Pager, Sorting, Paging, FilterPanel, ColumnChooser, Grouping, GroupPanel, Summary, Editing, FilterRow, StateStoring, RowDragging, MasterDetail } from 'devextreme-react/data-grid';
3
+ import DataGrid, { Column, HeaderFilter, Selection, Scrolling, LoadPanel, SearchPanel, Pager, Sorting, Paging, FilterPanel, ColumnChooser, Grouping, GroupPanel, Summary, Editing, FilterRow, StateStoring, RowDragging, MasterDetail, Position, ColumnChooserSearch, ColumnChooserSelection } from 'devextreme-react/data-grid';
4
4
  import DataSource from 'devextreme/data/data_source';
5
5
  import { IconAll, IconSelected, IconVisible, SDKUI_Globals, SDKUI_Localizator } from '../../helper';
6
6
  import TMCounterContainer, { CounterItemKey } from './TMCounterContainer';
@@ -16,9 +16,9 @@ const TMDataGrid = React.forwardRef((props, ref) => {
16
16
  // main properties
17
17
  keyExpr = 'id', dataSource, focusedRowEnabled = true, hoverStateEnabled = true, focusedRowKey, selectedRowKeys = [],
18
18
  // custom options
19
- dataColumns = [], pageSize = TMDataGridPageSize.Large, showHeaderFilter = true, showFilterPanel = true, showLoadPanel = true, showSearchPanel = true, searchPanelToolbarPosition = 'before', searchPanelFocusStarting = false, counterConfig = { show: false, items: new Map() }, onHasFiltersChange,
19
+ dataColumns = [], pageSize = TMDataGridPageSize.Large, showHeaderFilter = true, showFilterPanel = true, showHeaderColumnChooser = false, showLoadPanel = true, showSearchPanel = true, searchPanelToolbarPosition = 'before', searchPanelFocusStarting = false, counterConfig = { show: false, items: new Map() }, onHasFiltersChange,
20
20
  // events and callbacks
21
- onSelectionChanged, onFocusedRowChanged, onRowDblClick, onRowClick, onCellClick, onCellDblClick, onOptionChanged, onContentReady, onContextMenuPreparing, onInitialized, onEditorPreparing, onCellPrepared, onRowPrepared, onRowUpdating, onRowExpanded, onRowCollapsed, onRowUpdated, onSaved, onEditCanceled, onEditingStart, onEditingChange, customizeColumns, onKeyDown, scrolling = { mode: 'standard', useNative: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1 }, paging = { enabled: true, pageSize: pageSize }, pager = { visible: true, showInfo: true, showNavigationButtons: true }, selection = { mode: 'multiple', showCheckBoxesMode: "always", selectAllMode: "allPages" }, sorting, summary, stateStoring, columnChooser, grouping, groupPanel, filterRow, headerFilter, editing, rowDragging, masterDetail,
21
+ onSelectionChanged, onFocusedRowChanged, onRowDblClick, onRowClick, onCellClick, onCellDblClick, onOptionChanged, onContentReady, onContextMenuPreparing, onInitialized, onEditorPreparing, onCellPrepared, onRowPrepared, onRowUpdating, onRowExpanded, onRowCollapsed, onRowUpdated, onSaved, onEditCanceled, onEditingStart, onEditingChange, customizeColumns, onKeyDown, scrolling = { mode: 'standard', useNative: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1 }, paging = { enabled: true, pageSize: pageSize }, pager = { visible: true, showInfo: true, showNavigationButtons: true }, selection = { mode: 'multiple', showCheckBoxesMode: "always", selectAllMode: "allPages" }, sorting, summary, stateStoring, grouping, groupPanel, filterRow, headerFilter, editing, rowDragging, masterDetail,
22
22
  // other properties
23
23
  disabled = false, autoNavigateToFocusedRow = true, columnResizingMode = 'widget', columnHidingEnabled = true, columnAutoWidth = true, allowColumnResizing = true, allowColumnReordering = true, showBorders = true, showRowLines = SDKUI_Globals.userSettings?.themeSettings.gridSettings.showRowLines === 1, showColumnLines = SDKUI_Globals.userSettings?.themeSettings.gridSettings.showColumnLines === 1, showColumnHeaders = true, rowAlternationEnabled = false, wordWrapEnabled = false, noDataText,
24
24
  // styles
@@ -146,7 +146,18 @@ const TMDataGrid = React.forwardRef((props, ref) => {
146
146
  e.items = [...updatedContextMenuItems];
147
147
  }
148
148
  }
149
- }, [updateContextMenuItems, onContextMenuPreparing]);
149
+ // Add column chooser to header context menu
150
+ if (e.target === 'header' && showHeaderColumnChooser) {
151
+ e.items = e.items || [];
152
+ e.items.push({
153
+ text: SDKUI_Localizator.ShowColumnSelection,
154
+ icon: 'columnchooser',
155
+ onItemClick: () => {
156
+ internalRef.current?.instance().showColumnChooser();
157
+ }
158
+ });
159
+ }
160
+ }, [updateContextMenuItems, onContextMenuPreparing, showHeaderColumnChooser]);
150
161
  // Handle toolbar preparation, especially for the search panel
151
162
  const onToolbarPreparingCallback = useCallback((e) => {
152
163
  if (e === undefined || e.toolbarOptions === undefined || e.toolbarOptions.items === undefined)
@@ -223,7 +234,7 @@ const TMDataGrid = React.forwardRef((props, ref) => {
223
234
  // other properties
224
235
  disabled: disabled, autoNavigateToFocusedRow: autoNavigateToFocusedRow, focusedRowKey: focusedRowKey, columnHidingEnabled: columnHidingEnabled, columnResizingMode: columnResizingMode, columnAutoWidth: columnAutoWidth, allowColumnResizing: allowColumnResizing, allowColumnReordering: allowColumnReordering, showBorders: showBorders, showRowLines: showRowLines, showColumnLines: showColumnLines, showColumnHeaders: showColumnHeaders, rowAlternationEnabled: rowAlternationEnabled, wordWrapEnabled: wordWrapEnabled, noDataText: noDataText,
225
236
  // styles
226
- width: width, height: height, style: { userSelect: 'none' }, children: [dataColumns.map((column, index) => (_jsx(Column, { ...column }, column.caption + index.toString()))), sorting && _jsx(Sorting, { ...sorting }), selection && _jsx(Selection, { ...selection }), scrolling && _jsx(Scrolling, { ...scrolling }), summary && _jsx(Summary, { ...summary }), showHeaderFilter && _jsx(HeaderFilter, { visible: true, ...headerFilter }), rowDragging && _jsx(RowDragging, { ...rowDragging }), filterRow && _jsx(FilterRow, { ...filterRow }), showFilterPanel && _jsx(FilterPanel, { visible: true }), columnChooser && _jsx(ColumnChooser, { ...columnChooser }), stateStoring && _jsx(StateStoring, { ...stateStoring }), groupPanel && _jsx(GroupPanel, { ...groupPanel }), _jsx(Grouping, { contextMenuEnabled: true, ...grouping }), _jsx(LoadPanel, { enabled: showLoadPanel }), _jsx(SearchPanel, { visible: showSearchPanel, searchVisibleColumnsOnly: true, highlightSearchText: true }), editing && _jsx(Editing, { ...editing }), paging && _jsx(Paging, { ...paging }), pager && _jsx(Pager, { ...pager, visible: totalRecordCount > pageSize }), masterDetail && _jsx(MasterDetail, { ...masterDetail })] }) }), counterConfig.show && _jsx("div", { style: { width: "100%", height: "25px", display: "flex", alignItems: "center", gap: "15px", backgroundColor: "#e0e0e0" }, children: _jsx(TMCounterContainer, { items: counterValues, bgColorContainer: counterConfig.bgColorContainer, bgColorItem: counterConfig.bgColorItem, hoverColorItem: counterConfig.hoverColorItem, textColorItem: counterConfig.textColorItem }) })] });
237
+ width: width, height: height, style: { userSelect: 'none' }, children: [dataColumns.map((column, index) => (_jsx(Column, { ...column }, column.caption + index.toString()))), sorting && _jsx(Sorting, { ...sorting }), selection && _jsx(Selection, { ...selection }), scrolling && _jsx(Scrolling, { ...scrolling }), summary && _jsx(Summary, { ...summary }), showHeaderFilter && _jsx(HeaderFilter, { visible: true, ...headerFilter }), rowDragging && _jsx(RowDragging, { ...rowDragging }), filterRow && _jsx(FilterRow, { ...filterRow }), showFilterPanel && _jsx(FilterPanel, { visible: true }), showHeaderColumnChooser && _jsxs(ColumnChooser, { height: "400px", enabled: !showHeaderColumnChooser, mode: "select", children: [_jsx(Position, { my: "center", at: "center", of: window }), _jsx(ColumnChooserSearch, { enabled: true }), _jsx(ColumnChooserSelection, { allowSelectAll: false, selectByClick: true, recursive: true })] }), stateStoring && _jsx(StateStoring, { ...stateStoring }), groupPanel && _jsx(GroupPanel, { ...groupPanel }), _jsx(Grouping, { contextMenuEnabled: true, ...grouping }), _jsx(LoadPanel, { enabled: showLoadPanel }), _jsx(SearchPanel, { visible: showSearchPanel, searchVisibleColumnsOnly: true, highlightSearchText: true }), editing && _jsx(Editing, { ...editing }), paging && _jsx(Paging, { ...paging }), pager && _jsx(Pager, { ...pager, visible: totalRecordCount > pageSize }), masterDetail && _jsx(MasterDetail, { ...masterDetail })] }) }), counterConfig.show && _jsx("div", { style: { width: "100%", height: "25px", display: "flex", alignItems: "center", gap: "15px", backgroundColor: "#e0e0e0" }, children: _jsx(TMCounterContainer, { items: counterValues, bgColorContainer: counterConfig.bgColorContainer, bgColorItem: counterConfig.bgColorItem, hoverColorItem: counterConfig.hoverColorItem, textColorItem: counterConfig.textColorItem }) })] });
227
238
  });
228
239
  export default TMDataGrid;
229
240
  const getRecordCount = (dataSource) => {
@@ -170,7 +170,7 @@ const TMHtmlEditor = (props) => {
170
170
  justifyContent: 'flex-end',
171
171
  fontSize: 12,
172
172
  color: '#6c757d',
173
- marginTop: 4,
173
+ marginTop: showInfoIcon ? 0 : 4,
174
174
  gap: 4,
175
175
  }, children: [`${Math.max(charactersRemaining, 0)} ${SDKUI_Localizator.CharactersRemaining}`, showInfoIcon && (_jsx(TMTooltip, { content: 'Markup HTML', children: _jsx("span", { className: "dx-icon-codeblock", style: { fontSize: 22, cursor: 'pointer' }, onClick: () => {
176
176
  TMMessageBoxManager.show({
@@ -389,17 +389,35 @@ const TMMetadataValues = ({ showCheckBoxes = ShowCheckBoxesMode.Never, checkPerm
389
389
  return (_jsxs("div", { style: { width: '100%' }, children: [draftData.length > 0 && _jsx(TMAccordion, { title: SDKUI_Localizator.Draft, children: draftData.map(item => renderMetadataItem(item, isReadOnly)) }), checkOutData.length > 0 && _jsx(TMAccordion, { title: `${SDKUI_Localizator.CheckIn}/${SDKUI_Localizator.CheckOut}`, children: checkOutData.map(item => renderMetadataItem(item, true)) })] }));
390
390
  }, [metadataValues, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, dynDataListsToBeRefreshed, validationItems, selectedMID, isOpenDistinctValues, openChooserBySingleClick, metadataValuesOrig]);
391
391
  const layoutChronology = useMemo(() => {
392
- const chronologyData = [];
392
+ // Definiamo l'ordine desiderato: Version, Tipo, Dimensione, Autore, Data Ultima modifica
393
+ const desiredChronologyOrder = [
394
+ ChronologyMIDs.Ver,
395
+ SystemMIDsAsNumber.FileExt,
396
+ SystemMIDsAsNumber.FileSize,
397
+ ChronologyMIDs.AuthorID,
398
+ ChronologyMIDs.CheckInTime,
399
+ ];
400
+ const tempChronologyDataMap = {};
393
401
  metadataValues.forEach(item => {
394
402
  switch (item.md?.id) {
395
403
  case ChronologyMIDs.Ver:
396
404
  case ChronologyMIDs.AuthorID:
397
- chronologyData.push(item);
405
+ case ChronologyMIDs.CheckInTime:
406
+ case SystemMIDsAsNumber.FileExt:
407
+ case SystemMIDsAsNumber.FileSize:
408
+ tempChronologyDataMap[item.md.id] = item;
398
409
  break;
399
410
  default:
400
411
  break;
401
412
  }
402
413
  });
414
+ // Visualizziamo nell'ordine desiderato
415
+ const chronologyData = [];
416
+ desiredChronologyOrder.forEach(id => {
417
+ if (tempChronologyDataMap[id]) {
418
+ chronologyData.push(tempChronologyDataMap[id]);
419
+ }
420
+ });
403
421
  return (_jsx("div", { style: { width: '100%' }, children: chronologyData.length > 0 && chronologyData.map(item => renderMetadataItem(item, isReadOnly)) }));
404
422
  }, [metadataValues, showCheckBoxes, showNullValueCheckBoxes, isReadOnly, dynDataListsToBeRefreshed, validationItems, selectedMID, isOpenDistinctValues, openChooserBySingleClick, metadataValuesOrig]);
405
423
  const layoutDsAttachs = useMemo(() => {
@@ -1,16 +1,10 @@
1
1
  import React from 'react';
2
2
  import { HomeBlogPost, TaskDescriptor } from '@topconsultnpm/sdk-ts';
3
3
  interface ITMDcmtBlogProps {
4
- blogsDatasource: HomeBlogPost[];
5
- setBlogsDatasource: (posts: HomeBlogPost[]) => void;
6
- hasLoadedDataOnce: boolean;
7
- setHasLoadedDataOnce: (loaded: boolean) => void;
8
- lastLoadedDid: number | undefined;
9
- setLastLoadedDid: (did: number | undefined) => void;
10
4
  tid: number | undefined;
11
5
  did: number | undefined;
12
- fetchBlogDataAsync: (tid: number | undefined, did: number | undefined) => Promise<void>;
13
6
  isVisible?: boolean;
7
+ fetchBlogDataTrigger?: number;
14
8
  allTasks?: Array<TaskDescriptor>;
15
9
  getAllTasks?: () => Promise<void>;
16
10
  deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
@@ -6,13 +6,40 @@ import { TMNothingToShow } from './TMDcmtPreview';
6
6
  import { IconBoard, SDKUI_Localizator } from '../../../helper';
7
7
  import TMBlogCommentForm from '../blog/TMBlogCommentForm';
8
8
  import TMBlogsPost from '../../grids/TMBlogsPost';
9
- const TMDcmtBlog = ({ blogsDatasource, setBlogsDatasource, hasLoadedDataOnce, setHasLoadedDataOnce, lastLoadedDid, setLastLoadedDid, tid, did, fetchBlogDataAsync, isVisible, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
9
+ import TMSpinner from '../../base/TMSpinner';
10
+ import { TMExceptionBoxManager } from '../../base/TMPopUp';
11
+ const TMDcmtBlog = ({ tid, did, isVisible, fetchBlogDataTrigger, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers }) => {
12
+ const [blogsDatasource, setBlogsDatasource] = useState([]);
13
+ const [hasLoadedDataOnce, setHasLoadedDataOnce] = useState(false); //traccia se *qualsiasi* dato è stato caricato per la prima volta
14
+ const [lastLoadedDid, setLastLoadedDid] = useState(undefined); // `lastLoadedDid` tiene traccia dell'ultimo `did` per cui abbiamo caricato i dati
10
15
  // State to manage show comment form selected file
11
16
  const [showCommentForm, setShowCommentForm] = useState(false);
12
17
  const [externalBlogPost, setExternalBlogPost] = useState(undefined);
18
+ const fetchBlogDataAsync = useCallback(async (tid, did) => {
19
+ try {
20
+ TMSpinner.show({ description: 'Caricamento - Bacheca...' });
21
+ const res = await SDK_Globals.tmSession?.NewSearchEngine().BlogRetrieveAsync(tid, did);
22
+ setBlogsDatasource(res ?? []);
23
+ setHasLoadedDataOnce(true);
24
+ setLastLoadedDid(did);
25
+ }
26
+ catch (e) {
27
+ let err = e;
28
+ TMExceptionBoxManager.show({ exception: err });
29
+ }
30
+ finally {
31
+ TMSpinner.hide();
32
+ }
33
+ }, []);
13
34
  const showCommentFormCallback = useCallback(() => {
14
35
  setShowCommentForm(true);
15
36
  }, []);
37
+ // useEffect per triggerare il fetch dall'esterno tramite props
38
+ useEffect(() => {
39
+ if (fetchBlogDataTrigger !== undefined && fetchBlogDataTrigger > 0) {
40
+ fetchBlogDataAsync(tid, did);
41
+ }
42
+ }, [fetchBlogDataTrigger, fetchBlogDataAsync, tid, did]);
16
43
  useEffect(() => {
17
44
  if (!tid || !did) {
18
45
  setBlogsDatasource([]);
@@ -21,7 +48,7 @@ const TMDcmtBlog = ({ blogsDatasource, setBlogsDatasource, hasLoadedDataOnce, se
21
48
  }
22
49
  // Condizione per eseguire il fetch:
23
50
  // 1. Il pannello è visibile
24
- // 2. E (non abbiamo ancora caricato dati O il `did` è cambiato rispetto all'ultima volta)
51
+ // 2. E (non abbiamo ancora caricato dati o il `did` è cambiato rispetto all'ultima volta)
25
52
  const shouldFetch = isVisible && (!hasLoadedDataOnce || did !== lastLoadedDid);
26
53
  // Esegui la chiamata API solo se il pannello è visibile E i dati non sono già stati caricati
27
54
  // O, se vuoi ricaricare ogni volta che diventa visibile (ma è meno efficiente per "pesante")