vxe-pc-ui 4.7.8 → 4.7.10
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/es/icon/style.css +1 -1
- package/es/image/src/group.js +21 -5
- package/es/image/src/image.js +25 -5
- package/es/image/src/preview.js +20 -13
- package/es/image/src/util.js +11 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/image/src/group.js +19 -5
- package/lib/image/src/group.min.js +1 -1
- package/lib/image/src/image.js +23 -5
- package/lib/image/src/image.min.js +1 -1
- package/lib/image/src/preview.js +28 -14
- package/lib/image/src/preview.min.js +1 -1
- package/lib/image/src/util.js +14 -0
- package/lib/image/src/util.min.js +1 -1
- package/lib/index.umd.js +96 -29
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/image/src/group.ts +22 -5
- package/packages/image/src/image.ts +26 -5
- package/packages/image/src/preview.ts +20 -13
- package/packages/image/src/util.ts +12 -1
- package/types/components/image-group.d.ts +23 -2
- package/types/components/image-preview.d.ts +12 -2
- package/types/components/image.d.ts +27 -3
- /package/es/icon/{iconfont.1752545171984.ttf → iconfont.1752569365688.ttf} +0 -0
- /package/es/icon/{iconfont.1752545171984.woff → iconfont.1752569365688.woff} +0 -0
- /package/es/icon/{iconfont.1752545171984.woff2 → iconfont.1752569365688.woff2} +0 -0
- /package/es/{iconfont.1752545171984.ttf → iconfont.1752569365688.ttf} +0 -0
- /package/es/{iconfont.1752545171984.woff → iconfont.1752569365688.woff} +0 -0
- /package/es/{iconfont.1752545171984.woff2 → iconfont.1752569365688.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1752545171984.ttf → iconfont.1752569365688.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1752545171984.woff → iconfont.1752569365688.woff} +0 -0
- /package/lib/icon/style/{iconfont.1752545171984.woff2 → iconfont.1752569365688.woff2} +0 -0
- /package/lib/{iconfont.1752545171984.ttf → iconfont.1752569365688.ttf} +0 -0
- /package/lib/{iconfont.1752545171984.woff → iconfont.1752569365688.woff} +0 -0
- /package/lib/{iconfont.1752545171984.woff2 → iconfont.1752569365688.woff2} +0 -0
package/lib/image/src/preview.js
CHANGED
|
@@ -39,7 +39,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
39
39
|
beforeDownloadMethod: Function,
|
|
40
40
|
downloadMethod: Function
|
|
41
41
|
},
|
|
42
|
-
emits: ['update:modelValue', 'change', 'download', 'download-fail', 'close'],
|
|
42
|
+
emits: ['update:modelValue', 'change', 'download', 'download-fail', 'rotate', 'close'],
|
|
43
43
|
setup(props, context) {
|
|
44
44
|
const {
|
|
45
45
|
emit
|
|
@@ -234,7 +234,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
234
234
|
reactData.offsetScale = Number(Math.max(-0.9, offsetScale - stepNum).toFixed(2));
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
-
const
|
|
237
|
+
const handleChangeEvent = (evnt, isNext) => {
|
|
238
238
|
let activeIndex = reactData.activeIndex || 0;
|
|
239
239
|
const imgList = computeImgList.value;
|
|
240
240
|
if (isNext) {
|
|
@@ -250,11 +250,21 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
250
250
|
activeIndex--;
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
|
-
|
|
253
|
+
const imgUrl = imgList[activeIndex || 0];
|
|
254
254
|
reactData.activeIndex = activeIndex;
|
|
255
|
+
resetStyle();
|
|
255
256
|
emitModel(activeIndex);
|
|
257
|
+
dispatchEvent('change', {
|
|
258
|
+
url: imgUrl,
|
|
259
|
+
activeIndex
|
|
260
|
+
}, evnt);
|
|
256
261
|
};
|
|
257
|
-
const
|
|
262
|
+
const handleRotateImgEvent = (evnt, isRight) => {
|
|
263
|
+
const imgList = computeImgList.value;
|
|
264
|
+
const {
|
|
265
|
+
activeIndex
|
|
266
|
+
} = reactData;
|
|
267
|
+
const imgUrl = imgList[activeIndex || 0];
|
|
258
268
|
let offsetRotate = reactData.offsetRotate;
|
|
259
269
|
if (isRight) {
|
|
260
270
|
offsetRotate += 90;
|
|
@@ -262,6 +272,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
262
272
|
offsetRotate -= 90;
|
|
263
273
|
}
|
|
264
274
|
reactData.offsetRotate = offsetRotate;
|
|
275
|
+
dispatchEvent('rotate', {
|
|
276
|
+
url: imgUrl,
|
|
277
|
+
rotateValue: offsetRotate
|
|
278
|
+
}, evnt);
|
|
265
279
|
};
|
|
266
280
|
const handlePct11 = () => {
|
|
267
281
|
resetStyle();
|
|
@@ -359,10 +373,10 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
359
373
|
handlePct11();
|
|
360
374
|
break;
|
|
361
375
|
case 'rotateLeft':
|
|
362
|
-
|
|
376
|
+
handleRotateImgEvent(evnt, false);
|
|
363
377
|
break;
|
|
364
378
|
case 'rotateRight':
|
|
365
|
-
|
|
379
|
+
handleRotateImgEvent(evnt, true);
|
|
366
380
|
break;
|
|
367
381
|
case 'print':
|
|
368
382
|
handlePrintImg();
|
|
@@ -444,21 +458,21 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
444
458
|
if (hasShiftKey) {
|
|
445
459
|
reactData.offsetLeft -= 1;
|
|
446
460
|
} else {
|
|
447
|
-
|
|
461
|
+
handleChangeEvent(evnt, false);
|
|
448
462
|
}
|
|
449
463
|
} else if (isRightArrow) {
|
|
450
464
|
evnt.preventDefault();
|
|
451
465
|
if (hasShiftKey) {
|
|
452
466
|
reactData.offsetLeft += 1;
|
|
453
467
|
} else {
|
|
454
|
-
|
|
468
|
+
handleChangeEvent(evnt, true);
|
|
455
469
|
}
|
|
456
470
|
} else if (isR && isControlKey) {
|
|
457
471
|
evnt.preventDefault();
|
|
458
472
|
if (hasShiftKey) {
|
|
459
|
-
|
|
473
|
+
handleRotateImgEvent(evnt, false);
|
|
460
474
|
} else {
|
|
461
|
-
|
|
475
|
+
handleRotateImgEvent(evnt, true);
|
|
462
476
|
}
|
|
463
477
|
} else if (isP && isControlKey) {
|
|
464
478
|
evnt.preventDefault();
|
|
@@ -538,15 +552,15 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
|
|
|
538
552
|
class: 'vxe-image-preview--close-bg'
|
|
539
553
|
})]), imgList.length > 1 ? (0, _vue.h)('div', {
|
|
540
554
|
class: 'vxe-image-preview--previous-btn',
|
|
541
|
-
onClick() {
|
|
542
|
-
|
|
555
|
+
onClick(evnt) {
|
|
556
|
+
handleChangeEvent(evnt, false);
|
|
543
557
|
}
|
|
544
558
|
}, [(0, _vue.h)('i', {
|
|
545
559
|
class: (0, _ui.getIcon)().IMAGE_PREVIEW_PREVIOUS
|
|
546
560
|
})]) : (0, _ui.renderEmptyElement)($xeImagePreview), imgList.length > 1 ? (0, _vue.h)('div', {
|
|
547
561
|
class: 'vxe-image-preview--next-btn',
|
|
548
|
-
onClick() {
|
|
549
|
-
|
|
562
|
+
onClick(evnt) {
|
|
563
|
+
handleChangeEvent(evnt, true);
|
|
550
564
|
}
|
|
551
565
|
}, [(0, _vue.h)('i', {
|
|
552
566
|
class: (0, _ui.getIcon)().IMAGE_PREVIEW_NEXT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_ui=require("../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils")),_dom=require("../../ui/src/dom");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeImagePreview",props:{modelValue:Number,urlList:Array,urlField:{type:String,default:()=>(0,_ui.getConfig)().imagePreview.urlField},maskClosable:{type:Boolean,default:()=>(0,_ui.getConfig)().imagePreview.maskClosable},marginSize:{type:String,default:()=>(0,_ui.getConfig)().imagePreview.marginSize},showPrintButton:{type:Boolean,default:()=>(0,_ui.getConfig)().imagePreview.showPrintButton},showDownloadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().imagePreview.showDownloadButton},toolbarConfig:Object,beforeDownloadMethod:Function,downloadMethod:Function},emits:["update:modelValue","change","download","download-fail","close"],setup(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _vue=require("vue"),_comp=require("../../ui/src/comp"),_ui=require("../../ui"),_xeUtils=_interopRequireDefault(require("xe-utils")),_dom=require("../../ui/src/dom");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeImagePreview",props:{modelValue:Number,urlList:Array,urlField:{type:String,default:()=>(0,_ui.getConfig)().imagePreview.urlField},maskClosable:{type:Boolean,default:()=>(0,_ui.getConfig)().imagePreview.maskClosable},marginSize:{type:String,default:()=>(0,_ui.getConfig)().imagePreview.marginSize},showPrintButton:{type:Boolean,default:()=>(0,_ui.getConfig)().imagePreview.showPrintButton},showDownloadButton:{type:Boolean,default:()=>(0,_ui.getConfig)().imagePreview.showDownloadButton},toolbarConfig:Object,beforeDownloadMethod:Function,downloadMethod:Function},emits:["update:modelValue","change","download","download-fail","rotate","close"],setup(u,e){const a=e["emit"];var t=_xeUtils.default.uniqueId();const i=(0,_vue.ref)(),o={refElem:i},c=(0,_vue.reactive)({activeIndex:u.modelValue||0,offsetPct11:!1,offsetScale:0,offsetRotate:0,offsetLeft:0,offsetTop:0}),r=(0,_vue.computed)(()=>u.urlField||"url"),_=(0,_vue.computed)(()=>_xeUtils.default.toNumber(u.marginSize||0)||16),s=(0,_vue.computed)(()=>Object.assign({},(0,_ui.getConfig)().imagePreview.toolbarConfig,u.toolbarConfig)),l=(0,_vue.computed)(()=>{var e=c["offsetRotate"];return e?e+"°":"0°"}),v=(0,_vue.computed)(()=>{var e=c["offsetScale"];return e?_xeUtils.default.ceil(100*(1+e))+"%":"100%"}),d=(0,_vue.computed)(()=>{var e=u["urlList"];const t=r.value;return e&&e.length?e.map(e=>_xeUtils.default.isString(e)?e:e[t]||""):[]}),n=(0,_vue.computed)(()=>{var{offsetScale:e,offsetRotate:o,offsetLeft:a,offsetTop:i}=c,r=[];let n=1;if(e&&(n=1+e,r.push(`scale(${n})`)),o&&r.push(`rotate(${o}deg)`),a||i){let e=a/=n,t=i/=n;if(o)switch(o%360){case 90:case-270:e=i,t=-a;break;case 180:case-180:e=-a,t=-i;break;case 270:case-90:e=-i,t=a}r.push(`translate(${e}px, ${t}px)`)}return r.length?r.join(" "):""}),f={computeImgList:d},m={xID:t,props:u,context:e,reactData:c,getRefMaps:()=>o,getComputeMaps:()=>f},p=(e,t,o)=>{a(e,(0,_ui.createEvent)(o,{$imagePreview:m},t))};t={dispatchEvent:p};const g=e=>{c.activeIndex=e,a("update:modelValue",e)},E=e=>{p("close",{},e)};const h=()=>{var e=i.value;(0,_dom.removeClass)(e,"is--move"),Object.assign(c,{offsetPct11:!1,offsetScale:0,offsetRotate:0,offsetLeft:0,offsetTop:0})},w=()=>{var e=c["offsetScale"];let t=.02;return t=-.6<=e&&(t=.04,-.4<=e)&&(t=.07,0<=e)&&(t=.1,3<=e)&&(t=.25,8<=e)&&(t=.4,16<=e)&&(t=.6,24<=e)&&(t=.9,32<=e)&&(t=1.3,39<=e)&&(t=1.9,45<=e)?2.5:t},x=e=>{var t=c["offsetScale"],o=w();c.offsetScale=e?Number(Math.min(49,t+o).toFixed(2)):Number(Math.max(-.9,t-o).toFixed(2))},I=(e,t)=>{let o=c.activeIndex||0;var a=d.value,t=(t?o>=a.length-1?o=0:o++:o<=0?o=a.length-1:o--,a[o||0]);c.activeIndex=o,h(),g(o),p("change",{url:t,activeIndex:o},e)},b=(e,t)=>{var o=d.value,a=c["activeIndex"],o=o[a||0];let i=c.offsetRotate;t?i+=90:i-=90,c.offsetRotate=i,p("rotate",{url:o,rotateValue:i},e)},P=()=>{var e=c["activeIndex"],e=d.value[e||0];_ui.VxeUI.print&&_ui.VxeUI.print({align:"center",pageBreaks:[{bodyHtml:`<img src="${e}" style="max-width:100%;max-height:100%;">`}]})},R=(e,t)=>{p("download",{url:t},e)},V=a=>{const i=c["activeIndex"];var e=s.value.download,e=!_xeUtils.default.isBoolean(e)&&e?Object.assign({},e):{};const r=d.value[i||0];var t=u.beforeDownloadMethod||e.beforeDownloadMethod||(0,_ui.getConfig)().imagePreview.beforeDownloadMethod;const n=u.downloadMethod||e.downloadMethod||(0,_ui.getConfig)().imagePreview.downloadMethod;Promise.resolve(!t||t({$imagePreview:m,url:r,index:i||0})).then(e=>{var t,o;e&&(n?Promise.resolve(n({$imagePreview:m,url:r,index:i||0})).then(()=>{R(a,r)}).catch(e=>e):(t=a,o=r,_ui.VxeUI.saveFile&&fetch(o).then(e=>e.blob().then(e=>{_ui.VxeUI.saveFile({filename:o,content:e}),R(t,o)})).catch(()=>{_ui.VxeUI.modal&&_ui.VxeUI.modal.message({content:(0,_ui.getI18n)("vxe.error.downErr"),status:"error"})})))})},O=(e,t)=>{var o=c["activeIndex"];if(d.value[o||0])switch(t){case"zoomOut":x(!1);break;case"zoomIn":x(!0);break;case"pctFull":h();break;case"pct11":h(),c.offsetPct11=!0;break;case"rotateLeft":b(e,!1);break;case"rotateRight":b(e,!0);break;case"print":P();break;case"download":V(e)}},L=e=>{e=e.deltaY;0<e?x(!1):e<0&&x(!0)},C=e=>{const{offsetTop:r,offsetLeft:n}=c,u=i.value,t=(e.preventDefault(),document.onmousemove),o=document.onmouseup,s=e.pageX,l=e.pageY,v=_.value;document.onmousemove=e=>{var{pageX:t,pageY:o}=e,{visibleHeight:a,visibleWidth:i}=(0,_dom.getDomNode)();e.preventDefault(),(0,_dom.addClass)(u,"is--move"),t>v&&o>v&&t<i-v&&o<a-v&&(c.offsetLeft=n+t-s,c.offsetTop=r+o-l)},document.onmouseup=()=>{document.onmousemove=t,document.onmouseup=o,(0,_dom.removeClass)(u,"is--move")}},M=e=>{var t=(0,_dom.hasControlKey)(e),o=e.shiftKey,a=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_UP),i=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_DOWN),r=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_LEFT),n=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.ARROW_RIGHT),u=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.R),s=_ui.globalEvents.hasKey(e,_ui.GLOBAL_EVENT_KEYS.P);a?(e.preventDefault(),o?--c.offsetTop:x(!0)):i?(e.preventDefault(),o?c.offsetTop+=1:x(!1)):r?(e.preventDefault(),o?--c.offsetLeft:I(e,!1)):n?(e.preventDefault(),o?c.offsetLeft+=1:I(e,!0)):u&&t?(e.preventDefault(),o?b(e,!1):b(e,!0)):s&&t&&(e.preventDefault(),P())},T=e=>{u.maskClosable&&e.target===e.currentTarget&&p("close",{},e)},y=(Object.assign(m,t,{}),(t,e)=>{var o=s.value[t],a=!_xeUtils.default.isBoolean(o)&&o?Object.assign({},o):{};return!1!==o?(0,_vue.h)("div",{class:"vxe-image-preview--operation-btn",title:(0,_ui.getI18n)("vxe.imagePreview.operBtn."+t),onClick(e){O(e,t)}},[(0,_vue.h)("i",{class:a.icon||(0,_ui.getIcon)()[e]})]):(0,_ui.renderEmptyElement)(m)});e=()=>{var e=c["offsetPct11"];return(0,_vue.h)("div",{ref:i,class:["vxe-image-preview",{"is--pct11":e}],onWheel:L},[(()=>{const o=c["activeIndex"];var e=d.value;const a=n.value;return(0,_vue.h)("div",{class:"vxe-image-preview--img-list",onClick:T},e.map((e,t)=>{t=o===t;return(0,_vue.h)("img",{class:["vxe-image-preview--img-item",{"is--active":t}],src:e,style:t?{transform:a}:null,onMousedown(e){C(e)}})}))})(),(()=>{var{showPrintButton:e,showDownloadButton:t}=u,o=c["activeIndex"],a=d.value,i=l.value,r=v.value,n=s.value;return(0,_vue.h)("div",{class:"vxe-image-preview--btn-wrapper"},[(0,_vue.h)("div",{class:"vxe-image-preview--close-wrapper"},[(0,_vue.h)("div",{class:"vxe-image-preview--close-btn",onClick:E},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().IMAGE_PREVIEW_CLOSE})]),(0,_vue.h)("div",{class:"vxe-image-preview--close-bg"})]),1<a.length?(0,_vue.h)("div",{class:"vxe-image-preview--previous-btn",onClick(e){I(e,!1)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().IMAGE_PREVIEW_PREVIOUS})]):(0,_ui.renderEmptyElement)(m),1<a.length?(0,_vue.h)("div",{class:"vxe-image-preview--next-btn",onClick(e){I(e,!0)}},[(0,_vue.h)("i",{class:(0,_ui.getIcon)().IMAGE_PREVIEW_NEXT})]):(0,_ui.renderEmptyElement)(m),(0,_vue.h)("div",{class:"vxe-image-preview--operation-info"},[(0,_vue.h)("div",{class:"vxe-image-preview--operation-deg"},i),(0,_vue.h)("div",{class:"vxe-image-preview--operation-pct"},r)]),(0,_vue.h)("div",{class:"vxe-image-preview--operation-wrapper"},[(0,_vue.h)("div",{class:"vxe-image-preview--operation-active-count"},[(0,_vue.h)("span",{class:"vxe-image-preview--operation-active-current"},""+((o||0)+1)),(0,_vue.h)("span",{class:"vxe-image-preview--operation-active-total"},"/"+a.length)]),y("zoomOut","IMAGE_PREVIEW_ZOOM_OUT"),y("zoomIn","IMAGE_PREVIEW_ZOOM_IN"),y("pctFull","IMAGE_PREVIEW_PCT_FULL"),y("pct11","IMAGE_PREVIEW_PCT_1_1"),y("rotateLeft","IMAGE_PREVIEW_ROTATE_LEFT"),y("rotateRight","IMAGE_PREVIEW_ROTATE_RIGHT"),e||n.print?y("print","IMAGE_PREVIEW_PRINT"):(0,_ui.renderEmptyElement)(m),t||n.download?y("download","IMAGE_PREVIEW_DOWNLOAD"):(0,_ui.renderEmptyElement)(m)])])})()])};return(0,_vue.watch)(()=>u.modelValue,e=>{c.activeIndex=e,h()}),(0,_vue.onMounted)(()=>{_ui.globalEvents.on(m,"keydown",M)}),(0,_vue.onBeforeUnmount)(()=>{var e=i.value;e&&(0,_dom.removeClass)(e,"is--move")}),(0,_vue.onUnmounted)(()=>{_ui.globalEvents.off(m,"keydown")}),(0,_vue.provide)("$xeImagePreview",m),m.renderVN=e}});
|
package/lib/image/src/util.js
CHANGED
|
@@ -18,6 +18,10 @@ const openPreviewImage = options => {
|
|
|
18
18
|
urlList,
|
|
19
19
|
activeIndex
|
|
20
20
|
} = opts;
|
|
21
|
+
const {
|
|
22
|
+
rotate,
|
|
23
|
+
change
|
|
24
|
+
} = opts.events || {};
|
|
21
25
|
const modalId = _xeUtils.default.uniqueId('image-preview');
|
|
22
26
|
_core.VxeUI.modal.open({
|
|
23
27
|
id: modalId,
|
|
@@ -44,6 +48,16 @@ const openPreviewImage = options => {
|
|
|
44
48
|
downloadMethod: opts.downloadMethod,
|
|
45
49
|
onClose() {
|
|
46
50
|
_core.VxeUI.modal.close(modalId);
|
|
51
|
+
},
|
|
52
|
+
onChange(eventParams) {
|
|
53
|
+
if (change) {
|
|
54
|
+
change.call(this, eventParams);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
onRotate(eventParams) {
|
|
58
|
+
if (rotate) {
|
|
59
|
+
rotate.call(this, eventParams);
|
|
60
|
+
}
|
|
47
61
|
}
|
|
48
62
|
});
|
|
49
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.openPreviewImage=void 0;var _vue=require("vue"),_core=require("@vxe-ui/core"),_preview=_interopRequireDefault(require("./preview")),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const openPreviewImage=e=>{if(_core.VxeUI.modal){const o=Object.assign({escClosable:!0},e),{urlList:r,activeIndex:t}=o,i=_xeUtils.default.uniqueId("image-preview");_core.VxeUI.modal.open({id:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.openPreviewImage=void 0;var _vue=require("vue"),_core=require("@vxe-ui/core"),_preview=_interopRequireDefault(require("./preview")),_xeUtils=_interopRequireDefault(require("xe-utils"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const openPreviewImage=e=>{if(_core.VxeUI.modal){const o=Object.assign({escClosable:!0},e),{urlList:r,activeIndex:t}=o,{rotate:i,change:l}=o.events||{},a=_xeUtils.default.uniqueId("image-preview");_core.VxeUI.modal.open({id:a,title:"预览",width:"100%",height:"100%",showHeader:!1,showFooter:!1,padding:!1,escClosable:o.escClosable,className:"vxe-image-preview-popup-wrapper",slots:{default(){return(0,_vue.h)(_preview.default,{modelValue:t,urlList:r,urlField:o.urlField,marginSize:o.marginSize,maskClosable:o.maskClosable,toolbarConfig:o.toolbarConfig,showPrintButton:o.showPrintButton,showDownloadButton:o.showDownloadButton,beforeDownloadMethod:o.beforeDownloadMethod,downloadMethod:o.downloadMethod,onClose(){_core.VxeUI.modal.close(a)},onChange(e){l&&l.call(this,e)},onRotate(e){i&&i.call(this,e)}})}}})}return Promise.resolve()};exports.openPreviewImage=openPreviewImage;
|
package/lib/index.umd.js
CHANGED
|
@@ -2074,6 +2074,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
2074
2074
|
globalResize: function() { return /* reexport */ globalResize; },
|
|
2075
2075
|
globalStore: function() { return /* reexport */ globalStore; },
|
|
2076
2076
|
handleCheckInfo: function() { return /* reexport */ handleCheckInfo; },
|
|
2077
|
+
hasComponent: function() { return /* reexport */ hasComponent; },
|
|
2077
2078
|
hasLanguage: function() { return /* reexport */ hasLanguage; },
|
|
2078
2079
|
hooks: function() { return /* reexport */ hooks; },
|
|
2079
2080
|
install: function() { return /* reexport */ install; },
|
|
@@ -2293,6 +2294,7 @@ __webpack_require__.d(components_namespaceObject, {
|
|
|
2293
2294
|
globalResize: function() { return globalResize; },
|
|
2294
2295
|
globalStore: function() { return globalStore; },
|
|
2295
2296
|
handleCheckInfo: function() { return handleCheckInfo; },
|
|
2297
|
+
hasComponent: function() { return hasComponent; },
|
|
2296
2298
|
hasLanguage: function() { return hasLanguage; },
|
|
2297
2299
|
hooks: function() { return hooks; },
|
|
2298
2300
|
install: function() { return install; },
|
|
@@ -2342,11 +2344,12 @@ if (typeof window !== 'undefined') {
|
|
|
2342
2344
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js
|
|
2343
2345
|
var es_array_push = __webpack_require__(4114);
|
|
2344
2346
|
;// CONCATENATED MODULE: ./node_modules/@vxe-ui/core/es/src/core.js
|
|
2345
|
-
const coreVersion = "4.2.
|
|
2347
|
+
const coreVersion = "4.2.3";
|
|
2346
2348
|
const VxeCore = {
|
|
2347
2349
|
coreVersion,
|
|
2348
2350
|
uiVersion: '',
|
|
2349
|
-
tableVersion: ''
|
|
2351
|
+
tableVersion: '',
|
|
2352
|
+
designVersion: ''
|
|
2350
2353
|
};
|
|
2351
2354
|
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
|
2352
2355
|
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(9274);
|
|
@@ -2913,7 +2916,7 @@ function createLog(type, name) {
|
|
|
2913
2916
|
return msg;
|
|
2914
2917
|
};
|
|
2915
2918
|
}
|
|
2916
|
-
const version = "4.2.
|
|
2919
|
+
const version = "4.2.3";
|
|
2917
2920
|
const log = {
|
|
2918
2921
|
create: createLog,
|
|
2919
2922
|
warn: createLog('warn', `v${version}`),
|
|
@@ -3411,6 +3414,9 @@ const components = {};
|
|
|
3411
3414
|
function getComponent(name) {
|
|
3412
3415
|
return components[name] || null;
|
|
3413
3416
|
}
|
|
3417
|
+
function hasComponent(name) {
|
|
3418
|
+
return !!components[name];
|
|
3419
|
+
}
|
|
3414
3420
|
function component(comp) {
|
|
3415
3421
|
if (comp && comp.name) {
|
|
3416
3422
|
components[comp.name] = comp;
|
|
@@ -3450,6 +3456,7 @@ const index_esm_VxeUI = Object.assign(VxeCore, {
|
|
|
3450
3456
|
hooks: hooks,
|
|
3451
3457
|
component,
|
|
3452
3458
|
getComponent,
|
|
3459
|
+
hasComponent,
|
|
3453
3460
|
useFns: useFns,
|
|
3454
3461
|
use
|
|
3455
3462
|
});
|
|
@@ -4278,14 +4285,14 @@ function checkDynamic() {
|
|
|
4278
4285
|
}
|
|
4279
4286
|
;// CONCATENATED MODULE: ./packages/ui/src/log.ts
|
|
4280
4287
|
|
|
4281
|
-
const log_version = `ui v${"4.7.
|
|
4288
|
+
const log_version = `ui v${"4.7.10"}`;
|
|
4282
4289
|
const warnLog = log.create('warn', log_version);
|
|
4283
4290
|
const errLog = log.create('error', log_version);
|
|
4284
4291
|
;// CONCATENATED MODULE: ./packages/ui/index.ts
|
|
4285
4292
|
|
|
4286
4293
|
|
|
4287
4294
|
|
|
4288
|
-
const ui_version = "4.7.
|
|
4295
|
+
const ui_version = "4.7.10";
|
|
4289
4296
|
index_esm_VxeUI.uiVersion = ui_version;
|
|
4290
4297
|
index_esm_VxeUI.dynamicApp = dynamicApp;
|
|
4291
4298
|
function config(options) {
|
|
@@ -23042,7 +23049,7 @@ const IconPicker = VxeIconPicker;
|
|
|
23042
23049
|
beforeDownloadMethod: Function,
|
|
23043
23050
|
downloadMethod: Function
|
|
23044
23051
|
},
|
|
23045
|
-
emits: ['update:modelValue', 'change', 'download', 'download-fail', 'close'],
|
|
23052
|
+
emits: ['update:modelValue', 'change', 'download', 'download-fail', 'rotate', 'close'],
|
|
23046
23053
|
setup(props, context) {
|
|
23047
23054
|
const {
|
|
23048
23055
|
emit
|
|
@@ -23237,7 +23244,7 @@ const IconPicker = VxeIconPicker;
|
|
|
23237
23244
|
reactData.offsetScale = Number(Math.max(-0.9, offsetScale - stepNum).toFixed(2));
|
|
23238
23245
|
}
|
|
23239
23246
|
};
|
|
23240
|
-
const
|
|
23247
|
+
const handleChangeEvent = (evnt, isNext) => {
|
|
23241
23248
|
let activeIndex = reactData.activeIndex || 0;
|
|
23242
23249
|
const imgList = computeImgList.value;
|
|
23243
23250
|
if (isNext) {
|
|
@@ -23253,11 +23260,21 @@ const IconPicker = VxeIconPicker;
|
|
|
23253
23260
|
activeIndex--;
|
|
23254
23261
|
}
|
|
23255
23262
|
}
|
|
23256
|
-
|
|
23263
|
+
const imgUrl = imgList[activeIndex || 0];
|
|
23257
23264
|
reactData.activeIndex = activeIndex;
|
|
23265
|
+
resetStyle();
|
|
23258
23266
|
emitModel(activeIndex);
|
|
23267
|
+
dispatchEvent('change', {
|
|
23268
|
+
url: imgUrl,
|
|
23269
|
+
activeIndex
|
|
23270
|
+
}, evnt);
|
|
23259
23271
|
};
|
|
23260
|
-
const
|
|
23272
|
+
const handleRotateImgEvent = (evnt, isRight) => {
|
|
23273
|
+
const imgList = computeImgList.value;
|
|
23274
|
+
const {
|
|
23275
|
+
activeIndex
|
|
23276
|
+
} = reactData;
|
|
23277
|
+
const imgUrl = imgList[activeIndex || 0];
|
|
23261
23278
|
let offsetRotate = reactData.offsetRotate;
|
|
23262
23279
|
if (isRight) {
|
|
23263
23280
|
offsetRotate += 90;
|
|
@@ -23265,6 +23282,10 @@ const IconPicker = VxeIconPicker;
|
|
|
23265
23282
|
offsetRotate -= 90;
|
|
23266
23283
|
}
|
|
23267
23284
|
reactData.offsetRotate = offsetRotate;
|
|
23285
|
+
dispatchEvent('rotate', {
|
|
23286
|
+
url: imgUrl,
|
|
23287
|
+
rotateValue: offsetRotate
|
|
23288
|
+
}, evnt);
|
|
23268
23289
|
};
|
|
23269
23290
|
const handlePct11 = () => {
|
|
23270
23291
|
resetStyle();
|
|
@@ -23362,10 +23383,10 @@ const IconPicker = VxeIconPicker;
|
|
|
23362
23383
|
handlePct11();
|
|
23363
23384
|
break;
|
|
23364
23385
|
case 'rotateLeft':
|
|
23365
|
-
|
|
23386
|
+
handleRotateImgEvent(evnt, false);
|
|
23366
23387
|
break;
|
|
23367
23388
|
case 'rotateRight':
|
|
23368
|
-
|
|
23389
|
+
handleRotateImgEvent(evnt, true);
|
|
23369
23390
|
break;
|
|
23370
23391
|
case 'print':
|
|
23371
23392
|
handlePrintImg();
|
|
@@ -23447,21 +23468,21 @@ const IconPicker = VxeIconPicker;
|
|
|
23447
23468
|
if (hasShiftKey) {
|
|
23448
23469
|
reactData.offsetLeft -= 1;
|
|
23449
23470
|
} else {
|
|
23450
|
-
|
|
23471
|
+
handleChangeEvent(evnt, false);
|
|
23451
23472
|
}
|
|
23452
23473
|
} else if (isRightArrow) {
|
|
23453
23474
|
evnt.preventDefault();
|
|
23454
23475
|
if (hasShiftKey) {
|
|
23455
23476
|
reactData.offsetLeft += 1;
|
|
23456
23477
|
} else {
|
|
23457
|
-
|
|
23478
|
+
handleChangeEvent(evnt, true);
|
|
23458
23479
|
}
|
|
23459
23480
|
} else if (isR && isControlKey) {
|
|
23460
23481
|
evnt.preventDefault();
|
|
23461
23482
|
if (hasShiftKey) {
|
|
23462
|
-
|
|
23483
|
+
handleRotateImgEvent(evnt, false);
|
|
23463
23484
|
} else {
|
|
23464
|
-
|
|
23485
|
+
handleRotateImgEvent(evnt, true);
|
|
23465
23486
|
}
|
|
23466
23487
|
} else if (isP && isControlKey) {
|
|
23467
23488
|
evnt.preventDefault();
|
|
@@ -23541,15 +23562,15 @@ const IconPicker = VxeIconPicker;
|
|
|
23541
23562
|
class: 'vxe-image-preview--close-bg'
|
|
23542
23563
|
})]), imgList.length > 1 ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
23543
23564
|
class: 'vxe-image-preview--previous-btn',
|
|
23544
|
-
onClick() {
|
|
23545
|
-
|
|
23565
|
+
onClick(evnt) {
|
|
23566
|
+
handleChangeEvent(evnt, false);
|
|
23546
23567
|
}
|
|
23547
23568
|
}, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('i', {
|
|
23548
23569
|
class: getIcon().IMAGE_PREVIEW_PREVIOUS
|
|
23549
23570
|
})]) : renderEmptyElement($xeImagePreview), imgList.length > 1 ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
23550
23571
|
class: 'vxe-image-preview--next-btn',
|
|
23551
|
-
onClick() {
|
|
23552
|
-
|
|
23572
|
+
onClick(evnt) {
|
|
23573
|
+
handleChangeEvent(evnt, true);
|
|
23553
23574
|
}
|
|
23554
23575
|
}, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('i', {
|
|
23555
23576
|
class: getIcon().IMAGE_PREVIEW_NEXT
|
|
@@ -23616,6 +23637,10 @@ const openPreviewImage = options => {
|
|
|
23616
23637
|
urlList,
|
|
23617
23638
|
activeIndex
|
|
23618
23639
|
} = opts;
|
|
23640
|
+
const {
|
|
23641
|
+
rotate,
|
|
23642
|
+
change
|
|
23643
|
+
} = opts.events || {};
|
|
23619
23644
|
const modalId = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId('image-preview');
|
|
23620
23645
|
index_esm_VxeUI.modal.open({
|
|
23621
23646
|
id: modalId,
|
|
@@ -23642,6 +23667,16 @@ const openPreviewImage = options => {
|
|
|
23642
23667
|
downloadMethod: opts.downloadMethod,
|
|
23643
23668
|
onClose() {
|
|
23644
23669
|
index_esm_VxeUI.modal.close(modalId);
|
|
23670
|
+
},
|
|
23671
|
+
onChange(eventParams) {
|
|
23672
|
+
if (change) {
|
|
23673
|
+
change.call(this, eventParams);
|
|
23674
|
+
}
|
|
23675
|
+
},
|
|
23676
|
+
onRotate(eventParams) {
|
|
23677
|
+
if (rotate) {
|
|
23678
|
+
rotate.call(this, eventParams);
|
|
23679
|
+
}
|
|
23645
23680
|
}
|
|
23646
23681
|
});
|
|
23647
23682
|
}
|
|
@@ -23687,9 +23722,10 @@ const openPreviewImage = options => {
|
|
|
23687
23722
|
size: {
|
|
23688
23723
|
type: String,
|
|
23689
23724
|
default: () => getConfig().image.size || getConfig().size
|
|
23690
|
-
}
|
|
23725
|
+
},
|
|
23726
|
+
getThumbnailUrlMethod: Function
|
|
23691
23727
|
},
|
|
23692
|
-
emits: ['click'],
|
|
23728
|
+
emits: ['click', 'change', 'rotate'],
|
|
23693
23729
|
setup(props, context) {
|
|
23694
23730
|
const {
|
|
23695
23731
|
emit
|
|
@@ -23751,6 +23787,14 @@ const openPreviewImage = options => {
|
|
|
23751
23787
|
const imgItem = computeImgItem.value;
|
|
23752
23788
|
return imgItem ? `${imgItem.url || ''}` : '';
|
|
23753
23789
|
});
|
|
23790
|
+
const computeImgThumbnailUrl = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
23791
|
+
const getThumbnailUrlFn = props.getThumbnailUrlMethod || getConfig().image.getThumbnailUrlMethod;
|
|
23792
|
+
const imgUrl = computeImgUrl.value;
|
|
23793
|
+
return getThumbnailUrlFn ? getThumbnailUrlFn({
|
|
23794
|
+
url: imgUrl,
|
|
23795
|
+
$image: $xeImage
|
|
23796
|
+
}) : '';
|
|
23797
|
+
});
|
|
23754
23798
|
const computeMaps = {
|
|
23755
23799
|
computeSize
|
|
23756
23800
|
};
|
|
@@ -23790,10 +23834,18 @@ const openPreviewImage = options => {
|
|
|
23790
23834
|
toolbarConfig,
|
|
23791
23835
|
showPrintButton,
|
|
23792
23836
|
showDownloadButton,
|
|
23793
|
-
maskClosable
|
|
23837
|
+
maskClosable,
|
|
23838
|
+
events: {
|
|
23839
|
+
change(eventParams) {
|
|
23840
|
+
$xeImage.dispatchEvent('click', eventParams, eventParams.$event);
|
|
23841
|
+
},
|
|
23842
|
+
rotate(eventParams) {
|
|
23843
|
+
$xeImage.dispatchEvent('click', eventParams, eventParams.$event);
|
|
23844
|
+
}
|
|
23845
|
+
}
|
|
23794
23846
|
});
|
|
23795
23847
|
}
|
|
23796
|
-
|
|
23848
|
+
$xeImage.dispatchEvent('click', {
|
|
23797
23849
|
url: imgUrl
|
|
23798
23850
|
}, evnt);
|
|
23799
23851
|
}
|
|
@@ -23808,6 +23860,7 @@ const openPreviewImage = options => {
|
|
|
23808
23860
|
} = props;
|
|
23809
23861
|
const imgStyle = computeImgStyle.value;
|
|
23810
23862
|
const imgUrl = computeImgUrl.value;
|
|
23863
|
+
const imgThumbnailUrl = computeImgThumbnailUrl.value;
|
|
23811
23864
|
const vSize = computeSize.value;
|
|
23812
23865
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('img', {
|
|
23813
23866
|
ref: refElem,
|
|
@@ -23815,7 +23868,7 @@ const openPreviewImage = options => {
|
|
|
23815
23868
|
[`size--${vSize}`]: vSize,
|
|
23816
23869
|
'is--circle': circle
|
|
23817
23870
|
}],
|
|
23818
|
-
src: imgUrl,
|
|
23871
|
+
src: imgThumbnailUrl || imgUrl,
|
|
23819
23872
|
alt,
|
|
23820
23873
|
loading,
|
|
23821
23874
|
style: imgStyle,
|
|
@@ -23870,9 +23923,10 @@ const image_Image = VxeImage;
|
|
|
23870
23923
|
showDownloadButton: {
|
|
23871
23924
|
type: Boolean,
|
|
23872
23925
|
default: () => getConfig().imageGroup.showDownloadButton
|
|
23873
|
-
}
|
|
23926
|
+
},
|
|
23927
|
+
getThumbnailUrlMethod: Function
|
|
23874
23928
|
},
|
|
23875
|
-
emits: ['click'],
|
|
23929
|
+
emits: ['click', 'change', 'rotate'],
|
|
23876
23930
|
setup(props, context) {
|
|
23877
23931
|
const {
|
|
23878
23932
|
emit
|
|
@@ -23904,6 +23958,9 @@ const image_Image = VxeImage;
|
|
|
23904
23958
|
const computeImgStyleOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
23905
23959
|
return Object.assign({}, getConfig().imageGroup.imageStyle, props.imageStyle);
|
|
23906
23960
|
});
|
|
23961
|
+
const computeGetThumbnailUrlMethod = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
23962
|
+
return props.getThumbnailUrlMethod || getConfig().imageGroup.getThumbnailUrlMethod;
|
|
23963
|
+
});
|
|
23907
23964
|
const computeMaps = {
|
|
23908
23965
|
computeSize
|
|
23909
23966
|
};
|
|
@@ -23938,10 +23995,18 @@ const image_Image = VxeImage;
|
|
|
23938
23995
|
urlList: imgList,
|
|
23939
23996
|
toolbarConfig,
|
|
23940
23997
|
showPrintButton,
|
|
23941
|
-
showDownloadButton
|
|
23998
|
+
showDownloadButton,
|
|
23999
|
+
events: {
|
|
24000
|
+
change(eventParams) {
|
|
24001
|
+
$xeImageGroup.dispatchEvent('click', eventParams, eventParams.$event);
|
|
24002
|
+
},
|
|
24003
|
+
rotate(eventParams) {
|
|
24004
|
+
$xeImageGroup.dispatchEvent('click', eventParams, eventParams.$event);
|
|
24005
|
+
}
|
|
24006
|
+
}
|
|
23942
24007
|
});
|
|
23943
24008
|
}
|
|
23944
|
-
|
|
24009
|
+
$xeImageGroup.dispatchEvent('click', {
|
|
23945
24010
|
url,
|
|
23946
24011
|
urlList: imgList
|
|
23947
24012
|
}, evnt);
|
|
@@ -23952,6 +24017,7 @@ const image_Image = VxeImage;
|
|
|
23952
24017
|
const imgList = computeImgList.value;
|
|
23953
24018
|
const vSize = computeSize.value;
|
|
23954
24019
|
const imgStyleOpts = computeImgStyleOpts.value;
|
|
24020
|
+
const getThumbnailUrlMethod = computeGetThumbnailUrlMethod.value;
|
|
23955
24021
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
23956
24022
|
class: ['vxe-image-group', {
|
|
23957
24023
|
[`size--${vSize}`]: vSize
|
|
@@ -23962,7 +24028,8 @@ const image_Image = VxeImage;
|
|
|
23962
24028
|
src: item.url,
|
|
23963
24029
|
alt: item.alt,
|
|
23964
24030
|
width: imgStyleOpts.width,
|
|
23965
|
-
height: imgStyleOpts.height
|
|
24031
|
+
height: imgStyleOpts.height,
|
|
24032
|
+
getThumbnailUrlMethod
|
|
23966
24033
|
});
|
|
23967
24034
|
}) : []);
|
|
23968
24035
|
};
|