@mptw/skylens-ui 1.4.86 → 1.4.87
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.
- package/components/SLDownloadButton.vue +0 -17
- package/components/SLToast.vue +2 -1
- package/package.json +1 -1
- package/utils/index.ts +13 -1
|
@@ -30,10 +30,8 @@ import type { PropType } from "vue";
|
|
|
30
30
|
import { fromEvent, Subscription } from "rxjs";
|
|
31
31
|
import { createPopper } from "@popperjs/core";
|
|
32
32
|
import type { Instance as PopperInstance, Placement } from "@popperjs/core";
|
|
33
|
-
import * as htmlToImage from "html-to-image";
|
|
34
33
|
import ExcelJS from "exceljs";
|
|
35
34
|
import {
|
|
36
|
-
formatDateRange,
|
|
37
35
|
downloadURL,
|
|
38
36
|
downloadBlob,
|
|
39
37
|
gaev,
|
|
@@ -243,20 +241,6 @@ export default defineComponent({
|
|
|
243
241
|
}
|
|
244
242
|
}
|
|
245
243
|
|
|
246
|
-
async function copyImageToClipboard() {
|
|
247
|
-
if (!navigator.clipboard) {
|
|
248
|
-
console.log("Can not copy image to clipboard!");
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
const dataURL = await domToPngDataUrl(imageTarget.value, customFilter.value, customStyle.value, padding.value, dateRanges.value, watermark.value, WatermarkImage);
|
|
252
|
-
if (!dataURL) {
|
|
253
|
-
console.log("Can not generate data URL!");
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
await navigator.clipboard.writeText(dataURL);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
244
|
onMounted(() => {
|
|
261
245
|
nextTick(() => {
|
|
262
246
|
if (buttonEl.value && popupEl.value) {
|
|
@@ -280,7 +264,6 @@ export default defineComponent({
|
|
|
280
264
|
popupEl,
|
|
281
265
|
onClickedToggle,
|
|
282
266
|
onClickedOption,
|
|
283
|
-
copyImageToClipboard,
|
|
284
267
|
};
|
|
285
268
|
},
|
|
286
269
|
});
|
package/components/SLToast.vue
CHANGED
package/package.json
CHANGED
package/utils/index.ts
CHANGED
|
@@ -702,4 +702,16 @@ export const domToPngDataUrl = async (
|
|
|
702
702
|
dataURL = await addDateRanges(dataURL, [...dateRanges].reverse());
|
|
703
703
|
if (watermark) dataURL = await addWatermark(dataURL, watermarkImg);
|
|
704
704
|
return dataURL;
|
|
705
|
-
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
export const dataURLtoBlob = (dataurl: string) => {
|
|
708
|
+
const arr = dataurl.split(',');
|
|
709
|
+
const mime = arr[0].match(/:(.*?);/)[1];
|
|
710
|
+
const bstr = atob(arr[1]);
|
|
711
|
+
let n = bstr.length;
|
|
712
|
+
const u8arr = new Uint8Array(n);
|
|
713
|
+
while (n--) {
|
|
714
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
715
|
+
}
|
|
716
|
+
return new Blob([u8arr], { type: mime });
|
|
717
|
+
}
|