vxe-pc-ui 4.11.33 → 4.11.35
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/es/button/src/button-group.js +11 -5
- package/es/button/src/button.js +12 -4
- package/es/context-menu/index.js +2 -2
- package/es/context-menu/src/context-menu.js +287 -14
- package/es/context-menu/style.css +2 -8
- package/es/context-menu/style.min.css +1 -1
- package/es/dynamics/index.js +1 -1
- package/es/icon/style.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +4 -2
- package/es/ui/src/log.js +1 -1
- package/es/vxe-context-menu/style.css +2 -8
- package/es/vxe-context-menu/style.min.css +1 -1
- package/lib/button/src/button-group.js +12 -7
- package/lib/button/src/button-group.min.js +1 -1
- package/lib/button/src/button.js +11 -4
- package/lib/button/src/button.min.js +1 -1
- package/lib/context-menu/index.js +2 -2
- package/lib/context-menu/index.min.js +1 -1
- package/lib/context-menu/src/context-menu.js +299 -13
- package/lib/context-menu/src/context-menu.min.js +1 -1
- package/lib/context-menu/style/style.css +2 -8
- package/lib/context-menu/style/style.min.css +1 -1
- package/lib/dynamics/index.js +2 -0
- package/lib/dynamics/index.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +331 -29
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +4 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-context-menu/style/style.css +2 -8
- package/lib/vxe-context-menu/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/button/src/button-group.ts +14 -6
- package/packages/button/src/button.ts +13 -4
- package/packages/context-menu/index.ts +2 -2
- package/packages/context-menu/src/context-menu.ts +290 -15
- package/packages/dynamics/index.ts +1 -1
- package/packages/ui/index.ts +3 -1
- package/styles/components/context-menu.scss +2 -12
- package/types/components/button-group.d.ts +9 -1
- package/types/components/button.d.ts +9 -1
- package/types/components/context-menu.d.ts +3 -1
- package/types/components/table-module/filter.d.ts +4 -0
- /package/es/icon/{iconfont.1767617712062.ttf → iconfont.1767779770584.ttf} +0 -0
- /package/es/icon/{iconfont.1767617712062.woff → iconfont.1767779770584.woff} +0 -0
- /package/es/icon/{iconfont.1767617712062.woff2 → iconfont.1767779770584.woff2} +0 -0
- /package/es/{iconfont.1767617712062.ttf → iconfont.1767779770584.ttf} +0 -0
- /package/es/{iconfont.1767617712062.woff → iconfont.1767779770584.woff} +0 -0
- /package/es/{iconfont.1767617712062.woff2 → iconfont.1767779770584.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1767617712062.ttf → iconfont.1767779770584.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1767617712062.woff → iconfont.1767779770584.woff} +0 -0
- /package/lib/icon/style/{iconfont.1767617712062.woff2 → iconfont.1767779770584.woff2} +0 -0
- /package/lib/{iconfont.1767617712062.ttf → iconfont.1767779770584.ttf} +0 -0
- /package/lib/{iconfont.1767617712062.woff → iconfont.1767779770584.woff} +0 -0
- /package/lib/{iconfont.1767617712062.woff2 → iconfont.1767779770584.woff2} +0 -0
package/lib/index.umd.js
CHANGED
|
@@ -3636,6 +3636,8 @@ const VxeDynamics = defineVxeComponent({
|
|
|
3636
3636
|
optionClick(params);
|
|
3637
3637
|
}
|
|
3638
3638
|
}
|
|
3639
|
+
}, {
|
|
3640
|
+
events: undefined
|
|
3639
3641
|
});
|
|
3640
3642
|
}
|
|
3641
3643
|
return [modals.length ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
@@ -3659,14 +3661,14 @@ function checkDynamic() {
|
|
|
3659
3661
|
}
|
|
3660
3662
|
;// CONCATENATED MODULE: ./packages/ui/src/log.ts
|
|
3661
3663
|
|
|
3662
|
-
const log_version = `ui v${"4.11.
|
|
3664
|
+
const log_version = `ui v${"4.11.35"}`;
|
|
3663
3665
|
const warnLog = log.create('warn', log_version);
|
|
3664
3666
|
const errLog = log.create('error', log_version);
|
|
3665
3667
|
;// CONCATENATED MODULE: ./packages/ui/index.ts
|
|
3666
3668
|
|
|
3667
3669
|
|
|
3668
3670
|
|
|
3669
|
-
const ui_version = "4.11.
|
|
3671
|
+
const ui_version = "4.11.35";
|
|
3670
3672
|
index_esm_VxeUI.uiVersion = ui_version;
|
|
3671
3673
|
index_esm_VxeUI.dynamicApp = dynamicApp;
|
|
3672
3674
|
function config(options) {
|
|
@@ -3736,7 +3738,9 @@ setConfig({
|
|
|
3736
3738
|
}
|
|
3737
3739
|
},
|
|
3738
3740
|
collapsePane: {},
|
|
3739
|
-
contextMenu: {
|
|
3741
|
+
contextMenu: {
|
|
3742
|
+
autoLocate: true
|
|
3743
|
+
},
|
|
3740
3744
|
countdown: {},
|
|
3741
3745
|
colorPicker: {
|
|
3742
3746
|
type: 'rgb',
|
|
@@ -7335,7 +7339,7 @@ const VxeButtonComponent = defineVxeComponent({
|
|
|
7335
7339
|
default: null
|
|
7336
7340
|
}
|
|
7337
7341
|
},
|
|
7338
|
-
emits: ['click', 'mouseenter', 'mouseleave', 'dropdown-click', 'dropdownClick'],
|
|
7342
|
+
emits: ['click', 'mouseenter', 'mouseleave', 'dropdown-click', 'dropdownClick', 'contextmenu'],
|
|
7339
7343
|
setup(props, context) {
|
|
7340
7344
|
const {
|
|
7341
7345
|
slots,
|
|
@@ -7613,6 +7617,9 @@ const VxeButtonComponent = defineVxeComponent({
|
|
|
7613
7617
|
const mouseleaveEvent = evnt => {
|
|
7614
7618
|
dispatchEvent('mouseleave', {}, evnt);
|
|
7615
7619
|
};
|
|
7620
|
+
const contextmenuEvent = evnt => {
|
|
7621
|
+
dispatchEvent('contextmenu', {}, evnt);
|
|
7622
|
+
};
|
|
7616
7623
|
const clickTargetEvent = evnt => {
|
|
7617
7624
|
const {
|
|
7618
7625
|
loading,
|
|
@@ -7849,7 +7856,9 @@ const VxeButtonComponent = defineVxeComponent({
|
|
|
7849
7856
|
return renderEmptyElement($xeButton);
|
|
7850
7857
|
}
|
|
7851
7858
|
if (dropdownsSlot || downBtnList.length) {
|
|
7852
|
-
const btnOns = {
|
|
7859
|
+
const btnOns = {
|
|
7860
|
+
onContextmenu: contextmenuEvent
|
|
7861
|
+
};
|
|
7853
7862
|
const panelOns = {};
|
|
7854
7863
|
if (trigger === 'hover') {
|
|
7855
7864
|
// hover 触发
|
|
@@ -7977,7 +7986,8 @@ const VxeButtonComponent = defineVxeComponent({
|
|
|
7977
7986
|
to: routerLink,
|
|
7978
7987
|
onClick: clickEvent,
|
|
7979
7988
|
onMouseenter: mouseenterEvent,
|
|
7980
|
-
onMouseleave: mouseleaveEvent
|
|
7989
|
+
onMouseleave: mouseleaveEvent,
|
|
7990
|
+
onContextmenu: contextmenuEvent
|
|
7981
7991
|
}, {
|
|
7982
7992
|
default() {
|
|
7983
7993
|
return renderContent();
|
|
@@ -8002,7 +8012,8 @@ const VxeButtonComponent = defineVxeComponent({
|
|
|
8002
8012
|
disabled: btnDisabled || loading,
|
|
8003
8013
|
onClick: clickEvent,
|
|
8004
8014
|
onMouseenter: mouseenterEvent,
|
|
8005
|
-
onMouseleave: mouseleaveEvent
|
|
8015
|
+
onMouseleave: mouseleaveEvent,
|
|
8016
|
+
onContextmenu: contextmenuEvent
|
|
8006
8017
|
}, renderContent());
|
|
8007
8018
|
};
|
|
8008
8019
|
$xeButton.renderVN = renderVN;
|
|
@@ -8063,7 +8074,7 @@ const Button = VxeButton;
|
|
|
8063
8074
|
default: () => getConfig().buttonGroup.size || getConfig().size
|
|
8064
8075
|
}
|
|
8065
8076
|
},
|
|
8066
|
-
emits: ['click'],
|
|
8077
|
+
emits: ['click', 'contextmenu'],
|
|
8067
8078
|
setup(props, context) {
|
|
8068
8079
|
const {
|
|
8069
8080
|
slots,
|
|
@@ -8083,12 +8094,13 @@ const Button = VxeButton;
|
|
|
8083
8094
|
const {
|
|
8084
8095
|
computePermissionInfo
|
|
8085
8096
|
} = usePermission(props);
|
|
8097
|
+
const dispatchEvent = (type, params, evnt) => {
|
|
8098
|
+
emit(type, createEvent(evnt, {
|
|
8099
|
+
$buttonGroup: $xeButtonGroup
|
|
8100
|
+
}, params));
|
|
8101
|
+
};
|
|
8086
8102
|
const buttonGroupMethods = {
|
|
8087
|
-
dispatchEvent
|
|
8088
|
-
emit(type, createEvent(evnt, {
|
|
8089
|
-
$buttonGroup: $xeButtonGroup
|
|
8090
|
-
}, params));
|
|
8091
|
-
}
|
|
8103
|
+
dispatchEvent
|
|
8092
8104
|
};
|
|
8093
8105
|
const buttonGroupPrivateMethods = {
|
|
8094
8106
|
handleClick(params, evnt) {
|
|
@@ -8105,6 +8117,9 @@ const Button = VxeButton;
|
|
|
8105
8117
|
}, evnt);
|
|
8106
8118
|
}
|
|
8107
8119
|
};
|
|
8120
|
+
const contextmenuEvent = evnt => {
|
|
8121
|
+
dispatchEvent('contextmenu', {}, evnt);
|
|
8122
|
+
};
|
|
8108
8123
|
Object.assign($xeButtonGroup, buttonGroupMethods, buttonGroupPrivateMethods);
|
|
8109
8124
|
const renderVN = () => {
|
|
8110
8125
|
const {
|
|
@@ -8122,7 +8137,8 @@ const Button = VxeButton;
|
|
|
8122
8137
|
$buttonGroup: $xeButtonGroup
|
|
8123
8138
|
}) : className : '', {
|
|
8124
8139
|
'is--vertical': vertical
|
|
8125
|
-
}]
|
|
8140
|
+
}],
|
|
8141
|
+
onContextmenu: contextmenuEvent
|
|
8126
8142
|
}, defaultSlot ? defaultSlot({}) : options ? options.map((item, index) => {
|
|
8127
8143
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(src_button, {
|
|
8128
8144
|
key: index,
|
|
@@ -17438,7 +17454,7 @@ function context_menu_createReactData() {
|
|
|
17438
17454
|
left: '',
|
|
17439
17455
|
zIndex: 0
|
|
17440
17456
|
},
|
|
17441
|
-
|
|
17457
|
+
childOffsetX: 0
|
|
17442
17458
|
};
|
|
17443
17459
|
}
|
|
17444
17460
|
/* harmony default export */ var context_menu = (defineVxeComponent({
|
|
@@ -17453,6 +17469,10 @@ function context_menu_createReactData() {
|
|
|
17453
17469
|
options: Array,
|
|
17454
17470
|
x: [Number, String],
|
|
17455
17471
|
y: [Number, String],
|
|
17472
|
+
autoLocate: {
|
|
17473
|
+
type: Boolean,
|
|
17474
|
+
default: () => getConfig().contextMenu.autoLocate
|
|
17475
|
+
},
|
|
17456
17476
|
zIndex: [Number, String],
|
|
17457
17477
|
position: {
|
|
17458
17478
|
type: String,
|
|
@@ -17488,6 +17508,20 @@ function context_menu_createReactData() {
|
|
|
17488
17508
|
} = props;
|
|
17489
17509
|
return options || [];
|
|
17490
17510
|
});
|
|
17511
|
+
const computeAllFirstMenuList = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
17512
|
+
const menuGroups = computeMenuGroups.value;
|
|
17513
|
+
const firstList = [];
|
|
17514
|
+
for (let i = 0; i < menuGroups.length; i++) {
|
|
17515
|
+
const list = menuGroups[i];
|
|
17516
|
+
for (let j = 0; j < list.length; j++) {
|
|
17517
|
+
const firstItem = list[j];
|
|
17518
|
+
if (hasValidItem(firstItem)) {
|
|
17519
|
+
firstList.push(firstItem);
|
|
17520
|
+
}
|
|
17521
|
+
}
|
|
17522
|
+
}
|
|
17523
|
+
return firstList;
|
|
17524
|
+
});
|
|
17491
17525
|
const computeTopAndLeft = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
17492
17526
|
const {
|
|
17493
17527
|
x,
|
|
@@ -17521,7 +17555,7 @@ function context_menu_createReactData() {
|
|
|
17521
17555
|
} = reactData;
|
|
17522
17556
|
const value = true;
|
|
17523
17557
|
reactData.visible = value;
|
|
17524
|
-
|
|
17558
|
+
handleLocate();
|
|
17525
17559
|
updateZindex();
|
|
17526
17560
|
if (modelValue !== value) {
|
|
17527
17561
|
emitModel(value);
|
|
@@ -17534,7 +17568,9 @@ function context_menu_createReactData() {
|
|
|
17534
17568
|
visible: value
|
|
17535
17569
|
}, null);
|
|
17536
17570
|
}
|
|
17537
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)()
|
|
17571
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
|
|
17572
|
+
updateLocate();
|
|
17573
|
+
});
|
|
17538
17574
|
};
|
|
17539
17575
|
const close = () => {
|
|
17540
17576
|
const {
|
|
@@ -17558,7 +17594,7 @@ function context_menu_createReactData() {
|
|
|
17558
17594
|
}
|
|
17559
17595
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
17560
17596
|
};
|
|
17561
|
-
const
|
|
17597
|
+
const handleLocate = () => {
|
|
17562
17598
|
const {
|
|
17563
17599
|
x,
|
|
17564
17600
|
y
|
|
@@ -17568,6 +17604,7 @@ function context_menu_createReactData() {
|
|
|
17568
17604
|
} = reactData;
|
|
17569
17605
|
popupStyle.left = toCssUnit(x || 0);
|
|
17570
17606
|
popupStyle.top = toCssUnit(y || 0);
|
|
17607
|
+
updateLocate();
|
|
17571
17608
|
};
|
|
17572
17609
|
const updateZindex = () => {
|
|
17573
17610
|
const {
|
|
@@ -17586,6 +17623,67 @@ function context_menu_createReactData() {
|
|
|
17586
17623
|
}
|
|
17587
17624
|
}
|
|
17588
17625
|
};
|
|
17626
|
+
const updateLocate = () => {
|
|
17627
|
+
const {
|
|
17628
|
+
autoLocate,
|
|
17629
|
+
position
|
|
17630
|
+
} = props;
|
|
17631
|
+
const {
|
|
17632
|
+
popupStyle
|
|
17633
|
+
} = reactData;
|
|
17634
|
+
if (autoLocate) {
|
|
17635
|
+
const wrapperEl = refElem.value;
|
|
17636
|
+
if (wrapperEl) {
|
|
17637
|
+
const {
|
|
17638
|
+
visibleWidth,
|
|
17639
|
+
visibleHeight
|
|
17640
|
+
} = getDomNode();
|
|
17641
|
+
const wrapperStyle = getComputedStyle(wrapperEl);
|
|
17642
|
+
const offsetTop = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(wrapperStyle.top);
|
|
17643
|
+
const offsetLeft = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(wrapperStyle.left);
|
|
17644
|
+
const wrapperWidth = wrapperEl.offsetWidth;
|
|
17645
|
+
const wrapperHeight = wrapperEl.offsetHeight;
|
|
17646
|
+
if (position === 'absolute') {
|
|
17647
|
+
//
|
|
17648
|
+
} else {
|
|
17649
|
+
if (offsetTop + wrapperHeight > visibleHeight) {
|
|
17650
|
+
popupStyle.top = `${Math.max(0, offsetTop - wrapperHeight)}px`;
|
|
17651
|
+
}
|
|
17652
|
+
if (offsetLeft + wrapperWidth > visibleWidth) {
|
|
17653
|
+
popupStyle.left = `${Math.max(0, offsetLeft - wrapperWidth)}px`;
|
|
17654
|
+
}
|
|
17655
|
+
}
|
|
17656
|
+
}
|
|
17657
|
+
}
|
|
17658
|
+
updateChildLocate();
|
|
17659
|
+
};
|
|
17660
|
+
const updateChildLocate = () => {
|
|
17661
|
+
const wrapperEl = refElem.value;
|
|
17662
|
+
if (wrapperEl) {
|
|
17663
|
+
const {
|
|
17664
|
+
visibleWidth
|
|
17665
|
+
} = getDomNode();
|
|
17666
|
+
const owSize = 2;
|
|
17667
|
+
const handleStyle = () => {
|
|
17668
|
+
const wrapperStyle = getComputedStyle(wrapperEl);
|
|
17669
|
+
const offsetLeft = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(wrapperStyle.left);
|
|
17670
|
+
const wrapperWidth = wrapperEl.offsetWidth;
|
|
17671
|
+
const childEl = wrapperEl.querySelector('.vxe-context-menu--children-wrapper');
|
|
17672
|
+
const childWidth = childEl ? childEl.offsetWidth : wrapperWidth;
|
|
17673
|
+
if (offsetLeft + wrapperWidth > visibleWidth - childWidth) {
|
|
17674
|
+
// 往左
|
|
17675
|
+
reactData.childOffsetX = -childWidth + owSize;
|
|
17676
|
+
} else {
|
|
17677
|
+
// 往右
|
|
17678
|
+
reactData.childOffsetX = wrapperWidth - owSize;
|
|
17679
|
+
}
|
|
17680
|
+
};
|
|
17681
|
+
handleStyle();
|
|
17682
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
17683
|
+
handleStyle();
|
|
17684
|
+
});
|
|
17685
|
+
}
|
|
17686
|
+
};
|
|
17589
17687
|
const handleVisible = () => {
|
|
17590
17688
|
const {
|
|
17591
17689
|
modelValue
|
|
@@ -17617,12 +17715,193 @@ function context_menu_createReactData() {
|
|
|
17617
17715
|
};
|
|
17618
17716
|
const handleItemMouseenterEvent = (evnt, item, parentitem) => {
|
|
17619
17717
|
reactData.activeOption = parentitem || item;
|
|
17620
|
-
|
|
17718
|
+
if (parentitem) {
|
|
17719
|
+
reactData.activeOption = parentitem;
|
|
17720
|
+
reactData.activeChildOption = item;
|
|
17721
|
+
} else {
|
|
17722
|
+
reactData.activeOption = item;
|
|
17723
|
+
if (hasChildMenu(item)) {
|
|
17724
|
+
reactData.activeChildOption = findFirstChildItem(item);
|
|
17725
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
17726
|
+
updateChildLocate();
|
|
17727
|
+
});
|
|
17728
|
+
} else {
|
|
17729
|
+
reactData.activeChildOption = null;
|
|
17730
|
+
}
|
|
17731
|
+
}
|
|
17621
17732
|
};
|
|
17622
17733
|
const handleItemMouseleaveEvent = () => {
|
|
17623
17734
|
reactData.activeOption = null;
|
|
17624
17735
|
reactData.activeChildOption = null;
|
|
17625
17736
|
};
|
|
17737
|
+
const hasValidItem = item => {
|
|
17738
|
+
return !item.loading && !item.disabled && item.visible !== false;
|
|
17739
|
+
};
|
|
17740
|
+
const findNextFirstItem = (allFirstList, firstItem) => {
|
|
17741
|
+
for (let i = 0; i < allFirstList.length; i++) {
|
|
17742
|
+
const item = allFirstList[i];
|
|
17743
|
+
if (firstItem === item) {
|
|
17744
|
+
const nextItem = allFirstList[i + 1];
|
|
17745
|
+
if (nextItem) {
|
|
17746
|
+
return nextItem;
|
|
17747
|
+
}
|
|
17748
|
+
}
|
|
17749
|
+
}
|
|
17750
|
+
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().first(allFirstList);
|
|
17751
|
+
};
|
|
17752
|
+
const findPrevFirstItem = (allFirstList, firstItem) => {
|
|
17753
|
+
for (let i = 0; i < allFirstList.length; i++) {
|
|
17754
|
+
const item = allFirstList[i];
|
|
17755
|
+
if (firstItem === item) {
|
|
17756
|
+
if (i > 0) {
|
|
17757
|
+
return allFirstList[i - 1];
|
|
17758
|
+
}
|
|
17759
|
+
}
|
|
17760
|
+
}
|
|
17761
|
+
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(allFirstList);
|
|
17762
|
+
};
|
|
17763
|
+
const findFirstChildItem = firstItem => {
|
|
17764
|
+
const {
|
|
17765
|
+
children
|
|
17766
|
+
} = firstItem;
|
|
17767
|
+
if (children) {
|
|
17768
|
+
for (let i = 0; i < children.length; i++) {
|
|
17769
|
+
const item = children[i];
|
|
17770
|
+
if (hasValidItem(item)) {
|
|
17771
|
+
return item;
|
|
17772
|
+
}
|
|
17773
|
+
}
|
|
17774
|
+
}
|
|
17775
|
+
return null;
|
|
17776
|
+
};
|
|
17777
|
+
const findPrevChildItem = (firstItem, childItem) => {
|
|
17778
|
+
const {
|
|
17779
|
+
children
|
|
17780
|
+
} = firstItem;
|
|
17781
|
+
let prevValidItem = null;
|
|
17782
|
+
if (children) {
|
|
17783
|
+
for (let i = 0; i < children.length; i++) {
|
|
17784
|
+
const item = children[i];
|
|
17785
|
+
if (childItem === item) {
|
|
17786
|
+
break;
|
|
17787
|
+
}
|
|
17788
|
+
if (hasValidItem(item)) {
|
|
17789
|
+
prevValidItem = item;
|
|
17790
|
+
}
|
|
17791
|
+
}
|
|
17792
|
+
if (!prevValidItem) {
|
|
17793
|
+
for (let len = children.length - 1; len >= 0; len--) {
|
|
17794
|
+
const item = children[len];
|
|
17795
|
+
if (hasValidItem(item)) {
|
|
17796
|
+
return item;
|
|
17797
|
+
}
|
|
17798
|
+
}
|
|
17799
|
+
}
|
|
17800
|
+
}
|
|
17801
|
+
return prevValidItem;
|
|
17802
|
+
};
|
|
17803
|
+
const findNextChildItem = (firstItem, childItem) => {
|
|
17804
|
+
const {
|
|
17805
|
+
children
|
|
17806
|
+
} = firstItem;
|
|
17807
|
+
let firstValidItem = null;
|
|
17808
|
+
if (children) {
|
|
17809
|
+
let isMetch = false;
|
|
17810
|
+
for (let i = 0; i < children.length; i++) {
|
|
17811
|
+
const item = children[i];
|
|
17812
|
+
if (!firstValidItem) {
|
|
17813
|
+
if (hasValidItem(item)) {
|
|
17814
|
+
firstValidItem = item;
|
|
17815
|
+
}
|
|
17816
|
+
}
|
|
17817
|
+
if (isMetch) {
|
|
17818
|
+
if (hasValidItem(item)) {
|
|
17819
|
+
return item;
|
|
17820
|
+
}
|
|
17821
|
+
} else {
|
|
17822
|
+
isMetch = childItem === item;
|
|
17823
|
+
}
|
|
17824
|
+
}
|
|
17825
|
+
}
|
|
17826
|
+
return firstValidItem;
|
|
17827
|
+
};
|
|
17828
|
+
const handleGlobalMousewheelEvent = evnt => {
|
|
17829
|
+
const {
|
|
17830
|
+
visible
|
|
17831
|
+
} = reactData;
|
|
17832
|
+
if (visible) {
|
|
17833
|
+
const el = refElem.value;
|
|
17834
|
+
if (!getEventTargetNode(evnt, el, '').flag) {
|
|
17835
|
+
close();
|
|
17836
|
+
}
|
|
17837
|
+
}
|
|
17838
|
+
};
|
|
17839
|
+
const handleGlobalKeydownEvent = evnt => {
|
|
17840
|
+
const {
|
|
17841
|
+
visible,
|
|
17842
|
+
activeOption,
|
|
17843
|
+
activeChildOption
|
|
17844
|
+
} = reactData;
|
|
17845
|
+
const allFirstMenuList = computeAllFirstMenuList.value;
|
|
17846
|
+
if (visible) {
|
|
17847
|
+
const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
|
|
17848
|
+
const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN);
|
|
17849
|
+
const isLeftArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_LEFT);
|
|
17850
|
+
const isRightArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_RIGHT);
|
|
17851
|
+
const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER);
|
|
17852
|
+
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE);
|
|
17853
|
+
if (isEsc) {
|
|
17854
|
+
close();
|
|
17855
|
+
return;
|
|
17856
|
+
}
|
|
17857
|
+
// 回车选中
|
|
17858
|
+
if (isEnter) {
|
|
17859
|
+
if (activeOption || activeChildOption) {
|
|
17860
|
+
evnt.preventDefault();
|
|
17861
|
+
evnt.stopPropagation();
|
|
17862
|
+
if (!activeChildOption && hasChildMenu(activeOption)) {
|
|
17863
|
+
reactData.activeChildOption = findFirstChildItem(activeOption);
|
|
17864
|
+
updateChildLocate();
|
|
17865
|
+
return;
|
|
17866
|
+
}
|
|
17867
|
+
handleItemClickEvent(evnt, activeChildOption || activeOption);
|
|
17868
|
+
return;
|
|
17869
|
+
}
|
|
17870
|
+
}
|
|
17871
|
+
// 方向键操作
|
|
17872
|
+
if (activeChildOption) {
|
|
17873
|
+
if (isUpArrow) {
|
|
17874
|
+
evnt.preventDefault();
|
|
17875
|
+
reactData.activeChildOption = findPrevChildItem(activeOption, activeChildOption);
|
|
17876
|
+
updateChildLocate();
|
|
17877
|
+
} else if (isDwArrow) {
|
|
17878
|
+
evnt.preventDefault();
|
|
17879
|
+
reactData.activeChildOption = findNextChildItem(activeOption, activeChildOption);
|
|
17880
|
+
updateChildLocate();
|
|
17881
|
+
} else if (isLeftArrow) {
|
|
17882
|
+
evnt.preventDefault();
|
|
17883
|
+
reactData.activeChildOption = null;
|
|
17884
|
+
}
|
|
17885
|
+
} else if (activeOption) {
|
|
17886
|
+
evnt.preventDefault();
|
|
17887
|
+
if (isUpArrow) {
|
|
17888
|
+
reactData.activeOption = findPrevFirstItem(allFirstMenuList, activeOption);
|
|
17889
|
+
} else if (isDwArrow) {
|
|
17890
|
+
reactData.activeOption = findNextFirstItem(allFirstMenuList, activeOption);
|
|
17891
|
+
} else {
|
|
17892
|
+
if (hasChildMenu(activeOption)) {
|
|
17893
|
+
if (isRightArrow) {
|
|
17894
|
+
reactData.activeChildOption = findFirstChildItem(activeOption);
|
|
17895
|
+
updateChildLocate();
|
|
17896
|
+
}
|
|
17897
|
+
}
|
|
17898
|
+
}
|
|
17899
|
+
} else {
|
|
17900
|
+
evnt.preventDefault();
|
|
17901
|
+
reactData.activeOption = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().first(allFirstMenuList);
|
|
17902
|
+
}
|
|
17903
|
+
}
|
|
17904
|
+
};
|
|
17626
17905
|
const handleGlobalMousedownEvent = evnt => {
|
|
17627
17906
|
const {
|
|
17628
17907
|
visible
|
|
@@ -17634,6 +17913,14 @@ function context_menu_createReactData() {
|
|
|
17634
17913
|
}
|
|
17635
17914
|
}
|
|
17636
17915
|
};
|
|
17916
|
+
const handleGlobalBlurEvent = () => {
|
|
17917
|
+
const {
|
|
17918
|
+
visible
|
|
17919
|
+
} = reactData;
|
|
17920
|
+
if (visible) {
|
|
17921
|
+
close();
|
|
17922
|
+
}
|
|
17923
|
+
};
|
|
17637
17924
|
const tagPrivateMethods = {};
|
|
17638
17925
|
Object.assign($xeContextMenu, tagMethods, tagPrivateMethods);
|
|
17639
17926
|
const renderMenuItem = (item, parentItem, hasChildMenus) => {
|
|
@@ -17697,7 +17984,8 @@ function context_menu_createReactData() {
|
|
|
17697
17984
|
const renderMenus = () => {
|
|
17698
17985
|
const {
|
|
17699
17986
|
activeOption,
|
|
17700
|
-
activeChildOption
|
|
17987
|
+
activeChildOption,
|
|
17988
|
+
childOffsetX
|
|
17701
17989
|
} = reactData;
|
|
17702
17990
|
const menuGroups = computeMenuGroups.value;
|
|
17703
17991
|
const mgVNs = [];
|
|
@@ -17708,13 +17996,19 @@ function context_menu_createReactData() {
|
|
|
17708
17996
|
children
|
|
17709
17997
|
} = firstItem;
|
|
17710
17998
|
const hasChildMenus = children && children.some(child => child.visible !== false);
|
|
17999
|
+
const isActiveFirst = activeOption === firstItem;
|
|
18000
|
+
const showChild = isActiveFirst && !!activeChildOption;
|
|
17711
18001
|
moVNs.push((0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
17712
18002
|
key: `${gIndex}_${i}`,
|
|
17713
18003
|
class: ['vxe-context-menu--item-wrapper vxe-context-menu--first-item', firstItem.className || '', {
|
|
17714
|
-
'is--active':
|
|
18004
|
+
'is--active': isActiveFirst,
|
|
18005
|
+
'is--subactive': isActiveFirst && !!activeChildOption
|
|
17715
18006
|
}]
|
|
17716
|
-
}, [hasChildMenus ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
17717
|
-
class: 'vxe-context-menu--children-wrapper'
|
|
18007
|
+
}, [hasChildMenus && showChild ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
18008
|
+
class: 'vxe-context-menu--children-wrapper',
|
|
18009
|
+
style: {
|
|
18010
|
+
transform: `translate(${childOffsetX}px, -5px)`
|
|
18011
|
+
}
|
|
17718
18012
|
}, children.map(twoItem => {
|
|
17719
18013
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
17720
18014
|
class: ['vxe-context-menu--item-wrapper vxe-context-menu--child-item', twoItem.className || '', {
|
|
@@ -17738,13 +18032,12 @@ function context_menu_createReactData() {
|
|
|
17738
18032
|
} = props;
|
|
17739
18033
|
const {
|
|
17740
18034
|
visible,
|
|
17741
|
-
popupStyle
|
|
17742
|
-
childPos
|
|
18035
|
+
popupStyle
|
|
17743
18036
|
} = reactData;
|
|
17744
18037
|
const vSize = computeSize.value;
|
|
17745
18038
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
17746
18039
|
ref: refElem,
|
|
17747
|
-
class: ['vxe-context-menu vxe-context-menu--wrapper', position === 'absolute' ? 'is--' + position : 'is--fixed',
|
|
18040
|
+
class: ['vxe-context-menu vxe-context-menu--wrapper', position === 'absolute' ? 'is--' + position : 'is--fixed', className || '', {
|
|
17748
18041
|
[`size--${vSize}`]: vSize,
|
|
17749
18042
|
'is--visible': visible
|
|
17750
18043
|
}],
|
|
@@ -17752,17 +18045,26 @@ function context_menu_createReactData() {
|
|
|
17752
18045
|
}, (destroyOnClose ? visible : true) ? renderMenus() : []);
|
|
17753
18046
|
};
|
|
17754
18047
|
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(computeTopAndLeft, () => {
|
|
17755
|
-
|
|
18048
|
+
handleLocate();
|
|
18049
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
18050
|
+
updateLocate();
|
|
18051
|
+
});
|
|
17756
18052
|
});
|
|
17757
18053
|
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.modelValue, () => {
|
|
17758
18054
|
handleVisible();
|
|
17759
18055
|
});
|
|
17760
18056
|
handleVisible();
|
|
17761
18057
|
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
|
|
18058
|
+
globalEvents.on($xeContextMenu, 'mousewheel', handleGlobalMousewheelEvent);
|
|
18059
|
+
globalEvents.on($xeContextMenu, 'keydown', handleGlobalKeydownEvent);
|
|
17762
18060
|
globalEvents.on($xeContextMenu, 'mousedown', handleGlobalMousedownEvent);
|
|
18061
|
+
globalEvents.on($xeContextMenu, 'blur', handleGlobalBlurEvent);
|
|
17763
18062
|
});
|
|
17764
18063
|
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.onBeforeUnmount)(() => {
|
|
18064
|
+
globalEvents.off($xeContextMenu, 'mousewheel');
|
|
18065
|
+
globalEvents.off($xeContextMenu, 'keydown');
|
|
17765
18066
|
globalEvents.off($xeContextMenu, 'mousedown');
|
|
18067
|
+
globalEvents.off($xeContextMenu, 'blur');
|
|
17766
18068
|
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(reactData, context_menu_createReactData());
|
|
17767
18069
|
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, context_menu_createInternalData());
|
|
17768
18070
|
});
|
|
@@ -17810,8 +18112,8 @@ const ContextMenuController = {
|
|
|
17810
18112
|
evnt.preventDefault();
|
|
17811
18113
|
evnt.stopPropagation();
|
|
17812
18114
|
const opts = Object.assign({}, options);
|
|
17813
|
-
const x = evnt.clientX;
|
|
17814
|
-
const y = evnt.clientY;
|
|
18115
|
+
const x = evnt.clientX + 1;
|
|
18116
|
+
const y = evnt.clientY + 1;
|
|
17815
18117
|
openMenu(opts, x, y);
|
|
17816
18118
|
},
|
|
17817
18119
|
close() {
|