web-component-gallery 2.0.35 → 2.0.36
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/js.umd.js +1 -1
- package/lib/browse/index.jsx +29 -6
- package/lib/descriptions-list/index.jsx +2 -1
- package/lib/icon-font/index.js +1 -1
- package/lib/model/Model.js +1 -1
- package/package.json +1 -1
package/lib/browse/index.jsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import PropTypes from 'ant-design-vue/es/_util/vue-types'
|
|
2
|
-
|
|
3
2
|
import { Base64 } from '../../utils/Base64'
|
|
3
|
+
import { IconFont } from '../index'
|
|
4
4
|
|
|
5
5
|
const BrowseProps = {
|
|
6
6
|
data: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.object]).def([]),
|
|
7
|
+
/** 是否缩略图显示 */
|
|
8
|
+
isThumb: PropTypes.bool,
|
|
7
9
|
/** 支持http地址可配置 */
|
|
8
10
|
httpsUrl: PropTypes.object.def({}),
|
|
9
11
|
/** 限制高度 */
|
|
@@ -45,7 +47,7 @@ const setInnerData = (data, https) => {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
// 不同类型不同容器承载
|
|
48
|
-
const getCustomTag = (url) => {
|
|
50
|
+
export const getCustomTag = (url) => {
|
|
49
51
|
const ext = url.slice(url.lastIndexOf('.') + 1).toLowerCase()
|
|
50
52
|
if (FILE_TYPES.PICTURE.includes(ext)) return 'img'
|
|
51
53
|
if (FILE_TYPES.AUDIO.includes(ext)) return 'audio'
|
|
@@ -54,7 +56,14 @@ const getCustomTag = (url) => {
|
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
function renderContent(h, url, images) {
|
|
57
|
-
const { astrictH, $viewerApi } = this
|
|
59
|
+
const { isThumb, astrictH, $viewerApi, $postM } = this
|
|
60
|
+
|
|
61
|
+
const MEDIA_TYPES = {
|
|
62
|
+
IFRAME: 'iframe',
|
|
63
|
+
IMAGE: 'img'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const ICON_TYPE = "icon-file_thumb"
|
|
58
67
|
|
|
59
68
|
const CustomTag = getCustomTag(url)
|
|
60
69
|
|
|
@@ -63,10 +72,17 @@ function renderContent(h, url, images) {
|
|
|
63
72
|
...(astrictH && { style: `width: auto; height: ${astrictH}px; objectFit: contain;` })
|
|
64
73
|
}
|
|
65
74
|
|
|
66
|
-
if (CustomTag === 'iframe') attrs['controls'] = true
|
|
67
|
-
|
|
68
75
|
const handleClick = () => {
|
|
69
|
-
if (CustomTag !==
|
|
76
|
+
if (CustomTag !== MEDIA_TYPES.IMAGE && !isThumb) return
|
|
77
|
+
|
|
78
|
+
if (CustomTag === MEDIA_TYPES.IFRAME && isThumb) {
|
|
79
|
+
$postM({
|
|
80
|
+
type: 'customModal',
|
|
81
|
+
name: 'browse',
|
|
82
|
+
params: { data: { url } }
|
|
83
|
+
})
|
|
84
|
+
return
|
|
85
|
+
}
|
|
70
86
|
|
|
71
87
|
try {
|
|
72
88
|
$viewerApi({
|
|
@@ -80,6 +96,13 @@ function renderContent(h, url, images) {
|
|
|
80
96
|
} catch(error){ console.error('未安装v-viewer@1.6.4组件库') }
|
|
81
97
|
}
|
|
82
98
|
|
|
99
|
+
if (CustomTag === MEDIA_TYPES.IFRAME) {
|
|
100
|
+
if (isThumb) {
|
|
101
|
+
return <IconFont type={ICON_TYPE} onClick={handleClick} />
|
|
102
|
+
}
|
|
103
|
+
attrs['controls'] = true
|
|
104
|
+
}
|
|
105
|
+
|
|
83
106
|
return <CustomTag {...{ attrs }} onClick={handleClick} />
|
|
84
107
|
}
|
|
85
108
|
|
|
@@ -29,6 +29,7 @@ const renderContent = (h, item, details) => {
|
|
|
29
29
|
transferData(details[item.props], 'Array')
|
|
30
30
|
const props = {
|
|
31
31
|
data,
|
|
32
|
+
isThumb: true,
|
|
32
33
|
astrictH: 104
|
|
33
34
|
}
|
|
34
35
|
return (
|
|
@@ -66,7 +67,7 @@ const DescriptionsList = {
|
|
|
66
67
|
renderContent(h, descItem, descDetails)
|
|
67
68
|
}
|
|
68
69
|
</DescriptionsItem>
|
|
69
|
-
)
|
|
70
|
+
)
|
|
70
71
|
} )
|
|
71
72
|
}
|
|
72
73
|
</Descriptions>
|
package/lib/icon-font/index.js
CHANGED
package/lib/model/Model.js
CHANGED
|
@@ -90,7 +90,7 @@ export default {
|
|
|
90
90
|
// multipleConfig为配置的动态项数据
|
|
91
91
|
return dynamicModel.map((modelItem, key) => {
|
|
92
92
|
// 为动态项时重新定义绑定key、prop等来进行检验
|
|
93
|
-
props.multipleConfig.map((configItem) => {
|
|
93
|
+
return props.multipleConfig.map((configItem) => {
|
|
94
94
|
const childAttrs = {
|
|
95
95
|
key,
|
|
96
96
|
prop: `${props.model}.${key}.${configItem.model}`,
|