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.
@@ -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 !== 'img') return
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>
@@ -5,7 +5,7 @@ const IconFont = {
5
5
  props: {
6
6
  scriptUrl: {
7
7
  type: String,
8
- default: '//at.alicdn.com/t/c/font_4641025_tdg12oa0nfq.js'
8
+ default: '//at.alicdn.com/t/c/font_4641025_7wxxoh6rdl3.js'
9
9
  },
10
10
  type: {
11
11
  type: String,
@@ -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}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-component-gallery",
3
- "version": "2.0.35",
3
+ "version": "2.0.36",
4
4
  "description": "基础vue、antdvue、less实现的私有组件库",
5
5
  "main": "dist/index.umd.js",
6
6
  "files": [