codexly-ui 0.15.15 → 0.16.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.
@@ -137,17 +137,8 @@ class ClxChartComponent {
137
137
  this._chart.update();
138
138
  }
139
139
  }, { injector: this._injector });
140
- // Chart.js sizes its canvas backing store from the container's getBoundingClientRect() at the
141
- // moment it's created — but inside a flex/grid ancestor (e.g. the dashboard's CDK drag-drop
142
- // grid) that layout can still be settling on the frame this component mounts, so the chart can
143
- // capture a stale size (seen in practice: a container CSS-fixed at 120px tall, but the canvas's
144
- // own width/height backing-store attrs frozen at a stale 180px from that first read) and never
145
- // self-correct, because a ResizeObserver alone only fires on a SUBSEQUENT size change — a
146
- // container that was wrong from its very first paint and then never changes size again never
147
- // fires one. So force one resize() a frame after creation (by which point the browser has
148
- // finished the layout pass) to re-read the real size once, in addition to the observer that
149
- // keeps it in sync for any later resize (grid edit, window resize, etc).
150
- requestAnimationFrame(() => this._chart?.resize());
140
+ // Keeps the canvas's backing store in sync whenever its container actually changes size later
141
+ // (grid edit, window resize, sidebar toggle) — Chart.js doesn't watch this on its own.
151
142
  const container = this.canvasRef.nativeElement.parentElement;
152
143
  if (container && typeof ResizeObserver !== 'undefined') {
153
144
  this._resizeObserver = new ResizeObserver(() => this._chart?.resize());
@@ -1 +1 @@
1
- {"version":3,"file":"codexly-ui-charts.mjs","sources":["../../../projects/codexly-ui/charts/lib/chart.config.ts","../../../projects/codexly-ui/charts/lib/clx-chart.component.ts","../../../projects/codexly-ui/charts/codexly-ui-charts.ts"],"sourcesContent":["import type { ChartData, ChartOptions, ChartType } from 'chart.js';\nimport { CLX_COLOR_HEX } from 'codexly-ui';\n\nexport const CLX_CHART_DEFAULTS_NO_SCALES: ChartOptions = {\n responsive: true,\n maintainAspectRatio: false,\n font: {\n family: 'Roboto, ui-sans-serif, system-ui, -apple-system, sans-serif',\n size: 12,\n },\n plugins: {\n legend: { display: true, position: 'top', align: 'center' },\n tooltip: { enabled: true },\n },\n} as ChartOptions;\n\nexport const CLX_CHART_DEFAULTS: ChartOptions = {\n responsive: true,\n maintainAspectRatio: false,\n font: {\n family: 'Roboto, ui-sans-serif, system-ui, -apple-system, sans-serif',\n size: 12,\n },\n plugins: {\n legend: {\n display: true,\n position: 'top',\n align: 'center'\n },\n tooltip: {\n enabled: true\n },\n },\n scales: {\n x: { \n display: true,\n grid: {\n display: false\n },\n border: {\n color: CLX_COLOR_HEX.slate100\n },\n ticks: {\n color: CLX_COLOR_HEX.slate400\n }\n },\n y: {\n display: true,\n beginAtZero: true,\n grid: {\n display: true,\n color: CLX_COLOR_HEX.slate100\n },\n border: {\n color: CLX_COLOR_HEX.slate100\n },\n ticks: {\n color: CLX_COLOR_HEX.slate400\n }\n },\n },\n} as ChartOptions;\n\nexport const CLX_CHART_PALETTE: string[] = Object.values(CLX_COLOR_HEX);\n\n/** Versiones con opacidad 20% para backgrounds de áreas/barras */\nexport const CLX_CHART_PALETTE_ALPHA: string[] = CLX_CHART_PALETTE.map(hex => `${hex}33`);\n\nconst AREA_TYPES: ChartType[] = ['line', 'radar'];\nconst MULTI_SLICE_TYPES: ChartType[] = ['pie', 'doughnut', 'polarArea'];\n\nfunction shuffled(arr: string[]): string[] {\n const a = [...arr];\n for (let i = a.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [a[i], a[j]] = [a[j], a[i]];\n }\n return a;\n}\n\nexport function applyChartDefaults(type: ChartType, data: ChartData): ChartData {\n const palette = shuffled(CLX_CHART_PALETTE);\n const paletteAlpha = palette.map(hex => `${hex}33`);\n const datasets = data.datasets.map((ds, i) => {\n const color = palette[i % palette.length];\n const alpha = paletteAlpha[i % paletteAlpha.length];\n\n if (MULTI_SLICE_TYPES.includes(type)) {\n const count = (ds.data as number[]).length;\n return {\n ...ds,\n backgroundColor: ds.backgroundColor ?? Array.from({ length: count }, (_, j) =>\n palette[j % palette.length]\n ),\n borderColor: ds.borderColor ?? '#fff',\n borderWidth: (ds as any).borderWidth ?? 2,\n };\n }\n\n if (AREA_TYPES.includes(type)) {\n return {\n ...ds,\n borderColor: ds.borderColor ?? color,\n backgroundColor: ds.backgroundColor ?? alpha,\n pointBackgroundColor: (ds as any).pointBackgroundColor ?? color,\n fill: (ds as any).fill ?? (type === 'line' ? false : true),\n tension: (ds as any).tension ?? 0.4,\n };\n }\n\n return {\n ...ds,\n backgroundColor: ds.backgroundColor ?? color,\n borderColor: ds.borderColor ?? color,\n borderWidth: (ds as any).borderWidth ?? 0,\n barPercentage: (ds as any).barPercentage ?? 0.5,\n categoryPercentage: (ds as any).categoryPercentage ?? 0.6,\n };\n });\n\n return { ...data, datasets } as ChartData;\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n Injector,\n input,\n OnDestroy,\n untracked,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport {\n Chart,\n LineController,\n BarController,\n PieController,\n DoughnutController,\n RadarController,\n PolarAreaController,\n CategoryScale,\n LinearScale,\n RadialLinearScale,\n BarElement,\n LineElement,\n PointElement,\n ArcElement,\n Filler,\n Tooltip,\n Legend,\n type ChartData,\n type ChartOptions,\n} from 'chart.js';\n\nimport { applyChartDefaults, CLX_CHART_DEFAULTS, CLX_CHART_DEFAULTS_NO_SCALES } from './chart.config';\nimport type { ClxChartType } from './clx-chart.types';\n\nChart.register(\n LineController, BarController, PieController,\n DoughnutController, RadarController, PolarAreaController,\n CategoryScale, LinearScale, RadialLinearScale,\n BarElement, LineElement, PointElement, ArcElement,\n Filler, Tooltip, Legend,\n);\n\nconst NO_SCALE_TYPES = ['doughnut', 'pie', 'polarArea'];\n\n@Component({\n selector: 'clx-chart',\n standalone: true,\n template: `\n <div class=\"clx-chart-container\" [style.height]=\"_hostHeight()\" [class.clx-loading]=\"loading()\">\n <canvas #canvas role=\"img\" [attr.aria-label]=\"ariaLabel() || 'Chart'\"></canvas>\n \n @if (loading()) {\n <div class=\"clx-chart-loader\">\n <div class=\"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-500\"></div>\n </div>\n }\n </div>\n `,\n styles: [`\n :host { display: block; width: 100%; }\n .clx-chart-container { position: relative; width: 100%; }\n canvas { display: block; width: 100% !important; }\n \n .clx-chart-loader {\n position: absolute;\n inset: 0;\n background: rgba(255, 255, 255, 0.6);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10;\n backdrop-filter: blur(2px);\n }\n `],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ClxChartComponent implements AfterViewInit, OnDestroy {\n @ViewChild('canvas') canvasRef!: ElementRef<HTMLCanvasElement>;\n\n type = input.required<ClxChartType>();\n data = input.required<ChartData>();\n options = input<ChartOptions>({});\n height = input<number | string>(300);\n ariaLabel = input<string>();\n\n // SOLUCIÓN AL ERROR: Añadimos el input loading\n loading = input<boolean>(false);\n\n private _chart?: Chart;\n private _injector = inject(Injector);\n private _resizeObserver?: ResizeObserver;\n\n _hostHeight = computed(() =>\n typeof this.height() === 'number' ? `${this.height()}px` : this.height()\n );\n\n ngAfterViewInit(): void {\n this._createChart();\n\n effect(() => {\n const currentType = this.type();\n const currentData = this.data();\n\n if (this._chart) {\n (this._chart.config as any).type = currentType;\n this._chart.data = applyChartDefaults(currentType, currentData);\n this._chart.update();\n }\n }, { injector: this._injector });\n\n // Chart.js sizes its canvas backing store from the container's getBoundingClientRect() at the\n // moment it's created — but inside a flex/grid ancestor (e.g. the dashboard's CDK drag-drop\n // grid) that layout can still be settling on the frame this component mounts, so the chart can\n // capture a stale size (seen in practice: a container CSS-fixed at 120px tall, but the canvas's\n // own width/height backing-store attrs frozen at a stale 180px from that first read) and never\n // self-correct, because a ResizeObserver alone only fires on a SUBSEQUENT size change — a\n // container that was wrong from its very first paint and then never changes size again never\n // fires one. So force one resize() a frame after creation (by which point the browser has\n // finished the layout pass) to re-read the real size once, in addition to the observer that\n // keeps it in sync for any later resize (grid edit, window resize, etc).\n requestAnimationFrame(() => this._chart?.resize());\n\n const container = this.canvasRef.nativeElement.parentElement;\n if (container && typeof ResizeObserver !== 'undefined') {\n this._resizeObserver = new ResizeObserver(() => this._chart?.resize());\n this._resizeObserver.observe(container);\n }\n }\n\n private _createChart(): void {\n const ctx = this.canvasRef.nativeElement.getContext('2d');\n if (!ctx) return;\n\n const type = untracked(() => this.type());\n this._chart = new Chart(ctx, {\n type,\n data: applyChartDefaults(type, untracked(() => this.data())),\n options: { ...(NO_SCALE_TYPES.includes(type) ? CLX_CHART_DEFAULTS_NO_SCALES : CLX_CHART_DEFAULTS), ...untracked(() => this.options()) },\n });\n }\n\n ngOnDestroy(): void {\n this._resizeObserver?.disconnect();\n this._chart?.destroy();\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAGO,MAAM,4BAA4B,GAAiB;AACxD,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,mBAAmB,EAAE,KAAK;AAC1B,IAAA,IAAI,EAAE;AACJ,QAAA,MAAM,EAAE,6DAA6D;AACrE,QAAA,IAAI,EAAE,EAAE;AACT,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,MAAM,EAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE;AAC5D,QAAA,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC3B,KAAA;CACc;AAEV,MAAM,kBAAkB,GAAiB;AAC9C,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,mBAAmB,EAAE,KAAK;AAC1B,IAAA,IAAI,EAAE;AACJ,QAAA,MAAM,EAAE,6DAA6D;AACrE,QAAA,IAAI,EAAE,EAAE;AACT,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,MAAM,EAAE;AACN,YAAA,OAAO,EAAE,IAAI;AACb,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,KAA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A,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;4FAoBU,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAjC7B,SAAS;+BACE,WAAW,EAAA,UAAA,EACT,IAAI,EAAA,QAAA,EACN;;;;;;;;;;AAUT,EAAA,CAAA,EAAA,aAAA,EAiBc,iBAAiB,CAAC,IAAI,EAAA,eAAA,EACpB,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,0TAAA,CAAA,EAAA;;sBAG9C,SAAS;uBAAC,QAAQ;;;ACrFrB;;AAEG;;;;"}
1
+ {"version":3,"file":"codexly-ui-charts.mjs","sources":["../../../projects/codexly-ui/charts/lib/chart.config.ts","../../../projects/codexly-ui/charts/lib/clx-chart.component.ts","../../../projects/codexly-ui/charts/codexly-ui-charts.ts"],"sourcesContent":["import type { ChartData, ChartOptions, ChartType } from 'chart.js';\nimport { CLX_COLOR_HEX } from 'codexly-ui';\n\nexport const CLX_CHART_DEFAULTS_NO_SCALES: ChartOptions = {\n responsive: true,\n maintainAspectRatio: false,\n font: {\n family: 'Roboto, ui-sans-serif, system-ui, -apple-system, sans-serif',\n size: 12,\n },\n plugins: {\n legend: { display: true, position: 'top', align: 'center' },\n tooltip: { enabled: true },\n },\n} as ChartOptions;\n\nexport const CLX_CHART_DEFAULTS: ChartOptions = {\n responsive: true,\n maintainAspectRatio: false,\n font: {\n family: 'Roboto, ui-sans-serif, system-ui, -apple-system, sans-serif',\n size: 12,\n },\n plugins: {\n legend: {\n display: true,\n position: 'top',\n align: 'center'\n },\n tooltip: {\n enabled: true\n },\n },\n scales: {\n x: { \n display: true,\n grid: {\n display: false\n },\n border: {\n color: CLX_COLOR_HEX.slate100\n },\n ticks: {\n color: CLX_COLOR_HEX.slate400\n }\n },\n y: {\n display: true,\n beginAtZero: true,\n grid: {\n display: true,\n color: CLX_COLOR_HEX.slate100\n },\n border: {\n color: CLX_COLOR_HEX.slate100\n },\n ticks: {\n color: CLX_COLOR_HEX.slate400\n }\n },\n },\n} as ChartOptions;\n\nexport const CLX_CHART_PALETTE: string[] = Object.values(CLX_COLOR_HEX);\n\n/** Versiones con opacidad 20% para backgrounds de áreas/barras */\nexport const CLX_CHART_PALETTE_ALPHA: string[] = CLX_CHART_PALETTE.map(hex => `${hex}33`);\n\nconst AREA_TYPES: ChartType[] = ['line', 'radar'];\nconst MULTI_SLICE_TYPES: ChartType[] = ['pie', 'doughnut', 'polarArea'];\n\nfunction shuffled(arr: string[]): string[] {\n const a = [...arr];\n for (let i = a.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [a[i], a[j]] = [a[j], a[i]];\n }\n return a;\n}\n\nexport function applyChartDefaults(type: ChartType, data: ChartData): ChartData {\n const palette = shuffled(CLX_CHART_PALETTE);\n const paletteAlpha = palette.map(hex => `${hex}33`);\n const datasets = data.datasets.map((ds, i) => {\n const color = palette[i % palette.length];\n const alpha = paletteAlpha[i % paletteAlpha.length];\n\n if (MULTI_SLICE_TYPES.includes(type)) {\n const count = (ds.data as number[]).length;\n return {\n ...ds,\n backgroundColor: ds.backgroundColor ?? Array.from({ length: count }, (_, j) =>\n palette[j % palette.length]\n ),\n borderColor: ds.borderColor ?? '#fff',\n borderWidth: (ds as any).borderWidth ?? 2,\n };\n }\n\n if (AREA_TYPES.includes(type)) {\n return {\n ...ds,\n borderColor: ds.borderColor ?? color,\n backgroundColor: ds.backgroundColor ?? alpha,\n pointBackgroundColor: (ds as any).pointBackgroundColor ?? color,\n fill: (ds as any).fill ?? (type === 'line' ? false : true),\n tension: (ds as any).tension ?? 0.4,\n };\n }\n\n return {\n ...ds,\n backgroundColor: ds.backgroundColor ?? color,\n borderColor: ds.borderColor ?? color,\n borderWidth: (ds as any).borderWidth ?? 0,\n barPercentage: (ds as any).barPercentage ?? 0.5,\n categoryPercentage: (ds as any).categoryPercentage ?? 0.6,\n };\n });\n\n return { ...data, datasets } as ChartData;\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n Injector,\n input,\n OnDestroy,\n untracked,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport {\n Chart,\n LineController,\n BarController,\n PieController,\n DoughnutController,\n RadarController,\n PolarAreaController,\n CategoryScale,\n LinearScale,\n RadialLinearScale,\n BarElement,\n LineElement,\n PointElement,\n ArcElement,\n Filler,\n Tooltip,\n Legend,\n type ChartData,\n type ChartOptions,\n} from 'chart.js';\n\nimport { applyChartDefaults, CLX_CHART_DEFAULTS, CLX_CHART_DEFAULTS_NO_SCALES } from './chart.config';\nimport type { ClxChartType } from './clx-chart.types';\n\nChart.register(\n LineController, BarController, PieController,\n DoughnutController, RadarController, PolarAreaController,\n CategoryScale, LinearScale, RadialLinearScale,\n BarElement, LineElement, PointElement, ArcElement,\n Filler, Tooltip, Legend,\n);\n\nconst NO_SCALE_TYPES = ['doughnut', 'pie', 'polarArea'];\n\n@Component({\n selector: 'clx-chart',\n standalone: true,\n template: `\n <div class=\"clx-chart-container\" [style.height]=\"_hostHeight()\" [class.clx-loading]=\"loading()\">\n <canvas #canvas role=\"img\" [attr.aria-label]=\"ariaLabel() || 'Chart'\"></canvas>\n \n @if (loading()) {\n <div class=\"clx-chart-loader\">\n <div class=\"animate-spin rounded-full h-8 w-8 border-b-2 border-indigo-500\"></div>\n </div>\n }\n </div>\n `,\n styles: [`\n :host { display: block; width: 100%; }\n .clx-chart-container { position: relative; width: 100%; }\n canvas { display: block; width: 100% !important; }\n \n .clx-chart-loader {\n position: absolute;\n inset: 0;\n background: rgba(255, 255, 255, 0.6);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10;\n backdrop-filter: blur(2px);\n }\n `],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ClxChartComponent implements AfterViewInit, OnDestroy {\n @ViewChild('canvas') canvasRef!: ElementRef<HTMLCanvasElement>;\n\n type = input.required<ClxChartType>();\n data = input.required<ChartData>();\n options = input<ChartOptions>({});\n height = input<number | string>(300);\n ariaLabel = input<string>();\n\n // SOLUCIÓN AL ERROR: Añadimos el input loading\n loading = input<boolean>(false);\n\n private _chart?: Chart;\n private _injector = inject(Injector);\n private _resizeObserver?: ResizeObserver;\n\n _hostHeight = computed(() =>\n typeof this.height() === 'number' ? `${this.height()}px` : this.height()\n );\n\n ngAfterViewInit(): void {\n this._createChart();\n\n effect(() => {\n const currentType = this.type();\n const currentData = this.data();\n\n if (this._chart) {\n (this._chart.config as any).type = currentType;\n this._chart.data = applyChartDefaults(currentType, currentData);\n this._chart.update();\n }\n }, { injector: this._injector });\n\n // Keeps the canvas's backing store in sync whenever its container actually changes size later\n // (grid edit, window resize, sidebar toggle) — Chart.js doesn't watch this on its own.\n const container = this.canvasRef.nativeElement.parentElement;\n if (container && typeof ResizeObserver !== 'undefined') {\n this._resizeObserver = new ResizeObserver(() => this._chart?.resize());\n this._resizeObserver.observe(container);\n }\n }\n\n private _createChart(): void {\n const ctx = this.canvasRef.nativeElement.getContext('2d');\n if (!ctx) return;\n\n const type = untracked(() => this.type());\n this._chart = new Chart(ctx, {\n type,\n data: applyChartDefaults(type, untracked(() => this.data())),\n options: { ...(NO_SCALE_TYPES.includes(type) ? CLX_CHART_DEFAULTS_NO_SCALES : CLX_CHART_DEFAULTS), ...untracked(() => this.options()) },\n });\n }\n\n ngOnDestroy(): void {\n this._resizeObserver?.disconnect();\n this._chart?.destroy();\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAGO,MAAM,4BAA4B,GAAiB;AACxD,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,mBAAmB,EAAE,KAAK;AAC1B,IAAA,IAAI,EAAE;AACJ,QAAA,MAAM,EAAE,6DAA6D;AACrE,QAAA,IAAI,EAAE,EAAE;AACT,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,MAAM,EAAG,EAAE,OAAO,EAAE,IAAI,EAAE,Q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AAA,EAAA,EAAA,WAAA,EAAA,CAAA,EAAA,YAAA,EAAA,WAAA,EAAA,KAAA,EAAA,IAAA,EAAA,SAAA,EAAA,CAAA,QAAA,CAAA,EAAA,WAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EA9BlB;;;;;;;;;;AAUT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,0TAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;4FAoBU,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAjC7B,SAAS;+BACE,WAAW,EAAA,UAAA,EACT,IAAI,EAAA,QAAA,EACN;;;;;;;;;;AAUT,EAAA,CAAA,EAAA,aAAA,EAiBc,iBAAiB,CAAC,IAAI,EAAA,eAAA,EACpB,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,0TAAA,CAAA,EAAA;;sBAG9C,SAAS;uBAAC,QAAQ;;;ACrFrB;;AAEG;;;;"}
@@ -10,8 +10,6 @@ import * as i1 from '@angular/cdk/overlay';
10
10
  import { ScrollStrategyOptions, OverlayModule } from '@angular/cdk/overlay';
11
11
  import { ScrollingModule, CdkScrollable } from '@angular/cdk/scrolling';
12
12
  import { Router, NavigationEnd, RouterLink, RouterLinkActive } from '@angular/router';
13
- import * as i1$2 from '@angular/cdk/drag-drop';
14
- import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
15
13
 
16
14
  // ── Parse 'red' | 'red-500' → { color, shade } ───────────────────────────────
17
15
  function parseColorInput(input) {
@@ -16656,16 +16654,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
16656
16654
  * Mount it inside `<ng-template clxCell let-row>` instead of hand-building the flex row each time. */
16657
16655
  class ClxTableStatusCellComponent {
16658
16656
  label = input.required(...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
16657
+ /** Optional second line under the label (e.g. the customer's email under their name). */
16658
+ sublabel = input(null, ...(ngDevMode ? [{ debugName: "sublabel" }] : /* istanbul ignore next */ []));
16659
16659
  avatarSrc = input(null, ...(ngDevMode ? [{ debugName: "avatarSrc" }] : /* istanbul ignore next */ []));
16660
16660
  avatarInitials = input(null, ...(ngDevMode ? [{ debugName: "avatarInitials" }] : /* istanbul ignore next */ []));
16661
16661
  avatarColor = input(undefined, ...(ngDevMode ? [{ debugName: "avatarColor" }] : /* istanbul ignore next */ []));
16662
16662
  statusLabel = input.required(...(ngDevMode ? [{ debugName: "statusLabel" }] : /* istanbul ignore next */ []));
16663
16663
  statusColor = input('slate', ...(ngDevMode ? [{ debugName: "statusColor" }] : /* istanbul ignore next */ []));
16664
16664
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ClxTableStatusCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
16665
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.15", type: ClxTableStatusCellComponent, isStandalone: true, selector: "clx-table-status-cell", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, avatarSrc: { classPropertyName: "avatarSrc", publicName: "avatarSrc", isSignal: true, isRequired: false, transformFunction: null }, avatarInitials: { classPropertyName: "avatarInitials", publicName: "avatarInitials", isSignal: true, isRequired: false, transformFunction: null }, avatarColor: { classPropertyName: "avatarColor", publicName: "avatarColor", isSignal: true, isRequired: false, transformFunction: null }, statusLabel: { classPropertyName: "statusLabel", publicName: "statusLabel", isSignal: true, isRequired: true, transformFunction: null }, statusColor: { classPropertyName: "statusColor", publicName: "statusColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex items-center justify-between gap-3 w-full" }, ngImport: i0, template: `
16665
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: ClxTableStatusCellComponent, isStandalone: true, selector: "clx-table-status-cell", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, sublabel: { classPropertyName: "sublabel", publicName: "sublabel", isSignal: true, isRequired: false, transformFunction: null }, avatarSrc: { classPropertyName: "avatarSrc", publicName: "avatarSrc", isSignal: true, isRequired: false, transformFunction: null }, avatarInitials: { classPropertyName: "avatarInitials", publicName: "avatarInitials", isSignal: true, isRequired: false, transformFunction: null }, avatarColor: { classPropertyName: "avatarColor", publicName: "avatarColor", isSignal: true, isRequired: false, transformFunction: null }, statusLabel: { classPropertyName: "statusLabel", publicName: "statusLabel", isSignal: true, isRequired: true, transformFunction: null }, statusColor: { classPropertyName: "statusColor", publicName: "statusColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex items-center justify-between gap-3 w-full" }, ngImport: i0, template: `
16666
16666
  <div class="flex items-center gap-2.5 min-w-0">
16667
16667
  <clx-avatar [src]="avatarSrc()" [initials]="avatarInitials()" [color]="avatarColor()" size="xs" />
16668
- <span class="text-sm text-clx-text-label truncate">{{ label() }}</span>
16668
+ <div class="min-w-0">
16669
+ <p class="text-sm text-clx-text-label truncate">{{ label() }}</p>
16670
+ @if (sublabel()) {
16671
+ <p class="text-xs text-clx-text-muted truncate">{{ sublabel() }}</p>
16672
+ }
16673
+ </div>
16669
16674
  </div>
16670
16675
  <span clx-badge [color]="statusColor()" variant="light" shape="pill" size="xs" class="shrink-0">
16671
16676
  {{ statusLabel() }}
@@ -16684,259 +16689,146 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
16684
16689
  template: `
16685
16690
  <div class="flex items-center gap-2.5 min-w-0">
16686
16691
  <clx-avatar [src]="avatarSrc()" [initials]="avatarInitials()" [color]="avatarColor()" size="xs" />
16687
- <span class="text-sm text-clx-text-label truncate">{{ label() }}</span>
16692
+ <div class="min-w-0">
16693
+ <p class="text-sm text-clx-text-label truncate">{{ label() }}</p>
16694
+ @if (sublabel()) {
16695
+ <p class="text-xs text-clx-text-muted truncate">{{ sublabel() }}</p>
16696
+ }
16697
+ </div>
16688
16698
  </div>
16689
16699
  <span clx-badge [color]="statusColor()" variant="light" shape="pill" size="xs" class="shrink-0">
16690
16700
  {{ statusLabel() }}
16691
16701
  </span>
16692
16702
  `,
16693
16703
  }]
16694
- }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], avatarSrc: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarSrc", required: false }] }], avatarInitials: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarInitials", required: false }] }], avatarColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarColor", required: false }] }], statusLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "statusLabel", required: true }] }], statusColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "statusColor", required: false }] }] } });
16695
-
16696
- /** Content template for one grid cell — `<ng-template clxGridItem let-item>...</ng-template>`,
16697
- * mirroring the `clxCell`/`clxColumn` convention ClxTableComponent already uses for projected
16698
- * per-row templates. Typically a <clx-widget-card> wrapping whatever the widget actually renders. */
16699
- class ClxGridItemDirective {
16700
- templateRef;
16701
- constructor(templateRef) {
16702
- this.templateRef = templateRef;
16703
- }
16704
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ClxGridItemDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
16705
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.15", type: ClxGridItemDirective, isStandalone: true, selector: "ng-template[clxGridItem]", ngImport: i0 });
16706
- }
16707
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ClxGridItemDirective, decorators: [{
16708
- type: Directive,
16709
- args: [{ selector: 'ng-template[clxGridItem]', standalone: true }]
16710
- }], ctorParameters: () => [{ type: i0.TemplateRef }] });
16711
- /** Content-agnostic configurable dashboard grid: positions/sizes projected widgets on a CSS grid
16712
- * using column/row units, supports drag-to-reorder (via Angular CDK's CdkDropList/CdkDrag — no
16713
- * new dependency, @angular/cdk is already pulled in by ClxProfileComponent/ClxWidgetCardComponent's
16714
- * overlay usage) and resize-by-dragging a corner handle. Persistence is the caller's job: listen
16715
- * to (layoutChange) and save the resulting ClxGridItem[] (e.g. to rp_dashboard_layouts.layout).
16716
- *
16717
- * Responsive: `columns` is the desktop column count; the grid itself halves it under 1024px and
16718
- * collapses to a single column under 640px (both breakpoints measured off its own host width via
16719
- * ResizeObserver, not the viewport — correct inside a narrow sidebar-pushed layout too). Below
16720
- * 640px, pointer-drag reorder/resize is replaced by an up/down reorder button pair per item —
16721
- * CdkDrag's pointer events are unreliable with real fingers on a dense grid, and a 1-column layout
16722
- * has nothing to resize width-wise anyway. */
16723
- class ClxDashboardGridComponent {
16724
- _themeSvc = inject(ClxThemeService);
16725
- _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
16726
- items = input.required(...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
16727
- columns = input(4, ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
16728
- rowHeight = input(92, ...(ngDevMode ? [{ debugName: "rowHeight" }] : /* istanbul ignore next */ []));
16729
- gap = input(16, ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
16730
- editable = input(false, ...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
16731
- layoutChange = output();
16732
- itemResize = output();
16733
- _itemTemplate = contentChild(ClxGridItemDirective, ...(ngDevMode ? [{ debugName: "_itemTemplate" }] : /* istanbul ignore next */ []));
16734
- _container = viewChild('container', ...(ngDevMode ? [{ debugName: "_container" }] : /* istanbul ignore next */ []));
16735
- _hostWidth = signal(1280, ...(ngDevMode ? [{ debugName: "_hostWidth" }] : /* istanbul ignore next */ []));
16736
- _resizeObserver;
16737
- /** Below 640px: single column, no drag/resize (reorder buttons instead). 640-1024px: half the
16738
- * desktop column count (min 2). 1024px+: the full `columns()` count. */
16739
- _isCompact = computed(() => this._hostWidth() < 640, ...(ngDevMode ? [{ debugName: "_isCompact" }] : /* istanbul ignore next */ []));
16740
- _effectiveColumns = computed(() => {
16741
- const w = this._hostWidth();
16742
- if (w < 640)
16743
- return 1;
16744
- if (w < 1024)
16745
- return Math.max(2, Math.floor(this.columns() / 2));
16746
- return this.columns();
16747
- }, ...(ngDevMode ? [{ debugName: "_effectiveColumns" }] : /* istanbul ignore next */ []));
16748
- _gridCols = computed(() => `repeat(${this._effectiveColumns()}, minmax(0, 1fr))`, ...(ngDevMode ? [{ debugName: "_gridCols" }] : /* istanbul ignore next */ []));
16749
- /** Editing gets a visibly distinct "canvas" — dashed border + dotted background + surface-2 tint
16750
- * — so the grid reads as an editable panel, not bare page background with cards floating on it. */
16751
- _containerClass = computed(() => {
16752
- const radius = resolveContainerRadius(this._themeSvc.config().borderRadius);
16753
- if (!this.editable())
16754
- return `${radius} p-1`;
16755
- return `${radius} p-4 border-2 border-dashed border-clx-border bg-clx-surface-2`;
16756
- }, ...(ngDevMode ? [{ debugName: "_containerClass" }] : /* istanbul ignore next */ []));
16757
- _resizing = null;
16758
- constructor() {
16759
- effect((onCleanup) => {
16760
- const el = this._container()?.nativeElement;
16761
- if (!this._isBrowser || !el)
16762
- return;
16763
- this._hostWidth.set(el.clientWidth);
16764
- this._resizeObserver = new ResizeObserver(entries => {
16765
- const width = entries[0]?.contentRect.width;
16766
- if (width)
16767
- this._hostWidth.set(width);
16768
- });
16769
- this._resizeObserver.observe(el);
16770
- onCleanup(() => this._resizeObserver?.disconnect());
16771
- });
16772
- }
16773
- ngOnDestroy() {
16774
- this._resizeObserver?.disconnect();
16775
- }
16776
- _onDrop(event) {
16777
- const next = [...this.items()];
16778
- moveItemInArray(next, event.previousIndex, event.currentIndex);
16779
- this.layoutChange.emit(next);
16780
- }
16781
- _onDragMoved(_event) {
16782
- // Reordering is handled by cdkDropListDropped above; this hook exists for future free-form
16783
- // (x/y pixel) positioning if a consumer needs it — not required for a reorderable column grid.
16784
- }
16785
- /** Compact-mode reorder (touch-friendly alternative to CdkDrag) — swap item at `index` with its
16786
- * neighbor `delta` positions away (-1 = up/earlier, 1 = down/later). */
16787
- _moveBy(index, delta) {
16788
- const next = [...this.items()];
16789
- const target = index + delta;
16790
- if (target < 0 || target >= next.length)
16791
- return;
16792
- [next[index], next[target]] = [next[target], next[index]];
16793
- this.layoutChange.emit(next);
16794
- }
16795
- _startResize(event, item) {
16796
- event.preventDefault();
16797
- event.stopPropagation();
16798
- this._resizing = { item, startX: event.clientX, startY: event.clientY, startW: item.w, startH: item.h };
16799
- const cellW = event.target.closest('[style*="grid-column"]')?.clientWidth
16800
- ?? (this.rowHeight() * 2);
16801
- const onMove = (e) => {
16802
- if (!this._resizing)
16803
- return;
16804
- const dx = e.clientX - this._resizing.startX;
16805
- const dy = e.clientY - this._resizing.startY;
16806
- const deltaCols = Math.round(dx / (cellW / this._resizing.startW || 1));
16807
- const deltaRows = Math.round(dy / this.rowHeight());
16808
- const nextW = Math.max(item.minW ?? 1, this._resizing.startW + deltaCols);
16809
- const nextH = Math.max(item.minH ?? 1, this._resizing.startH + deltaRows);
16810
- if (nextW !== item.w || nextH !== item.h) {
16811
- item.w = nextW;
16812
- item.h = nextH;
16813
- this.itemResize.emit({ id: item.id, w: nextW, h: nextH });
16814
- }
16815
- };
16816
- const onUp = () => {
16817
- this._resizing = null;
16818
- this.layoutChange.emit([...this.items()]);
16819
- window.removeEventListener('pointermove', onMove);
16820
- window.removeEventListener('pointerup', onUp);
16821
- };
16822
- window.addEventListener('pointermove', onMove);
16823
- window.addEventListener('pointerup', onUp);
16824
- }
16825
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ClxDashboardGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
16826
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: ClxDashboardGridComponent, isStandalone: true, selector: "clx-dashboard-grid", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, rowHeight: { classPropertyName: "rowHeight", publicName: "rowHeight", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { layoutChange: "layoutChange", itemResize: "itemResize" }, host: { classAttribute: "block w-full" }, queries: [{ propertyName: "_itemTemplate", first: true, predicate: ClxGridItemDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_container", first: true, predicate: ["container"], descendants: true, isSignal: true }], ngImport: i0, template: `
16827
- <div #container [class]="_containerClass()">
16828
- <div
16829
- cdkDropList
16830
- [cdkDropListDisabled]="!editable() || _isCompact()"
16831
- (cdkDropListDropped)="_onDrop($event)"
16832
- class="grid w-full"
16833
- [style.grid-template-columns]="_gridCols()"
16834
- [style.grid-auto-rows.px]="rowHeight()"
16835
- [style.gap.px]="gap()">
16836
- @for (item of items(); track item.id; let i = $index) {
16837
- <div
16838
- cdkDrag
16839
- [cdkDragDisabled]="!editable() || _isCompact()"
16840
- [cdkDragData]="item"
16841
- (cdkDragMoved)="_onDragMoved($event)"
16842
- class="relative"
16843
- [class.cursor-grab]="editable() && !_isCompact()"
16844
- [style.grid-column]="_isCompact() ? 'span 1' : 'span ' + item.w"
16845
- [style.grid-row]="_isCompact() ? 'span 1' : 'span ' + item.h">
16846
-
16847
- <ng-container
16848
- [ngTemplateOutlet]="_itemTemplate()?.templateRef ?? null"
16849
- [ngTemplateOutletContext]="{ $implicit: item }">
16850
- </ng-container>
16851
-
16852
- @if (editable() && !_isCompact()) {
16853
- <div
16854
- class="absolute -right-1 -bottom-1 w-3.5 h-3.5 rounded bg-clx-primary border-2 border-clx-surface shadow cursor-nwse-resize z-10"
16855
- (pointerdown)="_startResize($event, item)">
16856
- </div>
16857
- }
16704
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], sublabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "sublabel", required: false }] }], avatarSrc: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarSrc", required: false }] }], avatarInitials: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarInitials", required: false }] }], avatarColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarColor", required: false }] }], statusLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "statusLabel", required: true }] }], statusColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "statusColor", required: false }] }] } });
16858
16705
 
16859
- @if (editable() && _isCompact()) {
16860
- <div class="absolute top-2 right-2 z-10 flex flex-col rounded-lg overflow-hidden border border-clx-border bg-clx-surface shadow-sm">
16861
- <button type="button" class="w-7 h-7 flex items-center justify-center disabled:opacity-30"
16862
- [disabled]="i === 0" (click)="_moveBy(i, -1)" aria-label="Mover arriba">
16863
- <span clx-icon name="keyboard_arrow_up" size="sm"></span>
16864
- </button>
16865
- <div class="h-px bg-clx-border-soft"></div>
16866
- <button type="button" class="w-7 h-7 flex items-center justify-center disabled:opacity-30"
16867
- [disabled]="i === items().length - 1" (click)="_moveBy(i, 1)" aria-label="Mover abajo">
16868
- <span clx-icon name="keyboard_arrow_down" size="sm"></span>
16869
- </button>
16870
- </div>
16871
- }
16872
- </div>
16706
+ /** Drop-in cell for a `clxCell` table column: product image + name/category on the left, price +
16707
+ * quantity sold on the right — e.g. a "top selling products" dashboard widget row. Mount it inside
16708
+ * `<ng-template clxCell let-row>` instead of hand-building the flex row each time. */
16709
+ class ClxTableProductCellComponent {
16710
+ imageSrc = input(null, ...(ngDevMode ? [{ debugName: "imageSrc" }] : /* istanbul ignore next */ []));
16711
+ name = input.required(...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
16712
+ category = input('', ...(ngDevMode ? [{ debugName: "category" }] : /* istanbul ignore next */ []));
16713
+ price = input('', ...(ngDevMode ? [{ debugName: "price" }] : /* istanbul ignore next */ []));
16714
+ soldQty = input('', ...(ngDevMode ? [{ debugName: "soldQty" }] : /* istanbul ignore next */ []));
16715
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ClxTableProductCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
16716
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: ClxTableProductCellComponent, isStandalone: true, selector: "clx-table-product-cell", inputs: { imageSrc: { classPropertyName: "imageSrc", publicName: "imageSrc", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null }, category: { classPropertyName: "category", publicName: "category", isSignal: true, isRequired: false, transformFunction: null }, price: { classPropertyName: "price", publicName: "price", isSignal: true, isRequired: false, transformFunction: null }, soldQty: { classPropertyName: "soldQty", publicName: "soldQty", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "flex items-center justify-between gap-3 w-full" }, ngImport: i0, template: `
16717
+ <div class="flex items-center gap-2.5 min-w-0">
16718
+ @if (imageSrc()) {
16719
+ <img [src]="imageSrc()" [alt]="name()" class="w-9 h-9 rounded-lg object-cover shrink-0 bg-clx-surface-2" />
16720
+ } @else {
16721
+ <div class="w-9 h-9 rounded-lg shrink-0 bg-clx-surface-2"></div>
16722
+ }
16723
+ <div class="min-w-0">
16724
+ <p class="text-sm text-clx-text-label truncate">{{ name() }}</p>
16725
+ @if (category()) {
16726
+ <p class="text-xs text-clx-text-muted truncate">{{ category() }}</p>
16873
16727
  }
16874
16728
  </div>
16875
16729
  </div>
16876
- `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i1$2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i1$2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: ClxIconComponent, selector: "span[clx-icon]", inputs: ["name", "size", "color", "fill"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
16730
+ <div class="text-right shrink-0">
16731
+ <p class="text-sm font-semibold text-clx-text tabular-nums">{{ price() }}</p>
16732
+ @if (soldQty()) {
16733
+ <p class="text-xs text-clx-text-muted">{{ soldQty() }} vendidos</p>
16734
+ }
16735
+ </div>
16736
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
16877
16737
  }
16878
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ClxDashboardGridComponent, decorators: [{
16738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ClxTableProductCellComponent, decorators: [{
16879
16739
  type: Component,
16880
16740
  args: [{
16881
- selector: 'clx-dashboard-grid',
16741
+ selector: 'clx-table-product-cell',
16882
16742
  standalone: true,
16883
- imports: [NgTemplateOutlet, DragDropModule, ClxIconComponent],
16884
16743
  encapsulation: ViewEncapsulation.None,
16885
16744
  changeDetection: ChangeDetectionStrategy.OnPush,
16886
- host: { class: 'block w-full' },
16745
+ host: { class: 'flex items-center justify-between gap-3 w-full' },
16887
16746
  template: `
16888
- <div #container [class]="_containerClass()">
16889
- <div
16890
- cdkDropList
16891
- [cdkDropListDisabled]="!editable() || _isCompact()"
16892
- (cdkDropListDropped)="_onDrop($event)"
16893
- class="grid w-full"
16894
- [style.grid-template-columns]="_gridCols()"
16895
- [style.grid-auto-rows.px]="rowHeight()"
16896
- [style.gap.px]="gap()">
16897
- @for (item of items(); track item.id; let i = $index) {
16898
- <div
16899
- cdkDrag
16900
- [cdkDragDisabled]="!editable() || _isCompact()"
16901
- [cdkDragData]="item"
16902
- (cdkDragMoved)="_onDragMoved($event)"
16903
- class="relative"
16904
- [class.cursor-grab]="editable() && !_isCompact()"
16905
- [style.grid-column]="_isCompact() ? 'span 1' : 'span ' + item.w"
16906
- [style.grid-row]="_isCompact() ? 'span 1' : 'span ' + item.h">
16907
-
16908
- <ng-container
16909
- [ngTemplateOutlet]="_itemTemplate()?.templateRef ?? null"
16910
- [ngTemplateOutletContext]="{ $implicit: item }">
16911
- </ng-container>
16912
-
16913
- @if (editable() && !_isCompact()) {
16914
- <div
16915
- class="absolute -right-1 -bottom-1 w-3.5 h-3.5 rounded bg-clx-primary border-2 border-clx-surface shadow cursor-nwse-resize z-10"
16916
- (pointerdown)="_startResize($event, item)">
16917
- </div>
16918
- }
16919
-
16920
- @if (editable() && _isCompact()) {
16921
- <div class="absolute top-2 right-2 z-10 flex flex-col rounded-lg overflow-hidden border border-clx-border bg-clx-surface shadow-sm">
16922
- <button type="button" class="w-7 h-7 flex items-center justify-center disabled:opacity-30"
16923
- [disabled]="i === 0" (click)="_moveBy(i, -1)" aria-label="Mover arriba">
16924
- <span clx-icon name="keyboard_arrow_up" size="sm"></span>
16925
- </button>
16926
- <div class="h-px bg-clx-border-soft"></div>
16927
- <button type="button" class="w-7 h-7 flex items-center justify-center disabled:opacity-30"
16928
- [disabled]="i === items().length - 1" (click)="_moveBy(i, 1)" aria-label="Mover abajo">
16929
- <span clx-icon name="keyboard_arrow_down" size="sm"></span>
16930
- </button>
16931
- </div>
16932
- }
16933
- </div>
16747
+ <div class="flex items-center gap-2.5 min-w-0">
16748
+ @if (imageSrc()) {
16749
+ <img [src]="imageSrc()" [alt]="name()" class="w-9 h-9 rounded-lg object-cover shrink-0 bg-clx-surface-2" />
16750
+ } @else {
16751
+ <div class="w-9 h-9 rounded-lg shrink-0 bg-clx-surface-2"></div>
16752
+ }
16753
+ <div class="min-w-0">
16754
+ <p class="text-sm text-clx-text-label truncate">{{ name() }}</p>
16755
+ @if (category()) {
16756
+ <p class="text-xs text-clx-text-muted truncate">{{ category() }}</p>
16934
16757
  }
16935
16758
  </div>
16936
16759
  </div>
16760
+ <div class="text-right shrink-0">
16761
+ <p class="text-sm font-semibold text-clx-text tabular-nums">{{ price() }}</p>
16762
+ @if (soldQty()) {
16763
+ <p class="text-xs text-clx-text-muted">{{ soldQty() }} vendidos</p>
16764
+ }
16765
+ </div>
16766
+ `,
16767
+ }]
16768
+ }], propDecorators: { imageSrc: [{ type: i0.Input, args: [{ isSignal: true, alias: "imageSrc", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: true }] }], category: [{ type: i0.Input, args: [{ isSignal: true, alias: "category", required: false }] }], price: [{ type: i0.Input, args: [{ isSignal: true, alias: "price", required: false }] }], soldQty: [{ type: i0.Input, args: [{ isSignal: true, alias: "soldQty", required: false }] }] } });
16769
+
16770
+ /** A ranking: color dot + label on the left, optional trend badge + value on the right — e.g. "Top
16771
+ * selling categories" or "Sales by channel" on a dashboard. Composes ClxListComponent/
16772
+ * ClxListItemComponent (their clxLead/clxTrail slots) rather than reinventing list chrome. */
16773
+ class ClxRankedListComponent {
16774
+ items = input.required(...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
16775
+ color = input(undefined, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
16776
+ dotClass(color) {
16777
+ return resolveColor(color).bg;
16778
+ }
16779
+ trendColor(direction) {
16780
+ return direction === 'up' ? 'green' : direction === 'down' ? 'red' : 'slate';
16781
+ }
16782
+ trendIcon(direction) {
16783
+ return direction === 'up' ? 'arrow_upward' : direction === 'down' ? 'arrow_downward' : 'remove';
16784
+ }
16785
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ClxRankedListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
16786
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.15", type: ClxRankedListComponent, isStandalone: true, selector: "clx-ranked-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
16787
+ <clx-list [color]="color()">
16788
+ @for (item of items(); track item.label) {
16789
+ <clx-list-item [label]="item.label">
16790
+ <span clxLead class="w-2 h-2 rounded-full shrink-0" [class]="dotClass(item.colorDot)"></span>
16791
+ <div clxTrail class="flex items-center gap-2">
16792
+ @if (item.trend) {
16793
+ <span clx-badge size="xs" variant="light" shape="pill" [color]="trendColor(item.trendDirection)">
16794
+ <span clx-icon [name]="trendIcon(item.trendDirection)" size="xxs"></span>
16795
+ {{ item.trend }}
16796
+ </span>
16797
+ }
16798
+ <span class="text-sm font-semibold text-clx-text tabular-nums">{{ item.value }}</span>
16799
+ </div>
16800
+ </clx-list-item>
16801
+ }
16802
+ </clx-list>
16803
+ `, isInline: true, dependencies: [{ kind: "component", type: ClxListComponent, selector: "clx-list", inputs: ["color", "variant", "size", "numbered"] }, { kind: "component", type: ClxListItemComponent, selector: "clx-list-item", inputs: ["label", "sublabel", "wrapSublabel", "icon", "meta", "metaColor", "disabled"] }, { kind: "component", type: ClxBadgeComponent, selector: "span[clx-badge]", inputs: ["variant", "color", "size", "shape", "positioned"] }, { kind: "component", type: ClxIconComponent, selector: "span[clx-icon]", inputs: ["name", "size", "color", "fill"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
16804
+ }
16805
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImport: i0, type: ClxRankedListComponent, decorators: [{
16806
+ type: Component,
16807
+ args: [{
16808
+ selector: 'clx-ranked-list',
16809
+ standalone: true,
16810
+ imports: [ClxListComponent, ClxListItemComponent, ClxBadgeComponent, ClxIconComponent],
16811
+ changeDetection: ChangeDetectionStrategy.OnPush,
16812
+ template: `
16813
+ <clx-list [color]="color()">
16814
+ @for (item of items(); track item.label) {
16815
+ <clx-list-item [label]="item.label">
16816
+ <span clxLead class="w-2 h-2 rounded-full shrink-0" [class]="dotClass(item.colorDot)"></span>
16817
+ <div clxTrail class="flex items-center gap-2">
16818
+ @if (item.trend) {
16819
+ <span clx-badge size="xs" variant="light" shape="pill" [color]="trendColor(item.trendDirection)">
16820
+ <span clx-icon [name]="trendIcon(item.trendDirection)" size="xxs"></span>
16821
+ {{ item.trend }}
16822
+ </span>
16823
+ }
16824
+ <span class="text-sm font-semibold text-clx-text tabular-nums">{{ item.value }}</span>
16825
+ </div>
16826
+ </clx-list-item>
16827
+ }
16828
+ </clx-list>
16937
16829
  `,
16938
16830
  }]
16939
- }], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], rowHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeight", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], layoutChange: [{ type: i0.Output, args: ["layoutChange"] }], itemResize: [{ type: i0.Output, args: ["itemResize"] }], _itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ClxGridItemDirective), { isSignal: true }] }], _container: [{ type: i0.ViewChild, args: ['container', { isSignal: true }] }] } });
16831
+ }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
16940
16832
 
16941
16833
  const PRODUCT_TAG_LABEL = {
16942
16834
  'new': 'Nuevo',
@@ -19541,5 +19433,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
19541
19433
  * Generated bundle index. Do not edit.
19542
19434
  */
19543
19435
 
19544
- export { CLX_ADDON_BORDER, CLX_ADDON_TEXT, CLX_ALERT_OPTIONS, CLX_ALERT_RESOLVE, CLX_BG_ADDON, CLX_BG_DISABLED, CLX_BG_ICON_WRAP, CLX_BG_SECTION, CLX_BG_SURFACE, CLX_BORDER_DEFAULT, CLX_BORDER_DISABLED, CLX_BORDER_MEDIUM, CLX_COLOR_HEX, CLX_COLOR_HEX_100, CLX_COLOR_MAP, CLX_FONT_CATALOG, CLX_MODAL_ANIM_CONFIG, CLX_MODAL_DATA, CLX_MODAL_REF, CLX_OPTION_DISABLED, CLX_PLACEHOLDER, CLX_RADIO_GROUP, CLX_RADIUS_MAP, CLX_TEXT_BODY, CLX_TEXT_DISABLED, CLX_TEXT_HEADING, CLX_TEXT_HINT, CLX_TEXT_IDLE, CLX_TEXT_INPUT, CLX_TEXT_LABEL, CLX_TEXT_OPTION, CLX_TEXT_SUBTITLE, CLX_TEXT_TITLE, CLX_THEME_CONFIG, CLX_THEME_DEFAULTS, CLX_TOAST_DEFAULTS, ClxAlertComponent, ClxAlertService, ClxAnimateDirective, ClxAnimateGroupDirective, ClxAnimateService, ClxAppLayoutComponent, ClxAvatarComponent, ClxBadgeComponent, ClxBrandComponent, ClxButtonComponent, ClxButtonGroupComponent, ClxCardBodyDirective, ClxCardComponent, ClxCardExpiryInputComponent, ClxCardFooterDirective, ClxCardHeaderActionsDirective, ClxCardHeaderDirective, ClxCardNumberInputComponent, ClxCardValidators, ClxCarouselComponent, ClxCarouselDirective, ClxCartComponent, ClxCartSummaryDrawer, ClxCellDirective, ClxCheckboxComponent, ClxCollapseComponent, ClxColorPickerComponent, ClxColumnDefDirective, ClxDashboardGridComponent, ClxDateRangePickerComponent, ClxDatepickerComponent, ClxDrawerComponent, ClxDrawerService, ClxEditorComponent, ClxEditorImageModalComponent, ClxEditorLinkModalComponent, ClxFabComponent, ClxFilterPanelComponent, ClxGridItemDirective, ClxHeaderCellDirective, ClxIconComponent, ClxInputComponent, ClxListComponent, ClxListItemComponent, ClxMenuComponent, ClxMenuItemComponent, ClxMenuItemTrailingDirective, ClxModalComponent, ClxModalService, ClxNativeOverlayService, ClxNavGroupComponent, ClxNotificationComponent, ClxNumberComponent, ClxOtpComponent, ClxPageEmptyComponent, ClxPageHeaderComponent, ClxPageHeaderTitleDirective, ClxPageNotFoundComponent, ClxPageServerErrorComponent, ClxPageUnauthorizedComponent, ClxPaginationComponent, ClxProductComponent, ClxProductDetailComponent, ClxProductQuickViewComponent, ClxProfileComponent, ClxProgressBarComponent, ClxRadioComponent, ClxRadioGroupComponent, ClxRatingComponent, ClxSearchComponent, ClxSelectComponent, ClxSkeletonComponent, ClxSliderComponent, ClxSocialIconComponent, ClxSpinnerComponent, ClxStatCardComponent, ClxStepComponent, ClxStepperComponent, ClxSwitchComponent, ClxTabDirective, ClxTableActionsComponent, ClxTableComponent, ClxTableProgressCellComponent, ClxTableStatusCellComponent, ClxTabsComponent, ClxTagComponent, ClxTextareaComponent, ClxThemeService, ClxTimelineComponent, ClxTimelineItemComponent, ClxTimepickerComponent, ClxToastComponent, ClxToastContainerComponent, ClxToastService, ClxTooltipComponent, ClxTooltipDirective, ClxTreeComponent, ClxUploadComponent, ClxWidgetCardComponent, ClxWishlistComponent, ClxWizardComponent, TIMEPICKER_SIZE_MAP, detectClxCardBrand, isClxCardExpired, parseColorInput, provideCodexlyTheme, resolveColor, resolveContainerRadius, resolveRadius };
19436
+ export { CLX_ADDON_BORDER, CLX_ADDON_TEXT, CLX_ALERT_OPTIONS, CLX_ALERT_RESOLVE, CLX_BG_ADDON, CLX_BG_DISABLED, CLX_BG_ICON_WRAP, CLX_BG_SECTION, CLX_BG_SURFACE, CLX_BORDER_DEFAULT, CLX_BORDER_DISABLED, CLX_BORDER_MEDIUM, CLX_COLOR_HEX, CLX_COLOR_HEX_100, CLX_COLOR_MAP, CLX_FONT_CATALOG, CLX_MODAL_ANIM_CONFIG, CLX_MODAL_DATA, CLX_MODAL_REF, CLX_OPTION_DISABLED, CLX_PLACEHOLDER, CLX_RADIO_GROUP, CLX_RADIUS_MAP, CLX_TEXT_BODY, CLX_TEXT_DISABLED, CLX_TEXT_HEADING, CLX_TEXT_HINT, CLX_TEXT_IDLE, CLX_TEXT_INPUT, CLX_TEXT_LABEL, CLX_TEXT_OPTION, CLX_TEXT_SUBTITLE, CLX_TEXT_TITLE, CLX_THEME_CONFIG, CLX_THEME_DEFAULTS, CLX_TOAST_DEFAULTS, ClxAlertComponent, ClxAlertService, ClxAnimateDirective, ClxAnimateGroupDirective, ClxAnimateService, ClxAppLayoutComponent, ClxAvatarComponent, ClxBadgeComponent, ClxBrandComponent, ClxButtonComponent, ClxButtonGroupComponent, ClxCardBodyDirective, ClxCardComponent, ClxCardExpiryInputComponent, ClxCardFooterDirective, ClxCardHeaderActionsDirective, ClxCardHeaderDirective, ClxCardNumberInputComponent, ClxCardValidators, ClxCarouselComponent, ClxCarouselDirective, ClxCartComponent, ClxCartSummaryDrawer, ClxCellDirective, ClxCheckboxComponent, ClxCollapseComponent, ClxColorPickerComponent, ClxColumnDefDirective, ClxDateRangePickerComponent, ClxDatepickerComponent, ClxDrawerComponent, ClxDrawerService, ClxEditorComponent, ClxEditorImageModalComponent, ClxEditorLinkModalComponent, ClxFabComponent, ClxFilterPanelComponent, ClxHeaderCellDirective, ClxIconComponent, ClxInputComponent, ClxListComponent, ClxListItemComponent, ClxMenuComponent, ClxMenuItemComponent, ClxMenuItemTrailingDirective, ClxModalComponent, ClxModalService, ClxNativeOverlayService, ClxNavGroupComponent, ClxNotificationComponent, ClxNumberComponent, ClxOtpComponent, ClxPageEmptyComponent, ClxPageHeaderComponent, ClxPageHeaderTitleDirective, ClxPageNotFoundComponent, ClxPageServerErrorComponent, ClxPageUnauthorizedComponent, ClxPaginationComponent, ClxProductComponent, ClxProductDetailComponent, ClxProductQuickViewComponent, ClxProfileComponent, ClxProgressBarComponent, ClxRadioComponent, ClxRadioGroupComponent, ClxRankedListComponent, ClxRatingComponent, ClxSearchComponent, ClxSelectComponent, ClxSkeletonComponent, ClxSliderComponent, ClxSocialIconComponent, ClxSpinnerComponent, ClxStatCardComponent, ClxStepComponent, ClxStepperComponent, ClxSwitchComponent, ClxTabDirective, ClxTableActionsComponent, ClxTableComponent, ClxTableProductCellComponent, ClxTableProgressCellComponent, ClxTableStatusCellComponent, ClxTabsComponent, ClxTagComponent, ClxTextareaComponent, ClxThemeService, ClxTimelineComponent, ClxTimelineItemComponent, ClxTimepickerComponent, ClxToastComponent, ClxToastContainerComponent, ClxToastService, ClxTooltipComponent, ClxTooltipDirective, ClxTreeComponent, ClxUploadComponent, ClxWidgetCardComponent, ClxWishlistComponent, ClxWizardComponent, TIMEPICKER_SIZE_MAP, detectClxCardBrand, isClxCardExpired, parseColorInput, provideCodexlyTheme, resolveColor, resolveContainerRadius, resolveRadius };
19545
19437
  //# sourceMappingURL=codexly-ui.mjs.map