@nivaro/react 0.1.248 → 0.1.250

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +52 -23
  2. package/dist/index.js +20929 -20841
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1711,6 +1711,47 @@ export declare type GridFlushContextValue = {
1711
1711
  unregister: (key: string) => void;
1712
1712
  };
1713
1713
 
1714
+ /**
1715
+ * A one-click rewrite of every row in the grid, driven by an aggregate of a
1716
+ * related collection.
1717
+ *
1718
+ * EFP's "Close Out Lines" is one instance of this shape: for each REQ line,
1719
+ * sum `open_unbilled_amount` across the PO lines pointing at it and, where the
1720
+ * line covers that remainder, subtract it. Expressed as config rather than
1721
+ * EFP code so any collection can do the same:
1722
+ *
1723
+ * {label:'Close Out Lines', relation:'po_line_items',
1724
+ * aggregate:{field:'open_unbilled_amount', op:'sum'},
1725
+ * guard:'{{amount}} >= {{__agg__}}',
1726
+ * set:{amount:'{{amount}} - {{__agg__}}'}}
1727
+ *
1728
+ * `{{__agg__}}` is the aggregate for that row (same token match-agg-column
1729
+ * uses); every other `{{field}}` reads the row's current value. Rows failing
1730
+ * the guard are left exactly as they are.
1731
+ *
1732
+ * Writes go through the SAME paths a manual cell edit uses, so a staged grid
1733
+ * (new record, addendum, save_mode 'pending') stages the change and an
1734
+ * immediate grid PATCHes it — the action never invents its own persistence.
1735
+ */
1736
+ declare interface GridStatConfig {
1737
+ label: string;
1738
+ /** Expression — `{{$parent.requisition_amount}} - {{$sum.total}}`. */
1739
+ value: string;
1740
+ format?: 'currency' | 'number';
1741
+ /** 'danger' paints a negative result red (the "over" state). */
1742
+ negative?: 'danger';
1743
+ }
1744
+
1745
+ declare interface GridSumCapConfig {
1746
+ /** Column summed over the grid (write-computed columns are derived per row). */
1747
+ field: string;
1748
+ /** Expression for the ceiling — `{{$parent.requisition_amount}}`. */
1749
+ cap: string;
1750
+ format?: 'currency' | 'number';
1751
+ label?: string;
1752
+ message?: string;
1753
+ }
1754
+
1714
1755
  export declare interface HeaderWidgetInfo {
1715
1756
  field: string;
1716
1757
  widgetId: number;
@@ -1937,7 +1978,7 @@ export declare function InboundCallersView({ hours: initialHours }: {
1937
1978
  hours?: number;
1938
1979
  }): JSX.Element;
1939
1980
 
1940
- export declare function InlineTableField({ relatedCollection, manyField, parentId, parentCollection, layoutId, showRowRevisions, rowComments, allowRevisionRestore, saveMode, showLineNumbers, enableReorder, parentCascades, rowRules, columnPresets, defaultPreset, drawerRelations, parentContextFields, uniqueBy, sortField, sortDir, sectionGroupBy, freezeFirstColumn, rowFilter, rowDefaults, allocateDrawer, autoAllocate, rowBulkActions, uploadTemplate, rowMatchPanel, lineSla, rowLints, submissionErrors, prefillParentId, parentFieldKey, readOnly, emptyLabel, editorMode }: {
1981
+ export declare function InlineTableField({ relatedCollection, manyField, parentId, parentCollection, layoutId, showRowRevisions, rowComments, allowRevisionRestore, saveMode, showLineNumbers, enableReorder, parentCascades, rowRules, columnPresets, defaultPreset, drawerRelations, parentContextFields, uniqueBy, sortField, sortDir, sectionGroupBy, freezeFirstColumn, rowFilter, rowDefaults, allocateDrawer, autoAllocate, rowBulkActions, uploadTemplate, rowMatchPanel, lineSla, rowLints, stats, sumCap, submissionErrors, prefillParentId, parentFieldKey, readOnly, emptyLabel, editorMode }: {
1941
1982
  relatedCollection: string;
1942
1983
  manyField: string;
1943
1984
  parentId: string;
@@ -2000,6 +2041,16 @@ export declare function InlineTableField({ relatedCollection, manyField, parentI
2000
2041
  } | null;
2001
2042
  /** options.row_lints — "when X, expect Y" checks judged per row on the client. */
2002
2043
  rowLints?: RowLint[] | null;
2044
+ /** options.stats — a figure strip above the grid (both modes). Each value is
2045
+ * an expression over `{{$parent.<field>}}` (the parent record's draft),
2046
+ * `{{$sum.<column>}}` (that column summed over the rows on screen, staged
2047
+ * edits and the row being typed into included) and `{{$count}}`. A
2048
+ * negative result reads red when `negative` is 'danger'. */
2049
+ stats?: GridStatConfig[] | null;
2050
+ /** options.sum_cap — refuse to save/stage a row when `field` summed over the
2051
+ * grid (this row's draft included) would exceed `cap` (same tokens as
2052
+ * stats). The client twin of the server's sum_cap validation rule. */
2053
+ sumCap?: GridSumCapConfig | null;
2003
2054
  /** Flag rows a failed ERP push rejected (options.submission_errors) — the
2004
2055
  * latest failed nivaro_erp_submissions row for the PARENT record is parsed
2005
2056
  * for "LineNumber N: reason" entries and matching rows tint red with the
@@ -4176,28 +4227,6 @@ export declare const ROW_HIGHLIGHT_TINTS: Record<string, {
4176
4227
  text: string;
4177
4228
  }>;
4178
4229
 
4179
- /**
4180
- * A one-click rewrite of every row in the grid, driven by an aggregate of a
4181
- * related collection.
4182
- *
4183
- * EFP's "Close Out Lines" is one instance of this shape: for each REQ line,
4184
- * sum `open_unbilled_amount` across the PO lines pointing at it and, where the
4185
- * line covers that remainder, subtract it. Expressed as config rather than
4186
- * EFP code so any collection can do the same:
4187
- *
4188
- * {label:'Close Out Lines', relation:'po_line_items',
4189
- * aggregate:{field:'open_unbilled_amount', op:'sum'},
4190
- * guard:'{{amount}} >= {{__agg__}}',
4191
- * set:{amount:'{{amount}} - {{__agg__}}'}}
4192
- *
4193
- * `{{__agg__}}` is the aggregate for that row (same token match-agg-column
4194
- * uses); every other `{{field}}` reads the row's current value. Rows failing
4195
- * the guard are left exactly as they are.
4196
- *
4197
- * Writes go through the SAME paths a manual cell edit uses, so a staged grid
4198
- * (new record, addendum, save_mode 'pending') stages the change and an
4199
- * immediate grid PATCHes it — the action never invents its own persistence.
4200
- */
4201
4230
  declare interface RowBulkActionConfig {
4202
4231
  label: string;
4203
4232
  /** O2M alias on the ROW's collection pointing at the rows to aggregate. */