web-component-gallery 1.3.12 → 2.0.2

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 (218) hide show
  1. package/dist/923.umd.js +1 -0
  2. package/dist/index.umd.js +1 -12252
  3. package/dist/js.umd.js +1 -0
  4. package/dist/style.css +17 -0
  5. package/dist/style.umd.js +1 -0
  6. package/{method → extensions}/AMap.js +1 -5
  7. package/{plugins/method → extensions}/Dialog.js +2 -2
  8. package/{lib/lazy_use.js → extensions/index.js} +16 -2
  9. package/lib/{amap/components/AmapSearch/index.jsx → amap-comp/AmapSearch.jsx} +3 -5
  10. package/lib/amap-comp/index.js +18 -0
  11. package/{plugins/lib/amap/components/AmapSearch/index.less → lib/amap-comp/style/AmapSearch.less} +5 -3
  12. package/lib/amap-comp/style/index.js +1 -0
  13. package/lib/amap-comp/style/index.less +1 -0
  14. package/lib/{amap/AmapDraw.jsx → amap-draw/index.jsx} +2 -4
  15. package/lib/amap-draw/style/index.js +1 -0
  16. package/lib/{amap/AmapDraw.less → amap-draw/style/index.less} +6 -3
  17. package/lib/browse/index.jsx +0 -2
  18. package/lib/browse/style/index.js +1 -0
  19. package/lib/button/Button.js +1 -3
  20. package/lib/button/style/index.js +1 -0
  21. package/{plugins/lib/dateTime → lib/date-time}/index.vue +3 -13
  22. package/lib/date-time/style/index.js +1 -0
  23. package/lib/date-time/style/index.less +7 -0
  24. package/lib/{descriptions → descriptions-list}/index.jsx +1 -3
  25. package/lib/descriptions-list/style/index.js +1 -0
  26. package/{plugins/lib/tree → lib/directory}/Directory.js +4 -21
  27. package/lib/directory/index.js +8 -0
  28. package/lib/directory/style/index.js +1 -0
  29. package/lib/{tree/style/Directory.less → directory/style/index.less} +3 -4
  30. package/{plugins/lib/form/components → lib/form-comp}/ACascaderMultiple.vue +1 -106
  31. package/lib/form-comp/ARadio.vue +70 -0
  32. package/lib/{form/components → form-comp}/ARangePicker.vue +9 -20
  33. package/lib/{form/components → form-comp}/ASelectCustom.vue +1 -8
  34. package/lib/form-comp/ATagsInput.vue +88 -0
  35. package/lib/form-comp/ATimePicker.vue +127 -0
  36. package/lib/{form/components → form-comp}/AUpload.vue +2 -17
  37. package/lib/form-comp/index.js +37 -0
  38. package/lib/form-comp/style/ACascaderMultiple.less +117 -0
  39. package/lib/form-comp/style/ARadio.less +0 -0
  40. package/lib/form-comp/style/ARangePicker.less +11 -0
  41. package/lib/form-comp/style/ASelectCustom.less +4 -0
  42. package/lib/form-comp/style/ATagsInput.less +24 -0
  43. package/lib/form-comp/style/ATimePicker.less +8 -0
  44. package/lib/form-comp/style/AUpload.less +15 -0
  45. package/lib/form-comp/style/index.js +1 -0
  46. package/lib/form-comp/style/index.less +7 -0
  47. package/lib/index.js +60 -45
  48. package/lib/modal/index.jsx +4 -6
  49. package/lib/modal/style/index.js +1 -0
  50. package/lib/modal/{index.less → style/index.less} +6 -7
  51. package/{plugins/lib/form → lib/model}/Model.js +1 -3
  52. package/lib/model/index.js +7 -0
  53. package/lib/model/style/index.js +1 -0
  54. package/lib/{form/style/Model.less → model/style/index.less} +10 -10
  55. package/{plugins/lib/form → lib/model}/utils/render.js +1 -1
  56. package/lib/{form → model}/utils/resetFields.js +1 -1
  57. package/lib/no-data/directive.js +65 -0
  58. package/lib/no-data/index.js +21 -0
  59. package/lib/no-data/index.vue +35 -0
  60. package/lib/no-data/style/index.js +1 -0
  61. package/lib/no-data/style/index.less +15 -0
  62. package/lib/search/index.js +7 -0
  63. package/{plugins/lib/form/Search.vue → lib/search/index.vue} +3 -6
  64. package/lib/search/style/index.js +1 -0
  65. package/{plugins/lib/form/style/Search.less → lib/search/style/index.less} +7 -8
  66. package/lib/style/mixins.less +1 -1
  67. package/lib/{svgIcon → svg-icon}/index.vue +1 -17
  68. package/lib/svg-icon/style/index.js +1 -0
  69. package/lib/svg-icon/style/index.less +15 -0
  70. package/lib/table/index.vue +4 -8
  71. package/lib/table/style/index.js +1 -0
  72. package/lib/table/style/index.less +12 -13
  73. package/lib/tree/index.js +2 -11
  74. package/{plugins/lib/tree/Tree.vue → lib/tree/index.vue} +2 -5
  75. package/lib/tree/style/index.js +1 -0
  76. package/{plugins/lib/tree/style/Tree.less → lib/tree/style/index.less} +4 -4
  77. package/lib/weather/index.vue +1 -9
  78. package/lib/weather/style/index.js +1 -0
  79. package/lib/weather/style/index.less +7 -0
  80. package/package.json +16 -34
  81. package/utils/Axios.js +91 -82
  82. package/utils/Postcss.js +12 -8
  83. package/README.md +0 -24
  84. package/dist/amap.umd.js +0 -12252
  85. package/dist/avatar.umd.js +0 -5337
  86. package/dist/button.umd.js +0 -5845
  87. package/dist/dateTime.umd.js +0 -1287
  88. package/dist/form.umd.js +0 -9981
  89. package/dist/multiTab.umd.js +0 -5556
  90. package/dist/svgIcon.umd.js +0 -1167
  91. package/dist/table.umd.js +0 -6306
  92. package/dist/tree.umd.js +0 -5393
  93. package/dist/weather.umd.js +0 -1167
  94. package/lib/amap/components/AmapSearch/index.less +0 -16
  95. package/lib/amap/index.js +0 -13
  96. package/lib/avatar/index.js +0 -7
  97. package/lib/avatar/index.vue +0 -47
  98. package/lib/basic/404.vue +0 -24
  99. package/lib/dateTime/index.vue +0 -43
  100. package/lib/form/Model.js +0 -153
  101. package/lib/form/Search.vue +0 -159
  102. package/lib/form/components/ACascaderMultiple.vue +0 -766
  103. package/lib/form/components/ARadio.vue +0 -74
  104. package/lib/form/components/ATagsInput.vue +0 -93
  105. package/lib/form/components/ATimePicker.vue +0 -73
  106. package/lib/form/index.js +0 -55
  107. package/lib/form/style/Search.less +0 -34
  108. package/lib/form/utils/render.js +0 -85
  109. package/lib/iframe/events.js +0 -2
  110. package/lib/iframe/index.jsx +0 -234
  111. package/lib/iframe/index.less +0 -19
  112. package/lib/multiTab/APIEnums.js +0 -17
  113. package/lib/multiTab/MultiTab.jsx +0 -237
  114. package/lib/multiTab/RouteAPI.js +0 -71
  115. package/lib/multiTab/RouteContent.jsx +0 -90
  116. package/lib/multiTab/RouteKeepAlive.js +0 -183
  117. package/lib/multiTab/events.js +0 -2
  118. package/lib/multiTab/index.js +0 -15
  119. package/lib/multiTab/index.less +0 -73
  120. package/lib/style/index.less +0 -2
  121. package/lib/tree/Directory.js +0 -428
  122. package/lib/tree/Tree.vue +0 -181
  123. package/lib/tree/style/Tree.less +0 -52
  124. package/method/Dialog.js +0 -134
  125. package/method/index.js +0 -12
  126. package/plugins/lib/amap/AmapDraw.jsx +0 -349
  127. package/plugins/lib/amap/AmapDraw.less +0 -45
  128. package/plugins/lib/amap/components/AmapSearch/index.jsx +0 -73
  129. package/plugins/lib/amap/index.js +0 -13
  130. package/plugins/lib/avatar/index.js +0 -7
  131. package/plugins/lib/avatar/index.vue +0 -47
  132. package/plugins/lib/basic/404.vue +0 -24
  133. package/plugins/lib/browse/index.jsx +0 -76
  134. package/plugins/lib/browse/index.less +0 -4
  135. package/plugins/lib/button/Button.js +0 -89
  136. package/plugins/lib/button/index.js +0 -7
  137. package/plugins/lib/dateTime/index.js +0 -7
  138. package/plugins/lib/descriptions/index.jsx +0 -108
  139. package/plugins/lib/descriptions/index.less +0 -15
  140. package/plugins/lib/form/components/ARadio.vue +0 -74
  141. package/plugins/lib/form/components/ARangePicker.vue +0 -129
  142. package/plugins/lib/form/components/ASelectCustom.vue +0 -226
  143. package/plugins/lib/form/components/ATagsInput.vue +0 -93
  144. package/plugins/lib/form/components/ATimePicker.vue +0 -73
  145. package/plugins/lib/form/components/AUpload.vue +0 -183
  146. package/plugins/lib/form/components/RenderComp.vue +0 -69
  147. package/plugins/lib/form/index.js +0 -55
  148. package/plugins/lib/form/style/Model.less +0 -53
  149. package/plugins/lib/form/utils/resetFields.js +0 -16
  150. package/plugins/lib/iframe/events.js +0 -2
  151. package/plugins/lib/iframe/index.jsx +0 -234
  152. package/plugins/lib/iframe/index.less +0 -19
  153. package/plugins/lib/index.js +0 -72
  154. package/plugins/lib/lazy_use.js +0 -40
  155. package/plugins/lib/modal/index.jsx +0 -53
  156. package/plugins/lib/modal/index.less +0 -50
  157. package/plugins/lib/multiTab/APIEnums.js +0 -17
  158. package/plugins/lib/multiTab/MultiTab.jsx +0 -237
  159. package/plugins/lib/multiTab/RouteAPI.js +0 -71
  160. package/plugins/lib/multiTab/RouteContent.jsx +0 -90
  161. package/plugins/lib/multiTab/RouteKeepAlive.js +0 -183
  162. package/plugins/lib/multiTab/events.js +0 -2
  163. package/plugins/lib/multiTab/index.js +0 -15
  164. package/plugins/lib/multiTab/index.less +0 -73
  165. package/plugins/lib/style/index.less +0 -2
  166. package/plugins/lib/style/mixins.less +0 -79
  167. package/plugins/lib/svgIcon/index.js +0 -7
  168. package/plugins/lib/svgIcon/index.vue +0 -77
  169. package/plugins/lib/table/index.js +0 -7
  170. package/plugins/lib/table/index.vue +0 -217
  171. package/plugins/lib/table/style/index.less +0 -50
  172. package/plugins/lib/tree/index.js +0 -17
  173. package/plugins/lib/tree/style/Directory.less +0 -119
  174. package/plugins/lib/weather/index.js +0 -7
  175. package/plugins/lib/weather/index.vue +0 -58
  176. package/plugins/method/AMap.js +0 -368
  177. package/plugins/method/PageLoading.jsx +0 -106
  178. package/plugins/method/Theme.js +0 -88
  179. package/plugins/method/index.js +0 -12
  180. package/plugins/store/auth.js +0 -31
  181. package/plugins/store/cache.js +0 -56
  182. package/plugins/store/chat.js +0 -74
  183. package/plugins/store/project.js +0 -46
  184. package/plugins/utils/Axios.js +0 -105
  185. package/plugins/utils/Base64.js +0 -314
  186. package/plugins/utils/Filter.js +0 -249
  187. package/plugins/utils/PostMessage.js +0 -16
  188. package/plugins/utils/Postcss.js +0 -9
  189. package/plugins/utils/Rem.js +0 -24
  190. package/plugins/utils/Request.js +0 -38
  191. package/plugins/utils/Storage.js +0 -73
  192. package/plugins/utils/Tree.js +0 -169
  193. package/plugins/utils/Utils.js +0 -51
  194. package/plugins/utils/Validate.js +0 -33
  195. package/plugins/utils/Websocket.js +0 -186
  196. package/utils/PostMessage.js +0 -16
  197. package/utils/Request.js +0 -38
  198. /package/{method → extensions}/PageLoading.jsx +0 -0
  199. /package/{method → extensions}/Theme.js +0 -0
  200. /package/{plugins/font → font}/DS-DIGI-1.ttf +0 -0
  201. /package/{plugins/font → font}/DS-DIGIB-2.ttf +0 -0
  202. /package/{plugins/font → font}/DS-DIGII-3.ttf +0 -0
  203. /package/{plugins/font → font}/DS-DIGIT-4.ttf +0 -0
  204. /package/{plugins/font → font}/Orbitron-Black.ttf +0 -0
  205. /package/{plugins/font → font}/Orbitron-Bold.ttf +0 -0
  206. /package/{plugins/font → font}/Orbitron-Medium.ttf +0 -0
  207. /package/{plugins/font → font}/Orbitron-Regular.ttf +0 -0
  208. /package/{plugins/font → font}/PANGMENZHENGDAOBIAOTITI-1.TTF +0 -0
  209. /package/{plugins/font → font}/PingFang SC.ttf +0 -0
  210. /package/{plugins/font → font}/YouSheBiaoTiHei.ttf +0 -0
  211. /package/{plugins/font → font}/font.css +0 -0
  212. /package/{plugins/font → font}//345/255/227/351/255/20235/345/217/267-/347/273/217/345/205/270/351/233/205/351/273/221.ttf" +0 -0
  213. /package/lib/browse/{index.less → style/index.less} +0 -0
  214. /package/{dist/css/index.css → lib/button/style/index.less} +0 -0
  215. /package/lib/{dateTime → date-time}/index.js +0 -0
  216. /package/lib/{descriptions → descriptions-list/style}/index.less +0 -0
  217. /package/lib/{form/components → form-comp}/RenderComp.vue +0 -0
  218. /package/lib/{svgIcon → svg-icon}/index.js +0 -0
@@ -1,237 +0,0 @@
1
- import AppEvent from './events'
2
- import { TAB_BINDING } from './APIEnums'
3
- import { Menu, Dropdown, Button, Icon, Tabs } from 'ant-design-vue'
4
- import './index.less'
5
-
6
- const eventKey = {
7
- 'closeThat': TAB_BINDING.TAB_CLOSE,
8
- 'closeRight': TAB_BINDING.TAB_CLOSE_RIGHT,
9
- 'closeLeft': TAB_BINDING.TAB_CLOSE_LEFT,
10
- 'closeAll': TAB_BINDING.TAB_CLOSE_ALL
11
- }
12
-
13
- const i18nRender = (context) => context
14
-
15
- const renderTabMenu = (h, path) => {
16
- const props = {
17
- on: {
18
- click: ({ key, item, domEvent }) => {
19
- console.log('key', path)
20
- console.log(key, item, domEvent)
21
- AppEvent.$emit(eventKey[key], path)
22
- }
23
- }
24
- }
25
- return (
26
- <Menu {...props}>
27
- <Menu.Item key="closeThat">关闭当前标签</Menu.Item>
28
- <Menu.Item key="closeRight">关闭右侧</Menu.Item>
29
- <Menu.Item key="closeLeft">关闭左侧</Menu.Item>
30
- <Menu.Item key="closeAll">关闭全部</Menu.Item>
31
- </Menu>
32
- )
33
- }
34
-
35
- const renderTabDropDown = (h, title, keyPath, handles) => {
36
- const handleReload = () => {
37
- handles['reload'](keyPath)
38
- }
39
-
40
- const menus = renderTabMenu(h, keyPath)
41
- return (
42
- <Dropdown overlay={menus} trigger={['contextmenu']}>
43
- <span>
44
- <span class='ant-pro-multi-tab-title'>{ title }</span>
45
- {/* <Icon title='reload page' class='ant-pro-multi-tab-icon' type={'reload'} onClick={handleReload} /> */}
46
- </span>
47
- </Dropdown>
48
- )
49
- }
50
-
51
- const MultiTab = {
52
- name: 'MultiTab',
53
- props: {
54
- contentWidth: {
55
- type: Boolean,
56
- default: false
57
- }
58
- },
59
- data () {
60
- return {
61
- activeKey: '',
62
- pages: [],
63
- fullPathList: []
64
- }
65
- },
66
- render (h) {
67
- const { $data: { pages }, contentWidth } = this
68
- const handles = {
69
- cls: (keyPath) => {
70
- // console.log('close', keyPath)
71
- // this.closeThat(keyPath)
72
- this.$tab.close(keyPath, false)
73
- },
74
- reload: (keyPath) => {
75
- this.$tab.refresh(keyPath)
76
- }
77
- }
78
- const tabPanels = pages.map(page => {
79
- const title = page.meta.customTitle || page.meta.title
80
- return (
81
- <Tabs.TabPane
82
- style={{ height: 0 }}
83
- key={page.fullPath}
84
- tab={renderTabDropDown(h, i18nRender(title), page.fullPath, handles)}
85
- closable={pages.length > 1}
86
- ></Tabs.TabPane>
87
- )
88
- })
89
-
90
- const edit = (targetKey, action) => {
91
- console.log('editTab:', targetKey, 'action:', action)
92
- this[action](targetKey)
93
- }
94
-
95
- const handleMenuClick = ({key}) => {
96
- this[key](this.activeKey)
97
- }
98
-
99
- const controlMenu = (<Dropdown slot="tabBarExtraContent" style={{ marginRight: '8px' }}>
100
- <Menu slot="overlay" onClick={handleMenuClick}>
101
- {/* <Menu.Item key="closeAll">全部关闭</Menu.Item> */}
102
- <Menu.Item key="closeThat">关闭当前</Menu.Item>
103
- <Menu.Item key="closeAll">关闭其他</Menu.Item>
104
- </Menu>
105
- <Button icon={'align-left'} type={'link'}><Icon type="down" /></Button>
106
- </Dropdown>)
107
-
108
- return (
109
- <div class={['ant-pro-multi-tab', contentWidth ? 'wide' : null]}>
110
- <div class={'ant-pro-multi-tab-wrapper'}>
111
- <Tabs
112
- hideAdd
113
- type={'editable-card'}
114
- vModel={this.activeKey}
115
- onEdit={edit}
116
- >
117
- {tabPanels}
118
- {controlMenu}
119
- </Tabs>
120
- </div>
121
- </div>
122
- )
123
- },
124
- created () {
125
- const { pages, fullPathList } = this
126
- AppEvent.$on(TAB_BINDING.TAB_CLOSE, val => {
127
- this.closeThat(val)
128
- console.log('hook:tab:ck', val)
129
- }).$on(TAB_BINDING.TAB_CLOSE_RIGHT, val => {
130
- this.closeRight(val)
131
- console.log('hook:tab:closeRight', val)
132
- }).$on(TAB_BINDING.TAB_CLOSE_LEFT, val => {
133
- this.closeLeft(val)
134
- console.log('hook:tab:closeLeft', val)
135
- }).$on(TAB_BINDING.TAB_CLOSE_ALL, val => {
136
- this.closeAll(val)
137
- console.log('hook:tab:closeAll', val)
138
- }).$on('hook:tab:rename', val => {
139
- // console.log('hook:tab:rename', val)
140
- })
141
-
142
- pages.push(this.$route)
143
- fullPathList.push(this.$route.fullPath)
144
-
145
- this.activeLastTab()
146
-
147
- this.$watch('$route', newVal => {
148
- const { fullPath, params } = newVal
149
- if (this.activeKey !== fullPath) {
150
- this.activeKey = fullPath
151
- }
152
- if (this.fullPathList.indexOf(fullPath) < 0) {
153
- this.fullPathList.push(fullPath)
154
- /** 向外抛出打开方法 */
155
- this.$tab.open(newVal)
156
- if (params && params._tabName) {
157
- const newPage = Object.assign({}, newVal, {
158
- meta: {
159
- customTitle: params._tabName
160
- }
161
- })
162
- this.pages.push(newPage)
163
- } else {
164
- this.pages.push(newVal)
165
- }
166
- }
167
- })
168
- this.$watch('activeKey', pathKey => {
169
- this.$router.push({ path: pathKey })
170
- /** 激活路由时记录信息 */
171
- this.$tab.activeTab(this.$route)
172
- })
173
- },
174
- mounted () {
175
- /** 延迟执行,记录第一次路由 */
176
- // let timer=setTimeout(()=>{
177
- // this.$tab.open(this.$route)
178
- // clearTimeout(timer)
179
- // }, 60)
180
- },
181
- methods: {
182
- activeLastTab () {
183
- this.activeKey = this.fullPathList[this.fullPathList.length - 1]
184
- },
185
- remove (targetKey) {
186
- this.closeThat(targetKey)
187
- },
188
- closeThat (targetKey) {
189
- if (this.fullPathList.length > 1) {
190
- this.pages = this.pages.filter(page => page.fullPath !== targetKey)
191
- this.fullPathList = this.fullPathList.filter(path => path !== targetKey)
192
- this.activeLastTab()
193
- /** 向外抛出关闭方法 */
194
- let cache = true
195
- try {
196
- const majorPath = targetKey.split('?')[0]
197
- cache = this.fullPathList.some( path =>
198
- path.includes('?') &&
199
- path.split('?')[0] === majorPath
200
- )
201
- this.$tab.close(majorPath, cache)
202
- } catch{ this.$tab.close(targetKey, cache) }
203
- console.log( cache, '是否缓存' )
204
- }
205
- },
206
- closeLeft(e) {
207
- const currentIndex = this.fullPathList.indexOf(e)
208
- if (currentIndex > 0) {
209
- this.fullPathList.forEach((item, index) => {
210
- if (index < currentIndex) {
211
- this.remove(item)
212
- }
213
- })
214
- }
215
- },
216
- closeRight(e) {
217
- const currentIndex = this.fullPathList.indexOf(e)
218
- if (currentIndex < this.fullPathList.length - 1) {
219
- this.fullPathList.forEach((item, index) => {
220
- if (index > currentIndex) {
221
- this.remove(item)
222
- }
223
- })
224
- }
225
- },
226
- closeAll(e) {
227
- const currentIndex = this.fullPathList.indexOf(e)
228
- this.fullPathList.forEach((item, index) => {
229
- if (index !== currentIndex) {
230
- this.remove(item)
231
- }
232
- })
233
- },
234
- }
235
- }
236
-
237
- export default MultiTab
@@ -1,71 +0,0 @@
1
- import { ROUTE_BINDING } from './APIEnums'
2
- import AppEvent from './events'
3
-
4
- const RouteAPI = {
5
- /**
6
- * Open a new tab(route)
7
- * 打开一个新标签(路由)
8
- *
9
- * @param config: {
10
- * routeName,
11
- * title,
12
- * path
13
- * }
14
- */
15
- open (config) {
16
- AppEvent.$emit(ROUTE_BINDING.R_OPEN, config)
17
- },
18
- /**
19
- * Close a tab
20
- * 关闭一个打开的标签
21
- * 如果标签没打开或找不到标签则不做任何事情
22
- *
23
- * @param config
24
- * @param cache: bool true 则关闭后会缓存页面,false 反之
25
- * { config, isCache: cache }
26
- */
27
- close (config, cache) {
28
- AppEvent.$emit(ROUTE_BINDING.R_CLOSE, { config, isCache: cache })
29
- },
30
- /**
31
- * Active a opened tab
32
- * 激活一个已经打开的 tab
33
- * @param config
34
- */
35
- activeTab (config) {
36
- AppEvent.$emit(ROUTE_BINDING.R_ACTIVE, config)
37
- },
38
- /**
39
- * Replace current page to new Route
40
- * 替换当前 tab 页面为一个新的页面
41
- * 注意:这个替换会更新路由地址,但是 tab 的位置不会发生变化
42
- * 被替换的路由还会被缓存住,下次打开还是缓存时的状态
43
- *
44
- * @param {*} config
45
- */
46
- replace (config) {
47
- AppEvent.$emit('hook:replace', config)
48
- },
49
- /**
50
- * Refresh current tab (clear page cache)
51
- */
52
- refresh (keyPath) {
53
- AppEvent.$emit(ROUTE_BINDING.R_REFRESH, keyPath)
54
- },
55
- closeAll () {
56
- AppEvent.$emit('hook:closeAll')
57
- },
58
- closeOthers () {
59
- AppEvent.$emit('hook:closeOthers')
60
- },
61
- /**
62
- * Get all cached page
63
- *
64
- * @param callback
65
- */
66
- caches (callback) {
67
- AppEvent.$emit(ROUTE_BINDING.R_GET_CACHES, callback)
68
- }
69
- }
70
-
71
- export default RouteAPI
@@ -1,90 +0,0 @@
1
- /* eslint-disable */
2
- import { ROUTE_BINDING, TAB_BINDING } from './APIEnums'
3
- import AppEvent from './events'
4
- import RouteAPI from './RouteAPI'
5
- import MultiTab from './MultiTab.jsx'
6
- import RouteKeepAlive from './RouteKeepAlive'
7
-
8
- const addAndGet = val => {
9
- return val >= Number.MAX_SAFE_INTEGER ? 0 : ++val
10
- }
11
-
12
- const RouteContent = {
13
- name: 'RouteContent',
14
- data () {
15
- return {
16
- includes: [],
17
- excludes: [],
18
- /*
19
- * Cache: { fullPath : String, snapshot : Number }
20
- * cached: Map
21
- */
22
- cached: {}
23
- }
24
- },
25
- render () {
26
- const {
27
- $route: { meta, fullPath },
28
- includes,
29
- excludes,
30
- cached
31
- } = this
32
-
33
- const handleRef = (ref) => {
34
- this.keepRef = ref
35
- }
36
- console.log('meta', this.$route);
37
- if (meta.keepAlive) {
38
- if (includes.findIndex(item => item === fullPath) === -1) {
39
- includes.push(fullPath)
40
- cached[fullPath] = {
41
- fullPath,
42
- snapshot: 0
43
- }
44
- }
45
- }
46
- const genKey = cached[fullPath].fullPath + cached[fullPath].snapshot
47
- const props = {
48
- on: {
49
- ref: handleRef
50
- }
51
- }
52
- return (
53
- <route-keep-alive {...props} include={includes} exclude={excludes}>
54
- <router-view key={genKey} />
55
- </route-keep-alive>
56
- )
57
- },
58
- created () {
59
- AppEvent.$on(ROUTE_BINDING.R_OPEN, ({ routeName, title, ...rest }) => {
60
- this.$router.push({ name: routeName, params: { '_tabName': title, ...rest } })
61
- }).$on(ROUTE_BINDING.R_REFRESH, keyPath => {
62
- const { $route: { fullPath } } = this
63
- let key = keyPath || fullPath
64
- const cache = this.cached[key]
65
- this.keepRef.clearCache(key)
66
- cache.snapshot = addAndGet(cache.snapshot)
67
- // how with
68
- this.$forceUpdate()
69
- }).$on(ROUTE_BINDING.R_GET_CACHES, (callback) => {
70
- callback(this.keepRef.allCache())
71
- }).$on(ROUTE_BINDING.R_CLOSE, val => {
72
- const { config: keyPath, isCache } = val
73
- AppEvent.$emit(TAB_BINDING.TAB_CLOSE, keyPath)
74
- // this.keepRef.clearCache(keyPath)
75
- })
76
- }
77
- }
78
-
79
- RouteContent.install = function (Vue) {
80
- if (Vue.prototype.$tab) {
81
- return
82
- }
83
- Vue.prototype.$tab = RouteAPI
84
- Vue.prototype.$tabBus = AppEvent
85
- Vue.component(RouteContent.name, RouteContent)
86
- Vue.component(RouteKeepAlive.name, RouteKeepAlive)
87
- Vue.component(MultiTab.name, MultiTab)
88
- }
89
-
90
- export default RouteContent
@@ -1,183 +0,0 @@
1
- const _toString = Object.prototype.toString
2
-
3
- const isRegExp = (v) => {
4
- return _toString.call(v) === '[object RegExp]'
5
- }
6
-
7
- const isDef = (v) => {
8
- return v !== undefined && v !== null
9
- }
10
-
11
- const isAsyncPlaceholder = (node) => {
12
- return node.isComment && node.asyncFactory
13
- }
14
-
15
- const remove = (arr, item) => {
16
- if (arr.length) {
17
- const index = arr.indexOf(item)
18
- if (index > -1) {
19
- return arr.splice(index, 1)
20
- }
21
- }
22
- }
23
-
24
- export const getFirstComponentChild = (children) => {
25
- if (Array.isArray(children)) {
26
- for (let i = 0; i < children.length; i++) {
27
- const c = children[i]
28
- if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
29
- return c
30
- }
31
- }
32
- }
33
- }
34
-
35
- export const getComponentName = (opts) => {
36
- return opts && (opts.Ctor.options.name || opts.tag)
37
- }
38
-
39
- export const getComponentKey = (opts) => {
40
- return opts && (opts.Ctor.cid + (opts.tag ? `::${opts.tag}` : ''))
41
- }
42
-
43
- export const getCurrentRouteKey = ($route) => {
44
- return $route.fullPath
45
- }
46
-
47
- const matches = (pattern, name) => {
48
- if (Array.isArray(pattern)) {
49
- return pattern.indexOf(name) > -1
50
- } else if (typeof pattern === 'string') {
51
- return pattern.split(',').indexOf(name) > -1
52
- } else if (isRegExp(pattern)) {
53
- return pattern.test(name)
54
- }
55
- /* istanbul ignore next */
56
- return false
57
- }
58
-
59
- const pruneCache = (keepAliveInstance, cacheKey) => {
60
- const { cache, keys, _vnode } = keepAliveInstance
61
- for (const key in cache) {
62
- const cachedNode = cache[key]
63
- if (cachedNode) {
64
- if (cacheKey === key) {
65
- pruneCacheEntry(cache, key, keys, _vnode)
66
- }
67
- }
68
- }
69
- }
70
-
71
- const pruneCacheEntry = (
72
- cache,
73
- key,
74
- keys,
75
- current
76
- ) => {
77
- const cached = cache[key]
78
- if (cached && (!current || cached.tag !== current.tag)) {
79
- cached.componentInstance.$destroy()
80
- }
81
- cache[key] = null
82
- remove(keys, key)
83
- }
84
-
85
- /* const findCached = (cached, vnode) => {
86
-
87
- } */
88
-
89
- const RouteKeepAlive = {
90
- name: 'RouteKeepAlive',
91
- abstract: true,
92
- props: {
93
- include: {
94
- type: [String, Array],
95
- default: ''
96
- },
97
- exclude: {
98
- type: [String, Array],
99
- default: ''
100
- },
101
- max: {
102
- type: [String, Number],
103
- default: null
104
- }
105
- },
106
-
107
- created () {
108
- this.cache = Object.create(null)
109
- this.keys = []
110
- },
111
-
112
- destroyed () {
113
- for (const key in this.cache) {
114
- pruneCacheEntry(this.cache, key, this.keys)
115
- }
116
- },
117
-
118
- mounted () {
119
- this.$watch('include', val => {
120
- pruneCache(this, val)
121
- })
122
- this.$watch('exclude', val => {
123
- pruneCache(this, val)
124
- })
125
- },
126
-
127
- methods: {
128
- allCache () {
129
- return this.cache
130
- },
131
- clearCache (key) {
132
- pruneCache(this, key)
133
- this.$router.replace(this.$router.currentRoute)
134
- }
135
- },
136
-
137
- render () {
138
- this.$emit('ref', this)
139
- const slot = this.$slots.default
140
- const vnode = getFirstComponentChild(slot)
141
- // const vnode = cloneVNode(defVNode, true)
142
- const componentOptions = vnode && vnode.componentOptions
143
-
144
- const key = getCurrentRouteKey(this.$route)
145
- if (componentOptions) {
146
- // check pattern
147
- const { include, exclude } = this
148
- if (
149
- // not included
150
- (include && (!key || !matches(include, key))) ||
151
- // excluded
152
- (exclude && key && matches(exclude, key))
153
- ) {
154
- return vnode
155
- }
156
-
157
- const { cache, keys } = this
158
- if (cache[key]) {
159
- vnode.componentInstance = cache[key].componentInstance
160
- // make current key freshest
161
- remove(keys, key)
162
- keys.push(key)
163
- } else {
164
- // vnode = cloneVNode(vnode, true)
165
-
166
- cache[key] = vnode
167
- keys.push(key)
168
- // prune oldest entry
169
- if (this.max && keys.length > parseInt(this.max)) {
170
- pruneCacheEntry(cache, keys[0], keys, this._vnode)
171
- }
172
- }
173
- vnode.data.keepAlive = true
174
- }
175
- return vnode || (slot && slot[0])
176
- }
177
- }
178
-
179
- RouteKeepAlive.install = function (Vue) {
180
- Vue.component(RouteKeepAlive.name, RouteKeepAlive)
181
- }
182
-
183
- export default RouteKeepAlive
@@ -1,2 +0,0 @@
1
- import Vue from 'vue'
2
- export default new Vue()
@@ -1,15 +0,0 @@
1
- import AppEvent from './events'
2
- import RouteAPI from './RouteAPI'
3
- import MultiTab from './MultiTab.jsx'
4
- import * as APIEnums from './APIEnums'
5
- import RouteKeepAlive from './RouteKeepAlive'
6
- import RouteContent from './RouteContent.jsx'
7
-
8
- export {
9
- AppEvent,
10
- RouteAPI,
11
- MultiTab,
12
- RouteKeepAlive,
13
- APIEnums
14
- }
15
- export default RouteContent
@@ -1,73 +0,0 @@
1
- @import "~ant-design-vue/es/style/themes/default";
2
-
3
- @multi-tab-prefix-cls: ~"ant-pro-multi-tab";
4
- @multi-tab-wrapper-prefix-cls: ~"ant-pro-multi-tab-wrapper";
5
-
6
- .@{multi-tab-prefix-cls} {
7
- .ant-tabs-bar {
8
- margin: 0;
9
- border-bottom: none;
10
- padding-left: @padding-md + 4px;
11
- box-sizing: border-box;
12
- background: @layout-header-background;
13
- }
14
-
15
- .ant-tabs-extra-content .ant-btn {
16
- border: none;
17
- background: transparent;
18
- }
19
-
20
- .ant-tabs.ant-tabs-card .ant-tabs-card-bar {
21
- .ant-tabs-tab {
22
- height: 26px;
23
- line-height: 26px;
24
- color: @input-placeholder-color;
25
- border-radius: @border-radius-sm;
26
- padding: 0 @padding-xs;
27
- border: none;
28
- background: transparent;
29
-
30
- .ant-tabs-close-x {
31
- margin-left: 14px;
32
- color: @input-placeholder-color;
33
- }
34
- }
35
- .ant-tabs-tab-active {
36
- color: @primary-color;
37
- background-color: @item-active-bg;
38
-
39
- .ant-tabs-close-x {
40
- color: @primary-color;
41
- }
42
- }
43
- .ant-tabs-nav-container {
44
- display: flex;
45
- align-items: center;
46
- }
47
- }
48
-
49
- .ant-tabs-nav .ant-tabs-tab .anticon {
50
- margin-right: 4px;
51
- &:last-child {
52
- margin-right: 0;
53
- }
54
- }
55
-
56
- .ant-pro-multi-tab-title {
57
- user-select: none;
58
- font-weight: 300;
59
- font-size: @font-size-base;
60
- }
61
-
62
- .ant-pro-multi-tab-icon {
63
- height: @font-size-base;
64
- overflow: hidden;
65
- color: @text-color-secondary;
66
- font-size: @font-size-sm;
67
- vertical-align: middle;
68
- transition: all 0.3s;
69
- &:hover {
70
- color: @heading-color;
71
- }
72
- }
73
- }
@@ -1,2 +0,0 @@
1
- /* 混入样式 */
2
- @import './mixins.less';