@nivaro/react 0.1.247 → 0.1.249

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 +62 -24
  2. package/dist/index.js +23994 -23873
  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
@@ -3829,7 +3880,7 @@ export declare function RecordGridWidgetBody({ widget }: {
3829
3880
  widget: PageRendererWidget;
3830
3881
  }): JSX.Element;
3831
3882
 
3832
- export declare function RecordReadView({ collection, itemId, layoutData, flush, renderSlot, integrityMarks }: {
3883
+ export declare function RecordReadView({ collection, itemId, layoutData, flush, renderSlot, integrityMarks, renderGrid, gridCounts }: {
3833
3884
  collection: string;
3834
3885
  itemId: string;
3835
3886
  layoutData: ReadViewLayout;
@@ -3849,6 +3900,15 @@ export declare function RecordReadView({ collection, itemId, layoutData, flush,
3849
3900
  * finding gets an amber mark whose tip lists the messages.
3850
3901
  */
3851
3902
  integrityMarks?: boolean;
3903
+ /**
3904
+ * Host-rendered child grid for an O2M alias — the record form passes its
3905
+ * real inline grid in read-only mode so Summary keeps everything the edit
3906
+ * grid decorates (PO match dots, row lints, submission errors, presets,
3907
+ * aggregate footer). Return null to fall back to the plain child table.
3908
+ */
3909
+ renderGrid?: (assignment: LayoutAssignment) => ReactNode;
3910
+ /** Row counts per O2M alias when the host renders the grids (hide_empty). */
3911
+ gridCounts?: Record<string, number>;
3852
3912
  }): JSX.Element;
3853
3913
 
3854
3914
  /**
@@ -4167,28 +4227,6 @@ export declare const ROW_HIGHLIGHT_TINTS: Record<string, {
4167
4227
  text: string;
4168
4228
  }>;
4169
4229
 
4170
- /**
4171
- * A one-click rewrite of every row in the grid, driven by an aggregate of a
4172
- * related collection.
4173
- *
4174
- * EFP's "Close Out Lines" is one instance of this shape: for each REQ line,
4175
- * sum `open_unbilled_amount` across the PO lines pointing at it and, where the
4176
- * line covers that remainder, subtract it. Expressed as config rather than
4177
- * EFP code so any collection can do the same:
4178
- *
4179
- * {label:'Close Out Lines', relation:'po_line_items',
4180
- * aggregate:{field:'open_unbilled_amount', op:'sum'},
4181
- * guard:'{{amount}} >= {{__agg__}}',
4182
- * set:{amount:'{{amount}} - {{__agg__}}'}}
4183
- *
4184
- * `{{__agg__}}` is the aggregate for that row (same token match-agg-column
4185
- * uses); every other `{{field}}` reads the row's current value. Rows failing
4186
- * the guard are left exactly as they are.
4187
- *
4188
- * Writes go through the SAME paths a manual cell edit uses, so a staged grid
4189
- * (new record, addendum, save_mode 'pending') stages the change and an
4190
- * immediate grid PATCHes it — the action never invents its own persistence.
4191
- */
4192
4230
  declare interface RowBulkActionConfig {
4193
4231
  label: string;
4194
4232
  /** O2M alias on the ROW's collection pointing at the rows to aggregate. */