shirkasoft-ui-components 1.3.15 → 1.13.16

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.
@@ -32,6 +32,22 @@ class TooltipComponent {
32
32
  }
33
33
  /** Shows the tooltip over the host trigger on mouseenter. */
34
34
  onMouseEnter() {
35
+ this.open();
36
+ }
37
+ /** Hides the tooltip on mouseleave. */
38
+ onMouseLeave() {
39
+ this.hide();
40
+ }
41
+ /** Also opens on keyboard focus, so icon-only triggers are readable. */
42
+ onFocusIn() {
43
+ this.open();
44
+ }
45
+ /** Closes when the focus leaves the trigger. */
46
+ onFocusOut() {
47
+ this.hide();
48
+ }
49
+ /** Opens the tooltip when there is text to show. */
50
+ open() {
35
51
  if (!this.text())
36
52
  return;
37
53
  const trigger = this.host.nativeElement.querySelector('.shk-tooltip-trigger');
@@ -39,10 +55,6 @@ class TooltipComponent {
39
55
  return;
40
56
  this.show(trigger);
41
57
  }
42
- /** Hides the tooltip on mouseleave. */
43
- onMouseLeave() {
44
- this.hide();
45
- }
46
58
  /** Creates and positions the tooltip element on `document.body`. */
47
59
  show(trigger) {
48
60
  this.removeTooltip();
@@ -58,7 +70,7 @@ class TooltipComponent {
58
70
  borderRadius: '6px',
59
71
  fontSize: '12px',
60
72
  lineHeight: '1.4',
61
- whiteSpace: 'normal',
73
+ whiteSpace: 'pre-line',
62
74
  maxWidth: 'min(80vw, 22rem)',
63
75
  boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
64
76
  pointerEvents: 'none',
@@ -136,7 +148,7 @@ class TooltipComponent {
136
148
  this.removeTooltip();
137
149
  }
138
150
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
139
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.23", type: TooltipComponent, isStandalone: true, selector: "shk-tooltip", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" } }, ngImport: i0, template: `
151
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.23", type: TooltipComponent, isStandalone: true, selector: "shk-tooltip", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "focusin": "onFocusIn()", "focusout": "onFocusOut()" } }, ngImport: i0, template: `
140
152
  <div class="shk-tooltip-trigger inline-flex">
141
153
  <ng-content></ng-content>
142
154
  </div>
@@ -159,6 +171,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImpo
159
171
  }], onMouseLeave: [{
160
172
  type: HostListener,
161
173
  args: ['mouseleave']
174
+ }], onFocusIn: [{
175
+ type: HostListener,
176
+ args: ['focusin']
177
+ }], onFocusOut: [{
178
+ type: HostListener,
179
+ args: ['focusout']
162
180
  }] } });
163
181
 
164
182
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"shirkasoft-ui-components-tooltip.mjs","sources":["../../../projects/ui-components/tooltip/tooltip.component.ts","../../../projects/ui-components/tooltip/shirkasoft-ui-components-tooltip.ts"],"sourcesContent":["import {\n Component,\n input,\n ElementRef,\n inject,\n HostListener,\n OnDestroy,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\nconst TOOLTIP_Z_INDEX = '2147483647';\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Tooltip rendered in `document.body` with `position: fixed`, so it always\n * floats above any container (tables with `overflow: hidden`, modals, scroll\n * wrappers, etc.) and never gets clipped or hidden behind its anchor element.\n */\n@Component({\n selector: 'shk-tooltip',\n standalone: true,\n template: `\n <div class=\"shk-tooltip-trigger inline-flex\">\n <ng-content></ng-content>\n </div>\n `,\n})\nexport class TooltipComponent implements OnDestroy {\n /** Content of the tooltip. */\n readonly text = input<string>('');\n /** Preferred placement relative to the trigger. */\n readonly position = input<'top' | 'bottom' | 'right'>('bottom');\n /** 'hover' shows on mouse enter; 'fixed' stays pinned to the content. */\n readonly mode = input<'hover' | 'fixed'>('hover');\n /** Distance (px) between the tooltip and the trigger. */\n readonly offset = input(8);\n\n private readonly host = inject(ElementRef<HTMLElement>);\n private readonly document = inject(DOCUMENT);\n\n /** The dynamically created tooltip element. */\n private tooltipEl: HTMLElement | null = null;\n /** Unsubscribe callbacks for the scroll/resize listeners. */\n private cleanup: (() => void) | null = null;\n\n /** Shows the tooltip over the host trigger on mouseenter. */\n @HostListener('mouseenter')\n onMouseEnter(): void {\n if (!this.text()) return;\n const trigger = this.host.nativeElement.querySelector(\n '.shk-tooltip-trigger',\n ) as HTMLElement | null;\n if (!trigger) return;\n this.show(trigger);\n }\n\n /** Hides the tooltip on mouseleave. */\n @HostListener('mouseleave')\n onMouseLeave(): void {\n this.hide();\n }\n\n /** Creates and positions the tooltip element on `document.body`. */\n private show(trigger: HTMLElement): void {\n this.removeTooltip();\n\n const el = this.document.createElement('span');\n el.className = 'shk-tooltip-dynamic';\n el.textContent = this.text();\n Object.assign(el.style, {\n position: 'fixed',\n zIndex: TOOLTIP_Z_INDEX,\n backgroundColor: 'var(--shk-tooltip-bg, #27272a)',\n color: 'var(--shk-tooltip-text, #fff)',\n padding: '4px 8px',\n borderRadius: '6px',\n fontSize: '12px',\n lineHeight: '1.4',\n whiteSpace: 'normal',\n maxWidth: 'min(80vw, 22rem)',\n boxShadow:\n '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',\n pointerEvents: 'none',\n opacity: '0',\n transition: 'opacity 0.15s ease',\n });\n\n this.document.body.appendChild(el);\n this.tooltipEl = el;\n\n const place = () => {\n const rect = trigger.getBoundingClientRect();\n const w = el.offsetWidth;\n const h = el.offsetHeight;\n const { left, top } = this.computePosition(rect, w, h);\n el.style.left = `${left}px`;\n el.style.top = `${top}px`;\n };\n\n place();\n requestAnimationFrame(() => {\n if (this.tooltipEl === el) {\n el.style.opacity = '1';\n }\n });\n\n const onScrollOrResize = () => place();\n window.addEventListener('scroll', onScrollOrResize, true);\n window.addEventListener('resize', onScrollOrResize);\n this.cleanup = () => {\n window.removeEventListener('scroll', onScrollOrResize, true);\n window.removeEventListener('resize', onScrollOrResize);\n };\n }\n\n /** Computes the tooltip position, clamped to the viewport. */\n private computePosition(\n rect: DOMRect,\n width: number,\n height: number,\n ): { left: number; top: number } {\n const off = this.offset();\n const viewportW = this.document.defaultView?.innerWidth ?? 0;\n const viewportH = this.document.defaultView?.innerHeight ?? 0;\n\n let x: number;\n let y: number;\n\n if (this.position() === 'right') {\n x = rect.right + off;\n y = rect.top + rect.height / 2 - height / 2;\n } else if (this.position() === 'bottom') {\n x = rect.left + rect.width / 2 - width / 2;\n y = rect.bottom + off;\n } else {\n x = rect.left + rect.width / 2 - width / 2;\n y = rect.top - off - height;\n }\n\n const margin = 4;\n const left = Math.max(\n margin,\n Math.min(x, Math.max(margin, viewportW - width - margin)),\n );\n const top = Math.max(\n margin,\n Math.min(y, Math.max(margin, viewportH - height - margin)),\n );\n return { left, top };\n }\n\n /** Fades the tooltip out and removes it from the DOM. */\n private hide(): void {\n if (!this.tooltipEl) return;\n const el = this.tooltipEl;\n el.style.opacity = '0';\n this.tooltipEl = null;\n setTimeout(() => {\n el.remove();\n }, 150);\n }\n\n /** Removes the tooltip and its listeners. */\n private removeTooltip(): void {\n this.cleanup?.();\n this.cleanup = null;\n this.tooltipEl?.remove();\n this.tooltipEl = null;\n }\n\n /** Cleans up the tooltip on component destroy. */\n ngOnDestroy(): void {\n this.removeTooltip();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAUA,MAAM,eAAe,GAAG,YAAY;AAEpC;;;;AAIG;AAEH;;;;AAIG;MAUU,gBAAgB,CAAA;AAT7B,IAAA,WAAA,GAAA;;AAWW,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;;AAExB,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAA6B,QAAQ,+EAAC;;AAEtD,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAoB,OAAO,2EAAC;;AAExC,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK,CAAC,CAAC,6EAAC;AAET,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,EAAC,UAAuB,EAAC;AACtC,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;;QAGpC,IAAA,CAAA,SAAS,GAAuB,IAAI;;QAEpC,IAAA,CAAA,OAAO,GAAwB,IAAI;AAmI5C,IAAA;;IA/HC,YAAY,GAAA;AACV,QAAA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YAAE;AAClB,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,CACnD,sBAAsB,CACD;AACvB,QAAA,IAAI,CAAC,OAAO;YAAE;AACd,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;IACpB;;IAIA,YAAY,GAAA;QACV,IAAI,CAAC,IA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AIT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,CAAA;;4FAEU,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAT5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE;;;;AAIT,EAAA,CAAA;AACF,iBAAA;;sBAoBE,YAAY;uBAAC,YAAY;;sBAWzB,YAAY;uBAAC,YAAY;;;AC9D5B;;AAEG;;;;"}
1
+ {"version":3,"file":"shirkasoft-ui-components-tooltip.mjs","sources":["../../../projects/ui-components/tooltip/tooltip.component.ts","../../../projects/ui-components/tooltip/shirkasoft-ui-components-tooltip.ts"],"sourcesContent":["import {\n Component,\n input,\n ElementRef,\n inject,\n HostListener,\n OnDestroy,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\nconst TOOLTIP_Z_INDEX = '2147483647';\n\n/**\n * Shirkasoft UI Components.\n * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).\n * Belongs to Shirkasoft.\n */\n\n/**\n * Tooltip rendered in `document.body` with `position: fixed`, so it always\n * floats above any container (tables with `overflow: hidden`, modals, scroll\n * wrappers, etc.) and never gets clipped or hidden behind its anchor element.\n */\n@Component({\n selector: 'shk-tooltip',\n standalone: true,\n template: `\n <div class=\"shk-tooltip-trigger inline-flex\">\n <ng-content></ng-content>\n </div>\n `,\n})\nexport class TooltipComponent implements OnDestroy {\n /** Content of the tooltip. */\n readonly text = input<string>('');\n /** Preferred placement relative to the trigger. */\n readonly position = input<'top' | 'bottom' | 'right'>('bottom');\n /** 'hover' shows on mouse enter; 'fixed' stays pinned to the content. */\n readonly mode = input<'hover' | 'fixed'>('hover');\n /** Distance (px) between the tooltip and the trigger. */\n readonly offset = input(8);\n\n private readonly host = inject(ElementRef<HTMLElement>);\n private readonly document = inject(DOCUMENT);\n\n /** The dynamically created tooltip element. */\n private tooltipEl: HTMLElement | null = null;\n /** Unsubscribe callbacks for the scroll/resize listeners. */\n private cleanup: (() => void) | null = null;\n\n /** Shows the tooltip over the host trigger on mouseenter. */\n @HostListener('mouseenter')\n onMouseEnter(): void {\n this.open();\n }\n\n /** Hides the tooltip on mouseleave. */\n @HostListener('mouseleave')\n onMouseLeave(): void {\n this.hide();\n }\n\n /** Also opens on keyboard focus, so icon-only triggers are readable. */\n @HostListener('focusin')\n onFocusIn(): void {\n this.open();\n }\n\n /** Closes when the focus leaves the trigger. */\n @HostListener('focusout')\n onFocusOut(): void {\n this.hide();\n }\n\n /** Opens the tooltip when there is text to show. */\n private open(): void {\n if (!this.text()) return;\n const trigger = this.host.nativeElement.querySelector(\n '.shk-tooltip-trigger',\n ) as HTMLElement | null;\n if (!trigger) return;\n this.show(trigger);\n }\n\n /** Creates and positions the tooltip element on `document.body`. */\n private show(trigger: HTMLElement): void {\n this.removeTooltip();\n\n const el = this.document.createElement('span');\n el.className = 'shk-tooltip-dynamic';\n el.textContent = this.text();\n Object.assign(el.style, {\n position: 'fixed',\n zIndex: TOOLTIP_Z_INDEX,\n backgroundColor: 'var(--shk-tooltip-bg, #27272a)',\n color: 'var(--shk-tooltip-text, #fff)',\n padding: '4px 8px',\n borderRadius: '6px',\n fontSize: '12px',\n lineHeight: '1.4',\n whiteSpace: 'pre-line',\n maxWidth: 'min(80vw, 22rem)',\n boxShadow:\n '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',\n pointerEvents: 'none',\n opacity: '0',\n transition: 'opacity 0.15s ease',\n });\n\n this.document.body.appendChild(el);\n this.tooltipEl = el;\n\n const place = () => {\n const rect = trigger.getBoundingClientRect();\n const w = el.offsetWidth;\n const h = el.offsetHeight;\n const { left, top } = this.computePosition(rect, w, h);\n el.style.left = `${left}px`;\n el.style.top = `${top}px`;\n };\n\n place();\n requestAnimationFrame(() => {\n if (this.tooltipEl === el) {\n el.style.opacity = '1';\n }\n });\n\n const onScrollOrResize = () => place();\n window.addEventListener('scroll', onScrollOrResize, true);\n window.addEventListener('resize', onScrollOrResize);\n this.cleanup = () => {\n window.removeEventListener('scroll', onScrollOrResize, true);\n window.removeEventListener('resize', onScrollOrResize);\n };\n }\n\n /** Computes the tooltip position, clamped to the viewport. */\n private computePosition(\n rect: DOMRect,\n width: number,\n height: number,\n ): { left: number; top: number } {\n const off = this.offset();\n const viewportW = this.document.defaultView?.innerWidth ?? 0;\n const viewportH = this.document.defaultView?.innerHeight ?? 0;\n\n let x: number;\n let y: number;\n\n if (this.position() === 'right') {\n x = rect.right + off;\n y = rect.top + rect.height / 2 - height / 2;\n } else if (this.position() === 'bottom') {\n x = rect.left + rect.width / 2 - width / 2;\n y = rect.bottom + off;\n } else {\n x = rect.left + rect.width / 2 - width / 2;\n y = rect.top - off - height;\n }\n\n const margin = 4;\n const left = Math.max(\n margin,\n Math.min(x, Math.max(margin, viewportW - width - margin)),\n );\n const top = Math.max(\n margin,\n Math.min(y, Math.max(margin, viewportH - height - margin)),\n );\n return { left, top };\n }\n\n /** Fades the tooltip out and removes it from the DOM. */\n private hide(): void {\n if (!this.tooltipEl) return;\n const el = this.tooltipEl;\n el.style.opacity = '0';\n this.tooltipEl = null;\n setTimeout(() => {\n el.remove();\n }, 150);\n }\n\n /** Removes the tooltip and its listeners. */\n private removeTooltip(): void {\n this.cleanup?.();\n this.cleanup = null;\n this.tooltipEl?.remove();\n this.tooltipEl = null;\n }\n\n /** Cleans up the tooltip on component destroy. */\n ngOnDestroy(): void {\n this.removeTooltip();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAUA,MAAM,eAAe,GAAG,YAAY;AAEpC;;;;AAIG;AAEH;;;;AAIG;MAUU,gBAAgB,CAAA;AAT7B,IAAA,WAAA,GAAA;;AAWW,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE,2EAAC;;AAExB,QAAA,IAAA,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uBAAC,SAAS;;sBAMtB,YAAY;uBAAC,UAAU;;;ACrE1B;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shirkasoft-ui-components",
3
- "version": "1.3.15",
3
+ "version": "1.13.16",
4
4
  "description": "Angular UI Components Library — themeable via CSS custom properties",
5
5
  "keywords": [
6
6
  "angular",
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { LucideFunnelX, LucideCircleCheck, LucideCircleX, LucideTrash2, LucideCircleAlert } from '@lucide/angular';
2
+ import { LucideFunnelX, LucideCircleCheck, LucideCircleX, LucideTrash2, LucideInfo, LucideTriangleAlert, LucideOctagonAlert } from '@lucide/angular';
3
3
  import { TagSeverity } from 'shirkasoft-ui-components/tag';
4
4
 
5
5
  /** Match modes available in the column filter menu. */
@@ -75,22 +75,6 @@ interface Column {
75
75
  * - `date` (uses `dateFormat`) · `currency` (uses `currency`)
76
76
  */
77
77
  template?: 'text' | 'tag' | 'progress' | 'boolean' | 'date' | 'currency';
78
- /**
79
- * Marks the field as mandatory: with the table's `validateRequired`, rows
80
- * where it is empty are flagged and the cell shows "Falta <header>".
81
- * Pass a function to make it conditional per row/payload, e.g.
82
- * `(row) => row.tipo === 'empresa'` (only mandatory for companies).
83
- */
84
- required?: boolean | ((row: any) => boolean);
85
- /** Text shown in an empty required cell (default "Falta <header>"). */
86
- missingMessage?: string;
87
- /**
88
- * How a missing value of this column is shown: `'error'` (red, mandatory)
89
- * or `'warning'` (amber, informative). Defaults to the table's `missingAsError`.
90
- */
91
- missingSeverity?: MissingSeverity;
92
- /** Custom rule to decide whether the value is missing (default: empty value). */
93
- isMissing?: (row: any) => boolean;
94
78
  /** Angular date format for `template: 'date'` (default `'dd/MM/yyyy'`). */
95
79
  dateFormat?: string;
96
80
  /** ISO currency code for `template: 'currency'` (default `'USD'`). */
@@ -146,23 +130,38 @@ interface FilterChangeEvent {
146
130
  [key: string]: ColumnFilterState;
147
131
  };
148
132
  }
149
- /** Severity of a missing value: mandatory (error) or informative (warning). */
150
- type MissingSeverity = 'error' | 'warning';
151
- /** A missing field reported by `validateRow`. */
152
- interface MissingField {
153
- field: string;
154
- header: string;
155
- severity: MissingSeverity;
133
+ /** Severity of a row problem: informational (blue), warning (amber) or blocking (red). */
134
+ type RowSeverity = 'low' | 'moderate' | 'critical';
135
+ /**
136
+ * Rule applied to one field of the payload. The key of the
137
+ * `rowValidations` map is the field (dot paths allowed), so the rule only
138
+ * needs to say when the value is a problem and how severe it is.
139
+ */
140
+ interface RowValidation {
141
+ /**
142
+ * Condition over the field value and the whole row. Return `true` when the
143
+ * row has a problem in that field.
144
+ *
145
+ * @example (value) => value == null || Number(value) <= 0
146
+ * @example (value, row) => !row.factura_id && !value
147
+ */
148
+ condition: (value: any, row: any) => boolean;
149
+ /** Color of the row: `low` blue, `moderate` amber, `critical` red. The worst one wins. */
150
+ severity: RowSeverity;
151
+ /**
152
+ * Message of the violation: a translation key (Transloco) or literal text.
153
+ * When the key isn't translated, the literal is used as is.
154
+ */
155
+ message?: string;
156
+ /** Values interpolated into `message` (`{{name}}`), resolved per row. */
157
+ messageParams?: (value: any, row: any) => Record<string, unknown>;
156
158
  }
157
- /** A required column, as checked by the validation. */
158
- interface MissingRequirement {
159
+ /** A violation found by `rowValidations`, with its message already translated. */
160
+ interface RowViolation {
161
+ /** Field of the payload that failed (the key of `rowValidations`). */
159
162
  field: string;
160
- header: string;
161
- /** `true`, or a condition deciding whether the field is mandatory for a row. */
162
- required: true | ((row: any) => boolean);
163
- isMissing?: (row: any) => boolean;
164
- /** The required column. */
165
- column: Column;
163
+ severity: RowSeverity;
164
+ message?: string;
166
165
  }
167
166
  /** Internal filter kind (`exact` is a `text` filter). */
168
167
  type FilterKind = 'text' | 'numeric' | 'date' | 'select' | 'multiselect' | 'boolean' | 'range';
@@ -186,7 +185,9 @@ declare class TableComponent {
186
185
  yes: typeof LucideCircleCheck;
187
186
  no: typeof LucideCircleX;
188
187
  trash: typeof LucideTrash2;
189
- error: typeof LucideCircleAlert;
188
+ low: typeof LucideInfo;
189
+ moderate: typeof LucideTriangleAlert;
190
+ critical: typeof LucideOctagonAlert;
190
191
  };
191
192
  /**
192
193
  * Minimum width applied to each column (except `actions`, which keeps its
@@ -259,15 +260,12 @@ declare class TableComponent {
259
260
  */
260
261
  resizableColumns: _angular_core.InputSignal<boolean>;
261
262
  /**
262
- * Highlights the rows where a `required` column is empty (red for errors,
263
- * amber for warnings) and writes "Falta <header>" in the empty cell.
263
+ * Rules to flag rows with problems, keyed by field of the payload. Each rule
264
+ * applies a condition to the value of that field and paints the whole row:
265
+ * `low` blue, `moderate` amber, `critical` red. When a row has several
266
+ * issues the worst severity wins. See `RowValidation`.
264
267
  */
265
- validateRequired: _angular_core.InputSignal<boolean>;
266
- /**
267
- * Default severity of missing cells: errors (red) when true, warnings
268
- * (amber) when false. Each column can override it with `missingSeverity`.
269
- */
270
- missingAsError: _angular_core.InputSignal<boolean>;
268
+ rowValidations: _angular_core.InputSignal<Record<string, RowValidation>>;
271
269
  /**
272
270
  * Column widths (px) keyed by field. Two-way bindable via
273
271
  * `[(columnWidths)]` to restore/save them yourself.
@@ -374,39 +372,33 @@ declare class TableComponent {
374
372
  visibleBulkActions: _angular_core.Signal<BulkAction[]>;
375
373
  /** Number of rendered columns, including the selection column. */
376
374
  totalColspan: _angular_core.Signal<number>;
377
- /** Every `required` column, active or not. */
378
- private allRequirements;
379
- /** Requirements checked on screen (empty when `validateRequired` is off). */
380
- private activeRequirements;
381
- /** Whether a value counts as missing: null, undefined, blank text or empty array. */
382
- private isEmptyValue;
383
- /**
384
- * Whether the requirement fails for a row: its condition (when `required`
385
- * is a function) must apply, and then the value must be missing.
386
- */
387
- private requirementMissing;
388
- /** Missing requirements of each displayed row (cached per render). */
389
- private missingByRow;
390
- /** Required columns that are empty in the row. */
391
- missingFields(row: any): MissingRequirement[];
392
- /** Whether a cell is a required column without value. */
393
- isCellMissing(col: Column, row: any): boolean;
375
+ /** Rank used to pick the worst severity of a row. */
376
+ private readonly severityRank;
377
+ /** Violations of each displayed row (cached per render, re-evaluated on i18n changes). */
378
+ private violationsByRow;
379
+ /** Evaluates the rules against a row and returns its violations (messages already translated). */
380
+ private collectViolations;
381
+ /** Message of a rule: translated when `message` is a registered key, literal otherwise. */
382
+ private resolveViolationMessage;
383
+ /** Violations of a row (empty when it has no issues). */
384
+ rowViolationsOf(row: any): RowViolation[];
394
385
  /**
395
- * Checks an object (e.g. the payload returned by a modal) against the
396
- * `required` columns, returning the ones it's missing (empty = complete). Works even when `validateRequired` is off, so it can
397
- * be used before adding the row.
386
+ * Highest severity of a row: `'critical'` > `'moderate'` > `'low'`, or `null`
387
+ * when the row has no issues.
398
388
  */
399
- validateRow(row: any): MissingField[];
389
+ rowSeverity(row: any): RowSeverity | null;
400
390
  /**
401
- * Severity of a row: `'error'` when a mandatory (error) field is missing,
402
- * `'warning'` when only informative fields are missing, `null` when complete.
391
+ * Checks any object (e.g. the payload of a modal) against `rowValidations`,
392
+ * returning its violations (empty = no issues). The row doesn't need to be
393
+ * displayed, so it can be used before adding it.
403
394
  */
404
- rowSeverity(row: any): MissingSeverity | null;
405
- /** Severity of a column's missing value (its own, or the table default). */
406
- severityOf(col: Column): MissingSeverity;
407
- /** Icon of a missing cell: error circle or warning triangle. */
408
- protected missingIconFor(col: Column): any;
409
- protected missingCellMessage(col: Column): string;
395
+ validateRow(row: any): RowViolation[];
396
+ /** Tooltip of a row: its violation messages, one per line. */
397
+ protected rowValidationTitle(row: any): string | null;
398
+ /** Icon of the severity indicator shown in the actions cell. */
399
+ protected rowValidationIcon(row: any): any;
400
+ /** Accessible label of the severity indicator (the messages, or the severity). */
401
+ protected rowValidationLabel(row: any): string;
410
402
  /** Total records: server-provided in server mode, locally computed otherwise. */
411
403
  effectiveTotalRecords: _angular_core.Signal<number>;
412
404
  /**
@@ -699,8 +691,8 @@ declare class TableComponent {
699
691
  /** Closes the column filter menu with Escape. */
700
692
  onEscape(): void;
701
693
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TableComponent, never>;
702
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TableComponent, "shk-table", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "rowsPerPage": { "alias": "rowsPerPage"; "required": false; "isSignal": true; }; "rowsPerPageOptions": { "alias": "rowsPerPageOptions"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "showActionRow": { "alias": "showActionRow"; "required": false; "isSignal": true; }; "customTemplates": { "alias": "customTemplates"; "required": false; "isSignal": true; }; "headerActions": { "alias": "headerActions"; "required": false; "isSignal": true; }; "rowActions": { "alias": "rowActions"; "required": false; "isSignal": true; }; "hasShadow": { "alias": "hasShadow"; "required": false; "isSignal": true; }; "defaultSortField": { "alias": "defaultSortField"; "required": false; "isSignal": true; }; "defaultSortOrder": { "alias": "defaultSortOrder"; "required": false; "isSignal": true; }; "showSearch": { "alias": "showSearch"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "globalFilterFields": { "alias": "globalFilterFields"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "serverSide": { "alias": "serverSide"; "required": false; "isSignal": true; }; "totalRecords": { "alias": "totalRecords"; "required": false; "isSignal": true; }; "filters": { "alias": "filters"; "required": false; "isSignal": true; }; "activeFilter": { "alias": "activeFilter"; "required": false; "isSignal": true; }; "showGridlines": { "alias": "showGridlines"; "required": false; "isSignal": true; }; "resizableColumns": { "alias": "resizableColumns"; "required": false; "isSignal": true; }; "validateRequired": { "alias": "validateRequired"; "required": false; "isSignal": true; }; "missingAsError": { "alias": "missingAsError"; "required": false; "isSignal": true; }; "columnWidths": { "alias": "columnWidths"; "required": false; "isSignal": true; }; "stateKey": { "alias": "stateKey"; "required": false; "isSignal": true; }; "stateStorage": { "alias": "stateStorage"; "required": false; "isSignal": true; }; "rowHover": { "alias": "rowHover"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "showPageReport": { "alias": "showPageReport"; "required": false; "isSignal": true; }; "showRowsPerPage": { "alias": "showRowsPerPage"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "isRowSelectable": { "alias": "isRowSelectable"; "required": false; "isSignal": true; }; "bulkActions": { "alias": "bulkActions"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; }, { "columnWidths": "columnWidthsChange"; "selection": "selectionChange"; "refresh": "refresh"; "pageChange": "pageChange"; "filterChange": "filterChange"; "searchChange": "searchChange"; "filterClick": "filterClick"; "columnResize": "columnResize"; }, never, never, true, never>;
694
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TableComponent, "shk-table", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "rowsPerPage": { "alias": "rowsPerPage"; "required": false; "isSignal": true; }; "rowsPerPageOptions": { "alias": "rowsPerPageOptions"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "showActionRow": { "alias": "showActionRow"; "required": false; "isSignal": true; }; "customTemplates": { "alias": "customTemplates"; "required": false; "isSignal": true; }; "headerActions": { "alias": "headerActions"; "required": false; "isSignal": true; }; "rowActions": { "alias": "rowActions"; "required": false; "isSignal": true; }; "hasShadow": { "alias": "hasShadow"; "required": false; "isSignal": true; }; "defaultSortField": { "alias": "defaultSortField"; "required": false; "isSignal": true; }; "defaultSortOrder": { "alias": "defaultSortOrder"; "required": false; "isSignal": true; }; "showSearch": { "alias": "showSearch"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "globalFilterFields": { "alias": "globalFilterFields"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "serverSide": { "alias": "serverSide"; "required": false; "isSignal": true; }; "totalRecords": { "alias": "totalRecords"; "required": false; "isSignal": true; }; "filters": { "alias": "filters"; "required": false; "isSignal": true; }; "activeFilter": { "alias": "activeFilter"; "required": false; "isSignal": true; }; "showGridlines": { "alias": "showGridlines"; "required": false; "isSignal": true; }; "resizableColumns": { "alias": "resizableColumns"; "required": false; "isSignal": true; }; "rowValidations": { "alias": "rowValidations"; "required": false; "isSignal": true; }; "columnWidths": { "alias": "columnWidths"; "required": false; "isSignal": true; }; "stateKey": { "alias": "stateKey"; "required": false; "isSignal": true; }; "stateStorage": { "alias": "stateStorage"; "required": false; "isSignal": true; }; "rowHover": { "alias": "rowHover"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "showPageReport": { "alias": "showPageReport"; "required": false; "isSignal": true; }; "showRowsPerPage": { "alias": "showRowsPerPage"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "dataKey": { "alias": "dataKey"; "required": false; "isSignal": true; }; "isRowSelectable": { "alias": "isRowSelectable"; "required": false; "isSignal": true; }; "bulkActions": { "alias": "bulkActions"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; }, { "columnWidths": "columnWidthsChange"; "selection": "selectionChange"; "refresh": "refresh"; "pageChange": "pageChange"; "filterChange": "filterChange"; "searchChange": "searchChange"; "filterClick": "filterClick"; "columnResize": "columnResize"; }, never, never, true, never>;
703
695
  }
704
696
 
705
697
  export { TableComponent };
706
- export type { BulkAction, Column, ColumnFilterState, ColumnFilterType, FilterChangeEvent, FilterMatchMode, FilterOperator, FilterOption, FilterRule, MissingField, MissingRequirement, MissingSeverity, PageChangeEvent, RowAction, TableAction };
698
+ export type { BulkAction, Column, ColumnFilterState, ColumnFilterType, FilterChangeEvent, FilterMatchMode, FilterOperator, FilterOption, FilterRule, PageChangeEvent, RowAction, RowSeverity, RowValidation, RowViolation, TableAction };
@@ -30,6 +30,12 @@ declare class TooltipComponent implements OnDestroy {
30
30
  onMouseEnter(): void;
31
31
  /** Hides the tooltip on mouseleave. */
32
32
  onMouseLeave(): void;
33
+ /** Also opens on keyboard focus, so icon-only triggers are readable. */
34
+ onFocusIn(): void;
35
+ /** Closes when the focus leaves the trigger. */
36
+ onFocusOut(): void;
37
+ /** Opens the tooltip when there is text to show. */
38
+ private open;
33
39
  /** Creates and positions the tooltip element on `document.body`. */
34
40
  private show;
35
41
  /** Computes the tooltip position, clamped to the viewport. */