vxe-pc-ui 4.11.0 → 4.11.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 (38) hide show
  1. package/es/icon/style.css +1 -1
  2. package/es/style.css +1 -1
  3. package/es/style.min.css +1 -1
  4. package/es/tree/src/store.js +8 -0
  5. package/es/tree/src/tree.js +123 -68
  6. package/es/ui/index.js +1 -1
  7. package/es/ui/src/log.js +1 -1
  8. package/lib/icon/style/style.css +1 -1
  9. package/lib/icon/style/style.min.css +1 -1
  10. package/lib/index.umd.js +140 -79
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/style.css +1 -1
  13. package/lib/style.min.css +1 -1
  14. package/lib/tree/src/store.js +15 -0
  15. package/lib/tree/src/store.min.js +1 -0
  16. package/lib/tree/src/tree.js +124 -72
  17. package/lib/tree/src/tree.min.js +1 -1
  18. package/lib/ui/index.js +1 -1
  19. package/lib/ui/index.min.js +1 -1
  20. package/lib/ui/src/log.js +1 -1
  21. package/lib/ui/src/log.min.js +1 -1
  22. package/package.json +1 -1
  23. package/packages/tree/src/store.ts +14 -0
  24. package/packages/tree/src/tree.ts +131 -74
  25. package/types/components/gantt-plugins/extend-gantt-chart.d.ts +19 -0
  26. package/types/components/tree.d.ts +24 -0
  27. /package/es/icon/{iconfont.1765418463677.ttf → iconfont.1765525478141.ttf} +0 -0
  28. /package/es/icon/{iconfont.1765418463677.woff → iconfont.1765525478141.woff} +0 -0
  29. /package/es/icon/{iconfont.1765418463677.woff2 → iconfont.1765525478141.woff2} +0 -0
  30. /package/es/{iconfont.1765418463677.ttf → iconfont.1765525478141.ttf} +0 -0
  31. /package/es/{iconfont.1765418463677.woff → iconfont.1765525478141.woff} +0 -0
  32. /package/es/{iconfont.1765418463677.woff2 → iconfont.1765525478141.woff2} +0 -0
  33. /package/lib/icon/style/{iconfont.1765418463677.ttf → iconfont.1765525478141.ttf} +0 -0
  34. /package/lib/icon/style/{iconfont.1765418463677.woff → iconfont.1765525478141.woff} +0 -0
  35. /package/lib/icon/style/{iconfont.1765418463677.woff2 → iconfont.1765525478141.woff2} +0 -0
  36. /package/lib/{iconfont.1765418463677.ttf → iconfont.1765525478141.ttf} +0 -0
  37. /package/lib/{iconfont.1765418463677.woff → iconfont.1765525478141.woff} +0 -0
  38. /package/lib/{iconfont.1765418463677.woff2 → iconfont.1765525478141.woff2} +0 -0
@@ -3,6 +3,7 @@ import { defineVxeComponent } from '../../ui/src/comp'
3
3
  import { VxeUI, getI18n, createEvent, getIcon, getConfig, useSize, globalEvents, globalResize, renderEmptyElement } from '../../ui'
4
4
  import { calcTreeLine, enNodeValue, deNodeValue } from './util'
5
5
  import { errLog } from '../../ui/src/log'
6
+ import { getCrossTreeDragNodeInfo } from './store'
6
7
  import XEUtils from 'xe-utils'
7
8
  import { getSlotVNs } from '../../ui/src/vn'
8
9
  import { toCssUnit, isScale, getPaddingTopBottomSize, addClass, removeClass, getTpImg, hasControlKey, getEventTargetNode } from '../../ui/src/dom'
@@ -50,6 +51,11 @@ function createInternalData (): TreeInternalData {
50
51
  }
51
52
  }
52
53
 
54
+ // let crossTreeDragNodeObj: {
55
+ // $oldTree: VxeTreeConstructor & VxeTreePrivateMethods
56
+ // $newTree: (VxeTreeConstructor & VxeTreePrivateMethods) | null
57
+ // } | null = null
58
+
53
59
  export default defineVxeComponent({
54
60
  name: 'VxeTree',
55
61
  props: {
@@ -200,6 +206,8 @@ export default defineVxeComponent({
200
206
  const refDragNodeLineElem = ref<HTMLDivElement>()
201
207
  const refDragTipElem = ref<HTMLDivElement>()
202
208
 
209
+ const crossTreeDragNodeInfo = getCrossTreeDragNodeInfo()
210
+
203
211
  const reactData = reactive<TreeReactData>({
204
212
  parentHeight: 0,
205
213
  customHeight: 0,
@@ -1749,11 +1757,17 @@ export default defineVxeComponent({
1749
1757
  }
1750
1758
  }
1751
1759
 
1760
+ const clearCrossTreeDragStatus = () => {
1761
+ // crossTreeDragNodeObj = null
1762
+ crossTreeDragNodeInfo.node = null
1763
+ }
1764
+
1752
1765
  const clearDragStatus = () => {
1753
1766
  const { dragNode } = reactData
1754
1767
  if (dragNode) {
1755
- clearNodeDropOrigin()
1756
1768
  hideDropTip()
1769
+ clearNodeDropOrigin()
1770
+ clearCrossTreeDragStatus()
1757
1771
  reactData.dragNode = null
1758
1772
  }
1759
1773
  }
@@ -1858,84 +1872,55 @@ export default defineVxeComponent({
1858
1872
  dragToChild: !!prevDragToChild,
1859
1873
  offsetIndex: dragOffsetIndex as 0 | 1
1860
1874
  }
1861
- const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
1862
- return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
1863
- if (!status) {
1864
- return errRest
1865
- }
1866
1875
 
1867
- const dragNodeid = getNodeId(dragNode)
1868
- const dragNodeRest = nodeMaps[dragNodeid] || {}
1869
- const _dragNodeIndex = dragNodeRest._index
1870
- let dragNodeHeight = 0
1871
- let dragOffsetTop = -1
1872
- if (animation) {
1873
- const prevItemEl = el.querySelector<HTMLElement>(`.vxe-tree--node-wrapper[nodeid="${prevDragNode}"]`)
1874
- const oldItemEl = el.querySelector<HTMLElement>(`.vxe-tree--node-wrapper[nodeid="${dragNodeid}"]`)
1875
- const targetItemEl = prevItemEl || oldItemEl
1876
- if (targetItemEl) {
1877
- dragNodeHeight = targetItemEl.offsetHeight
1878
- }
1879
- if (oldItemEl) {
1880
- dragOffsetTop = oldItemEl.offsetTop
1881
- }
1876
+ const dragNodeid = getNodeId(dragNode)
1877
+ const dragNodeRest = nodeMaps[dragNodeid] || {}
1878
+ const _dragNodeIndex = dragNodeRest._index
1879
+ let dragNodeHeight = 0
1880
+ let dragOffsetTop = -1
1881
+ if (animation) {
1882
+ const prevItemEl = el.querySelector<HTMLElement>(`.vxe-tree--node-wrapper[nodeid="${prevDragNode}"]`)
1883
+ const oldItemEl = el.querySelector<HTMLElement>(`.vxe-tree--node-wrapper[nodeid="${dragNodeid}"]`)
1884
+ const targetItemEl = prevItemEl || oldItemEl
1885
+ if (targetItemEl) {
1886
+ dragNodeHeight = targetItemEl.offsetHeight
1882
1887
  }
1888
+ if (oldItemEl) {
1889
+ dragOffsetTop = oldItemEl.offsetTop
1890
+ }
1891
+ }
1883
1892
 
1884
- let oafIndex = -1
1885
- let nafIndex = -1
1886
-
1887
- if (transform) {
1888
- // 移出源位置
1889
- const oldRest = dragNodeRest
1890
- const newNodeid = getNodeId(prevDragNode)
1891
- const newRest = nodeMaps[newNodeid]
1892
-
1893
- if (oldRest && newRest) {
1894
- const { level: oldLevel } = oldRest
1895
- const { level: newLevel } = newRest
1896
-
1897
- const oldAllMaps: Record<string, any> = {}
1898
- XEUtils.eachTree([dragNode], item => {
1899
- oldAllMaps[getNodeId(item)] = item
1900
- }, { children: mapChildrenField })
1901
-
1902
- let isSelfToChildStatus = false
1903
-
1904
- if (oldLevel && newLevel) {
1905
- // 子到子
1906
-
1907
- if (isPeerDrag && !isCrossDrag) {
1908
- if (oldRest.item[parentField] !== newRest.item[parentField]) {
1909
- // 非同级
1910
- return errRest
1911
- }
1912
- } else {
1913
- if (!isCrossDrag) {
1914
- return errRest
1915
- }
1916
- if (oldAllMaps[newNodeid]) {
1917
- isSelfToChildStatus = true
1918
- if (!(isCrossDrag && isSelfToChildDrag)) {
1919
- if (VxeUI.modal) {
1920
- VxeUI.modal.message({
1921
- status: 'error',
1922
- content: getI18n('vxe.error.treeDragChild')
1923
- })
1924
- }
1925
- return errRest
1926
- }
1927
- }
1928
- }
1929
- } else if (oldLevel) {
1930
- // 子到根
1893
+ let oafIndex = -1
1894
+ let nafIndex = -1
1895
+ const oldAllMaps: Record<string, any> = {}
1896
+ let isSelfToChildStatus = false
1931
1897
 
1932
- if (!isCrossDrag) {
1898
+ const oldRest = dragNodeRest
1899
+ const newNodeid = getNodeId(prevDragNode)
1900
+ const newRest = nodeMaps[newNodeid]
1901
+ if (transform) {
1902
+ if (oldRest && newRest) {
1903
+ const { level: oldLevel } = oldRest
1904
+ const { level: newLevel } = newRest
1905
+
1906
+ XEUtils.eachTree([dragNode], item => {
1907
+ oldAllMaps[getNodeId(item)] = item
1908
+ }, { children: mapChildrenField })
1909
+
1910
+ if (oldLevel && newLevel) {
1911
+ // 子到子
1912
+
1913
+ if (isPeerDrag && !isCrossDrag) {
1914
+ if (oldRest.item[parentField] !== newRest.item[parentField]) {
1915
+ // 非同级
1916
+ clearNodeDragData()
1917
+ clearCrossTreeDragStatus()
1933
1918
  return errRest
1934
1919
  }
1935
- } else if (newLevel) {
1936
- // 根到子
1937
-
1920
+ } else {
1938
1921
  if (!isCrossDrag) {
1922
+ clearNodeDragData()
1923
+ clearCrossTreeDragStatus()
1939
1924
  return errRest
1940
1925
  }
1941
1926
  if (oldAllMaps[newNodeid]) {
@@ -1947,13 +1932,57 @@ export default defineVxeComponent({
1947
1932
  content: getI18n('vxe.error.treeDragChild')
1948
1933
  })
1949
1934
  }
1935
+ clearNodeDragData()
1936
+ clearCrossTreeDragStatus()
1950
1937
  return errRest
1951
1938
  }
1952
1939
  }
1953
- } else {
1954
- // 根到根
1955
1940
  }
1941
+ } else if (oldLevel) {
1942
+ // 子到根
1943
+
1944
+ if (!isCrossDrag) {
1945
+ clearNodeDragData()
1946
+ clearCrossTreeDragStatus()
1947
+ return errRest
1948
+ }
1949
+ } else if (newLevel) {
1950
+ // 根到子
1951
+
1952
+ if (!isCrossDrag) {
1953
+ clearNodeDragData()
1954
+ clearCrossTreeDragStatus()
1955
+ return errRest
1956
+ }
1957
+ if (oldAllMaps[newNodeid]) {
1958
+ isSelfToChildStatus = true
1959
+ if (!(isCrossDrag && isSelfToChildDrag)) {
1960
+ if (VxeUI.modal) {
1961
+ VxeUI.modal.message({
1962
+ status: 'error',
1963
+ content: getI18n('vxe.error.treeDragChild')
1964
+ })
1965
+ }
1966
+ clearNodeDragData()
1967
+ clearCrossTreeDragStatus()
1968
+ return errRest
1969
+ }
1970
+ }
1971
+ } else {
1972
+ // 根到根
1973
+ }
1974
+ }
1975
+ }
1976
+
1977
+ const isDragToChildFlag = isSelfToChildDrag && dragToChildMethod ? dragToChildMethod(dragParams) : prevDragToChild
1978
+ return Promise.resolve(dEndMethod ? dEndMethod(dragParams) : true).then((status) => {
1979
+ if (!status) {
1980
+ return errRest
1981
+ }
1956
1982
 
1983
+ if (transform) {
1984
+ // 移出源位置
1985
+ if (oldRest && newRest) {
1957
1986
  const fullList = XEUtils.toTreeArray(internalData.afterTreeList, {
1958
1987
  key: keyField,
1959
1988
  parentKey: parentField,
@@ -2093,10 +2122,12 @@ export default defineVxeComponent({
2093
2122
  return errRest
2094
2123
  }).then((rest) => {
2095
2124
  clearNodeDragData()
2125
+ clearCrossTreeDragStatus()
2096
2126
  return rest
2097
2127
  })
2098
2128
  }
2099
2129
  clearNodeDragData()
2130
+ clearCrossTreeDragStatus()
2100
2131
  return Promise.resolve(errRest)
2101
2132
  }
2102
2133
 
@@ -2183,6 +2214,28 @@ export default defineVxeComponent({
2183
2214
  return getNodeId(node1) === getNodeId(node2)
2184
2215
  }
2185
2216
  return false
2217
+ },
2218
+ handleCrossTreeNodeDragCancelEvent () {
2219
+ clearNodeDragData()
2220
+ clearCrossTreeDragStatus()
2221
+ },
2222
+ /**
2223
+ * 处理跨树拖拽完成
2224
+ */
2225
+ handleCrossTreeNodeDragFinishEvent () {
2226
+ },
2227
+ /**
2228
+ * 处理跨树拖至新的空树
2229
+ */
2230
+ handleCrossTreeNodeDragInsertEvent () {
2231
+ },
2232
+ /**
2233
+ * 处理跨树拖插入
2234
+ */
2235
+ handleCrossTreeNodeDragoverEmptyEvent () {
2236
+ },
2237
+ hideCrossTreeNodeDropClearStatus () {
2238
+ hideDropTip()
2186
2239
  }
2187
2240
  }
2188
2241
 
@@ -2614,6 +2667,10 @@ export default defineVxeComponent({
2614
2667
  })
2615
2668
 
2616
2669
  onMounted(() => {
2670
+ const dragOpts = computeDragOpts.value
2671
+ if (dragOpts.isCrossTreeDrag) {
2672
+ errLog('vxe.error.notProp', ['drag-config.isCrossTreeDrag'])
2673
+ }
2617
2674
  if (props.autoResize) {
2618
2675
  const el = refElem.value
2619
2676
  const parentEl = getParentElem()
@@ -1,3 +1,5 @@
1
+ import { VNode } from 'vue'
2
+ import { VxeComponentStyleType } from '@vxe-ui/core'
1
3
  import { VxeGanttConstructor, VxeGanttDefines } from '../gantt'
2
4
 
3
5
  /* eslint-disable @typescript-eslint/no-empty-interface,no-use-before-define,@typescript-eslint/no-unused-vars */
@@ -14,6 +16,23 @@ export interface VxeGanttExtendChartPrivateMethods<D = any> {
14
16
  row: D
15
17
  scaleType: VxeGanttDefines.ColumnScaleType
16
18
  }): void
19
+ /**
20
+ * @private
21
+ */
22
+ renderGanttTaskBarContent(params: {
23
+ $gantt: VxeGanttConstructor<D>
24
+ source: string
25
+ type: string
26
+ scaleType: VxeGanttDefines.ColumnScaleType
27
+ row: D
28
+ rowIndex: number
29
+ $rowIndex: number
30
+ _rowIndex: number
31
+ }, renderParams: {
32
+ title: string
33
+ vbStyle: VxeComponentStyleType
34
+ vpStyle: VxeComponentStyleType
35
+ }): VNode[]
17
36
  }
18
37
 
19
38
  declare module '../gantt' {
@@ -153,6 +153,10 @@ export namespace VxeTreePropTypes {
153
153
  * 需要 isCrossDrag,是否允许将自己拖拽到子级行中
154
154
  */
155
155
  isSelfToChildDrag?: boolean
156
+ /**
157
+ * 是否允许在不同树之间进行拖拽
158
+ */
159
+ isCrossTreeDrag?: boolean
156
160
  /**
157
161
  * 是否显示拖拽辅助状态显示
158
162
  */
@@ -592,6 +596,26 @@ export interface TreePrivateMethods {
592
596
  * @private
593
597
  */
594
598
  eqNode(node1: any, node2: any): boolean
599
+ /**
600
+ * @private
601
+ */
602
+ handleCrossTreeNodeDragInsertEvent(evnt: DragEvent): void
603
+ /**
604
+ * @private
605
+ */
606
+ handleCrossTreeNodeDragCancelEvent(evnt: DragEvent): void
607
+ /**
608
+ * @private
609
+ */
610
+ handleCrossTreeNodeDragFinishEvent(evnt: DragEvent): void
611
+ /**
612
+ * @private
613
+ */
614
+ handleCrossTreeNodeDragoverEmptyEvent(evnt: DragEvent): void
615
+ /**
616
+ * @private
617
+ */
618
+ hideCrossTreeNodeDropClearStatus(): void
595
619
  }
596
620
  export interface VxeTreePrivateMethods extends TreePrivateMethods { }
597
621