@deot/vc-components 1.0.53 → 1.0.54

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/dist/index.cjs CHANGED
@@ -10851,14 +10851,18 @@ const Upload$1 = vue.defineComponent({
10851
10851
  }
10852
10852
  let { enhancer } = VcInstance.options.Upload || {};
10853
10853
  enhancer = props.enhancer || enhancer || (() => false);
10854
- const allow = enhancer(instance);
10855
- if (allow && allow.then) {
10856
- allow.catch(() => {
10857
- el.click?.();
10854
+ const skip = enhancer(instance);
10855
+ if (skip && skip.then) {
10856
+ let skip$ = false;
10857
+ skip.then((v) => {
10858
+ skip$ = typeof v === "undefined" ? true : !!v;
10859
+ return v;
10860
+ }).finally(() => {
10861
+ skip$ || el.click?.();
10858
10862
  });
10859
10863
  return;
10860
10864
  }
10861
- allow || el.click();
10865
+ skip || el.click();
10862
10866
  };
10863
10867
  const handleChange = (e) => {
10864
10868
  uploadFiles(e.target.files);
@@ -12147,34 +12151,14 @@ const Snapshot = /* @__PURE__ */ vue.defineComponent({
12147
12151
  slots,
12148
12152
  expose
12149
12153
  }) {
12154
+ let snapDOM;
12150
12155
  const instance = vue.getCurrentInstance();
12151
12156
  const current = vue.ref();
12152
12157
  const snapdom = vue.ref();
12153
-
12154
- // 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
12155
12158
  const refresh = async () => {
12156
- if (!props.crossOrigin) return;
12157
- const transformSource = props.source || VcInstance.options.Snapshot?.source || (v => v);
12158
- return Promise.all(Array.from(current.value.querySelectorAll('img')).map(node => {
12159
- return new Promise(resolve => {
12160
- (async () => {
12161
- let url;
12162
- try {
12163
- url = await transformSource(node.src, 'image');
12164
- } catch (e) {
12165
- console.error(e);
12166
- }
12167
- const image = new Image();
12168
- image.crossOrigin = props.crossOrigin;
12169
- image.src = `${url}?=${new Date().getTime()}`; // 强制不缓存
12170
- image.onload = () => {
12171
- node.src = image.src;
12172
- resolve(1);
12173
- };
12174
- image.onerror = () => resolve(0);
12175
- })();
12176
- });
12177
- }));
12159
+ await vue.nextTick();
12160
+ snapdom.value = await snapDOM(current.value, props.options);
12161
+ return snapdom.value;
12178
12162
  };
12179
12163
  const toDataURL = async () => {
12180
12164
  await refresh();
@@ -12183,14 +12167,18 @@ const Snapshot = /* @__PURE__ */ vue.defineComponent({
12183
12167
  const download = async options => {
12184
12168
  await refresh();
12185
12169
  const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
12186
- const allow = _download(instance, options);
12187
- if (allow && allow.then) {
12188
- allow.catch(() => {
12189
- snapdom.value.download(options);
12170
+ const skip = _download(instance, options);
12171
+ if (skip && skip.then) {
12172
+ let skip$ = false;
12173
+ skip.then(v => {
12174
+ skip$ = typeof v === 'undefined' ? true : !!v;
12175
+ return v;
12176
+ }).finally(() => {
12177
+ skip$ || snapdom.value.download(options);
12190
12178
  });
12191
12179
  return;
12192
12180
  }
12193
- allow || snapdom.value.download(options);
12181
+ skip || snapdom.value.download(options);
12194
12182
  };
12195
12183
  expose({
12196
12184
  snapdom,
@@ -12200,9 +12188,9 @@ const Snapshot = /* @__PURE__ */ vue.defineComponent({
12200
12188
  });
12201
12189
  vue.onMounted(async () => {
12202
12190
  try {
12203
- let snapDOM = window.snapdom || (await import('@zumer/snapdom'));
12191
+ snapDOM = window.snapdom || (await import('@zumer/snapdom'));
12204
12192
  snapDOM = snapDOM.snapdom || snapDOM;
12205
- snapdom.value = await snapDOM(current.value, props.options);
12193
+ await refresh();
12206
12194
  emit('ready', {
12207
12195
  instance,
12208
12196
  dependencies: {
@@ -19262,14 +19262,18 @@ var VcComponents = (function (exports, vue) {
19262
19262
  }
19263
19263
  let { enhancer } = VcInstance.options.Upload || {};
19264
19264
  enhancer = props.enhancer || enhancer || (() => false);
19265
- const allow = enhancer(instance);
19266
- if (allow && allow.then) {
19267
- allow.catch(() => {
19268
- el.click?.();
19265
+ const skip = enhancer(instance);
19266
+ if (skip && skip.then) {
19267
+ let skip$ = false;
19268
+ skip.then((v) => {
19269
+ skip$ = typeof v === "undefined" ? true : !!v;
19270
+ return v;
19271
+ }).finally(() => {
19272
+ skip$ || el.click?.();
19269
19273
  });
19270
19274
  return;
19271
19275
  }
19272
- allow || el.click();
19276
+ skip || el.click();
19273
19277
  };
19274
19278
  const handleChange = (e) => {
19275
19279
  uploadFiles(e.target.files);
@@ -20690,34 +20694,14 @@ var VcComponents = (function (exports, vue) {
20690
20694
  slots,
20691
20695
  expose
20692
20696
  }) {
20697
+ let snapDOM;
20693
20698
  const instance = vue.getCurrentInstance();
20694
20699
  const current = vue.ref();
20695
20700
  const snapdom = vue.ref();
20696
-
20697
- // 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
20698
20701
  const refresh = async () => {
20699
- if (!props.crossOrigin) return;
20700
- const transformSource = props.source || VcInstance.options.Snapshot?.source || (v => v);
20701
- return Promise.all(Array.from(current.value.querySelectorAll('img')).map(node => {
20702
- return new Promise(resolve => {
20703
- (async () => {
20704
- let url;
20705
- try {
20706
- url = await transformSource(node.src, 'image');
20707
- } catch (e) {
20708
- console.error(e);
20709
- }
20710
- const image = new Image();
20711
- image.crossOrigin = props.crossOrigin;
20712
- image.src = `${url}?=${new Date().getTime()}`; // 强制不缓存
20713
- image.onload = () => {
20714
- node.src = image.src;
20715
- resolve(1);
20716
- };
20717
- image.onerror = () => resolve(0);
20718
- })();
20719
- });
20720
- }));
20702
+ await vue.nextTick();
20703
+ snapdom.value = await snapDOM(current.value, props.options);
20704
+ return snapdom.value;
20721
20705
  };
20722
20706
  const toDataURL = async () => {
20723
20707
  await refresh();
@@ -20726,14 +20710,18 @@ var VcComponents = (function (exports, vue) {
20726
20710
  const download = async options => {
20727
20711
  await refresh();
20728
20712
  const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
20729
- const allow = _download(instance, options);
20730
- if (allow && allow.then) {
20731
- allow.catch(() => {
20732
- snapdom.value.download(options);
20713
+ const skip = _download(instance, options);
20714
+ if (skip && skip.then) {
20715
+ let skip$ = false;
20716
+ skip.then(v => {
20717
+ skip$ = typeof v === 'undefined' ? true : !!v;
20718
+ return v;
20719
+ }).finally(() => {
20720
+ skip$ || snapdom.value.download(options);
20733
20721
  });
20734
20722
  return;
20735
20723
  }
20736
- allow || snapdom.value.download(options);
20724
+ skip || snapdom.value.download(options);
20737
20725
  };
20738
20726
  expose({
20739
20727
  snapdom,
@@ -20743,9 +20731,9 @@ var VcComponents = (function (exports, vue) {
20743
20731
  });
20744
20732
  vue.onMounted(async () => {
20745
20733
  try {
20746
- let snapDOM = window.snapdom || (await Promise.resolve().then(() => snapdom$1));
20734
+ snapDOM = window.snapdom || (await Promise.resolve().then(() => snapdom$1));
20747
20735
  snapDOM = snapDOM.snapdom || snapDOM;
20748
- snapdom.value = await snapDOM(current.value, props.options);
20736
+ await refresh();
20749
20737
  emit('ready', {
20750
20738
  instance,
20751
20739
  dependencies: {
package/dist/index.js CHANGED
@@ -10829,14 +10829,18 @@ const Upload$1 = defineComponent({
10829
10829
  }
10830
10830
  let { enhancer } = VcInstance.options.Upload || {};
10831
10831
  enhancer = props.enhancer || enhancer || (() => false);
10832
- const allow = enhancer(instance);
10833
- if (allow && allow.then) {
10834
- allow.catch(() => {
10835
- el.click?.();
10832
+ const skip = enhancer(instance);
10833
+ if (skip && skip.then) {
10834
+ let skip$ = false;
10835
+ skip.then((v) => {
10836
+ skip$ = typeof v === "undefined" ? true : !!v;
10837
+ return v;
10838
+ }).finally(() => {
10839
+ skip$ || el.click?.();
10836
10840
  });
10837
10841
  return;
10838
10842
  }
10839
- allow || el.click();
10843
+ skip || el.click();
10840
10844
  };
10841
10845
  const handleChange = (e) => {
10842
10846
  uploadFiles(e.target.files);
@@ -12125,34 +12129,14 @@ const Snapshot = /* @__PURE__ */ defineComponent({
12125
12129
  slots,
12126
12130
  expose
12127
12131
  }) {
12132
+ let snapDOM;
12128
12133
  const instance = getCurrentInstance();
12129
12134
  const current = ref();
12130
12135
  const snapdom = ref();
12131
-
12132
- // 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
12133
12136
  const refresh = async () => {
12134
- if (!props.crossOrigin) return;
12135
- const transformSource = props.source || VcInstance.options.Snapshot?.source || (v => v);
12136
- return Promise.all(Array.from(current.value.querySelectorAll('img')).map(node => {
12137
- return new Promise(resolve => {
12138
- (async () => {
12139
- let url;
12140
- try {
12141
- url = await transformSource(node.src, 'image');
12142
- } catch (e) {
12143
- console.error(e);
12144
- }
12145
- const image = new Image();
12146
- image.crossOrigin = props.crossOrigin;
12147
- image.src = `${url}?=${new Date().getTime()}`; // 强制不缓存
12148
- image.onload = () => {
12149
- node.src = image.src;
12150
- resolve(1);
12151
- };
12152
- image.onerror = () => resolve(0);
12153
- })();
12154
- });
12155
- }));
12137
+ await nextTick();
12138
+ snapdom.value = await snapDOM(current.value, props.options);
12139
+ return snapdom.value;
12156
12140
  };
12157
12141
  const toDataURL = async () => {
12158
12142
  await refresh();
@@ -12161,14 +12145,18 @@ const Snapshot = /* @__PURE__ */ defineComponent({
12161
12145
  const download = async options => {
12162
12146
  await refresh();
12163
12147
  const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
12164
- const allow = _download(instance, options);
12165
- if (allow && allow.then) {
12166
- allow.catch(() => {
12167
- snapdom.value.download(options);
12148
+ const skip = _download(instance, options);
12149
+ if (skip && skip.then) {
12150
+ let skip$ = false;
12151
+ skip.then(v => {
12152
+ skip$ = typeof v === 'undefined' ? true : !!v;
12153
+ return v;
12154
+ }).finally(() => {
12155
+ skip$ || snapdom.value.download(options);
12168
12156
  });
12169
12157
  return;
12170
12158
  }
12171
- allow || snapdom.value.download(options);
12159
+ skip || snapdom.value.download(options);
12172
12160
  };
12173
12161
  expose({
12174
12162
  snapdom,
@@ -12178,9 +12166,9 @@ const Snapshot = /* @__PURE__ */ defineComponent({
12178
12166
  });
12179
12167
  onMounted(async () => {
12180
12168
  try {
12181
- let snapDOM = window.snapdom || (await import('@zumer/snapdom'));
12169
+ snapDOM = window.snapdom || (await import('@zumer/snapdom'));
12182
12170
  snapDOM = snapDOM.snapdom || snapDOM;
12183
- snapdom.value = await snapDOM(current.value, props.options);
12171
+ await refresh();
12184
12172
  emit('ready', {
12185
12173
  instance,
12186
12174
  dependencies: {
@@ -19265,14 +19265,18 @@
19265
19265
  }
19266
19266
  let { enhancer } = VcInstance.options.Upload || {};
19267
19267
  enhancer = props.enhancer || enhancer || (() => false);
19268
- const allow = enhancer(instance);
19269
- if (allow && allow.then) {
19270
- allow.catch(() => {
19271
- el.click?.();
19268
+ const skip = enhancer(instance);
19269
+ if (skip && skip.then) {
19270
+ let skip$ = false;
19271
+ skip.then((v) => {
19272
+ skip$ = typeof v === "undefined" ? true : !!v;
19273
+ return v;
19274
+ }).finally(() => {
19275
+ skip$ || el.click?.();
19272
19276
  });
19273
19277
  return;
19274
19278
  }
19275
- allow || el.click();
19279
+ skip || el.click();
19276
19280
  };
19277
19281
  const handleChange = (e) => {
19278
19282
  uploadFiles(e.target.files);
@@ -20693,34 +20697,14 @@
20693
20697
  slots,
20694
20698
  expose
20695
20699
  }) {
20700
+ let snapDOM;
20696
20701
  const instance = vue.getCurrentInstance();
20697
20702
  const current = vue.ref();
20698
20703
  const snapdom = vue.ref();
20699
-
20700
- // 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
20701
20704
  const refresh = async () => {
20702
- if (!props.crossOrigin) return;
20703
- const transformSource = props.source || VcInstance.options.Snapshot?.source || (v => v);
20704
- return Promise.all(Array.from(current.value.querySelectorAll('img')).map(node => {
20705
- return new Promise(resolve => {
20706
- (async () => {
20707
- let url;
20708
- try {
20709
- url = await transformSource(node.src, 'image');
20710
- } catch (e) {
20711
- console.error(e);
20712
- }
20713
- const image = new Image();
20714
- image.crossOrigin = props.crossOrigin;
20715
- image.src = `${url}?=${new Date().getTime()}`; // 强制不缓存
20716
- image.onload = () => {
20717
- node.src = image.src;
20718
- resolve(1);
20719
- };
20720
- image.onerror = () => resolve(0);
20721
- })();
20722
- });
20723
- }));
20705
+ await vue.nextTick();
20706
+ snapdom.value = await snapDOM(current.value, props.options);
20707
+ return snapdom.value;
20724
20708
  };
20725
20709
  const toDataURL = async () => {
20726
20710
  await refresh();
@@ -20729,14 +20713,18 @@
20729
20713
  const download = async options => {
20730
20714
  await refresh();
20731
20715
  const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
20732
- const allow = _download(instance, options);
20733
- if (allow && allow.then) {
20734
- allow.catch(() => {
20735
- snapdom.value.download(options);
20716
+ const skip = _download(instance, options);
20717
+ if (skip && skip.then) {
20718
+ let skip$ = false;
20719
+ skip.then(v => {
20720
+ skip$ = typeof v === 'undefined' ? true : !!v;
20721
+ return v;
20722
+ }).finally(() => {
20723
+ skip$ || snapdom.value.download(options);
20736
20724
  });
20737
20725
  return;
20738
20726
  }
20739
- allow || snapdom.value.download(options);
20727
+ skip || snapdom.value.download(options);
20740
20728
  };
20741
20729
  expose({
20742
20730
  snapdom,
@@ -20746,9 +20734,9 @@
20746
20734
  });
20747
20735
  vue.onMounted(async () => {
20748
20736
  try {
20749
- let snapDOM = window.snapdom || (await Promise.resolve().then(() => snapdom$1));
20737
+ snapDOM = window.snapdom || (await Promise.resolve().then(() => snapdom$1));
20750
20738
  snapDOM = snapDOM.snapdom || snapDOM;
20751
- snapdom.value = await snapDOM(current.value, props.options);
20739
+ await refresh();
20752
20740
  emit('ready', {
20753
20741
  instance,
20754
20742
  dependencies: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deot/vc-components",
3
- "version": "1.0.53",
3
+ "version": "1.0.54",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",