react-chessboard-ui 1.7.0 → 1.7.2
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.
|
@@ -13,5 +13,6 @@ export declare const DEFAULT_MARKED_CELL_COLOR = "#3697ce";
|
|
|
13
13
|
export declare const DEFAULT_CHECKED_CELL_COLOR = "#e95b5c";
|
|
14
14
|
export declare const DEFAULT_PIECES_MAP: import("./models").ChessPiecesMap;
|
|
15
15
|
export declare const DEFAULT_CSS_HIDE_PIECES_EFFECT: string;
|
|
16
|
+
export declare const DEFAULT_SHOW_MOVES_TRAIL = true;
|
|
16
17
|
export declare const DEFAULT_HIDE_PIECES_HANDLER: (figure: Figure) => void;
|
|
17
18
|
export declare const DEFAULT_CHESSBORD_CONFIG: ChessBoardConfig;
|
package/dist/index.js
CHANGED
|
@@ -1890,6 +1890,7 @@ var DEFAULT_MARKED_CELL_COLOR = '#3697ce';
|
|
|
1890
1890
|
var DEFAULT_CHECKED_CELL_COLOR = '#e95b5c';
|
|
1891
1891
|
var DEFAULT_PIECES_MAP = CHESS_PIECES_MAP;
|
|
1892
1892
|
var DEFAULT_CSS_HIDE_PIECES_EFFECT = styles.hiddenFigureEffect;
|
|
1893
|
+
var DEFAULT_SHOW_MOVES_TRAIL = true;
|
|
1893
1894
|
var DEFAULT_HIDE_PIECES_HANDLER = function DEFAULT_HIDE_PIECES_HANDLER(figure) {
|
|
1894
1895
|
figure.color === 'white' ? figure.position = [8, figure.position[1]] : figure.position = [-1, figure.position[1]];
|
|
1895
1896
|
};
|
|
@@ -1906,6 +1907,7 @@ var DEFAULT_CHESSBORD_CONFIG = {
|
|
|
1906
1907
|
checkedCellColor: DEFAULT_CHECKED_CELL_COLOR,
|
|
1907
1908
|
piecesMap: DEFAULT_PIECES_MAP,
|
|
1908
1909
|
cssHidePieceEffect: DEFAULT_CSS_HIDE_PIECES_EFFECT,
|
|
1910
|
+
showMovesTrail: DEFAULT_SHOW_MOVES_TRAIL,
|
|
1909
1911
|
onHidePieces: DEFAULT_HIDE_PIECES_HANDLER
|
|
1910
1912
|
};
|
|
1911
1913
|
|
|
@@ -2042,7 +2044,8 @@ var BASE_BOARD_SIZE = 8;
|
|
|
2042
2044
|
var ChessBoardCellsLayout = function ChessBoardCellsLayout(_ref) {
|
|
2043
2045
|
var _ref$size = _ref.size,
|
|
2044
2046
|
size = _ref$size === void 0 ? BASE_BOARD_SIZE : _ref$size,
|
|
2045
|
-
boardConfig = _ref.boardConfig
|
|
2047
|
+
boardConfig = _ref.boardConfig,
|
|
2048
|
+
movesTrail = _ref.movesTrail;
|
|
2046
2049
|
return React__default.createElement("div", null, getFilledArrayBySize(size).map(function (_, j) {
|
|
2047
2050
|
return React__default.createElement("div", {
|
|
2048
2051
|
className: styles.row,
|
|
@@ -2055,7 +2058,9 @@ var ChessBoardCellsLayout = function ChessBoardCellsLayout(_ref) {
|
|
|
2055
2058
|
backgroundColor: getIsLightCell(j, i) ? boardConfig.whiteCellColor : boardConfig.blackCellColor
|
|
2056
2059
|
},
|
|
2057
2060
|
key: "cells-layout-" + i
|
|
2058
|
-
})
|
|
2061
|
+
}, movesTrail && (movesTrail[0][0] === i && movesTrail[0][1] === j || movesTrail[1][0] === i && movesTrail[1][1] === j) && React__default.createElement("div", {
|
|
2062
|
+
className: styles.movesTrail
|
|
2063
|
+
}));
|
|
2059
2064
|
}));
|
|
2060
2065
|
}));
|
|
2061
2066
|
};
|
|
@@ -2988,6 +2993,7 @@ var ChessBoard = function ChessBoard(props) {
|
|
|
2988
2993
|
fromPos = _useChessBoardInterac.fromPos,
|
|
2989
2994
|
newMove = _useChessBoardInterac.newMove,
|
|
2990
2995
|
animated = _useChessBoardInterac.animated,
|
|
2996
|
+
movesTrail = _useChessBoardInterac.movesTrail,
|
|
2991
2997
|
boardConfig = _useChessBoardInterac.boardConfig,
|
|
2992
2998
|
markedCells = _useChessBoardInterac.markedCells,
|
|
2993
2999
|
grabbingPos = _useChessBoardInterac.grabbingPos,
|
|
@@ -3044,7 +3050,8 @@ var ChessBoard = function ChessBoard(props) {
|
|
|
3044
3050
|
return React__default.createElement("div", {
|
|
3045
3051
|
className: styles.chessBoard
|
|
3046
3052
|
}, React__default.createElement(ChessBoardCellsLayout, {
|
|
3047
|
-
boardConfig: boardConfig
|
|
3053
|
+
boardConfig: boardConfig,
|
|
3054
|
+
movesTrail: boardConfig.showMovesTrail && movesTrail
|
|
3048
3055
|
}), React__default.createElement(ChessBoardFiguresLayout, {
|
|
3049
3056
|
initialState: initialState,
|
|
3050
3057
|
change: newMove,
|