@nivaro/react 0.1.233 → 0.1.235

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
@@ -2317,10 +2317,13 @@ export declare function matchScopeDimension(scopes: UserScopesInfo | null, probe
2317
2317
  collection?: string;
2318
2318
  }): UserScopesInfo['dimensions'][number] | null;
2319
2319
 
2320
- export declare function MatrixEditor({ config, initialScope }: {
2320
+ export declare function MatrixEditor({ config, initialScope, lockScope }: {
2321
2321
  config: MatrixEditorConfig;
2322
2322
  /** Pre-seed scope pickers (drill-down hosts scope the matrix to a record). */
2323
2323
  initialScope?: Record<string, unknown>;
2324
+ /** Scope fields supplied by initialScope render as fixed context, not pickers
2325
+ * (a sheet already scoped to one project). */
2326
+ lockScope?: boolean;
2324
2327
  }): JSX.Element;
2325
2328
 
2326
2329
  declare interface MatrixEditorConfig {
@@ -2335,6 +2338,8 @@ declare interface MatrixEditorConfig {
2335
2338
  option_filter?: Record<string, unknown>;
2336
2339
  key_field: string;
2337
2340
  value_field: string;
2341
+ /** Colour role for the saved-value column (default 'info'). */
2342
+ value_color?: string;
2338
2343
  value_label?: string;
2339
2344
  value_format?: 'currency' | 'number';
2340
2345
  /** Scope pickers. `filter` narrows a picker's options; '$scope.<field>'
@@ -2399,11 +2404,35 @@ declare interface MatrixEditorConfig {
2399
2404
  params?: Record<string, unknown>;
2400
2405
  match_option_field: string;
2401
2406
  match_group_field?: string;
2407
+ /** `color` = a QueryTable colour role (accent | ink | muted | positive |
2408
+ * negative | warning | info) or hex for the column's figures. */
2402
2409
  columns: Array<{
2403
2410
  field: string;
2404
2411
  label?: string;
2405
2412
  format?: 'currency' | 'number';
2413
+ color?: string;
2406
2414
  }>;
2415
+ /** Computed columns over the row: `{{__current__}}` (saved value),
2416
+ * `{{__new__}}` (live value incl. the edit) and any metric field —
2417
+ * e.g. Remaining = `{{__new__}} - {{current_spend}} - {{committed_costs}}`.
2418
+ * Aggregated levels sum the inputs first, then apply the formula. */
2419
+ derived?: Array<{
2420
+ label: string;
2421
+ formula: string;
2422
+ format?: 'currency' | 'number';
2423
+ /** Colour role; `color_negative` takes over below zero (default
2424
+ * positive / negative — a Remaining figure). */
2425
+ color?: string;
2426
+ color_negative?: string;
2427
+ }>;
2428
+ /** Metric rows that match no rendered cell still count: shown read-only as
2429
+ * an "Other …" row per group (options outside the project's list) and an
2430
+ * "Other …" group (groups outside the project's list), so the totals
2431
+ * reconcile with the project-level figures. */
2432
+ unmatched?: {
2433
+ option_label?: string;
2434
+ group_label?: string;
2435
+ } | false;
2407
2436
  };
2408
2437
  }
2409
2438
 
@@ -2938,9 +2967,16 @@ declare interface QuerySheetDef {
2938
2967
  title?: string;
2939
2968
  width?: number | string;
2940
2969
  config?: QueryWidgetConfig;
2970
+ /** A tab is a nested query view OR a MatrixEditor (`matrix`): its scope is
2971
+ * seeded from the clicked row — `scope: {project: '$row.id'}` — and those
2972
+ * fields render as fixed context, not pickers. */
2941
2973
  tabs?: Array<{
2942
2974
  label: string;
2943
- config: QueryWidgetConfig;
2975
+ config?: QueryWidgetConfig;
2976
+ matrix?: {
2977
+ config: MatrixEditorConfig;
2978
+ scope: Record<string, string>;
2979
+ };
2944
2980
  }>;
2945
2981
  }
2946
2982
 
@@ -2989,9 +3025,14 @@ declare interface QueryTableColumn {
2989
3025
  * alternating groups get a faint band so wide grids stay scannable. */
2990
3026
  group?: string;
2991
3027
  /** Cell text color (any CSS color) — EFP forecast/actual column tinting.
2992
- * color_dark overrides in dark mode (defaults to color). */
3028
+ * color_dark overrides in dark mode (defaults to color). Either may be a
3029
+ * role name — accent | ink | muted | positive | negative | warning | info —
3030
+ * instead of a hex; roles follow the host theme (see COLOR_ROLES). */
2993
3031
  color?: string;
2994
3032
  color_dark?: string;
3033
+ /** Colour (role or hex) used instead of `color` when the cell's value is
3034
+ * negative — a Remaining Budget column reads green until it goes red. */
3035
+ color_negative?: string;
2995
3036
  /** Second field rendered as a stacked line under the main value in the SAME
2996
3037
  * cell (EFP month cells: Fcst over Act — halves the column count). Toggles
2997
3038
  * hide individual lines; the column collapses when both lines hide. */
@@ -3078,6 +3119,11 @@ declare interface QueryTableConfig {
3078
3119
  /** Render a Months/Quarters toggle above the table (EFP quarterly view).
3079
3120
  * Quarter columns sum their three months — same drill/total math. */
3080
3121
  quarter_toggle?: boolean;
3122
+ /** Colour role/hex for the generated period + year columns, an optional
3123
+ * below-zero flip, and a separate colour for the Total column. */
3124
+ color?: string;
3125
+ color_negative?: string;
3126
+ total_color?: string;
3081
3127
  };
3082
3128
  }
3083
3129
 
@@ -3166,7 +3212,8 @@ declare interface QueryWidgetStat {
3166
3212
  * render with a leading '+'. */
3167
3213
  field_subtract?: string;
3168
3214
  /** EFP stat-card accent: colored top border + value (accent_dark in dark
3169
- * mode; accent_negative when a delta goes negative). */
3215
+ * mode; accent_negative when a delta goes negative). Each may be a role name
3216
+ * — accent | positive | negative | info … — see QueryTable COLOR_ROLES. */
3170
3217
  accent?: string;
3171
3218
  accent_dark?: string;
3172
3219
  accent_negative?: string;
@@ -3436,6 +3483,14 @@ export declare function RecordGridEditor({ config }: {
3436
3483
  declare interface RecordGridEditorConfig {
3437
3484
  collection: string;
3438
3485
  title?: string;
3486
+ /**
3487
+ * BROWSE-THEN-EDIT: the key columns become header pickers. Until every key
3488
+ * is chosen the grid shows read-only totals rolled up by the unpicked keys
3489
+ * (click a rollup to drill into it); once all keys are chosen the matching
3490
+ * row(s) edit inline and a missing row can be created. Month values render
3491
+ * formatted (thousands separators) until focused.
3492
+ */
3493
+ browse?: boolean;
3439
3494
  /** Scope pickers: every field must be chosen before rows load; values filter
3440
3495
  * loaded rows and seed created rows. `filter` supports '$scope.<field>'
3441
3496
  * tokens off the other scope values. */