@kdcloudjs/table 1.1.5-canary.8 → 1.1.5-canary.9

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.
@@ -10,8 +10,7 @@ import { ContextMenuStyleWrap } from '../../common-views';
10
10
  import { copyDataToClipboard, executeOnTempElement, console, getEventPath, isElementInEventPath, getTargetEleInEventPath } from '../../utils';
11
11
  import { findByTree } from '../../utils/others';
12
12
  import { internals } from '../../internals';
13
- import { Classes, MenuClasses } from '../../base/styles';
14
- var stateKey = 'contextMenu';
13
+ import { MenuClasses } from '../../base/styles';
15
14
  export function contextMenu() {
16
15
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17
16
  return function step(pipeline) {
@@ -49,13 +48,11 @@ export function contextMenu() {
49
48
  };
50
49
 
51
50
  var onContextMenu = function onContextMenu(e) {
52
- if (suppressShowContextMenu(e)) {
53
- return;
51
+ if (canShowContextMenu(e, pipeline)) {
52
+ e.preventDefault();
53
+ e.stopPropagation();
54
+ showContextMenu(e);
54
55
  }
55
-
56
- e.preventDefault();
57
- e.stopPropagation();
58
- showContextMenu(e);
59
56
  };
60
57
 
61
58
  pipeline.addTableProps({
@@ -392,24 +389,12 @@ function isElementInsideTheFooter(ele) {
392
389
  }
393
390
 
394
391
  return false;
395
- } // 禁止弹出右键菜单
396
-
397
-
398
- function suppressShowContextMenu(e) {
399
- var path = getEventPath(e.nativeEvent);
400
- var pointIndex = 0;
401
-
402
- while (pointIndex < path.length) {
403
- var ele = path[pointIndex];
404
-
405
- if (ele.classList.contains(Classes.tableBody) || ele.classList.contains(Classes.tableFooter)) {
406
- return false;
407
- }
392
+ }
408
393
 
409
- pointIndex++;
410
- }
394
+ function canShowContextMenu(e, pipeline) {
395
+ var _a, _b;
411
396
 
412
- return true;
397
+ return ((_a = pipeline.ref.current.domHelper) === null || _a === void 0 ? void 0 : _a.tableBody.contains(e.target)) || ((_b = pipeline.ref.current.domHelper) === null || _b === void 0 ? void 0 : _b.tableFooter.contains(e.target));
413
398
  } // 默认选项
414
399
 
415
400
 
@@ -43,8 +43,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "functi
43
43
 
44
44
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
45
 
46
- var stateKey = 'contextMenu';
47
-
48
46
  function contextMenu() {
49
47
  var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
50
48
  return function step(pipeline) {
@@ -83,13 +81,11 @@ function contextMenu() {
83
81
  };
84
82
 
85
83
  var onContextMenu = function onContextMenu(e) {
86
- if (suppressShowContextMenu(e)) {
87
- return;
84
+ if (canShowContextMenu(e, pipeline)) {
85
+ e.preventDefault();
86
+ e.stopPropagation();
87
+ showContextMenu(e);
88
88
  }
89
-
90
- e.preventDefault();
91
- e.stopPropagation();
92
- showContextMenu(e);
93
89
  };
94
90
 
95
91
  pipeline.addTableProps({
@@ -429,24 +425,12 @@ function isElementInsideTheFooter(ele) {
429
425
  }
430
426
 
431
427
  return false;
432
- } // 禁止弹出右键菜单
433
-
434
-
435
- function suppressShowContextMenu(e) {
436
- var path = (0, _utils.getEventPath)(e.nativeEvent);
437
- var pointIndex = 0;
438
-
439
- while (pointIndex < path.length) {
440
- var ele = path[pointIndex];
441
-
442
- if (ele.classList.contains(_styles.Classes.tableBody) || ele.classList.contains(_styles.Classes.tableFooter)) {
443
- return false;
444
- }
428
+ }
445
429
 
446
- pointIndex++;
447
- }
430
+ function canShowContextMenu(e, pipeline) {
431
+ var _a, _b;
448
432
 
449
- return true;
433
+ return ((_a = pipeline.ref.current.domHelper) === null || _a === void 0 ? void 0 : _a.tableBody.contains(e.target)) || ((_b = pipeline.ref.current.domHelper) === null || _b === void 0 ? void 0 : _b.tableFooter.contains(e.target));
450
434
  } // 默认选项
451
435
 
452
436
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kdcloudjs/table",
3
- "version": "1.1.5-canary.8",
3
+ "version": "1.1.5-canary.9",
4
4
  "description": "金蝶 react table 组件",
5
5
  "title": "table",
6
6
  "keywords": [