@dskripchenko/laravel-admin 1.37.0 → 1.38.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -7,8 +7,8 @@
7
7
  * - datetime → 'd.m.Y H:i:s' by default.
8
8
  * - money → '{value} {currency}', with decimals.
9
9
  * - boolean → the trueLabel or falseLabel from the meta.
10
- * - badge → the text; the styling happens in the UI, through a slot or
11
- * a CSS class.
10
+ * - badge → the label from meta.labels (TableColumn::asBadge), or the
11
+ * value as it is; the tone comes from badgeTone().
12
12
  * - bytes → a human-readable size.
13
13
  * - text → the fallback.
14
14
  *
@@ -26,3 +26,22 @@ export interface CellMeta {
26
26
  [key: string]: unknown;
27
27
  }
28
28
  export declare function formatCell(value: unknown, preset: string | undefined, meta?: CellMeta): string;
29
+ export type BadgeTone = 'info' | 'success' | 'warning' | 'danger' | 'default';
30
+ /** The badge tone of a value: the column's colour map, meta.colors. */
31
+ export declare function badgeTone(value: unknown, meta?: CellMeta): BadgeTone;
32
+ /** The badge caption of a value: meta.labels, or the value itself. */
33
+ export declare function badgeLabel(value: unknown, meta?: CellMeta): string;
34
+ /** Where formatTableRows keeps the raw row next to the formatted one. */
35
+ export declare const RAW_ROW: unique symbol;
36
+ export interface TableColumnLike {
37
+ name: string;
38
+ preset?: string | null;
39
+ meta?: CellMeta;
40
+ }
41
+ /**
42
+ * Formats every cell of the rows by their columns' presets, keeping the raw
43
+ * row under RAW_ROW — a badge cell needs the raw value for its tone.
44
+ */
45
+ export declare function formatTableRows(rows: Record<string, unknown>[], columns: TableColumnLike[]): Record<string | symbol, unknown>[];
46
+ /** The tone of a badge cell of a row made by formatTableRows. */
47
+ export declare function rowBadgeTone(row: unknown, column: TableColumnLike): BadgeTone;