tsv2-library 1.0.61-alpha.63 → 1.0.61-alpha.65
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.
|
@@ -6,5 +6,5 @@ export declare const buildFileURL: (name?: string, width?: number, height?: numb
|
|
|
6
6
|
* @param immediateRevoke Immediately revoke the object URL after download - default to true
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
export declare const downloadFile: (fileUrl: string, customFileName?: string, immediateRevoke?: boolean) => Promise<string>;
|
|
9
|
+
export declare const downloadFile: (fileUrl: string, customFileName?: string, immediateRevoke?: boolean, viewNewTab?: boolean) => Promise<string>;
|
|
10
10
|
export declare const getImageURL: (name?: string | null, width?: number, height?: number, returnURLOnly?: boolean) => Promise<string | undefined>;
|
package/dist/tsv2-library.es.js
CHANGED
|
@@ -19603,12 +19603,14 @@ const buildFileURL = (name, width2, height) => {
|
|
|
19603
19603
|
return url;
|
|
19604
19604
|
};
|
|
19605
19605
|
const getFilenameFromResponse = (response) => {
|
|
19606
|
-
const contentDisposition = response.headers["
|
|
19606
|
+
const contentDisposition = response.headers["content-disposition"];
|
|
19607
19607
|
if (!contentDisposition)
|
|
19608
|
-
return
|
|
19608
|
+
return void 0;
|
|
19609
19609
|
const quotedFilenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
|
19610
19610
|
const quotedMatch = contentDisposition.match(quotedFilenameRegex);
|
|
19611
|
-
|
|
19611
|
+
if (quotedMatch) {
|
|
19612
|
+
return decodeURIComponent(quotedMatch[1].replace(/['"]/g, ""));
|
|
19613
|
+
}
|
|
19612
19614
|
};
|
|
19613
19615
|
const getAuthToken = () => {
|
|
19614
19616
|
const user = JSON.parse(localStorage.getItem("user") ?? "{}");
|
|
@@ -19623,19 +19625,19 @@ const fetchFile = async (url, token) => {
|
|
|
19623
19625
|
});
|
|
19624
19626
|
return {
|
|
19625
19627
|
blob: new Blob([res.data], {
|
|
19626
|
-
type: res.headers["
|
|
19628
|
+
type: res.headers["content-type"] || "image/webp"
|
|
19627
19629
|
}),
|
|
19628
19630
|
fileName: getFilenameFromResponse(res)
|
|
19629
19631
|
};
|
|
19630
19632
|
};
|
|
19631
|
-
const downloadFile = async (fileUrl, customFileName, immediateRevoke = true) => {
|
|
19633
|
+
const downloadFile = async (fileUrl, customFileName, immediateRevoke = true, viewNewTab = false) => {
|
|
19632
19634
|
const token = getAuthToken();
|
|
19633
19635
|
const { blob: blob2, fileName: fetchFileName } = await fetchFile(fileUrl, token);
|
|
19634
19636
|
let objectUrl = "";
|
|
19635
19637
|
const isViewable = /^(image|application\/pdf)/i.test(blob2.type);
|
|
19636
19638
|
const fileName = customFileName ?? fetchFileName;
|
|
19637
19639
|
if (fileName) {
|
|
19638
|
-
if (isViewable) {
|
|
19640
|
+
if (isViewable && viewNewTab) {
|
|
19639
19641
|
const file = new File([blob2], fileName, {
|
|
19640
19642
|
type: blob2.type
|
|
19641
19643
|
});
|
|
@@ -51983,7 +51985,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
51983
51985
|
var _a;
|
|
51984
51986
|
return {
|
|
51985
51987
|
...props.defaultQueryParams,
|
|
51986
|
-
search: (_a = props.search) == null ? void 0 : _a.trim(),
|
|
51988
|
+
search: props.search ? String((_a = props.search) == null ? void 0 : _a.trim()) : void 0,
|
|
51987
51989
|
page: props.usePaginator ? tablePage.value : void 0,
|
|
51988
51990
|
limit: props.usePaginator ? tableRows.value : void 0,
|
|
51989
51991
|
sortOrder: sortOrder2.value,
|
|
@@ -52075,6 +52077,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
|
|
|
52075
52077
|
selectedData.value = [];
|
|
52076
52078
|
currentPageDataSelected.value = [];
|
|
52077
52079
|
}
|
|
52080
|
+
console.log("✨ ~ queryParams:", queryParams.value);
|
|
52078
52081
|
loadingTable.value = true;
|
|
52079
52082
|
const { data: data30, totalRecords: total = 0 } = await ((_a = props.fetchFunction) == null ? void 0 : _a.call(props, scanParams ?? queryParams.value)) ?? {};
|
|
52080
52083
|
dispatchUpdateTotalRecordsEvent(total);
|