@topconsultnpm/sdkui-react 6.20.0-dev1.6 → 6.20.0-dev1.9

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.
@@ -136,32 +136,32 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
136
136
  const [blobUrl, setBlobUrl] = useState(undefined);
137
137
  const [fileType, setFileType] = useState(undefined);
138
138
  const [formattedXml, setFormattedXml] = useState(undefined);
139
- const [isMobile, setIsMobile] = useState(false);
140
- useEffect(() => {
141
- const checkIsMobile = () => {
142
- const userAgent = navigator.userAgent || navigator.vendor || window.opera;
143
- // Only detect actual mobile/tablet devices, NOT desktop browsers
144
- const isMobileDevice =
145
- // Traditional mobile detection (phones and tablets)
146
- /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) ||
147
- // Additional Android tablet detection (covers tablets in landscape)
148
- /android.*tablet|android.*mobile/i.test(userAgent) ||
149
- // Touch-only devices (excludes laptops with touchscreen)
150
- (('ontouchstart' in window || navigator.maxTouchPoints > 0) &&
151
- !/Windows NT|Macintosh|Linux/.test(userAgent)) ||
152
- // Small screen mobile devices only
153
- (window.screen.width <= 768 && /Mobi|Android/i.test(userAgent));
154
- setIsMobile(isMobileDevice);
155
- };
156
- checkIsMobile();
157
- // Listen for orientation changes (important for tablets)
158
- window.addEventListener('orientationchange', checkIsMobile);
159
- window.addEventListener('resize', checkIsMobile);
160
- return () => {
161
- window.removeEventListener('orientationchange', checkIsMobile);
162
- window.removeEventListener('resize', checkIsMobile);
163
- };
164
- }, []);
139
+ // const [isMobile, setIsMobile] = useState<boolean>(false);
140
+ // useEffect(() => {
141
+ // const checkIsMobile = () => {
142
+ // const userAgent = navigator.userAgent || navigator.vendor || (window as any).opera;
143
+ // // Only detect actual mobile/tablet devices, NOT desktop browsers
144
+ // const isMobileDevice =
145
+ // // Traditional mobile detection (phones and tablets)
146
+ // /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent) ||
147
+ // // Additional Android tablet detection (covers tablets in landscape)
148
+ // /android.*tablet|android.*mobile/i.test(userAgent) ||
149
+ // // Touch-only devices (excludes laptops with touchscreen)
150
+ // (('ontouchstart' in window || navigator.maxTouchPoints > 0) &&
151
+ // !/Windows NT|Macintosh|Linux/.test(userAgent)) ||
152
+ // // Small screen mobile devices only
153
+ // (window.screen.width <= 768 && /Mobi|Android/i.test(userAgent));
154
+ // setIsMobile(isMobileDevice);
155
+ // };
156
+ // checkIsMobile();
157
+ // // Listen for orientation changes (important for tablets)
158
+ // window.addEventListener('orientationchange', checkIsMobile);
159
+ // window.addEventListener('resize', checkIsMobile);
160
+ // return () => {
161
+ // window.removeEventListener('orientationchange', checkIsMobile);
162
+ // window.removeEventListener('resize', checkIsMobile);
163
+ // };
164
+ // }, []);
165
165
  useEffect(() => {
166
166
  if (fileBlob) {
167
167
  setFileType(fileBlob.type);
@@ -222,38 +222,73 @@ export const TMFileViewer = ({ fileBlob, isResizingActive }) => {
222
222
  if (fileBlob.type.includes('image')) {
223
223
  return (_jsx(ImageViewer, { fileBlob: fileBlob, alt: '' }));
224
224
  }
225
- if (fileType === 'application/pdf' && isMobile) {
226
- return (_jsx("object", { data: blobUrl, type: "application/pdf", width: "100%", height: "100%", style: {
227
- border: 'none',
228
- zIndex: 0,
229
- pointerEvents: isResizingActive === true ? "none" : "auto"
230
- }, children: _jsxs("div", { style: {
231
- padding: '40px',
232
- textAlign: 'center',
233
- display: 'flex',
234
- flexDirection: 'column',
235
- alignItems: 'center',
236
- justifyContent: 'center',
237
- height: '100%',
238
- gap: '20px'
239
- }, children: [_jsx(IconPreview, { fontSize: 96 }), _jsxs("div", { children: [_jsx("h3", { children: SDKUI_Localizator.PDFDocument }), _jsx("p", { children: SDKUI_Localizator.PreviewNotAvailableOnDevice })] }), _jsxs("div", { style: { display: 'flex', gap: '10px', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center' }, children: [_jsx("a", { href: blobUrl, download: "document.pdf", style: {
240
- minWidth: '180px',
241
- padding: '12px 24px',
242
- backgroundColor: TMColors.primaryColor,
243
- color: 'white',
244
- textDecoration: 'none',
245
- borderRadius: '4px',
246
- display: 'inline-block'
247
- }, children: SDKUI_Localizator.DownloadFile }), _jsx("a", { href: blobUrl, target: "_blank", rel: "noopener noreferrer", style: {
248
- minWidth: '180px',
249
- padding: '12px 24px',
250
- backgroundColor: TMColors.primaryColor,
251
- color: 'white',
252
- textDecoration: 'none',
253
- borderRadius: '4px',
254
- display: 'inline-block'
255
- }, children: SDKUI_Localizator.OpenInNewTab })] })] }) }, blobUrl));
256
- }
225
+ // if (fileType === 'application/pdf' && isMobile) {
226
+ // return (
227
+ // <object
228
+ // key={blobUrl}
229
+ // data={blobUrl}
230
+ // type="application/pdf"
231
+ // width="100%"
232
+ // height="100%"
233
+ // style={{
234
+ // border: 'none',
235
+ // zIndex: 0,
236
+ // pointerEvents: isResizingActive === true ? "none" : "auto"
237
+ // }}
238
+ // >
239
+ // {/* Fallback UI if <object> tag fails to render PDF */}
240
+ // <div style={{
241
+ // padding: '40px',
242
+ // textAlign: 'center',
243
+ // display: 'flex',
244
+ // flexDirection: 'column',
245
+ // alignItems: 'center',
246
+ // justifyContent: 'center',
247
+ // height: '100%',
248
+ // gap: '20px'
249
+ // }}>
250
+ // <IconPreview fontSize={96} />
251
+ // <div>
252
+ // <h3>{SDKUI_Localizator.PDFDocument}</h3>
253
+ // <p>{SDKUI_Localizator.PreviewNotAvailableOnDevice}</p>
254
+ // </div>
255
+ // <div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center' }}>
256
+ // <a
257
+ // href={blobUrl}
258
+ // download="document.pdf"
259
+ // style={{
260
+ // minWidth: '180px',
261
+ // padding: '12px 24px',
262
+ // backgroundColor: TMColors.primaryColor,
263
+ // color: 'white',
264
+ // textDecoration: 'none',
265
+ // borderRadius: '4px',
266
+ // display: 'inline-block'
267
+ // }}
268
+ // >
269
+ // {SDKUI_Localizator.DownloadFile}
270
+ // </a>
271
+ // <a
272
+ // href={blobUrl}
273
+ // target="_blank"
274
+ // rel="noopener noreferrer"
275
+ // style={{
276
+ // minWidth: '180px',
277
+ // padding: '12px 24px',
278
+ // backgroundColor: TMColors.primaryColor,
279
+ // color: 'white',
280
+ // textDecoration: 'none',
281
+ // borderRadius: '4px',
282
+ // display: 'inline-block'
283
+ // }}
284
+ // >
285
+ // {SDKUI_Localizator.OpenInNewTab}
286
+ // </a>
287
+ // </div>
288
+ // </div>
289
+ // </object>
290
+ // );
291
+ // }
257
292
  return (_jsx("iframe", { srcDoc: formattedXml ? `<html><body>${formattedXml}</body></html>` : undefined, src: !formattedXml
258
293
  ? (fileType === 'application/pdf' ? `${blobUrl}#view=FitH&scrollbar=1` : blobUrl)
259
294
  : undefined, title: "File Viewer", width: "100%", height: "100%", style: { border: 'none', zIndex: 0, pointerEvents: isResizingActive === true ? "none" : "auto" } }, blobUrl));
@@ -43,7 +43,7 @@ import { TMResultManager } from '../../forms/TMResultDialog';
43
43
  import TMCustomButton from '../../base/TMCustomButton';
44
44
  import ToppyDraggableHelpCenter from '../assistant/ToppyDraggableHelpCenter';
45
45
  import TMSignSettingsForm from './TMSignSettingsForm';
46
- import { getDcmtCicoStatus, cicoDownloadFilesCallback, getCicoDownloadFileName, renderCicoCheckInContent, validateCicoFileName, updateCheckoutItem } from '../../../helper/checkinCheckoutManager';
46
+ import { getDcmtCicoStatus, cicoDownloadFilesCallback, getCicoDownloadFileName, renderCicoCheckInContent, validateCicoFileName, updateCicoCheckoutStorageItem } from '../../../helper/checkinCheckoutManager';
47
47
  import TMSearchResultCheckoutInfoForm from './TMSearchResultCheckoutInfoForm';
48
48
  import TMViewHistoryDcmt from './TMViewHistoryDcmt';
49
49
  import TMBlogCommentForm from '../blog/TMBlogCommentForm';
@@ -468,7 +468,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
468
468
  .then(async () => {
469
469
  result.push({ rowIndex: i, id1: firstDoc.TID, id2: firstDoc.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
470
470
  // Remove the corresponding draft checkout item
471
- updateCheckoutItem({ TID: firstDoc.TID.toString(), DID: firstDoc.DID.toString(), checkoutFolder: "", checkoutName: "" }, "dcmtInfo", "remove");
471
+ updateCicoCheckoutStorageItem({ TID: firstDoc.TID.toString(), DID: firstDoc.DID.toString(), checkoutFolder: "", checkoutName: "" }, "dcmtInfo", "remove");
472
472
  await refreshFocusedDataRowAsync(firstDoc.TID, firstDoc.DID, true);
473
473
  })
474
474
  .catch((error) => {
@@ -541,7 +541,7 @@ const TMSearchResult = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, a
541
541
  ue.DID = firstDoc.DID;
542
542
  await ue.CheckInAsync(file, "", abortControllerLocal.signal);
543
543
  // Remove the corresponding draft checkout item
544
- updateCheckoutItem({ TID: firstDoc.TID.toString(), DID: firstDoc.DID.toString(), checkoutFolder: "", checkoutName: "" }, "dcmtInfo", "remove");
544
+ updateCicoCheckoutStorageItem({ TID: firstDoc.TID.toString(), DID: firstDoc.DID.toString(), checkoutFolder: "", checkoutName: "" }, "dcmtInfo", "remove");
545
545
  result.push({ rowIndex: i, id1: firstDoc.DID, id2: firstDoc.DID, description: SDKUI_Localizator.UpdateCompletedSuccessfully, resultType: ResultTypes.SUCCESS });
546
546
  await refreshFocusedDataRowAsync(firstDoc.TID, firstDoc.DID, true);
547
547
  const cacheKey = `${firstDoc.TID}-${firstDoc.DID}`;
@@ -5,7 +5,7 @@ import { IconBxInfo, IconFileDots, IconFolder, SDKUI_Globals, SDKUI_Localizator
5
5
  import { FormModes } from "../../../ts";
6
6
  import { ResultTypes, ValidationItem } from "@topconsultnpm/sdk-ts";
7
7
  import { SaveFormOptions, useSaveForm } from "../../../hooks/useForm";
8
- import { getCicoDownloadFileName, updateCheckoutItem } from "../../../helper/checkinCheckoutManager";
8
+ import { getCicoDownloadFileName, updateCicoCheckoutStorageItem } from "../../../helper/checkinCheckoutManager";
9
9
  import { TMColors } from "../../../utils/theme";
10
10
  import TMLayoutContainer, { TMLayoutItem } from "../../base/TMLayout";
11
11
  import TMTooltip from "../../base/TMTooltip";
@@ -57,13 +57,8 @@ const TMSearchResultCheckoutInfoForm = (props) => {
57
57
  // Check: formData must exist, selectedDcmtOrFocused.TID and selectedDcmtOrFocused.DID must exist, and at least one of checkoutFolder or checkoutName must be filled
58
58
  if (formData && selectedDcmtOrFocused.TID && selectedDcmtOrFocused.DID) {
59
59
  // Create a new draft checkout item with TID, DID, and folder/name values
60
- const newItem = {
61
- TID: selectedDcmtOrFocused.TID.toString(),
62
- DID: selectedDcmtOrFocused.DID.toString(),
63
- checkoutFolder: formData.checkoutFolder ?? "",
64
- checkoutName: formData.checkoutName ?? ""
65
- };
66
- updateCheckoutItem(newItem, "dcmtInfo", "addOrUpdate");
60
+ const newItem = { TID: selectedDcmtOrFocused.TID.toString(), DID: selectedDcmtOrFocused.DID.toString(), checkoutFolder: formData.checkoutFolder ?? "", checkoutName: formData.checkoutName ?? "" };
61
+ updateCicoCheckoutStorageItem(newItem, "dcmtInfo", "addOrUpdate");
67
62
  onClose();
68
63
  ShowAlert({ mode: 'success', title: SDKUI_Localizator.CheckoutInfo, message: SDKUI_Localizator.OperationSuccess, duration: 3000 });
69
64
  }
@@ -29,7 +29,7 @@ export type DownloadSource = {
29
29
  };
30
30
  export declare const getCicoDownloadFileName: (source: DownloadSource, checkout: boolean, withTimestampAndExt: boolean) => string;
31
31
  export declare const cicoDownloadFilesCallback: (sources: Array<DownloadSource>, checkout: boolean, downloadDcmtsAsync: (inputDcmts: Array<DcmtInfo> | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean) => Promise<void>) => Promise<void>;
32
- export declare const updateCheckoutItem: (item: CheckoutInfo, type: "fileItem" | "dcmtInfo", action?: "addOrUpdate" | "remove") => void;
32
+ export declare const updateCicoCheckoutStorageItem: (item: CheckoutInfo, type: "fileItem" | "dcmtInfo", action?: "addOrUpdate" | "remove") => void;
33
33
  export declare const validateCicoFileName: (source: DownloadSource, fileName: string) => FileNameValidation;
34
34
  type ValidationResult = {
35
35
  expected: string | number | undefined;
@@ -64,13 +64,8 @@ export const cicoDownloadFilesCallback = async (sources, checkout, downloadDcmts
64
64
  if (tid && did && ext) {
65
65
  let fileName = getCicoDownloadFileName(source, checkout, true);
66
66
  if (checkout) {
67
- const newItem = {
68
- TID: tid.toString(),
69
- DID: did.toString(),
70
- checkoutFolder: "",
71
- checkoutName: fileName
72
- };
73
- updateCheckoutItem(newItem, source.type, "addOrUpdate");
67
+ const newItem = { TID: tid.toString(), DID: did.toString(), checkoutFolder: "", checkoutName: fileName };
68
+ updateCicoCheckoutStorageItem(newItem, source.type, "addOrUpdate");
74
69
  }
75
70
  files.push({ TID: tid, DID: did, FILEEXT: ext, fileName });
76
71
  }
@@ -78,7 +73,7 @@ export const cicoDownloadFilesCallback = async (sources, checkout, downloadDcmts
78
73
  if (files.length > 0)
79
74
  await downloadDcmtsAsync(files, DownloadTypes.Dcmt, "download");
80
75
  };
81
- export const updateCheckoutItem = (item, type, action = "addOrUpdate") => {
76
+ export const updateCicoCheckoutStorageItem = (item, type, action = "addOrUpdate") => {
82
77
  // Select the appropriate array based on type
83
78
  const currentItems = type === 'dcmtInfo' ? [...SDKUI_Globals.userSettings.dcmtCheckoutInfo] : [...SDKUI_Globals.userSettings.wgDraftCheckoutInfo];
84
79
  // Find the index of an existing item that has the same TID and DID as the new item
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.6",
3
+ "version": "6.20.0-dev1.9",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",