@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.js
CHANGED
|
@@ -51,6 +51,10 @@ const defaults$2 = {
|
|
|
51
51
|
},
|
|
52
52
|
TableColumn: {
|
|
53
53
|
line: nil
|
|
54
|
+
},
|
|
55
|
+
Snapshot: {
|
|
56
|
+
source: nil,
|
|
57
|
+
download: nil
|
|
54
58
|
}
|
|
55
59
|
};
|
|
56
60
|
|
|
@@ -2361,23 +2365,23 @@ const InputNumber = /* @__PURE__ */ defineComponent({
|
|
|
2361
2365
|
...listeners
|
|
2362
2366
|
}), {
|
|
2363
2367
|
prepend: slots.prepend && (() => slots.prepend?.()),
|
|
2364
|
-
append:
|
|
2368
|
+
append: slots.append ? () => slots.append?.() : props.step ? () => {
|
|
2365
2369
|
return createVNode("div", {
|
|
2366
2370
|
"class": "vc-input-number__icon"
|
|
2367
2371
|
}, [createVNode("div", {
|
|
2368
2372
|
"class": "vc-input-number__up",
|
|
2369
|
-
"disabled": plusDisabled.value ? 'disabled' :
|
|
2373
|
+
"disabled": plusDisabled.value ? 'disabled' : void 0,
|
|
2370
2374
|
"onClick": e => handleStepper(e, 1)
|
|
2371
2375
|
}, [createVNode(Icon, {
|
|
2372
2376
|
"type": "up"
|
|
2373
2377
|
}, null)]), createVNode("div", {
|
|
2374
2378
|
"class": "vc-input-number__down",
|
|
2375
|
-
"disabled": minusDisabled.value ? 'disabled' :
|
|
2379
|
+
"disabled": minusDisabled.value ? 'disabled' : void 0,
|
|
2376
2380
|
"onClick": e => handleStepper(e, -1)
|
|
2377
2381
|
}, [createVNode(Icon, {
|
|
2378
2382
|
"type": "down"
|
|
2379
2383
|
}, null)])]);
|
|
2380
|
-
} :
|
|
2384
|
+
} : void 0
|
|
2381
2385
|
});
|
|
2382
2386
|
};
|
|
2383
2387
|
}
|
|
@@ -12092,27 +12096,111 @@ const props$H = {
|
|
|
12092
12096
|
tag: {
|
|
12093
12097
|
type: String,
|
|
12094
12098
|
default: "div"
|
|
12099
|
+
},
|
|
12100
|
+
// useCORS
|
|
12101
|
+
crossOrigin: {
|
|
12102
|
+
type: String,
|
|
12103
|
+
// ''. 'anonymous', 'use-credentials'
|
|
12104
|
+
default: "anonymous",
|
|
12105
|
+
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
12106
|
+
},
|
|
12107
|
+
source: Function,
|
|
12108
|
+
download: Function,
|
|
12109
|
+
// 传递给snap-dom的配置项
|
|
12110
|
+
options: {
|
|
12111
|
+
type: Object,
|
|
12112
|
+
default: () => ({})
|
|
12095
12113
|
}
|
|
12096
12114
|
};
|
|
12097
12115
|
|
|
12098
12116
|
/** @jsxImportSource vue */
|
|
12099
12117
|
|
|
12100
|
-
const COMPONENT_NAME$Z = 'vc-
|
|
12101
|
-
const
|
|
12118
|
+
const COMPONENT_NAME$Z = 'vc-snapshot';
|
|
12119
|
+
const Snapshot = /* @__PURE__ */ defineComponent({
|
|
12102
12120
|
name: COMPONENT_NAME$Z,
|
|
12103
12121
|
props: props$H,
|
|
12122
|
+
emits: ['ready'],
|
|
12104
12123
|
setup(props, {
|
|
12105
|
-
|
|
12124
|
+
emit,
|
|
12125
|
+
slots,
|
|
12126
|
+
expose
|
|
12106
12127
|
}) {
|
|
12128
|
+
const instance = getCurrentInstance();
|
|
12129
|
+
const current = ref();
|
|
12130
|
+
const snapdom = ref();
|
|
12131
|
+
|
|
12132
|
+
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
12133
|
+
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
|
+
}));
|
|
12156
|
+
};
|
|
12157
|
+
const toDataURL = async () => {
|
|
12158
|
+
await refresh();
|
|
12159
|
+
return snapdom.value.toRaw();
|
|
12160
|
+
};
|
|
12161
|
+
const download = async options => {
|
|
12162
|
+
await refresh();
|
|
12163
|
+
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);
|
|
12168
|
+
});
|
|
12169
|
+
return;
|
|
12170
|
+
}
|
|
12171
|
+
allow || snapdom.value.download(options);
|
|
12172
|
+
};
|
|
12173
|
+
expose({
|
|
12174
|
+
snapdom,
|
|
12175
|
+
refresh,
|
|
12176
|
+
toDataURL,
|
|
12177
|
+
download
|
|
12178
|
+
});
|
|
12179
|
+
onMounted(async () => {
|
|
12180
|
+
try {
|
|
12181
|
+
let snapDOM = window.snapdom || (await import('@zumer/snapdom'));
|
|
12182
|
+
snapDOM = snapDOM.snapdom || snapDOM;
|
|
12183
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
12184
|
+
emit('ready', {
|
|
12185
|
+
instance,
|
|
12186
|
+
dependencies: {
|
|
12187
|
+
snapDOM
|
|
12188
|
+
}
|
|
12189
|
+
});
|
|
12190
|
+
} catch (e) {
|
|
12191
|
+
throw new VcError('snapshot', e);
|
|
12192
|
+
}
|
|
12193
|
+
});
|
|
12107
12194
|
return () => {
|
|
12108
12195
|
return createVNode("div", {
|
|
12109
|
-
"
|
|
12196
|
+
"ref": current,
|
|
12197
|
+
"class": "vc-snapshot"
|
|
12110
12198
|
}, [slots?.default?.()]);
|
|
12111
12199
|
};
|
|
12112
12200
|
}
|
|
12113
12201
|
});
|
|
12114
12202
|
|
|
12115
|
-
const
|
|
12203
|
+
const MSnapshot = Snapshot;
|
|
12116
12204
|
|
|
12117
12205
|
const MIcon = Icon;
|
|
12118
12206
|
|
|
@@ -23907,4 +23995,4 @@ const UploadPicker = /* @__PURE__ */ defineComponent({
|
|
|
23907
23995
|
|
|
23908
23996
|
const MUploadPicker = UploadPicker;
|
|
23909
23997
|
|
|
23910
|
-
export { ActionSheet, Affix, Alert, Artboard, Button, ButtonGroup, Calendar, Card, Carousel, Cascader, Chart, Checkbox, CheckboxGroup, Clipboard, Collapse, CollapseItem, ColorPicker, Countdown, Customer, DatePicker, Debounce, Divider, Drawer, DrawerView, Dropdown, DropdownItem, DropdownMenu, Editor, EditorView, Expand$1 as Expand, Form, FormItem, Fragment,
|
|
23998
|
+
export { ActionSheet, Affix, Alert, Artboard, Button, ButtonGroup, Calendar, Card, Carousel, Cascader, Chart, Checkbox, CheckboxGroup, Clipboard, Collapse, CollapseItem, ColorPicker, Countdown, Customer, DatePicker, Debounce, Divider, Drawer, DrawerView, Dropdown, DropdownItem, DropdownMenu, Editor, EditorView, Expand$1 as Expand, Form, FormItem, Fragment, Icon, IconManager, Image$1 as Image, ImageCrop, ImagePreview, ImageProcessing, Input, InputNumber, InputSearch, MList as List, MListItem as ListItem, MActionSheet, MAffix, MAlert, MArtboard, MButton, MButtonGroup, MCalendar, MCard, MCarousel, MCascader, MChart, MCheckbox, MCheckboxGroup, MClipboard, MCollapse, MCollapseItem, MColorPicker, MCountdown, MCustomer, MDatePicker, Debounce as MDebounce, MDivider, MDrawer, MDrawerView, MDropdown, MDropdownItem, MDropdownMenu, MEditor, MEditorView, MExpand, MForm, MFormItem, MFragment, MIcon, MImage, MImageCrop, MImagePreview, MImageProcessing, MInput, MInputNumber, MInputSearch, MList, MListItem, MMarquee, MMessage, modal as MModal, MModalView, MNotice, MOption, MPagination, MPicker, MPopconfirm, MPopover, MPopup, MPortal, MPrint, MProgress, MRadio, MRadioButton, MRadioGroup, MRate, MRecycleList, MResizer, MScroller, MSelect, MSlider, MSnapshot, MSortList, MSpin, MSteps, MSwitch, MTable, MTableColumn, MTabs, MTabsPane, MTag, MText, MTextarea, MTimePicker, MTimeline, MToast, MToastView, MTouch, MTransition, MTransitionCollapse, MTransitionFade, MTransitionScale, MTransitionSlide, MTransitionZoom, MTree, MTreeSelect, MUpload, MUploadPicker, Marquee, Message, MessageView, Modal, ModalView, Notice, NoticeView, Option$1 as Option, Pagination, Picker, Popconfirm, Popover, Popup, Portal, PortalView, Print, Progress, Radio, RadioButton, RadioGroup, Rate, RecycleList, Resizer, Scroller, ScrollerWheel, Select, Slider, Snapshot, SortList, Spin, Steps, Switch, Table, TableColumn, Tabs, TabsPane, Tag, Text, Textarea, Theme, ThemeImage, ThemeText, ThemeView, TimePicker, Timeline, Toast, ToastView, Touch, Transition, TransitionCollapse, TransitionFade, TransitionScale, TransitionSlide, TransitionZoom, Tree, TreeSelect, Upload, UploadPicker, VcError, VcInstance };
|