@mptw/skylens-ui 1.4.85 → 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 -12
- 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,15 +241,6 @@ export default defineComponent({
|
|
|
243
241
|
}
|
|
244
242
|
}
|
|
245
243
|
|
|
246
|
-
async function copyImage() {
|
|
247
|
-
const dataURL = await domToPngDataUrl(imageTarget.value, customFilter.value, customStyle.value, padding.value, dateRanges.value, watermark.value, WatermarkImage);
|
|
248
|
-
if (!dataURL) {
|
|
249
|
-
console.log("Can not generate data URL!");
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
return dataURL;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
244
|
onMounted(() => {
|
|
256
245
|
nextTick(() => {
|
|
257
246
|
if (buttonEl.value && popupEl.value) {
|
|
@@ -275,7 +264,6 @@ export default defineComponent({
|
|
|
275
264
|
popupEl,
|
|
276
265
|
onClickedToggle,
|
|
277
266
|
onClickedOption,
|
|
278
|
-
copyImage,
|
|
279
267
|
};
|
|
280
268
|
},
|
|
281
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
|
+
}
|