@topconsultnpm/sdkui-react-beta 6.16.71 → 6.16.73
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.
|
@@ -95,6 +95,8 @@ interface TMBlogsProps {
|
|
|
95
95
|
shouldSelectLastBlog?: boolean;
|
|
96
96
|
/** Updates the flag that determines if the blog component should automatically select the last blog. */
|
|
97
97
|
updateShouldSelectLastBlog?: (value: boolean) => void;
|
|
98
|
+
/** Refresh Home Page News Callback */
|
|
99
|
+
refreshHomePageNews?: () => Promise<void>;
|
|
98
100
|
}
|
|
99
101
|
declare const TMBlogs: (props: TMBlogsProps) => import("react/jsx-runtime").JSX.Element;
|
|
100
102
|
export default TMBlogs;
|
|
@@ -17,6 +17,7 @@ import { useDcmtOperations } from '../../hooks/useDcmtOperations';
|
|
|
17
17
|
import { DownloadTypes } from '../../ts';
|
|
18
18
|
import TMDcmtForm from '../features/documents/TMDcmtForm';
|
|
19
19
|
import { TMColors } from '../../utils/theme';
|
|
20
|
+
import ShowAlert from '../base/TMAlert';
|
|
20
21
|
let localAbortController = new AbortController();
|
|
21
22
|
const TMBlogs = (props) => {
|
|
22
23
|
const { id, allData, showExtendedAttachments = true, treeFs, draftLatestInfoMap, archivedDocumentMap, updateVisualizedBlogCallback, height, width, scrollToBottom = true, header, showIconHeader = true, color = colors.PRIMARY_BLUE, handleNavigateToWGs, showId, setShowId, contextMenuParams = {
|
|
@@ -30,7 +31,7 @@ const TMBlogs = (props) => {
|
|
|
30
31
|
isRestoreEnabled: false,
|
|
31
32
|
isRefreshEnabled: false,
|
|
32
33
|
isCreateContextualTask: false,
|
|
33
|
-
}, refreshCallback, showCommentFormCallback, showTaskFormCallback, handleAttachmentFocus, showFloatingCommentButton = false, context, layoutMode = 'stacked', markBlogAsRead, shouldSelectLastBlog = false, updateShouldSelectLastBlog } = props;
|
|
34
|
+
}, refreshCallback, showCommentFormCallback, showTaskFormCallback, handleAttachmentFocus, showFloatingCommentButton = false, context, layoutMode = 'stacked', markBlogAsRead, shouldSelectLastBlog = false, updateShouldSelectLastBlog, refreshHomePageNews } = props;
|
|
34
35
|
const [uiId, setUiId] = useState('');
|
|
35
36
|
// Get the current device type (e.g., mobile, tablet, desktop) using a custom hook.
|
|
36
37
|
const deviceType = useDeviceType();
|
|
@@ -207,6 +208,36 @@ const TMBlogs = (props) => {
|
|
|
207
208
|
TMResultManager.show(result, SDKUI_Localizator.CopyToClipboard, "ID", undefined);
|
|
208
209
|
});
|
|
209
210
|
};
|
|
211
|
+
const unFollowCallback = async (blog, classId) => {
|
|
212
|
+
const title = SDKUI_Localizator.Unfollow;
|
|
213
|
+
const header = blog.header ?? undefined;
|
|
214
|
+
const message = header ? SDKUI_Localizator.UnfollowSelectedItem.replaceParams(header) : SDKUI_Localizator.Unfollow + "?";
|
|
215
|
+
TMMessageBoxManager.show({
|
|
216
|
+
title, message, buttons: [ButtonNames.YES, ButtonNames.NO],
|
|
217
|
+
confirmOnEnter: true,
|
|
218
|
+
onButtonClick: async (e) => {
|
|
219
|
+
if (e !== ButtonNames.YES)
|
|
220
|
+
return;
|
|
221
|
+
let result = [];
|
|
222
|
+
switch (classId) {
|
|
223
|
+
case 'WG':
|
|
224
|
+
const workingGroupEngine = new WorkingGroupEngine(SDK_Globals.tmSession);
|
|
225
|
+
await workingGroupEngine.FollowAddOrRemoveAsync(blog.id, true).then(async () => {
|
|
226
|
+
result.push({ rowIndex: blog.id, id1: blog.id, id2: blog.id, description: SDKUI_Localizator.OperationSuccess, resultType: ResultTypes.SUCCESS });
|
|
227
|
+
refreshHomePageNews?.();
|
|
228
|
+
})
|
|
229
|
+
.catch((err) => {
|
|
230
|
+
result.push({ rowIndex: blog.id, id1: blog.id, id2: blog.id, resultType: ResultTypes.ERROR, description: getExceptionMessage(err) });
|
|
231
|
+
});
|
|
232
|
+
break;
|
|
233
|
+
default:
|
|
234
|
+
ShowAlert({ message: 'TODO', mode: 'warning', title: SDKUI_Localizator.Unfollow, duration: 3000 });
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
TMResultManager.show(result, SDKUI_Localizator.Unfollow, "ID", undefined);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
};
|
|
210
241
|
// ContexMenuItems array contains a list of context menu items for a blog
|
|
211
242
|
const contextMenuItems = useMemo(() => {
|
|
212
243
|
// customData1 === 1 means the group is archived (historical)
|
|
@@ -215,6 +246,7 @@ const TMBlogs = (props) => {
|
|
|
215
246
|
const isNotOwner = focusedBlog && focusedBlog.ownerID !== userId;
|
|
216
247
|
const isDeleted = focusedBlog && (focusedBlog.isDel !== undefined && focusedBlog.isDel !== 0);
|
|
217
248
|
const isInvalid = focusedBlog === undefined;
|
|
249
|
+
const classId = focusedBlog ? focusedBlog.classID : undefined;
|
|
218
250
|
let menuItemsElements = [
|
|
219
251
|
{
|
|
220
252
|
icon: "download",
|
|
@@ -269,6 +301,12 @@ const TMBlogs = (props) => {
|
|
|
269
301
|
disabled: isGroupArchived ? true : false,
|
|
270
302
|
beginGroup: true
|
|
271
303
|
},
|
|
304
|
+
{
|
|
305
|
+
icon: "eyeclose",
|
|
306
|
+
text: SDKUI_Localizator.Unfollow,
|
|
307
|
+
visible: Boolean(classId && classId === 'WG'),
|
|
308
|
+
onClick: () => focusedBlog && classId && unFollowCallback(focusedBlog, classId),
|
|
309
|
+
},
|
|
272
310
|
{
|
|
273
311
|
icon: isHeaderHidden ? 'eyeopen' : 'eyeclose',
|
|
274
312
|
text: isHeaderHidden ? SDKUI_Localizator.ShowFilters : SDKUI_Localizator.HideFilters,
|
|
@@ -292,7 +330,7 @@ const TMBlogs = (props) => {
|
|
|
292
330
|
disabled: false,
|
|
293
331
|
},
|
|
294
332
|
];
|
|
295
|
-
return menuItemsElements;
|
|
333
|
+
return menuItemsElements.filter(item => item.visible);
|
|
296
334
|
}, [isHeaderHidden, localShowId, setLocalShowId, focusedBlog, focusedAttachment, showDcmtForm]);
|
|
297
335
|
useEffect(() => {
|
|
298
336
|
setUiId(genUniqueId());
|
|
@@ -509,6 +509,8 @@ export declare class SDKUI_Localizator {
|
|
|
509
509
|
static get UBLViewFormats_NSO_PDF(): "NSO Style Sheet (PDF)" | "Hoja de estilo NSO (PDF)" | "Feuille de style NSO (PDF)" | "Folha de estilo NSO (PDF)" | "Foglio di stile NSO (PDF)";
|
|
510
510
|
static get UnableToGetUpdatedDocumentContent(): "Aktualisierter Dokumentinhalt kann nicht abgerufen werden" | "Unable to get updated document content" | "No se puede obtener el contenido actualizado del documento" | "Impossible d'obtenir le contenu mis à jour du document" | "Não é possível obter o conteúdo atualizado do documento" | "Impossibile ottenere il contenuto aggiornato del documento";
|
|
511
511
|
static get Undo(): "Änderungen rückgängig machen" | "Undo" | "Anular modificaciones" | "Annule les modifications" | "Anular alterações" | "Annulla modifiche";
|
|
512
|
+
static get Unfollow(): "Nicht mehr folgen" | "Unfollow" | "Dejar de seguir" | "Ne plus suivre" | "Deixar de seguir" | "Non seguire più";
|
|
513
|
+
static get UnfollowSelectedItem(): string;
|
|
512
514
|
static get Update(): "Bearbeiten" | "Update" | "Modificar" | "Modifie" | "Modificação" | "Modifica";
|
|
513
515
|
static get UpdateCompletedSuccessfully(): "Aktualisierung erfolgreich abgeschlossen" | "Update completed successfully" | "Actualización completada con éxito" | "Mise à jour terminée avec succès" | "Atualização concluída com sucesso" | "Aggiornamento completato con successo";
|
|
514
516
|
static get UpdateIn(): "interrumpir" | "Aktualisierung in" | "Update in" | "Mettre à jour dans" | "Atualizar em" | "Aggiorna in";
|
|
@@ -5055,6 +5055,32 @@ export class SDKUI_Localizator {
|
|
|
5055
5055
|
default: return "Annulla modifiche";
|
|
5056
5056
|
}
|
|
5057
5057
|
}
|
|
5058
|
+
static get Unfollow() {
|
|
5059
|
+
switch (this._cultureID) {
|
|
5060
|
+
case CultureIDs.De_DE: return "Nicht mehr folgen";
|
|
5061
|
+
case CultureIDs.En_US: return "Unfollow";
|
|
5062
|
+
case CultureIDs.Es_ES: return "Dejar de seguir";
|
|
5063
|
+
case CultureIDs.Fr_FR: return "Ne plus suivre";
|
|
5064
|
+
case CultureIDs.Pt_PT: return "Deixar de seguir";
|
|
5065
|
+
default: return "Non seguire più";
|
|
5066
|
+
}
|
|
5067
|
+
}
|
|
5068
|
+
static get UnfollowSelectedItem() {
|
|
5069
|
+
switch (this._cultureID) {
|
|
5070
|
+
case CultureIDs.De_DE:
|
|
5071
|
+
return "Möchten Sie das ausgewählte Element \"{{0}}\" nicht mehr folgen?";
|
|
5072
|
+
case CultureIDs.En_US:
|
|
5073
|
+
return "Unfollow the selected item \"{{0}}\"?";
|
|
5074
|
+
case CultureIDs.Es_ES:
|
|
5075
|
+
return "¿Dejar de seguir el elemento seleccionado \"{{0}}\"?";
|
|
5076
|
+
case CultureIDs.Fr_FR:
|
|
5077
|
+
return "Ne plus suivre l'élément sélectionné \"{{0}}\" ?";
|
|
5078
|
+
case CultureIDs.Pt_PT:
|
|
5079
|
+
return "Deixar de seguir o item selecionado \"{{0}}\"?";
|
|
5080
|
+
default:
|
|
5081
|
+
return "Non seguire più l'elemento selezionato \"{{0}}\"?";
|
|
5082
|
+
}
|
|
5083
|
+
}
|
|
5058
5084
|
static get Update() {
|
|
5059
5085
|
switch (this._cultureID) {
|
|
5060
5086
|
case CultureIDs.De_DE: return "Bearbeiten";
|