bi-element-ui 1.6.20 → 1.6.21
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/lib/bi-element-ui-externals.common.js +1 -1
- package/lib/bi-element-ui-externals.common.js.gz +0 -0
- package/lib/bi-element-ui-externals.css +1 -0
- package/lib/bi-element-ui-externals.css.gz +0 -0
- package/lib/bi-element-ui-externals.umd.min.js +1 -1
- package/lib/bi-element-ui-externals.umd.min.js.gz +0 -0
- package/lib/bi-element-ui.common.js +1 -1
- package/lib/bi-element-ui.common.js.gz +0 -0
- package/lib/bi-element-ui.css +1 -0
- package/lib/bi-element-ui.css.gz +0 -0
- package/lib/bi-element-ui.esm.js +1 -1
- package/lib/bi-element-ui.esm.js.gz +0 -0
- package/lib/bi-element-ui.umd.min.js +1 -1
- package/lib/bi-element-ui.umd.min.js.gz +0 -0
- package/package.json +1 -1
- package/packages/ExternalFrame/index.js +7 -0
- package/packages/ExternalFrame/src/index.vue +201 -0
- package/packages/index.js +3 -1
|
Binary file
|
package/package.json
CHANGED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bi-external-frame">
|
|
3
|
+
<el-tabs
|
|
4
|
+
v-if="isGroup"
|
|
5
|
+
v-model="activeName"
|
|
6
|
+
class="external-frame-tabs"
|
|
7
|
+
@tab-click="saveActiveTab"
|
|
8
|
+
>
|
|
9
|
+
<el-tab-pane
|
|
10
|
+
v-for="item in tabList"
|
|
11
|
+
:key="item.name"
|
|
12
|
+
:name="item.name"
|
|
13
|
+
>
|
|
14
|
+
<span slot="label">
|
|
15
|
+
{{ item.name }}
|
|
16
|
+
<el-tooltip
|
|
17
|
+
content="在新标签页打开"
|
|
18
|
+
placement="top"
|
|
19
|
+
>
|
|
20
|
+
<i
|
|
21
|
+
class="el-icon-position external-frame-open"
|
|
22
|
+
@click.stop="openInNewTab(item)"
|
|
23
|
+
></i>
|
|
24
|
+
</el-tooltip>
|
|
25
|
+
</span>
|
|
26
|
+
</el-tab-pane>
|
|
27
|
+
</el-tabs>
|
|
28
|
+
<div class="external-frame-body">
|
|
29
|
+
<div class="external-frame-zoom">
|
|
30
|
+
<el-button
|
|
31
|
+
size="mini"
|
|
32
|
+
circle
|
|
33
|
+
icon="el-icon-add"
|
|
34
|
+
@click="zoomIn"
|
|
35
|
+
></el-button>
|
|
36
|
+
<el-button
|
|
37
|
+
size="mini"
|
|
38
|
+
circle
|
|
39
|
+
icon="el-icon-minus"
|
|
40
|
+
@click="zoomOut"
|
|
41
|
+
></el-button>
|
|
42
|
+
<el-button
|
|
43
|
+
size="mini"
|
|
44
|
+
circle
|
|
45
|
+
icon="el-icon-redo"
|
|
46
|
+
@click="zoomReset"
|
|
47
|
+
></el-button>
|
|
48
|
+
</div>
|
|
49
|
+
<div
|
|
50
|
+
v-if="activeUrl"
|
|
51
|
+
class="external-frame-iframe-box"
|
|
52
|
+
>
|
|
53
|
+
<iframe
|
|
54
|
+
:src="activeUrl"
|
|
55
|
+
:style="iframeStyle"
|
|
56
|
+
frameborder="0"
|
|
57
|
+
></iframe>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<script>
|
|
64
|
+
export default {
|
|
65
|
+
name: 'BiExternalFrame',
|
|
66
|
+
props: {
|
|
67
|
+
externalData: {
|
|
68
|
+
type: Object,
|
|
69
|
+
default: () => ({})
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
data() {
|
|
73
|
+
return {
|
|
74
|
+
activeName: '',
|
|
75
|
+
scale: 1
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
computed: {
|
|
79
|
+
linkType() {
|
|
80
|
+
return Number(this.externalData && this.externalData.external_link_type) || 1
|
|
81
|
+
},
|
|
82
|
+
tabList() {
|
|
83
|
+
return (this.externalData && Array.isArray(this.externalData.child)) ? this.externalData.child : []
|
|
84
|
+
},
|
|
85
|
+
isGroup() {
|
|
86
|
+
return this.linkType === 3 && this.tabList.length > 0
|
|
87
|
+
},
|
|
88
|
+
activeUrl() {
|
|
89
|
+
if (this.isGroup) {
|
|
90
|
+
const active = this.tabList.find((item) => item.name === this.activeName) || this.tabList[0]
|
|
91
|
+
return (active && active.external_link_url) || ''
|
|
92
|
+
}
|
|
93
|
+
return (this.externalData && this.externalData.external_link_url) || ''
|
|
94
|
+
},
|
|
95
|
+
iframeStyle() {
|
|
96
|
+
const pct = this.scale * 100
|
|
97
|
+
return {
|
|
98
|
+
width: pct + '%',
|
|
99
|
+
height: pct + '%'
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
memoryKey() {
|
|
103
|
+
return 'external-frame-' + ((this.externalData && this.externalData.id) || '')
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
watch: {
|
|
107
|
+
externalData: {
|
|
108
|
+
immediate: true,
|
|
109
|
+
handler() {
|
|
110
|
+
this.restoreActiveTab()
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
methods: {
|
|
115
|
+
restoreActiveTab() {
|
|
116
|
+
if (!this.isGroup) {
|
|
117
|
+
this.activeName = ''
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
const saved = window.localStorage.getItem(this.memoryKey) || ''
|
|
121
|
+
const hit = saved && this.tabList.find((item) => item.name === saved)
|
|
122
|
+
this.activeName = hit ? hit.name : this.tabList[0].name
|
|
123
|
+
},
|
|
124
|
+
saveActiveTab() {
|
|
125
|
+
if (!this.isGroup || !this.activeName) return
|
|
126
|
+
window.localStorage.setItem(this.memoryKey, this.activeName)
|
|
127
|
+
},
|
|
128
|
+
openInNewTab(item) {
|
|
129
|
+
const url = item && item.external_link_url
|
|
130
|
+
if (url) window.open(url, '_blank')
|
|
131
|
+
},
|
|
132
|
+
zoomIn() {
|
|
133
|
+
if (this.scale < 3) this.scale = +(this.scale + 0.1).toFixed(1)
|
|
134
|
+
},
|
|
135
|
+
zoomOut() {
|
|
136
|
+
if (this.scale > 0.5) this.scale = +(this.scale - 0.1).toFixed(1)
|
|
137
|
+
},
|
|
138
|
+
zoomReset() {
|
|
139
|
+
this.scale = 1
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
<style lang="scss" scoped>
|
|
146
|
+
.bi-external-frame {
|
|
147
|
+
flex: 1 1 0;
|
|
148
|
+
height: 0;
|
|
149
|
+
min-height: 0;
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
overflow: hidden;
|
|
153
|
+
background-color: #fff;
|
|
154
|
+
}
|
|
155
|
+
.external-frame-tabs {
|
|
156
|
+
flex-shrink: 0;
|
|
157
|
+
border-radius: 4px 4px 0 0;
|
|
158
|
+
::v-deep .el-tabs__header {
|
|
159
|
+
margin: 0;
|
|
160
|
+
}
|
|
161
|
+
::v-deep .el-tabs__content {
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
.external-frame-open {
|
|
166
|
+
margin-left: 4px;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
}
|
|
169
|
+
.external-frame-body {
|
|
170
|
+
flex: 1 1 0;
|
|
171
|
+
height: 0;
|
|
172
|
+
min-height: 0;
|
|
173
|
+
display: flex;
|
|
174
|
+
flex-direction: column;
|
|
175
|
+
position: relative;
|
|
176
|
+
}
|
|
177
|
+
.external-frame-zoom {
|
|
178
|
+
position: absolute;
|
|
179
|
+
z-index: 1;
|
|
180
|
+
right: 12px;
|
|
181
|
+
top: 10px;
|
|
182
|
+
overflow: hidden;
|
|
183
|
+
width: 112px;
|
|
184
|
+
transition: width 0.2s;
|
|
185
|
+
white-space: nowrap;
|
|
186
|
+
}
|
|
187
|
+
.external-frame-iframe-box {
|
|
188
|
+
flex: 1 1 0;
|
|
189
|
+
height: 0;
|
|
190
|
+
min-height: 0;
|
|
191
|
+
position: relative;
|
|
192
|
+
overflow: auto;
|
|
193
|
+
iframe {
|
|
194
|
+
position: absolute;
|
|
195
|
+
top: 0;
|
|
196
|
+
left: 0;
|
|
197
|
+
display: block;
|
|
198
|
+
border: 0;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
</style>
|
package/packages/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import BiMoreButton from './MoreButton'
|
|
|
12
12
|
import BiTooltipIcon from './TooltipIcon'
|
|
13
13
|
import BiNoticeCenter from './NoticeCenter'
|
|
14
14
|
import BiSystemLink from './SystemLink'
|
|
15
|
+
import BiExternalFrame from './ExternalFrame'
|
|
15
16
|
import BiAvatar from './Avatar'
|
|
16
17
|
import BiLog from './Log'
|
|
17
18
|
import BiLogDialog from './LogDialog'
|
|
@@ -42,7 +43,7 @@ import { openNoticeDialog } from './NoticeCenter/noticeDialogApi'
|
|
|
42
43
|
// import BiVerification from './Verification/index.js'
|
|
43
44
|
|
|
44
45
|
// 组件列表
|
|
45
|
-
const components = [BiTable, BiCustomColumn, BiDatePicker, BiDownloadCenter, BiTicketCenter, BiMoreButton, BiTooltipIcon, BiSystemLink, BiNoticeCenter, BiAvatar, BiLog, BiLogDialog, BiLogButton, BiHomeData, BiNavbarTool, BiSearchBlock, BiBlock, BiForm, BiFormItem, BiIcon, BiTextEditor, BiSuperDate, BiFireworks, BiDialog]
|
|
46
|
+
const components = [BiTable, BiCustomColumn, BiDatePicker, BiDownloadCenter, BiTicketCenter, BiMoreButton, BiTooltipIcon, BiSystemLink, BiExternalFrame, BiNoticeCenter, BiAvatar, BiLog, BiLogDialog, BiLogButton, BiHomeData, BiNavbarTool, BiSearchBlock, BiBlock, BiForm, BiFormItem, BiIcon, BiTextEditor, BiSuperDate, BiFireworks, BiDialog]
|
|
46
47
|
|
|
47
48
|
// =============================================
|
|
48
49
|
// 依赖检查机制 - 运行时检查必要的外部依赖
|
|
@@ -203,6 +204,7 @@ export default {
|
|
|
203
204
|
BiMoreButton,
|
|
204
205
|
BiTooltipIcon,
|
|
205
206
|
BiSystemLink,
|
|
207
|
+
BiExternalFrame,
|
|
206
208
|
BiNoticeCenter,
|
|
207
209
|
BiAvatar,
|
|
208
210
|
BiLog,
|