vxe-pc-ui 0.2.0 → 0.4.0

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 (318) hide show
  1. package/es/anchor/index.js +2 -0
  2. package/es/anchor/src/anchor.js +18 -18
  3. package/es/anchor-link/index.js +2 -0
  4. package/es/breadcrumb/index.js +2 -0
  5. package/es/breadcrumb/src/breadcrumb.js +2 -2
  6. package/es/breadcrumb-item/index.js +2 -0
  7. package/es/button/index.js +2 -0
  8. package/es/button/src/button-group.js +2 -5
  9. package/es/button-group/index.js +2 -0
  10. package/es/checkbox/src/checkbox.js +8 -8
  11. package/es/checkbox/src/group.js +6 -6
  12. package/es/checkbox-group/index.js +1 -1
  13. package/es/col/index.js +2 -0
  14. package/es/components.js +3 -0
  15. package/es/form/index.js +2 -0
  16. package/es/form/src/form-config-item.js +3 -8
  17. package/es/form/src/form-item.js +3 -8
  18. package/es/form/src/form.js +5 -8
  19. package/es/form/src/render.js +2 -10
  20. package/es/form-design/index.js +2 -0
  21. package/es/form-gather/index.js +2 -0
  22. package/es/form-item/index.js +2 -0
  23. package/es/icon/index.js +2 -0
  24. package/es/input/index.js +1 -1
  25. package/es/input/style.css +5 -5
  26. package/es/input/style.min.css +1 -1
  27. package/es/layout-aside/index.js +2 -0
  28. package/es/layout-body/index.js +2 -0
  29. package/es/layout-container/index.js +2 -0
  30. package/es/layout-footer/index.js +2 -0
  31. package/es/layout-header/index.js +2 -0
  32. package/es/list/index.js +10 -0
  33. package/es/list/src/list.js +340 -0
  34. package/es/list/style.css +26 -0
  35. package/es/list/style.min.css +1 -0
  36. package/es/list-design/index.js +2 -0
  37. package/es/loading/index.js +2 -0
  38. package/es/modal/index.js +1 -1
  39. package/es/modal/src/modal.js +2 -5
  40. package/es/modal/style.css +1 -1
  41. package/es/modal/style.min.css +1 -1
  42. package/es/optgroup/index.js +1 -1
  43. package/es/option/index.js +1 -1
  44. package/es/pager/index.js +1 -1
  45. package/es/pager/src/pager.js +4 -4
  46. package/es/pager/style.css +2 -2
  47. package/es/pager/style.min.css +1 -1
  48. package/es/pulldown/index.js +1 -1
  49. package/es/pulldown/style.css +2 -2
  50. package/es/pulldown/style.min.css +1 -1
  51. package/es/radio/index.js +1 -1
  52. package/es/radio-button/index.js +1 -1
  53. package/es/radio-group/index.js +1 -1
  54. package/es/row/index.js +2 -0
  55. package/es/select/index.js +1 -1
  56. package/es/select/style.css +2 -2
  57. package/es/select/style.min.css +1 -1
  58. package/es/style.css +1 -1
  59. package/es/style.min.css +1 -1
  60. package/es/switch/index.js +1 -1
  61. package/es/switch/style.css +1 -1
  62. package/es/switch/style.min.css +1 -1
  63. package/es/tab-pane/index.js +2 -0
  64. package/es/tabs/index.js +2 -0
  65. package/es/tabs/src/tabs.js +50 -19
  66. package/es/tabs/style.css +49 -34
  67. package/es/tabs/style.min.css +1 -1
  68. package/es/textarea/index.js +1 -1
  69. package/es/textarea/style.css +2 -2
  70. package/es/textarea/style.min.css +1 -1
  71. package/es/tooltip/index.js +2 -0
  72. package/es/tooltip/src/tooltip.js +2 -7
  73. package/es/ui/src/core.js +1 -1
  74. package/es/ui/src/globalStore.js +64 -66
  75. package/es/ui/src/log.js +1 -1
  76. package/es/ui/src/resize.js +81 -0
  77. package/es/ui/src/store.js +8 -1
  78. package/es/vxe-input/style.css +5 -5
  79. package/es/vxe-input/style.min.css +1 -1
  80. package/es/vxe-list/index.js +3 -0
  81. package/es/vxe-list/style.css +26 -0
  82. package/es/vxe-list/style.min.css +1 -0
  83. package/es/vxe-modal/style.css +1 -1
  84. package/es/vxe-modal/style.min.css +1 -1
  85. package/es/vxe-pager/style.css +2 -2
  86. package/es/vxe-pager/style.min.css +1 -1
  87. package/es/vxe-pulldown/style.css +2 -2
  88. package/es/vxe-pulldown/style.min.css +1 -1
  89. package/es/vxe-select/style.css +2 -2
  90. package/es/vxe-select/style.min.css +1 -1
  91. package/es/vxe-switch/style.css +1 -1
  92. package/es/vxe-switch/style.min.css +1 -1
  93. package/es/vxe-tabs/style.css +49 -34
  94. package/es/vxe-tabs/style.min.css +1 -1
  95. package/es/vxe-textarea/style.css +2 -2
  96. package/es/vxe-textarea/style.min.css +1 -1
  97. package/lib/anchor/index.js +2 -0
  98. package/lib/anchor/index.min.js +1 -1
  99. package/lib/anchor/src/anchor.js +18 -18
  100. package/lib/anchor/src/anchor.min.js +1 -1
  101. package/lib/anchor-link/index.js +2 -0
  102. package/lib/anchor-link/index.min.js +1 -1
  103. package/lib/breadcrumb/index.js +2 -0
  104. package/lib/breadcrumb/index.min.js +1 -1
  105. package/lib/breadcrumb/src/breadcrumb.js +2 -2
  106. package/lib/breadcrumb/src/breadcrumb.min.js +1 -1
  107. package/lib/breadcrumb-item/index.js +2 -0
  108. package/lib/breadcrumb-item/index.min.js +1 -1
  109. package/lib/button/index.js +2 -0
  110. package/lib/button/index.min.js +1 -1
  111. package/lib/button/src/button-group.js +5 -7
  112. package/lib/button/src/button-group.min.js +1 -1
  113. package/lib/button-group/index.js +2 -0
  114. package/lib/button-group/index.min.js +1 -1
  115. package/lib/checkbox/src/checkbox.js +8 -8
  116. package/lib/checkbox/src/checkbox.min.js +1 -1
  117. package/lib/checkbox/src/group.js +6 -6
  118. package/lib/checkbox/src/group.min.js +1 -1
  119. package/lib/checkbox-group/index.js +1 -1
  120. package/lib/checkbox-group/index.min.js +1 -1
  121. package/lib/col/index.js +2 -0
  122. package/lib/col/index.min.js +1 -1
  123. package/lib/components.js +13 -1
  124. package/lib/components.min.js +1 -1
  125. package/lib/form/index.js +2 -0
  126. package/lib/form/index.min.js +1 -1
  127. package/lib/form/src/form-config-item.js +3 -4
  128. package/lib/form/src/form-config-item.min.js +1 -1
  129. package/lib/form/src/form-item.js +3 -4
  130. package/lib/form/src/form-item.min.js +1 -1
  131. package/lib/form/src/form.js +7 -8
  132. package/lib/form/src/form.min.js +1 -1
  133. package/lib/form/src/render.js +4 -8
  134. package/lib/form/src/render.min.js +1 -1
  135. package/lib/form-design/index.js +2 -0
  136. package/lib/form-design/index.min.js +1 -1
  137. package/lib/form-gather/index.js +2 -0
  138. package/lib/form-gather/index.min.js +1 -1
  139. package/lib/form-item/index.js +2 -0
  140. package/lib/form-item/index.min.js +1 -1
  141. package/lib/icon/index.js +2 -0
  142. package/lib/icon/index.min.js +1 -1
  143. package/lib/index.umd.js +737 -167
  144. package/lib/index.umd.min.js +1 -1
  145. package/lib/input/index.js +1 -1
  146. package/lib/input/index.min.js +1 -1
  147. package/lib/input/style/style.css +5 -5
  148. package/lib/input/style/style.min.css +1 -1
  149. package/lib/layout-aside/index.js +2 -0
  150. package/lib/layout-aside/index.min.js +1 -1
  151. package/lib/layout-body/index.js +2 -0
  152. package/lib/layout-body/index.min.js +1 -1
  153. package/lib/layout-container/index.js +2 -0
  154. package/lib/layout-container/index.min.js +1 -1
  155. package/lib/layout-footer/index.js +2 -0
  156. package/lib/layout-footer/index.min.js +1 -1
  157. package/lib/layout-header/index.js +2 -0
  158. package/lib/layout-header/index.min.js +1 -1
  159. package/lib/list/index.js +17 -0
  160. package/lib/list/index.min.js +1 -0
  161. package/lib/list/src/list.js +397 -0
  162. package/lib/list/src/list.min.js +1 -0
  163. package/lib/list/style/index.js +1 -0
  164. package/lib/list/style/style.css +26 -0
  165. package/lib/list/style/style.min.css +1 -0
  166. package/lib/list-design/index.js +2 -0
  167. package/lib/list-design/index.min.js +1 -1
  168. package/lib/loading/index.js +2 -0
  169. package/lib/loading/index.min.js +1 -1
  170. package/lib/modal/index.js +1 -5
  171. package/lib/modal/index.min.js +1 -1
  172. package/lib/modal/src/modal.js +3 -4
  173. package/lib/modal/src/modal.min.js +1 -1
  174. package/lib/modal/style/style.css +1 -1
  175. package/lib/modal/style/style.min.css +1 -1
  176. package/lib/optgroup/index.js +1 -1
  177. package/lib/optgroup/index.min.js +1 -1
  178. package/lib/option/index.js +1 -1
  179. package/lib/option/index.min.js +1 -1
  180. package/lib/pager/index.js +1 -1
  181. package/lib/pager/index.min.js +1 -1
  182. package/lib/pager/src/pager.js +6 -7
  183. package/lib/pager/src/pager.min.js +1 -1
  184. package/lib/pager/style/style.css +2 -2
  185. package/lib/pager/style/style.min.css +1 -1
  186. package/lib/pulldown/index.js +1 -1
  187. package/lib/pulldown/index.min.js +1 -1
  188. package/lib/pulldown/style/style.css +2 -2
  189. package/lib/pulldown/style/style.min.css +1 -1
  190. package/lib/radio/index.js +1 -1
  191. package/lib/radio/index.min.js +1 -1
  192. package/lib/radio-button/index.js +1 -1
  193. package/lib/radio-button/index.min.js +1 -1
  194. package/lib/radio-group/index.js +1 -1
  195. package/lib/radio-group/index.min.js +1 -1
  196. package/lib/row/index.js +2 -0
  197. package/lib/row/index.min.js +1 -1
  198. package/lib/select/index.js +1 -1
  199. package/lib/select/index.min.js +1 -1
  200. package/lib/select/style/style.css +2 -2
  201. package/lib/select/style/style.min.css +1 -1
  202. package/lib/style.css +1 -1
  203. package/lib/style.min.css +1 -1
  204. package/lib/switch/index.js +1 -1
  205. package/lib/switch/index.min.js +1 -1
  206. package/lib/switch/style/style.css +1 -1
  207. package/lib/switch/style/style.min.css +1 -1
  208. package/lib/tab-pane/index.js +2 -0
  209. package/lib/tab-pane/index.min.js +1 -1
  210. package/lib/tabs/index.js +2 -0
  211. package/lib/tabs/index.min.js +1 -1
  212. package/lib/tabs/src/tabs.js +50 -12
  213. package/lib/tabs/src/tabs.min.js +1 -1
  214. package/lib/tabs/style/style.css +49 -34
  215. package/lib/tabs/style/style.min.css +1 -1
  216. package/lib/textarea/index.js +1 -1
  217. package/lib/textarea/index.min.js +1 -1
  218. package/lib/textarea/style/style.css +2 -2
  219. package/lib/textarea/style/style.min.css +1 -1
  220. package/lib/tooltip/index.js +2 -0
  221. package/lib/tooltip/index.min.js +1 -1
  222. package/lib/tooltip/src/tooltip.js +3 -4
  223. package/lib/tooltip/src/tooltip.min.js +1 -1
  224. package/lib/ui/src/core.js +1 -1
  225. package/lib/ui/src/core.min.js +1 -1
  226. package/lib/ui/src/globalStore.js +63 -65
  227. package/lib/ui/src/globalStore.min.js +1 -1
  228. package/lib/ui/src/log.js +1 -1
  229. package/lib/ui/src/log.min.js +1 -1
  230. package/lib/ui/src/resize.js +96 -0
  231. package/lib/ui/src/resize.min.js +1 -0
  232. package/lib/ui/src/store.js +8 -1
  233. package/lib/ui/src/store.min.js +1 -1
  234. package/lib/vxe-input/style/style.css +5 -5
  235. package/lib/vxe-input/style/style.min.css +1 -1
  236. package/lib/vxe-list/index.js +22 -0
  237. package/lib/vxe-list/index.min.js +1 -0
  238. package/lib/vxe-list/style/index.js +1 -0
  239. package/lib/vxe-list/style/style.css +26 -0
  240. package/lib/vxe-list/style/style.min.css +1 -0
  241. package/lib/vxe-modal/style/style.css +1 -1
  242. package/lib/vxe-modal/style/style.min.css +1 -1
  243. package/lib/vxe-pager/style/style.css +2 -2
  244. package/lib/vxe-pager/style/style.min.css +1 -1
  245. package/lib/vxe-pulldown/style/style.css +2 -2
  246. package/lib/vxe-pulldown/style/style.min.css +1 -1
  247. package/lib/vxe-select/style/style.css +2 -2
  248. package/lib/vxe-select/style/style.min.css +1 -1
  249. package/lib/vxe-switch/style/style.css +1 -1
  250. package/lib/vxe-switch/style/style.min.css +1 -1
  251. package/lib/vxe-tabs/style/style.css +49 -34
  252. package/lib/vxe-tabs/style/style.min.css +1 -1
  253. package/lib/vxe-textarea/style/style.css +2 -2
  254. package/lib/vxe-textarea/style/style.min.css +1 -1
  255. package/package.json +1 -1
  256. package/packages/anchor/index.ts +3 -0
  257. package/packages/anchor/src/anchor.ts +23 -23
  258. package/packages/anchor-link/index.ts +3 -0
  259. package/packages/breadcrumb/index.ts +3 -0
  260. package/packages/breadcrumb/src/breadcrumb.ts +2 -2
  261. package/packages/breadcrumb-item/index.ts +3 -0
  262. package/packages/button/index.ts +3 -0
  263. package/packages/button-group/index.ts +3 -0
  264. package/packages/checkbox/index.ts +2 -2
  265. package/packages/checkbox/src/checkbox.ts +8 -8
  266. package/packages/checkbox/src/group.ts +6 -6
  267. package/packages/checkbox-group/index.ts +3 -4
  268. package/packages/col/index.ts +3 -0
  269. package/packages/components.ts +3 -0
  270. package/packages/form/index.ts +3 -0
  271. package/packages/form/src/form.ts +4 -4
  272. package/packages/form-design/index.ts +3 -0
  273. package/packages/form-gather/index.ts +3 -0
  274. package/packages/form-item/index.ts +3 -0
  275. package/packages/icon/index.ts +3 -0
  276. package/packages/input/index.ts +3 -4
  277. package/packages/layout-aside/index.ts +3 -0
  278. package/packages/layout-body/index.ts +3 -0
  279. package/packages/layout-container/index.ts +3 -0
  280. package/packages/layout-footer/index.ts +3 -0
  281. package/packages/layout-header/index.ts +3 -0
  282. package/packages/list/index.ts +14 -0
  283. package/packages/list/src/list.ts +372 -0
  284. package/packages/list-design/index.ts +3 -0
  285. package/packages/loading/index.ts +3 -0
  286. package/packages/optgroup/index.ts +3 -4
  287. package/packages/option/index.ts +3 -4
  288. package/packages/pager/index.ts +3 -4
  289. package/packages/pager/src/pager.ts +3 -3
  290. package/packages/pulldown/index.ts +3 -4
  291. package/packages/radio/index.ts +3 -4
  292. package/packages/radio-button/index.ts +3 -4
  293. package/packages/radio-group/index.ts +2 -3
  294. package/packages/row/index.ts +3 -0
  295. package/packages/select/index.ts +3 -4
  296. package/packages/switch/index.ts +1 -2
  297. package/packages/tab-pane/index.ts +3 -0
  298. package/packages/tabs/index.ts +3 -0
  299. package/packages/tabs/src/tabs.ts +49 -19
  300. package/packages/textarea/index.ts +3 -4
  301. package/packages/tooltip/index.ts +3 -0
  302. package/packages/ui/src/globalStore.ts +63 -65
  303. package/packages/ui/src/resize.ts +85 -0
  304. package/styles/all.scss +1 -0
  305. package/styles/components/input.scss +5 -5
  306. package/styles/components/list.scss +1 -1
  307. package/styles/components/modal.scss +1 -1
  308. package/styles/components/pager.scss +2 -2
  309. package/styles/components/pulldown.scss +2 -2
  310. package/styles/components/select.scss +2 -2
  311. package/styles/components/switch.scss +1 -1
  312. package/styles/components/tabs.scss +44 -34
  313. package/styles/components/textarea.scss +2 -2
  314. package/types/all.d.ts +1 -0
  315. package/types/components/list.d.ts +166 -0
  316. package/types/components/tab-pane.d.ts +1 -1
  317. package/types/components/tabs.d.ts +2 -2
  318. package/types/ui/global-config.d.ts +67 -25
@@ -23,6 +23,7 @@ import VxeLayoutContainer from './layout-container'
23
23
  import VxeLayoutFooter from './layout-footer'
24
24
  import VxeLayoutHeader from './layout-header'
25
25
  import VxeListDesign from './list-design'
26
+ import VxeList from './list'
26
27
  import VxeLoading from './loading'
27
28
  import VxeModal from './modal'
28
29
  import VxeOptgroup from './optgroup'
@@ -71,6 +72,7 @@ const components = [
71
72
  VxeLayoutFooter,
72
73
  VxeLayoutHeader,
73
74
  VxeListDesign,
75
+ VxeList,
74
76
  VxeLoading,
75
77
  VxeModal,
76
78
  VxeOptgroup,
@@ -119,6 +121,7 @@ export * from './layout-container'
119
121
  export * from './layout-footer'
120
122
  export * from './layout-header'
121
123
  export * from './list-design'
124
+ export * from './list'
122
125
  export * from './loading'
123
126
  export * from './modal'
124
127
  export * from './optgroup'
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeFormComponent from './src/form'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  export const VxeForm = Object.assign(VxeFormComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ export const VxeForm = Object.assign(VxeFormComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeFormComponent.name as string, VxeFormComponent)
12
+
10
13
  export const Form = VxeForm
11
14
  export default VxeForm
@@ -8,7 +8,7 @@ import { errLog, warnLog } from '../../ui/src/log'
8
8
  import { scrollToView } from '../../ui/src/dom'
9
9
  import { createItem, handleFieldOrItem, isHiddenItem, isActivetem } from './util'
10
10
  import { useSize } from '../../hooks/size'
11
- import VxeTooltipComponent from '../../tooltip'
11
+ import VxeTooltipComponent from '../../tooltip/src/tooltip'
12
12
  import VxeFormConfigItem from './form-config-item'
13
13
  import VxeLoading from '../../loading/index'
14
14
  import { getSlotVNs } from '../../ui/src/vn'
@@ -129,7 +129,7 @@ export default defineComponent({
129
129
 
130
130
  provide('xeFormItemInfo', null)
131
131
 
132
- const $xegrid = inject<any>('$xegrid', null)
132
+ const $xeGrid = inject<any>('$xeGrid', null)
133
133
 
134
134
  const refElem = ref<HTMLFormElement>()
135
135
  const refTooltip = ref() as Ref<VxeTooltipInstance>
@@ -160,7 +160,7 @@ export default defineComponent({
160
160
  context,
161
161
  reactData,
162
162
 
163
- xegrid: $xegrid,
163
+ xegrid: $xeGrid,
164
164
  getRefMaps: () => refMaps,
165
165
  getComputeMaps: () => computeMaps
166
166
  } as unknown as VxeFormConstructor & VxeFormPrivateMethods
@@ -596,7 +596,7 @@ export default defineComponent({
596
596
 
597
597
  formMethods = {
598
598
  dispatchEvent (type, params, evnt) {
599
- emit(type, Object.assign({ $form: $xeform, $grid: $xegrid, $event: evnt }, params))
599
+ emit(type, Object.assign({ $form: $xeform, $grid: $xeGrid, $event: evnt }, params))
600
600
  },
601
601
  reset,
602
602
  validate,
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeFormDesignComponent from './src/form-design'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  const VxeFormDesign = Object.assign({}, VxeFormDesignComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ const VxeFormDesign = Object.assign({}, VxeFormDesignComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeFormDesignComponent.name as string, VxeFormDesignComponent)
12
+
10
13
  export const FormDesign = VxeFormDesign
11
14
  export default VxeFormDesign
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeFormGatherComponent from '../form/src/form-gather'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  export const VxeFormGather = Object.assign(VxeFormGatherComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ export const VxeFormGather = Object.assign(VxeFormGatherComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeFormGatherComponent.name as string, VxeFormGatherComponent)
12
+
10
13
  export const FormGather = VxeFormGather
11
14
  export default VxeFormGather
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeFormItemComponent from '../form/src/form-item'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  export const VxeFormItem = Object.assign(VxeFormItemComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ export const VxeFormItem = Object.assign(VxeFormItemComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeFormItemComponent.name as string, VxeFormItemComponent)
12
+
10
13
  export const FormItem = VxeFormItem
11
14
  export default VxeFormItem
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeIconComponent from './src/icon'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  const VxeIcon = Object.assign({}, VxeIconComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ const VxeIcon = Object.assign({}, VxeIconComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeIconComponent.name as string, VxeIconComponent)
12
+
10
13
  export const Icon = VxeIcon
11
14
  export default VxeIcon
@@ -4,12 +4,11 @@ import { dynamicApp } from '../dynamics'
4
4
 
5
5
  export const VxeInput = Object.assign(VxeInputConstructor, {
6
6
  install (app: App) {
7
- app.component(VxeInputConstructor.name, VxeInputConstructor)
7
+ app.component(VxeInputConstructor.name as string, VxeInputConstructor)
8
8
  }
9
9
  })
10
10
 
11
- export const Input = VxeInput
12
-
13
- dynamicApp.component(VxeInputConstructor.name, VxeInputConstructor)
11
+ dynamicApp.component(VxeInputConstructor.name as string, VxeInputConstructor)
14
12
 
13
+ export const Input = VxeInput
15
14
  export default VxeInput
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeLayoutAsideComponent from './src/layout-aside'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  const VxeLayoutAside = Object.assign({}, VxeLayoutAsideComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ const VxeLayoutAside = Object.assign({}, VxeLayoutAsideComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeLayoutAsideComponent.name as string, VxeLayoutAsideComponent)
12
+
10
13
  export const LayoutAside = VxeLayoutAside
11
14
  export default VxeLayoutAside
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeLayoutBodyComponent from './src/layout-body'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  const VxeLayoutBody = Object.assign({}, VxeLayoutBodyComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ const VxeLayoutBody = Object.assign({}, VxeLayoutBodyComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeLayoutBodyComponent.name as string, VxeLayoutBodyComponent)
12
+
10
13
  export const LayoutBody = VxeLayoutBody
11
14
  export default VxeLayoutBody
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeLayoutContainerComponent from './src/layout-container'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  const VxeLayoutContainer = Object.assign({}, VxeLayoutContainerComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ const VxeLayoutContainer = Object.assign({}, VxeLayoutContainerComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeLayoutContainerComponent.name as string, VxeLayoutContainerComponent)
12
+
10
13
  export const LayoutContainer = VxeLayoutContainer
11
14
  export default VxeLayoutContainer
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeLayoutFooterComponent from './src/layout-footer'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  const VxeLayoutFooter = Object.assign({}, VxeLayoutFooterComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ const VxeLayoutFooter = Object.assign({}, VxeLayoutFooterComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeLayoutFooterComponent.name as string, VxeLayoutFooterComponent)
12
+
10
13
  export const LayoutFooter = VxeLayoutFooter
11
14
  export default VxeLayoutFooter
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeLayoutHeaderComponent from './src/layout-header'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  const VxeLayoutHeader = Object.assign({}, VxeLayoutHeaderComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ const VxeLayoutHeader = Object.assign({}, VxeLayoutHeaderComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeLayoutHeaderComponent.name as string, VxeLayoutHeaderComponent)
12
+
10
13
  export const LayoutHeader = VxeLayoutHeader
11
14
  export default VxeLayoutHeader
@@ -0,0 +1,14 @@
1
+ import { App } from 'vue'
2
+ import VxeListComponent from './src/list'
3
+ import { dynamicApp } from '../dynamics'
4
+
5
+ export const VxeList = Object.assign(VxeListComponent, {
6
+ install (app: App) {
7
+ app.component(VxeListComponent.name as string, VxeListComponent)
8
+ }
9
+ })
10
+
11
+ dynamicApp.component(VxeListComponent.name as string, VxeListComponent)
12
+
13
+ export const List = VxeList
14
+ export default VxeList
@@ -0,0 +1,372 @@
1
+ import { defineComponent, h, PropType, ref, Ref, computed, onUnmounted, watch, reactive, nextTick, onActivated } from 'vue'
2
+ import XEUtils from 'xe-utils'
3
+ import globalConfigStore from '../../ui/src/globalStore'
4
+ import { useSize } from '../../hooks/size'
5
+ import { createResizeEvent, XEResizeObserver } from '../../ui/src/resize'
6
+ import { browse } from '../../ui/src/dom'
7
+ import { GlobalEvent } from '../../ui/src/event'
8
+ import VxeLoadingComponent from '../../loading/src/loading'
9
+
10
+ import { VxeListConstructor, VxeListPropTypes, VxeListEmits, ListReactData, ListInternalData, ListMethods, ListPrivateRef, VxeListMethods } from '../../../types'
11
+
12
+ export default defineComponent({
13
+ name: 'VxeList',
14
+ props: {
15
+ data: Array as PropType<VxeListPropTypes.Data>,
16
+ height: [Number, String] as PropType<VxeListPropTypes.Height>,
17
+ maxHeight: [Number, String] as PropType<VxeListPropTypes.MaxHeight>,
18
+ loading: Boolean as PropType<VxeListPropTypes.Loading>,
19
+ className: [String, Function] as PropType<VxeListPropTypes.ClassName>,
20
+ size: { type: String as PropType<VxeListPropTypes.Size>, default: () => globalConfigStore.list.size || globalConfigStore.size },
21
+ autoResize: { type: Boolean as PropType<VxeListPropTypes.AutoResize>, default: () => globalConfigStore.list.autoResize },
22
+ syncResize: [Boolean, String, Number] as PropType<VxeListPropTypes.SyncResize>,
23
+ scrollY: Object as PropType<VxeListPropTypes.ScrollY>
24
+ },
25
+ emits: [
26
+ 'scroll'
27
+ ] as VxeListEmits,
28
+ setup (props, context) {
29
+ const { slots, emit } = context
30
+
31
+ const xID = XEUtils.uniqueId()
32
+
33
+ const computeSize = useSize(props)
34
+
35
+ const reactData = reactive({
36
+ scrollYLoad: false,
37
+ bodyHeight: 0,
38
+ rowHeight: 0,
39
+ topSpaceHeight: 0,
40
+ items: []
41
+ } as ListReactData)
42
+
43
+ const refElem = ref() as Ref<HTMLDivElement>
44
+ const refVirtualWrapper = ref() as Ref<HTMLDivElement>
45
+ const refVirtualBody = ref() as Ref<HTMLDivElement>
46
+
47
+ const internalData: ListInternalData = {
48
+ fullData: [],
49
+ lastScrollLeft: 0,
50
+ lastScrollTop: 0,
51
+ scrollYStore: {
52
+ startIndex: 0,
53
+ endIndex: 0,
54
+ visibleSize: 0,
55
+ offsetSize: 0,
56
+ rowHeight: 0
57
+ }
58
+ }
59
+
60
+ const refMaps: ListPrivateRef = {
61
+ refElem
62
+ }
63
+
64
+ const $xeList = {
65
+ xID,
66
+ props,
67
+ context,
68
+ reactData,
69
+ internalData,
70
+ getRefMaps: () => refMaps
71
+ } as unknown as VxeListConstructor & VxeListMethods
72
+
73
+ let listMethods = {} as ListMethods
74
+
75
+ const computeSYOpts = computed(() => {
76
+ return Object.assign({} as { gt: number }, globalConfigStore.list.scrollY, props.scrollY)
77
+ })
78
+
79
+ const computeStyles = computed(() => {
80
+ const { height, maxHeight } = props
81
+ const style: { [key: string]: string | number } = {}
82
+ if (height) {
83
+ style.height = `${isNaN(height as number) ? height : `${height}px`}`
84
+ } else if (maxHeight) {
85
+ style.height = 'auto'
86
+ style.maxHeight = `${isNaN(maxHeight as number) ? maxHeight : `${maxHeight}px`}`
87
+ }
88
+ return style
89
+ })
90
+
91
+ const updateYSpace = () => {
92
+ const { scrollYLoad } = reactData
93
+ const { scrollYStore, fullData } = internalData
94
+ reactData.bodyHeight = scrollYLoad ? fullData.length * scrollYStore.rowHeight : 0
95
+ reactData.topSpaceHeight = scrollYLoad ? Math.max(scrollYStore.startIndex * scrollYStore.rowHeight, 0) : 0
96
+ }
97
+
98
+ const handleData = () => {
99
+ const { scrollYLoad } = reactData
100
+ const { fullData, scrollYStore } = internalData
101
+ reactData.items = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullData.slice(0)
102
+ return nextTick()
103
+ }
104
+
105
+ const updateYData = () => {
106
+ handleData()
107
+ updateYSpace()
108
+ }
109
+
110
+ const computeScrollLoad = () => {
111
+ return nextTick().then(() => {
112
+ const { scrollYLoad } = reactData
113
+ const { scrollYStore } = internalData
114
+ const virtualBodyElem = refVirtualBody.value
115
+ const sYOpts = computeSYOpts.value
116
+ let rowHeight = 0
117
+ let firstItemElem: HTMLElement | undefined
118
+ if (virtualBodyElem) {
119
+ if (sYOpts.sItem) {
120
+ firstItemElem = virtualBodyElem.querySelector(sYOpts.sItem) as HTMLElement
121
+ }
122
+ if (!firstItemElem) {
123
+ firstItemElem = virtualBodyElem.children[0] as HTMLElement
124
+ }
125
+ }
126
+ if (firstItemElem) {
127
+ rowHeight = firstItemElem.offsetHeight
128
+ }
129
+ rowHeight = Math.max(20, rowHeight)
130
+ scrollYStore.rowHeight = rowHeight
131
+ // 计算 Y 逻辑
132
+ if (scrollYLoad) {
133
+ const scrollBodyElem = refVirtualWrapper.value
134
+ const visibleYSize = Math.max(8, Math.ceil(scrollBodyElem.clientHeight / rowHeight))
135
+ const offsetYSize = sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browse.edge ? 10 : 0)
136
+ scrollYStore.offsetSize = offsetYSize
137
+ scrollYStore.visibleSize = visibleYSize
138
+ scrollYStore.endIndex = Math.max(scrollYStore.startIndex, visibleYSize + offsetYSize, scrollYStore.endIndex)
139
+ updateYData()
140
+ } else {
141
+ updateYSpace()
142
+ }
143
+ reactData.rowHeight = rowHeight
144
+ })
145
+ }
146
+
147
+ /**
148
+ * 清除滚动条
149
+ */
150
+ const clearScroll = () => {
151
+ const scrollBodyElem = refVirtualWrapper.value
152
+ if (scrollBodyElem) {
153
+ scrollBodyElem.scrollTop = 0
154
+ }
155
+ return nextTick()
156
+ }
157
+
158
+ /**
159
+ * 如果有滚动条,则滚动到对应的位置
160
+ * @param {Number} scrollLeft 左距离
161
+ * @param {Number} scrollTop 上距离
162
+ */
163
+ const scrollTo = (scrollLeft: number | null, scrollTop?: number | null): Promise<void> => {
164
+ const scrollBodyElem = refVirtualWrapper.value
165
+ if (XEUtils.isNumber(scrollLeft)) {
166
+ scrollBodyElem.scrollLeft = scrollLeft
167
+ }
168
+ if (XEUtils.isNumber(scrollTop)) {
169
+ scrollBodyElem.scrollTop = scrollTop
170
+ }
171
+ if (reactData.scrollYLoad) {
172
+ return new Promise(resolve => {
173
+ setTimeout(() => {
174
+ nextTick(() => {
175
+ resolve()
176
+ })
177
+ }, 50)
178
+ })
179
+ }
180
+ return nextTick()
181
+ }
182
+
183
+ /**
184
+ * 刷新滚动条
185
+ */
186
+ const refreshScroll = () => {
187
+ const { lastScrollLeft, lastScrollTop } = internalData
188
+ return clearScroll().then(() => {
189
+ if (lastScrollLeft || lastScrollTop) {
190
+ internalData.lastScrollLeft = 0
191
+ internalData.lastScrollTop = 0
192
+ return scrollTo(lastScrollLeft, lastScrollTop)
193
+ }
194
+ })
195
+ }
196
+
197
+ /**
198
+ * 重新计算列表
199
+ */
200
+ const recalculate = () => {
201
+ const el = refElem.value
202
+ if (el.clientWidth && el.clientHeight) {
203
+ return computeScrollLoad()
204
+ }
205
+ return Promise.resolve()
206
+ }
207
+
208
+ const loadYData = (evnt: Event) => {
209
+ const { scrollYStore } = internalData
210
+ const { startIndex, endIndex, visibleSize, offsetSize, rowHeight } = scrollYStore
211
+ const scrollBodyElem = evnt.target as HTMLDivElement
212
+ const scrollTop = scrollBodyElem.scrollTop
213
+ const toVisibleIndex = Math.floor(scrollTop / rowHeight)
214
+ const offsetStartIndex = Math.max(0, toVisibleIndex - 1 - offsetSize)
215
+ const offsetEndIndex = toVisibleIndex + visibleSize + offsetSize
216
+ if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
217
+ if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
218
+ scrollYStore.startIndex = offsetStartIndex
219
+ scrollYStore.endIndex = offsetEndIndex
220
+ updateYData()
221
+ }
222
+ }
223
+ }
224
+
225
+ const scrollEvent = (evnt: Event) => {
226
+ const scrollBodyElem = evnt.target as HTMLDivElement
227
+ const scrollTop = scrollBodyElem.scrollTop
228
+ const scrollLeft = scrollBodyElem.scrollLeft
229
+ const isX = scrollLeft !== internalData.lastScrollLeft
230
+ const isY = scrollTop !== internalData.lastScrollTop
231
+ internalData.lastScrollTop = scrollTop
232
+ internalData.lastScrollLeft = scrollLeft
233
+ if (reactData.scrollYLoad) {
234
+ loadYData(evnt)
235
+ }
236
+ listMethods.dispatchEvent('scroll', { scrollLeft, scrollTop, isX, isY }, evnt)
237
+ }
238
+
239
+ listMethods = {
240
+ dispatchEvent (type, params, evnt) {
241
+ emit(type, Object.assign({ $list: $xeList, $event: evnt }, params))
242
+ },
243
+ /**
244
+ * 加载数据
245
+ * @param {Array} datas 数据
246
+ */
247
+ loadData (datas) {
248
+ const { scrollYStore } = internalData
249
+ const sYOpts = computeSYOpts.value
250
+ const fullData = datas || []
251
+ Object.assign(scrollYStore, {
252
+ startIndex: 0,
253
+ endIndex: 1,
254
+ visibleSize: 0
255
+ })
256
+ internalData.fullData = fullData
257
+ // 如果gt为0,则总是启用
258
+ reactData.scrollYLoad = !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt <= fullData.length)
259
+ handleData()
260
+ return computeScrollLoad().then(() => {
261
+ refreshScroll()
262
+ })
263
+ },
264
+ /**
265
+ * 重新加载数据
266
+ * @param {Array} datas 数据
267
+ */
268
+ reloadData (datas) {
269
+ clearScroll()
270
+ return listMethods.loadData(datas)
271
+ },
272
+ recalculate,
273
+ scrollTo,
274
+ refreshScroll,
275
+ clearScroll
276
+ }
277
+
278
+ Object.assign($xeList, listMethods)
279
+
280
+ const dataFlag = ref(0)
281
+ watch(() => props.data ? props.data.length : -1, () => {
282
+ dataFlag.value++
283
+ })
284
+ watch(() => props.data, () => {
285
+ dataFlag.value++
286
+ })
287
+ watch(dataFlag, () => {
288
+ listMethods.loadData(props.data || [])
289
+ })
290
+
291
+ watch(() => props.syncResize, (value) => {
292
+ if (value) {
293
+ recalculate()
294
+ nextTick(() => setTimeout(() => recalculate()))
295
+ }
296
+ })
297
+
298
+ onActivated(() => {
299
+ recalculate().then(() => refreshScroll())
300
+ })
301
+
302
+ let resizeObserver: XEResizeObserver
303
+
304
+ nextTick(() => {
305
+ GlobalEvent.on($xeList, 'resize', () => {
306
+ recalculate()
307
+ })
308
+ if (props.autoResize) {
309
+ const el = refElem.value
310
+ resizeObserver = createResizeEvent(() => recalculate())
311
+ resizeObserver.observe(el)
312
+ }
313
+ listMethods.loadData(props.data || [])
314
+ })
315
+
316
+ onUnmounted(() => {
317
+ if (resizeObserver) {
318
+ resizeObserver.disconnect()
319
+ }
320
+ GlobalEvent.off($xeList, 'resize')
321
+ })
322
+
323
+ const renderVN = () => {
324
+ const { className, loading } = props
325
+ const { bodyHeight, topSpaceHeight, items } = reactData
326
+ const vSize = computeSize.value
327
+ const styles = computeStyles.value
328
+ return h('div', {
329
+ ref: refElem,
330
+ class: ['vxe-list', className ? (XEUtils.isFunction(className) ? className({ $list: $xeList }) : className) : '', {
331
+ [`size--${vSize}`]: vSize,
332
+ 'is--loading': loading
333
+ }]
334
+ }, [
335
+ h('div', {
336
+ ref: refVirtualWrapper,
337
+ class: 'vxe-list--virtual-wrapper',
338
+ style: styles,
339
+ onScroll: scrollEvent
340
+ }, [
341
+ h('div', {
342
+ class: 'vxe-list--y-space',
343
+ style: {
344
+ height: bodyHeight ? `${bodyHeight}px` : ''
345
+ }
346
+ }),
347
+ h('div', {
348
+ ref: refVirtualBody,
349
+ class: 'vxe-list--body',
350
+ style: {
351
+ marginTop: topSpaceHeight ? `${topSpaceHeight}px` : ''
352
+ }
353
+ }, slots.default ? slots.default({ items, $list: $xeList }) : [])
354
+ ]),
355
+ /**
356
+ * 加载中
357
+ */
358
+ h(VxeLoadingComponent, {
359
+ class: 'vxe-list--loading',
360
+ modelValue: loading
361
+ })
362
+ ])
363
+ }
364
+
365
+ $xeList.renderVN = renderVN
366
+
367
+ return $xeList
368
+ },
369
+ render () {
370
+ return this.renderVN()
371
+ }
372
+ })
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeListDesignComponent from './src/list-design'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  const VxeListDesign = Object.assign({}, VxeListDesignComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ const VxeListDesign = Object.assign({}, VxeListDesignComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeListDesignComponent.name as string, VxeListDesignComponent)
12
+
10
13
  export const ListDesign = VxeListDesign
11
14
  export default VxeListDesign
@@ -1,5 +1,6 @@
1
1
  import { App } from 'vue'
2
2
  import VxeLoadingComponent from './src/loading'
3
+ import { dynamicApp } from '../dynamics'
3
4
 
4
5
  const VxeLoading = Object.assign({}, VxeLoadingComponent, {
5
6
  install (app: App) {
@@ -7,5 +8,7 @@ const VxeLoading = Object.assign({}, VxeLoadingComponent, {
7
8
  }
8
9
  })
9
10
 
11
+ dynamicApp.component(VxeLoadingComponent.name as string, VxeLoadingComponent)
12
+
10
13
  export const Loading = VxeLoading
11
14
  export default VxeLoading
@@ -4,12 +4,11 @@ import { dynamicApp } from '../dynamics'
4
4
 
5
5
  export const VxeOptgroup = Object.assign(VxeOptgroupComponent, {
6
6
  install: function (app: App) {
7
- app.component(VxeOptgroupComponent.name, VxeOptgroupComponent)
7
+ app.component(VxeOptgroupComponent.name as string, VxeOptgroupComponent)
8
8
  }
9
9
  })
10
10
 
11
- export const Optgroup = VxeOptgroup
12
-
13
- dynamicApp.component(VxeOptgroupComponent.name, VxeOptgroupComponent)
11
+ dynamicApp.component(VxeOptgroupComponent.name as string, VxeOptgroupComponent)
14
12
 
13
+ export const Optgroup = VxeOptgroup
15
14
  export default VxeOptgroup
@@ -4,12 +4,11 @@ import { dynamicApp } from '../dynamics'
4
4
 
5
5
  export const VxeOption = Object.assign(VxeOptionComponent, {
6
6
  install: function (app: App) {
7
- app.component(VxeOptionComponent.name, VxeOptionComponent)
7
+ app.component(VxeOptionComponent.name as string, VxeOptionComponent)
8
8
  }
9
9
  })
10
10
 
11
- export const Option = VxeOption
12
-
13
- dynamicApp.component(VxeOptionComponent.name, VxeOptionComponent)
11
+ dynamicApp.component(VxeOptionComponent.name as string, VxeOptionComponent)
14
12
 
13
+ export const Option = VxeOption
15
14
  export default VxeOption