vxe-pc-ui 4.14.39 → 4.14.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.esm.js +1722 -728
- package/dist/style.css +1 -1
- package/dist/style.min.css +1 -1
- package/es/cascader/src/cascader.js +1157 -172
- package/es/cascader/src/util.js +7 -0
- package/es/cascader/style.css +197 -21
- package/es/cascader/style.min.css +1 -1
- package/es/input/src/input.js +2 -2
- package/es/language/ar-EG.js +7 -0
- package/es/language/de-DE.js +7 -0
- package/es/language/en-US.js +7 -0
- package/es/language/es-ES.js +7 -0
- package/es/language/fr-FR.js +7 -0
- package/es/language/hu-HU.js +7 -0
- package/es/language/hy-AM.js +7 -0
- package/es/language/id-ID.js +7 -0
- package/es/language/it-IT.js +7 -0
- package/es/language/ja-JP.js +7 -0
- package/es/language/ko-KR.js +7 -0
- package/es/language/ms-MY.js +7 -0
- package/es/language/nb-NO.js +7 -0
- package/es/language/pt-BR.js +7 -0
- package/es/language/ru-RU.js +7 -0
- package/es/language/th-TH.js +7 -0
- package/es/language/ug-CN.js +7 -0
- package/es/language/uk-UA.js +7 -0
- package/es/language/uz-UZ.js +7 -0
- package/es/language/vi-VN.js +7 -0
- package/es/language/zh-CHT.js +7 -0
- package/es/language/zh-CN.js +7 -0
- package/es/list/style.css +2 -1
- package/es/list/style.min.css +1 -1
- package/es/number-input/src/number-input.js +7 -7
- package/es/number-input/src/util.js +2 -2
- package/es/split/style.css +1 -1
- package/es/split/style.min.css +1 -1
- package/es/splitter/style.css +1 -1
- package/es/splitter/style.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/tree/src/tree.js +23 -21
- package/es/tree-select/src/tree-select.js +20 -16
- package/es/tree-select/style.css +1 -8
- package/es/tree-select/style.min.css +1 -1
- package/es/ui/index.js +10 -4
- package/es/ui/src/dom.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/es/vxe-cascader/style.css +197 -21
- package/es/vxe-cascader/style.min.css +1 -1
- package/es/vxe-list/style.css +2 -1
- package/es/vxe-list/style.min.css +1 -1
- package/es/vxe-split/style.css +1 -1
- package/es/vxe-split/style.min.css +1 -1
- package/es/vxe-splitter/style.css +1 -1
- package/es/vxe-splitter/style.min.css +1 -1
- package/es/vxe-tree-select/style.css +1 -8
- package/es/vxe-tree-select/style.min.css +1 -1
- package/lib/cascader/src/cascader.js +1322 -173
- package/lib/cascader/src/cascader.min.js +1 -1
- package/lib/cascader/src/util.js +15 -0
- package/lib/cascader/src/util.min.js +1 -0
- package/lib/cascader/style/style.css +197 -21
- package/lib/cascader/style/style.min.css +1 -1
- package/lib/index.umd.js +2159 -972
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +2 -2
- package/lib/input/src/input.min.js +1 -1
- package/lib/language/ar-EG.js +7 -0
- package/lib/language/ar-EG.min.js +1 -1
- package/lib/language/ar-EG.umd.js +7 -0
- package/lib/language/de-DE.js +7 -0
- package/lib/language/de-DE.min.js +1 -1
- package/lib/language/de-DE.umd.js +7 -0
- package/lib/language/en-US.js +7 -0
- package/lib/language/en-US.min.js +1 -1
- package/lib/language/en-US.umd.js +7 -0
- package/lib/language/es-ES.js +7 -0
- package/lib/language/es-ES.min.js +1 -1
- package/lib/language/es-ES.umd.js +7 -0
- package/lib/language/fr-FR.js +7 -0
- package/lib/language/fr-FR.min.js +1 -1
- package/lib/language/fr-FR.umd.js +7 -0
- package/lib/language/hu-HU.js +7 -0
- package/lib/language/hu-HU.min.js +1 -1
- package/lib/language/hu-HU.umd.js +7 -0
- package/lib/language/hy-AM.js +7 -0
- package/lib/language/hy-AM.min.js +1 -1
- package/lib/language/hy-AM.umd.js +7 -0
- package/lib/language/id-ID.js +7 -0
- package/lib/language/id-ID.min.js +1 -1
- package/lib/language/id-ID.umd.js +7 -0
- package/lib/language/it-IT.js +7 -0
- package/lib/language/it-IT.min.js +1 -1
- package/lib/language/it-IT.umd.js +7 -0
- package/lib/language/ja-JP.js +7 -0
- package/lib/language/ja-JP.min.js +1 -1
- package/lib/language/ja-JP.umd.js +7 -0
- package/lib/language/ko-KR.js +7 -0
- package/lib/language/ko-KR.min.js +1 -1
- package/lib/language/ko-KR.umd.js +7 -0
- package/lib/language/ms-MY.js +7 -0
- package/lib/language/ms-MY.min.js +1 -1
- package/lib/language/ms-MY.umd.js +7 -0
- package/lib/language/nb-NO.js +7 -0
- package/lib/language/nb-NO.min.js +1 -1
- package/lib/language/nb-NO.umd.js +7 -0
- package/lib/language/pt-BR.js +7 -0
- package/lib/language/pt-BR.min.js +1 -1
- package/lib/language/pt-BR.umd.js +7 -0
- package/lib/language/ru-RU.js +7 -0
- package/lib/language/ru-RU.min.js +1 -1
- package/lib/language/ru-RU.umd.js +7 -0
- package/lib/language/th-TH.js +7 -0
- package/lib/language/th-TH.min.js +1 -1
- package/lib/language/th-TH.umd.js +7 -0
- package/lib/language/ug-CN.js +7 -0
- package/lib/language/ug-CN.min.js +1 -1
- package/lib/language/ug-CN.umd.js +7 -0
- package/lib/language/uk-UA.js +7 -0
- package/lib/language/uk-UA.min.js +1 -1
- package/lib/language/uk-UA.umd.js +7 -0
- package/lib/language/uz-UZ.js +7 -0
- package/lib/language/uz-UZ.min.js +1 -1
- package/lib/language/uz-UZ.umd.js +7 -0
- package/lib/language/vi-VN.js +7 -0
- package/lib/language/vi-VN.min.js +1 -1
- package/lib/language/vi-VN.umd.js +7 -0
- package/lib/language/zh-CHT.js +7 -0
- package/lib/language/zh-CHT.min.js +1 -1
- package/lib/language/zh-CHT.umd.js +7 -0
- package/lib/language/zh-CN.js +7 -0
- package/lib/language/zh-CN.min.js +1 -1
- package/lib/language/zh-CN.umd.js +7 -0
- package/lib/list/style/style.css +2 -1
- package/lib/list/style/style.min.css +1 -1
- package/lib/number-input/src/number-input.js +7 -4
- package/lib/number-input/src/number-input.min.js +1 -1
- package/lib/number-input/src/util.js +2 -2
- package/lib/number-input/src/util.min.js +1 -1
- package/lib/split/style/style.css +1 -1
- package/lib/split/style/style.min.css +1 -1
- package/lib/splitter/style/style.css +1 -1
- package/lib/splitter/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/tree/src/tree.js +23 -21
- package/lib/tree/src/tree.min.js +1 -1
- package/lib/tree-select/src/tree-select.js +22 -17
- package/lib/tree-select/src/tree-select.min.js +1 -1
- package/lib/tree-select/style/style.css +1 -8
- package/lib/tree-select/style/style.min.css +1 -1
- package/lib/ui/index.js +10 -4
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +5 -3
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-cascader/style/style.css +197 -21
- package/lib/vxe-cascader/style/style.min.css +1 -1
- package/lib/vxe-list/style/style.css +2 -1
- package/lib/vxe-list/style/style.min.css +1 -1
- package/lib/vxe-split/style/style.css +1 -1
- package/lib/vxe-split/style/style.min.css +1 -1
- package/lib/vxe-splitter/style/style.css +1 -1
- package/lib/vxe-splitter/style/style.min.css +1 -1
- package/lib/vxe-tree-select/style/style.css +1 -8
- package/lib/vxe-tree-select/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/cascader/src/cascader.ts +1193 -182
- package/packages/cascader/src/util.ts +9 -0
- package/packages/input/src/input.ts +2 -2
- package/packages/language/ar-EG.ts +7 -0
- package/packages/language/de-DE.ts +7 -0
- package/packages/language/en-US.ts +7 -0
- package/packages/language/es-ES.ts +7 -0
- package/packages/language/fr-FR.ts +7 -0
- package/packages/language/hu-HU.ts +7 -0
- package/packages/language/hy-AM.ts +7 -0
- package/packages/language/id-ID.ts +7 -0
- package/packages/language/it-IT.ts +7 -0
- package/packages/language/ja-JP.ts +7 -0
- package/packages/language/ko-KR.ts +7 -0
- package/packages/language/ms-MY.ts +7 -0
- package/packages/language/nb-NO.ts +7 -0
- package/packages/language/pt-BR.ts +7 -0
- package/packages/language/ru-RU.ts +7 -0
- package/packages/language/th-TH.ts +7 -0
- package/packages/language/ug-CN.ts +7 -0
- package/packages/language/uk-UA.ts +7 -0
- package/packages/language/uz-UZ.ts +7 -0
- package/packages/language/vi-VN.ts +7 -0
- package/packages/language/zh-CHT.ts +7 -0
- package/packages/language/zh-CN.ts +7 -0
- package/packages/number-input/src/number-input.ts +7 -7
- package/packages/number-input/src/util.ts +2 -2
- package/packages/tree/src/tree.ts +23 -22
- package/packages/tree-select/src/tree-select.ts +21 -16
- package/packages/ui/index.ts +10 -3
- package/packages/ui/src/dom.ts +3 -2
- package/styles/components/cascader.scss +116 -21
- package/styles/components/list.scss +2 -1
- package/styles/components/splitter.scss +3 -1
- package/styles/components/tree-select.scss +1 -8
- package/styles/helpers/placement.scss +2 -2
- package/styles/theme/base.scss +7 -0
- package/styles/theme/dark.scss +9 -0
- package/styles/theme/light.scss +9 -0
- package/styles/variable.scss +8 -0
- package/types/components/cascader.d.ts +167 -57
- package/types/ui/global-icon.d.ts +5 -0
- /package/es/icon/{iconfont.1781503194392.ttf → iconfont.1781658330183.ttf} +0 -0
- /package/es/icon/{iconfont.1781503194392.woff → iconfont.1781658330183.woff} +0 -0
- /package/es/icon/{iconfont.1781503194392.woff2 → iconfont.1781658330183.woff2} +0 -0
- /package/es/{iconfont.1781503194392.ttf → iconfont.1781658330183.ttf} +0 -0
- /package/es/{iconfont.1781503194392.woff → iconfont.1781658330183.woff} +0 -0
- /package/es/{iconfont.1781503194392.woff2 → iconfont.1781658330183.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1781503194392.ttf → iconfont.1781658330183.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1781503194392.woff → iconfont.1781658330183.woff} +0 -0
- /package/lib/icon/style/{iconfont.1781503194392.woff2 → iconfont.1781658330183.woff2} +0 -0
- /package/lib/{iconfont.1781503194392.ttf → iconfont.1781658330183.ttf} +0 -0
- /package/lib/{iconfont.1781503194392.woff → iconfont.1781658330183.woff} +0 -0
- /package/lib/{iconfont.1781503194392.woff2 → iconfont.1781658330183.woff2} +0 -0
package/dist/all.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as core from '@vxe-ui/core';
|
|
2
|
-
import { VxeUI, log, setConfig as setConfig$1, setIcon, getConfig as getConfig$3, createEvent, getIcon as getIcon$2, renderEmptyElement, useSize, usePermission, permission, globalEvents, renderer, getI18n as getI18n$2, GLOBAL_EVENT_KEYS, commands, formats, getComponent, validators
|
|
2
|
+
import { VxeUI, log, setConfig as setConfig$1, setIcon, getConfig as getConfig$3, createEvent, getIcon as getIcon$2, renderEmptyElement, useSize, usePermission, permission, globalEvents, renderer, getI18n as getI18n$2, globalResize, GLOBAL_EVENT_KEYS, getSlotVNs as getSlotVNs$1, commands, formats, getComponent, validators } from '@vxe-ui/core';
|
|
3
3
|
export * from '@vxe-ui/core';
|
|
4
|
-
import { defineComponent, reactive, h, createCommentVNode, createApp, ref, inject, computed, watch, onMounted, onUnmounted, provide, nextTick, onBeforeUnmount, resolveComponent, Teleport,
|
|
4
|
+
import { defineComponent, reactive, h, createCommentVNode, createApp, ref, inject, computed, watch, onMounted, onUnmounted, provide, nextTick, onBeforeUnmount, resolveComponent, Teleport, onActivated, onDeactivated, TransitionGroup } from 'vue';
|
|
5
5
|
import XEUtils from 'xe-utils';
|
|
6
6
|
import DomZIndex from 'dom-zindex';
|
|
7
7
|
|
|
@@ -80,11 +80,11 @@ function checkDynamic() {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const version$1 = `ui v${"4.14.
|
|
83
|
+
const version$1 = `ui v${"4.14.40"}`;
|
|
84
84
|
const warnLog = log.create('warn', version$1);
|
|
85
85
|
const errLog = log.create('error', version$1);
|
|
86
86
|
|
|
87
|
-
const version = "4.14.
|
|
87
|
+
const version = "4.14.40";
|
|
88
88
|
VxeUI.uiVersion = version;
|
|
89
89
|
VxeUI.dynamicApp = dynamicApp;
|
|
90
90
|
function config(options) {
|
|
@@ -144,7 +144,10 @@ setConfig$1({
|
|
|
144
144
|
},
|
|
145
145
|
carouselItem: {},
|
|
146
146
|
cascader: {
|
|
147
|
-
|
|
147
|
+
showFullLabel: true,
|
|
148
|
+
treeConfig: {
|
|
149
|
+
showIcon: true
|
|
150
|
+
}
|
|
148
151
|
},
|
|
149
152
|
checkbox: {},
|
|
150
153
|
checkboxButton: {},
|
|
@@ -498,7 +501,6 @@ setConfig$1({
|
|
|
498
501
|
}
|
|
499
502
|
},
|
|
500
503
|
treeSelect: {
|
|
501
|
-
autoClose: null,
|
|
502
504
|
// separator: '/',
|
|
503
505
|
virtualYConfig: {
|
|
504
506
|
enabled: true,
|
|
@@ -736,7 +738,11 @@ setIcon({
|
|
|
736
738
|
BACKTOP_TOP: iconPrefix + 'top',
|
|
737
739
|
// context-menu
|
|
738
740
|
CONTEXT_MENU_OPTION_LOADING: iconPrefix + 'spinner roll',
|
|
739
|
-
CONTEXT_MENU_CHILDREN: iconPrefix + 'arrow-right'
|
|
741
|
+
CONTEXT_MENU_CHILDREN: iconPrefix + 'arrow-right',
|
|
742
|
+
// cascader
|
|
743
|
+
CASCADER_NODE_OPEN: iconPrefix + 'arrow-right',
|
|
744
|
+
CASCADER_NODE_CLOSE: iconPrefix + 'arrow-right',
|
|
745
|
+
CASCADER_NODE_LOADED: iconPrefix + 'spinner roll'
|
|
740
746
|
});
|
|
741
747
|
|
|
742
748
|
var zhCN = {
|
|
@@ -1092,6 +1098,13 @@ var zhCN = {
|
|
|
1092
1098
|
yearLabel: '{0} 年',
|
|
1093
1099
|
monthLabel: '{0} 月'
|
|
1094
1100
|
},
|
|
1101
|
+
cascader: {
|
|
1102
|
+
clearChecked: '清除',
|
|
1103
|
+
allChecked: '全选',
|
|
1104
|
+
total: '已选 {0} 项',
|
|
1105
|
+
close: '关闭',
|
|
1106
|
+
search: '搜索'
|
|
1107
|
+
},
|
|
1095
1108
|
numberInput: {
|
|
1096
1109
|
currencySymbol: '¥'
|
|
1097
1110
|
},
|
|
@@ -1855,7 +1868,7 @@ function scrollToView(elem) {
|
|
|
1855
1868
|
}
|
|
1856
1869
|
}
|
|
1857
1870
|
function updatePanelPlacement(targetElem, panelElem, options) {
|
|
1858
|
-
const { placement, defaultPlacement, teleportTo, marginSize } = Object.assign({ teleportTo: false, marginSize: 18 }, options);
|
|
1871
|
+
const { placement, defaultPlacement, teleportTo, marginSize, isMinWidth } = Object.assign({ teleportTo: false, marginSize: 18, isMinWidth: true }, options);
|
|
1859
1872
|
let panelPlacement = 'bottom';
|
|
1860
1873
|
let top = '';
|
|
1861
1874
|
let bottom = '';
|
|
@@ -1952,7 +1965,7 @@ function updatePanelPlacement(targetElem, panelElem, options) {
|
|
|
1952
1965
|
if (XEUtils.isNumber(right)) {
|
|
1953
1966
|
stys.right = toCssUnit(right);
|
|
1954
1967
|
}
|
|
1955
|
-
if (XEUtils.isNumber(minWidth)) {
|
|
1968
|
+
if (isMinWidth && XEUtils.isNumber(minWidth)) {
|
|
1956
1969
|
stys.minWidth = toCssUnit(minWidth);
|
|
1957
1970
|
}
|
|
1958
1971
|
}
|
|
@@ -3778,7 +3791,7 @@ function createInternalData$d() {
|
|
|
3778
3791
|
targetEl: null
|
|
3779
3792
|
};
|
|
3780
3793
|
}
|
|
3781
|
-
function createReactData$
|
|
3794
|
+
function createReactData$a() {
|
|
3782
3795
|
return {
|
|
3783
3796
|
showBtn: false,
|
|
3784
3797
|
backtopZindex: 0
|
|
@@ -3858,7 +3871,7 @@ var VxeBacktopComponent = defineVxeComponent({
|
|
|
3858
3871
|
const refElem = ref();
|
|
3859
3872
|
const { computeSize } = useSize(props);
|
|
3860
3873
|
const internalData = createInternalData$d();
|
|
3861
|
-
const reactData = reactive(createReactData$
|
|
3874
|
+
const reactData = reactive(createReactData$a());
|
|
3862
3875
|
const refMaps = {
|
|
3863
3876
|
refElem
|
|
3864
3877
|
};
|
|
@@ -4035,7 +4048,7 @@ var VxeBacktopComponent = defineVxeComponent({
|
|
|
4035
4048
|
});
|
|
4036
4049
|
onBeforeUnmount(() => {
|
|
4037
4050
|
removeScrollEvent();
|
|
4038
|
-
XEUtils.assign(reactData, createReactData$
|
|
4051
|
+
XEUtils.assign(reactData, createReactData$a());
|
|
4039
4052
|
XEUtils.assign(internalData, createInternalData$d());
|
|
4040
4053
|
});
|
|
4041
4054
|
$xeBacktop.renderVN = renderVN;
|
|
@@ -6660,50 +6673,416 @@ dynamicApp.use(VxeCarouselItem);
|
|
|
6660
6673
|
VxeUI.component(VxeCarouselItemComponent);
|
|
6661
6674
|
const CarouselItem = VxeCarouselItem;
|
|
6662
6675
|
|
|
6663
|
-
function enNodeValue(nodeid) {
|
|
6676
|
+
function enNodeValue$1(nodeid) {
|
|
6664
6677
|
return XEUtils.eqNull(nodeid) ? '' : encodeURIComponent(`${nodeid}`);
|
|
6665
6678
|
}
|
|
6666
|
-
function deNodeValue(nodeid) {
|
|
6679
|
+
function deNodeValue$1(nodeid) {
|
|
6667
6680
|
return nodeid ? decodeURIComponent(`${nodeid}`) : nodeid;
|
|
6668
6681
|
}
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6682
|
+
|
|
6683
|
+
function createReactData$9() {
|
|
6684
|
+
return {
|
|
6685
|
+
scrollYLoad: false,
|
|
6686
|
+
bodyHeight: 0,
|
|
6687
|
+
customHeight: 0,
|
|
6688
|
+
customMaxHeight: 0,
|
|
6689
|
+
parentHeight: 0,
|
|
6690
|
+
topSpaceHeight: 0,
|
|
6691
|
+
items: []
|
|
6692
|
+
};
|
|
6693
|
+
}
|
|
6694
|
+
function createInternalData$c() {
|
|
6695
|
+
return {
|
|
6696
|
+
resizeObserver: undefined,
|
|
6697
|
+
fullData: [],
|
|
6698
|
+
lastScrollLeft: 0,
|
|
6699
|
+
lastScrollTop: 0,
|
|
6700
|
+
scrollYStore: {
|
|
6701
|
+
startIndex: 0,
|
|
6702
|
+
endIndex: 0,
|
|
6703
|
+
visibleSize: 0,
|
|
6704
|
+
offsetSize: 0,
|
|
6705
|
+
rowHeight: 0
|
|
6687
6706
|
}
|
|
6688
|
-
}
|
|
6689
|
-
return count;
|
|
6707
|
+
};
|
|
6690
6708
|
}
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6709
|
+
var VxeListComponent = defineVxeComponent({
|
|
6710
|
+
name: 'VxeList',
|
|
6711
|
+
props: {
|
|
6712
|
+
data: Array,
|
|
6713
|
+
height: [Number, String],
|
|
6714
|
+
maxHeight: [Number, String],
|
|
6715
|
+
loading: Boolean,
|
|
6716
|
+
className: [String, Function],
|
|
6717
|
+
size: {
|
|
6718
|
+
type: String,
|
|
6719
|
+
default: () => getConfig$3().list.size || getConfig$3().size
|
|
6720
|
+
},
|
|
6721
|
+
autoResize: {
|
|
6722
|
+
type: Boolean,
|
|
6723
|
+
default: () => getConfig$3().list.autoResize
|
|
6724
|
+
},
|
|
6725
|
+
syncResize: [Boolean, String, Number],
|
|
6726
|
+
virtualYConfig: Object,
|
|
6727
|
+
scrollY: Object
|
|
6728
|
+
},
|
|
6729
|
+
emits: [
|
|
6730
|
+
'scroll'
|
|
6731
|
+
],
|
|
6732
|
+
setup(props, context) {
|
|
6733
|
+
const { slots, emit } = context;
|
|
6734
|
+
const xID = XEUtils.uniqueId();
|
|
6735
|
+
const browseObj = XEUtils.browse();
|
|
6736
|
+
const { computeSize } = useSize(props);
|
|
6737
|
+
const reactData = reactive(createReactData$9());
|
|
6738
|
+
const internalData = createInternalData$c();
|
|
6739
|
+
const refElem = ref();
|
|
6740
|
+
const refVirtualWrapper = ref();
|
|
6741
|
+
const refVirtualBody = ref();
|
|
6742
|
+
const refMaps = {
|
|
6743
|
+
refElem
|
|
6744
|
+
};
|
|
6745
|
+
const $xeList = {
|
|
6746
|
+
xID,
|
|
6747
|
+
props,
|
|
6748
|
+
context,
|
|
6749
|
+
reactData,
|
|
6750
|
+
internalData,
|
|
6751
|
+
getRefMaps: () => refMaps
|
|
6752
|
+
};
|
|
6753
|
+
const computeSYOpts = computed(() => {
|
|
6754
|
+
return Object.assign({}, getConfig$3().list.virtualYConfig || getConfig$3().list.scrollY, props.virtualYConfig || props.scrollY);
|
|
6755
|
+
});
|
|
6756
|
+
const computeStyles = computed(() => {
|
|
6757
|
+
const { height, maxHeight } = props;
|
|
6758
|
+
const { customHeight, customMaxHeight } = reactData;
|
|
6759
|
+
const style = {};
|
|
6760
|
+
if (height) {
|
|
6761
|
+
style.height = `${customHeight}px`;
|
|
6762
|
+
}
|
|
6763
|
+
else if (maxHeight) {
|
|
6764
|
+
style.height = 'auto';
|
|
6765
|
+
style.maxHeight = `${customMaxHeight}px`;
|
|
6766
|
+
}
|
|
6767
|
+
return style;
|
|
6768
|
+
});
|
|
6769
|
+
const dispatchEvent = (type, params, evnt) => {
|
|
6770
|
+
emit(type, createEvent(evnt, { $list: $xeList }, params));
|
|
6771
|
+
};
|
|
6772
|
+
const calcTableHeight = (key) => {
|
|
6773
|
+
const { parentHeight } = reactData;
|
|
6774
|
+
const val = props[key];
|
|
6775
|
+
let num = 0;
|
|
6776
|
+
if (val) {
|
|
6777
|
+
if (val === '100%' || val === 'auto') {
|
|
6778
|
+
num = parentHeight;
|
|
6779
|
+
}
|
|
6780
|
+
else {
|
|
6781
|
+
if (isScale(val)) {
|
|
6782
|
+
num = Math.floor((XEUtils.toInteger(val) || 1) / 100 * parentHeight);
|
|
6783
|
+
}
|
|
6784
|
+
else {
|
|
6785
|
+
num = XEUtils.toNumber(val);
|
|
6786
|
+
}
|
|
6787
|
+
num = Math.max(40, num);
|
|
6788
|
+
}
|
|
6789
|
+
}
|
|
6790
|
+
return num;
|
|
6791
|
+
};
|
|
6792
|
+
const updateHeight = () => {
|
|
6793
|
+
reactData.customHeight = calcTableHeight('height');
|
|
6794
|
+
reactData.customMaxHeight = calcTableHeight('maxHeight');
|
|
6795
|
+
};
|
|
6796
|
+
const updateYSpace = () => {
|
|
6797
|
+
const { scrollYLoad } = reactData;
|
|
6798
|
+
const { scrollYStore, fullData } = internalData;
|
|
6799
|
+
reactData.bodyHeight = scrollYLoad ? fullData.length * scrollYStore.rowHeight : 0;
|
|
6800
|
+
reactData.topSpaceHeight = scrollYLoad ? Math.max(scrollYStore.startIndex * scrollYStore.rowHeight, 0) : 0;
|
|
6801
|
+
};
|
|
6802
|
+
const handleData = () => {
|
|
6803
|
+
const { scrollYLoad } = reactData;
|
|
6804
|
+
const { fullData, scrollYStore } = internalData;
|
|
6805
|
+
reactData.items = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullData.slice(0);
|
|
6806
|
+
return nextTick();
|
|
6807
|
+
};
|
|
6808
|
+
const updateYData = () => {
|
|
6809
|
+
handleData();
|
|
6810
|
+
updateYSpace();
|
|
6811
|
+
};
|
|
6812
|
+
const computeScrollLoad = () => {
|
|
6813
|
+
return nextTick().then(() => {
|
|
6814
|
+
const { scrollYLoad } = reactData;
|
|
6815
|
+
const { scrollYStore } = internalData;
|
|
6816
|
+
const virtualBodyElem = refVirtualBody.value;
|
|
6817
|
+
const sYOpts = computeSYOpts.value;
|
|
6818
|
+
let rowHeight = 0;
|
|
6819
|
+
let firstItemElem;
|
|
6820
|
+
if (virtualBodyElem) {
|
|
6821
|
+
if (sYOpts.sItem) {
|
|
6822
|
+
firstItemElem = virtualBodyElem.querySelector(sYOpts.sItem);
|
|
6823
|
+
}
|
|
6824
|
+
if (!firstItemElem) {
|
|
6825
|
+
firstItemElem = virtualBodyElem.children[0];
|
|
6826
|
+
}
|
|
6827
|
+
}
|
|
6828
|
+
if (firstItemElem) {
|
|
6829
|
+
rowHeight = firstItemElem.offsetHeight;
|
|
6830
|
+
}
|
|
6831
|
+
rowHeight = Math.max(12, rowHeight);
|
|
6832
|
+
scrollYStore.rowHeight = rowHeight;
|
|
6833
|
+
// 计算 Y 逻辑
|
|
6834
|
+
if (scrollYLoad) {
|
|
6835
|
+
const scrollBodyElem = refVirtualWrapper.value;
|
|
6836
|
+
const visibleYSize = Math.max(8, Math.ceil(scrollBodyElem.clientHeight / rowHeight));
|
|
6837
|
+
const offsetYSize = sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browseObj.edge ? 10 : 0);
|
|
6838
|
+
scrollYStore.offsetSize = offsetYSize;
|
|
6839
|
+
scrollYStore.visibleSize = visibleYSize;
|
|
6840
|
+
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
6841
|
+
updateYData();
|
|
6842
|
+
}
|
|
6843
|
+
else {
|
|
6844
|
+
updateYSpace();
|
|
6845
|
+
}
|
|
6846
|
+
});
|
|
6847
|
+
};
|
|
6848
|
+
/**
|
|
6849
|
+
* 清除滚动条
|
|
6850
|
+
*/
|
|
6851
|
+
const clearScroll = () => {
|
|
6852
|
+
const scrollBodyElem = refVirtualWrapper.value;
|
|
6853
|
+
if (scrollBodyElem) {
|
|
6854
|
+
scrollBodyElem.scrollTop = 0;
|
|
6855
|
+
}
|
|
6856
|
+
return nextTick();
|
|
6857
|
+
};
|
|
6858
|
+
/**
|
|
6859
|
+
* 如果有滚动条,则滚动到对应的位置
|
|
6860
|
+
*/
|
|
6861
|
+
const scrollTo = (scrollLeft, scrollTop) => {
|
|
6862
|
+
const scrollBodyElem = refVirtualWrapper.value;
|
|
6863
|
+
if (scrollLeft) {
|
|
6864
|
+
if (!XEUtils.isNumber(scrollLeft)) {
|
|
6865
|
+
scrollTop = scrollLeft.top;
|
|
6866
|
+
scrollLeft = scrollLeft.left;
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
if (XEUtils.isNumber(scrollLeft)) {
|
|
6870
|
+
scrollBodyElem.scrollLeft = scrollLeft;
|
|
6871
|
+
}
|
|
6872
|
+
if (XEUtils.isNumber(scrollTop)) {
|
|
6873
|
+
scrollBodyElem.scrollTop = scrollTop;
|
|
6874
|
+
}
|
|
6875
|
+
if (reactData.scrollYLoad) {
|
|
6876
|
+
return new Promise(resolve => {
|
|
6877
|
+
setTimeout(() => {
|
|
6878
|
+
nextTick(() => {
|
|
6879
|
+
resolve();
|
|
6880
|
+
});
|
|
6881
|
+
}, 50);
|
|
6882
|
+
});
|
|
6883
|
+
}
|
|
6884
|
+
return nextTick();
|
|
6885
|
+
};
|
|
6886
|
+
/**
|
|
6887
|
+
* 刷新滚动条
|
|
6888
|
+
*/
|
|
6889
|
+
const refreshScroll = () => {
|
|
6890
|
+
const { lastScrollLeft, lastScrollTop } = internalData;
|
|
6891
|
+
return clearScroll().then(() => {
|
|
6892
|
+
if (lastScrollLeft || lastScrollTop) {
|
|
6893
|
+
internalData.lastScrollLeft = 0;
|
|
6894
|
+
internalData.lastScrollTop = 0;
|
|
6895
|
+
return scrollTo(lastScrollLeft, lastScrollTop);
|
|
6896
|
+
}
|
|
6897
|
+
});
|
|
6898
|
+
};
|
|
6899
|
+
/**
|
|
6900
|
+
* 重新计算列表
|
|
6901
|
+
*/
|
|
6902
|
+
const recalculate = () => {
|
|
6903
|
+
const el = refElem.value;
|
|
6904
|
+
if (el) {
|
|
6905
|
+
const parentEl = el.parentElement;
|
|
6906
|
+
reactData.parentHeight = parentEl ? parentEl.clientHeight : 0;
|
|
6907
|
+
updateHeight();
|
|
6908
|
+
if (el.clientWidth && el.clientHeight) {
|
|
6909
|
+
return computeScrollLoad();
|
|
6910
|
+
}
|
|
6911
|
+
}
|
|
6912
|
+
return nextTick();
|
|
6913
|
+
};
|
|
6914
|
+
const loadYData = (evnt) => {
|
|
6915
|
+
const { scrollYStore } = internalData;
|
|
6916
|
+
const { startIndex, endIndex, visibleSize, offsetSize, rowHeight } = scrollYStore;
|
|
6917
|
+
const scrollBodyElem = evnt.target;
|
|
6918
|
+
const scrollTop = scrollBodyElem.scrollTop;
|
|
6919
|
+
const toVisibleIndex = Math.floor(scrollTop / rowHeight);
|
|
6920
|
+
const offsetStartIndex = Math.max(0, toVisibleIndex - 1 - offsetSize);
|
|
6921
|
+
const offsetEndIndex = toVisibleIndex + visibleSize + offsetSize;
|
|
6922
|
+
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
6923
|
+
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
6924
|
+
scrollYStore.startIndex = offsetStartIndex;
|
|
6925
|
+
scrollYStore.endIndex = offsetEndIndex;
|
|
6926
|
+
updateYData();
|
|
6927
|
+
}
|
|
6928
|
+
}
|
|
6929
|
+
};
|
|
6930
|
+
const scrollEvent = (evnt) => {
|
|
6931
|
+
const scrollBodyElem = evnt.target;
|
|
6932
|
+
const scrollTop = scrollBodyElem.scrollTop;
|
|
6933
|
+
const scrollLeft = scrollBodyElem.scrollLeft;
|
|
6934
|
+
const isX = scrollLeft !== internalData.lastScrollLeft;
|
|
6935
|
+
const isY = scrollTop !== internalData.lastScrollTop;
|
|
6936
|
+
internalData.lastScrollTop = scrollTop;
|
|
6937
|
+
internalData.lastScrollLeft = scrollLeft;
|
|
6938
|
+
if (reactData.scrollYLoad) {
|
|
6939
|
+
loadYData(evnt);
|
|
6940
|
+
}
|
|
6941
|
+
dispatchEvent('scroll', { scrollLeft, scrollTop, isX, isY }, evnt);
|
|
6942
|
+
};
|
|
6943
|
+
/**
|
|
6944
|
+
* 加载数据
|
|
6945
|
+
* @param {Array} datas 数据
|
|
6946
|
+
*/
|
|
6947
|
+
const loadData = (datas) => {
|
|
6948
|
+
const { scrollYStore } = internalData;
|
|
6949
|
+
const sYOpts = computeSYOpts.value;
|
|
6950
|
+
const fullData = datas || [];
|
|
6951
|
+
Object.assign(scrollYStore, {
|
|
6952
|
+
startIndex: 0,
|
|
6953
|
+
endIndex: 1,
|
|
6954
|
+
visibleSize: 0
|
|
6955
|
+
});
|
|
6956
|
+
internalData.fullData = fullData;
|
|
6957
|
+
// 如果gt为0,则总是启用
|
|
6958
|
+
reactData.scrollYLoad = !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt <= fullData.length);
|
|
6959
|
+
handleData();
|
|
6960
|
+
return computeScrollLoad().then(() => {
|
|
6961
|
+
refreshScroll();
|
|
6962
|
+
});
|
|
6963
|
+
};
|
|
6964
|
+
const listMethods = {
|
|
6965
|
+
dispatchEvent,
|
|
6966
|
+
loadData,
|
|
6967
|
+
/**
|
|
6968
|
+
* 重新加载数据
|
|
6969
|
+
* @param {Array} datas 数据
|
|
6970
|
+
*/
|
|
6971
|
+
reloadData(datas) {
|
|
6972
|
+
clearScroll();
|
|
6973
|
+
return loadData(datas);
|
|
6974
|
+
},
|
|
6975
|
+
recalculate,
|
|
6976
|
+
scrollTo,
|
|
6977
|
+
refreshScroll,
|
|
6978
|
+
clearScroll
|
|
6979
|
+
};
|
|
6980
|
+
Object.assign($xeList, listMethods);
|
|
6981
|
+
const renderVN = () => {
|
|
6982
|
+
const { className, loading } = props;
|
|
6983
|
+
const { bodyHeight, topSpaceHeight, items } = reactData;
|
|
6984
|
+
const defaultSlot = slots.default;
|
|
6985
|
+
const vSize = computeSize.value;
|
|
6986
|
+
const styles = computeStyles.value;
|
|
6987
|
+
return h('div', {
|
|
6988
|
+
ref: refElem,
|
|
6989
|
+
class: ['vxe-list', className ? (XEUtils.isFunction(className) ? className({ $list: $xeList }) : className) : '', {
|
|
6990
|
+
[`size--${vSize}`]: vSize,
|
|
6991
|
+
'is--loading': loading
|
|
6992
|
+
}]
|
|
6993
|
+
}, [
|
|
6994
|
+
h('div', {
|
|
6995
|
+
ref: refVirtualWrapper,
|
|
6996
|
+
class: 'vxe-list--virtual-wrapper',
|
|
6997
|
+
style: styles,
|
|
6998
|
+
onScroll: scrollEvent
|
|
6999
|
+
}, [
|
|
7000
|
+
h('div', {
|
|
7001
|
+
class: 'vxe-list--y-space',
|
|
7002
|
+
style: {
|
|
7003
|
+
height: bodyHeight ? `${bodyHeight}px` : ''
|
|
7004
|
+
}
|
|
7005
|
+
}),
|
|
7006
|
+
h('div', {
|
|
7007
|
+
ref: refVirtualBody,
|
|
7008
|
+
class: 'vxe-list--body',
|
|
7009
|
+
style: {
|
|
7010
|
+
marginTop: topSpaceHeight ? `${topSpaceHeight}px` : ''
|
|
7011
|
+
}
|
|
7012
|
+
}, defaultSlot ? defaultSlot({ items, $list: $xeList }) : [])
|
|
7013
|
+
]),
|
|
7014
|
+
/**
|
|
7015
|
+
* 加载中
|
|
7016
|
+
*/
|
|
7017
|
+
h(VxeLoadingComponent, {
|
|
7018
|
+
class: 'vxe-list--loading',
|
|
7019
|
+
modelValue: loading
|
|
7020
|
+
})
|
|
7021
|
+
]);
|
|
7022
|
+
};
|
|
7023
|
+
const dataFlag = ref(0);
|
|
7024
|
+
watch(() => props.data ? props.data.length : -1, () => {
|
|
7025
|
+
dataFlag.value++;
|
|
7026
|
+
});
|
|
7027
|
+
watch(() => props.data, () => {
|
|
7028
|
+
dataFlag.value++;
|
|
7029
|
+
});
|
|
7030
|
+
watch(dataFlag, () => {
|
|
7031
|
+
loadData(props.data || []);
|
|
7032
|
+
});
|
|
7033
|
+
watch(() => props.height, () => {
|
|
7034
|
+
recalculate();
|
|
7035
|
+
});
|
|
7036
|
+
watch(() => props.maxHeight, () => {
|
|
7037
|
+
recalculate();
|
|
7038
|
+
});
|
|
7039
|
+
watch(() => props.syncResize, (value) => {
|
|
7040
|
+
if (value) {
|
|
7041
|
+
recalculate();
|
|
7042
|
+
nextTick(() => setTimeout(() => recalculate()));
|
|
7043
|
+
}
|
|
7044
|
+
});
|
|
7045
|
+
onActivated(() => {
|
|
7046
|
+
recalculate().then(() => refreshScroll());
|
|
7047
|
+
});
|
|
7048
|
+
nextTick(() => {
|
|
7049
|
+
loadData(props.data || []);
|
|
7050
|
+
});
|
|
7051
|
+
onMounted(() => {
|
|
7052
|
+
recalculate();
|
|
7053
|
+
if (props.autoResize) {
|
|
7054
|
+
const el = refElem.value;
|
|
7055
|
+
const resizeObserver = globalResize.create(() => recalculate());
|
|
7056
|
+
resizeObserver.observe(el);
|
|
7057
|
+
if (el) {
|
|
7058
|
+
resizeObserver.observe(el.parentElement);
|
|
7059
|
+
}
|
|
7060
|
+
internalData.resizeObserver = resizeObserver;
|
|
7061
|
+
}
|
|
7062
|
+
globalEvents.on($xeList, 'resize', recalculate);
|
|
7063
|
+
});
|
|
7064
|
+
onBeforeUnmount(() => {
|
|
7065
|
+
const { resizeObserver } = internalData;
|
|
7066
|
+
if (resizeObserver) {
|
|
7067
|
+
resizeObserver.disconnect();
|
|
7068
|
+
}
|
|
7069
|
+
globalEvents.off($xeList, 'resize');
|
|
7070
|
+
XEUtils.assign(reactData, createReactData$9());
|
|
7071
|
+
XEUtils.assign(internalData, createInternalData$c());
|
|
7072
|
+
});
|
|
7073
|
+
$xeList.renderVN = renderVN;
|
|
7074
|
+
return $xeList;
|
|
7075
|
+
},
|
|
7076
|
+
render() {
|
|
7077
|
+
return this.renderVN();
|
|
6698
7078
|
}
|
|
6699
|
-
|
|
6700
|
-
}
|
|
7079
|
+
});
|
|
6701
7080
|
|
|
6702
7081
|
function handleNumber(val) {
|
|
6703
7082
|
return XEUtils.isString(val) ? val.replace(/[^0-9e.-]/g, '') : val;
|
|
6704
7083
|
}
|
|
6705
|
-
function toFloatValueFixed(inputValue, digitsValue, roundingMode) {
|
|
6706
|
-
if (!roundingMode || roundingMode === 'default') {
|
|
7084
|
+
function toFloatValueFixed(inputValue, type, digitsValue, roundingMode) {
|
|
7085
|
+
if (type !== 'integer' && (!roundingMode || roundingMode === 'default')) {
|
|
6707
7086
|
// 默认截取忽略
|
|
6708
7087
|
if (/^-/.test('' + inputValue)) {
|
|
6709
7088
|
return XEUtils.toFixed(XEUtils.ceil(inputValue, digitsValue), digitsValue);
|
|
@@ -7454,7 +7833,7 @@ var VxeInputComponent = defineVxeComponent({
|
|
|
7454
7833
|
const { type, exponential } = props;
|
|
7455
7834
|
const inpMaxLength = computeInpMaxLength.value;
|
|
7456
7835
|
const digitsValue = computeDigitsValue.value;
|
|
7457
|
-
const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue, '') : XEUtils.toValueString(val));
|
|
7836
|
+
const restVal = (type === 'float' ? toFloatValueFixed(val, type, digitsValue, '') : XEUtils.toValueString(val));
|
|
7458
7837
|
if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
|
|
7459
7838
|
return val;
|
|
7460
7839
|
}
|
|
@@ -7640,7 +8019,7 @@ var VxeInputComponent = defineVxeComponent({
|
|
|
7640
8019
|
}
|
|
7641
8020
|
else if (type === 'float') {
|
|
7642
8021
|
if (inputValue) {
|
|
7643
|
-
const validValue = toFloatValueFixed(inputValue, digitsValue, '');
|
|
8022
|
+
const validValue = toFloatValueFixed(inputValue, type, digitsValue, '');
|
|
7644
8023
|
if (inputValue !== validValue) {
|
|
7645
8024
|
handleChange(validValue, { type: 'init' });
|
|
7646
8025
|
}
|
|
@@ -9395,14 +9774,48 @@ var VxeInputComponent = defineVxeComponent({
|
|
|
9395
9774
|
}
|
|
9396
9775
|
});
|
|
9397
9776
|
|
|
9398
|
-
|
|
9777
|
+
/**
|
|
9778
|
+
* 生成节点的唯一主键
|
|
9779
|
+
*/
|
|
9780
|
+
function getNodeUniqueId$1() {
|
|
9399
9781
|
return XEUtils.uniqueId('node_');
|
|
9400
9782
|
}
|
|
9401
|
-
function
|
|
9783
|
+
function createReactData$8() {
|
|
9784
|
+
return {
|
|
9785
|
+
initialized: false,
|
|
9786
|
+
searchValue: '',
|
|
9787
|
+
searchLoading: false,
|
|
9788
|
+
currentCunkList: [],
|
|
9789
|
+
currentItems: [],
|
|
9790
|
+
currentNode: null,
|
|
9791
|
+
panelIndex: 0,
|
|
9792
|
+
panelStyle: {},
|
|
9793
|
+
panelPlacement: null,
|
|
9794
|
+
triggerFocusPanel: false,
|
|
9795
|
+
visiblePanel: false,
|
|
9796
|
+
isAniVisible: false,
|
|
9797
|
+
isActivated: false,
|
|
9798
|
+
selectRadioKey: null,
|
|
9799
|
+
treeList: [],
|
|
9800
|
+
updateExpandedFlag: 1,
|
|
9801
|
+
updateCheckboxFlag: 1,
|
|
9802
|
+
fullOptFlag: 1,
|
|
9803
|
+
lazyOptFlag: 1
|
|
9804
|
+
};
|
|
9805
|
+
}
|
|
9806
|
+
function createInternalData$b() {
|
|
9402
9807
|
return {
|
|
9403
9808
|
// hpTimeout: undefined,
|
|
9404
|
-
|
|
9405
|
-
|
|
9809
|
+
afterTreeList: [],
|
|
9810
|
+
treeFullData: [],
|
|
9811
|
+
afterVisibleList: [],
|
|
9812
|
+
nodeMaps: {},
|
|
9813
|
+
fullNodeMaps: {},
|
|
9814
|
+
lazyNodeMaps: {},
|
|
9815
|
+
indeterminateRowMaps: {},
|
|
9816
|
+
selectCheckboxMaps: {},
|
|
9817
|
+
treeExpandedMaps: {},
|
|
9818
|
+
treeExpandLazyLoadedMaps: {}
|
|
9406
9819
|
};
|
|
9407
9820
|
}
|
|
9408
9821
|
var VxeCascaderComponent = defineVxeComponent({
|
|
@@ -9425,25 +9838,41 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9425
9838
|
},
|
|
9426
9839
|
filterable: Boolean,
|
|
9427
9840
|
filterConfig: Object,
|
|
9841
|
+
showFullLabel: {
|
|
9842
|
+
type: Boolean,
|
|
9843
|
+
default: getConfig$3().cascader.showFullLabel
|
|
9844
|
+
},
|
|
9845
|
+
separator: {
|
|
9846
|
+
type: String,
|
|
9847
|
+
default: getConfig$3().cascader.separator
|
|
9848
|
+
},
|
|
9428
9849
|
multiple: Boolean,
|
|
9429
9850
|
className: [String, Function],
|
|
9430
9851
|
prefixIcon: String,
|
|
9431
|
-
placement: String,
|
|
9432
|
-
transform: Boolean,
|
|
9433
9852
|
lazyOptions: Array,
|
|
9434
9853
|
options: Array,
|
|
9435
9854
|
optionProps: Object,
|
|
9436
|
-
zIndex: Number,
|
|
9437
9855
|
size: {
|
|
9438
9856
|
type: String,
|
|
9439
9857
|
default: () => getConfig$3().cascader.size || getConfig$3().size
|
|
9440
9858
|
},
|
|
9859
|
+
treeConfig: Object,
|
|
9860
|
+
radioConfig: Object,
|
|
9861
|
+
checkboxConfig: Object,
|
|
9441
9862
|
remote: Boolean,
|
|
9442
9863
|
remoteConfig: Function,
|
|
9443
9864
|
popupConfig: Object,
|
|
9444
|
-
|
|
9865
|
+
checkedClosable: {
|
|
9866
|
+
type: Boolean,
|
|
9867
|
+
default: () => getConfig$3().cascader.checkedClosable
|
|
9868
|
+
},
|
|
9869
|
+
clearClosable: {
|
|
9870
|
+
type: Boolean,
|
|
9871
|
+
default: () => getConfig$3().cascader.clearClosable
|
|
9872
|
+
},
|
|
9873
|
+
showCloseButton: {
|
|
9445
9874
|
type: Boolean,
|
|
9446
|
-
default: () => getConfig$3().cascader.
|
|
9875
|
+
default: () => getConfig$3().cascader.showCloseButton
|
|
9447
9876
|
},
|
|
9448
9877
|
showTotalButton: {
|
|
9449
9878
|
type: Boolean,
|
|
@@ -9456,16 +9885,7 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9456
9885
|
showClearButton: {
|
|
9457
9886
|
type: Boolean,
|
|
9458
9887
|
default: () => getConfig$3().cascader.showClearButton
|
|
9459
|
-
}
|
|
9460
|
-
transfer: {
|
|
9461
|
-
type: Boolean,
|
|
9462
|
-
default: null
|
|
9463
|
-
},
|
|
9464
|
-
/**
|
|
9465
|
-
* 已废弃,被 remote-config.queryMethod 替换
|
|
9466
|
-
* @deprecated
|
|
9467
|
-
*/
|
|
9468
|
-
remoteMethod: Function
|
|
9888
|
+
}
|
|
9469
9889
|
},
|
|
9470
9890
|
emits: [
|
|
9471
9891
|
'update:modelValue',
|
|
@@ -9475,7 +9895,14 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9475
9895
|
'blur',
|
|
9476
9896
|
'focus',
|
|
9477
9897
|
'click',
|
|
9478
|
-
'node-click'
|
|
9898
|
+
'node-click',
|
|
9899
|
+
'node-expand',
|
|
9900
|
+
'current-change',
|
|
9901
|
+
'radio-change',
|
|
9902
|
+
'checkbox-change',
|
|
9903
|
+
'load-success',
|
|
9904
|
+
'load-error',
|
|
9905
|
+
'visible-change'
|
|
9479
9906
|
],
|
|
9480
9907
|
setup(props, context) {
|
|
9481
9908
|
const { emit, slots } = context;
|
|
@@ -9489,22 +9916,10 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9489
9916
|
const refElem = ref();
|
|
9490
9917
|
const refInput = ref();
|
|
9491
9918
|
const refInpSearch = ref();
|
|
9492
|
-
const
|
|
9919
|
+
const refChunkWrapper = ref();
|
|
9493
9920
|
const refOptionPanel = ref();
|
|
9494
|
-
const
|
|
9495
|
-
const
|
|
9496
|
-
initialized: false,
|
|
9497
|
-
searchValue: '',
|
|
9498
|
-
searchLoading: false,
|
|
9499
|
-
panelIndex: 0,
|
|
9500
|
-
panelStyle: {},
|
|
9501
|
-
panelPlacement: null,
|
|
9502
|
-
triggerFocusPanel: false,
|
|
9503
|
-
visiblePanel: false,
|
|
9504
|
-
isAniVisible: false,
|
|
9505
|
-
isActivated: false
|
|
9506
|
-
});
|
|
9507
|
-
const internalData = createInternalData$c();
|
|
9921
|
+
const reactData = reactive(createReactData$8());
|
|
9922
|
+
const internalData = createInternalData$b();
|
|
9508
9923
|
const refMaps = {
|
|
9509
9924
|
refElem
|
|
9510
9925
|
};
|
|
@@ -9529,17 +9944,24 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9529
9944
|
return disabled;
|
|
9530
9945
|
});
|
|
9531
9946
|
const computeBtnTransfer = computed(() => {
|
|
9532
|
-
const
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
return globalTransfer;
|
|
9537
|
-
}
|
|
9538
|
-
if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
|
|
9539
|
-
return true;
|
|
9540
|
-
}
|
|
9947
|
+
const popupOpts = computePopupOpts.value;
|
|
9948
|
+
const { transfer } = popupOpts;
|
|
9949
|
+
if (XEUtils.isBoolean(transfer)) {
|
|
9950
|
+
return transfer;
|
|
9541
9951
|
}
|
|
9542
|
-
|
|
9952
|
+
if ($xeTable || $xeModal || $xeDrawer || $xeForm) {
|
|
9953
|
+
return true;
|
|
9954
|
+
}
|
|
9955
|
+
return false;
|
|
9956
|
+
});
|
|
9957
|
+
const computeTreeOpts = computed(() => {
|
|
9958
|
+
return Object.assign({}, getConfig$3().cascader.treeConfig, props.treeConfig);
|
|
9959
|
+
});
|
|
9960
|
+
const computeRadioOpts = computed(() => {
|
|
9961
|
+
return Object.assign({}, getConfig$3().cascader.radioConfig, props.radioConfig);
|
|
9962
|
+
});
|
|
9963
|
+
const computeCheckboxOpts = computed(() => {
|
|
9964
|
+
return Object.assign({}, getConfig$3().cascader.checkboxConfig, props.checkboxConfig);
|
|
9543
9965
|
});
|
|
9544
9966
|
const computePopupOpts = computed(() => {
|
|
9545
9967
|
return Object.assign({}, getConfig$3().cascader.popupConfig, props.popupConfig);
|
|
@@ -9547,10 +9969,6 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9547
9969
|
const computePropsOpts = computed(() => {
|
|
9548
9970
|
return props.optionProps || {};
|
|
9549
9971
|
});
|
|
9550
|
-
const computeNodeKeyField = computed(() => {
|
|
9551
|
-
const valueField = computeValueField.value;
|
|
9552
|
-
return valueField;
|
|
9553
|
-
});
|
|
9554
9972
|
const computeLabelField = computed(() => {
|
|
9555
9973
|
const propsOpts = computePropsOpts.value;
|
|
9556
9974
|
return propsOpts.label || 'label';
|
|
@@ -9559,46 +9977,72 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9559
9977
|
const propsOpts = computePropsOpts.value;
|
|
9560
9978
|
return propsOpts.value || 'value';
|
|
9561
9979
|
});
|
|
9980
|
+
const computeKeyField = computed(() => {
|
|
9981
|
+
const treeOpts = computeTreeOpts.value;
|
|
9982
|
+
return treeOpts.keyField || 'id';
|
|
9983
|
+
});
|
|
9984
|
+
const computeParentField = computed(() => {
|
|
9985
|
+
const treeOpts = computeTreeOpts.value;
|
|
9986
|
+
return treeOpts.parentField || 'parentId';
|
|
9987
|
+
});
|
|
9562
9988
|
const computeChildrenField = computed(() => {
|
|
9563
|
-
const
|
|
9564
|
-
return
|
|
9989
|
+
const treeOpts = computeTreeOpts.value;
|
|
9990
|
+
return treeOpts.childrenField || 'children';
|
|
9991
|
+
});
|
|
9992
|
+
const computeMapChildrenField = computed(() => {
|
|
9993
|
+
const treeOpts = computeTreeOpts.value;
|
|
9994
|
+
return treeOpts.mapChildrenField || 'mapChildren';
|
|
9995
|
+
});
|
|
9996
|
+
const computeHasChildField = computed(() => {
|
|
9997
|
+
const treeOpts = computeTreeOpts.value;
|
|
9998
|
+
return treeOpts.hasChildField || 'hasChild';
|
|
9565
9999
|
});
|
|
9566
10000
|
const computeRemoteOpts = computed(() => {
|
|
9567
10001
|
return Object.assign({}, getConfig$3().cascader.remoteConfig, props.remoteConfig);
|
|
9568
10002
|
});
|
|
10003
|
+
const computeSelectVals = computed(() => {
|
|
10004
|
+
const { modelValue } = props;
|
|
10005
|
+
return XEUtils.eqNull(modelValue) ? [] : (XEUtils.isArray(modelValue) ? modelValue : [modelValue]);
|
|
10006
|
+
});
|
|
9569
10007
|
const computeSelectLabel = computed(() => {
|
|
9570
|
-
const {
|
|
9571
|
-
const {
|
|
9572
|
-
const
|
|
10008
|
+
const { showFullLabel } = props;
|
|
10009
|
+
const { fullOptFlag, lazyOptFlag } = reactData;
|
|
10010
|
+
const { fullNodeMaps, lazyNodeMaps } = internalData;
|
|
9573
10011
|
const labelField = computeLabelField.value;
|
|
9574
|
-
const selectVals =
|
|
10012
|
+
const selectVals = computeSelectVals.value;
|
|
9575
10013
|
return selectVals.map(val => {
|
|
9576
10014
|
const cacheItem = fullNodeMaps[val];
|
|
9577
|
-
if (cacheItem) {
|
|
9578
|
-
return cacheItem.item[labelField];
|
|
10015
|
+
if (fullOptFlag && cacheItem) {
|
|
10016
|
+
return showFullLabel ? cacheItem.fullLabel : cacheItem.item[labelField];
|
|
9579
10017
|
}
|
|
9580
|
-
if (
|
|
9581
|
-
const
|
|
9582
|
-
if (
|
|
9583
|
-
return
|
|
10018
|
+
if (lazyOptFlag) {
|
|
10019
|
+
const lazyCacheItem = lazyNodeMaps[val];
|
|
10020
|
+
if (lazyCacheItem) {
|
|
10021
|
+
return showFullLabel ? lazyCacheItem.fullLabel : lazyCacheItem.item[labelField];
|
|
9584
10022
|
}
|
|
9585
10023
|
}
|
|
9586
10024
|
return val;
|
|
9587
10025
|
}).join(', ');
|
|
9588
10026
|
});
|
|
9589
10027
|
const computePopupWrapperStyle = computed(() => {
|
|
10028
|
+
const { currentCunkList, panelStyle } = reactData;
|
|
9590
10029
|
const popupOpts = computePopupOpts.value;
|
|
9591
|
-
const { height,
|
|
9592
|
-
const stys = {};
|
|
9593
|
-
if (width) {
|
|
9594
|
-
stys.width = toCssUnit(width);
|
|
9595
|
-
}
|
|
10030
|
+
const { height, nodeWidth, nodeHeight } = popupOpts;
|
|
10031
|
+
const stys = Object.assign(Object.assign({}, panelStyle), { '--vxe-ui-cascader-chunk-size': currentCunkList.length });
|
|
9596
10032
|
if (height) {
|
|
9597
|
-
stys
|
|
9598
|
-
|
|
10033
|
+
stys['--vxe-ui-cascader-chunk-height'] = toCssUnit(height);
|
|
10034
|
+
}
|
|
10035
|
+
if (nodeWidth) {
|
|
10036
|
+
stys['--vxe-ui-cascader-node-width'] = toCssUnit(nodeWidth);
|
|
10037
|
+
}
|
|
10038
|
+
if (nodeHeight) {
|
|
10039
|
+
stys['--vxe-ui-cascader-node-height'] = toCssUnit(nodeHeight);
|
|
9599
10040
|
}
|
|
9600
10041
|
return stys;
|
|
9601
10042
|
});
|
|
10043
|
+
const computeFilterOpts = computed(() => {
|
|
10044
|
+
return Object.assign({}, getConfig$3().cascader.filterConfig, props.filterConfig);
|
|
10045
|
+
});
|
|
9602
10046
|
const computeMaps = {};
|
|
9603
10047
|
const $xeCascader = {
|
|
9604
10048
|
xID,
|
|
@@ -9618,48 +10062,318 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9618
10062
|
const cascaderMethods = {
|
|
9619
10063
|
dispatchEvent
|
|
9620
10064
|
};
|
|
9621
|
-
const
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
10065
|
+
const getNodeId = (node) => {
|
|
10066
|
+
if (!node) {
|
|
10067
|
+
return '';
|
|
10068
|
+
}
|
|
10069
|
+
const valueField = computeValueField.value;
|
|
10070
|
+
const nodeKey = node[valueField];
|
|
10071
|
+
return enNodeValue$1(nodeKey);
|
|
9625
10072
|
};
|
|
9626
|
-
const
|
|
9627
|
-
const {
|
|
9628
|
-
const
|
|
10073
|
+
const isCheckedByCheckboxNodeId = (nodeid) => {
|
|
10074
|
+
const { updateCheckboxFlag } = reactData;
|
|
10075
|
+
const { selectCheckboxMaps } = internalData;
|
|
10076
|
+
return !!(updateCheckboxFlag && selectCheckboxMaps[nodeid]);
|
|
10077
|
+
};
|
|
10078
|
+
const handleCheckedCheckboxNode = (nodeList, checked) => {
|
|
10079
|
+
const { selectCheckboxMaps } = internalData;
|
|
10080
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
9629
10081
|
const childrenField = computeChildrenField.value;
|
|
10082
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
10083
|
+
const { checkStrictly } = checkboxOpts;
|
|
10084
|
+
const treeOpts = computeTreeOpts.value;
|
|
10085
|
+
const { transform } = treeOpts;
|
|
10086
|
+
const handleSelect = (node) => {
|
|
10087
|
+
const nodeid = getNodeId(node);
|
|
10088
|
+
{
|
|
10089
|
+
if (!selectCheckboxMaps[nodeid]) {
|
|
10090
|
+
selectCheckboxMaps[nodeid] = node;
|
|
10091
|
+
}
|
|
10092
|
+
}
|
|
10093
|
+
};
|
|
10094
|
+
if (checkStrictly) {
|
|
10095
|
+
nodeList.forEach(handleSelect);
|
|
10096
|
+
}
|
|
10097
|
+
else {
|
|
10098
|
+
XEUtils.eachTree(nodeList, handleSelect, { children: transform ? mapChildrenField : childrenField });
|
|
10099
|
+
}
|
|
10100
|
+
reactData.updateCheckboxFlag++;
|
|
10101
|
+
updateCheckboxStatus();
|
|
10102
|
+
};
|
|
10103
|
+
const createNode = (records) => {
|
|
9630
10104
|
const valueField = computeValueField.value;
|
|
9631
|
-
|
|
10105
|
+
return Promise.resolve(records.map(obj => {
|
|
10106
|
+
const item = Object.assign({}, obj);
|
|
10107
|
+
let nodeid = getNodeId(item);
|
|
10108
|
+
if (!nodeid) {
|
|
10109
|
+
nodeid = getNodeUniqueId$1();
|
|
10110
|
+
XEUtils.set(item, valueField, nodeid);
|
|
10111
|
+
}
|
|
10112
|
+
return item;
|
|
10113
|
+
}));
|
|
10114
|
+
};
|
|
10115
|
+
const cacheNodeMap = () => {
|
|
10116
|
+
const { separator } = props;
|
|
10117
|
+
const { treeFullData } = internalData;
|
|
10118
|
+
const valueField = computeValueField.value;
|
|
10119
|
+
const labelField = computeLabelField.value;
|
|
10120
|
+
const childrenField = computeChildrenField.value;
|
|
9632
10121
|
const keyMaps = {};
|
|
9633
|
-
const
|
|
9634
|
-
|
|
10122
|
+
const fullMaps = {};
|
|
10123
|
+
XEUtils.eachTree(treeFullData, (item, index, items, path, parenItem, nodes) => {
|
|
10124
|
+
let nodeid = getNodeId(item);
|
|
9635
10125
|
if (!nodeid) {
|
|
9636
|
-
nodeid =
|
|
10126
|
+
nodeid = getNodeUniqueId$1();
|
|
10127
|
+
item[valueField] = nodeid;
|
|
9637
10128
|
}
|
|
9638
|
-
|
|
9639
|
-
|
|
10129
|
+
const nodeVal = item[valueField];
|
|
10130
|
+
const itemRest = {
|
|
10131
|
+
item,
|
|
10132
|
+
index,
|
|
10133
|
+
$index: -1,
|
|
10134
|
+
_index: -1,
|
|
10135
|
+
items,
|
|
10136
|
+
parent: parenItem,
|
|
10137
|
+
nodes,
|
|
10138
|
+
level: nodes.length - 1,
|
|
10139
|
+
treeIndex: index,
|
|
10140
|
+
lineCount: 0,
|
|
10141
|
+
treeLoaded: false,
|
|
10142
|
+
fullLabel: nodes.map(item => item[labelField]).join((separator || ' / '))
|
|
10143
|
+
};
|
|
10144
|
+
keyMaps[nodeid] = itemRest;
|
|
10145
|
+
fullMaps[nodeVal] = itemRest;
|
|
10146
|
+
}, { children: childrenField });
|
|
10147
|
+
internalData.nodeMaps = keyMaps;
|
|
10148
|
+
internalData.fullNodeMaps = fullMaps;
|
|
10149
|
+
reactData.fullOptFlag++;
|
|
10150
|
+
};
|
|
10151
|
+
const updateAfterDataIndex = () => {
|
|
10152
|
+
const { separator } = props;
|
|
10153
|
+
const { afterTreeList, nodeMaps } = internalData;
|
|
10154
|
+
const labelField = computeLabelField.value;
|
|
10155
|
+
const childrenField = computeChildrenField.value;
|
|
10156
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
10157
|
+
const treeOpts = computeTreeOpts.value;
|
|
10158
|
+
const { transform } = treeOpts;
|
|
10159
|
+
let vtIndex = 0;
|
|
10160
|
+
XEUtils.eachTree(afterTreeList, (item, index, items, path, parenItem, nodes) => {
|
|
10161
|
+
const nodeid = getNodeId(item);
|
|
10162
|
+
const nodeItem = nodeMaps[nodeid];
|
|
10163
|
+
if (nodeItem) {
|
|
10164
|
+
nodeItem.items = items;
|
|
10165
|
+
nodeItem.treeIndex = index;
|
|
10166
|
+
nodeItem._index = vtIndex;
|
|
9640
10167
|
}
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
10168
|
+
else {
|
|
10169
|
+
const rest = {
|
|
10170
|
+
item,
|
|
10171
|
+
index,
|
|
10172
|
+
$index: -1,
|
|
10173
|
+
_index: vtIndex,
|
|
10174
|
+
items,
|
|
10175
|
+
parent: parenItem,
|
|
10176
|
+
nodes,
|
|
10177
|
+
level: nodes.length - 1,
|
|
10178
|
+
treeIndex: index,
|
|
10179
|
+
lineCount: 0,
|
|
10180
|
+
treeLoaded: false,
|
|
10181
|
+
fullLabel: nodes.map(item => item[labelField]).join((separator || ' / '))
|
|
10182
|
+
};
|
|
10183
|
+
nodeMaps[nodeid] = rest;
|
|
10184
|
+
}
|
|
10185
|
+
vtIndex++;
|
|
10186
|
+
}, { children: transform ? mapChildrenField : childrenField });
|
|
10187
|
+
};
|
|
10188
|
+
const updateAfterFullData = () => {
|
|
10189
|
+
const { searchValue } = reactData;
|
|
10190
|
+
const { treeFullData, lastFilterValue } = internalData;
|
|
10191
|
+
const labelField = computeLabelField.value;
|
|
10192
|
+
const childrenField = computeChildrenField.value;
|
|
10193
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
10194
|
+
const treeOpts = computeTreeOpts.value;
|
|
10195
|
+
const { transform } = treeOpts;
|
|
10196
|
+
const filterOpts = computeFilterOpts.value;
|
|
10197
|
+
const { beforeFilterMethod, filterMethod, afterFilterMethod } = filterOpts;
|
|
10198
|
+
let fullList = treeFullData;
|
|
10199
|
+
let treeList = fullList;
|
|
10200
|
+
let filterStr = '';
|
|
10201
|
+
if (searchValue) {
|
|
10202
|
+
filterStr = `${searchValue}`;
|
|
10203
|
+
const handleSearch = filterMethod
|
|
10204
|
+
? (item) => {
|
|
10205
|
+
return filterMethod({
|
|
10206
|
+
$cascader: $xeCascader,
|
|
10207
|
+
node: item,
|
|
10208
|
+
filterValue: filterStr
|
|
10209
|
+
});
|
|
10210
|
+
}
|
|
10211
|
+
: (item) => {
|
|
10212
|
+
return String(item[labelField]).toLowerCase().indexOf(filterStr.toLowerCase()) > -1;
|
|
10213
|
+
};
|
|
10214
|
+
const bafParams = { $cascader: $xeCascader, filterValue: filterStr };
|
|
10215
|
+
if (beforeFilterMethod) {
|
|
10216
|
+
beforeFilterMethod(bafParams);
|
|
9645
10217
|
}
|
|
9646
|
-
nodeMaps[value] = { item, index, items, parent, nodes };
|
|
9647
|
-
};
|
|
9648
|
-
if (options) {
|
|
9649
10218
|
if (transform) {
|
|
9650
|
-
|
|
9651
|
-
|
|
10219
|
+
treeList = XEUtils.searchTree(treeFullData, handleSearch, {
|
|
10220
|
+
original: true,
|
|
10221
|
+
isEvery: true,
|
|
10222
|
+
children: childrenField,
|
|
10223
|
+
mapChildren: mapChildrenField
|
|
9652
10224
|
});
|
|
10225
|
+
fullList = treeList;
|
|
9653
10226
|
}
|
|
9654
10227
|
else {
|
|
9655
|
-
|
|
10228
|
+
fullList = treeFullData.filter(handleSearch);
|
|
9656
10229
|
}
|
|
10230
|
+
internalData.lastFilterValue = filterStr;
|
|
10231
|
+
nextTick(() => {
|
|
10232
|
+
if (afterFilterMethod) {
|
|
10233
|
+
afterFilterMethod(bafParams);
|
|
10234
|
+
}
|
|
10235
|
+
});
|
|
9657
10236
|
}
|
|
9658
|
-
|
|
9659
|
-
|
|
10237
|
+
else {
|
|
10238
|
+
if (transform) {
|
|
10239
|
+
treeList = XEUtils.searchTree(treeFullData, () => true, {
|
|
10240
|
+
original: true,
|
|
10241
|
+
isEvery: true,
|
|
10242
|
+
children: childrenField,
|
|
10243
|
+
mapChildren: mapChildrenField
|
|
10244
|
+
});
|
|
10245
|
+
fullList = treeList;
|
|
10246
|
+
if (lastFilterValue) {
|
|
10247
|
+
const bafParams = { $cascader: $xeCascader, filterValue: filterStr };
|
|
10248
|
+
if (beforeFilterMethod) {
|
|
10249
|
+
beforeFilterMethod(bafParams);
|
|
10250
|
+
}
|
|
10251
|
+
// 取消筛选时自动收起
|
|
10252
|
+
nextTick(() => {
|
|
10253
|
+
if (afterFilterMethod) {
|
|
10254
|
+
afterFilterMethod(bafParams);
|
|
10255
|
+
}
|
|
10256
|
+
});
|
|
10257
|
+
}
|
|
10258
|
+
}
|
|
10259
|
+
internalData.lastFilterValue = '';
|
|
10260
|
+
}
|
|
10261
|
+
internalData.afterVisibleList = fullList;
|
|
10262
|
+
internalData.afterTreeList = treeList;
|
|
10263
|
+
updateAfterDataIndex();
|
|
10264
|
+
};
|
|
10265
|
+
/**
|
|
10266
|
+
* 如果为虚拟树、则将树结构拍平
|
|
10267
|
+
*/
|
|
10268
|
+
const handleTreeToList = () => {
|
|
10269
|
+
const { afterTreeList, treeExpandedMaps } = internalData;
|
|
10270
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
10271
|
+
const treeOpts = computeTreeOpts.value;
|
|
10272
|
+
const { transform } = treeOpts;
|
|
10273
|
+
const expandMaps = {};
|
|
10274
|
+
if (transform) {
|
|
10275
|
+
const fullData = [];
|
|
10276
|
+
XEUtils.eachTree(afterTreeList, (item, index, items, path, parentRow) => {
|
|
10277
|
+
const nodeid = getNodeId(item);
|
|
10278
|
+
const parentNodeid = getNodeId(parentRow);
|
|
10279
|
+
if (!parentRow || (expandMaps[parentNodeid] && treeExpandedMaps[parentNodeid])) {
|
|
10280
|
+
expandMaps[nodeid] = 1;
|
|
10281
|
+
fullData.push(item);
|
|
10282
|
+
}
|
|
10283
|
+
}, { children: mapChildrenField });
|
|
10284
|
+
internalData.afterVisibleList = fullData;
|
|
10285
|
+
return fullData;
|
|
10286
|
+
}
|
|
10287
|
+
return internalData.afterVisibleList;
|
|
10288
|
+
};
|
|
10289
|
+
const handleData = (force) => {
|
|
10290
|
+
const { nodeMaps } = internalData;
|
|
10291
|
+
let fullList = internalData.afterVisibleList;
|
|
10292
|
+
if (force) {
|
|
10293
|
+
// 更新数据,处理筛选和排序
|
|
10294
|
+
updateAfterFullData();
|
|
10295
|
+
// 如果为虚拟树,将树结构拍平
|
|
10296
|
+
fullList = handleTreeToList();
|
|
10297
|
+
}
|
|
10298
|
+
const treeList = fullList.slice(0);
|
|
10299
|
+
treeList.forEach((item, $index) => {
|
|
10300
|
+
const nodeid = getNodeId(item);
|
|
10301
|
+
const itemRest = nodeMaps[nodeid];
|
|
10302
|
+
if (itemRest) {
|
|
10303
|
+
itemRest.$index = $index;
|
|
10304
|
+
}
|
|
10305
|
+
});
|
|
10306
|
+
reactData.treeList = treeList;
|
|
10307
|
+
};
|
|
10308
|
+
const triggerSearchEvent = XEUtils.debounce(() => handleData(true), 350, { trailing: true });
|
|
10309
|
+
const loadData = (list) => {
|
|
10310
|
+
const treeOpts = computeTreeOpts.value;
|
|
10311
|
+
const keyField = computeKeyField.value;
|
|
10312
|
+
const parentField = computeParentField.value;
|
|
10313
|
+
const childrenField = computeChildrenField.value;
|
|
10314
|
+
const { rootParentValue, rootValues } = treeOpts;
|
|
10315
|
+
const { transform } = treeOpts;
|
|
10316
|
+
const fullData = transform
|
|
10317
|
+
? XEUtils.toArrayTree(list, {
|
|
10318
|
+
key: keyField,
|
|
10319
|
+
parentKey: parentField,
|
|
10320
|
+
mapChildren: childrenField,
|
|
10321
|
+
rootParentValue,
|
|
10322
|
+
rootValues
|
|
10323
|
+
})
|
|
10324
|
+
: list ? list.slice(0) : [];
|
|
10325
|
+
internalData.treeFullData = fullData;
|
|
10326
|
+
cacheNodeMap();
|
|
10327
|
+
handleData(true);
|
|
10328
|
+
handleCurrentItems();
|
|
10329
|
+
updateCurrentChunk();
|
|
10330
|
+
return nextTick();
|
|
10331
|
+
};
|
|
10332
|
+
const updateCurrentChunk = () => {
|
|
10333
|
+
const { currentItems } = reactData;
|
|
10334
|
+
const { treeFullData } = internalData;
|
|
10335
|
+
const childrenField = computeChildrenField.value;
|
|
10336
|
+
const currentCunkList = [treeFullData];
|
|
10337
|
+
if (currentItems.length) {
|
|
10338
|
+
let chunkIndex = 0;
|
|
10339
|
+
let stNodeid = currentItems[chunkIndex];
|
|
10340
|
+
let optList = treeFullData;
|
|
10341
|
+
while (stNodeid && optList && optList.length) {
|
|
10342
|
+
stNodeid = currentItems[chunkIndex++];
|
|
10343
|
+
const currOption = optList.find(item => stNodeid === getNodeId(item));
|
|
10344
|
+
optList = currOption ? currOption[childrenField] : [];
|
|
10345
|
+
if (!optList || !optList.length) {
|
|
10346
|
+
break;
|
|
10347
|
+
}
|
|
10348
|
+
currentCunkList.push(optList);
|
|
10349
|
+
}
|
|
10350
|
+
}
|
|
10351
|
+
reactData.currentCunkList = currentCunkList;
|
|
10352
|
+
};
|
|
10353
|
+
const handleCurrentItems = () => {
|
|
10354
|
+
const { treeFullData } = internalData;
|
|
10355
|
+
const selectVals = computeSelectVals.value;
|
|
10356
|
+
const childrenField = computeChildrenField.value;
|
|
10357
|
+
const stItems = [];
|
|
10358
|
+
const expandedMaps = {};
|
|
10359
|
+
if (selectVals.length) {
|
|
10360
|
+
const lastVal = XEUtils.last(selectVals);
|
|
10361
|
+
const stRest = XEUtils.findTree(treeFullData, (item) => lastVal === getNodeId(item), { children: childrenField });
|
|
10362
|
+
if (stRest) {
|
|
10363
|
+
const { nodes } = stRest;
|
|
10364
|
+
nodes.forEach(item => {
|
|
10365
|
+
const nodeid = getNodeId(item);
|
|
10366
|
+
expandedMaps[nodeid] = true;
|
|
10367
|
+
stItems.push(nodeid);
|
|
10368
|
+
});
|
|
10369
|
+
}
|
|
10370
|
+
}
|
|
10371
|
+
internalData.treeExpandedMaps = expandedMaps;
|
|
10372
|
+
reactData.currentItems = stItems;
|
|
9660
10373
|
};
|
|
9661
10374
|
const updateZindex = () => {
|
|
9662
|
-
const
|
|
10375
|
+
const popupOpts = computePopupOpts.value;
|
|
10376
|
+
const { zIndex } = popupOpts;
|
|
9663
10377
|
if (zIndex) {
|
|
9664
10378
|
reactData.panelIndex = zIndex;
|
|
9665
10379
|
}
|
|
@@ -9668,7 +10382,6 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9668
10382
|
}
|
|
9669
10383
|
};
|
|
9670
10384
|
const updatePlacement = () => {
|
|
9671
|
-
const { placement } = props;
|
|
9672
10385
|
const { panelIndex } = reactData;
|
|
9673
10386
|
const targetElem = refElem.value;
|
|
9674
10387
|
const panelElem = refOptionPanel.value;
|
|
@@ -9676,9 +10389,10 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9676
10389
|
const popupOpts = computePopupOpts.value;
|
|
9677
10390
|
const handleStyle = () => {
|
|
9678
10391
|
const ppObj = updatePanelPlacement(targetElem, panelElem, {
|
|
9679
|
-
placement: popupOpts.placement
|
|
10392
|
+
placement: popupOpts.placement,
|
|
9680
10393
|
defaultPlacement: popupOpts.defaultPlacement,
|
|
9681
|
-
teleportTo: btnTransfer
|
|
10394
|
+
teleportTo: btnTransfer,
|
|
10395
|
+
isMinWidth: false
|
|
9682
10396
|
});
|
|
9683
10397
|
const panelStyle = Object.assign(ppObj.style, {
|
|
9684
10398
|
zIndex: panelIndex
|
|
@@ -9689,9 +10403,9 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9689
10403
|
handleStyle();
|
|
9690
10404
|
return nextTick().then(handleStyle);
|
|
9691
10405
|
};
|
|
9692
|
-
const showOptionPanel = () => {
|
|
10406
|
+
const showOptionPanel = (evnt) => {
|
|
9693
10407
|
const { loading, remote, filterable } = props;
|
|
9694
|
-
const {
|
|
10408
|
+
const { treeFullData } = internalData;
|
|
9695
10409
|
const isDisabled = computeIsDisabled.value;
|
|
9696
10410
|
const remoteOpts = computeRemoteOpts.value;
|
|
9697
10411
|
if (!loading && !isDisabled) {
|
|
@@ -9702,7 +10416,7 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9702
10416
|
reactData.isActivated = true;
|
|
9703
10417
|
reactData.isAniVisible = true;
|
|
9704
10418
|
if (filterable) {
|
|
9705
|
-
if (remote && remoteOpts.enabled && remoteOpts.autoLoad && !
|
|
10419
|
+
if (remote && remoteOpts.enabled && remoteOpts.autoLoad && !treeFullData.length) {
|
|
9706
10420
|
handleSearchEvent();
|
|
9707
10421
|
}
|
|
9708
10422
|
}
|
|
@@ -9712,16 +10426,55 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9712
10426
|
}, 10);
|
|
9713
10427
|
updateZindex();
|
|
9714
10428
|
updatePlacement();
|
|
10429
|
+
dispatchEvent('visible-change', { visible: true }, evnt || null);
|
|
9715
10430
|
}
|
|
9716
10431
|
};
|
|
9717
|
-
const hideOptionPanel = () => {
|
|
10432
|
+
const hideOptionPanel = (evnt) => {
|
|
9718
10433
|
reactData.visiblePanel = false;
|
|
9719
10434
|
internalData.hpTimeout = setTimeout(() => {
|
|
9720
10435
|
reactData.isAniVisible = false;
|
|
9721
10436
|
}, 350);
|
|
10437
|
+
dispatchEvent('visible-change', { visible: false }, evnt || null);
|
|
10438
|
+
};
|
|
10439
|
+
const setCurrentNode = (node) => {
|
|
10440
|
+
reactData.currentNode = node;
|
|
10441
|
+
return nextTick();
|
|
10442
|
+
};
|
|
10443
|
+
const setAllCheckboxNode = (checked) => {
|
|
10444
|
+
const selectMaps = {};
|
|
10445
|
+
const childrenField = computeChildrenField.value;
|
|
10446
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
10447
|
+
const treeOpts = computeTreeOpts.value;
|
|
10448
|
+
const { transform } = treeOpts;
|
|
10449
|
+
const checkKeys = [];
|
|
10450
|
+
const checkNodes = [];
|
|
10451
|
+
{
|
|
10452
|
+
XEUtils.eachTree(internalData.afterTreeList, (node) => {
|
|
10453
|
+
const nodeid = getNodeId(node);
|
|
10454
|
+
checkKeys.push(nodeid);
|
|
10455
|
+
checkNodes.push(node);
|
|
10456
|
+
selectMaps[nodeid] = true;
|
|
10457
|
+
}, { children: transform ? mapChildrenField : childrenField });
|
|
10458
|
+
}
|
|
10459
|
+
internalData.indeterminateRowMaps = {};
|
|
10460
|
+
internalData.selectCheckboxMaps = selectMaps;
|
|
10461
|
+
reactData.updateCheckboxFlag++;
|
|
10462
|
+
updateCheckboxStatus();
|
|
10463
|
+
return nextTick().then(() => {
|
|
10464
|
+
return { checkNodeKeys: checkKeys, checkNodes };
|
|
10465
|
+
});
|
|
10466
|
+
};
|
|
10467
|
+
const clearCheckboxNode = () => {
|
|
10468
|
+
internalData.indeterminateRowMaps = {};
|
|
10469
|
+
internalData.selectCheckboxMaps = {};
|
|
10470
|
+
reactData.updateCheckboxFlag++;
|
|
10471
|
+
updateCheckboxStatus();
|
|
10472
|
+
return nextTick().then(() => {
|
|
10473
|
+
return { checkNodeKeys: [], checkNodes: [] };
|
|
10474
|
+
});
|
|
9722
10475
|
};
|
|
9723
10476
|
const changeEvent = (evnt, selectValue, node) => {
|
|
9724
|
-
const value = XEUtils.isArray(selectValue) ? selectValue.map(deNodeValue) : deNodeValue(selectValue);
|
|
10477
|
+
const value = XEUtils.isArray(selectValue) ? selectValue.map(deNodeValue$1) : deNodeValue$1(selectValue);
|
|
9725
10478
|
emitModel(value);
|
|
9726
10479
|
if (value !== props.modelValue) {
|
|
9727
10480
|
dispatchEvent('change', { value, node, option: node }, evnt);
|
|
@@ -9737,103 +10490,438 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9737
10490
|
};
|
|
9738
10491
|
const clearEvent = (params, evnt) => {
|
|
9739
10492
|
clearValueEvent(evnt, null);
|
|
9740
|
-
hideOptionPanel();
|
|
10493
|
+
hideOptionPanel(evnt);
|
|
9741
10494
|
};
|
|
9742
10495
|
const allCheckedPanelEvent = (params) => {
|
|
9743
10496
|
const { $event } = params;
|
|
9744
|
-
const { multiple,
|
|
9745
|
-
const $tree = refTree.value;
|
|
10497
|
+
const { multiple, checkedClosable } = props;
|
|
9746
10498
|
if (multiple) {
|
|
9747
|
-
|
|
9748
|
-
$
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
10499
|
+
setAllCheckboxNode().then(({ checkNodeKeys, checkNodes }) => {
|
|
10500
|
+
changeEvent($event, checkNodeKeys, checkNodes[0]);
|
|
10501
|
+
dispatchEvent('all-change', { value: checkNodeKeys }, $event);
|
|
10502
|
+
if (checkedClosable) {
|
|
10503
|
+
hideOptionPanel($event);
|
|
10504
|
+
}
|
|
10505
|
+
});
|
|
10506
|
+
}
|
|
10507
|
+
};
|
|
10508
|
+
const clearCheckedPanelEvent = (params) => {
|
|
10509
|
+
const { $event } = params;
|
|
10510
|
+
const { multiple, checkedClosable } = props;
|
|
10511
|
+
const value = multiple ? [] : null;
|
|
10512
|
+
clearCheckboxNode().then(() => {
|
|
10513
|
+
if (checkedClosable) {
|
|
10514
|
+
hideOptionPanel($event);
|
|
10515
|
+
}
|
|
10516
|
+
});
|
|
10517
|
+
changeEvent($event, value, null);
|
|
10518
|
+
dispatchEvent('clear', { value }, $event);
|
|
10519
|
+
};
|
|
10520
|
+
const closePanelEvent = (params) => {
|
|
10521
|
+
const { $event } = params;
|
|
10522
|
+
hideOptionPanel($event);
|
|
10523
|
+
};
|
|
10524
|
+
const handleGlobalMousewheelEvent = (evnt) => {
|
|
10525
|
+
const { visiblePanel } = reactData;
|
|
10526
|
+
const isDisabled = computeIsDisabled.value;
|
|
10527
|
+
if (!isDisabled) {
|
|
10528
|
+
if (visiblePanel) {
|
|
10529
|
+
const panelElem = refOptionPanel.value;
|
|
10530
|
+
if (getEventTargetNode(evnt, panelElem).flag) {
|
|
10531
|
+
updatePlacement();
|
|
10532
|
+
}
|
|
10533
|
+
else {
|
|
10534
|
+
hideOptionPanel(evnt);
|
|
10535
|
+
}
|
|
10536
|
+
}
|
|
10537
|
+
}
|
|
10538
|
+
};
|
|
10539
|
+
const handleGlobalMousedownEvent = (evnt) => {
|
|
10540
|
+
const { visiblePanel } = reactData;
|
|
10541
|
+
const isDisabled = computeIsDisabled.value;
|
|
10542
|
+
if (!isDisabled) {
|
|
10543
|
+
const el = refElem.value;
|
|
10544
|
+
const panelElem = refOptionPanel.value;
|
|
10545
|
+
reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag;
|
|
10546
|
+
if (visiblePanel && !reactData.isActivated) {
|
|
10547
|
+
hideOptionPanel(evnt);
|
|
10548
|
+
}
|
|
10549
|
+
}
|
|
10550
|
+
};
|
|
10551
|
+
const handleGlobalBlurEvent = (evnt) => {
|
|
10552
|
+
const { visiblePanel, isActivated } = reactData;
|
|
10553
|
+
if (visiblePanel) {
|
|
10554
|
+
hideOptionPanel(evnt);
|
|
10555
|
+
}
|
|
10556
|
+
if (isActivated) {
|
|
10557
|
+
reactData.isActivated = false;
|
|
10558
|
+
}
|
|
10559
|
+
if (visiblePanel || isActivated) {
|
|
10560
|
+
const $input = refInput.value;
|
|
10561
|
+
if ($input) {
|
|
10562
|
+
$input.blur();
|
|
10563
|
+
}
|
|
10564
|
+
}
|
|
10565
|
+
};
|
|
10566
|
+
const handleGlobalResizeEvent = () => {
|
|
10567
|
+
const { visiblePanel } = reactData;
|
|
10568
|
+
if (visiblePanel) {
|
|
10569
|
+
updatePlacement();
|
|
10570
|
+
}
|
|
10571
|
+
};
|
|
10572
|
+
const handleFocusSearch = () => {
|
|
10573
|
+
if (props.filterable) {
|
|
10574
|
+
nextTick(() => {
|
|
10575
|
+
const inpSearch = refInpSearch.value;
|
|
10576
|
+
if (inpSearch) {
|
|
10577
|
+
inpSearch.focus();
|
|
10578
|
+
}
|
|
10579
|
+
});
|
|
10580
|
+
}
|
|
10581
|
+
};
|
|
10582
|
+
const changeCurrentEvent = (evnt, node) => {
|
|
10583
|
+
evnt.preventDefault();
|
|
10584
|
+
const isChecked = true;
|
|
10585
|
+
reactData.currentNode = node;
|
|
10586
|
+
dispatchEvent('current-change', { node, checked: isChecked }, evnt);
|
|
10587
|
+
};
|
|
10588
|
+
const changeRadioEvent = (evnt, node) => {
|
|
10589
|
+
evnt.preventDefault();
|
|
10590
|
+
evnt.stopPropagation();
|
|
10591
|
+
const { nodeMaps } = internalData;
|
|
10592
|
+
const radioOpts = computeRadioOpts.value;
|
|
10593
|
+
const childrenField = computeChildrenField.value;
|
|
10594
|
+
const { checkMode, checkMethod } = radioOpts;
|
|
10595
|
+
const nodeid = getNodeId(node);
|
|
10596
|
+
const childList = node[childrenField];
|
|
10597
|
+
const isExistChild = childList && childList.length > 0;
|
|
10598
|
+
const nodeItem = nodeMaps[nodeid] || {};
|
|
10599
|
+
const nLevel = nodeItem.level;
|
|
10600
|
+
const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
|
|
10601
|
+
if (isDisabled) {
|
|
10602
|
+
return;
|
|
10603
|
+
}
|
|
10604
|
+
const value = nodeid;
|
|
10605
|
+
reactData.selectRadioKey = value;
|
|
10606
|
+
changeEvent(evnt, value, node);
|
|
10607
|
+
hideOptionPanel(evnt);
|
|
10608
|
+
};
|
|
10609
|
+
const handleAsyncTreeExpandChilds = (node) => {
|
|
10610
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
10611
|
+
const treeOpts = computeTreeOpts.value;
|
|
10612
|
+
const { loadMethod } = treeOpts;
|
|
10613
|
+
const { checkStrictly } = checkboxOpts;
|
|
10614
|
+
return new Promise(resolve => {
|
|
10615
|
+
if (loadMethod) {
|
|
10616
|
+
const { nodeMaps } = internalData;
|
|
10617
|
+
const nodeid = getNodeId(node);
|
|
10618
|
+
const nodeItem = nodeMaps[nodeid];
|
|
10619
|
+
internalData.treeExpandLazyLoadedMaps[nodeid] = true;
|
|
10620
|
+
Promise.resolve(loadMethod({ $cascader: $xeCascader, node })).then((childRecords) => {
|
|
10621
|
+
const { treeExpandLazyLoadedMaps } = internalData;
|
|
10622
|
+
nodeItem.treeLoaded = true;
|
|
10623
|
+
if (treeExpandLazyLoadedMaps[nodeid]) {
|
|
10624
|
+
treeExpandLazyLoadedMaps[nodeid] = false;
|
|
10625
|
+
}
|
|
10626
|
+
if (!XEUtils.isArray(childRecords)) {
|
|
10627
|
+
childRecords = [];
|
|
10628
|
+
}
|
|
10629
|
+
if (childRecords) {
|
|
10630
|
+
return $xeCascader.loadChildrenNode(node, childRecords).then(childRows => {
|
|
10631
|
+
const { treeExpandedMaps } = internalData;
|
|
10632
|
+
if (childRows.length && !treeExpandedMaps[nodeid]) {
|
|
10633
|
+
treeExpandedMaps[nodeid] = true;
|
|
10634
|
+
}
|
|
10635
|
+
reactData.updateExpandedFlag++;
|
|
10636
|
+
// 如果当前节点已选中,则展开后子节点也被选中
|
|
10637
|
+
if (!checkStrictly && $xeCascader.isCheckedByCheckboxNodeId(nodeid)) {
|
|
10638
|
+
handleCheckedCheckboxNode(childRows);
|
|
10639
|
+
}
|
|
10640
|
+
dispatchEvent('load-success', { node, data: childRecords }, new Event('load-success'));
|
|
10641
|
+
return nextTick();
|
|
10642
|
+
});
|
|
10643
|
+
}
|
|
10644
|
+
else {
|
|
10645
|
+
dispatchEvent('load-success', { node, data: childRecords }, new Event('load-success'));
|
|
10646
|
+
}
|
|
10647
|
+
}).catch((e) => {
|
|
10648
|
+
const { treeExpandLazyLoadedMaps } = internalData;
|
|
10649
|
+
nodeItem.treeLoaded = false;
|
|
10650
|
+
if (treeExpandLazyLoadedMaps[nodeid]) {
|
|
10651
|
+
treeExpandLazyLoadedMaps[nodeid] = false;
|
|
10652
|
+
}
|
|
10653
|
+
dispatchEvent('load-error', { node, data: e }, new Event('load-error'));
|
|
10654
|
+
}).finally(() => {
|
|
10655
|
+
handleTreeToList();
|
|
10656
|
+
handleData();
|
|
10657
|
+
});
|
|
10658
|
+
}
|
|
10659
|
+
else {
|
|
10660
|
+
resolve();
|
|
10661
|
+
}
|
|
10662
|
+
});
|
|
10663
|
+
};
|
|
10664
|
+
/**
|
|
10665
|
+
* 展开与收起树节点
|
|
10666
|
+
* @param nodeList
|
|
10667
|
+
* @param expanded
|
|
10668
|
+
* @returns
|
|
10669
|
+
*/
|
|
10670
|
+
const handleBaseTreeExpand = (nodeList, expanded) => {
|
|
10671
|
+
const { treeExpandLazyLoadedMaps, treeExpandedMaps } = internalData;
|
|
10672
|
+
const { nodeMaps } = internalData;
|
|
10673
|
+
const childrenField = computeChildrenField.value;
|
|
10674
|
+
const hasChildField = computeHasChildField.value;
|
|
10675
|
+
const treeOpts = computeTreeOpts.value;
|
|
10676
|
+
const { lazy, toggleMethod } = treeOpts;
|
|
10677
|
+
const result = [];
|
|
10678
|
+
let validNodes = toggleMethod ? nodeList.filter((node) => toggleMethod({ $cascader: $xeCascader, expanded, node })) : nodeList;
|
|
10679
|
+
validNodes = validNodes.length ? [validNodes[validNodes.length - 1]] : [];
|
|
10680
|
+
// 同一级只能展开一个
|
|
10681
|
+
const nodeid = getNodeId(validNodes[0]);
|
|
10682
|
+
const nodeItem = nodeMaps[nodeid];
|
|
10683
|
+
if (nodeItem) {
|
|
10684
|
+
nodeItem.items.forEach(item => {
|
|
10685
|
+
const itemNodeId = getNodeId(item);
|
|
10686
|
+
if (treeExpandedMaps[itemNodeId]) {
|
|
10687
|
+
delete treeExpandedMaps[itemNodeId];
|
|
10688
|
+
}
|
|
10689
|
+
});
|
|
10690
|
+
}
|
|
10691
|
+
{
|
|
10692
|
+
validNodes.forEach((item) => {
|
|
10693
|
+
const itemNodeId = getNodeId(item);
|
|
10694
|
+
if (!treeExpandedMaps[itemNodeId]) {
|
|
10695
|
+
const nodeItem = nodeMaps[itemNodeId];
|
|
10696
|
+
const isLoad = lazy && item[hasChildField] && !nodeItem.treeLoaded && !treeExpandLazyLoadedMaps[itemNodeId];
|
|
10697
|
+
// 是否使用懒加载
|
|
10698
|
+
if (isLoad) {
|
|
10699
|
+
result.push(handleAsyncTreeExpandChilds(item));
|
|
10700
|
+
}
|
|
10701
|
+
else {
|
|
10702
|
+
if (item[childrenField] && item[childrenField].length) {
|
|
10703
|
+
treeExpandedMaps[itemNodeId] = true;
|
|
10704
|
+
}
|
|
9753
10705
|
}
|
|
9754
|
-
});
|
|
9755
|
-
}
|
|
9756
|
-
}
|
|
9757
|
-
};
|
|
9758
|
-
const clearCheckedPanelEvent = (params) => {
|
|
9759
|
-
const { $event } = params;
|
|
9760
|
-
const { multiple, autoClose } = props;
|
|
9761
|
-
const $tree = refTree.value;
|
|
9762
|
-
if ($tree) {
|
|
9763
|
-
const value = multiple ? [] : null;
|
|
9764
|
-
$tree.clearCheckboxNode().then(() => {
|
|
9765
|
-
if (autoClose) {
|
|
9766
|
-
hideOptionPanel();
|
|
9767
10706
|
}
|
|
9768
10707
|
});
|
|
9769
|
-
changeEvent($event, value, null);
|
|
9770
|
-
dispatchEvent('clear', { value }, $event);
|
|
9771
10708
|
}
|
|
10709
|
+
reactData.updateExpandedFlag++;
|
|
10710
|
+
handleTreeToList();
|
|
10711
|
+
handleData();
|
|
10712
|
+
return Promise.all(result);
|
|
9772
10713
|
};
|
|
9773
|
-
const
|
|
9774
|
-
const {
|
|
9775
|
-
const
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
10714
|
+
const toggleExpandEvent = (evnt, node, chunks, chunkIndex) => {
|
|
10715
|
+
const { currentItems } = reactData;
|
|
10716
|
+
const { treeExpandLazyLoadedMaps } = internalData;
|
|
10717
|
+
const treeOpts = computeTreeOpts.value;
|
|
10718
|
+
const { lazy } = treeOpts;
|
|
10719
|
+
const stItems = currentItems.slice(0, chunkIndex);
|
|
10720
|
+
const nodeid = getNodeId(node);
|
|
10721
|
+
const expanded = true;
|
|
10722
|
+
evnt.stopPropagation();
|
|
10723
|
+
stItems.push(nodeid);
|
|
10724
|
+
reactData.currentItems = stItems;
|
|
10725
|
+
if (!lazy || !treeExpandLazyLoadedMaps[nodeid]) {
|
|
10726
|
+
handleBaseTreeExpand([node], expanded);
|
|
10727
|
+
}
|
|
10728
|
+
setCurrentNode(node);
|
|
10729
|
+
updateCurrentChunk();
|
|
10730
|
+
dispatchEvent('node-expand', { node, expanded }, evnt);
|
|
10731
|
+
};
|
|
10732
|
+
const updateCheckboxStatus = () => {
|
|
10733
|
+
const { selectCheckboxMaps, indeterminateRowMaps, afterTreeList } = internalData;
|
|
10734
|
+
const childrenField = computeChildrenField.value;
|
|
10735
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
10736
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
10737
|
+
const { checkStrictly, checkMethod } = checkboxOpts;
|
|
10738
|
+
const treeOpts = computeTreeOpts.value;
|
|
10739
|
+
const { transform } = treeOpts;
|
|
10740
|
+
if (!checkStrictly) {
|
|
10741
|
+
const childRowMaps = {};
|
|
10742
|
+
const childRowList = [];
|
|
10743
|
+
XEUtils.eachTree(afterTreeList, (node) => {
|
|
10744
|
+
const nodeid = getNodeId(node);
|
|
10745
|
+
const childList = node[childrenField];
|
|
10746
|
+
if (childList && childList.length && !childRowMaps[nodeid]) {
|
|
10747
|
+
childRowMaps[nodeid] = 1;
|
|
10748
|
+
childRowList.unshift([node, nodeid, childList]);
|
|
10749
|
+
}
|
|
10750
|
+
}, { children: transform ? mapChildrenField : childrenField });
|
|
10751
|
+
childRowList.forEach(vals => {
|
|
10752
|
+
const node = vals[0];
|
|
10753
|
+
const nodeid = vals[1];
|
|
10754
|
+
const childList = vals[2];
|
|
10755
|
+
let sLen = 0; // 已选
|
|
10756
|
+
let hLen = 0; // 半选
|
|
10757
|
+
let vLen = 0; // 有效子行
|
|
10758
|
+
const cLen = childList.length; // 子行
|
|
10759
|
+
childList.forEach(checkMethod
|
|
10760
|
+
? (item) => {
|
|
10761
|
+
const childNodeid = getNodeId(item);
|
|
10762
|
+
const isSelect = selectCheckboxMaps[childNodeid];
|
|
10763
|
+
if (checkMethod({ $cascader: $xeCascader, node: item })) {
|
|
10764
|
+
if (isSelect) {
|
|
10765
|
+
sLen++;
|
|
10766
|
+
}
|
|
10767
|
+
else if (indeterminateRowMaps[childNodeid]) {
|
|
10768
|
+
hLen++;
|
|
10769
|
+
}
|
|
10770
|
+
vLen++;
|
|
10771
|
+
}
|
|
10772
|
+
else {
|
|
10773
|
+
if (isSelect) {
|
|
10774
|
+
sLen++;
|
|
10775
|
+
}
|
|
10776
|
+
else if (indeterminateRowMaps[childNodeid]) {
|
|
10777
|
+
hLen++;
|
|
10778
|
+
}
|
|
10779
|
+
}
|
|
10780
|
+
}
|
|
10781
|
+
: item => {
|
|
10782
|
+
const childNodeid = getNodeId(item);
|
|
10783
|
+
const isSelect = selectCheckboxMaps[childNodeid];
|
|
10784
|
+
if (isSelect) {
|
|
10785
|
+
sLen++;
|
|
10786
|
+
}
|
|
10787
|
+
else if (indeterminateRowMaps[childNodeid]) {
|
|
10788
|
+
hLen++;
|
|
10789
|
+
}
|
|
10790
|
+
vLen++;
|
|
10791
|
+
});
|
|
10792
|
+
let isSelected = false;
|
|
10793
|
+
if (cLen > 0) {
|
|
10794
|
+
if (vLen > 0) {
|
|
10795
|
+
isSelected = (sLen > 0 || hLen > 0) && sLen >= vLen;
|
|
10796
|
+
}
|
|
10797
|
+
else {
|
|
10798
|
+
// 如果存在子项禁用
|
|
10799
|
+
if ((sLen > 0 && sLen >= vLen)) {
|
|
10800
|
+
isSelected = true;
|
|
10801
|
+
}
|
|
10802
|
+
else if (selectCheckboxMaps[nodeid]) {
|
|
10803
|
+
isSelected = true;
|
|
10804
|
+
}
|
|
10805
|
+
else {
|
|
10806
|
+
isSelected = false;
|
|
10807
|
+
}
|
|
10808
|
+
}
|
|
9781
10809
|
}
|
|
9782
10810
|
else {
|
|
9783
|
-
|
|
10811
|
+
// 如果无子项
|
|
10812
|
+
isSelected = selectCheckboxMaps[nodeid];
|
|
9784
10813
|
}
|
|
9785
|
-
|
|
10814
|
+
const halfSelect = !isSelected && (sLen > 0 || hLen > 0);
|
|
10815
|
+
if (isSelected) {
|
|
10816
|
+
selectCheckboxMaps[nodeid] = node;
|
|
10817
|
+
if (indeterminateRowMaps[nodeid]) {
|
|
10818
|
+
delete indeterminateRowMaps[nodeid];
|
|
10819
|
+
}
|
|
10820
|
+
}
|
|
10821
|
+
else {
|
|
10822
|
+
if (selectCheckboxMaps[nodeid]) {
|
|
10823
|
+
delete selectCheckboxMaps[nodeid];
|
|
10824
|
+
}
|
|
10825
|
+
if (halfSelect) {
|
|
10826
|
+
indeterminateRowMaps[nodeid] = node;
|
|
10827
|
+
}
|
|
10828
|
+
else {
|
|
10829
|
+
if (indeterminateRowMaps[nodeid]) {
|
|
10830
|
+
delete indeterminateRowMaps[nodeid];
|
|
10831
|
+
}
|
|
10832
|
+
}
|
|
10833
|
+
}
|
|
10834
|
+
});
|
|
10835
|
+
reactData.updateCheckboxFlag++;
|
|
9786
10836
|
}
|
|
9787
10837
|
};
|
|
9788
|
-
const
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
10838
|
+
const changeCheckboxEvent = (evnt, node) => {
|
|
10839
|
+
evnt.preventDefault();
|
|
10840
|
+
evnt.stopPropagation();
|
|
10841
|
+
const { selectCheckboxMaps, nodeMaps } = internalData;
|
|
10842
|
+
const childrenField = computeChildrenField.value;
|
|
10843
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
10844
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
10845
|
+
const { checkStrictly, checkMode, checkMethod } = checkboxOpts;
|
|
10846
|
+
const treeOpts = computeTreeOpts.value;
|
|
10847
|
+
const { transform } = treeOpts;
|
|
10848
|
+
const nodeid = getNodeId(node);
|
|
10849
|
+
const childList = node[childrenField];
|
|
10850
|
+
const isExistChild = childList && childList.length > 0;
|
|
10851
|
+
const nodeItem = nodeMaps[nodeid] || {};
|
|
10852
|
+
const nLevel = nodeItem.level;
|
|
10853
|
+
const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
|
|
10854
|
+
if (isDisabled) {
|
|
10855
|
+
return;
|
|
9798
10856
|
}
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
if (visiblePanel) {
|
|
9803
|
-
hideOptionPanel();
|
|
10857
|
+
let isChecked = false;
|
|
10858
|
+
if (selectCheckboxMaps[nodeid]) {
|
|
10859
|
+
delete selectCheckboxMaps[nodeid];
|
|
9804
10860
|
}
|
|
9805
|
-
|
|
9806
|
-
|
|
10861
|
+
else {
|
|
10862
|
+
isChecked = true;
|
|
10863
|
+
selectCheckboxMaps[nodeid] = node;
|
|
9807
10864
|
}
|
|
9808
|
-
if (
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
10865
|
+
if (!checkStrictly) {
|
|
10866
|
+
XEUtils.eachTree(XEUtils.get(node, transform ? mapChildrenField : childrenField), (childNode) => {
|
|
10867
|
+
const childNodeid = getNodeId(childNode);
|
|
10868
|
+
if (isChecked) {
|
|
10869
|
+
if (!selectCheckboxMaps[childNodeid]) {
|
|
10870
|
+
selectCheckboxMaps[childNodeid] = true;
|
|
10871
|
+
}
|
|
10872
|
+
}
|
|
10873
|
+
else {
|
|
10874
|
+
if (selectCheckboxMaps[childNodeid]) {
|
|
10875
|
+
delete selectCheckboxMaps[childNodeid];
|
|
10876
|
+
}
|
|
10877
|
+
}
|
|
10878
|
+
}, { children: transform ? mapChildrenField : childrenField });
|
|
9813
10879
|
}
|
|
10880
|
+
reactData.updateCheckboxFlag++;
|
|
10881
|
+
updateCheckboxStatus();
|
|
10882
|
+
const nodeids = XEUtils.keys(selectCheckboxMaps);
|
|
10883
|
+
const value = nodeids;
|
|
10884
|
+
changeEvent(evnt, value, node);
|
|
9814
10885
|
};
|
|
9815
|
-
const
|
|
9816
|
-
const {
|
|
9817
|
-
|
|
9818
|
-
|
|
10886
|
+
const handleNodeClickEvent = (evnt, node, chunks, chunkIndex) => {
|
|
10887
|
+
const { multiple } = props;
|
|
10888
|
+
const treeOpts = computeTreeOpts.value;
|
|
10889
|
+
const radioOpts = computeRadioOpts.value;
|
|
10890
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
10891
|
+
const childrenField = computeChildrenField.value;
|
|
10892
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
10893
|
+
const { transform, trigger } = treeOpts;
|
|
10894
|
+
const childList = node[transform ? mapChildrenField : childrenField];
|
|
10895
|
+
let triggerCurrent = false;
|
|
10896
|
+
let triggerRadio = false;
|
|
10897
|
+
let triggerCheckbox = false;
|
|
10898
|
+
let triggerExpand = false;
|
|
10899
|
+
triggerCurrent = true;
|
|
10900
|
+
changeCurrentEvent(evnt, node);
|
|
10901
|
+
if (trigger !== 'icon') {
|
|
10902
|
+
triggerExpand = true;
|
|
10903
|
+
toggleExpandEvent(evnt, node, chunks, chunkIndex);
|
|
9819
10904
|
}
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
if (inpSearch) {
|
|
9826
|
-
inpSearch.focus();
|
|
9827
|
-
}
|
|
9828
|
-
});
|
|
10905
|
+
if (multiple) {
|
|
10906
|
+
if (checkboxOpts.trigger === 'node' || (!checkboxOpts.showIcon && (!childList || !childList.length))) {
|
|
10907
|
+
triggerCheckbox = true;
|
|
10908
|
+
changeCheckboxEvent(evnt, node);
|
|
10909
|
+
}
|
|
9829
10910
|
}
|
|
10911
|
+
else {
|
|
10912
|
+
if (radioOpts.trigger === 'node' || (!radioOpts.showIcon && (!childList || !childList.length))) {
|
|
10913
|
+
triggerRadio = true;
|
|
10914
|
+
changeRadioEvent(evnt, node);
|
|
10915
|
+
}
|
|
10916
|
+
}
|
|
10917
|
+
dispatchEvent('node-click', { node, triggerCurrent, triggerRadio, triggerCheckbox, triggerExpand }, evnt);
|
|
9830
10918
|
};
|
|
9831
10919
|
const focusEvent = (evnt) => {
|
|
9832
10920
|
const isDisabled = computeIsDisabled.value;
|
|
9833
10921
|
if (!isDisabled) {
|
|
9834
10922
|
if (!reactData.visiblePanel) {
|
|
9835
10923
|
reactData.triggerFocusPanel = true;
|
|
9836
|
-
showOptionPanel();
|
|
10924
|
+
showOptionPanel(evnt);
|
|
9837
10925
|
setTimeout(() => {
|
|
9838
10926
|
reactData.triggerFocusPanel = false;
|
|
9839
10927
|
}, 150);
|
|
@@ -9842,7 +10930,15 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9842
10930
|
dispatchEvent('focus', {}, evnt);
|
|
9843
10931
|
};
|
|
9844
10932
|
const clickEvent = (evnt) => {
|
|
9845
|
-
|
|
10933
|
+
evnt.preventDefault();
|
|
10934
|
+
if (reactData.triggerFocusPanel) {
|
|
10935
|
+
reactData.triggerFocusPanel = false;
|
|
10936
|
+
}
|
|
10937
|
+
else {
|
|
10938
|
+
if (!reactData.visiblePanel) {
|
|
10939
|
+
showOptionPanel(evnt);
|
|
10940
|
+
}
|
|
10941
|
+
}
|
|
9846
10942
|
dispatchEvent('click', {}, evnt);
|
|
9847
10943
|
};
|
|
9848
10944
|
const blurEvent = (evnt) => {
|
|
@@ -9851,12 +10947,13 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9851
10947
|
};
|
|
9852
10948
|
const modelSearchEvent = (value) => {
|
|
9853
10949
|
reactData.searchValue = value;
|
|
10950
|
+
triggerSearchEvent(new Event('filter'));
|
|
9854
10951
|
};
|
|
9855
10952
|
const handleSearchEvent = () => {
|
|
9856
|
-
const { modelValue, remote
|
|
10953
|
+
const { modelValue, remote } = props;
|
|
9857
10954
|
const { searchValue } = reactData;
|
|
9858
10955
|
const remoteOpts = computeRemoteOpts.value;
|
|
9859
|
-
const queryMethod = remoteOpts.queryMethod
|
|
10956
|
+
const queryMethod = remoteOpts.queryMethod;
|
|
9860
10957
|
if (remote && queryMethod && remoteOpts.enabled) {
|
|
9861
10958
|
reactData.searchLoading = true;
|
|
9862
10959
|
Promise.resolve(queryMethod({ $cascader: $xeCascader, searchValue, value: modelValue })).then(() => nextTick())
|
|
@@ -9874,18 +10971,211 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9874
10971
|
}
|
|
9875
10972
|
else {
|
|
9876
10973
|
if (reactData.visiblePanel) {
|
|
9877
|
-
hideOptionPanel();
|
|
10974
|
+
hideOptionPanel($event);
|
|
9878
10975
|
}
|
|
9879
10976
|
else {
|
|
9880
|
-
showOptionPanel();
|
|
10977
|
+
showOptionPanel($event);
|
|
10978
|
+
}
|
|
10979
|
+
}
|
|
10980
|
+
};
|
|
10981
|
+
const cascaderPrivateMethods = {
|
|
10982
|
+
isCheckedByCheckboxNodeId,
|
|
10983
|
+
/**
|
|
10984
|
+
* 用于树结构,给行数据加载子节点
|
|
10985
|
+
*/
|
|
10986
|
+
loadChildrenNode(node, childRecords) {
|
|
10987
|
+
const { separator } = props;
|
|
10988
|
+
const { nodeMaps } = internalData;
|
|
10989
|
+
const treeOpts = computeTreeOpts.value;
|
|
10990
|
+
const labelField = computeLabelField.value;
|
|
10991
|
+
const { lazy, transform } = treeOpts;
|
|
10992
|
+
if (!lazy) {
|
|
10993
|
+
return Promise.resolve([]);
|
|
9881
10994
|
}
|
|
10995
|
+
const childrenField = computeChildrenField.value;
|
|
10996
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
10997
|
+
const parentNodeItem = nodeMaps[getNodeId(node)];
|
|
10998
|
+
const parentLevel = parentNodeItem ? parentNodeItem.level : 0;
|
|
10999
|
+
const parentNodes = parentNodeItem ? parentNodeItem.nodes : [];
|
|
11000
|
+
return createNode(childRecords).then((nodeList) => {
|
|
11001
|
+
XEUtils.eachTree(nodeList, (childRow, index, items, path, parent, nodes) => {
|
|
11002
|
+
const itemNodeId = getNodeId(childRow);
|
|
11003
|
+
nodeMaps[itemNodeId] = {
|
|
11004
|
+
item: childRow,
|
|
11005
|
+
index: -1,
|
|
11006
|
+
$index: -1,
|
|
11007
|
+
_index: -1,
|
|
11008
|
+
items,
|
|
11009
|
+
parent: parent || parentNodeItem.item,
|
|
11010
|
+
nodes: parentNodes.concat(nodes),
|
|
11011
|
+
level: parentLevel + nodes.length,
|
|
11012
|
+
treeIndex: -1,
|
|
11013
|
+
lineCount: 0,
|
|
11014
|
+
treeLoaded: false,
|
|
11015
|
+
fullLabel: nodes.map(item => item[labelField]).join((separator || ' / '))
|
|
11016
|
+
};
|
|
11017
|
+
}, { children: childrenField });
|
|
11018
|
+
node[childrenField] = nodeList;
|
|
11019
|
+
if (transform) {
|
|
11020
|
+
node[mapChildrenField] = nodeList;
|
|
11021
|
+
}
|
|
11022
|
+
updateAfterDataIndex();
|
|
11023
|
+
return nodeList;
|
|
11024
|
+
});
|
|
9882
11025
|
}
|
|
9883
11026
|
};
|
|
9884
|
-
const cascaderPrivateMethods = {};
|
|
9885
11027
|
Object.assign($xeCascader, cascaderMethods, cascaderPrivateMethods);
|
|
11028
|
+
const handleVisibleOrCheckMode = (mode, isExistChild, nLevel) => {
|
|
11029
|
+
if (mode) {
|
|
11030
|
+
if (mode === 'first') {
|
|
11031
|
+
return !nLevel;
|
|
11032
|
+
}
|
|
11033
|
+
if (mode === 'last') {
|
|
11034
|
+
return !isExistChild;
|
|
11035
|
+
}
|
|
11036
|
+
}
|
|
11037
|
+
return true;
|
|
11038
|
+
};
|
|
11039
|
+
const renderRadio = (node, isExistChild, nLevel, isChecked) => {
|
|
11040
|
+
const radioOpts = computeRadioOpts.value;
|
|
11041
|
+
const { showIcon, checkMode, checkMethod, visibleMode, visibleMethod } = radioOpts;
|
|
11042
|
+
const isVisible = visibleMethod ? visibleMethod({ $cascader: $xeCascader, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
|
|
11043
|
+
if (showIcon && isVisible) {
|
|
11044
|
+
const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
|
|
11045
|
+
return h('div', {
|
|
11046
|
+
class: ['vxe-tree--radio-option', {
|
|
11047
|
+
'is--checked': isChecked,
|
|
11048
|
+
'is--disabled': isDisabled
|
|
11049
|
+
}],
|
|
11050
|
+
onClick: (evnt) => {
|
|
11051
|
+
if (!isDisabled) {
|
|
11052
|
+
changeRadioEvent(evnt, node);
|
|
11053
|
+
}
|
|
11054
|
+
}
|
|
11055
|
+
}, [
|
|
11056
|
+
h('span', {
|
|
11057
|
+
class: ['vxe-radio--icon', isChecked ? getIcon$2().RADIO_CHECKED : getIcon$2().RADIO_UNCHECKED]
|
|
11058
|
+
})
|
|
11059
|
+
]);
|
|
11060
|
+
}
|
|
11061
|
+
return renderEmptyElement($xeCascader);
|
|
11062
|
+
};
|
|
11063
|
+
const renderCheckbox = (node, isExistChild, nLevel, isChecked, isIndeterminate) => {
|
|
11064
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
11065
|
+
const { showIcon, checkMode, checkMethod, visibleMode, visibleMethod } = checkboxOpts;
|
|
11066
|
+
const isVisible = visibleMethod ? visibleMethod({ $cascader: $xeCascader, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel);
|
|
11067
|
+
if (showIcon && isVisible) {
|
|
11068
|
+
const isDisabled = checkMethod ? !checkMethod({ $cascader: $xeCascader, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel);
|
|
11069
|
+
return h('div', {
|
|
11070
|
+
class: ['vxe-cascader--checkbox-option', {
|
|
11071
|
+
'is--checked': isChecked,
|
|
11072
|
+
'is--indeterminate': isIndeterminate,
|
|
11073
|
+
'is--disabled': isDisabled
|
|
11074
|
+
}],
|
|
11075
|
+
onClick: (evnt) => {
|
|
11076
|
+
if (!isDisabled) {
|
|
11077
|
+
changeCheckboxEvent(evnt, node);
|
|
11078
|
+
}
|
|
11079
|
+
}
|
|
11080
|
+
}, [
|
|
11081
|
+
h('span', {
|
|
11082
|
+
class: ['vxe-checkbox--icon', isIndeterminate ? getIcon$2().CHECKBOX_INDETERMINATE : (isChecked ? getIcon$2().CHECKBOX_CHECKED : getIcon$2().CHECKBOX_UNCHECKED)]
|
|
11083
|
+
})
|
|
11084
|
+
]);
|
|
11085
|
+
}
|
|
11086
|
+
return renderEmptyElement($xeCascader);
|
|
11087
|
+
};
|
|
11088
|
+
const renderNode = (node, nodeid, nodeIndex, chunks, chunkIndex) => {
|
|
11089
|
+
const { multiple } = props;
|
|
11090
|
+
const { currentNode, selectRadioKey, updateCheckboxFlag, updateExpandedFlag } = reactData;
|
|
11091
|
+
const { nodeMaps, selectCheckboxMaps, indeterminateRowMaps, treeExpandedMaps, treeExpandLazyLoadedMaps } = internalData;
|
|
11092
|
+
const treeOpts = computeTreeOpts.value;
|
|
11093
|
+
const { lazy, iconLoaded, iconOpen, iconClose } = treeOpts;
|
|
11094
|
+
const childrenField = computeChildrenField.value;
|
|
11095
|
+
const labelField = computeLabelField.value;
|
|
11096
|
+
const hasChildField = computeHasChildField.value;
|
|
11097
|
+
const childList = node[childrenField];
|
|
11098
|
+
const isExistChild = childList && childList.length > 0;
|
|
11099
|
+
const iconSlot = slots.icon;
|
|
11100
|
+
const titleSlot = slots.title;
|
|
11101
|
+
const isExpand = updateExpandedFlag && treeExpandedMaps[nodeid];
|
|
11102
|
+
const nodeItem = nodeMaps[nodeid] || {};
|
|
11103
|
+
const nodeTitle = node[labelField];
|
|
11104
|
+
const nLevel = nodeItem.level;
|
|
11105
|
+
let isRadioChecked = false;
|
|
11106
|
+
if (!multiple) {
|
|
11107
|
+
isRadioChecked = nodeid === selectRadioKey;
|
|
11108
|
+
}
|
|
11109
|
+
let isCheckboxChecked = false;
|
|
11110
|
+
let isIndeterminate = false;
|
|
11111
|
+
if (multiple) {
|
|
11112
|
+
isCheckboxChecked = !!(updateCheckboxFlag && selectCheckboxMaps[nodeid]);
|
|
11113
|
+
isIndeterminate = !!(updateCheckboxFlag && indeterminateRowMaps[nodeid]);
|
|
11114
|
+
}
|
|
11115
|
+
let hasLazyChilds = false;
|
|
11116
|
+
let isLazyLoading = false;
|
|
11117
|
+
let isLazyLoaded = false;
|
|
11118
|
+
if (lazy) {
|
|
11119
|
+
isLazyLoading = !!treeExpandLazyLoadedMaps[nodeid];
|
|
11120
|
+
hasLazyChilds = node[hasChildField];
|
|
11121
|
+
isLazyLoaded = !!nodeItem.treeLoaded;
|
|
11122
|
+
}
|
|
11123
|
+
const nParams = { node };
|
|
11124
|
+
return h('div', {
|
|
11125
|
+
key: `${chunkIndex}_${nodeIndex}`,
|
|
11126
|
+
class: ['vxe-cascader-chunk--node-item', {
|
|
11127
|
+
'is--current': currentNode && (currentNode === node || getNodeId(currentNode) === nodeid),
|
|
11128
|
+
'is-radio--checked': isRadioChecked,
|
|
11129
|
+
'is-checkbox--checked': isCheckboxChecked,
|
|
11130
|
+
'is-checkbox--indeterminate': isIndeterminate,
|
|
11131
|
+
'is--expand': isExpand
|
|
11132
|
+
}],
|
|
11133
|
+
title: nodeTitle,
|
|
11134
|
+
onMousedown: (evnt) => {
|
|
11135
|
+
const isLeftBtn = evnt.button === 0;
|
|
11136
|
+
if (isLeftBtn) {
|
|
11137
|
+
evnt.stopPropagation();
|
|
11138
|
+
}
|
|
11139
|
+
},
|
|
11140
|
+
onClick(evnt) {
|
|
11141
|
+
handleNodeClickEvent(evnt, node, chunks, chunkIndex);
|
|
11142
|
+
}
|
|
11143
|
+
}, [
|
|
11144
|
+
multiple ? renderCheckbox(node, isExistChild, nLevel, isCheckboxChecked, isIndeterminate) : renderRadio(node, isExistChild, nLevel, isRadioChecked),
|
|
11145
|
+
h('div', {
|
|
11146
|
+
class: 'vxe-cascader-chunk--node-item-inner'
|
|
11147
|
+
}, [
|
|
11148
|
+
h('div', {
|
|
11149
|
+
class: 'vxe-cascader-chunk--node-item-title'
|
|
11150
|
+
}, titleSlot ? getSlotVNs$1(titleSlot(nParams)) : nodeTitle)
|
|
11151
|
+
]),
|
|
11152
|
+
treeOpts.showIcon && (lazy ? (isLazyLoaded ? isExistChild : hasLazyChilds) : isExistChild)
|
|
11153
|
+
? h('div', {
|
|
11154
|
+
class: 'vxe-cascader-chunk--node-item-switcher'
|
|
11155
|
+
}, [
|
|
11156
|
+
[
|
|
11157
|
+
h('div', {
|
|
11158
|
+
class: 'vxe-cascader--node-item-icon',
|
|
11159
|
+
onClick(evnt) {
|
|
11160
|
+
if (treeOpts.trigger === 'icon') {
|
|
11161
|
+
toggleExpandEvent(evnt, node, chunks, chunkIndex);
|
|
11162
|
+
}
|
|
11163
|
+
}
|
|
11164
|
+
}, iconSlot
|
|
11165
|
+
? getSlotVNs$1(iconSlot(nParams))
|
|
11166
|
+
: [
|
|
11167
|
+
h('i', {
|
|
11168
|
+
class: isLazyLoading ? (iconLoaded || getIcon$2().CASCADER_NODE_LOADED) : (isExpand ? (iconOpen || getIcon$2().CASCADER_NODE_OPEN) : (iconClose || getIcon$2().CASCADER_NODE_CLOSE))
|
|
11169
|
+
})
|
|
11170
|
+
])
|
|
11171
|
+
]
|
|
11172
|
+
])
|
|
11173
|
+
: renderEmptyElement($xeCascader)
|
|
11174
|
+
]);
|
|
11175
|
+
};
|
|
9886
11176
|
const renderVN = () => {
|
|
9887
|
-
const { className, modelValue, multiple, loading, filterable, showTotalButton, showCheckedButton, showClearButton } = props;
|
|
9888
|
-
const { initialized, isActivated, isAniVisible, visiblePanel, searchValue } = reactData;
|
|
11177
|
+
const { className, modelValue, multiple, loading, filterable, showTotalButton, showCheckedButton, showClearButton, showCloseButton } = props;
|
|
11178
|
+
const { initialized, isActivated, isAniVisible, visiblePanel, searchValue, currentCunkList } = reactData;
|
|
9889
11179
|
const vSize = computeSize.value;
|
|
9890
11180
|
const isDisabled = computeIsDisabled.value;
|
|
9891
11181
|
const selectLabel = computeSelectLabel.value;
|
|
@@ -9953,7 +11243,7 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9953
11243
|
'ani--enter': !loading && visiblePanel
|
|
9954
11244
|
}],
|
|
9955
11245
|
placement: reactData.panelPlacement,
|
|
9956
|
-
style:
|
|
11246
|
+
style: popupWrapperStyle
|
|
9957
11247
|
}, initialized
|
|
9958
11248
|
? [
|
|
9959
11249
|
h('div', {
|
|
@@ -9976,38 +11266,35 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
9976
11266
|
})
|
|
9977
11267
|
])
|
|
9978
11268
|
: renderEmptyElement($xeCascader),
|
|
9979
|
-
|
|
11269
|
+
(showCheckedButton && multiple) || showClearButton || headerSlot
|
|
9980
11270
|
? h('div', {
|
|
9981
|
-
class: 'vxe-
|
|
11271
|
+
class: 'vxe-tree-select--panel-header'
|
|
9982
11272
|
}, headerSlot
|
|
9983
11273
|
? headerSlot({})
|
|
9984
11274
|
: [
|
|
9985
11275
|
h('div', {
|
|
9986
|
-
class: 'vxe-
|
|
11276
|
+
class: 'vxe-tree-select--header-button'
|
|
9987
11277
|
}, [
|
|
9988
|
-
|
|
11278
|
+
showCheckedButton && showClearButton
|
|
9989
11279
|
? h('div', {
|
|
9990
|
-
class: 'vxe-
|
|
9991
|
-
},
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
})
|
|
10009
|
-
: renderEmptyElement($xeCascader)
|
|
10010
|
-
])
|
|
11280
|
+
class: 'vxe-tree-select--selected-btns'
|
|
11281
|
+
}, [
|
|
11282
|
+
(showCheckedButton && multiple)
|
|
11283
|
+
? h(VxeButtonComponent, {
|
|
11284
|
+
content: getI18n$2('vxe.treeSelect.allChecked'),
|
|
11285
|
+
mode: 'text',
|
|
11286
|
+
onClick: allCheckedPanelEvent
|
|
11287
|
+
})
|
|
11288
|
+
: renderEmptyElement($xeCascader),
|
|
11289
|
+
showClearButton
|
|
11290
|
+
? h(VxeButtonComponent, {
|
|
11291
|
+
content: getI18n$2('vxe.treeSelect.clearChecked'),
|
|
11292
|
+
mode: 'text',
|
|
11293
|
+
onClick: clearCheckedPanelEvent
|
|
11294
|
+
})
|
|
11295
|
+
: renderEmptyElement($xeCascader)
|
|
11296
|
+
])
|
|
11297
|
+
: renderEmptyElement($xeCascader)
|
|
10011
11298
|
])
|
|
10012
11299
|
])
|
|
10013
11300
|
: renderEmptyElement($xeCascader),
|
|
@@ -10015,15 +11302,56 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
10015
11302
|
class: 'vxe-cascader--panel-body'
|
|
10016
11303
|
}, [
|
|
10017
11304
|
h('div', {
|
|
10018
|
-
ref:
|
|
10019
|
-
class: 'vxe-cascader-
|
|
10020
|
-
|
|
10021
|
-
|
|
11305
|
+
ref: refChunkWrapper,
|
|
11306
|
+
class: 'vxe-cascader-chunk--wrapper'
|
|
11307
|
+
}, [
|
|
11308
|
+
currentCunkList.map((chunks, chunkIndex) => {
|
|
11309
|
+
return h('div', {
|
|
11310
|
+
key: chunkIndex,
|
|
11311
|
+
class: 'vxe-cascader-chunk--item-wrapper'
|
|
11312
|
+
}, [
|
|
11313
|
+
h(VxeListComponent, {
|
|
11314
|
+
data: chunks
|
|
11315
|
+
}, {
|
|
11316
|
+
default(slotParams) {
|
|
11317
|
+
const { items } = slotParams;
|
|
11318
|
+
return items.map((node, nodeIndex) => {
|
|
11319
|
+
const nodeid = getNodeId(node);
|
|
11320
|
+
return renderNode(node, nodeid, nodeIndex, chunks, chunkIndex);
|
|
11321
|
+
});
|
|
11322
|
+
}
|
|
11323
|
+
})
|
|
11324
|
+
]);
|
|
11325
|
+
})
|
|
11326
|
+
])
|
|
10022
11327
|
]),
|
|
10023
|
-
footerSlot
|
|
11328
|
+
footerSlot || showTotalButton || (showCloseButton && multiple)
|
|
10024
11329
|
? h('div', {
|
|
10025
11330
|
class: 'vxe-cascader--panel-footer'
|
|
10026
|
-
}, footerSlot
|
|
11331
|
+
}, footerSlot
|
|
11332
|
+
? footerSlot({})
|
|
11333
|
+
: [
|
|
11334
|
+
h('div', {
|
|
11335
|
+
class: 'vxe-cascader--footer-button'
|
|
11336
|
+
}, [
|
|
11337
|
+
showTotalButton
|
|
11338
|
+
? h('div', {
|
|
11339
|
+
class: 'vxe-cascader--total-btns'
|
|
11340
|
+
}, getI18n$2('vxe.treeSelect.total', [selectVals.length]))
|
|
11341
|
+
: renderEmptyElement($xeCascader),
|
|
11342
|
+
showCloseButton && multiple
|
|
11343
|
+
? h('div', {
|
|
11344
|
+
class: 'vxe-cascader--oper-btns'
|
|
11345
|
+
}, [
|
|
11346
|
+
h(VxeButtonComponent, {
|
|
11347
|
+
content: getI18n$2('vxe.select.close'),
|
|
11348
|
+
mode: 'text',
|
|
11349
|
+
onClick: closePanelEvent
|
|
11350
|
+
})
|
|
11351
|
+
])
|
|
11352
|
+
: renderEmptyElement($xeCascader)
|
|
11353
|
+
])
|
|
11354
|
+
])
|
|
10027
11355
|
: renderEmptyElement($xeCascader)
|
|
10028
11356
|
])
|
|
10029
11357
|
]
|
|
@@ -10031,11 +11359,30 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
10031
11359
|
])
|
|
10032
11360
|
]);
|
|
10033
11361
|
};
|
|
11362
|
+
watch(() => props.modelValue, () => {
|
|
11363
|
+
if (!reactData.visiblePanel) {
|
|
11364
|
+
handleCurrentItems();
|
|
11365
|
+
updateCurrentChunk();
|
|
11366
|
+
}
|
|
11367
|
+
});
|
|
10034
11368
|
watch(() => props.options, () => {
|
|
10035
|
-
|
|
11369
|
+
cacheNodeMap();
|
|
10036
11370
|
});
|
|
10037
|
-
|
|
11371
|
+
const dataFlag = ref(0);
|
|
11372
|
+
watch(() => props.options ? props.options.length : 0, () => {
|
|
11373
|
+
dataFlag.value++;
|
|
11374
|
+
});
|
|
11375
|
+
watch(() => props.options, () => {
|
|
11376
|
+
dataFlag.value++;
|
|
11377
|
+
});
|
|
11378
|
+
watch(dataFlag, () => {
|
|
11379
|
+
loadData(props.options || []);
|
|
11380
|
+
});
|
|
11381
|
+
loadData(props.options || []);
|
|
10038
11382
|
onMounted(() => {
|
|
11383
|
+
if (props.filterable) {
|
|
11384
|
+
errLog('vxe.error.notProp', ['filterable']);
|
|
11385
|
+
}
|
|
10039
11386
|
globalEvents.on($xeCascader, 'mousewheel', handleGlobalMousewheelEvent);
|
|
10040
11387
|
globalEvents.on($xeCascader, 'mousedown', handleGlobalMousedownEvent);
|
|
10041
11388
|
globalEvents.on($xeCascader, 'blur', handleGlobalBlurEvent);
|
|
@@ -10046,7 +11393,7 @@ var VxeCascaderComponent = defineVxeComponent({
|
|
|
10046
11393
|
globalEvents.off($xeCascader, 'mousedown');
|
|
10047
11394
|
globalEvents.off($xeCascader, 'blur');
|
|
10048
11395
|
globalEvents.off($xeCascader, 'resize');
|
|
10049
|
-
XEUtils.assign(internalData, createInternalData$
|
|
11396
|
+
XEUtils.assign(internalData, createInternalData$b());
|
|
10050
11397
|
});
|
|
10051
11398
|
provide('$xeCascader', $xeCascader);
|
|
10052
11399
|
$xeCascader.renderVN = renderVN;
|
|
@@ -10379,7 +11726,7 @@ dynamicApp.use(VxeCheckboxButton);
|
|
|
10379
11726
|
VxeUI.component(VxeCheckboxButtonComponent);
|
|
10380
11727
|
const CheckboxButton = VxeCheckboxButton;
|
|
10381
11728
|
|
|
10382
|
-
function createInternalData$
|
|
11729
|
+
function createInternalData$a() {
|
|
10383
11730
|
return {
|
|
10384
11731
|
// isLoaded: false
|
|
10385
11732
|
};
|
|
@@ -10419,7 +11766,7 @@ var VxeCheckboxGroupComponent = defineVxeComponent({
|
|
|
10419
11766
|
const formItemInfo = inject('xeFormItemInfo', null);
|
|
10420
11767
|
const xID = XEUtils.uniqueId();
|
|
10421
11768
|
const reactData = reactive({});
|
|
10422
|
-
const internalData = createInternalData$
|
|
11769
|
+
const internalData = createInternalData$a();
|
|
10423
11770
|
const computeIsReadonly = computed(() => {
|
|
10424
11771
|
const { readonly } = props;
|
|
10425
11772
|
if (readonly === null) {
|
|
@@ -10578,7 +11925,7 @@ var VxeCheckboxGroupComponent = defineVxeComponent({
|
|
|
10578
11925
|
});
|
|
10579
11926
|
});
|
|
10580
11927
|
onUnmounted(() => {
|
|
10581
|
-
XEUtils.assign(internalData, createInternalData$
|
|
11928
|
+
XEUtils.assign(internalData, createInternalData$a());
|
|
10582
11929
|
});
|
|
10583
11930
|
provide('$xeCheckboxGroup', $xeCheckboxGroup);
|
|
10584
11931
|
$xeCheckboxGroup.renderVN = renderVN;
|
|
@@ -11322,7 +12669,7 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11322
12669
|
// float
|
|
11323
12670
|
roundingMode: {
|
|
11324
12671
|
type: String,
|
|
11325
|
-
default:
|
|
12672
|
+
default: () => getConfig$3().numberInput.roundingMode
|
|
11326
12673
|
},
|
|
11327
12674
|
// float
|
|
11328
12675
|
digits: {
|
|
@@ -11568,13 +12915,13 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11568
12915
|
return `${val}`;
|
|
11569
12916
|
};
|
|
11570
12917
|
const getNumberValue = (val) => {
|
|
11571
|
-
const { exponential, roundingMode, autoFill } = props;
|
|
12918
|
+
const { type, exponential, roundingMode, autoFill } = props;
|
|
11572
12919
|
const inpMaxLength = computeInpMaxLength.value;
|
|
11573
12920
|
const digitsValue = computeDigitsValue.value;
|
|
11574
12921
|
const decimalsType = computeDecimalsType.value;
|
|
11575
12922
|
let restVal = '';
|
|
11576
12923
|
if (decimalsType) {
|
|
11577
|
-
restVal = toFloatValueFixed(val, digitsValue, roundingMode);
|
|
12924
|
+
restVal = toFloatValueFixed(val, type, digitsValue, roundingMode);
|
|
11578
12925
|
if (!autoFill) {
|
|
11579
12926
|
restVal = handleNumberString(XEUtils.toNumber(restVal));
|
|
11580
12927
|
}
|
|
@@ -11666,7 +13013,7 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11666
13013
|
}
|
|
11667
13014
|
};
|
|
11668
13015
|
const updateModel = (val) => {
|
|
11669
|
-
const { roundingMode, autoFill } = props;
|
|
13016
|
+
const { type, roundingMode, autoFill } = props;
|
|
11670
13017
|
const { inputValue } = reactData;
|
|
11671
13018
|
const digitsValue = computeDigitsValue.value;
|
|
11672
13019
|
const decimalsType = computeDecimalsType.value;
|
|
@@ -11676,7 +13023,7 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11676
13023
|
else {
|
|
11677
13024
|
let textValue = '' + val;
|
|
11678
13025
|
if (decimalsType) {
|
|
11679
|
-
textValue = toFloatValueFixed(val, digitsValue, roundingMode);
|
|
13026
|
+
textValue = toFloatValueFixed(val, type, digitsValue, roundingMode);
|
|
11680
13027
|
if (!autoFill) {
|
|
11681
13028
|
textValue = '' + XEUtils.toNumber(textValue);
|
|
11682
13029
|
}
|
|
@@ -11690,7 +13037,7 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11690
13037
|
* 检查初始值
|
|
11691
13038
|
*/
|
|
11692
13039
|
const initValue = () => {
|
|
11693
|
-
const { roundingMode, autoFill } = props;
|
|
13040
|
+
const { type, roundingMode, autoFill } = props;
|
|
11694
13041
|
const { inputValue } = reactData;
|
|
11695
13042
|
const digitsValue = computeDigitsValue.value;
|
|
11696
13043
|
const decimalsType = computeDecimalsType.value;
|
|
@@ -11699,7 +13046,7 @@ var VxeNumberInputComponent = defineVxeComponent({
|
|
|
11699
13046
|
let textValue = '';
|
|
11700
13047
|
let validValue = null;
|
|
11701
13048
|
if (inputValue) {
|
|
11702
|
-
textValue = toFloatValueFixed(inputValue, digitsValue, roundingMode);
|
|
13049
|
+
textValue = toFloatValueFixed(inputValue, type, digitsValue, roundingMode);
|
|
11703
13050
|
validValue = XEUtils.toNumber(textValue);
|
|
11704
13051
|
if (!autoFill) {
|
|
11705
13052
|
textValue = `${validValue}`;
|
|
@@ -13321,12 +14668,12 @@ dynamicApp.use(VxeColorPicker);
|
|
|
13321
14668
|
VxeUI.component(VxeColorPickerComponent);
|
|
13322
14669
|
const ColorPicker = VxeColorPicker;
|
|
13323
14670
|
|
|
13324
|
-
function createInternalData$
|
|
14671
|
+
function createInternalData$9() {
|
|
13325
14672
|
return {
|
|
13326
14673
|
// leaveTime: null
|
|
13327
14674
|
};
|
|
13328
14675
|
}
|
|
13329
|
-
function createReactData$
|
|
14676
|
+
function createReactData$7() {
|
|
13330
14677
|
return {
|
|
13331
14678
|
visible: false,
|
|
13332
14679
|
activeOption: null,
|
|
@@ -13381,8 +14728,8 @@ var VxeContextMenuComponent = defineVxeComponent({
|
|
|
13381
14728
|
const xID = XEUtils.uniqueId();
|
|
13382
14729
|
const refElem = ref();
|
|
13383
14730
|
const { computeSize } = useSize(props);
|
|
13384
|
-
const internalData = createInternalData$
|
|
13385
|
-
const reactData = reactive(createReactData$
|
|
14731
|
+
const internalData = createInternalData$9();
|
|
14732
|
+
const reactData = reactive(createReactData$7());
|
|
13386
14733
|
const refMaps = {
|
|
13387
14734
|
refElem
|
|
13388
14735
|
};
|
|
@@ -13937,8 +15284,8 @@ var VxeContextMenuComponent = defineVxeComponent({
|
|
|
13937
15284
|
globalEvents.off($xeContextMenu, 'keydown');
|
|
13938
15285
|
globalEvents.off($xeContextMenu, 'mousedown');
|
|
13939
15286
|
globalEvents.off($xeContextMenu, 'blur');
|
|
13940
|
-
XEUtils.assign(reactData, createReactData$
|
|
13941
|
-
XEUtils.assign(internalData, createInternalData$
|
|
15287
|
+
XEUtils.assign(reactData, createReactData$7());
|
|
15288
|
+
XEUtils.assign(internalData, createInternalData$9());
|
|
13942
15289
|
});
|
|
13943
15290
|
$xeContextMenu.renderVN = renderVN;
|
|
13944
15291
|
return $xeContextMenu;
|
|
@@ -20628,7 +21975,7 @@ function checkRuleStatus(rule, data, val) {
|
|
|
20628
21975
|
}
|
|
20629
21976
|
return true;
|
|
20630
21977
|
}
|
|
20631
|
-
function createReactData$
|
|
21978
|
+
function createReactData$6() {
|
|
20632
21979
|
return {
|
|
20633
21980
|
collapseAll: false,
|
|
20634
21981
|
staticItems: [],
|
|
@@ -20636,7 +21983,7 @@ function createReactData$7() {
|
|
|
20636
21983
|
itemWidth: 0
|
|
20637
21984
|
};
|
|
20638
21985
|
}
|
|
20639
|
-
function createInternalData$
|
|
21986
|
+
function createInternalData$8() {
|
|
20640
21987
|
return {
|
|
20641
21988
|
meTimeout: undefined,
|
|
20642
21989
|
stTimeout: undefined,
|
|
@@ -20745,8 +22092,8 @@ var VxeFormComponent = defineVxeComponent({
|
|
|
20745
22092
|
const $xeGrid = inject('$xeGrid', null);
|
|
20746
22093
|
const xID = XEUtils.uniqueId();
|
|
20747
22094
|
const { computeSize } = useSize(props);
|
|
20748
|
-
const reactData = reactive(createReactData$
|
|
20749
|
-
const internalData = createInternalData$
|
|
22095
|
+
const reactData = reactive(createReactData$6());
|
|
22096
|
+
const internalData = createInternalData$8();
|
|
20750
22097
|
const refElem = ref();
|
|
20751
22098
|
const refTooltip = ref();
|
|
20752
22099
|
let formMethods = {};
|
|
@@ -21440,7 +22787,7 @@ var VxeFormComponent = defineVxeComponent({
|
|
|
21440
22787
|
});
|
|
21441
22788
|
onUnmounted(() => {
|
|
21442
22789
|
globalEvents.off($xeForm, 'resize');
|
|
21443
|
-
XEUtils.assign(internalData, createInternalData$
|
|
22790
|
+
XEUtils.assign(internalData, createInternalData$8());
|
|
21444
22791
|
});
|
|
21445
22792
|
reactData.collapseAll = !!props.collapseStatus;
|
|
21446
22793
|
if (props.items) {
|
|
@@ -22844,13 +24191,13 @@ const openPreviewImage = (options) => {
|
|
|
22844
24191
|
return Promise.resolve();
|
|
22845
24192
|
};
|
|
22846
24193
|
|
|
22847
|
-
function createInternalData$
|
|
24194
|
+
function createInternalData$7() {
|
|
22848
24195
|
return {
|
|
22849
24196
|
// dgTime: 0,
|
|
22850
24197
|
// mdTime: 0
|
|
22851
24198
|
};
|
|
22852
24199
|
}
|
|
22853
|
-
function createReactData$
|
|
24200
|
+
function createReactData$5() {
|
|
22854
24201
|
return {};
|
|
22855
24202
|
}
|
|
22856
24203
|
var VxeImageComponent = defineVxeComponent({
|
|
@@ -22909,8 +24256,8 @@ var VxeImageComponent = defineVxeComponent({
|
|
|
22909
24256
|
const $xeImageGroup = inject('$xeImageGroup', null);
|
|
22910
24257
|
const refElem = ref();
|
|
22911
24258
|
const { computeSize } = useSize(props);
|
|
22912
|
-
const internalData = createInternalData$
|
|
22913
|
-
const reactData = reactive(createReactData$
|
|
24259
|
+
const internalData = createInternalData$7();
|
|
24260
|
+
const reactData = reactive(createReactData$5());
|
|
22914
24261
|
const refMaps = {
|
|
22915
24262
|
refElem
|
|
22916
24263
|
};
|
|
@@ -23096,8 +24443,8 @@ var VxeImageComponent = defineVxeComponent({
|
|
|
23096
24443
|
]);
|
|
23097
24444
|
};
|
|
23098
24445
|
onBeforeUnmount(() => {
|
|
23099
|
-
XEUtils.assign(reactData, createReactData$
|
|
23100
|
-
XEUtils.assign(internalData, createInternalData$
|
|
24446
|
+
XEUtils.assign(reactData, createReactData$5());
|
|
24447
|
+
XEUtils.assign(internalData, createInternalData$7());
|
|
23101
24448
|
});
|
|
23102
24449
|
$xeImage.renderVN = renderVN;
|
|
23103
24450
|
return $xeImage;
|
|
@@ -23386,10 +24733,10 @@ dynamicApp.use(VxeLayoutAside);
|
|
|
23386
24733
|
VxeUI.component(VxeLayoutAsideComponent);
|
|
23387
24734
|
const LayoutAside = VxeLayoutAside;
|
|
23388
24735
|
|
|
23389
|
-
function createInternalData$
|
|
24736
|
+
function createInternalData$6() {
|
|
23390
24737
|
return {};
|
|
23391
24738
|
}
|
|
23392
|
-
function createReactData$
|
|
24739
|
+
function createReactData$4() {
|
|
23393
24740
|
return {};
|
|
23394
24741
|
}
|
|
23395
24742
|
var VxeLayoutBodyComponent = defineVxeComponent({
|
|
@@ -23414,8 +24761,8 @@ var VxeLayoutBodyComponent = defineVxeComponent({
|
|
|
23414
24761
|
const backtopId = `vxe_layout_body_backtop_${xID}`;
|
|
23415
24762
|
const refElem = ref();
|
|
23416
24763
|
const { computeSize } = useSize(props);
|
|
23417
|
-
const internalData = createInternalData$
|
|
23418
|
-
const reactData = reactive(createReactData$
|
|
24764
|
+
const internalData = createInternalData$6();
|
|
24765
|
+
const reactData = reactive(createReactData$4());
|
|
23419
24766
|
const refMaps = {
|
|
23420
24767
|
refElem
|
|
23421
24768
|
};
|
|
@@ -23830,404 +25177,6 @@ dynamicApp.use(VxeLink);
|
|
|
23830
25177
|
VxeUI.component(VxeLinkComponent);
|
|
23831
25178
|
const Link = VxeLink;
|
|
23832
25179
|
|
|
23833
|
-
function createReactData$4() {
|
|
23834
|
-
return {
|
|
23835
|
-
scrollYLoad: false,
|
|
23836
|
-
bodyHeight: 0,
|
|
23837
|
-
customHeight: 0,
|
|
23838
|
-
customMaxHeight: 0,
|
|
23839
|
-
parentHeight: 0,
|
|
23840
|
-
topSpaceHeight: 0,
|
|
23841
|
-
items: []
|
|
23842
|
-
};
|
|
23843
|
-
}
|
|
23844
|
-
function createInternalData$6() {
|
|
23845
|
-
return {
|
|
23846
|
-
resizeObserver: undefined,
|
|
23847
|
-
fullData: [],
|
|
23848
|
-
lastScrollLeft: 0,
|
|
23849
|
-
lastScrollTop: 0,
|
|
23850
|
-
scrollYStore: {
|
|
23851
|
-
startIndex: 0,
|
|
23852
|
-
endIndex: 0,
|
|
23853
|
-
visibleSize: 0,
|
|
23854
|
-
offsetSize: 0,
|
|
23855
|
-
rowHeight: 0
|
|
23856
|
-
}
|
|
23857
|
-
};
|
|
23858
|
-
}
|
|
23859
|
-
var VxeListComponent = defineVxeComponent({
|
|
23860
|
-
name: 'VxeList',
|
|
23861
|
-
props: {
|
|
23862
|
-
data: Array,
|
|
23863
|
-
height: [Number, String],
|
|
23864
|
-
maxHeight: [Number, String],
|
|
23865
|
-
loading: Boolean,
|
|
23866
|
-
className: [String, Function],
|
|
23867
|
-
size: {
|
|
23868
|
-
type: String,
|
|
23869
|
-
default: () => getConfig$3().list.size || getConfig$3().size
|
|
23870
|
-
},
|
|
23871
|
-
autoResize: {
|
|
23872
|
-
type: Boolean,
|
|
23873
|
-
default: () => getConfig$3().list.autoResize
|
|
23874
|
-
},
|
|
23875
|
-
syncResize: [Boolean, String, Number],
|
|
23876
|
-
virtualYConfig: Object,
|
|
23877
|
-
scrollY: Object
|
|
23878
|
-
},
|
|
23879
|
-
emits: [
|
|
23880
|
-
'scroll'
|
|
23881
|
-
],
|
|
23882
|
-
setup(props, context) {
|
|
23883
|
-
const { slots, emit } = context;
|
|
23884
|
-
const xID = XEUtils.uniqueId();
|
|
23885
|
-
const browseObj = XEUtils.browse();
|
|
23886
|
-
const { computeSize } = useSize(props);
|
|
23887
|
-
const reactData = reactive(createReactData$4());
|
|
23888
|
-
const internalData = createInternalData$6();
|
|
23889
|
-
const refElem = ref();
|
|
23890
|
-
const refVirtualWrapper = ref();
|
|
23891
|
-
const refVirtualBody = ref();
|
|
23892
|
-
const refMaps = {
|
|
23893
|
-
refElem
|
|
23894
|
-
};
|
|
23895
|
-
const $xeList = {
|
|
23896
|
-
xID,
|
|
23897
|
-
props,
|
|
23898
|
-
context,
|
|
23899
|
-
reactData,
|
|
23900
|
-
internalData,
|
|
23901
|
-
getRefMaps: () => refMaps
|
|
23902
|
-
};
|
|
23903
|
-
const computeSYOpts = computed(() => {
|
|
23904
|
-
return Object.assign({}, getConfig$3().list.virtualYConfig || getConfig$3().list.scrollY, props.virtualYConfig || props.scrollY);
|
|
23905
|
-
});
|
|
23906
|
-
const computeStyles = computed(() => {
|
|
23907
|
-
const { height, maxHeight } = props;
|
|
23908
|
-
const { customHeight, customMaxHeight } = reactData;
|
|
23909
|
-
const style = {};
|
|
23910
|
-
if (height) {
|
|
23911
|
-
style.height = `${customHeight}px`;
|
|
23912
|
-
}
|
|
23913
|
-
else if (maxHeight) {
|
|
23914
|
-
style.height = 'auto';
|
|
23915
|
-
style.maxHeight = `${customMaxHeight}px`;
|
|
23916
|
-
}
|
|
23917
|
-
return style;
|
|
23918
|
-
});
|
|
23919
|
-
const dispatchEvent = (type, params, evnt) => {
|
|
23920
|
-
emit(type, createEvent(evnt, { $list: $xeList }, params));
|
|
23921
|
-
};
|
|
23922
|
-
const calcTableHeight = (key) => {
|
|
23923
|
-
const { parentHeight } = reactData;
|
|
23924
|
-
const val = props[key];
|
|
23925
|
-
let num = 0;
|
|
23926
|
-
if (val) {
|
|
23927
|
-
if (val === '100%' || val === 'auto') {
|
|
23928
|
-
num = parentHeight;
|
|
23929
|
-
}
|
|
23930
|
-
else {
|
|
23931
|
-
if (isScale(val)) {
|
|
23932
|
-
num = Math.floor((XEUtils.toInteger(val) || 1) / 100 * parentHeight);
|
|
23933
|
-
}
|
|
23934
|
-
else {
|
|
23935
|
-
num = XEUtils.toNumber(val);
|
|
23936
|
-
}
|
|
23937
|
-
num = Math.max(40, num);
|
|
23938
|
-
}
|
|
23939
|
-
}
|
|
23940
|
-
return num;
|
|
23941
|
-
};
|
|
23942
|
-
const updateHeight = () => {
|
|
23943
|
-
reactData.customHeight = calcTableHeight('height');
|
|
23944
|
-
reactData.customMaxHeight = calcTableHeight('maxHeight');
|
|
23945
|
-
};
|
|
23946
|
-
const updateYSpace = () => {
|
|
23947
|
-
const { scrollYLoad } = reactData;
|
|
23948
|
-
const { scrollYStore, fullData } = internalData;
|
|
23949
|
-
reactData.bodyHeight = scrollYLoad ? fullData.length * scrollYStore.rowHeight : 0;
|
|
23950
|
-
reactData.topSpaceHeight = scrollYLoad ? Math.max(scrollYStore.startIndex * scrollYStore.rowHeight, 0) : 0;
|
|
23951
|
-
};
|
|
23952
|
-
const handleData = () => {
|
|
23953
|
-
const { scrollYLoad } = reactData;
|
|
23954
|
-
const { fullData, scrollYStore } = internalData;
|
|
23955
|
-
reactData.items = scrollYLoad ? fullData.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullData.slice(0);
|
|
23956
|
-
return nextTick();
|
|
23957
|
-
};
|
|
23958
|
-
const updateYData = () => {
|
|
23959
|
-
handleData();
|
|
23960
|
-
updateYSpace();
|
|
23961
|
-
};
|
|
23962
|
-
const computeScrollLoad = () => {
|
|
23963
|
-
return nextTick().then(() => {
|
|
23964
|
-
const { scrollYLoad } = reactData;
|
|
23965
|
-
const { scrollYStore } = internalData;
|
|
23966
|
-
const virtualBodyElem = refVirtualBody.value;
|
|
23967
|
-
const sYOpts = computeSYOpts.value;
|
|
23968
|
-
let rowHeight = 0;
|
|
23969
|
-
let firstItemElem;
|
|
23970
|
-
if (virtualBodyElem) {
|
|
23971
|
-
if (sYOpts.sItem) {
|
|
23972
|
-
firstItemElem = virtualBodyElem.querySelector(sYOpts.sItem);
|
|
23973
|
-
}
|
|
23974
|
-
if (!firstItemElem) {
|
|
23975
|
-
firstItemElem = virtualBodyElem.children[0];
|
|
23976
|
-
}
|
|
23977
|
-
}
|
|
23978
|
-
if (firstItemElem) {
|
|
23979
|
-
rowHeight = firstItemElem.offsetHeight;
|
|
23980
|
-
}
|
|
23981
|
-
rowHeight = Math.max(12, rowHeight);
|
|
23982
|
-
scrollYStore.rowHeight = rowHeight;
|
|
23983
|
-
// 计算 Y 逻辑
|
|
23984
|
-
if (scrollYLoad) {
|
|
23985
|
-
const scrollBodyElem = refVirtualWrapper.value;
|
|
23986
|
-
const visibleYSize = Math.max(8, Math.ceil(scrollBodyElem.clientHeight / rowHeight));
|
|
23987
|
-
const offsetYSize = sYOpts.oSize ? XEUtils.toNumber(sYOpts.oSize) : (browseObj.edge ? 10 : 0);
|
|
23988
|
-
scrollYStore.offsetSize = offsetYSize;
|
|
23989
|
-
scrollYStore.visibleSize = visibleYSize;
|
|
23990
|
-
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
23991
|
-
updateYData();
|
|
23992
|
-
}
|
|
23993
|
-
else {
|
|
23994
|
-
updateYSpace();
|
|
23995
|
-
}
|
|
23996
|
-
});
|
|
23997
|
-
};
|
|
23998
|
-
/**
|
|
23999
|
-
* 清除滚动条
|
|
24000
|
-
*/
|
|
24001
|
-
const clearScroll = () => {
|
|
24002
|
-
const scrollBodyElem = refVirtualWrapper.value;
|
|
24003
|
-
if (scrollBodyElem) {
|
|
24004
|
-
scrollBodyElem.scrollTop = 0;
|
|
24005
|
-
}
|
|
24006
|
-
return nextTick();
|
|
24007
|
-
};
|
|
24008
|
-
/**
|
|
24009
|
-
* 如果有滚动条,则滚动到对应的位置
|
|
24010
|
-
*/
|
|
24011
|
-
const scrollTo = (scrollLeft, scrollTop) => {
|
|
24012
|
-
const scrollBodyElem = refVirtualWrapper.value;
|
|
24013
|
-
if (scrollLeft) {
|
|
24014
|
-
if (!XEUtils.isNumber(scrollLeft)) {
|
|
24015
|
-
scrollTop = scrollLeft.top;
|
|
24016
|
-
scrollLeft = scrollLeft.left;
|
|
24017
|
-
}
|
|
24018
|
-
}
|
|
24019
|
-
if (XEUtils.isNumber(scrollLeft)) {
|
|
24020
|
-
scrollBodyElem.scrollLeft = scrollLeft;
|
|
24021
|
-
}
|
|
24022
|
-
if (XEUtils.isNumber(scrollTop)) {
|
|
24023
|
-
scrollBodyElem.scrollTop = scrollTop;
|
|
24024
|
-
}
|
|
24025
|
-
if (reactData.scrollYLoad) {
|
|
24026
|
-
return new Promise(resolve => {
|
|
24027
|
-
setTimeout(() => {
|
|
24028
|
-
nextTick(() => {
|
|
24029
|
-
resolve();
|
|
24030
|
-
});
|
|
24031
|
-
}, 50);
|
|
24032
|
-
});
|
|
24033
|
-
}
|
|
24034
|
-
return nextTick();
|
|
24035
|
-
};
|
|
24036
|
-
/**
|
|
24037
|
-
* 刷新滚动条
|
|
24038
|
-
*/
|
|
24039
|
-
const refreshScroll = () => {
|
|
24040
|
-
const { lastScrollLeft, lastScrollTop } = internalData;
|
|
24041
|
-
return clearScroll().then(() => {
|
|
24042
|
-
if (lastScrollLeft || lastScrollTop) {
|
|
24043
|
-
internalData.lastScrollLeft = 0;
|
|
24044
|
-
internalData.lastScrollTop = 0;
|
|
24045
|
-
return scrollTo(lastScrollLeft, lastScrollTop);
|
|
24046
|
-
}
|
|
24047
|
-
});
|
|
24048
|
-
};
|
|
24049
|
-
/**
|
|
24050
|
-
* 重新计算列表
|
|
24051
|
-
*/
|
|
24052
|
-
const recalculate = () => {
|
|
24053
|
-
const el = refElem.value;
|
|
24054
|
-
if (el) {
|
|
24055
|
-
const parentEl = el.parentElement;
|
|
24056
|
-
reactData.parentHeight = parentEl ? parentEl.clientHeight : 0;
|
|
24057
|
-
updateHeight();
|
|
24058
|
-
if (el.clientWidth && el.clientHeight) {
|
|
24059
|
-
return computeScrollLoad();
|
|
24060
|
-
}
|
|
24061
|
-
}
|
|
24062
|
-
return nextTick();
|
|
24063
|
-
};
|
|
24064
|
-
const loadYData = (evnt) => {
|
|
24065
|
-
const { scrollYStore } = internalData;
|
|
24066
|
-
const { startIndex, endIndex, visibleSize, offsetSize, rowHeight } = scrollYStore;
|
|
24067
|
-
const scrollBodyElem = evnt.target;
|
|
24068
|
-
const scrollTop = scrollBodyElem.scrollTop;
|
|
24069
|
-
const toVisibleIndex = Math.floor(scrollTop / rowHeight);
|
|
24070
|
-
const offsetStartIndex = Math.max(0, toVisibleIndex - 1 - offsetSize);
|
|
24071
|
-
const offsetEndIndex = toVisibleIndex + visibleSize + offsetSize;
|
|
24072
|
-
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
24073
|
-
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
24074
|
-
scrollYStore.startIndex = offsetStartIndex;
|
|
24075
|
-
scrollYStore.endIndex = offsetEndIndex;
|
|
24076
|
-
updateYData();
|
|
24077
|
-
}
|
|
24078
|
-
}
|
|
24079
|
-
};
|
|
24080
|
-
const scrollEvent = (evnt) => {
|
|
24081
|
-
const scrollBodyElem = evnt.target;
|
|
24082
|
-
const scrollTop = scrollBodyElem.scrollTop;
|
|
24083
|
-
const scrollLeft = scrollBodyElem.scrollLeft;
|
|
24084
|
-
const isX = scrollLeft !== internalData.lastScrollLeft;
|
|
24085
|
-
const isY = scrollTop !== internalData.lastScrollTop;
|
|
24086
|
-
internalData.lastScrollTop = scrollTop;
|
|
24087
|
-
internalData.lastScrollLeft = scrollLeft;
|
|
24088
|
-
if (reactData.scrollYLoad) {
|
|
24089
|
-
loadYData(evnt);
|
|
24090
|
-
}
|
|
24091
|
-
dispatchEvent('scroll', { scrollLeft, scrollTop, isX, isY }, evnt);
|
|
24092
|
-
};
|
|
24093
|
-
/**
|
|
24094
|
-
* 加载数据
|
|
24095
|
-
* @param {Array} datas 数据
|
|
24096
|
-
*/
|
|
24097
|
-
const loadData = (datas) => {
|
|
24098
|
-
const { scrollYStore } = internalData;
|
|
24099
|
-
const sYOpts = computeSYOpts.value;
|
|
24100
|
-
const fullData = datas || [];
|
|
24101
|
-
Object.assign(scrollYStore, {
|
|
24102
|
-
startIndex: 0,
|
|
24103
|
-
endIndex: 1,
|
|
24104
|
-
visibleSize: 0
|
|
24105
|
-
});
|
|
24106
|
-
internalData.fullData = fullData;
|
|
24107
|
-
// 如果gt为0,则总是启用
|
|
24108
|
-
reactData.scrollYLoad = !!sYOpts.enabled && sYOpts.gt > -1 && (sYOpts.gt === 0 || sYOpts.gt <= fullData.length);
|
|
24109
|
-
handleData();
|
|
24110
|
-
return computeScrollLoad().then(() => {
|
|
24111
|
-
refreshScroll();
|
|
24112
|
-
});
|
|
24113
|
-
};
|
|
24114
|
-
const listMethods = {
|
|
24115
|
-
dispatchEvent,
|
|
24116
|
-
loadData,
|
|
24117
|
-
/**
|
|
24118
|
-
* 重新加载数据
|
|
24119
|
-
* @param {Array} datas 数据
|
|
24120
|
-
*/
|
|
24121
|
-
reloadData(datas) {
|
|
24122
|
-
clearScroll();
|
|
24123
|
-
return loadData(datas);
|
|
24124
|
-
},
|
|
24125
|
-
recalculate,
|
|
24126
|
-
scrollTo,
|
|
24127
|
-
refreshScroll,
|
|
24128
|
-
clearScroll
|
|
24129
|
-
};
|
|
24130
|
-
Object.assign($xeList, listMethods);
|
|
24131
|
-
const renderVN = () => {
|
|
24132
|
-
const { className, loading } = props;
|
|
24133
|
-
const { bodyHeight, topSpaceHeight, items } = reactData;
|
|
24134
|
-
const defaultSlot = slots.default;
|
|
24135
|
-
const vSize = computeSize.value;
|
|
24136
|
-
const styles = computeStyles.value;
|
|
24137
|
-
return h('div', {
|
|
24138
|
-
ref: refElem,
|
|
24139
|
-
class: ['vxe-list', className ? (XEUtils.isFunction(className) ? className({ $list: $xeList }) : className) : '', {
|
|
24140
|
-
[`size--${vSize}`]: vSize,
|
|
24141
|
-
'is--loading': loading
|
|
24142
|
-
}]
|
|
24143
|
-
}, [
|
|
24144
|
-
h('div', {
|
|
24145
|
-
ref: refVirtualWrapper,
|
|
24146
|
-
class: 'vxe-list--virtual-wrapper',
|
|
24147
|
-
style: styles,
|
|
24148
|
-
onScroll: scrollEvent
|
|
24149
|
-
}, [
|
|
24150
|
-
h('div', {
|
|
24151
|
-
class: 'vxe-list--y-space',
|
|
24152
|
-
style: {
|
|
24153
|
-
height: bodyHeight ? `${bodyHeight}px` : ''
|
|
24154
|
-
}
|
|
24155
|
-
}),
|
|
24156
|
-
h('div', {
|
|
24157
|
-
ref: refVirtualBody,
|
|
24158
|
-
class: 'vxe-list--body',
|
|
24159
|
-
style: {
|
|
24160
|
-
marginTop: topSpaceHeight ? `${topSpaceHeight}px` : ''
|
|
24161
|
-
}
|
|
24162
|
-
}, defaultSlot ? defaultSlot({ items, $list: $xeList }) : [])
|
|
24163
|
-
]),
|
|
24164
|
-
/**
|
|
24165
|
-
* 加载中
|
|
24166
|
-
*/
|
|
24167
|
-
h(VxeLoadingComponent, {
|
|
24168
|
-
class: 'vxe-list--loading',
|
|
24169
|
-
modelValue: loading
|
|
24170
|
-
})
|
|
24171
|
-
]);
|
|
24172
|
-
};
|
|
24173
|
-
const dataFlag = ref(0);
|
|
24174
|
-
watch(() => props.data ? props.data.length : -1, () => {
|
|
24175
|
-
dataFlag.value++;
|
|
24176
|
-
});
|
|
24177
|
-
watch(() => props.data, () => {
|
|
24178
|
-
dataFlag.value++;
|
|
24179
|
-
});
|
|
24180
|
-
watch(dataFlag, () => {
|
|
24181
|
-
loadData(props.data || []);
|
|
24182
|
-
});
|
|
24183
|
-
watch(() => props.height, () => {
|
|
24184
|
-
recalculate();
|
|
24185
|
-
});
|
|
24186
|
-
watch(() => props.maxHeight, () => {
|
|
24187
|
-
recalculate();
|
|
24188
|
-
});
|
|
24189
|
-
watch(() => props.syncResize, (value) => {
|
|
24190
|
-
if (value) {
|
|
24191
|
-
recalculate();
|
|
24192
|
-
nextTick(() => setTimeout(() => recalculate()));
|
|
24193
|
-
}
|
|
24194
|
-
});
|
|
24195
|
-
onActivated(() => {
|
|
24196
|
-
recalculate().then(() => refreshScroll());
|
|
24197
|
-
});
|
|
24198
|
-
nextTick(() => {
|
|
24199
|
-
loadData(props.data || []);
|
|
24200
|
-
});
|
|
24201
|
-
onMounted(() => {
|
|
24202
|
-
recalculate();
|
|
24203
|
-
if (props.autoResize) {
|
|
24204
|
-
const el = refElem.value;
|
|
24205
|
-
const resizeObserver = globalResize.create(() => recalculate());
|
|
24206
|
-
resizeObserver.observe(el);
|
|
24207
|
-
if (el) {
|
|
24208
|
-
resizeObserver.observe(el.parentElement);
|
|
24209
|
-
}
|
|
24210
|
-
internalData.resizeObserver = resizeObserver;
|
|
24211
|
-
}
|
|
24212
|
-
globalEvents.on($xeList, 'resize', recalculate);
|
|
24213
|
-
});
|
|
24214
|
-
onBeforeUnmount(() => {
|
|
24215
|
-
const { resizeObserver } = internalData;
|
|
24216
|
-
if (resizeObserver) {
|
|
24217
|
-
resizeObserver.disconnect();
|
|
24218
|
-
}
|
|
24219
|
-
globalEvents.off($xeList, 'resize');
|
|
24220
|
-
XEUtils.assign(reactData, createReactData$4());
|
|
24221
|
-
XEUtils.assign(internalData, createInternalData$6());
|
|
24222
|
-
});
|
|
24223
|
-
$xeList.renderVN = renderVN;
|
|
24224
|
-
return $xeList;
|
|
24225
|
-
},
|
|
24226
|
-
render() {
|
|
24227
|
-
return this.renderVN();
|
|
24228
|
-
}
|
|
24229
|
-
});
|
|
24230
|
-
|
|
24231
25180
|
const VxeList = Object.assign(VxeListComponent, {
|
|
24232
25181
|
install(app) {
|
|
24233
25182
|
app.component(VxeListComponent.name, VxeListComponent);
|
|
@@ -36032,6 +36981,45 @@ dynamicApp.use(VxeTour);
|
|
|
36032
36981
|
VxeUI.component(VxeTourComponent);
|
|
36033
36982
|
const Tour = VxeTour;
|
|
36034
36983
|
|
|
36984
|
+
function enNodeValue(nodeid) {
|
|
36985
|
+
return XEUtils.eqNull(nodeid) ? '' : encodeURIComponent(`${nodeid}`);
|
|
36986
|
+
}
|
|
36987
|
+
function deNodeValue(nodeid) {
|
|
36988
|
+
return nodeid ? decodeURIComponent(`${nodeid}`) : nodeid;
|
|
36989
|
+
}
|
|
36990
|
+
function countTreeExpand($xeTree, prevNode) {
|
|
36991
|
+
let count = 1;
|
|
36992
|
+
if (!prevNode) {
|
|
36993
|
+
return count;
|
|
36994
|
+
}
|
|
36995
|
+
const props = $xeTree.props;
|
|
36996
|
+
const { transform } = props;
|
|
36997
|
+
const reactData = $xeTree.reactData;
|
|
36998
|
+
const { updateExpandedFlag } = reactData;
|
|
36999
|
+
const internalData = $xeTree.internalData;
|
|
37000
|
+
const { treeExpandedMaps } = internalData;
|
|
37001
|
+
const { computeChildrenField, computeMapChildrenField } = $xeTree.getComputeMaps();
|
|
37002
|
+
const childrenField = computeChildrenField.value;
|
|
37003
|
+
const mapChildrenField = computeMapChildrenField.value;
|
|
37004
|
+
const nodeChildren = prevNode[transform ? mapChildrenField : childrenField];
|
|
37005
|
+
if (nodeChildren && updateExpandedFlag && treeExpandedMaps[$xeTree.getNodeId(prevNode)]) {
|
|
37006
|
+
for (let index = 0; index < nodeChildren.length; index++) {
|
|
37007
|
+
count += countTreeExpand($xeTree, nodeChildren[index]);
|
|
37008
|
+
}
|
|
37009
|
+
}
|
|
37010
|
+
return count;
|
|
37011
|
+
}
|
|
37012
|
+
function calcTreeLine($xeTree, node, prevNode) {
|
|
37013
|
+
const internalData = $xeTree.internalData;
|
|
37014
|
+
const { scrollYStore } = internalData;
|
|
37015
|
+
const { rowHeight } = scrollYStore;
|
|
37016
|
+
let expandSize = 1;
|
|
37017
|
+
if (prevNode) {
|
|
37018
|
+
expandSize = countTreeExpand($xeTree, prevNode);
|
|
37019
|
+
}
|
|
37020
|
+
return (rowHeight || 28) * expandSize - (prevNode ? 1 : 12);
|
|
37021
|
+
}
|
|
37022
|
+
|
|
36035
37023
|
// 跨树拖拽
|
|
36036
37024
|
const crossTreeDragNodeInfo = reactive({
|
|
36037
37025
|
node: null
|
|
@@ -36394,6 +37382,9 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
36394
37382
|
getComputeMaps: () => computeMaps
|
|
36395
37383
|
};
|
|
36396
37384
|
const getNodeId = (node) => {
|
|
37385
|
+
if (!node) {
|
|
37386
|
+
return '';
|
|
37387
|
+
}
|
|
36397
37388
|
const valueField = computeValueField.value;
|
|
36398
37389
|
const nodeKey = XEUtils.get(node, valueField);
|
|
36399
37390
|
return enNodeValue(nodeKey);
|
|
@@ -36549,7 +37540,7 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
36549
37540
|
const valueField = computeValueField.value;
|
|
36550
37541
|
const childrenField = computeChildrenField.value;
|
|
36551
37542
|
const keyMaps = {};
|
|
36552
|
-
XEUtils.eachTree(treeFullData, (item, index, items, path,
|
|
37543
|
+
XEUtils.eachTree(treeFullData, (item, index, items, path, parenItem, nodes) => {
|
|
36553
37544
|
let nodeid = getNodeId(item);
|
|
36554
37545
|
if (!nodeid) {
|
|
36555
37546
|
nodeid = getNodeUniqueId();
|
|
@@ -36561,7 +37552,7 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
36561
37552
|
$index: -1,
|
|
36562
37553
|
_index: -1,
|
|
36563
37554
|
items,
|
|
36564
|
-
parent,
|
|
37555
|
+
parent: parenItem,
|
|
36565
37556
|
nodes,
|
|
36566
37557
|
level: nodes.length - 1,
|
|
36567
37558
|
treeIndex: index,
|
|
@@ -36577,7 +37568,7 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
36577
37568
|
const childrenField = computeChildrenField.value;
|
|
36578
37569
|
const mapChildrenField = computeMapChildrenField.value;
|
|
36579
37570
|
let vtIndex = 0;
|
|
36580
|
-
XEUtils.eachTree(afterTreeList, (item, index, items) => {
|
|
37571
|
+
XEUtils.eachTree(afterTreeList, (item, index, items, path, parenItem, nodes) => {
|
|
36581
37572
|
const nodeid = getNodeId(item);
|
|
36582
37573
|
const nodeItem = nodeMaps[nodeid];
|
|
36583
37574
|
if (nodeItem) {
|
|
@@ -36592,9 +37583,9 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
36592
37583
|
$index: -1,
|
|
36593
37584
|
_index: vtIndex,
|
|
36594
37585
|
items,
|
|
36595
|
-
parent,
|
|
36596
|
-
nodes
|
|
36597
|
-
level:
|
|
37586
|
+
parent: parenItem,
|
|
37587
|
+
nodes,
|
|
37588
|
+
level: nodes.length - 1,
|
|
36598
37589
|
treeIndex: index,
|
|
36599
37590
|
lineCount: 0,
|
|
36600
37591
|
treeLoaded: false
|
|
@@ -38404,7 +39395,7 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
38404
39395
|
const extraSlot = slots.extra;
|
|
38405
39396
|
const isExpand = updateExpandedFlag && treeExpandedMaps[nodeid];
|
|
38406
39397
|
const nodeItem = nodeMaps[nodeid] || {};
|
|
38407
|
-
const
|
|
39398
|
+
const nodeTitle = XEUtils.get(node, titleField);
|
|
38408
39399
|
const nLevel = nodeItem.level;
|
|
38409
39400
|
let isRadioChecked = false;
|
|
38410
39401
|
if (showRadio) {
|
|
@@ -38494,7 +39485,7 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
38494
39485
|
}, [
|
|
38495
39486
|
h('div', {
|
|
38496
39487
|
class: 'vxe-tree--node-item-title'
|
|
38497
|
-
}, titleSlot ? getSlotVNs(titleSlot(nParams)) : `${
|
|
39488
|
+
}, titleSlot ? getSlotVNs(titleSlot(nParams)) : `${nodeTitle}`),
|
|
38498
39489
|
extraSlot
|
|
38499
39490
|
? h('div', {
|
|
38500
39491
|
class: 'vxe-tree--node-item-extra'
|
|
@@ -38660,6 +39651,15 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
38660
39651
|
watch(() => props.data, () => {
|
|
38661
39652
|
dataFlag.value++;
|
|
38662
39653
|
});
|
|
39654
|
+
watch(() => props.rootParentValue, () => {
|
|
39655
|
+
dataFlag.value++;
|
|
39656
|
+
});
|
|
39657
|
+
watch(() => props.rootValues ? props.rootValues.length : 0, () => {
|
|
39658
|
+
dataFlag.value++;
|
|
39659
|
+
});
|
|
39660
|
+
watch(() => props.rootValues, () => {
|
|
39661
|
+
dataFlag.value++;
|
|
39662
|
+
});
|
|
38663
39663
|
watch(dataFlag, () => {
|
|
38664
39664
|
loadData(props.data || []);
|
|
38665
39665
|
});
|
|
@@ -38692,19 +39692,6 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
38692
39692
|
watch(hFlag, () => {
|
|
38693
39693
|
recalculate();
|
|
38694
39694
|
});
|
|
38695
|
-
const rootConf = ref(0);
|
|
38696
|
-
watch(() => props.rootParentValue, () => {
|
|
38697
|
-
rootConf.value++;
|
|
38698
|
-
});
|
|
38699
|
-
watch(() => props.rootValues ? props.rootValues.length : 0, () => {
|
|
38700
|
-
rootConf.value++;
|
|
38701
|
-
});
|
|
38702
|
-
watch(() => props.rootValues, () => {
|
|
38703
|
-
rootConf.value++;
|
|
38704
|
-
});
|
|
38705
|
-
watch(rootConf, () => {
|
|
38706
|
-
loadData(props.data || []);
|
|
38707
|
-
});
|
|
38708
39695
|
onMounted(() => {
|
|
38709
39696
|
const { transform, drag, menuConfig } = props;
|
|
38710
39697
|
const dragOpts = computeDragOpts.value;
|
|
@@ -38714,6 +39701,9 @@ var VxeTreeComponent = defineVxeComponent({
|
|
|
38714
39701
|
if (dragOpts.isCrossTreeDrag) {
|
|
38715
39702
|
errLog('vxe.error.notProp', ['drag-config.isCrossTreeDrag']);
|
|
38716
39703
|
}
|
|
39704
|
+
// if (valueField) {
|
|
39705
|
+
// errLog('vxe.error.delProp', ['value-field', 'value-field'])
|
|
39706
|
+
// }
|
|
38717
39707
|
const VxeUIContextMenu = VxeUI.getComponent('VxeContextMenu');
|
|
38718
39708
|
if (menuConfig && !VxeUIContextMenu) {
|
|
38719
39709
|
errLog('vxe.error.reqComp', ['vxe-context-menu']);
|
|
@@ -38948,12 +39938,12 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
38948
39938
|
return disabled;
|
|
38949
39939
|
});
|
|
38950
39940
|
const computeBtnTransfer = computed(() => {
|
|
38951
|
-
const { transfer } = props;
|
|
38952
39941
|
const popupOpts = computePopupOpts.value;
|
|
38953
|
-
|
|
38954
|
-
|
|
39942
|
+
const { transfer } = popupOpts;
|
|
39943
|
+
if (XEUtils.isBoolean(transfer)) {
|
|
39944
|
+
return transfer;
|
|
38955
39945
|
}
|
|
38956
|
-
if (transfer === null) {
|
|
39946
|
+
if (props.transfer === null) {
|
|
38957
39947
|
const globalTransfer = getConfig$3().treeSelect.transfer;
|
|
38958
39948
|
if (XEUtils.isBoolean(globalTransfer)) {
|
|
38959
39949
|
return globalTransfer;
|
|
@@ -38962,7 +39952,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
38962
39952
|
return true;
|
|
38963
39953
|
}
|
|
38964
39954
|
}
|
|
38965
|
-
return transfer;
|
|
39955
|
+
return props.transfer;
|
|
38966
39956
|
});
|
|
38967
39957
|
const computePopupOpts = computed(() => {
|
|
38968
39958
|
return Object.assign({}, getConfig$3().treeSelect.popupConfig, props.popupConfig);
|
|
@@ -39031,12 +40021,16 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
39031
40021
|
const treeOpts = computeTreeOpts.value;
|
|
39032
40022
|
return Object.assign({}, treeOpts.filterConfig, props.filterConfig);
|
|
39033
40023
|
});
|
|
40024
|
+
const computeSelectVals = computed(() => {
|
|
40025
|
+
const { modelValue } = props;
|
|
40026
|
+
return XEUtils.eqNull(modelValue) ? [] : (XEUtils.isArray(modelValue) ? modelValue : [modelValue]);
|
|
40027
|
+
});
|
|
39034
40028
|
const computeSelectLabel = computed(() => {
|
|
39035
|
-
const {
|
|
40029
|
+
const { showFullLabel } = props;
|
|
39036
40030
|
const { fullOptFlag, lazyOptFlag } = reactData;
|
|
39037
40031
|
const { fullNodeMaps, lazyNodeMaps } = internalData;
|
|
39038
40032
|
const labelField = computeLabelField.value;
|
|
39039
|
-
const selectVals =
|
|
40033
|
+
const selectVals = computeSelectVals.value;
|
|
39040
40034
|
return selectVals.map(val => {
|
|
39041
40035
|
const cacheItem = fullNodeMaps[val];
|
|
39042
40036
|
if (fullOptFlag && cacheItem) {
|
|
@@ -39116,12 +40110,12 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
39116
40110
|
nodeid = getOptUniqueId();
|
|
39117
40111
|
}
|
|
39118
40112
|
if (keyMaps[nodeid]) {
|
|
39119
|
-
errLog('vxe.error.repeatKey', [
|
|
40113
|
+
errLog('vxe.error.repeatKey', [nodeKeyField, nodeid]);
|
|
39120
40114
|
}
|
|
39121
40115
|
keyMaps[nodeid] = true;
|
|
39122
40116
|
const value = item[valueField];
|
|
39123
40117
|
if (nodeMaps[value]) {
|
|
39124
|
-
errLog('vxe.error.repeatKey', [
|
|
40118
|
+
errLog('vxe.error.repeatKey', [valueField, value]);
|
|
39125
40119
|
}
|
|
39126
40120
|
nodeMaps[value] = {
|
|
39127
40121
|
item,
|
|
@@ -39129,7 +40123,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
39129
40123
|
items,
|
|
39130
40124
|
parent: parentItem,
|
|
39131
40125
|
nodes,
|
|
39132
|
-
fullLabel: nodes.map(item => item[labelField]).join((separator || '/
|
|
40126
|
+
fullLabel: nodes.map(item => item[labelField]).join((separator || ' / '))
|
|
39133
40127
|
};
|
|
39134
40128
|
};
|
|
39135
40129
|
if (optList) {
|
|
@@ -39198,7 +40192,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
39198
40192
|
handleStyle();
|
|
39199
40193
|
return nextTick().then(handleStyle);
|
|
39200
40194
|
};
|
|
39201
|
-
const showOptionPanel = () => {
|
|
40195
|
+
const showOptionPanel = (evnt) => {
|
|
39202
40196
|
const { loading, remote, filterable } = props;
|
|
39203
40197
|
const { fullOptionList } = internalData;
|
|
39204
40198
|
const isDisabled = computeIsDisabled.value;
|
|
@@ -39222,7 +40216,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
39222
40216
|
}, 10);
|
|
39223
40217
|
updateZindex();
|
|
39224
40218
|
updatePlacement();
|
|
39225
|
-
dispatchEvent('visible-change', { visible: true }, null);
|
|
40219
|
+
dispatchEvent('visible-change', { visible: true }, evnt || null);
|
|
39226
40220
|
}
|
|
39227
40221
|
};
|
|
39228
40222
|
const hideOptionPanel = (evnt) => {
|
|
@@ -39261,7 +40255,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
39261
40255
|
$tree.setAllCheckboxNode(true).then(({ checkNodeKeys, checkNodes }) => {
|
|
39262
40256
|
changeEvent($event, checkNodeKeys, checkNodes[0]);
|
|
39263
40257
|
dispatchEvent('all-change', { value: checkNodeKeys }, $event);
|
|
39264
|
-
if (XEUtils.isBoolean(
|
|
40258
|
+
if (XEUtils.isBoolean(checkedClosable) ? checkedClosable : autoClose) {
|
|
39265
40259
|
hideOptionPanel($event);
|
|
39266
40260
|
}
|
|
39267
40261
|
});
|
|
@@ -39275,7 +40269,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
39275
40269
|
if ($tree) {
|
|
39276
40270
|
const value = multiple ? [] : null;
|
|
39277
40271
|
$tree.clearCheckboxNode().then(() => {
|
|
39278
|
-
if (XEUtils.isBoolean(
|
|
40272
|
+
if (XEUtils.isBoolean(clearClosable) ? clearClosable : autoClose) {
|
|
39279
40273
|
hideOptionPanel($event);
|
|
39280
40274
|
}
|
|
39281
40275
|
});
|
|
@@ -39362,7 +40356,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
39362
40356
|
if (!isDisabled) {
|
|
39363
40357
|
if (!reactData.visiblePanel) {
|
|
39364
40358
|
reactData.triggerFocusPanel = true;
|
|
39365
|
-
showOptionPanel();
|
|
40359
|
+
showOptionPanel(evnt);
|
|
39366
40360
|
setTimeout(() => {
|
|
39367
40361
|
reactData.triggerFocusPanel = false;
|
|
39368
40362
|
}, 150);
|
|
@@ -39406,7 +40400,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
|
|
|
39406
40400
|
hideOptionPanel($event);
|
|
39407
40401
|
}
|
|
39408
40402
|
else {
|
|
39409
|
-
showOptionPanel();
|
|
40403
|
+
showOptionPanel($event);
|
|
39410
40404
|
}
|
|
39411
40405
|
}
|
|
39412
40406
|
};
|