@topconsultnpm/sdkui-react 6.20.0-dev2.20 → 6.20.0-dev2.22

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.
@@ -21,7 +21,7 @@ const TMMetadataChooser = ({ tmSession, dataSource, showEditButton = true, butto
21
21
  return undefined;
22
22
  };
23
23
  const renderTemplate = useMemo(() => {
24
- return (_jsxs(StyledDivHorizontal, { style: { width: 'max-content', height: '100%' }, children: [values && values.length > 0 && values[0].mid && values[0].mid > 0 && _jsx(TMMidViewer, { tmSession: tmSession, tid_mid: values[0], showIcon: true, showId: showId, showCompleteName: showCompleteMetadataName }), values && values.length > 0 && values[0].mid && values[0].mid < 0 && _jsx(TMMidViewer, { tmSession: tmSession, tid_mid: values[0], inputMd: getinputMd(), showIcon: true, showId: showId, showCompleteName: showCompleteMetadataName }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` }), (values == undefined || values.length == 0) && _jsx("p", { children: placeHolder })] }));
24
+ return (_jsxs(StyledDivHorizontal, { style: { width: 'max-content', height: '100%' }, children: [values && values.length > 0 && values[0].mid && values[0].mid > 0 && _jsx(TMMidViewer, { tmSession: tmSession, tid_mid: values[0], showIcon: true, showId: showId, showCompleteName: showCompleteMetadataName }), values && values.length > 0 && values[0].mid && values[0].mid < 0 && _jsx(TMMidViewer, { tmSession: tmSession, tid_mid: values[0], inputMd: getinputMd(), showIcon: true, showId: showId, showCompleteName: showCompleteMetadataName }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` }), (values == undefined || values.length == 0) && _jsx("p", { children: placeHolder ?? SDKUI_Localizator.SelectMetadata })] }));
25
25
  }, [values, tmSession, showId, showCompleteMetadataName, placeHolder]);
26
26
  return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { label: label, width: width, height: height, disabled: disabled, validationItems: validationItems, backgroundColor: backgroundColor, buttons: buttons, placeHolder: placeHolder, fontSize: fontSize, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, showEditButton: showEditButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), openEditorOnSummaryClick: openEditorOnSummaryClick, onEditorClick: () => {
27
27
  if (!disabled) {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useEffect, useMemo, useState } from 'react';
3
3
  import Logo from '../../../assets/Toppy-generico.png';
4
- import { DcmtTypeListCacheService, LayoutModes, SDK_Localizator } from '@topconsultnpm/sdk-ts';
4
+ import { ArchiveConstraints, DcmtTypeListCacheService, LayoutModes, SDK_Localizator } from '@topconsultnpm/sdk-ts';
5
5
  import { IconTree, SDKUI_Globals, SDKUI_Localizator, IconRecentlyViewed, IconPreview, IconShow, IconBoard, IconDcmtTypeSys, removeMruTid, getMoreInfoTasksForDocument } from '../../../helper';
6
6
  import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
7
7
  import TMLayoutContainer from '../../base/TMLayout';
@@ -145,49 +145,36 @@ const TMArchive = ({ onDcmtTypeSelect = undefined, inputTID, inputFile = null, c
145
145
  export default TMArchive;
146
146
  const TMTreeSelectorWrapper = ({ isMobile, isSharedArchive, onSelectedTIDChanged }) => {
147
147
  const { setPanelVisibilityById, toggleMaximize, setToolbarButtonVisibility, countVisibleLeafPanels } = useTMPanelManagerContext();
148
- return (_jsx(TMTreeSelector, { layoutMode: LayoutModes.Ark, onClosePanel: !isMobile && countVisibleLeafPanels() > 1 ? () => setPanelVisibilityById('tmTreeSelector', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: !isMobile && countVisibleLeafPanels() > 1 ? () => toggleMaximize("tmTreeSelector") : undefined, onSelectedTIDChanged: (tid) => {
149
- onSelectedTIDChanged?.(tid);
150
- if (isMobile)
151
- setPanelVisibilityById('tmDcmtForm', true);
152
- else {
153
- setPanelVisibilityById('tmDcmtForm', true);
154
- if (!isSharedArchive) {
155
- setPanelVisibilityById('tmDcmtPreview', true);
156
- }
157
- }
158
- if (!isSharedArchive) {
159
- setToolbarButtonVisibility('tmDcmtPreview', true);
160
- }
161
- setToolbarButtonVisibility('tmDcmtForm', true);
162
- } }));
148
+ const updatePanelsVisibility = async (tid) => {
149
+ if (!tid)
150
+ return;
151
+ const dtd = await DcmtTypeListCacheService.GetAsync(tid);
152
+ const isOnlyMetadata = dtd?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
153
+ const previewVisible = !isSharedArchive && !isOnlyMetadata;
154
+ setPanelVisibilityById('tmDcmtPreview', previewVisible);
155
+ setToolbarButtonVisibility('tmDcmtPreview', previewVisible);
156
+ setPanelVisibilityById('tmDcmtForm', true);
157
+ setToolbarButtonVisibility('tmDcmtForm', true);
158
+ };
159
+ return (_jsx(TMTreeSelector, { layoutMode: LayoutModes.Ark, onClosePanel: !isMobile && countVisibleLeafPanels() > 1 ? () => setPanelVisibilityById('tmTreeSelector', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: !isMobile && countVisibleLeafPanels() > 1 ? () => toggleMaximize("tmTreeSelector") : undefined, onSelectedTIDChanged: async (tid) => { updatePanelsVisibility(tid); onSelectedTIDChanged?.(tid); } }));
163
160
  };
164
161
  const TMRecentsManagerWrapper = ({ mruTIDs, currentTID, currentMruTID, deviceType, isSharedArchive, onSelectedTID, onDeletedTID }) => {
165
162
  const { setPanelVisibilityById, setToolbarButtonVisibility } = useTMPanelManagerContext();
163
+ // This avoids unnecessary re-renders by only recalculating when deviceType changes.
164
+ let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
165
+ const updatePanelsVisibility = async (tid) => {
166
+ if (!tid)
167
+ return;
168
+ const dtd = await DcmtTypeListCacheService.GetAsync(tid);
169
+ const isOnlyMetadata = dtd?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
170
+ const previewVisible = !isSharedArchive && !isOnlyMetadata;
171
+ setPanelVisibilityById('tmDcmtPreview', previewVisible);
172
+ setToolbarButtonVisibility('tmDcmtPreview', previewVisible);
173
+ setPanelVisibilityById('tmDcmtForm', true);
174
+ setToolbarButtonVisibility('tmDcmtForm', true);
175
+ };
166
176
  useEffect(() => {
167
- if (currentTID) {
168
- setPanelVisibilityById('tmDcmtForm', true);
169
- if (!isSharedArchive) {
170
- setToolbarButtonVisibility('tmDcmtPreview', true);
171
- }
172
- setToolbarButtonVisibility('tmDcmtForm', true);
173
- }
174
- }, [currentTID, isSharedArchive]);
175
- return (_jsx(TMRecentsManager, { accessFilter: 'canArchive', mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
176
- onSelectedTID?.(tid);
177
- if (deviceType === DeviceType.MOBILE) {
178
- setPanelVisibilityById('tmDcmtForm', true);
179
- }
180
- else {
181
- setPanelVisibilityById('tmDcmtForm', true);
182
- if (!isSharedArchive) {
183
- setPanelVisibilityById('tmDcmtPreview', true);
184
- }
185
- }
186
- if (!isSharedArchive) {
187
- setToolbarButtonVisibility('tmDcmtPreview', true);
188
- }
189
- setToolbarButtonVisibility('tmDcmtForm', true);
190
- }, onDeletedTID: (tid) => {
191
- onDeletedTID?.(tid);
192
- } }));
177
+ updatePanelsVisibility(currentTID);
178
+ }, [currentTID, isSharedArchive, isMobile]);
179
+ return (_jsx(TMRecentsManager, { accessFilter: "canArchive", mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: async (tid) => { await updatePanelsVisibility(tid); onSelectedTID?.(tid); }, onDeletedTID: onDeletedTID }));
193
180
  };
@@ -569,6 +569,7 @@ export declare class SDKUI_Localizator {
569
569
  static get SelectArchiveToStart(): "Klicken Sie auf Archivieren, um zu beginnen." | "Click on Archive button to start." | "Haz clic en el botón Archivar para comenzar." | "Cliquez sur le bouton Archiver pour commencer." | "Clique no botão Arquivar para iniciar." | "Clicca sul pulsante Archivia per iniziare.";
570
570
  static get SelectAttachToStart(): "Sie können Dateien zu Ihrer E-Mail hinzufügen, klicken Sie auf Anhängen, um zu beginnen." | "You can attach files to your email, click on Attach button to start." | "Puedes adjuntar archivos a tu correo electrónico, haz clic en el botón Adjuntar para comenzar." | "Vous pouvez joindre des fichiers à votre e-mail, cliquez sur le bouton Joindre pour commencer." | "Você pode anexar arquivos ao seu e-mail, clique no botão Anexar para iniciar." | "Puoi allegare file alla tua email, clicca sul pulsante Allega per iniziare.";
571
571
  static get SelectFromAttachments(): "Aus Anhängen auswählen" | "Select from attachments" | "Seleccionar de archivos adjuntos" | "Sélectionner parmi les pièces jointes" | "Selecionar dos anexos" | "Seleziona dagli allegati";
572
+ static get SelectMetadata(): "Metadaten auswählen" | "Select metadata" | "Seleccionar metadatos" | "Sélectionner les métadonnées" | "Selecionar metadados" | "Seleziona metadato";
572
573
  static get SelectSupportAreaMessage(): "Wählen Sie einen Ablagebereich aus" | "Select a support area" | "Seleccione un área de apoyo" | "Sélectionnez une zone de support" | "Selecione uma área de apoio" | "Selezionare un'area di appoggio";
573
574
  static get SelectedSingular(): string;
574
575
  static get Selected(): "Ausgewählt" | "Selected" | "Sélectionné" | "Selecionado" | "Seleccionados" | "Selezionati";
@@ -5661,6 +5661,16 @@ export class SDKUI_Localizator {
5661
5661
  default: return "Seleziona dagli allegati";
5662
5662
  }
5663
5663
  }
5664
+ static get SelectMetadata() {
5665
+ switch (this._cultureID) {
5666
+ case CultureIDs.De_DE: return "Metadaten auswählen";
5667
+ case CultureIDs.En_US: return "Select metadata";
5668
+ case CultureIDs.Es_ES: return "Seleccionar metadatos";
5669
+ case CultureIDs.Fr_FR: return "Sélectionner les métadonnées";
5670
+ case CultureIDs.Pt_PT: return "Selecionar metadados";
5671
+ default: return "Seleziona metadato";
5672
+ }
5673
+ }
5664
5674
  static get SelectSupportAreaMessage() {
5665
5675
  switch (this._cultureID) {
5666
5676
  case CultureIDs.De_DE: return "Wählen Sie einen Ablagebereich aus";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev2.20",
3
+ "version": "6.20.0-dev2.22",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",