@zhenliang/sheet 0.1.65-beta → 0.1.65
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.
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import { stripRowIndex } from "../util";
|
|
7
|
+
import { isFreezedCell, stripRowIndex } from "../util";
|
|
8
8
|
export var mouseReducer = {
|
|
9
9
|
mouseDown: function mouseDown(state, payload) {
|
|
10
10
|
var _ref = payload,
|
|
@@ -20,7 +20,7 @@ export var mouseReducer = {
|
|
|
20
20
|
row: row
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
if (
|
|
23
|
+
if (isFreezedCell(row, col, data)) {
|
|
24
24
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
25
25
|
start: undefined,
|
|
26
26
|
end: undefined,
|
|
@@ -76,7 +76,7 @@ export var mouseReducer = {
|
|
|
76
76
|
row = _ref2.row,
|
|
77
77
|
col = _ref2.col;
|
|
78
78
|
var data = state.data;
|
|
79
|
-
if (state.mouseDown === false ||
|
|
79
|
+
if (state.mouseDown === false || isFreezedCell(row, col, data)) return state;
|
|
80
80
|
if (state.isIndex && state.start && state.end && (data === null || data === void 0 ? void 0 : data[row][col].dataIndex) === 'index') {
|
|
81
81
|
var _state$end;
|
|
82
82
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -106,7 +106,7 @@ export var mouseReducer = {
|
|
|
106
106
|
row = _ref3.row,
|
|
107
107
|
col = _ref3.col;
|
|
108
108
|
var data = state.data;
|
|
109
|
-
if (state.mouseDown === false ||
|
|
109
|
+
if (state.mouseDown === false || isFreezedCell(row, col, data)) return state;
|
|
110
110
|
if (state.isIndex && state.end) {
|
|
111
111
|
var _state$end2;
|
|
112
112
|
return _objectSpread(_objectSpread({}, state), {}, {
|
package/dist/core/util.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export declare const calcMenuPosition: ({ tableElement, menuElement, x, y, }: {
|
|
|
56
56
|
top: number;
|
|
57
57
|
left: number;
|
|
58
58
|
};
|
|
59
|
+
export declare const isFreezedCell: (row: number, col: number, data?: SheetType.Cell[][]) => boolean;
|
|
59
60
|
export declare const stripRowIndex: (data: SheetType.Cell[][]) => {
|
|
60
61
|
startIndex: number;
|
|
61
62
|
endIndex: number;
|
package/dist/core/util.js
CHANGED
|
@@ -457,6 +457,11 @@ export var calcMenuPosition = function calcMenuPosition(_ref5) {
|
|
|
457
457
|
left: left
|
|
458
458
|
};
|
|
459
459
|
};
|
|
460
|
+
export var isFreezedCell = function isFreezedCell(row, col, data) {
|
|
461
|
+
var _data$row$col$classNa;
|
|
462
|
+
var isFreezed = (data === null || data === void 0 ? void 0 : data[row][col].fixed) || (data === null || data === void 0 || (_data$row$col$classNa = data[row][col].className) === null || _data$row$col$classNa === void 0 ? void 0 : _data$row$col$classNa.includes('sheet-control'));
|
|
463
|
+
return !!isFreezed;
|
|
464
|
+
};
|
|
460
465
|
export var stripRowIndex = function stripRowIndex(data) {
|
|
461
466
|
if (!data.length || !data[0].length) return {
|
|
462
467
|
startIndex: 0,
|