@zhenliang/sheet 0.1.78 → 0.1.80

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.
@@ -1,6 +1,6 @@
1
1
  import { useMouse } from "../..";
2
2
  import { useCallback, useEffect, useRef } from 'react';
3
- import { extractDataRowAndCol, findParentTd, isSearchElement } from "../util";
3
+ import { extractDataRowAndCol, findParentTd, isSiblingControl } from "../util";
4
4
  var rowCount = 10; //每秒10行
5
5
  var colCount = 5; //每秒5列
6
6
 
@@ -268,9 +268,9 @@ export var useMouseEvent = function useMouseEvent(dispatch, elementRef) {
268
268
  var loseFocus = useCallback(function (e) {
269
269
  var _elementRef$current10, _elementRef$current11;
270
270
  // todo 加一个root node
271
- var isSearch = isSearchElement((_elementRef$current10 = elementRef.current) === null || _elementRef$current10 === void 0 ? void 0 : _elementRef$current10.parentElement, e.target);
271
+ var isSibling = isSiblingControl((_elementRef$current10 = elementRef.current) === null || _elementRef$current10 === void 0 ? void 0 : _elementRef$current10.parentElement, e.target);
272
272
  var isTableAControl = (_elementRef$current11 = elementRef.current) === null || _elementRef$current11 === void 0 || (_elementRef$current11 = _elementRef$current11.parentElement) === null || _elementRef$current11 === void 0 ? void 0 : _elementRef$current11.contains(e.target);
273
- if (!(isTableAControl || isSearch)) {
273
+ if (!(isTableAControl || isSibling)) {
274
274
  dispatch({
275
275
  type: 'loseFocus'
276
276
  });
@@ -62,6 +62,8 @@ export declare const stripRowIndex: (data: SheetType.Cell[][]) => {
62
62
  endIndex: number;
63
63
  };
64
64
  export declare const ensureFocus: (container?: HTMLElement | null) => void;
65
+ export declare const isSiblingControl: (tableRootNode: HTMLDivElement, target: HTMLElement) => boolean | undefined;
66
+ export declare const isAnotationElement: (tableRootNode: HTMLDivElement, target: HTMLElement) => boolean | undefined;
65
67
  export declare const isSearchElement: (tableRootNode: HTMLDivElement, target: HTMLElement) => boolean | undefined;
66
68
  export declare const noramlizeSearch: (target: string) => string;
67
69
  export declare const searchInclude: (search: string, compare: string) => boolean;
package/dist/core/util.js CHANGED
@@ -496,9 +496,16 @@ export var ensureFocus = function ensureFocus(container) {
496
496
  focusInterval = undefined;
497
497
  }, 1000);
498
498
  };
499
- export var isSearchElement = function isSearchElement(tableRootNode, target) {
499
+ export var isSiblingControl = function isSiblingControl(tableRootNode, target) {
500
+ return isAnotationElement(tableRootNode, target) || isSearchElement(tableRootNode, target);
501
+ };
502
+ export var isAnotationElement = function isAnotationElement(tableRootNode, target) {
500
503
  var _tableRootNode$nextSi;
501
- return (_tableRootNode$nextSi = tableRootNode.nextSibling) === null || _tableRootNode$nextSi === void 0 || (_tableRootNode$nextSi = _tableRootNode$nextSi.nextSibling) === null || _tableRootNode$nextSi === void 0 ? void 0 : _tableRootNode$nextSi.contains(target);
504
+ return (_tableRootNode$nextSi = tableRootNode.nextSibling) === null || _tableRootNode$nextSi === void 0 ? void 0 : _tableRootNode$nextSi.contains(target);
505
+ };
506
+ export var isSearchElement = function isSearchElement(tableRootNode, target) {
507
+ var _tableRootNode$nextSi2;
508
+ return (_tableRootNode$nextSi2 = tableRootNode.nextSibling) === null || _tableRootNode$nextSi2 === void 0 || (_tableRootNode$nextSi2 = _tableRootNode$nextSi2.nextSibling) === null || _tableRootNode$nextSi2 === void 0 ? void 0 : _tableRootNode$nextSi2.contains(target);
502
509
  };
503
510
  var punctuationMap = new Map([[",", ","], [":", ":"], [";", ";"]]);
504
511
  export var noramlizeSearch = function noramlizeSearch(target) {
@@ -62,6 +62,12 @@ export var useKeyBoard = function useKeyBoard(handler, listenElement) {
62
62
  handler.search(e);
63
63
  return;
64
64
  }
65
+ var isTab = !ctrlKeyPressed && keyCode === TAB_KEY;
66
+ if (isTab) {
67
+ var _moveInfo = move(keyCode, shiftKey);
68
+ _moveInfo && handler.move(e, _moveInfo);
69
+ return;
70
+ }
65
71
  if (e.target !== listenElement) {
66
72
  return;
67
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.78",
3
+ "version": "0.1.80",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",