@deot/vc-components 1.0.51 → 1.0.52
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 +93 -11
- package/dist/index.d.ts +76 -28
- package/dist/index.iife.js +4246 -33
- package/dist/index.js +92 -10
- package/dist/index.umd.cjs +4246 -33
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -2361,23 +2361,23 @@ const InputNumber = /* @__PURE__ */ defineComponent({
|
|
|
2361
2361
|
...listeners
|
|
2362
2362
|
}), {
|
|
2363
2363
|
prepend: slots.prepend && (() => slots.prepend?.()),
|
|
2364
|
-
append:
|
|
2364
|
+
append: slots.append ? () => slots.append?.() : props.step ? () => {
|
|
2365
2365
|
return createVNode("div", {
|
|
2366
2366
|
"class": "vc-input-number__icon"
|
|
2367
2367
|
}, [createVNode("div", {
|
|
2368
2368
|
"class": "vc-input-number__up",
|
|
2369
|
-
"disabled": plusDisabled.value ? 'disabled' :
|
|
2369
|
+
"disabled": plusDisabled.value ? 'disabled' : void 0,
|
|
2370
2370
|
"onClick": e => handleStepper(e, 1)
|
|
2371
2371
|
}, [createVNode(Icon, {
|
|
2372
2372
|
"type": "up"
|
|
2373
2373
|
}, null)]), createVNode("div", {
|
|
2374
2374
|
"class": "vc-input-number__down",
|
|
2375
|
-
"disabled": minusDisabled.value ? 'disabled' :
|
|
2375
|
+
"disabled": minusDisabled.value ? 'disabled' : void 0,
|
|
2376
2376
|
"onClick": e => handleStepper(e, -1)
|
|
2377
2377
|
}, [createVNode(Icon, {
|
|
2378
2378
|
"type": "down"
|
|
2379
2379
|
}, null)])]);
|
|
2380
|
-
} :
|
|
2380
|
+
} : void 0
|
|
2381
2381
|
});
|
|
2382
2382
|
};
|
|
2383
2383
|
}
|
|
@@ -12092,27 +12092,109 @@ const props$H = {
|
|
|
12092
12092
|
tag: {
|
|
12093
12093
|
type: String,
|
|
12094
12094
|
default: "div"
|
|
12095
|
+
},
|
|
12096
|
+
// useCORS
|
|
12097
|
+
crossOrigin: {
|
|
12098
|
+
type: String,
|
|
12099
|
+
// ''. 'anonymous', 'use-credentials'
|
|
12100
|
+
default: "anonymous",
|
|
12101
|
+
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
12102
|
+
},
|
|
12103
|
+
transformSource: Function,
|
|
12104
|
+
// 传递给snap-dom的配置项
|
|
12105
|
+
options: {
|
|
12106
|
+
type: Object,
|
|
12107
|
+
default: () => ({})
|
|
12095
12108
|
}
|
|
12096
12109
|
};
|
|
12097
12110
|
|
|
12098
12111
|
/** @jsxImportSource vue */
|
|
12099
12112
|
|
|
12100
|
-
const COMPONENT_NAME$Z = 'vc-
|
|
12101
|
-
const
|
|
12113
|
+
const COMPONENT_NAME$Z = 'vc-snapshot';
|
|
12114
|
+
const Snapshot = /* @__PURE__ */ defineComponent({
|
|
12102
12115
|
name: COMPONENT_NAME$Z,
|
|
12103
12116
|
props: props$H,
|
|
12117
|
+
emits: ['ready'],
|
|
12104
12118
|
setup(props, {
|
|
12105
|
-
|
|
12119
|
+
emit,
|
|
12120
|
+
slots,
|
|
12121
|
+
expose
|
|
12106
12122
|
}) {
|
|
12123
|
+
const current = ref();
|
|
12124
|
+
const instance = ref();
|
|
12125
|
+
|
|
12126
|
+
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
12127
|
+
const refresh = async () => {
|
|
12128
|
+
if (!props.crossOrigin) return;
|
|
12129
|
+
const transformSource = props.transformSource || VcInstance.options.Snapshot?.transformSource || (v => v);
|
|
12130
|
+
return Promise.all(Array.from(current.value.querySelectorAll('img')).map(node => {
|
|
12131
|
+
return new Promise(resolve => {
|
|
12132
|
+
(async () => {
|
|
12133
|
+
let url;
|
|
12134
|
+
try {
|
|
12135
|
+
url = await transformSource(node.src);
|
|
12136
|
+
} catch (e) {
|
|
12137
|
+
console.error(e);
|
|
12138
|
+
}
|
|
12139
|
+
const image = new Image();
|
|
12140
|
+
image.crossOrigin = props.crossOrigin;
|
|
12141
|
+
image.src = `${url}?=${new Date().getTime()}`; // 强制不缓存
|
|
12142
|
+
image.onload = () => {
|
|
12143
|
+
node.src = image.src;
|
|
12144
|
+
resolve(1);
|
|
12145
|
+
};
|
|
12146
|
+
image.onerror = () => resolve(0);
|
|
12147
|
+
})();
|
|
12148
|
+
});
|
|
12149
|
+
}));
|
|
12150
|
+
};
|
|
12151
|
+
const toDataURL = async () => {
|
|
12152
|
+
await refresh();
|
|
12153
|
+
return instance.value.toRaw();
|
|
12154
|
+
};
|
|
12155
|
+
const download = async options => {
|
|
12156
|
+
await refresh();
|
|
12157
|
+
const _download = VcInstance.options.Snapshot?.download || (() => false);
|
|
12158
|
+
const allow = _download(options);
|
|
12159
|
+
if (allow && allow.then) {
|
|
12160
|
+
allow.catch(() => {
|
|
12161
|
+
instance.value.download(options);
|
|
12162
|
+
});
|
|
12163
|
+
return;
|
|
12164
|
+
}
|
|
12165
|
+
allow || instance.value.download(options);
|
|
12166
|
+
};
|
|
12167
|
+
expose({
|
|
12168
|
+
instance,
|
|
12169
|
+
refresh,
|
|
12170
|
+
toDataURL,
|
|
12171
|
+
download
|
|
12172
|
+
});
|
|
12173
|
+
onMounted(async () => {
|
|
12174
|
+
try {
|
|
12175
|
+
let snapDOM = window.snapdom || (await import('@zumer/snapdom'));
|
|
12176
|
+
snapDOM = snapDOM.snapdom || snapDOM;
|
|
12177
|
+
instance.value = await snapDOM(current.value, props.options);
|
|
12178
|
+
emit('ready', {
|
|
12179
|
+
instance: instance.value,
|
|
12180
|
+
dependencies: {
|
|
12181
|
+
snapDOM
|
|
12182
|
+
}
|
|
12183
|
+
});
|
|
12184
|
+
} catch (e) {
|
|
12185
|
+
throw new VcError('snapshot', e);
|
|
12186
|
+
}
|
|
12187
|
+
});
|
|
12107
12188
|
return () => {
|
|
12108
12189
|
return createVNode("div", {
|
|
12109
|
-
"
|
|
12190
|
+
"ref": current,
|
|
12191
|
+
"class": "vc-snapshot"
|
|
12110
12192
|
}, [slots?.default?.()]);
|
|
12111
12193
|
};
|
|
12112
12194
|
}
|
|
12113
12195
|
});
|
|
12114
12196
|
|
|
12115
|
-
const
|
|
12197
|
+
const MSnapshot = Snapshot;
|
|
12116
12198
|
|
|
12117
12199
|
const MIcon = Icon;
|
|
12118
12200
|
|
|
@@ -23907,4 +23989,4 @@ const UploadPicker = /* @__PURE__ */ defineComponent({
|
|
|
23907
23989
|
|
|
23908
23990
|
const MUploadPicker = UploadPicker;
|
|
23909
23991
|
|
|
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,
|
|
23992
|
+
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 };
|