Merge pull request #639 from Corbe30/bugfix/tsc-issues

fixed: tsc, lint errors
This commit is contained in:
Sanchit Agarwal 2024-11-26 12:10:23 +05:30 committed by GitHub
commit 1eb99d20ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 5 deletions

View File

@ -227,7 +227,8 @@ export function defaultContext(refs: RefValues): Context {
defaultrowNum: 84,
addDefaultRows: 50,
fullscreenmode: true,
devicePixelRatio: (typeof globalThis !== 'undefined' ? globalThis : window).devicePixelRatio,
devicePixelRatio: (typeof globalThis !== "undefined" ? globalThis : window)
.devicePixelRatio,
contextMenu: {},
sheetTabContextMenu: {},

View File

@ -761,7 +761,11 @@ export function compute(ctx: Context, ruleArr: any, d: CellMatrix) {
continue;
}
// 符合条件
if (cell.v >= vSmall && cell.v <= vBig) {
if (
typeof cell.v === "number" &&
cell.v >= vSmall &&
cell.v <= vBig
) {
if (`${r}_${c}` in computeMap) {
computeMap[`${r}_${c}`].textColor = textColor;
computeMap[`${r}_${c}`].cellColor = cellColor;

View File

@ -32,7 +32,10 @@ export const FormatSearch: React.FC<{
}),
[currencyDetail, dateFmtList, numberFmtList]
);
const toolbarFormat = useMemo(
type toolbarFormatType = { name: string; pos?: string; value: string };
const toolbarFormat: toolbarFormatType[] = useMemo(
() => toolbarFormatAll[type],
[toolbarFormatAll, type]
);
@ -48,7 +51,11 @@ export const FormatSearch: React.FC<{
const index = getSheetIndex(ctx, ctx.currentSheetId);
if (_.isNil(index)) return;
const selectedFormatVal = toolbarFormat[selectedFormatIndex].value;
const selectedFormatPos = toolbarFormat[selectedFormatIndex].pos;
let selectedFormatPos: string;
if ("pos" in toolbarFormat[selectedFormatIndex])
selectedFormatPos = toolbarFormat[selectedFormatIndex].pos || "before";
_.forEach(ctx.luckysheet_select_save, (selection) => {
for (let r = selection.row[0]; r <= selection.row[1]; r += 1) {
for (let c = selection.column[0]; c <= selection.column[1]; c += 1) {

View File

@ -30,7 +30,9 @@ const Sheet: React.FC<Props> = ({ sheet }) => {
if (!data) return;
setContext((draftCtx) => {
if (settings.devicePixelRatio === 0) {
draftCtx.devicePixelRatio = (typeof globalThis !== 'undefined' ? globalThis : window).devicePixelRatio;
draftCtx.devicePixelRatio = (
typeof globalThis !== "undefined" ? globalThis : window
).devicePixelRatio;
}
updateContextWithSheetData(draftCtx, data);
updateContextWithCanvas(