@deot/vc-components 1.0.51 → 1.0.53
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 +99 -11
- package/dist/index.d.ts +80 -28
- package/dist/index.iife.js +4252 -33
- package/dist/index.js +98 -10
- package/dist/index.umd.cjs +4252 -33
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -73,6 +73,10 @@ const defaults$2 = {
|
|
|
73
73
|
},
|
|
74
74
|
TableColumn: {
|
|
75
75
|
line: nil
|
|
76
|
+
},
|
|
77
|
+
Snapshot: {
|
|
78
|
+
source: nil,
|
|
79
|
+
download: nil
|
|
76
80
|
}
|
|
77
81
|
};
|
|
78
82
|
|
|
@@ -2383,23 +2387,23 @@ const InputNumber = /* @__PURE__ */ vue.defineComponent({
|
|
|
2383
2387
|
...listeners
|
|
2384
2388
|
}), {
|
|
2385
2389
|
prepend: slots.prepend && (() => slots.prepend?.()),
|
|
2386
|
-
append:
|
|
2390
|
+
append: slots.append ? () => slots.append?.() : props.step ? () => {
|
|
2387
2391
|
return vue.createVNode("div", {
|
|
2388
2392
|
"class": "vc-input-number__icon"
|
|
2389
2393
|
}, [vue.createVNode("div", {
|
|
2390
2394
|
"class": "vc-input-number__up",
|
|
2391
|
-
"disabled": plusDisabled.value ? 'disabled' :
|
|
2395
|
+
"disabled": plusDisabled.value ? 'disabled' : void 0,
|
|
2392
2396
|
"onClick": e => handleStepper(e, 1)
|
|
2393
2397
|
}, [vue.createVNode(Icon, {
|
|
2394
2398
|
"type": "up"
|
|
2395
2399
|
}, null)]), vue.createVNode("div", {
|
|
2396
2400
|
"class": "vc-input-number__down",
|
|
2397
|
-
"disabled": minusDisabled.value ? 'disabled' :
|
|
2401
|
+
"disabled": minusDisabled.value ? 'disabled' : void 0,
|
|
2398
2402
|
"onClick": e => handleStepper(e, -1)
|
|
2399
2403
|
}, [vue.createVNode(Icon, {
|
|
2400
2404
|
"type": "down"
|
|
2401
2405
|
}, null)])]);
|
|
2402
|
-
} :
|
|
2406
|
+
} : void 0
|
|
2403
2407
|
});
|
|
2404
2408
|
};
|
|
2405
2409
|
}
|
|
@@ -12114,27 +12118,111 @@ const props$H = {
|
|
|
12114
12118
|
tag: {
|
|
12115
12119
|
type: String,
|
|
12116
12120
|
default: "div"
|
|
12121
|
+
},
|
|
12122
|
+
// useCORS
|
|
12123
|
+
crossOrigin: {
|
|
12124
|
+
type: String,
|
|
12125
|
+
// ''. 'anonymous', 'use-credentials'
|
|
12126
|
+
default: "anonymous",
|
|
12127
|
+
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
12128
|
+
},
|
|
12129
|
+
source: Function,
|
|
12130
|
+
download: Function,
|
|
12131
|
+
// 传递给snap-dom的配置项
|
|
12132
|
+
options: {
|
|
12133
|
+
type: Object,
|
|
12134
|
+
default: () => ({})
|
|
12117
12135
|
}
|
|
12118
12136
|
};
|
|
12119
12137
|
|
|
12120
12138
|
/** @jsxImportSource vue */
|
|
12121
12139
|
|
|
12122
|
-
const COMPONENT_NAME$Z = 'vc-
|
|
12123
|
-
const
|
|
12140
|
+
const COMPONENT_NAME$Z = 'vc-snapshot';
|
|
12141
|
+
const Snapshot = /* @__PURE__ */ vue.defineComponent({
|
|
12124
12142
|
name: COMPONENT_NAME$Z,
|
|
12125
12143
|
props: props$H,
|
|
12144
|
+
emits: ['ready'],
|
|
12126
12145
|
setup(props, {
|
|
12127
|
-
|
|
12146
|
+
emit,
|
|
12147
|
+
slots,
|
|
12148
|
+
expose
|
|
12128
12149
|
}) {
|
|
12150
|
+
const instance = vue.getCurrentInstance();
|
|
12151
|
+
const current = vue.ref();
|
|
12152
|
+
const snapdom = vue.ref();
|
|
12153
|
+
|
|
12154
|
+
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
12155
|
+
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
|
+
}));
|
|
12178
|
+
};
|
|
12179
|
+
const toDataURL = async () => {
|
|
12180
|
+
await refresh();
|
|
12181
|
+
return snapdom.value.toRaw();
|
|
12182
|
+
};
|
|
12183
|
+
const download = async options => {
|
|
12184
|
+
await refresh();
|
|
12185
|
+
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);
|
|
12190
|
+
});
|
|
12191
|
+
return;
|
|
12192
|
+
}
|
|
12193
|
+
allow || snapdom.value.download(options);
|
|
12194
|
+
};
|
|
12195
|
+
expose({
|
|
12196
|
+
snapdom,
|
|
12197
|
+
refresh,
|
|
12198
|
+
toDataURL,
|
|
12199
|
+
download
|
|
12200
|
+
});
|
|
12201
|
+
vue.onMounted(async () => {
|
|
12202
|
+
try {
|
|
12203
|
+
let snapDOM = window.snapdom || (await import('@zumer/snapdom'));
|
|
12204
|
+
snapDOM = snapDOM.snapdom || snapDOM;
|
|
12205
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
12206
|
+
emit('ready', {
|
|
12207
|
+
instance,
|
|
12208
|
+
dependencies: {
|
|
12209
|
+
snapDOM
|
|
12210
|
+
}
|
|
12211
|
+
});
|
|
12212
|
+
} catch (e) {
|
|
12213
|
+
throw new VcError('snapshot', e);
|
|
12214
|
+
}
|
|
12215
|
+
});
|
|
12129
12216
|
return () => {
|
|
12130
12217
|
return vue.createVNode("div", {
|
|
12131
|
-
"
|
|
12218
|
+
"ref": current,
|
|
12219
|
+
"class": "vc-snapshot"
|
|
12132
12220
|
}, [slots?.default?.()]);
|
|
12133
12221
|
};
|
|
12134
12222
|
}
|
|
12135
12223
|
});
|
|
12136
12224
|
|
|
12137
|
-
const
|
|
12225
|
+
const MSnapshot = Snapshot;
|
|
12138
12226
|
|
|
12139
12227
|
const MIcon = Icon;
|
|
12140
12228
|
|
|
@@ -23962,7 +24050,6 @@ exports.Expand = Expand$1;
|
|
|
23962
24050
|
exports.Form = Form;
|
|
23963
24051
|
exports.FormItem = FormItem;
|
|
23964
24052
|
exports.Fragment = Fragment;
|
|
23965
|
-
exports.HTMLToImage = HTMLToImage;
|
|
23966
24053
|
exports.Icon = Icon;
|
|
23967
24054
|
exports.IconManager = IconManager;
|
|
23968
24055
|
exports.Image = Image$1;
|
|
@@ -24007,7 +24094,6 @@ exports.MExpand = MExpand;
|
|
|
24007
24094
|
exports.MForm = MForm;
|
|
24008
24095
|
exports.MFormItem = MFormItem;
|
|
24009
24096
|
exports.MFragment = MFragment;
|
|
24010
|
-
exports.MHTMLToImage = MHTMLToImage;
|
|
24011
24097
|
exports.MIcon = MIcon;
|
|
24012
24098
|
exports.MImage = MImage;
|
|
24013
24099
|
exports.MImageCrop = MImageCrop;
|
|
@@ -24041,6 +24127,7 @@ exports.MResizer = MResizer;
|
|
|
24041
24127
|
exports.MScroller = MScroller;
|
|
24042
24128
|
exports.MSelect = MSelect;
|
|
24043
24129
|
exports.MSlider = MSlider;
|
|
24130
|
+
exports.MSnapshot = MSnapshot;
|
|
24044
24131
|
exports.MSortList = MSortList;
|
|
24045
24132
|
exports.MSpin = MSpin;
|
|
24046
24133
|
exports.MSteps = MSteps;
|
|
@@ -24094,6 +24181,7 @@ exports.Scroller = Scroller;
|
|
|
24094
24181
|
exports.ScrollerWheel = ScrollerWheel;
|
|
24095
24182
|
exports.Select = Select;
|
|
24096
24183
|
exports.Slider = Slider;
|
|
24184
|
+
exports.Snapshot = Snapshot;
|
|
24097
24185
|
exports.SortList = SortList;
|
|
24098
24186
|
exports.Spin = Spin;
|
|
24099
24187
|
exports.Steps = Steps;
|
package/dist/index.d.ts
CHANGED
|
@@ -2082,20 +2082,6 @@ export declare const Fragment: DefineComponent< {}, () => VNode<RendererNode,
|
|
|
2082
2082
|
[key: string]: any;
|
|
2083
2083
|
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
2084
2084
|
|
|
2085
|
-
export declare const HTMLToImage: DefineComponent<ExtractPropTypes< {
|
|
2086
|
-
tag: {
|
|
2087
|
-
type: StringConstructor;
|
|
2088
|
-
default: string;
|
|
2089
|
-
};
|
|
2090
|
-
}>, () => JSX_2.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
2091
|
-
tag: {
|
|
2092
|
-
type: StringConstructor;
|
|
2093
|
-
default: string;
|
|
2094
|
-
};
|
|
2095
|
-
}>> & Readonly<{}>, {
|
|
2096
|
-
tag: string;
|
|
2097
|
-
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
2098
|
-
|
|
2099
2085
|
export declare const Icon: DefineComponent<ExtractPropTypes< {
|
|
2100
2086
|
type: StringConstructor;
|
|
2101
2087
|
inherit: {
|
|
@@ -5001,20 +4987,6 @@ export declare const MFragment: DefineComponent< {}, () => VNode<RendererNode
|
|
|
5001
4987
|
[key: string]: any;
|
|
5002
4988
|
}>, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
5003
4989
|
|
|
5004
|
-
export declare const MHTMLToImage: DefineComponent<ExtractPropTypes< {
|
|
5005
|
-
tag: {
|
|
5006
|
-
type: StringConstructor;
|
|
5007
|
-
default: string;
|
|
5008
|
-
};
|
|
5009
|
-
}>, () => JSX_2.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
5010
|
-
tag: {
|
|
5011
|
-
type: StringConstructor;
|
|
5012
|
-
default: string;
|
|
5013
|
-
};
|
|
5014
|
-
}>> & Readonly<{}>, {
|
|
5015
|
-
tag: string;
|
|
5016
|
-
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
5017
|
-
|
|
5018
4990
|
export declare const MIcon: DefineComponent<ExtractPropTypes< {
|
|
5019
4991
|
type: StringConstructor;
|
|
5020
4992
|
inherit: {
|
|
@@ -8445,6 +8417,46 @@ default: string;
|
|
|
8445
8417
|
tag: string;
|
|
8446
8418
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
8447
8419
|
|
|
8420
|
+
export declare const MSnapshot: DefineComponent<ExtractPropTypes< {
|
|
8421
|
+
tag: {
|
|
8422
|
+
type: StringConstructor;
|
|
8423
|
+
default: string;
|
|
8424
|
+
};
|
|
8425
|
+
crossOrigin: {
|
|
8426
|
+
type: StringConstructor;
|
|
8427
|
+
default: string;
|
|
8428
|
+
validator: (v: any) => boolean;
|
|
8429
|
+
};
|
|
8430
|
+
source: FunctionConstructor;
|
|
8431
|
+
download: FunctionConstructor;
|
|
8432
|
+
options: {
|
|
8433
|
+
type: ObjectConstructor;
|
|
8434
|
+
default: () => {};
|
|
8435
|
+
};
|
|
8436
|
+
}>, () => JSX_2.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, "ready"[], "ready", PublicProps, Readonly<ExtractPropTypes< {
|
|
8437
|
+
tag: {
|
|
8438
|
+
type: StringConstructor;
|
|
8439
|
+
default: string;
|
|
8440
|
+
};
|
|
8441
|
+
crossOrigin: {
|
|
8442
|
+
type: StringConstructor;
|
|
8443
|
+
default: string;
|
|
8444
|
+
validator: (v: any) => boolean;
|
|
8445
|
+
};
|
|
8446
|
+
source: FunctionConstructor;
|
|
8447
|
+
download: FunctionConstructor;
|
|
8448
|
+
options: {
|
|
8449
|
+
type: ObjectConstructor;
|
|
8450
|
+
default: () => {};
|
|
8451
|
+
};
|
|
8452
|
+
}>> & Readonly<{
|
|
8453
|
+
onReady?: ((...args: any[]) => any) | undefined;
|
|
8454
|
+
}>, {
|
|
8455
|
+
tag: string;
|
|
8456
|
+
options: Record<string, any>;
|
|
8457
|
+
crossOrigin: string;
|
|
8458
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
8459
|
+
|
|
8448
8460
|
export declare const MSortList: DefineComponent<ExtractPropTypes< {
|
|
8449
8461
|
tag: {
|
|
8450
8462
|
type: StringConstructor;
|
|
@@ -13288,6 +13300,46 @@ default: string;
|
|
|
13288
13300
|
tag: string;
|
|
13289
13301
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
13290
13302
|
|
|
13303
|
+
export declare const Snapshot: DefineComponent<ExtractPropTypes< {
|
|
13304
|
+
tag: {
|
|
13305
|
+
type: StringConstructor;
|
|
13306
|
+
default: string;
|
|
13307
|
+
};
|
|
13308
|
+
crossOrigin: {
|
|
13309
|
+
type: StringConstructor;
|
|
13310
|
+
default: string;
|
|
13311
|
+
validator: (v: any) => boolean;
|
|
13312
|
+
};
|
|
13313
|
+
source: FunctionConstructor;
|
|
13314
|
+
download: FunctionConstructor;
|
|
13315
|
+
options: {
|
|
13316
|
+
type: ObjectConstructor;
|
|
13317
|
+
default: () => {};
|
|
13318
|
+
};
|
|
13319
|
+
}>, () => JSX_2.Element, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, "ready"[], "ready", PublicProps, Readonly<ExtractPropTypes< {
|
|
13320
|
+
tag: {
|
|
13321
|
+
type: StringConstructor;
|
|
13322
|
+
default: string;
|
|
13323
|
+
};
|
|
13324
|
+
crossOrigin: {
|
|
13325
|
+
type: StringConstructor;
|
|
13326
|
+
default: string;
|
|
13327
|
+
validator: (v: any) => boolean;
|
|
13328
|
+
};
|
|
13329
|
+
source: FunctionConstructor;
|
|
13330
|
+
download: FunctionConstructor;
|
|
13331
|
+
options: {
|
|
13332
|
+
type: ObjectConstructor;
|
|
13333
|
+
default: () => {};
|
|
13334
|
+
};
|
|
13335
|
+
}>> & Readonly<{
|
|
13336
|
+
onReady?: ((...args: any[]) => any) | undefined;
|
|
13337
|
+
}>, {
|
|
13338
|
+
tag: string;
|
|
13339
|
+
options: Record<string, any>;
|
|
13340
|
+
crossOrigin: string;
|
|
13341
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
13342
|
+
|
|
13291
13343
|
export declare const SortList: DefineComponent<ExtractPropTypes< {
|
|
13292
13344
|
tag: {
|
|
13293
13345
|
type: StringConstructor;
|