@fieldia/grid 0.0.0-stage → 0.3.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 fieldia-dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
1
+ # @fieldia/grid
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A [Fieldia](https://fieldia.dev) table of lines as a spreadsheet, on
4
+ [AG Grid Community](https://www.ag-grid.com/). Each cell is edited with
5
+ Fieldia's own field for its type, wired to its line, so every keystroke
6
+ reaches the form and computed values follow while a cell is being typed.
7
+
8
+ ```sh
9
+ npm install @fieldia/grid ag-grid-community
10
+ ```
11
+
12
+ ```ts
13
+ import { mountViewer } from '@fieldia/viewer';
14
+ import { gridWidgets } from '@fieldia/grid';
15
+
16
+ mountViewer(host, { page, dataSource, widgets: gridWidgets });
17
+ ```
18
+
19
+ A one2many node opts in with `"widget": "grid"`; nodes without it keep the
20
+ plain table, so pages that do not use the grid never load AG Grid. In React
21
+ pass `widgets={gridWidgets}`, in Vue `:widgets="gridWidgets"`, in Angular
22
+ `[widgets]="gridWidgets"`.
23
+
24
+ ```json
25
+ { "type": "field", "id": "f-lines", "field": "line_ids", "widget": "grid",
26
+ "totals": ["qty", "subtotal"], "optionalColumns": { "discount": "show" } }
27
+ ```
28
+
29
+ - **Keys**: Enter keeps a cell and moves down, Tab moves across (skipping
30
+ cells that cannot be edited), Tab or Enter at the end starts a new line,
31
+ Escape puts a cell back, Space ticks yes/no, Alt+Up/Down moves a line.
32
+ - **Sections and notes** (`lineKinds` on the field) run across the row; a
33
+ note grows as it is typed.
34
+ - **Moving lines** by a handle, with a `sequenceField` on the field.
35
+ - **Totals** under the lines, **columns** people resize, move and choose
36
+ (kept in the viewer's `preferences` store), **long tables** that scroll
37
+ inside, and `"editMode": "row"` to open a whole line at once.
38
+ - **A refused save** marks the wrong cells and opens the first one.
39
+
40
+ `gridApiOf(element)` returns the AG Grid API behind a grid, for an app that
41
+ needs more than the page describes.
42
+
43
+ MIT. AG Grid Community is MIT too; AG Grid Enterprise is not used.
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@fieldia/grid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.3.0",
4
+ "description": "Fieldia's table of lines on AG Grid: spreadsheet editing with Fieldia's own fields in the cells.",
5
+ "license": "MIT",
6
+ "homepage": "https://fieldia.dev",
7
+ "type": "commonjs",
8
+ "main": "./src/index.js",
9
+ "module": "./src/index.mjs",
10
+ "types": "./src/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": {
14
+ "import": "./src/index.d.mts",
15
+ "require": "./src/index.d.ts"
16
+ },
17
+ "import": "./src/index.mjs",
18
+ "require": "./src/index.js",
19
+ "default": "./src/index.js"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "dependencies": {
24
+ "@fieldia/core": "0.3.0",
25
+ "@fieldia/widgets": "0.3.0",
26
+ "tslib": "^2.8.1"
27
+ },
28
+ "peerDependencies": {
29
+ "ag-grid-community": "^36.0.0"
30
+ },
31
+ "sideEffects": false,
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/fieldia-dev/fieldia",
35
+ "directory": "libs/grid"
36
+ },
37
+ "files": [
38
+ "src",
39
+ "README.md",
40
+ "LICENSE"
41
+ ]
6
42
  }
@@ -0,0 +1,2 @@
1
+ export * from './lib/grid.mjs';
2
+ export * from './lib/styles.mjs';
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './lib/grid';
2
+ export * from './lib/styles';
package/src/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib/grid"), exports);
5
+ tslib_1.__exportStar(require("./lib/styles"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/grid/src/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,uDAA6B"}
package/src/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ export * from './lib/grid.mjs';
2
+ export * from './lib/styles.mjs';
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../libs/grid/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type GridApi } from 'ag-grid-community';
2
+ import { type Line } from '@fieldia/core';
3
+ import { type WidgetFactory } from '@fieldia/widgets';
4
+ /** The AG Grid API behind a grid's element, for an app that needs more than the page describes. */
5
+ export declare function gridApiOf(element: HTMLElement): GridApi<Line> | undefined;
6
+ export declare const gridWidget: WidgetFactory;
7
+ /** Pass these to the viewer (`widgets`) to show one2many nodes marked `"widget": "grid"` in the grid. */
8
+ export declare const gridWidgets: Record<string, WidgetFactory>;
@@ -0,0 +1,8 @@
1
+ import { type GridApi } from 'ag-grid-community';
2
+ import { type Line } from '@fieldia/core';
3
+ import { type WidgetFactory } from '@fieldia/widgets';
4
+ /** The AG Grid API behind a grid's element, for an app that needs more than the page describes. */
5
+ export declare function gridApiOf(element: HTMLElement): GridApi<Line> | undefined;
6
+ export declare const gridWidget: WidgetFactory;
7
+ /** Pass these to the viewer (`widgets`) to show one2many nodes marked `"widget": "grid"` in the grid. */
8
+ export declare const gridWidgets: Record<string, WidgetFactory>;