@nivaro/react 0.1.198 → 0.1.200

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/dist/index.d.ts CHANGED
@@ -1226,7 +1226,7 @@ export declare interface FieldInterfaceProps {
1226
1226
  itemId: string | null;
1227
1227
  }
1228
1228
 
1229
- export declare function FieldRenderer({ field, value, onChange, relations, collection, itemId, cascadeFilter, requiredParentLabel, onCountChange, displayOnly, prefillParentId }: {
1229
+ export declare function FieldRenderer({ field, value, onChange, relations, collection, itemId, cascadeFilter, requiredParentLabel, narrowedBy, onCountChange, displayOnly, prefillParentId }: {
1230
1230
  field: CMSField;
1231
1231
  value: unknown;
1232
1232
  onChange: (v: unknown) => void;
@@ -1235,6 +1235,12 @@ export declare function FieldRenderer({ field, value, onChange, relations, colle
1235
1235
  itemId: string;
1236
1236
  cascadeFilter?: Record<string, unknown>;
1237
1237
  requiredParentLabel?: string | null;
1238
+ /** Cascade parents currently narrowing an M2O picker (see RelationCombobox). */
1239
+ narrowedBy?: {
1240
+ labels: string[];
1241
+ keys: string[];
1242
+ onClear?: (key: string) => void;
1243
+ };
1238
1244
  onCountChange?: (count: number) => void;
1239
1245
  displayOnly?: boolean;
1240
1246
  prefillParentId?: string;
@@ -1753,7 +1759,7 @@ declare interface ImportValidationReport {
1753
1759
  truncated: boolean;
1754
1760
  }
1755
1761
 
1756
- 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, submissionErrors, prefillParentId, parentFieldKey, readOnly, emptyLabel }: {
1762
+ 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, submissionErrors, prefillParentId, parentFieldKey, readOnly, emptyLabel }: {
1757
1763
  relatedCollection: string;
1758
1764
  manyField: string;
1759
1765
  parentId: string;
@@ -1802,6 +1808,9 @@ export declare function InlineTableField({ relatedCollection, manyField, parentI
1802
1808
  /** Import template NAME — renders that template's upload button in this
1803
1809
  * grid's toolbar (existing records; wired to ItemEditForm's reimport flow). */
1804
1810
  uploadTemplate?: string;
1811
+ /** "Which related record is this row matched to, and if not, why" — see
1812
+ * RowMatchPanel (options.row_match_panel). Rendered in the row editor. */
1813
+ rowMatchPanel?: RowMatchPanelConfig;
1805
1814
  /** Flag rows a failed ERP push rejected (options.submission_errors) — the
1806
1815
  * latest failed nivaro_erp_submissions row for the PARENT record is parsed
1807
1816
  * for "LineNumber N: reason" entries and matching rows tint red with the
@@ -3323,13 +3332,21 @@ export declare function RelatedRecordsPanel({ collection, itemId, title, default
3323
3332
  defaultExpanded?: boolean;
3324
3333
  }): JSX.Element;
3325
3334
 
3326
- export declare function RelationCombobox({ collection, value, onChange, disabled, placeholder, extraFilter, autoSelectSingle, optionSort, requiredParent, facets, fieldKey }: {
3335
+ export declare function RelationCombobox({ collection, value, onChange, disabled, placeholder, extraFilter, autoSelectSingle, optionSort, requiredParent, facets, fieldKey, narrowedBy }: {
3327
3336
  collection: string;
3328
3337
  value: unknown;
3329
3338
  onChange: (v: unknown) => void;
3330
3339
  disabled?: boolean;
3331
3340
  placeholder?: string;
3332
3341
  extraFilter?: Record<string, unknown>;
3342
+ /** The parent fields whose current values narrow this picker (cascade
3343
+ * filters). When the narrowed list is EMPTY the panel says which parents
3344
+ * did it and offers to clear one — instead of a blank "No results". */
3345
+ narrowedBy?: {
3346
+ labels: string[];
3347
+ keys: string[];
3348
+ onClear?: (key: string) => void;
3349
+ };
3333
3350
  /** When the filtered option set has EXACTLY one option and the field is
3334
3351
  * empty, pick it automatically (options.auto_select_single). Two or more
3335
3352
  * options — or zero — leave the field blank; an existing value is never
@@ -3593,6 +3610,57 @@ export declare function rowHighlightClass(color?: string | null): string | undef
3593
3610
 
3594
3611
  export declare function rowHighlightTextClass(color?: string | null): string;
3595
3612
 
3613
+ /**
3614
+ * "Which related record is this row matched to, and if none, why not?"
3615
+ *
3616
+ * Config-driven (`options.row_match_panel` on an inline-table field): the
3617
+ * O2M alias on the child that points at the matched records (a workflow
3618
+ * line's `po_line_items`), the columns to show for a match, and — for the
3619
+ * unmatched case — how to find the nearest candidate among a filtered set
3620
+ * (the record's linked purchase orders) and which keys the match rule
3621
+ * compares. `useRowMatches` resolves this ONCE for every saved row of a
3622
+ * grid (two batched reads); the row shows a small dot, the row editor the
3623
+ * full panel with the reason a match fails.
3624
+ */
3625
+ declare interface RowMatchPanelConfig {
3626
+ /** O2M alias on the child collection (e.g. workflow_line_items.po_line_items). */
3627
+ relation: string;
3628
+ /** Panel heading. Default "Match". */
3629
+ title?: string;
3630
+ /** Shown per matched record. `path` is a column or dotted M2O path on the
3631
+ * target; `formula` is `{{col}}` arithmetic over the target row. */
3632
+ columns: Array<{
3633
+ path?: string;
3634
+ formula?: string;
3635
+ label: string;
3636
+ format?: 'currency' | 'number' | 'text';
3637
+ }>;
3638
+ /** How to explain a miss, and which keys a match is judged on. */
3639
+ candidates?: {
3640
+ /** Filter over the target collection; `$parent.<field>` tokens resolve
3641
+ * from the parent record (M2M aliases give id arrays). Unresolved token
3642
+ * = the parent has nothing to match against yet. */
3643
+ filter: Record<string, unknown>;
3644
+ /** The match rule: each key pairs a row field with a candidate field. */
3645
+ keys: Array<{
3646
+ row: string;
3647
+ candidate: string;
3648
+ label: string;
3649
+ format?: 'currency' | 'number' | 'text';
3650
+ /** Dotted path on the candidate for a human label (line_type.type). */
3651
+ candidate_display?: string;
3652
+ }>;
3653
+ /** Row field of the key that locates the nearest candidate (default: first key). */
3654
+ primary?: string;
3655
+ /** Label for the candidate's parent ("PO"), used in reasons; `parent_path`
3656
+ * is the dotted path to its human id (purchase_order.number). */
3657
+ parent_label?: string;
3658
+ parent_path?: string;
3659
+ };
3660
+ no_parent_message?: string;
3661
+ empty_message?: string;
3662
+ }
3663
+
3596
3664
  declare interface RowRule {
3597
3665
  trigger_field?: string | null;
3598
3666
  trigger_op?: string;