@libregrid/formulas 1.3.3 → 1.3.5
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 +30 -24
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
# @libregrid/formulas
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
A1
|
|
5
|
-
|
|
6
|
-
editor, an external `formulaDataSource` store, and custom function registration.
|
|
3
|
+
Evaluate spreadsheet-style formulas stored in cells. Users can reference cells
|
|
4
|
+
and ranges with A1 notation, and calculated values update when referenced data
|
|
5
|
+
changes. An optional external data source stores formulas separately from row data.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
[Documentation and examples](https://libregrid.dev/formulas)
|
|
9
8
|
|
|
10
9
|
## Install
|
|
11
10
|
|
|
12
11
|
```bash
|
|
13
|
-
npm install ag-grid-community @libregrid/formulas
|
|
12
|
+
npm install "ag-grid-community@^36.2.0" @libregrid/formulas
|
|
14
13
|
```
|
|
15
14
|
|
|
16
15
|
Requires `ag-grid-community >=36.1.0 <37` as a peer dependency.
|
|
17
16
|
|
|
18
17
|
## Usage
|
|
19
18
|
|
|
19
|
+
In a browser TypeScript project, add a grid container before running the code:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<div id="grid" style="height: 400px"></div>
|
|
23
|
+
```
|
|
24
|
+
|
|
20
25
|
```ts
|
|
21
26
|
import { ModuleRegistry, AllCommunityModule, createGrid } from 'ag-grid-community';
|
|
22
27
|
import { FormulasModule } from '@libregrid/formulas';
|
|
23
28
|
|
|
24
29
|
ModuleRegistry.registerModules([AllCommunityModule, FormulasModule]);
|
|
25
30
|
|
|
26
|
-
const api = createGrid(document.querySelector('#grid')!, {
|
|
31
|
+
const api = createGrid(document.querySelector<HTMLElement>('#grid')!, {
|
|
27
32
|
columnDefs: [
|
|
28
33
|
{ field: 'product' },
|
|
29
34
|
{ field: 'price' },
|
|
30
35
|
{ field: 'quantity' },
|
|
31
|
-
{ field: 'subtotal', allowFormula: true },
|
|
32
|
-
],
|
|
33
|
-
rowData: [
|
|
34
|
-
{ product: 'Bananas', price: 2.5, quantity: 6, subtotal: '=C2*B2' },
|
|
36
|
+
{ field: 'subtotal', allowFormula: true, editable: true },
|
|
35
37
|
],
|
|
38
|
+
rowData: [{ product: 'Bananas', price: 2.5, quantity: 6, subtotal: '=B1*C1' }],
|
|
36
39
|
getRowId: (params) => String(params.data.product),
|
|
37
40
|
});
|
|
38
41
|
```
|
|
@@ -44,20 +47,23 @@ function set. `gridOptions.formulaFuncs` registers custom functions.
|
|
|
44
47
|
|
|
45
48
|
Columns with `allowFormula: true` use the tokenising `agFormulaCellEditor` by
|
|
46
49
|
default. Formulas require Client-Side Row Model row IDs; tree data, row
|
|
47
|
-
grouping, pivot and server-side row models are not supported
|
|
48
|
-
|
|
50
|
+
grouping, pivot and server-side row models are not supported by this feature.
|
|
51
|
+
|
|
52
|
+
## Combining formulas and calculated columns
|
|
53
|
+
|
|
54
|
+
Use [`@libregrid/calculated-columns`](../calculated-columns/README.md) for
|
|
55
|
+
read-only expressions applied to every row. Both packages share an expression
|
|
56
|
+
engine: calculated columns use `[colId]` references within a row, while cell
|
|
57
|
+
formulas use cell and range references.
|
|
49
58
|
|
|
50
|
-
##
|
|
59
|
+
## Angular
|
|
51
60
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
cell/range references.
|
|
61
|
+
Use the same column definitions and grid options with `ag-grid-angular`.
|
|
62
|
+
Register the modules shown above through `provideLibreGrid` from
|
|
63
|
+
[`@libregrid/angular`](../angular/README.md). See the
|
|
64
|
+
[Angular setup](https://libregrid.dev/angular) for a complete component and bootstrap example.
|
|
57
65
|
|
|
58
|
-
##
|
|
66
|
+
## License
|
|
59
67
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
contracts published under MIT in `ag-grid-community`; no AG Grid Enterprise
|
|
63
|
-
code is used or inspected.
|
|
68
|
+
MIT — see [LICENSE](./LICENSE) and [NOTICE](./NOTICE). LibreGrid is an independent
|
|
69
|
+
project and is not affiliated with, endorsed by, or sponsored by AG Grid Ltd.
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "36.
|
|
1
|
+
export declare const VERSION = "36.2.0";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libregrid/formulas",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Spreadsheet-style cell formulas for AG Grid Community — part of LibreGrid",
|
|
5
5
|
"keywords": ["libregrid", "ag-grid", "formulas", "spreadsheet", "expressions"],
|
|
6
6
|
"homepage": "https://github.com/libregrid/libregrid#readme",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"peerDependencies": { "ag-grid-community": ">=36.1.0 <37" },
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@libregrid/core": "^1.3.
|
|
18
|
+
"@libregrid/core": "^1.3.5"
|
|
19
19
|
},
|
|
20
20
|
"files": ["dist", "LICENSE", "NOTICE", "README.md"],
|
|
21
21
|
"exports": { ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" } }
|