eoss-ui 0.6.44 → 0.6.46

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.
Files changed (279) hide show
  1. package/lib/button-group.js +22 -17
  2. package/lib/button.js +24 -19
  3. package/lib/cascader.js +2 -2
  4. package/lib/checkbox-group.js +22 -17
  5. package/lib/config/api.js +4 -1
  6. package/lib/data-table-form.js +22 -17
  7. package/lib/data-table.js +22 -17
  8. package/lib/date-picker.js +24 -19
  9. package/lib/dialog.js +22 -17
  10. package/lib/enable-drag.js +830 -0
  11. package/lib/enterprise.js +2 -2
  12. package/lib/eoss-ui.common.js +2217 -961
  13. package/lib/error-page.js +2 -2
  14. package/lib/flow-group.js +24 -19
  15. package/lib/flow-list.js +105 -100
  16. package/lib/flow.js +748 -312
  17. package/lib/form.js +46 -49
  18. package/lib/handle-user.js +24 -19
  19. package/lib/handler.js +49 -29
  20. package/lib/icon.js +31 -26
  21. package/lib/icons.js +2 -2
  22. package/lib/index.js +1 -1
  23. package/lib/input-number.js +24 -19
  24. package/lib/input.js +24 -19
  25. package/lib/label.js +2 -2
  26. package/lib/login.js +22 -17
  27. package/lib/main.js +524 -254
  28. package/lib/menu.js +2 -2
  29. package/lib/nav.js +51 -121
  30. package/lib/notify.js +24 -19
  31. package/lib/page.js +24 -19
  32. package/lib/pagination.js +24 -19
  33. package/lib/player.js +24 -19
  34. package/lib/qr-code.js +37 -32
  35. package/lib/radio-group.js +24 -19
  36. package/lib/retrial-auth.js +24 -19
  37. package/lib/select-ganged.js +24 -19
  38. package/lib/select.js +24 -19
  39. package/lib/selector-panel.js +22 -17
  40. package/lib/selector.js +31 -26
  41. package/lib/sizer.js +24 -19
  42. package/lib/steps.js +24 -19
  43. package/lib/switch.js +31 -26
  44. package/lib/table-form.js +49 -24
  45. package/lib/tabs-panel.js +2 -2
  46. package/lib/tabs.js +24 -19
  47. package/lib/theme-chalk/enable-drag.css +1 -0
  48. package/lib/theme-chalk/index.css +1 -1
  49. package/lib/theme-chalk/login.css +1 -1
  50. package/lib/theme-chalk/main.css +1 -1
  51. package/lib/theme-chalk/nav.css +1 -1
  52. package/lib/theme-chalk/simplicity.css +1 -1
  53. package/lib/tips.js +24 -19
  54. package/lib/toolbar.js +2 -2
  55. package/lib/tree-group.js +24 -19
  56. package/lib/tree.js +24 -19
  57. package/lib/upload.js +32 -26
  58. package/lib/wujie.js +24 -19
  59. package/lib/wxlogin.js +167 -162
  60. package/package.json +159 -159
  61. package/packages/button/index.js +5 -5
  62. package/packages/button/src/main.vue +418 -418
  63. package/packages/button-group/index.js +5 -5
  64. package/packages/button-group/src/main.vue +298 -298
  65. package/packages/calendar/index.js +5 -5
  66. package/packages/card/index.js +5 -5
  67. package/packages/card/src/main.vue +156 -156
  68. package/packages/cascader/index.js +5 -5
  69. package/packages/cascader/src/main.vue +168 -168
  70. package/packages/checkbox-group/index.js +5 -5
  71. package/packages/checkbox-group/src/main.vue +333 -333
  72. package/packages/clients/index.js +5 -5
  73. package/packages/clients/src/main.vue +144 -144
  74. package/packages/data-table/index.js +5 -5
  75. package/packages/data-table/src/children.vue +39 -39
  76. package/packages/data-table/src/column.vue +989 -989
  77. package/packages/data-table/src/main.vue +1822 -1822
  78. package/packages/data-table/src/sizer.vue +195 -195
  79. package/packages/data-table-form/index.js +5 -5
  80. package/packages/data-table-form/src/checkbox.vue +101 -101
  81. package/packages/data-table-form/src/colgroup.vue +17 -17
  82. package/packages/data-table-form/src/main.vue +181 -181
  83. package/packages/data-table-form/src/radio.vue +65 -65
  84. package/packages/data-table-form/src/table.vue +233 -233
  85. package/packages/data-table-form/src/tbody.vue +336 -336
  86. package/packages/data-table-form/src/thead.vue +68 -68
  87. package/packages/date-picker/index.js +5 -5
  88. package/packages/date-picker/src/main.vue +236 -236
  89. package/packages/dialog/index.js +5 -5
  90. package/packages/enable-drag/index.js +5 -0
  91. package/packages/enable-drag/src/main.vue +355 -0
  92. package/packages/enterprise/index.js +5 -5
  93. package/packages/enterprise/src/main.vue +66 -66
  94. package/packages/error-page/index.js +5 -5
  95. package/packages/error-page/src/main.vue +44 -44
  96. package/packages/flow/index.js +5 -5
  97. package/packages/flow/src/component/CommonOpinions.vue +345 -345
  98. package/packages/flow/src/component/CustomPreset.vue +322 -322
  99. package/packages/flow/src/component/FileList.vue +99 -99
  100. package/packages/flow/src/component/Preset.vue +255 -255
  101. package/packages/flow/src/component/SendMsg.vue +229 -229
  102. package/packages/flow/src/component/TimeLimit.vue +190 -190
  103. package/packages/flow/src/component/taskUnionExamine.vue +611 -611
  104. package/packages/flow/src/form.vue +121 -121
  105. package/packages/flow/src/freeStartFlow.vue +2843 -2843
  106. package/packages/flow/src/main.vue +2964 -2952
  107. package/packages/flow/src/processForm.vue +1018 -1018
  108. package/packages/flow/src/processReject.vue +293 -293
  109. package/packages/flow/src/reset.vue +899 -899
  110. package/packages/flow/src/startTaskRead.vue +596 -596
  111. package/packages/flow/src/supervise.vue +138 -0
  112. package/packages/flow/src/table.vue +58 -58
  113. package/packages/flow-group/index.js +5 -5
  114. package/packages/flow-group/src/main.vue +688 -688
  115. package/packages/flow-list/index.js +5 -5
  116. package/packages/flow-list/src/main.vue +1183 -1183
  117. package/packages/form/index.js +5 -5
  118. package/packages/form/src/main.vue +3583 -3584
  119. package/packages/form/src/table.vue +1426 -1420
  120. package/packages/handle-user/index.js +5 -5
  121. package/packages/handle-user/src/main.vue +138 -138
  122. package/packages/handler/index.js +5 -5
  123. package/packages/handler/src/main.vue +491 -474
  124. package/packages/icon/index.js +5 -5
  125. package/packages/icon/src/main.vue +101 -101
  126. package/packages/icons/index.js +5 -5
  127. package/packages/icons/src/main.vue +81 -81
  128. package/packages/input/index.js +5 -5
  129. package/packages/input/src/main.vue +356 -356
  130. package/packages/input-number/index.js +5 -5
  131. package/packages/input-number/src/main.vue +106 -106
  132. package/packages/label/index.js +5 -5
  133. package/packages/label/src/main.vue +457 -457
  134. package/packages/layout/index.js +5 -5
  135. package/packages/layout/src/item.vue +152 -152
  136. package/packages/layout/src/main.vue +31 -31
  137. package/packages/login/index.js +5 -5
  138. package/packages/login/src/main.vue +1935 -1935
  139. package/packages/login/src/resetPassword.vue +562 -562
  140. package/packages/main/index.js +5 -5
  141. package/packages/main/src/default/index.vue +162 -3
  142. package/packages/main/src/default/message.vue +249 -249
  143. package/packages/main/src/default/notice.vue +157 -157
  144. package/packages/main/src/default/userinfo.vue +505 -505
  145. package/packages/main/src/public/online.vue +89 -89
  146. package/packages/main/src/public/search.vue +461 -461
  147. package/packages/main/src/public/settings.vue +221 -221
  148. package/packages/main/src/simplicity/apps.vue +388 -388
  149. package/packages/main/src/simplicity/avatar.vue +82 -82
  150. package/packages/main/src/simplicity/handler.vue +259 -259
  151. package/packages/main/src/simplicity/index.vue +2049 -2047
  152. package/packages/main/src/simplicity/lists.vue +84 -84
  153. package/packages/main/src/simplicity/menu-list.vue +128 -128
  154. package/packages/main/src/simplicity/message.vue +259 -259
  155. package/packages/main/src/simplicity/notice.vue +190 -190
  156. package/packages/main/src/simplicity/router-page.vue +45 -45
  157. package/packages/main/src/simplicity/sub-menu.vue +241 -241
  158. package/packages/main/src/simplicity/user.vue +257 -257
  159. package/packages/main/src/simplicity/userinfo.vue +312 -312
  160. package/packages/menu/index.js +5 -5
  161. package/packages/menu/src/main.vue +536 -536
  162. package/packages/nav/index.js +5 -5
  163. package/packages/nav/src/main.vue +351 -402
  164. package/packages/notify/index.js +5 -5
  165. package/packages/notify/src/main.vue +538 -538
  166. package/packages/page/index.js +5 -5
  167. package/packages/page/src/main.vue +167 -167
  168. package/packages/pagination/index.js +5 -5
  169. package/packages/pagination/src/main.vue +96 -96
  170. package/packages/player/index.js +5 -5
  171. package/packages/player/src/main.vue +194 -194
  172. package/packages/qr-code/index.js +5 -5
  173. package/packages/qr-code/src/main.vue +170 -170
  174. package/packages/radio-group/index.js +6 -6
  175. package/packages/radio-group/src/main.vue +319 -319
  176. package/packages/retrial-auth/index.js +5 -5
  177. package/packages/retrial-auth/src/main.vue +280 -280
  178. package/packages/select/index.js +5 -5
  179. package/packages/select/src/main.vue +775 -775
  180. package/packages/select-ganged/index.js +5 -5
  181. package/packages/select-ganged/src/main.vue +724 -724
  182. package/packages/selector/index.js +5 -5
  183. package/packages/selector/src/main.vue +689 -689
  184. package/packages/selector-panel/index.js +5 -5
  185. package/packages/selector-panel/src/main.vue +1027 -1027
  186. package/packages/selector-panel/src/selection.vue +177 -177
  187. package/packages/selector-panel/src/tree.vue +129 -129
  188. package/packages/sizer/index.js +5 -5
  189. package/packages/sizer/src/main.vue +254 -254
  190. package/packages/steps/index.js +5 -5
  191. package/packages/steps/src/main.vue +181 -181
  192. package/packages/switch/index.js +5 -5
  193. package/packages/switch/src/main.vue +154 -154
  194. package/packages/table-form/index.js +5 -5
  195. package/packages/tabs/index.js +5 -5
  196. package/packages/tabs/src/main.vue +788 -788
  197. package/packages/tabs-panel/index.js +5 -5
  198. package/packages/tabs-panel/src/main.vue +29 -29
  199. package/packages/theme-chalk/lib/enable-drag.css +1 -0
  200. package/packages/theme-chalk/lib/index.css +1 -1
  201. package/packages/theme-chalk/lib/login.css +1 -1
  202. package/packages/theme-chalk/lib/main.css +1 -1
  203. package/packages/theme-chalk/lib/nav.css +1 -1
  204. package/packages/theme-chalk/lib/simplicity.css +1 -1
  205. package/packages/theme-chalk/src/base.scss +260 -260
  206. package/packages/theme-chalk/src/button-group.scss +175 -175
  207. package/packages/theme-chalk/src/button.scss +24 -24
  208. package/packages/theme-chalk/src/calendar.scss +113 -113
  209. package/packages/theme-chalk/src/card.scss +99 -99
  210. package/packages/theme-chalk/src/checkbox-group.scss +8 -8
  211. package/packages/theme-chalk/src/clients.scss +87 -87
  212. package/packages/theme-chalk/src/data-table-form.scss +67 -67
  213. package/packages/theme-chalk/src/data-table.scss +293 -293
  214. package/packages/theme-chalk/src/date-picker.scss +7 -7
  215. package/packages/theme-chalk/src/dialog.scss +77 -77
  216. package/packages/theme-chalk/src/enable-drag.scss +181 -0
  217. package/packages/theme-chalk/src/enterprise.scss +5 -5
  218. package/packages/theme-chalk/src/error-page.scss +18 -18
  219. package/packages/theme-chalk/src/flow-group.scss +110 -110
  220. package/packages/theme-chalk/src/flow-list.scss +36 -36
  221. package/packages/theme-chalk/src/flow.scss +318 -318
  222. package/packages/theme-chalk/src/form.scss +496 -496
  223. package/packages/theme-chalk/src/handle-user.scss +40 -40
  224. package/packages/theme-chalk/src/handler.scss +143 -143
  225. package/packages/theme-chalk/src/icon.scss +1789 -1789
  226. package/packages/theme-chalk/src/icons.scss +99 -99
  227. package/packages/theme-chalk/src/index.scss +1 -0
  228. package/packages/theme-chalk/src/input.scss +9 -9
  229. package/packages/theme-chalk/src/label.scss +24 -24
  230. package/packages/theme-chalk/src/layout.scss +46 -46
  231. package/packages/theme-chalk/src/login.scss +969 -947
  232. package/packages/theme-chalk/src/main.scss +656 -639
  233. package/packages/theme-chalk/src/menu.scss +222 -222
  234. package/packages/theme-chalk/src/mixins/color.scss +117 -117
  235. package/packages/theme-chalk/src/nav.scss +111 -125
  236. package/packages/theme-chalk/src/page.scss +3 -3
  237. package/packages/theme-chalk/src/pagination.scss +29 -29
  238. package/packages/theme-chalk/src/player.scss +9 -9
  239. package/packages/theme-chalk/src/qr-code.scss +17 -17
  240. package/packages/theme-chalk/src/radio-group.scss +9 -9
  241. package/packages/theme-chalk/src/retrial-auth.scss +38 -38
  242. package/packages/theme-chalk/src/select-ganged.scss +8 -8
  243. package/packages/theme-chalk/src/select.scss +8 -8
  244. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  245. package/packages/theme-chalk/src/selector.scss +91 -91
  246. package/packages/theme-chalk/src/simplicity.scss +1265 -1262
  247. package/packages/theme-chalk/src/sizer.scss +36 -36
  248. package/packages/theme-chalk/src/steps.scss +88 -88
  249. package/packages/theme-chalk/src/switch.scss +3 -3
  250. package/packages/theme-chalk/src/table-form.scss +1 -1
  251. package/packages/theme-chalk/src/tabs.scss +87 -87
  252. package/packages/theme-chalk/src/tips.scss +7 -7
  253. package/packages/theme-chalk/src/toolbar.scss +179 -179
  254. package/packages/theme-chalk/src/tree-group.scss +72 -72
  255. package/packages/theme-chalk/src/tree.scss +165 -165
  256. package/packages/theme-chalk/src/upload.scss +167 -167
  257. package/packages/theme-chalk/src/wxlogin.scss +3 -3
  258. package/packages/tips/index.js +5 -5
  259. package/packages/tips/src/main.vue +141 -141
  260. package/packages/toolbar/index.js +5 -5
  261. package/packages/toolbar/src/main.vue +430 -430
  262. package/packages/tree/index.js +5 -5
  263. package/packages/tree-group/index.js +5 -5
  264. package/packages/upload/index.js +5 -5
  265. package/packages/upload/src/main.vue +1335 -1334
  266. package/packages/upload/src/picture.js +15 -15
  267. package/packages/wujie/index.js +5 -5
  268. package/packages/wujie/src/main.vue +145 -145
  269. package/packages/wxlogin/index.js +5 -5
  270. package/packages/wxlogin/src/main.vue +128 -128
  271. package/src/config/api.js +251 -248
  272. package/src/config/image.js +2 -2
  273. package/src/index.js +4 -1
  274. package/src/utils/bus.js +3 -3
  275. package/src/utils/date-util.js +312 -312
  276. package/src/utils/http.js +50 -50
  277. package/src/utils/rules.js +18 -18
  278. package/src/utils/store.js +21 -21
  279. package/src/utils/webSocket.js +107 -107
@@ -1,402 +1,351 @@
1
- <template>
2
- <div
3
- ref="esNav"
4
- class="es-nav"
5
- :class="biserial ? 'es-nav-biserial' : ''"
6
- :style="{ width: boxWidth, height: height }"
7
- >
8
- <div
9
- class="es-nav-initial"
10
- v-if="biserial"
11
- :style="{
12
- width: _navWidth,
13
- left:
14
- this.overlap && !this.subMenu.length
15
- ? '15px'
16
- : show
17
- ? '-' + boxWidth
18
- : ''
19
- }"
20
- >
21
- <es-menu
22
- :class="{ 'es-nav-overlap': overlap }"
23
- v-bind="$attrs"
24
- sub-nav
25
- :data="menu"
26
- :is-default="isDefault"
27
- :deep="false"
28
- :default-active="subActive"
29
- :biserial="biserial"
30
- :menu-icons="menuIcon"
31
- :icons="icons"
32
- :sub-icon="subIcon"
33
- @select="handleTrigger"
34
- ></es-menu>
35
- </div>
36
- <div
37
- class="es-nav-main"
38
- :class="{ 'es-nav-overlap': overlap }"
39
- :biserial="biserial"
40
- :style="{
41
- width: biserial ? width : boxWidth,
42
- left: biserial ? (show ? '15px' : navWidth) : ''
43
- }"
44
- v-show="showMenu"
45
- >
46
- <div class="es-nav-title" v-if="showTitle" ref="navTitle">
47
- <span v-show="!isCollapse">{{ headline }}</span>
48
- <template v-if="showCollapse">
49
- <i
50
- v-show="!isCollapse"
51
- class="es-icon-indent es-collapse-handle"
52
- @click="handleChange"
53
- ></i>
54
- <i
55
- v-show="isCollapse"
56
- class="es-icon-increase es-collapse-handle"
57
- @click="handleChange"
58
- ></i>
59
- </template>
60
- </div>
61
- <es-menu
62
- v-bind="$attrs"
63
- :class="biserial ? 'es-nav-biserial' : ''"
64
- :data="biserial ? subMenu : menu"
65
- :collapse="isCollapse"
66
- :default-active="menuActive"
67
- :width="isTop ? boxWidth : menuWidth"
68
- :height="menuHeight"
69
- :style="{ height: menuHeight }"
70
- :is-default="isDefault"
71
- :biserial="biserial"
72
- :paddingLeft="paddingLeft"
73
- :menu-icon="menuIcon"
74
- :icons="icons"
75
- :sub-icon="subIcon"
76
- @select="handleSelect"
77
- @open="handleOpen"
78
- @close="handleClose"
79
- ></es-menu>
80
- </div>
81
-
82
- <div v-show="show" ref="box" class="es-sets-button">
83
- <el-button
84
- round
85
- type="primary"
86
- class="es-icon-yingyonglan"
87
- ref="area"
88
- ></el-button>
89
- </div>
90
- </div>
91
- </template>
92
- <script>
93
- import util from 'eoss-ui/src/utils/util';
94
- import { debounce } from 'throttle-debounce';
95
- export default {
96
- name: 'EsNav',
97
- inheritAttrs: false,
98
- props: {
99
- isTop: Boolean,
100
- data: {
101
- type: Array,
102
- default: []
103
- },
104
- title: {
105
- type: [String, Boolean],
106
- default: ''
107
- },
108
- width: {
109
- type: String,
110
- default: '200px'
111
- },
112
- navWidth: {
113
- type: String,
114
- default: '70px'
115
- },
116
- showCollapse: {
117
- type: Boolean,
118
- default: true
119
- },
120
- collapse: {
121
- type: Boolean,
122
- default: false
123
- },
124
- //是否双列导航
125
- biserial: Boolean,
126
- defaultActive: [String, Array],
127
- isDefault: Boolean,
128
- paddingLeft: Number,
129
- menuIcon: String,
130
- icons: Object,
131
- subIcon: {
132
- type: Boolean,
133
- default: true
134
- },
135
- overlap: Boolean,
136
- //隐藏菜单
137
- hideSubMenu: Boolean
138
- },
139
- computed: {
140
- show() {
141
- return this.overlap && this.subMenu.length;
142
- },
143
- showMenu() {
144
- return this.biserial ? this.subMenu.length : this.menu.length;
145
- },
146
- menu() {
147
- return this.data;
148
- },
149
- showTitle() {
150
- if (this.title === false && this.showCollapse === false) {
151
- return false;
152
- }
153
- return true;
154
- },
155
- subActive() {
156
- let active =
157
- this.biserial &&
158
- Array.isArray(this.defaultActive) &&
159
- this.defaultActive.length
160
- ? this.defaultActive[0]
161
- : undefined;
162
- return active;
163
- },
164
- menuActive() {
165
- let active =
166
- typeof this.defaultActive === 'string'
167
- ? this.defaultActive
168
- : this.defaultActive && this.defaultActive.length
169
- ? this.defaultActive[this.defaultActive.length - 1]
170
- : undefined;
171
- return active;
172
- },
173
- boxWidth() {
174
- if (!this.biserial) {
175
- if (this.overlap) {
176
- return this.navWidth;
177
- }
178
- if (this.isShow) {
179
- return this.width;
180
- } else {
181
- return this.navWidth;
182
- }
183
- }
184
- return this.subMenu &&
185
- this.subMenu.length &&
186
- this.isShow &&
187
- !this.overlap &&
188
- !this.hideSubMenu
189
- ? parseInt(this.width, 10) + parseInt(this.navWidth, 10) + 'px'
190
- : this.navWidth;
191
- },
192
- _navWidth() {
193
- return this.overlap
194
- ? parseInt(this.navWidth, 10) - 30 + 'px'
195
- : this.navWidth;
196
- }
197
- },
198
- watch: {
199
- collapse(val) {
200
- this.isCollapse = this.biserial ? false : val;
201
- },
202
- title(val) {
203
- if (typeof val === 'string' && val) {
204
- this.headline = val;
205
- }
206
- },
207
- boxWidth() {
208
- this.getHeight();
209
- },
210
- biserial: {
211
- handler(val) {
212
- this.isShow = !val;
213
- this.getHeight();
214
- }
215
- },
216
- defaultActive: {
217
- immediate: true,
218
- deep: true,
219
- handler(val) {
220
- if (val && val.length) {
221
- if (typeof val !== 'string' && val.length) {
222
- this.isShow = true;
223
- if (this.biserial) {
224
- this.active = val[0];
225
- } else {
226
- this.active = val[val.length - 1];
227
- }
228
- this.menu.forEach((item) => {
229
- if (item.id === this.active) {
230
- this.subMenu = item.children || [];
231
- this.headline = this.title ? this.title : item.text;
232
- return;
233
- }
234
- });
235
- }
236
- }
237
- }
238
- },
239
- menu(val) {
240
- if (val && val.length) {
241
- if (
242
- this.defaultActive &&
243
- typeof this.defaultActive !== 'string' &&
244
- this.defaultActive.length
245
- ) {
246
- this.isShow = true;
247
- if (this.biserial) {
248
- this.active = this.defaultActive[0];
249
- } else {
250
- this.active = this.defaultActive[this.defaultActive.length - 1];
251
- }
252
- val.forEach((item) => {
253
- if (item.id === this.active) {
254
- this.subMenu = item.children || [];
255
- this.headline = this.title ? this.title : item.text;
256
- return;
257
- }
258
- });
259
- }
260
- } else {
261
- this.subMenu = [];
262
- }
263
- },
264
- showMenu(val) {
265
- if (val) {
266
- this.getHeight();
267
- }
268
- }
269
- },
270
- data() {
271
- return {
272
- menuWidth: this.width,
273
- height: '',
274
- menuHeight: '',
275
- active: '',
276
- isCollapse: this.biserial ? false : this.collapse,
277
- isShow: this.biserial ? false : true,
278
- headline: this.title,
279
- subMenu: []
280
- };
281
- },
282
- beforeCreate() {
283
- this.getHeight = debounce(500, () => {
284
- this.resetHeight();
285
- });
286
- },
287
- mounted() {
288
- this.getHeight();
289
- this.move();
290
- },
291
- methods: {
292
- //设置按钮拖动
293
- move() {
294
- let area = this.$refs.area.$el;
295
- let box = this.$refs.box;
296
- let [sTime, eTime] = [0, 0];
297
- area.addEventListener('mousedown', (e) => {
298
- sTime = new Date().getTime();
299
- let { y: downY, x: downX } = e;
300
- let { height: winH, width: winW } =
301
- document.body.getBoundingClientRect();
302
- //防止拖动期间选中和复制网页文本
303
- document.body.onselectstart = document.body.oncontextmenu = () => {
304
- return false;
305
- };
306
- document.onmousemove = (eve) => {
307
- let size = 40;
308
- let { y: moveY, x: moveX } = eve;
309
- let { top: boxTop, left: boxLeft } = box.getBoundingClientRect();
310
- boxTop += moveY - downY;
311
- boxLeft += moveX - downX;
312
- boxTop >= winH - size && (boxTop = winH - size);
313
- boxTop <= -size && (boxTop = -size);
314
- boxLeft >= winW - size && (boxLeft = winW - size);
315
- boxLeft <= -size && (boxLeft = -size);
316
- if (boxTop < 0) {
317
- boxTop = 0;
318
- }
319
- if (boxLeft < 0) {
320
- boxLeft = 0;
321
- }
322
- box.style.top = boxTop + 'px';
323
- box.style.left = boxLeft + 'px';
324
- downY = moveY;
325
- downX = moveX;
326
- };
327
- document.onmouseup = () => {
328
- eTime = new Date().getTime();
329
- let isClick = eTime - sTime < 200;
330
- if (isClick) {
331
- let onArea = () => {
332
- this.subMenu = [];
333
- area.removeEventListener('click', onArea);
334
- };
335
- area.addEventListener('click', onArea);
336
- }
337
- document.onmousemove = null;
338
- document.body.onselectstart = document.body.oncontextmenu = () => {
339
- return true;
340
- };
341
- };
342
- });
343
- },
344
- handleChange() {
345
- if (this.biserial) {
346
- this.isShow = !this.isShow;
347
- } else {
348
- this.isCollapse = !this.isCollapse;
349
- if (this.isCollapse) {
350
- this.isShow = false;
351
- this.menuWidth = this.navWidth;
352
- } else {
353
- this.isShow = true;
354
- this.menuWidth = this.width;
355
- }
356
- }
357
- },
358
- handleTrigger(res) {
359
- let { node } = res;
360
- if (node.children && node.children.length) {
361
- this.subMenu = node.children;
362
- this.headline = node.text;
363
- this.isShow = true;
364
- }
365
- this.$emit('trigger', res);
366
- },
367
- handleSelect(res) {
368
- this.$emit('select', res);
369
- },
370
- handleOpen(res) {
371
- this.$emit('open', res);
372
- },
373
- handleClose(res) {
374
- this.$emit('close', res);
375
- },
376
- resetHeight() {
377
- this.$nextTick(() => {
378
- let height = this.$refs.esNav.parentNode.offsetHeight;
379
- Array.from(this.$refs.esNav.parentNode.children).forEach((item) => {
380
- if (item !== this.$refs.esNav) {
381
- let mt = util.getStyle(item, 'margin-top');
382
- let mb = util.getStyle(item, 'margin-bottom');
383
- mt = mt ? parseInt(mt, 10) : 0;
384
- mb = mb ? parseInt(mb, 10) : 0;
385
- height -= item.offsetHeight + mt + mb;
386
- }
387
- });
388
- if (this.overlap) {
389
- height -= 15;
390
- }
391
- this.height = height + 'px';
392
- if (this.showTitle) {
393
- let theight = this.$refs.navTitle.offsetHeight;
394
- this.menuHeight = height - theight + 'px';
395
- } else {
396
- this.menuHeight = height + 'px';
397
- }
398
- });
399
- }
400
- }
401
- };
402
- </script>
1
+ <template>
2
+ <div
3
+ ref="esNav"
4
+ class="es-nav"
5
+ :class="biserial ? 'es-nav-biserial' : ''"
6
+ :style="{ width: boxWidth, height: height }"
7
+ >
8
+ <div
9
+ class="es-nav-initial"
10
+ v-if="biserial"
11
+ :style="{
12
+ width: _navWidth,
13
+ left:
14
+ this.overlap && !this.subMenu.length
15
+ ? '15px'
16
+ : show
17
+ ? '-' + boxWidth
18
+ : ''
19
+ }"
20
+ >
21
+ <es-menu
22
+ :class="{ 'es-nav-overlap': overlap }"
23
+ v-bind="$attrs"
24
+ sub-nav
25
+ :data="menu"
26
+ :is-default="isDefault"
27
+ :deep="false"
28
+ :default-active="subActive"
29
+ :biserial="biserial"
30
+ :menu-icons="menuIcon"
31
+ :icons="icons"
32
+ :sub-icon="subIcon"
33
+ @select="handleTrigger"
34
+ ></es-menu>
35
+ </div>
36
+ <div
37
+ class="es-nav-main"
38
+ :class="{ 'es-nav-overlap': overlap }"
39
+ :biserial="biserial"
40
+ :style="{
41
+ width: biserial ? width : boxWidth,
42
+ left: biserial ? (show ? '15px' : navWidth) : ''
43
+ }"
44
+ v-show="showMenu"
45
+ >
46
+ <div class="es-nav-title" v-if="showTitle" ref="navTitle">
47
+ <span v-show="!isCollapse">{{ headline }}</span>
48
+ <template v-if="showCollapse">
49
+ <i
50
+ v-show="!isCollapse"
51
+ class="es-icon-indent es-collapse-handle"
52
+ @click="handleChange"
53
+ ></i>
54
+ <i
55
+ v-show="isCollapse"
56
+ class="es-icon-increase es-collapse-handle"
57
+ @click="handleChange"
58
+ ></i>
59
+ </template>
60
+ </div>
61
+ <es-menu
62
+ v-bind="$attrs"
63
+ :class="biserial ? 'es-nav-biserial' : ''"
64
+ :data="biserial ? subMenu : menu"
65
+ :collapse="isCollapse"
66
+ :default-active="menuActive"
67
+ :width="isTop ? boxWidth : menuWidth"
68
+ :height="menuHeight"
69
+ :style="{ height: menuHeight }"
70
+ :is-default="isDefault"
71
+ :biserial="biserial"
72
+ :paddingLeft="paddingLeft"
73
+ :menu-icon="menuIcon"
74
+ :icons="icons"
75
+ :sub-icon="subIcon"
76
+ @select="handleSelect"
77
+ @open="handleOpen"
78
+ @close="handleClose"
79
+ ></es-menu>
80
+ </div>
81
+ <es-enable-drag
82
+ v-show="show"
83
+ :distance="0"
84
+ topDistance="100px"
85
+ leftDistance="0px"
86
+ @click="handleClick"
87
+ ></es-enable-drag>
88
+ </div>
89
+ </template>
90
+ <script>
91
+ import util from 'eoss-ui/src/utils/util';
92
+ import { debounce } from 'throttle-debounce';
93
+ export default {
94
+ name: 'EsNav',
95
+ inheritAttrs: false,
96
+ props: {
97
+ isTop: Boolean,
98
+ data: {
99
+ type: Array,
100
+ default: []
101
+ },
102
+ title: {
103
+ type: [String, Boolean],
104
+ default: ''
105
+ },
106
+ width: {
107
+ type: String,
108
+ default: '200px'
109
+ },
110
+ navWidth: {
111
+ type: String,
112
+ default: '70px'
113
+ },
114
+ showCollapse: {
115
+ type: Boolean,
116
+ default: true
117
+ },
118
+ collapse: {
119
+ type: Boolean,
120
+ default: false
121
+ },
122
+ //是否双列导航
123
+ biserial: Boolean,
124
+ defaultActive: [String, Array],
125
+ isDefault: Boolean,
126
+ paddingLeft: Number,
127
+ menuIcon: String,
128
+ icons: Object,
129
+ subIcon: {
130
+ type: Boolean,
131
+ default: true
132
+ },
133
+ overlap: Boolean,
134
+ //隐藏菜单
135
+ hideSubMenu: Boolean
136
+ },
137
+ computed: {
138
+ show() {
139
+ return this.overlap && this.subMenu.length;
140
+ },
141
+ showMenu() {
142
+ return this.biserial ? this.subMenu.length : this.menu.length;
143
+ },
144
+ menu() {
145
+ return this.data;
146
+ },
147
+ showTitle() {
148
+ if (this.title === false && this.showCollapse === false) {
149
+ return false;
150
+ }
151
+ return true;
152
+ },
153
+ subActive() {
154
+ let active =
155
+ this.biserial &&
156
+ Array.isArray(this.defaultActive) &&
157
+ this.defaultActive.length
158
+ ? this.defaultActive[0]
159
+ : undefined;
160
+ return active;
161
+ },
162
+ menuActive() {
163
+ let active =
164
+ typeof this.defaultActive === 'string'
165
+ ? this.defaultActive
166
+ : this.defaultActive && this.defaultActive.length
167
+ ? this.defaultActive[this.defaultActive.length - 1]
168
+ : undefined;
169
+ return active;
170
+ },
171
+ boxWidth() {
172
+ if (!this.biserial) {
173
+ if (this.overlap) {
174
+ return this.navWidth;
175
+ }
176
+ if (this.isShow) {
177
+ return this.width;
178
+ } else {
179
+ return this.navWidth;
180
+ }
181
+ }
182
+ return this.subMenu &&
183
+ this.subMenu.length &&
184
+ this.isShow &&
185
+ !this.overlap &&
186
+ !this.hideSubMenu
187
+ ? parseInt(this.width, 10) + parseInt(this.navWidth, 10) + 'px'
188
+ : this.navWidth;
189
+ },
190
+ _navWidth() {
191
+ return this.overlap
192
+ ? parseInt(this.navWidth, 10) - 30 + 'px'
193
+ : this.navWidth;
194
+ }
195
+ },
196
+ watch: {
197
+ collapse(val) {
198
+ this.isCollapse = this.biserial ? false : val;
199
+ },
200
+ title(val) {
201
+ if (typeof val === 'string' && val) {
202
+ this.headline = val;
203
+ }
204
+ },
205
+ boxWidth() {
206
+ this.getHeight();
207
+ },
208
+ biserial: {
209
+ handler(val) {
210
+ this.isShow = !val;
211
+ this.getHeight();
212
+ }
213
+ },
214
+ defaultActive: {
215
+ immediate: true,
216
+ deep: true,
217
+ handler(val) {
218
+ if (val && val.length) {
219
+ if (typeof val !== 'string' && val.length) {
220
+ this.isShow = true;
221
+ if (this.biserial) {
222
+ this.active = val[0];
223
+ } else {
224
+ this.active = val[val.length - 1];
225
+ }
226
+ this.menu.forEach((item) => {
227
+ if (item.id === this.active) {
228
+ this.subMenu = item.children || [];
229
+ this.headline = this.title ? this.title : item.text;
230
+ return;
231
+ }
232
+ });
233
+ }
234
+ }
235
+ }
236
+ },
237
+ menu(val) {
238
+ if (val && val.length) {
239
+ if (
240
+ this.defaultActive &&
241
+ typeof this.defaultActive !== 'string' &&
242
+ this.defaultActive.length
243
+ ) {
244
+ this.isShow = true;
245
+ if (this.biserial) {
246
+ this.active = this.defaultActive[0];
247
+ } else {
248
+ this.active = this.defaultActive[this.defaultActive.length - 1];
249
+ }
250
+ val.forEach((item) => {
251
+ if (item.id === this.active) {
252
+ this.subMenu = item.children || [];
253
+ this.headline = this.title ? this.title : item.text;
254
+ return;
255
+ }
256
+ });
257
+ }
258
+ } else {
259
+ this.subMenu = [];
260
+ }
261
+ },
262
+ showMenu(val) {
263
+ if (val) {
264
+ this.getHeight();
265
+ }
266
+ }
267
+ },
268
+ data() {
269
+ return {
270
+ menuWidth: this.width,
271
+ height: '',
272
+ menuHeight: '',
273
+ active: '',
274
+ isCollapse: this.biserial ? false : this.collapse,
275
+ isShow: this.biserial ? false : true,
276
+ headline: this.title,
277
+ subMenu: []
278
+ };
279
+ },
280
+ beforeCreate() {
281
+ this.getHeight = debounce(500, () => {
282
+ this.resetHeight();
283
+ });
284
+ },
285
+ mounted() {
286
+ this.getHeight();
287
+ },
288
+ methods: {
289
+ //设置按钮拖动
290
+ handleClick() {
291
+ this.subMenu = [];
292
+ },
293
+ handleChange() {
294
+ if (this.biserial) {
295
+ this.isShow = !this.isShow;
296
+ } else {
297
+ this.isCollapse = !this.isCollapse;
298
+ if (this.isCollapse) {
299
+ this.isShow = false;
300
+ this.menuWidth = this.navWidth;
301
+ } else {
302
+ this.isShow = true;
303
+ this.menuWidth = this.width;
304
+ }
305
+ }
306
+ },
307
+ handleTrigger(res) {
308
+ let { node } = res;
309
+ if (node.children && node.children.length) {
310
+ this.subMenu = node.children;
311
+ this.headline = node.text;
312
+ this.isShow = true;
313
+ }
314
+ this.$emit('trigger', res);
315
+ },
316
+ handleSelect(res) {
317
+ this.$emit('select', res);
318
+ },
319
+ handleOpen(res) {
320
+ this.$emit('open', res);
321
+ },
322
+ handleClose(res) {
323
+ this.$emit('close', res);
324
+ },
325
+ resetHeight() {
326
+ this.$nextTick(() => {
327
+ let height = this.$refs.esNav.parentNode.offsetHeight;
328
+ Array.from(this.$refs.esNav.parentNode.children).forEach((item) => {
329
+ if (item !== this.$refs.esNav) {
330
+ let mt = util.getStyle(item, 'margin-top');
331
+ let mb = util.getStyle(item, 'margin-bottom');
332
+ mt = mt ? parseInt(mt, 10) : 0;
333
+ mb = mb ? parseInt(mb, 10) : 0;
334
+ height -= item.offsetHeight + mt + mb;
335
+ }
336
+ });
337
+ if (this.overlap) {
338
+ height -= 15;
339
+ }
340
+ this.height = height + 'px';
341
+ if (this.showTitle) {
342
+ let theight = this.$refs.navTitle.offsetHeight;
343
+ this.menuHeight = height - theight + 'px';
344
+ } else {
345
+ this.menuHeight = height + 'px';
346
+ }
347
+ });
348
+ }
349
+ }
350
+ };
351
+ </script>