@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.
@@ -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
  });
@@ -1,7 +1,8 @@
1
1
  <template lang="pug">
2
2
  Transition(name='toast-fade')
3
3
  .toast(v-if='show')
4
- .toast-wrapper {{ message }}
4
+ .toast-wrapper
5
+ slot(name='message') {{ message }}
5
6
  </template>
6
7
 
7
8
  <script lang="ts">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mptw/skylens-ui",
3
3
  "type": "module",
4
- "version": "1.4.86",
4
+ "version": "1.4.87",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",
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
+ }