vxe-pc-ui 4.11.33 → 4.11.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/es/button/src/button-group.js +11 -5
  2. package/es/button/src/button.js +12 -4
  3. package/es/context-menu/src/context-menu.js +218 -3
  4. package/es/context-menu/style.css +1 -1
  5. package/es/context-menu/style.min.css +1 -1
  6. package/es/icon/style.css +1 -1
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-context-menu/style.css +1 -1
  12. package/es/vxe-context-menu/style.min.css +1 -1
  13. package/lib/button/src/button-group.js +12 -7
  14. package/lib/button/src/button-group.min.js +1 -1
  15. package/lib/button/src/button.js +11 -4
  16. package/lib/button/src/button.min.js +1 -1
  17. package/lib/context-menu/src/context-menu.js +219 -2
  18. package/lib/context-menu/src/context-menu.min.js +1 -1
  19. package/lib/context-menu/style/style.css +1 -1
  20. package/lib/context-menu/style/style.min.css +1 -1
  21. package/lib/icon/style/style.css +1 -1
  22. package/lib/icon/style/style.min.css +1 -1
  23. package/lib/index.umd.js +244 -15
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/ui/index.js +1 -1
  28. package/lib/ui/index.min.js +1 -1
  29. package/lib/ui/src/log.js +1 -1
  30. package/lib/ui/src/log.min.js +1 -1
  31. package/lib/vxe-context-menu/style/style.css +1 -1
  32. package/lib/vxe-context-menu/style/style.min.css +1 -1
  33. package/package.json +1 -1
  34. package/packages/button/src/button-group.ts +14 -6
  35. package/packages/button/src/button.ts +13 -4
  36. package/packages/context-menu/src/context-menu.ts +216 -4
  37. package/styles/components/context-menu.scss +1 -1
  38. package/types/components/button-group.d.ts +9 -1
  39. package/types/components/button.d.ts +9 -1
  40. /package/es/icon/{iconfont.1767617712062.ttf → iconfont.1767662202838.ttf} +0 -0
  41. /package/es/icon/{iconfont.1767617712062.woff → iconfont.1767662202838.woff} +0 -0
  42. /package/es/icon/{iconfont.1767617712062.woff2 → iconfont.1767662202838.woff2} +0 -0
  43. /package/es/{iconfont.1767617712062.ttf → iconfont.1767662202838.ttf} +0 -0
  44. /package/es/{iconfont.1767617712062.woff → iconfont.1767662202838.woff} +0 -0
  45. /package/es/{iconfont.1767617712062.woff2 → iconfont.1767662202838.woff2} +0 -0
  46. /package/lib/icon/style/{iconfont.1767617712062.ttf → iconfont.1767662202838.ttf} +0 -0
  47. /package/lib/icon/style/{iconfont.1767617712062.woff → iconfont.1767662202838.woff} +0 -0
  48. /package/lib/icon/style/{iconfont.1767617712062.woff2 → iconfont.1767662202838.woff2} +0 -0
  49. /package/lib/{iconfont.1767617712062.ttf → iconfont.1767662202838.ttf} +0 -0
  50. /package/lib/{iconfont.1767617712062.woff → iconfont.1767662202838.woff} +0 -0
  51. /package/lib/{iconfont.1767617712062.woff2 → iconfont.1767662202838.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -3659,14 +3659,14 @@ function checkDynamic() {
3659
3659
  }
3660
3660
  ;// CONCATENATED MODULE: ./packages/ui/src/log.ts
3661
3661
 
3662
- const log_version = `ui v${"4.11.33"}`;
3662
+ const log_version = `ui v${"4.11.34"}`;
3663
3663
  const warnLog = log.create('warn', log_version);
3664
3664
  const errLog = log.create('error', log_version);
3665
3665
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
3666
3666
 
3667
3667
 
3668
3668
 
3669
- const ui_version = "4.11.33";
3669
+ const ui_version = "4.11.34";
3670
3670
  index_esm_VxeUI.uiVersion = ui_version;
3671
3671
  index_esm_VxeUI.dynamicApp = dynamicApp;
3672
3672
  function config(options) {
@@ -7335,7 +7335,7 @@ const VxeButtonComponent = defineVxeComponent({
7335
7335
  default: null
7336
7336
  }
7337
7337
  },
7338
- emits: ['click', 'mouseenter', 'mouseleave', 'dropdown-click', 'dropdownClick'],
7338
+ emits: ['click', 'mouseenter', 'mouseleave', 'dropdown-click', 'dropdownClick', 'contextmenu'],
7339
7339
  setup(props, context) {
7340
7340
  const {
7341
7341
  slots,
@@ -7613,6 +7613,9 @@ const VxeButtonComponent = defineVxeComponent({
7613
7613
  const mouseleaveEvent = evnt => {
7614
7614
  dispatchEvent('mouseleave', {}, evnt);
7615
7615
  };
7616
+ const contextmenuEvent = evnt => {
7617
+ dispatchEvent('contextmenu', {}, evnt);
7618
+ };
7616
7619
  const clickTargetEvent = evnt => {
7617
7620
  const {
7618
7621
  loading,
@@ -7849,7 +7852,9 @@ const VxeButtonComponent = defineVxeComponent({
7849
7852
  return renderEmptyElement($xeButton);
7850
7853
  }
7851
7854
  if (dropdownsSlot || downBtnList.length) {
7852
- const btnOns = {};
7855
+ const btnOns = {
7856
+ onContextmenu: contextmenuEvent
7857
+ };
7853
7858
  const panelOns = {};
7854
7859
  if (trigger === 'hover') {
7855
7860
  // hover 触发
@@ -7977,7 +7982,8 @@ const VxeButtonComponent = defineVxeComponent({
7977
7982
  to: routerLink,
7978
7983
  onClick: clickEvent,
7979
7984
  onMouseenter: mouseenterEvent,
7980
- onMouseleave: mouseleaveEvent
7985
+ onMouseleave: mouseleaveEvent,
7986
+ onContextmenu: contextmenuEvent
7981
7987
  }, {
7982
7988
  default() {
7983
7989
  return renderContent();
@@ -8002,7 +8008,8 @@ const VxeButtonComponent = defineVxeComponent({
8002
8008
  disabled: btnDisabled || loading,
8003
8009
  onClick: clickEvent,
8004
8010
  onMouseenter: mouseenterEvent,
8005
- onMouseleave: mouseleaveEvent
8011
+ onMouseleave: mouseleaveEvent,
8012
+ onContextmenu: contextmenuEvent
8006
8013
  }, renderContent());
8007
8014
  };
8008
8015
  $xeButton.renderVN = renderVN;
@@ -8063,7 +8070,7 @@ const Button = VxeButton;
8063
8070
  default: () => getConfig().buttonGroup.size || getConfig().size
8064
8071
  }
8065
8072
  },
8066
- emits: ['click'],
8073
+ emits: ['click', 'contextmenu'],
8067
8074
  setup(props, context) {
8068
8075
  const {
8069
8076
  slots,
@@ -8083,12 +8090,13 @@ const Button = VxeButton;
8083
8090
  const {
8084
8091
  computePermissionInfo
8085
8092
  } = usePermission(props);
8093
+ const dispatchEvent = (type, params, evnt) => {
8094
+ emit(type, createEvent(evnt, {
8095
+ $buttonGroup: $xeButtonGroup
8096
+ }, params));
8097
+ };
8086
8098
  const buttonGroupMethods = {
8087
- dispatchEvent(type, params, evnt) {
8088
- emit(type, createEvent(evnt, {
8089
- $buttonGroup: $xeButtonGroup
8090
- }, params));
8091
- }
8099
+ dispatchEvent
8092
8100
  };
8093
8101
  const buttonGroupPrivateMethods = {
8094
8102
  handleClick(params, evnt) {
@@ -8105,6 +8113,9 @@ const Button = VxeButton;
8105
8113
  }, evnt);
8106
8114
  }
8107
8115
  };
8116
+ const contextmenuEvent = evnt => {
8117
+ dispatchEvent('contextmenu', {}, evnt);
8118
+ };
8108
8119
  Object.assign($xeButtonGroup, buttonGroupMethods, buttonGroupPrivateMethods);
8109
8120
  const renderVN = () => {
8110
8121
  const {
@@ -8122,7 +8133,8 @@ const Button = VxeButton;
8122
8133
  $buttonGroup: $xeButtonGroup
8123
8134
  }) : className : '', {
8124
8135
  'is--vertical': vertical
8125
- }]
8136
+ }],
8137
+ onContextmenu: contextmenuEvent
8126
8138
  }, defaultSlot ? defaultSlot({}) : options ? options.map((item, index) => {
8127
8139
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(src_button, {
8128
8140
  key: index,
@@ -17488,6 +17500,20 @@ function context_menu_createReactData() {
17488
17500
  } = props;
17489
17501
  return options || [];
17490
17502
  });
17503
+ const computeAllFirstMenuList = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
17504
+ const menuGroups = computeMenuGroups.value;
17505
+ const firstList = [];
17506
+ for (let i = 0; i < menuGroups.length; i++) {
17507
+ const list = menuGroups[i];
17508
+ for (let j = 0; j < list.length; j++) {
17509
+ const firstItem = list[j];
17510
+ if (hasValidItem(firstItem)) {
17511
+ firstList.push(firstItem);
17512
+ }
17513
+ }
17514
+ }
17515
+ return firstList;
17516
+ });
17491
17517
  const computeTopAndLeft = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
17492
17518
  const {
17493
17519
  x,
@@ -17617,12 +17643,199 @@ function context_menu_createReactData() {
17617
17643
  };
17618
17644
  const handleItemMouseenterEvent = (evnt, item, parentitem) => {
17619
17645
  reactData.activeOption = parentitem || item;
17620
- reactData.activeChildOption = parentitem ? item : null;
17646
+ if (parentitem) {
17647
+ reactData.activeOption = parentitem;
17648
+ reactData.activeChildOption = item;
17649
+ } else {
17650
+ reactData.activeOption = item;
17651
+ if (hasChildMenu(item)) {
17652
+ reactData.activeChildOption = findFirstChildItem(item);
17653
+ } else {
17654
+ reactData.activeChildOption = null;
17655
+ }
17656
+ }
17621
17657
  };
17622
17658
  const handleItemMouseleaveEvent = () => {
17623
17659
  reactData.activeOption = null;
17624
17660
  reactData.activeChildOption = null;
17625
17661
  };
17662
+ const hasValidItem = item => {
17663
+ return !item.loading && !item.disabled && item.visible !== false;
17664
+ };
17665
+ const findNextFirstItem = (allFirstList, firstItem) => {
17666
+ for (let i = 0; i < allFirstList.length; i++) {
17667
+ const item = allFirstList[i];
17668
+ if (firstItem === item) {
17669
+ const nextItem = allFirstList[i + 1];
17670
+ if (nextItem) {
17671
+ return nextItem;
17672
+ }
17673
+ }
17674
+ }
17675
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().first(allFirstList);
17676
+ };
17677
+ const findPrevFirstItem = (allFirstList, firstItem) => {
17678
+ for (let i = 0; i < allFirstList.length; i++) {
17679
+ const item = allFirstList[i];
17680
+ if (firstItem === item) {
17681
+ if (i > 0) {
17682
+ return allFirstList[i - 1];
17683
+ }
17684
+ }
17685
+ }
17686
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().last(allFirstList);
17687
+ };
17688
+ const findFirstChildItem = firstItem => {
17689
+ const {
17690
+ children
17691
+ } = firstItem;
17692
+ if (children) {
17693
+ for (let i = 0; i < children.length; i++) {
17694
+ const item = children[i];
17695
+ if (hasValidItem(item)) {
17696
+ return item;
17697
+ }
17698
+ }
17699
+ }
17700
+ return null;
17701
+ };
17702
+ const findPrevChildItem = (firstItem, childItem) => {
17703
+ const {
17704
+ children
17705
+ } = firstItem;
17706
+ let prevValidItem = null;
17707
+ if (children) {
17708
+ for (let i = 0; i < children.length; i++) {
17709
+ const item = children[i];
17710
+ if (childItem === item) {
17711
+ break;
17712
+ }
17713
+ if (hasValidItem(item)) {
17714
+ prevValidItem = item;
17715
+ }
17716
+ }
17717
+ if (!prevValidItem) {
17718
+ for (let len = children.length - 1; len >= 0; len--) {
17719
+ const item = children[len];
17720
+ if (hasValidItem(item)) {
17721
+ return item;
17722
+ }
17723
+ }
17724
+ }
17725
+ }
17726
+ return prevValidItem;
17727
+ };
17728
+ const findNextChildItem = (firstItem, childItem) => {
17729
+ const {
17730
+ children
17731
+ } = firstItem;
17732
+ let firstValidItem = null;
17733
+ if (children) {
17734
+ let isMetch = false;
17735
+ for (let i = 0; i < children.length; i++) {
17736
+ const item = children[i];
17737
+ if (!firstValidItem) {
17738
+ if (hasValidItem(item)) {
17739
+ firstValidItem = item;
17740
+ }
17741
+ }
17742
+ if (isMetch) {
17743
+ if (hasValidItem(item)) {
17744
+ return item;
17745
+ }
17746
+ } else {
17747
+ isMetch = childItem === item;
17748
+ }
17749
+ }
17750
+ }
17751
+ return firstValidItem;
17752
+ };
17753
+ const handleGlobalMousewheelEvent = evnt => {
17754
+ const {
17755
+ visible
17756
+ } = reactData;
17757
+ if (visible) {
17758
+ const el = refElem.value;
17759
+ if (!getEventTargetNode(evnt, el, '').flag) {
17760
+ close();
17761
+ }
17762
+ }
17763
+ };
17764
+ const handleGlobalKeydownEvent = evnt => {
17765
+ const {
17766
+ visible,
17767
+ childPos,
17768
+ activeOption,
17769
+ activeChildOption
17770
+ } = reactData;
17771
+ const allFirstMenuList = computeAllFirstMenuList.value;
17772
+ if (visible) {
17773
+ const isLeftArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_LEFT);
17774
+ const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
17775
+ const isRightArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_RIGHT);
17776
+ const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN);
17777
+ const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER);
17778
+ // 回车选中
17779
+ if (isEnter) {
17780
+ if (activeOption || activeChildOption) {
17781
+ evnt.preventDefault();
17782
+ evnt.stopPropagation();
17783
+ if (!activeChildOption && hasChildMenu(activeOption)) {
17784
+ reactData.activeChildOption = findFirstChildItem(activeOption);
17785
+ return;
17786
+ }
17787
+ handleItemClickEvent(evnt, activeChildOption || activeOption);
17788
+ return;
17789
+ }
17790
+ }
17791
+ // 方向键操作
17792
+ if (activeChildOption) {
17793
+ if (isUpArrow) {
17794
+ evnt.preventDefault();
17795
+ reactData.activeChildOption = findPrevChildItem(activeOption, activeChildOption);
17796
+ } else if (isDwArrow) {
17797
+ evnt.preventDefault();
17798
+ reactData.activeChildOption = findNextChildItem(activeOption, activeChildOption);
17799
+ } else if (isLeftArrow) {
17800
+ evnt.preventDefault();
17801
+ if (childPos === 'left') {
17802
+ // 无操作
17803
+ } else {
17804
+ reactData.activeChildOption = null;
17805
+ }
17806
+ } else if (isRightArrow) {
17807
+ evnt.preventDefault();
17808
+ if (childPos === 'left') {
17809
+ reactData.activeChildOption = null;
17810
+ } else {
17811
+ // 无操作
17812
+ }
17813
+ }
17814
+ } else if (activeOption) {
17815
+ evnt.preventDefault();
17816
+ if (isUpArrow) {
17817
+ reactData.activeOption = findPrevFirstItem(allFirstMenuList, activeOption);
17818
+ } else if (isDwArrow) {
17819
+ reactData.activeOption = findNextFirstItem(allFirstMenuList, activeOption);
17820
+ } else {
17821
+ if (hasChildMenu(activeOption)) {
17822
+ if (childPos === 'left') {
17823
+ if (isLeftArrow) {
17824
+ reactData.activeChildOption = findFirstChildItem(activeOption);
17825
+ }
17826
+ } else {
17827
+ if (isRightArrow) {
17828
+ reactData.activeChildOption = findFirstChildItem(activeOption);
17829
+ }
17830
+ }
17831
+ }
17832
+ }
17833
+ } else {
17834
+ evnt.preventDefault();
17835
+ reactData.activeOption = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().first(allFirstMenuList);
17836
+ }
17837
+ }
17838
+ };
17626
17839
  const handleGlobalMousedownEvent = evnt => {
17627
17840
  const {
17628
17841
  visible
@@ -17634,6 +17847,14 @@ function context_menu_createReactData() {
17634
17847
  }
17635
17848
  }
17636
17849
  };
17850
+ const handleGlobalBlurEvent = () => {
17851
+ const {
17852
+ visible
17853
+ } = reactData;
17854
+ if (visible) {
17855
+ close();
17856
+ }
17857
+ };
17637
17858
  const tagPrivateMethods = {};
17638
17859
  Object.assign($xeContextMenu, tagMethods, tagPrivateMethods);
17639
17860
  const renderMenuItem = (item, parentItem, hasChildMenus) => {
@@ -17708,10 +17929,12 @@ function context_menu_createReactData() {
17708
17929
  children
17709
17930
  } = firstItem;
17710
17931
  const hasChildMenus = children && children.some(child => child.visible !== false);
17932
+ const isActiveFirst = activeOption === firstItem;
17711
17933
  moVNs.push((0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
17712
17934
  key: `${gIndex}_${i}`,
17713
17935
  class: ['vxe-context-menu--item-wrapper vxe-context-menu--first-item', firstItem.className || '', {
17714
- 'is--active': activeOption === firstItem
17936
+ 'is--active': isActiveFirst,
17937
+ 'is--subactive': isActiveFirst && !!activeChildOption
17715
17938
  }]
17716
17939
  }, [hasChildMenus ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
17717
17940
  class: 'vxe-context-menu--children-wrapper'
@@ -17759,10 +17982,16 @@ function context_menu_createReactData() {
17759
17982
  });
17760
17983
  handleVisible();
17761
17984
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
17985
+ globalEvents.on($xeContextMenu, 'mousewheel', handleGlobalMousewheelEvent);
17986
+ globalEvents.on($xeContextMenu, 'keydown', handleGlobalKeydownEvent);
17762
17987
  globalEvents.on($xeContextMenu, 'mousedown', handleGlobalMousedownEvent);
17988
+ globalEvents.on($xeContextMenu, 'blur', handleGlobalBlurEvent);
17763
17989
  });
17764
17990
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onBeforeUnmount)(() => {
17991
+ globalEvents.off($xeContextMenu, 'mousewheel');
17992
+ globalEvents.off($xeContextMenu, 'keydown');
17765
17993
  globalEvents.off($xeContextMenu, 'mousedown');
17994
+ globalEvents.off($xeContextMenu, 'blur');
17766
17995
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(reactData, context_menu_createReactData());
17767
17996
  external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, context_menu_createInternalData());
17768
17997
  });