Skip to content

Commit

Permalink
feat(cf): support boolean compare (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gggpound committed Mar 28, 2024
1 parent 0d7aa56 commit b13af5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/engine-formula/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export {
export { generateStringWithSequence, type ISequenceNode, sequenceNodeType } from './engine/utils/sequence';
export { ArrayValueObject, ValueObjectFactory } from './engine/value-object/array-value-object';
export { BaseValueObject, ErrorValueObject } from './engine/value-object/base-value-object';
export { BooleanValue } from './basics/common';
export type { PrimitiveValueType } from './engine/value-object/primitive-object';
export { NumberValueObject } from './engine/value-object/primitive-object';
export { BooleanValueObject } from './engine/value-object/primitive-object';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*/

import type { ICellData } from '@univerjs/core';
import { ColorKit, ObjectMatrix, Range } from '@univerjs/core';
import { BooleanNumber, CellValueType, ColorKit, ObjectMatrix, Range } from '@univerjs/core';
import { BooleanValue } from '@univerjs/engine-formula';
import type { IConditionFormatRule, IValueConfig } from '../../models/type';
import { NumberOperator, ValueType } from '../../base/const';
import { ConditionalFormatFormulaService, FormulaResultStatus } from '../conditional-format-formula.service';
Expand All @@ -30,6 +31,9 @@ export const getCellValue = (cell?: ICellData) => {
if (!cell) {
return null;
}
if (cell.t === CellValueType.BOOLEAN) {
return cell.v === BooleanNumber.TRUE ? BooleanValue.TRUE : BooleanValue.FALSE;
}
const v = cell.v;
const dataStream = cell.p?.body?.dataStream.replace(/\r\n$/, '');
return !isNullable(v) ? v : !isNullable(dataStream) ? dataStream : null;
Expand Down

0 comments on commit b13af5b

Please sign in to comment.