@univerjs/sheets-formula 0.1.2 → 0.1.4
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/README.md +9 -7
- package/lib/cjs/index.js +8 -8
- package/lib/es/index.js +1742 -1815
- package/lib/index.css +1 -1
- package/lib/types/commands/operations/editor-formula.operation.d.ts +1 -0
- package/lib/types/controllers/prompt.controller.d.ts +2 -6
- package/lib/types/controllers/shortcuts/prompt.shortcut.d.ts +1 -0
- package/lib/types/controllers/update-formula.controller.d.ts +11 -0
- package/lib/types/controllers/utils/ref-range-formula.d.ts +52 -0
- package/lib/types/controllers/utils/utils.d.ts +17 -0
- package/lib/types/locale/en-US.d.ts +6 -14
- package/lib/types/locale/function-list/logical/en-US.d.ts +2 -2
- package/lib/types/locale/function-list/logical/ja-JP.d.ts +2 -2
- package/lib/types/locale/function-list/logical/zh-CN.d.ts +2 -2
- package/lib/types/locale/function-list/text/en-US.d.ts +4 -12
- package/lib/types/locale/function-list/text/ja-JP.d.ts +4 -12
- package/lib/types/locale/function-list/text/zh-CN.d.ts +4 -12
- package/lib/types/locale/zh-CN.d.ts +6 -14
- package/lib/umd/index.js +6 -6
- package/package.json +26 -26
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://npmjs.org/package/@univerjs/sheets-formula)
|
|
4
4
|
[](https://img.shields.io/npm/l/@univerjs/sheets-formula)
|
|
5
|
+

|
|
6
|
+

|
|
5
7
|
|
|
6
8
|
## Introduction
|
|
7
9
|
|
|
@@ -341,7 +343,7 @@ You can create a new `custom-function.ts` file to specifically place custom form
|
|
|
341
343
|
*/
|
|
342
344
|
export class Customsum extends BaseFunction {
|
|
343
345
|
override calculate(...variants: BaseValueObject[]) {
|
|
344
|
-
let accumulatorAll: BaseValueObject =
|
|
346
|
+
let accumulatorAll: BaseValueObject = NumberValueObject.create(0);
|
|
345
347
|
for (let i = 0; i < variants.length; i++) {
|
|
346
348
|
let variant = variants[i];
|
|
347
349
|
|
|
@@ -492,7 +494,7 @@ First refer to [Custom Plugin](/en-us/guides/extend/write-a-plugin/) to create a
|
|
|
492
494
|
*/
|
|
493
495
|
export class Customsum extends BaseFunction {
|
|
494
496
|
override calculate(...variants: BaseValueObject[]) {
|
|
495
|
-
let accumulatorAll: BaseValueObject =
|
|
497
|
+
let accumulatorAll: BaseValueObject = NumberValueObject.create(0);
|
|
496
498
|
for (let i = 0; i < variants.length; i++) {
|
|
497
499
|
let variant = variants[i];
|
|
498
500
|
|
|
@@ -704,10 +706,10 @@ To implement a formula, you need to add formula description, internationalizatio
|
|
|
704
706
|
Location: [packages/sheets-formula/src/locale/function-list/math/en-US.ts](https://github.com/dream-num/univer/blob/dev/packages/sheets-formula/src/locale/function-list/math/en-US.ts).
|
|
705
707
|
|
|
706
708
|
Internationalization is organized by category, with a file for each category. Refer to the Office function category page for a brief overview.
|
|
707
|
-

|
|
708
710
|
|
|
709
711
|
Refer to the Office function details page for function descriptions and parameter descriptions.
|
|
710
|
-

|
|
711
713
|
|
|
712
714
|
Most function names already have basic description, abstract, links, and parameter structures. It is recommended to modify them based on this foundation. If a function is not present, add it to the end.
|
|
713
715
|
|
|
@@ -775,10 +777,10 @@ To implement a formula, you need to add formula description, internationalizatio
|
|
|
775
777
|
- Any formula's input and output can be `A1`, `A1:B10`, etc. When researching Excel, consider all cases, such as `=SIN(A1:B10)`, which expands to the calculated range.
|
|
776
778
|
- For example, the `XLOOKUP` function requires at least one of the rows or columns of its two inputs to be of equal size for matrix calculation.
|
|
777
779
|
- For example, the `SUMIF` function, although commonly used for summation, can expand based on the second parameter.
|
|
778
|
-

|
|
781
|
+

|
|
780
782
|
- Excel formula calculation is becoming more like numpy, for example:
|
|
781
|
-

|
|
782
784
|
- For numerical calculations in formulas, use built-in methods and try to avoid obtaining values for manual calculation. Because formula parameters can be values, arrays, or references. You can refer to existing `sum` and `minus` functions.
|
|
783
785
|
- Precision issues: The formula introduces `big.js`, and using built-in methods will call this library. However, it is nearly 100 times slower than native calculations. Therefore, for methods like `sin`, it is advisable to use native implementations.
|
|
784
786
|
- For custom calculations, use the `product` function, suitable for calculating two input parameters. Call `map` to iterate over the values for changes to a parameter's own values.
|