@leankylin-sheet/formula-parser 3.1.28 → 3.1.30
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.
- package/{lib/grammar-parser/grammar-parser.js → dist/index.esm.js} +856 -46
- package/{es/grammar-parser/grammar-parser.js → dist/index.js} +903 -42
- package/dist/packages/core/src/api/cell.d.ts +10 -0
- package/dist/packages/core/src/api/common.d.ts +57 -0
- package/dist/packages/core/src/api/errors.d.ts +2 -0
- package/dist/packages/core/src/api/index.d.ts +9 -0
- package/dist/packages/core/src/api/merge.d.ts +5 -0
- package/dist/packages/core/src/api/range.d.ts +22 -0
- package/dist/packages/core/src/api/rowcol.d.ts +14 -0
- package/dist/packages/core/src/api/sheet.d.ts +10 -0
- package/dist/packages/core/src/api/workbook.d.ts +15 -0
- package/dist/packages/core/src/canvas.d.ts +56 -0
- package/dist/packages/core/src/context.d.ts +193 -0
- package/dist/packages/core/src/events/copy.d.ts +2 -0
- package/dist/packages/core/src/events/index.d.ts +4 -0
- package/dist/packages/core/src/events/keyboard.d.ts +6 -0
- package/dist/packages/core/src/events/mouse.d.ts +25 -0
- package/dist/packages/core/src/events/paste.d.ts +5 -0
- package/dist/packages/core/src/index.d.ts +10 -0
- package/dist/packages/core/src/locale/en.d.ts +1028 -0
- package/dist/packages/core/src/locale/es.d.ts +1132 -0
- package/dist/packages/core/src/locale/index.d.ts +1046 -0
- package/dist/packages/core/src/locale/zh.d.ts +1045 -0
- package/dist/packages/core/src/locale/zh_tw.d.ts +1185 -0
- package/dist/packages/core/src/modules/ConditionFormat.d.ts +17 -0
- package/dist/packages/core/src/modules/border.d.ts +3 -0
- package/dist/packages/core/src/modules/cell.d.ts +32 -0
- package/dist/packages/core/src/modules/clipboard.d.ts +3 -0
- package/dist/packages/core/src/modules/color.d.ts +1 -0
- package/dist/packages/core/src/modules/comment.d.ts +96 -0
- package/dist/packages/core/src/modules/conditionalFormat.d.ts +2 -0
- package/dist/packages/core/src/modules/cursor.d.ts +3 -0
- package/dist/packages/core/src/modules/dataVerification.d.ts +11 -0
- package/dist/packages/core/src/modules/dropCell.d.ts +10 -0
- package/dist/packages/core/src/modules/filter.d.ts +45 -0
- package/dist/packages/core/src/modules/format.d.ts +6 -0
- package/dist/packages/core/src/modules/formula.d.ts +53 -0
- package/dist/packages/core/src/modules/freeze.d.ts +5 -0
- package/dist/packages/core/src/modules/hyperlink.d.ts +21 -0
- package/dist/packages/core/src/modules/image.d.ts +31 -0
- package/dist/packages/core/src/modules/index.d.ts +35 -0
- package/dist/packages/core/src/modules/inline-string.d.ts +36 -0
- package/dist/packages/core/src/modules/location.d.ts +6 -0
- package/dist/packages/core/src/modules/locationCondition.d.ts +21 -0
- package/dist/packages/core/src/modules/merge.d.ts +3 -0
- package/dist/packages/core/src/modules/mobile.d.ts +5 -0
- package/dist/packages/core/src/modules/moveCells.d.ts +5 -0
- package/dist/packages/core/src/modules/protection.d.ts +5 -0
- package/dist/packages/core/src/modules/refresh.d.ts +3 -0
- package/dist/packages/core/src/modules/rowcol.d.ts +19 -0
- package/dist/packages/core/src/modules/screenshot.d.ts +2 -0
- package/dist/packages/core/src/modules/searchReplace.d.ts +36 -0
- package/dist/packages/core/src/modules/selection.d.ts +47 -0
- package/dist/packages/core/src/modules/sheet.d.ts +10 -0
- package/dist/packages/core/src/modules/sort.d.ts +7 -0
- package/dist/packages/core/src/modules/splitColumn.d.ts +5 -0
- package/dist/packages/core/src/modules/ssf.d.ts +2 -0
- package/dist/packages/core/src/modules/text.d.ts +10 -0
- package/dist/packages/core/src/modules/toolbar.d.ts +32 -0
- package/dist/packages/core/src/modules/validation.d.ts +19 -0
- package/dist/packages/core/src/modules/zoom.d.ts +3 -0
- package/dist/packages/core/src/settings.d.ts +132 -0
- package/dist/packages/core/src/types.d.ts +351 -0
- package/dist/packages/core/src/utils/index.d.ts +17 -0
- package/dist/packages/core/src/utils/patch.d.ts +37 -0
- package/dist/packages/formula-parser/src/error.d.ts +10 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/evaluate-by-operator.d.ts +2 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/add.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/ampersand.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/divide.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/equal.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/formula-function.d.ts +7 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/greater-than-or-equal.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/greater-than.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/less-than-or-equal.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/less-than.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/minus.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/multiply.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/not-equal.d.ts +6 -0
- package/dist/packages/formula-parser/src/evaluate-by-operator/operator/power.d.ts +6 -0
- package/dist/packages/formula-parser/src/grammar-parser/grammar-parser.d.ts +4 -0
- package/dist/packages/formula-parser/src/helper/cell.d.ts +6 -0
- package/dist/packages/formula-parser/src/helper/number.d.ts +2 -0
- package/dist/packages/formula-parser/src/helper/string.d.ts +1 -0
- package/{es/index.js → dist/packages/formula-parser/src/index.d.ts} +5 -5
- package/dist/packages/formula-parser/src/parser.d.ts +20 -0
- package/dist/packages/formula-parser/src/supported-formulas.d.ts +2 -0
- package/dist/packages/react/src/components/CellOptions/index.d.ts +4 -0
- package/dist/packages/react/src/components/ChangeColor/index.d.ts +7 -0
- package/dist/packages/react/src/components/ConditionFormat/ConditionRules.d.ts +6 -0
- package/dist/packages/react/src/components/ConditionFormat/index.d.ts +7 -0
- package/dist/packages/react/src/components/ContextMenu/Divider.d.ts +3 -0
- package/dist/packages/react/src/components/ContextMenu/FilterMenu.d.ts +3 -0
- package/dist/packages/react/src/components/ContextMenu/Menu.d.ts +8 -0
- package/dist/packages/react/src/components/ContextMenu/SheetTab.d.ts +4 -0
- package/dist/packages/react/src/components/ContextMenu/index.d.ts +4 -0
- package/dist/packages/react/src/components/CustomSort/index.d.ts +4 -0
- package/dist/packages/react/src/components/DataVerification/DropdownList.d.ts +4 -0
- package/dist/packages/react/src/components/DataVerification/RangeDialog.d.ts +4 -0
- package/dist/packages/react/src/components/DataVerification/index.d.ts +4 -0
- package/dist/packages/react/src/components/Dialog/index.d.ts +12 -0
- package/dist/packages/react/src/components/FilterOption/index.d.ts +5 -0
- package/dist/packages/react/src/components/FormatSearch/index.d.ts +6 -0
- package/dist/packages/react/src/components/FormulaSearch/index.d.ts +5 -0
- package/dist/packages/react/src/components/FxEditor/CalcInfo.d.ts +3 -0
- package/dist/packages/react/src/components/FxEditor/NameBox.d.ts +3 -0
- package/dist/packages/react/src/components/FxEditor/index.d.ts +4 -0
- package/dist/packages/react/src/components/ImgBoxs/index.d.ts +3 -0
- package/dist/packages/react/src/components/LinkEidtCard/index.d.ts +5 -0
- package/dist/packages/react/src/components/LocationCondition/index.d.ts +3 -0
- package/dist/packages/react/src/components/MessageBox/index.d.ts +9 -0
- package/dist/packages/react/src/components/NotationBoxes/index.d.ts +3 -0
- package/dist/packages/react/src/components/SVGDefines.d.ts +3 -0
- package/dist/packages/react/src/components/SVGIcon.d.ts +9 -0
- package/dist/packages/react/src/components/SearchReplace/index.d.ts +4 -0
- package/dist/packages/react/src/components/Sheet/index.d.ts +8 -0
- package/dist/packages/react/src/components/SheetList/SheetHiddenButton.d.ts +8 -0
- package/dist/packages/react/src/components/SheetList/SheetListItem.d.ts +9 -0
- package/dist/packages/react/src/components/SheetList/index.d.ts +4 -0
- package/dist/packages/react/src/components/SheetOverlay/ColumnHeader.d.ts +3 -0
- package/dist/packages/react/src/components/SheetOverlay/ContentEditable.d.ts +11 -0
- package/dist/packages/react/src/components/SheetOverlay/FormulaHint/index.d.ts +4 -0
- package/dist/packages/react/src/components/SheetOverlay/FormulaSearch/index.d.ts +4 -0
- package/dist/packages/react/src/components/SheetOverlay/InputBox.d.ts +3 -0
- package/dist/packages/react/src/components/SheetOverlay/RowHeader.d.ts +3 -0
- package/dist/packages/react/src/components/SheetOverlay/ScrollBar/index.d.ts +7 -0
- package/dist/packages/react/src/components/SheetOverlay/index.d.ts +4 -0
- package/dist/packages/react/src/components/SheetTab/SheetItem.d.ts +8 -0
- package/dist/packages/react/src/components/SheetTab/index.d.ts +4 -0
- package/dist/packages/react/src/components/SplitColumn/index.d.ts +3 -0
- package/dist/packages/react/src/components/Toolbar/Button.d.ts +11 -0
- package/dist/packages/react/src/components/Toolbar/ColorPicker.d.ts +6 -0
- package/dist/packages/react/src/components/Toolbar/Combo.d.ts +10 -0
- package/dist/packages/react/src/components/Toolbar/CustomBorder.d.ts +7 -0
- package/dist/packages/react/src/components/Toolbar/CustomButton.d.ts +11 -0
- package/dist/packages/react/src/components/Toolbar/CustomColor.d.ts +8 -0
- package/dist/packages/react/src/components/Toolbar/CustomIcon.d.ts +9 -0
- package/dist/packages/react/src/components/Toolbar/Divider.d.ts +4 -0
- package/dist/packages/react/src/components/Toolbar/MoreItemsContainer.d.ts +6 -0
- package/dist/packages/react/src/components/Toolbar/Select.d.ts +14 -0
- package/dist/packages/react/src/components/Toolbar/index.d.ts +7 -0
- package/dist/packages/react/src/components/Workbook/api.d.ts +121 -0
- package/dist/packages/react/src/components/Workbook/index.d.ts +130 -0
- package/dist/packages/react/src/components/ZoomControl/index.d.ts +4 -0
- package/dist/packages/react/src/components/index.d.ts +3 -0
- package/dist/packages/react/src/context/index.d.ts +25 -0
- package/dist/packages/react/src/context/modal.d.ts +10 -0
- package/dist/packages/react/src/hooks/useAlert.d.ts +4 -0
- package/dist/packages/react/src/hooks/useDialog.d.ts +5 -0
- package/dist/packages/react/src/hooks/useOutsideClick.d.ts +2 -0
- package/dist/packages/react/src/hooks/usePrevious.d.ts +2 -0
- package/dist/packages/react/src/index.d.ts +1 -0
- package/dist/stories/data/cell.d.ts +1180 -0
- package/dist/stories/data/dataVerification.d.ts +131 -0
- package/dist/stories/data/empty.d.ts +10 -0
- package/dist/stories/data/formula.d.ts +362 -0
- package/dist/stories/data/freeze.d.ts +34 -0
- package/dist/stories/data/protected.d.ts +40 -0
- package/dist/stories/utils.d.ts +1 -0
- package/package.json +6 -18
- package/LICENSE +0 -21
- package/es/error.js +0 -45
- package/es/evaluate-by-operator/evaluate-by-operator.js +0 -70
- package/es/evaluate-by-operator/operator/add.js +0 -16
- package/es/evaluate-by-operator/operator/ampersand.js +0 -10
- package/es/evaluate-by-operator/operator/divide.js +0 -21
- package/es/evaluate-by-operator/operator/equal.js +0 -5
- package/es/evaluate-by-operator/operator/formula-function.js +0 -40
- package/es/evaluate-by-operator/operator/greater-than-or-equal.js +0 -5
- package/es/evaluate-by-operator/operator/greater-than.js +0 -5
- package/es/evaluate-by-operator/operator/less-than-or-equal.js +0 -5
- package/es/evaluate-by-operator/operator/less-than.js +0 -5
- package/es/evaluate-by-operator/operator/minus.js +0 -16
- package/es/evaluate-by-operator/operator/multiply.js +0 -16
- package/es/evaluate-by-operator/operator/not-equal.js +0 -5
- package/es/evaluate-by-operator/operator/power.js +0 -11
- package/es/grammar-parser/grammar-parser.jison +0 -230
- package/es/helper/cell.js +0 -117
- package/es/helper/number.js +0 -25
- package/es/helper/string.js +0 -13
- package/es/parser.js +0 -306
- package/es/supported-formulas.js +0 -3
- package/lib/error.js +0 -53
- package/lib/evaluate-by-operator/evaluate-by-operator.js +0 -77
- package/lib/evaluate-by-operator/operator/add.js +0 -23
- package/lib/evaluate-by-operator/operator/ampersand.js +0 -17
- package/lib/evaluate-by-operator/operator/divide.js +0 -28
- package/lib/evaluate-by-operator/operator/equal.js +0 -12
- package/lib/evaluate-by-operator/operator/formula-function.js +0 -51
- package/lib/evaluate-by-operator/operator/greater-than-or-equal.js +0 -12
- package/lib/evaluate-by-operator/operator/greater-than.js +0 -12
- package/lib/evaluate-by-operator/operator/less-than-or-equal.js +0 -12
- package/lib/evaluate-by-operator/operator/less-than.js +0 -12
- package/lib/evaluate-by-operator/operator/minus.js +0 -23
- package/lib/evaluate-by-operator/operator/multiply.js +0 -23
- package/lib/evaluate-by-operator/operator/not-equal.js +0 -12
- package/lib/evaluate-by-operator/operator/power.js +0 -18
- package/lib/grammar-parser/grammar-parser.jison +0 -230
- package/lib/helper/cell.js +0 -128
- package/lib/helper/number.js +0 -32
- package/lib/helper/string.js +0 -19
- package/lib/index.js +0 -115
- package/lib/parser.js +0 -314
- package/lib/supported-formulas.js +0 -12
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function rowLabelToIndex(label: string): number;
|
|
2
|
+
export function rowIndexToLabel(row: number): string;
|
|
3
|
+
export function columnLabelToIndex(label: string): number;
|
|
4
|
+
export function columnIndexToLabel(column: number): string;
|
|
5
|
+
export function extractLabel(label: string): any[];
|
|
6
|
+
export function toLabel(row: Object, column: Object): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function trimEdges(string: string, margin?: number | undefined): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Parser from
|
|
2
|
-
import SUPPORTED_FORMULAS from
|
|
3
|
-
import error, { ERROR, ERROR_DIV_ZERO, ERROR_NAME, ERROR_NOT_AVAILABLE, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE } from
|
|
4
|
-
import { extractLabel, toLabel, columnIndexToLabel, columnLabelToIndex, rowIndexToLabel, rowLabelToIndex } from
|
|
5
|
-
export { SUPPORTED_FORMULAS, ERROR, ERROR_DIV_ZERO, ERROR_NAME, ERROR_NOT_AVAILABLE, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE, Parser, error, extractLabel, toLabel, columnIndexToLabel, columnLabelToIndex, rowIndexToLabel, rowLabelToIndex };
|
|
1
|
+
import Parser from "./parser";
|
|
2
|
+
import SUPPORTED_FORMULAS from "./supported-formulas";
|
|
3
|
+
import error, { ERROR, ERROR_DIV_ZERO, ERROR_NAME, ERROR_NOT_AVAILABLE, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE } from "./error";
|
|
4
|
+
import { extractLabel, toLabel, columnIndexToLabel, columnLabelToIndex, rowIndexToLabel, rowLabelToIndex } from "./helper/cell";
|
|
5
|
+
export { SUPPORTED_FORMULAS, ERROR, ERROR_DIV_ZERO, ERROR_NAME, ERROR_NOT_AVAILABLE, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE, Parser, error, extractLabel, toLabel, columnIndexToLabel, columnLabelToIndex, rowIndexToLabel, rowLabelToIndex, };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default Parser;
|
|
2
|
+
declare class Parser {
|
|
3
|
+
parser: GrammarParser;
|
|
4
|
+
variables: any;
|
|
5
|
+
functions: any;
|
|
6
|
+
options: any;
|
|
7
|
+
parse(expression: string, options: {
|
|
8
|
+
sheetId: string;
|
|
9
|
+
}): any;
|
|
10
|
+
setVariable(name: string, value: any): Parser;
|
|
11
|
+
getVariable(name: string): any;
|
|
12
|
+
private _callVariable;
|
|
13
|
+
setFunction(name: string, fn: Function): Parser;
|
|
14
|
+
getFunction(name: string): any;
|
|
15
|
+
private _callFunction;
|
|
16
|
+
private _callCellValue;
|
|
17
|
+
private _callRangeValue;
|
|
18
|
+
private _throwError;
|
|
19
|
+
}
|
|
20
|
+
import { Parser as GrammarParser } from "./grammar-parser/grammar-parser";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = React.PropsWithChildren<{
|
|
3
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
|
|
4
|
+
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
|
|
5
|
+
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>, container: HTMLDivElement) => void;
|
|
6
|
+
}>;
|
|
7
|
+
declare const Menu: React.FC<Props>;
|
|
8
|
+
export default Menu;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.css";
|
|
3
|
+
type Props = {
|
|
4
|
+
type?: "ok" | "yesno";
|
|
5
|
+
onOk?: () => void;
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
containerStyle?: React.CSSProperties;
|
|
8
|
+
contentStyle?: React.CSSProperties;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare const Dialog: React.FC<Props>;
|
|
12
|
+
export default Dialog;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type ContentEditableProps = Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> & {
|
|
3
|
+
initialContent?: string;
|
|
4
|
+
innerRef?: (e: HTMLDivElement | null) => void;
|
|
5
|
+
onChange?: (html: string, isBlur?: boolean) => void;
|
|
6
|
+
onBlur?: (e: React.FocusEvent<HTMLDivElement, Element>) => void;
|
|
7
|
+
autoFocus?: boolean;
|
|
8
|
+
allowEdit?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const ContentEditable: React.FC<ContentEditableProps>;
|
|
11
|
+
export default ContentEditable;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
tooltip: string;
|
|
4
|
+
iconId: string;
|
|
5
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare const Button: React.FC<Props>;
|
|
11
|
+
export default Button;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
tooltip: string;
|
|
4
|
+
iconId?: string;
|
|
5
|
+
text?: string;
|
|
6
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
7
|
+
children: (setOpen: React.Dispatch<React.SetStateAction<boolean>>) => React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
declare const Combo: React.FC<Props>;
|
|
10
|
+
export default Combo;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
tooltip?: string;
|
|
4
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
iconName?: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare const CustomButton: React.FC<Props>;
|
|
11
|
+
export default CustomButton;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
|
+
declare const Select: React.FC<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
style?: CSSProperties;
|
|
5
|
+
}>;
|
|
6
|
+
type OptionProps = {
|
|
7
|
+
onClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
8
|
+
iconId?: string;
|
|
9
|
+
onMouseLeave?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
10
|
+
onMouseEnter?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const Option: React.FC<React.PropsWithChildren<OptionProps>>;
|
|
13
|
+
export { Option };
|
|
14
|
+
export default Select;
|