@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.
- package/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +9 -24
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +2 -2
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/table/pipeline/features/contextMenu.js +9 -24
- package/lib/table/pipeline/features/contextMenu.js +8 -24
- package/package.json +1 -1
|
@@ -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 {
|
|
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 (
|
|
53
|
-
|
|
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
|
-
|
|
410
|
-
|
|
394
|
+
function canShowContextMenu(e, pipeline) {
|
|
395
|
+
var _a, _b;
|
|
411
396
|
|
|
412
|
-
return
|
|
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 (
|
|
87
|
-
|
|
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
|
-
|
|
447
|
-
|
|
430
|
+
function canShowContextMenu(e, pipeline) {
|
|
431
|
+
var _a, _b;
|
|
448
432
|
|
|
449
|
-
return
|
|
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
|
|