@lambo-design/pro-layout 1.0.0-beta.279 → 1.0.0-beta.280

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/pro-layout",
3
- "version": "1.0.0-beta.279",
3
+ "version": "1.0.0-beta.280",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -1,270 +1,58 @@
1
1
  <template>
2
2
  <Row class="pro-layout-tools-quick-icons">
3
- <Col class="font-padding">
4
- <Tooltip content="搜索菜单" placement="bottom">
5
- <Icon v-show="showSearchIcon" @click="handleIconClick" type="ios-search-outline" size="16" style="cursor: pointer" id="searchIcon"/>
6
- </Tooltip>
7
- <transition name="slide">
8
- <div class="topInput" id="modalTopInput" v-show="showTopInput" @click="handleTopInput">
9
- <Input v-model="searchTopText" clearable placeholder="搜索菜单" ref="topInput"
10
- :border="false" style="width: 200px;" @on-clear="handleTopInput"
11
- @on-change="handleTopInput" @on-blur="handleTopBlur">
12
- <template #prefix>
13
- <Icon type="ios-search" size="23"/>
14
- </template>
15
- </Input>
16
- </div>
17
- </transition>
18
- </Col>
19
3
  <Col v-for="(item,index) in rightTopOptButtonList" :key="index" class="font-padding">
20
- <Tooltip v-if="item === 'collect' && currentItem &&currentItem.type == 2" content="收藏" placement="bottom">
21
- <Icon @click="collectEvent" :type=" isCollected ? 'ios-star' : 'ios-star-outline'" size="16" style="cursor: pointer"/>
22
- </Tooltip>
23
- <Tooltip v-if="item === 'fullScreen'" :content="isFullScreen ? '退出全屏' : '全屏'" placement="bottom">
24
- <Icon @click="handleFullScreen" :type="isFullScreen ? 'md-contract' : 'md-expand'" size="16" style="cursor: pointer"/>
25
- </Tooltip>
26
- </Col>
27
- <Col>
28
- <Modal v-model="searchTopModal" class="quick-search-fast-con-modal" footer-hide :closable="false" :mask="false" id="topModalId"
29
- :styles="{top: '55px',width: '420px',float:'right'}">
30
- <div v-if="spinShowTop">
31
- <Spin size="large" v-if="spinShowTop" :show="spinShowTop">
32
- <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
33
- <div>加载中</div>
34
- </Spin>
35
- </div>
36
- <div v-else class="modal-content">
37
- <div v-for="(item,index) in menuData" :key="index">
38
- <div class="menu-style" @click="handleMenuClick(item)">
39
- <Icon :type="item.icon"/>
40
- <span class="label-style">{{ item.label }}</span>
41
- </div>
42
- </div>
43
- <div v-if="menuData.length === 0">
44
- <span class="no-result">暂无数据</span>
45
- </div>
46
- </div>
47
- </Modal>
4
+ <ProLayoutToolsQuickSearch v-show="item === 'search'"></ProLayoutToolsQuickSearch>
5
+ <ProLayoutToolsQuickCollect v-show="item === 'collect'"></ProLayoutToolsQuickCollect>
6
+ <ProLayoutToolsQuickFullscreen v-show="item === 'fullScreen'"></ProLayoutToolsQuickFullscreen>
7
+ <ProLayoutToolsQuickTodo v-show="item === 'todo'"></ProLayoutToolsQuickTodo>
8
+ <ProLayoutToolsQuickNotice v-show="item === 'notice'"></ProLayoutToolsQuickNotice>
48
9
  </Col>
49
10
  </Row>
50
11
  </template>
51
12
 
52
13
  <script>
53
14
  import Bus from '@lambo-design/shared/utils/bus'
54
- import { deepCopy } from '@lambo-design/shared/utils/assist'
15
+ import ProLayoutToolsQuickSearch from './pro-layout-tools-quick-search';
16
+ import ProLayoutToolsQuickCollect from './pro-layout-tools-quick-collect';
17
+ import ProLayoutToolsQuickFullscreen from './pro-layout-tools-quick-fullscreen';
18
+ import ProLayoutToolsQuickTodo from './pro-layout-tools-quick-todo';
19
+ import ProLayoutToolsQuickNotice from './pro-layout-tools-quick-notice';
20
+ import {deepCopy} from "@lambo-design/shared/utils/assist";
55
21
 
56
22
  export default {
57
23
  name: 'pro-layout-tools-quick-icons',
58
24
  data() {
59
25
  return {
60
- originAllMenuList:[],
61
- menuList: [],
62
- currentName: '',
63
- currentItem: {},
64
- collectMenuList: [],
65
- isFullScreen:false,
66
- isCollected:false,
67
- rightTopOptButtonList: ['collect','fullScreen','search'],
68
- showSearchIcon:true,
69
- searchTopModal:false,
70
- searchTopText:'',
71
- showTopInput:false,
72
- spinShowTop:false,
73
- menuData:[]
26
+ rightTopOptButtonList: ['search','collect','fullScreen']
74
27
  }
75
28
  },
76
- watch: {
77
- collectMenuList(){
78
- this.changeCollectMenu();
79
- },
80
- currentName(){
81
- this.changeCollectMenu();
82
- }
29
+ components:{
30
+ ProLayoutToolsQuickSearch,
31
+ ProLayoutToolsQuickCollect,
32
+ ProLayoutToolsQuickFullscreen,
33
+ ProLayoutToolsQuickTodo,
34
+ ProLayoutToolsQuickNotice
83
35
  },
84
36
  methods: {
85
37
  initListener() {
86
38
  Bus.$on('system-info',(data) => {
87
39
  this.initSystemInfo(data);
88
40
  })
89
- Bus.$on('origin-all-menu-list', (data) => {
90
- this.initOriginAllMenu(data);
91
- })
92
- Bus.$on('menu-list', (data) => {
93
- this.initMenu(data);
94
- })
95
- Bus.$on('menu-click',(name,item) => {
96
- this.initMenuClick(name, item)
97
- })
98
- Bus.$on('collect-menu-list',(data)=>{
99
- this.initCollectMenu(data)
100
- });
101
41
  },
102
42
  destroyListener() {
103
43
  Bus.$off('system-info')
104
- Bus.$off('origin-all-menu-list')
105
- Bus.$off('menu-list')
106
- Bus.$off('menu-click')
107
- Bus.$off('collect-menu-list')
108
44
  },
109
45
  initSystemInfo(data){
110
46
  if (data && data.rightTopOptButtonList) {
111
47
  this.rightTopOptButtonList = deepCopy(data.rightTopOptButtonList)
112
48
  }
113
49
  },
114
- initOriginAllMenu(data){
115
- this.originAllMenuList = deepCopy(data);
116
- },
117
- initMenu(data){
118
- this.menuList = deepCopy(data);
119
- this.menuData = this.menuList.filter(menuItem => {
120
- return menuItem.type === 2;
121
- });
122
- },
123
- initMenuClick(name, item){
124
- this.currentName = name
125
- if(item) {
126
- this.currentItem = item;
127
- } else {
128
- this.currentItem = this.menuList.find(menu => menu.name == name)
129
- }
130
- },
131
- initCollectMenu(data){
132
- this.collectMenuList = deepCopy(data);
133
- },
134
- changeCollectMenu(){
135
- this.isCollected = false
136
- let collectMenu = this.collectMenuList.find(item => item.name == this.currentName)
137
- this.isCollected = !!collectMenu;
138
- },
139
- collectEvent(){
140
- Bus.$emit('toggle-collect-menu',!this.isCollected,this.currentItem)
141
- },
142
- handleKeyPress(event){
143
- // 按下 F11 键时触发全屏切换
144
- if (event.key === 'F11') {
145
- event.preventDefault(); // 防止浏览器默认行为
146
- this.handleFullScreen();
147
- }
148
- },
149
- // 全屏事件
150
- handleFullScreen() {
151
- let element = document.documentElement;
152
- // 如果是全屏,退出
153
- if (this.isFullScreen) {
154
- this.isFullScreen = !this.isFullScreen
155
- if (document.exitFullscreen) {
156
- document.exitFullscreen();
157
- } else if (document.webkitCancelFullScreen) {
158
- document.webkitCancelFullScreen();
159
- } else if (document.mozCancelFullScreen) {
160
- document.mozCancelFullScreen();
161
- } else if (document.msExitFullscreen) {
162
- document.msExitFullscreen();
163
- }
164
- } else { // 否则,进入全屏
165
- this.isFullScreen = !this.isFullScreen
166
- if (element.requestFullscreen) {
167
- element.requestFullscreen();
168
- } else if (element.webkitRequestFullScreen) {
169
- element.webkitRequestFullScreen();
170
- } else if (element.mozRequestFullScreen) {
171
- element.mozRequestFullScreen();
172
- } else if (element.msRequestFullscreen) {
173
- // IE11
174
- element.msRequestFullscreen();
175
- }
176
- }
177
- // 改变当前全屏状态
178
- // this.isFullScreen = !this.isFullScreen;
179
- },
180
- //判断浏览器是否处于全屏状态
181
- checkFull() {
182
- let isFull = document.mozFullScreen ||
183
- document.fullScreen ||
184
- document.webkitIsFullScreen ||
185
- document.webkitRequestFullScreen ||
186
- document.mozRequestFullScreen ||
187
- document.msFullscreenEnabled;
188
- if (isFull === undefined) isFull = false;
189
- return isFull;
190
- },
191
-
192
- handleSelect(name,item){
193
- Bus.$emit('select-menu',name,item)
194
- this.searchTopModal = false
195
- },
196
- handleTopInput(){
197
- this.searchTopModal = true
198
- this.spinShowTop = true
199
- // 使用 filter 方法找到所有匹配的菜单项
200
- const regex = new RegExp(this.searchTopText, "i");
201
- this.menuData = this.menuList.filter(menuItem => {
202
- return menuItem.label.match(regex) && menuItem.type === 2;
203
- });
204
- this.spinShowTop = false
205
- },
206
- handleTopBlur(){
207
- this.searchTopModal = false
208
- this.showTopInput = false
209
- this.showSearchIcon = true
210
- },
211
- handleIconClick(){
212
- this.showTopInput = true
213
- this.showSearchIcon = false
214
- this.searchTopModal = true
215
- },
216
- handleOutsideClick(event) {
217
- if(document.getElementById("topModalId") && !document.getElementById("topModalId").contains(event.target)
218
- && document.getElementById("modalTopInput") && !document.getElementById("modalTopInput").contains(event.target)
219
- && document.getElementById("searchIcon") && !document.getElementById("searchIcon").contains(event.target)){
220
- let clearButton = event.target.closest(".ivu-icon-ios-close-circle");
221
- if(clearButton){
222
- this.searchTopModal = true;
223
- this.showTopInput = true;
224
- this.showSearchIcon = false;
225
- } else {
226
- setTimeout(() => {
227
- this.searchTopModal = false;
228
- this.showTopInput = false;
229
- this.showSearchIcon = true
230
- }, 525);
231
- }
232
- }
233
- },
234
- handleMenuClick(item){
235
- Bus.$emit('select-menu',item.name,item)
236
- }
237
50
  },
238
51
  created() {
239
52
  this.initListener()
240
53
  },
241
- mounted() {
242
- let self = this
243
- document.addEventListener('keydown', this.handleKeyPress);
244
- //由于 全屏状态下 ,按 "Esc" 键退出全屏,浏览器监听不到 "Esc" 键的事件,所以需要通过浏览器窗口大小改变的事件去触发退出全屏事件
245
- window.addEventListener("resize", function () {
246
- //增加 timer 定时器的原因是全屏和退出全屏的事件会触发两次窗口大小改变事件,做一次过滤
247
- if (self.timer) return;
248
- self.timer = setTimeout(() => {
249
- // 如果是按 "Esc" 键退出全屏,窗口状态已经是非全屏,但是之前记录的状态还是全屏的状态
250
- if (!self.checkFull() && self.isFullScreen) {
251
- //退出全屏状态。。。
252
- self.isFullScreen = false;
253
- // self.pageExitFullScreen();
254
- }else{
255
-
256
- //进入全屏状态。。。
257
- }
258
- clearTimeout(self.timer);
259
- self.timer = null;
260
- }, 0);
261
- });
262
- window.addEventListener("click", this.handleOutsideClick);
263
- },
264
54
  beforeDestroy() {
265
55
  this.destroyListener()
266
- document.removeEventListener('keydown', this.handleKeyPress);
267
- window.removeEventListener("click", this.handleOutsideClick);
268
56
  }
269
57
  }
270
58
  </script>
@@ -274,45 +62,5 @@ export default {
274
62
  .font-padding {
275
63
  padding-right: 10px
276
64
  }
277
- .topInput{
278
- float: right;
279
- position: relative;
280
- z-index: 1000;
281
- margin-top: 0px;
282
- margin-left: 10px;
283
- }
284
- .slide-enter-active,
285
- .slide-leave-active{
286
- transition: transform 0.5s;
287
- }
288
- .slide-enter{
289
- transform: translateX(100%);
290
- }
291
- .slide-leave-to{
292
- transform: translateX(175px);
293
- }
294
- }
295
- </style>
296
- <style lang="less">
297
- @import '@lambo-design/core/src/styles/default.less';
298
- .quick-search-fast-con-modal {
299
- .modal-content {
300
- .menu-style {
301
- margin : 5px;
302
- font-size : 16px;
303
- display : inline-block;
304
- cursor : pointer;
305
- &:hover{
306
- color: var(--primary-color,@_primary-color);
307
- }
308
- }
309
- .label-style {
310
- height : 13px;
311
- font-size : 14px;
312
- font-weight : 500;
313
- margin-left : 5px;
314
- line-height : 18px;
315
- }
316
- }
317
65
  }
318
66
  </style>