@mintplayer/ng-spark 22.31.0 → 22.33.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.
Files changed (75) hide show
  1. package/README.md +101 -1
  2. package/fesm2022/mintplayer-ng-spark-attribute-description.mjs +3 -3
  3. package/fesm2022/mintplayer-ng-spark-auth-account.mjs +18 -18
  4. package/fesm2022/mintplayer-ng-spark-auth-auth-bar.mjs +16 -8
  5. package/fesm2022/mintplayer-ng-spark-auth-auth-bar.mjs.map +1 -1
  6. package/fesm2022/mintplayer-ng-spark-auth-confirm-email.mjs +3 -3
  7. package/fesm2022/mintplayer-ng-spark-auth-core.mjs +6 -6
  8. package/fesm2022/mintplayer-ng-spark-auth-external-login.mjs +3 -3
  9. package/fesm2022/mintplayer-ng-spark-auth-forgot-password.mjs +3 -3
  10. package/fesm2022/mintplayer-ng-spark-auth-login.mjs +3 -3
  11. package/fesm2022/mintplayer-ng-spark-auth-pipes.mjs +3 -3
  12. package/fesm2022/mintplayer-ng-spark-auth-register.mjs +3 -3
  13. package/fesm2022/mintplayer-ng-spark-auth-reset-password.mjs +3 -3
  14. package/fesm2022/mintplayer-ng-spark-auth-sign-in.mjs +3 -3
  15. package/fesm2022/mintplayer-ng-spark-auth-two-factor.mjs +3 -3
  16. package/fesm2022/mintplayer-ng-spark-client-operations.mjs +24 -24
  17. package/fesm2022/mintplayer-ng-spark-column-filter.mjs +3 -3
  18. package/fesm2022/mintplayer-ng-spark-contributions.mjs +9 -9
  19. package/fesm2022/mintplayer-ng-spark-grid.mjs +220 -49
  20. package/fesm2022/mintplayer-ng-spark-grid.mjs.map +1 -1
  21. package/fesm2022/mintplayer-ng-spark-history.mjs +9 -9
  22. package/fesm2022/mintplayer-ng-spark-icon.mjs +3 -3
  23. package/fesm2022/mintplayer-ng-spark-identity-provider-connected-applications.mjs +3 -3
  24. package/fesm2022/mintplayer-ng-spark-identity-provider-core.mjs +9 -9
  25. package/fesm2022/mintplayer-ng-spark-identity-provider-developers.mjs +6 -6
  26. package/fesm2022/mintplayer-ng-spark-identity-provider-management.mjs +3 -3
  27. package/fesm2022/mintplayer-ng-spark-models.mjs +44 -1
  28. package/fesm2022/mintplayer-ng-spark-models.mjs.map +1 -1
  29. package/fesm2022/mintplayer-ng-spark-moderation.mjs +21 -21
  30. package/fesm2022/mintplayer-ng-spark-notifications.mjs +687 -0
  31. package/fesm2022/mintplayer-ng-spark-notifications.mjs.map +1 -0
  32. package/fesm2022/mintplayer-ng-spark-organizations-accept.mjs +179 -0
  33. package/fesm2022/mintplayer-ng-spark-organizations-accept.mjs.map +1 -0
  34. package/fesm2022/mintplayer-ng-spark-organizations.mjs +202 -0
  35. package/fesm2022/mintplayer-ng-spark-organizations.mjs.map +1 -0
  36. package/fesm2022/mintplayer-ng-spark-pipes.mjs +125 -85
  37. package/fesm2022/mintplayer-ng-spark-pipes.mjs.map +1 -1
  38. package/fesm2022/mintplayer-ng-spark-po-create.mjs +3 -3
  39. package/fesm2022/mintplayer-ng-spark-po-detail.mjs +90 -26
  40. package/fesm2022/mintplayer-ng-spark-po-detail.mjs.map +1 -1
  41. package/fesm2022/mintplayer-ng-spark-po-edit.mjs +84 -12
  42. package/fesm2022/mintplayer-ng-spark-po-edit.mjs.map +1 -1
  43. package/fesm2022/mintplayer-ng-spark-po-form.mjs +9 -9
  44. package/fesm2022/mintplayer-ng-spark-pwa.mjs +74 -6
  45. package/fesm2022/mintplayer-ng-spark-pwa.mjs.map +1 -1
  46. package/fesm2022/mintplayer-ng-spark-query-list.mjs +10 -109
  47. package/fesm2022/mintplayer-ng-spark-query-list.mjs.map +1 -1
  48. package/fesm2022/mintplayer-ng-spark-renderers.mjs +3 -3
  49. package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs +3 -3
  50. package/fesm2022/mintplayer-ng-spark-score-renderers.mjs +801 -0
  51. package/fesm2022/mintplayer-ng-spark-score-renderers.mjs.map +1 -0
  52. package/fesm2022/mintplayer-ng-spark-services.mjs +424 -72
  53. package/fesm2022/mintplayer-ng-spark-services.mjs.map +1 -1
  54. package/fesm2022/mintplayer-ng-spark-share-page.mjs +334 -0
  55. package/fesm2022/mintplayer-ng-spark-share-page.mjs.map +1 -0
  56. package/fesm2022/mintplayer-ng-spark-share.mjs +10 -0
  57. package/fesm2022/mintplayer-ng-spark-share.mjs.map +1 -0
  58. package/fesm2022/mintplayer-ng-spark-shell.mjs +38 -36
  59. package/fesm2022/mintplayer-ng-spark-shell.mjs.map +1 -1
  60. package/fesm2022/mintplayer-ng-spark-soft-delete.mjs +9 -9
  61. package/package.json +25 -1
  62. package/types/mintplayer-ng-spark-grid.d.ts +77 -26
  63. package/types/mintplayer-ng-spark-models.d.ts +150 -17
  64. package/types/mintplayer-ng-spark-notifications.d.ts +188 -0
  65. package/types/mintplayer-ng-spark-organizations-accept.d.ts +40 -0
  66. package/types/mintplayer-ng-spark-organizations.d.ts +72 -0
  67. package/types/mintplayer-ng-spark-pipes.d.ts +10 -0
  68. package/types/mintplayer-ng-spark-po-detail.d.ts +26 -0
  69. package/types/mintplayer-ng-spark-po-edit.d.ts +37 -0
  70. package/types/mintplayer-ng-spark-pwa.d.ts +48 -2
  71. package/types/mintplayer-ng-spark-query-list.d.ts +8 -23
  72. package/types/mintplayer-ng-spark-score-renderers.d.ts +340 -0
  73. package/types/mintplayer-ng-spark-services.d.ts +146 -6
  74. package/types/mintplayer-ng-spark-share-page.d.ts +67 -0
  75. package/types/mintplayer-ng-spark-share.d.ts +26 -0
@@ -0,0 +1,801 @@
1
+ import { Color } from "@mintplayer/ng-bootstrap";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, Directive, LOCALE_ID, computed, inject, input } from "@angular/core";
4
+ import { formatNumber } from "@angular/common";
5
+ import { BsProgressBarComponent, BsProgressComponent } from "@mintplayer/ng-bootstrap/progress-bar";
6
+ import { BsSparklineComponent } from "@mintplayer/ng-bootstrap/charts/sparkline";
7
+ import { BsTrendChartComponent } from "@mintplayer/ng-bootstrap/charts/trend";
8
+ import { BsBadgeComponent } from "@mintplayer/ng-bootstrap/badge";
9
+ import { provideSparkAttributeRenderers } from "@mintplayer/ng-spark/renderers";
10
+ const sparkTrafficLightBands = [
11
+ {
12
+ min: 80,
13
+ color: "success"
14
+ },
15
+ {
16
+ min: 60,
17
+ color: "warning"
18
+ },
19
+ { color: "danger" }
20
+ ];
21
+ const sparkLetterGrades = [
22
+ {
23
+ min: 90,
24
+ color: "success",
25
+ label: "A"
26
+ },
27
+ {
28
+ min: 80,
29
+ color: "success",
30
+ label: "B"
31
+ },
32
+ {
33
+ min: 70,
34
+ color: "warning",
35
+ label: "C"
36
+ },
37
+ {
38
+ min: 50,
39
+ color: "warning",
40
+ label: "D"
41
+ },
42
+ {
43
+ color: "danger",
44
+ label: "F"
45
+ }
46
+ ];
47
+ function resolveSparkScoreBands(option, fallback = sparkTrafficLightBands) {
48
+ if (option === "traffic-light") return sparkTrafficLightBands;
49
+ if (option === "letter-grades") return sparkLetterGrades;
50
+ if (Array.isArray(option) && option.length > 0) return option;
51
+ return fallback;
52
+ }
53
+ function sparkScoreBand(value, bands) {
54
+ if (value === null || value === void 0 || Number.isNaN(value)) return null;
55
+ let best = null;
56
+ for (const band of bands) {
57
+ const min = band.min ?? -Infinity;
58
+ if (value >= min && (best === null || min > (best.min ?? -Infinity))) best = band;
59
+ }
60
+ return best;
61
+ }
62
+ function sparkScoreColor(value, bands = sparkTrafficLightBands) {
63
+ const band = sparkScoreBand(value, bands);
64
+ return band ? Color[band.color] : Color.secondary;
65
+ }
66
+ function toSparkScoreNumber(raw) {
67
+ const value = typeof raw === "number" ? raw : raw === null || raw === void 0 || raw === "" ? NaN : Number(raw);
68
+ return Number.isNaN(value) ? null : value;
69
+ }
70
+ function numberOption(value, fallback) {
71
+ return typeof value === "number" && Number.isFinite(value) ? value : fallback;
72
+ }
73
+ function stringOption(value, fallback) {
74
+ return typeof value === "string" ? value : fallback;
75
+ }
76
+ var SparkThresholdBarComponent = class SparkThresholdBarComponent {
77
+ locale = inject(LOCALE_ID);
78
+ value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
79
+ options = input(...ngDevMode ? [void 0, { debugName: "options" }] : /* istanbul ignore next */ []);
80
+ settings = computed(() => {
81
+ const o = this.options() ?? {};
82
+ const decimals = Math.max(0, Math.trunc(numberOption(o.decimals, 1)));
83
+ return {
84
+ min: numberOption(o.min, 0),
85
+ max: numberOption(o.max, 100),
86
+ bands: resolveSparkScoreBands(o.bands),
87
+ decimals,
88
+ suffix: stringOption(o.suffix, "%"),
89
+ label: stringOption(o.label, "Value"),
90
+ width: stringOption(o.width, "80px"),
91
+ height: stringOption(o.height, "8px"),
92
+ showValue: o.showValue !== false
93
+ };
94
+ }, ...ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []);
95
+ view = computed(() => {
96
+ const value = toSparkScoreNumber(this.value());
97
+ if (value === null) return null;
98
+ const s = this.settings();
99
+ return {
100
+ value,
101
+ text: formatNumber(value, this.locale, `1.${s.decimals}-${s.decimals}`) + s.suffix,
102
+ color: sparkScoreColor(value, s.bands)
103
+ };
104
+ }, ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
105
+ static ɵfac = i0.ɵɵngDeclareFactory({
106
+ minVersion: "12.0.0",
107
+ version: "22.2.2",
108
+ ngImport: i0,
109
+ type: SparkThresholdBarComponent,
110
+ deps: [],
111
+ target: i0.ɵɵFactoryTarget.Component
112
+ });
113
+ static ɵcmp = i0.ɵɵngDeclareComponent({
114
+ minVersion: "17.0.0",
115
+ version: "22.2.2",
116
+ type: SparkThresholdBarComponent,
117
+ isStandalone: true,
118
+ selector: "spark-threshold-bar",
119
+ inputs: {
120
+ value: {
121
+ classPropertyName: "value",
122
+ publicName: "value",
123
+ isSignal: true,
124
+ isRequired: false,
125
+ transformFunction: null
126
+ },
127
+ options: {
128
+ classPropertyName: "options",
129
+ publicName: "options",
130
+ isSignal: true,
131
+ isRequired: false,
132
+ transformFunction: null
133
+ }
134
+ },
135
+ ngImport: i0,
136
+ template: `
137
+ @if (view(); as v) {
138
+ <div class="d-flex align-items-center gap-2">
139
+ <bs-progress [style.width]="settings().width" [style.height]="settings().height">
140
+ <bs-progress-bar [value]="v.value" [minimum]="settings().min" [maximum]="settings().max" [color]="v.color"
141
+ [ariaLabel]="settings().label" [valueText]="v.text" />
142
+ </bs-progress>
143
+ @if (settings().showValue) {
144
+ <span class="small text-nowrap">{{ v.text }}</span>
145
+ }
146
+ </div>
147
+ } @else {
148
+ <span class="text-muted small">—</span>
149
+ }
150
+ `,
151
+ isInline: true,
152
+ dependencies: [{
153
+ kind: "component",
154
+ type: BsProgressComponent,
155
+ selector: "bs-progress",
156
+ inputs: [
157
+ "height",
158
+ "isIndeterminate",
159
+ "ariaLabel"
160
+ ]
161
+ }, {
162
+ kind: "component",
163
+ type: BsProgressBarComponent,
164
+ selector: "bs-progress-bar",
165
+ inputs: [
166
+ "minimum",
167
+ "maximum",
168
+ "value",
169
+ "color",
170
+ "striped",
171
+ "animated",
172
+ "ariaLabel",
173
+ "valueText"
174
+ ]
175
+ }],
176
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
177
+ });
178
+ };
179
+ i0.ɵɵngDeclareClassMetadata({
180
+ minVersion: "12.0.0",
181
+ version: "22.2.2",
182
+ ngImport: i0,
183
+ type: SparkThresholdBarComponent,
184
+ decorators: [{
185
+ type: Component,
186
+ args: [{
187
+ selector: "spark-threshold-bar",
188
+ imports: [BsProgressComponent, BsProgressBarComponent],
189
+ template: `
190
+ @if (view(); as v) {
191
+ <div class="d-flex align-items-center gap-2">
192
+ <bs-progress [style.width]="settings().width" [style.height]="settings().height">
193
+ <bs-progress-bar [value]="v.value" [minimum]="settings().min" [maximum]="settings().max" [color]="v.color"
194
+ [ariaLabel]="settings().label" [valueText]="v.text" />
195
+ </bs-progress>
196
+ @if (settings().showValue) {
197
+ <span class="small text-nowrap">{{ v.text }}</span>
198
+ }
199
+ </div>
200
+ } @else {
201
+ <span class="text-muted small">—</span>
202
+ }
203
+ `,
204
+ changeDetection: ChangeDetectionStrategy.OnPush
205
+ }]
206
+ }],
207
+ propDecorators: {
208
+ value: [{
209
+ type: i0.Input,
210
+ args: [{
211
+ isSignal: true,
212
+ alias: "value",
213
+ required: false
214
+ }]
215
+ }],
216
+ options: [{
217
+ type: i0.Input,
218
+ args: [{
219
+ isSignal: true,
220
+ alias: "options",
221
+ required: false
222
+ }]
223
+ }]
224
+ }
225
+ });
226
+ function formatSparkDelta(raw, options) {
227
+ const o = options ?? {};
228
+ const value = toSparkScoreNumber(raw);
229
+ if (value === null) return {
230
+ up: false,
231
+ down: false,
232
+ text: stringOption(o.empty, "—"),
233
+ tone: "text-muted"
234
+ };
235
+ const decimals = Math.min(100, Math.max(0, Math.trunc(numberOption(o.decimals, 1))));
236
+ const up = value > 0;
237
+ const down = value < 0;
238
+ const good = o.higherIsBetter === false ? down : up;
239
+ const bad = o.higherIsBetter === false ? up : down;
240
+ return {
241
+ up,
242
+ down,
243
+ text: `${up ? "+" : ""}${value.toFixed(decimals)}${stringOption(o.suffix, "")}`,
244
+ tone: good ? "text-success" : bad ? "text-danger" : "text-muted"
245
+ };
246
+ }
247
+ var SparkDeltaComponent = class SparkDeltaComponent {
248
+ value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
249
+ options = input(...ngDevMode ? [void 0, { debugName: "options" }] : /* istanbul ignore next */ []);
250
+ view = computed(() => formatSparkDelta(this.value(), this.options()), ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
251
+ static ɵfac = i0.ɵɵngDeclareFactory({
252
+ minVersion: "12.0.0",
253
+ version: "22.2.2",
254
+ ngImport: i0,
255
+ type: SparkDeltaComponent,
256
+ deps: [],
257
+ target: i0.ɵɵFactoryTarget.Component
258
+ });
259
+ static ɵcmp = i0.ɵɵngDeclareComponent({
260
+ minVersion: "17.1.0",
261
+ version: "22.2.2",
262
+ type: SparkDeltaComponent,
263
+ isStandalone: true,
264
+ selector: "spark-delta",
265
+ inputs: {
266
+ value: {
267
+ classPropertyName: "value",
268
+ publicName: "value",
269
+ isSignal: true,
270
+ isRequired: false,
271
+ transformFunction: null
272
+ },
273
+ options: {
274
+ classPropertyName: "options",
275
+ publicName: "options",
276
+ isSignal: true,
277
+ isRequired: false,
278
+ transformFunction: null
279
+ }
280
+ },
281
+ ngImport: i0,
282
+ template: `<span class="small" [class]="view().tone">{{ view().text }}</span>`,
283
+ isInline: true,
284
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
285
+ });
286
+ };
287
+ i0.ɵɵngDeclareClassMetadata({
288
+ minVersion: "12.0.0",
289
+ version: "22.2.2",
290
+ ngImport: i0,
291
+ type: SparkDeltaComponent,
292
+ decorators: [{
293
+ type: Component,
294
+ args: [{
295
+ selector: "spark-delta",
296
+ template: `<span class="small" [class]="view().tone">{{ view().text }}</span>`,
297
+ changeDetection: ChangeDetectionStrategy.OnPush
298
+ }]
299
+ }],
300
+ propDecorators: {
301
+ value: [{
302
+ type: i0.Input,
303
+ args: [{
304
+ isSignal: true,
305
+ alias: "value",
306
+ required: false
307
+ }]
308
+ }],
309
+ options: [{
310
+ type: i0.Input,
311
+ args: [{
312
+ isSignal: true,
313
+ alias: "options",
314
+ required: false
315
+ }]
316
+ }]
317
+ }
318
+ });
319
+ function toSparkTrendPoints(value, minPoints = 2) {
320
+ if (!Array.isArray(value)) return null;
321
+ const points = [];
322
+ for (let i = 0; i < value.length; i++) {
323
+ const point = value[i];
324
+ if (point === null || typeof point === "number") points.push({
325
+ x: i,
326
+ y: point
327
+ });
328
+ else if (typeof point === "object" && "y" in point) points.push({
329
+ x: point.x,
330
+ y: point.y
331
+ });
332
+ else return null;
333
+ }
334
+ return points.length >= minPoints ? points : null;
335
+ }
336
+ var SparkTrendBase = class SparkTrendBase {
337
+ value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
338
+ options = input(...ngDevMode ? [void 0, { debugName: "options" }] : /* istanbul ignore next */ []);
339
+ settings = computed(() => {
340
+ const o = this.options() ?? {};
341
+ const label = typeof o.label === "string" ? o.label : void 0;
342
+ return {
343
+ display: o.display === "chart" ? "chart" : "sparkline",
344
+ yMin: typeof o.yMin === "number" ? o.yMin : void 0,
345
+ yMax: typeof o.yMax === "number" ? o.yMax : void 0,
346
+ label,
347
+ minPoints: Math.max(1, Math.trunc(numberOption(o.minPoints, 2))),
348
+ width: stringOption(o.width, "90px"),
349
+ height: stringOption(o.height, "24px"),
350
+ goal: typeof o.goal === "number" ? o.goal : void 0,
351
+ goalLabel: typeof o.goalLabel === "string" ? o.goalLabel : void 0,
352
+ seriesId: stringOption(o.seriesId, "value"),
353
+ seriesLabel: stringOption(o.seriesLabel, label ?? "")
354
+ };
355
+ }, ...ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []);
356
+ points = computed(() => toSparkTrendPoints(this.value(), this.settings().minPoints), ...ngDevMode ? [{ debugName: "points" }] : /* istanbul ignore next */ []);
357
+ static ɵfac = i0.ɵɵngDeclareFactory({
358
+ minVersion: "12.0.0",
359
+ version: "22.2.2",
360
+ ngImport: i0,
361
+ type: SparkTrendBase,
362
+ deps: [],
363
+ target: i0.ɵɵFactoryTarget.Directive
364
+ });
365
+ static ɵdir = i0.ɵɵngDeclareDirective({
366
+ minVersion: "17.1.0",
367
+ version: "22.2.2",
368
+ type: SparkTrendBase,
369
+ isStandalone: true,
370
+ inputs: {
371
+ value: {
372
+ classPropertyName: "value",
373
+ publicName: "value",
374
+ isSignal: true,
375
+ isRequired: false,
376
+ transformFunction: null
377
+ },
378
+ options: {
379
+ classPropertyName: "options",
380
+ publicName: "options",
381
+ isSignal: true,
382
+ isRequired: false,
383
+ transformFunction: null
384
+ }
385
+ },
386
+ ngImport: i0
387
+ });
388
+ };
389
+ i0.ɵɵngDeclareClassMetadata({
390
+ minVersion: "12.0.0",
391
+ version: "22.2.2",
392
+ ngImport: i0,
393
+ type: SparkTrendBase,
394
+ decorators: [{ type: Directive }],
395
+ propDecorators: {
396
+ value: [{
397
+ type: i0.Input,
398
+ args: [{
399
+ isSignal: true,
400
+ alias: "value",
401
+ required: false
402
+ }]
403
+ }],
404
+ options: [{
405
+ type: i0.Input,
406
+ args: [{
407
+ isSignal: true,
408
+ alias: "options",
409
+ required: false
410
+ }]
411
+ }]
412
+ }
413
+ });
414
+ var SparkTrendSparklineComponent = class SparkTrendSparklineComponent extends SparkTrendBase {
415
+ ys(points) {
416
+ return points.map((p) => p.y);
417
+ }
418
+ static ɵfac = i0.ɵɵngDeclareFactory({
419
+ minVersion: "12.0.0",
420
+ version: "22.2.2",
421
+ ngImport: i0,
422
+ type: SparkTrendSparklineComponent,
423
+ deps: null,
424
+ target: i0.ɵɵFactoryTarget.Component
425
+ });
426
+ static ɵcmp = i0.ɵɵngDeclareComponent({
427
+ minVersion: "17.0.0",
428
+ version: "22.2.2",
429
+ type: SparkTrendSparklineComponent,
430
+ isStandalone: true,
431
+ selector: "spark-trend-sparkline",
432
+ usesInheritance: true,
433
+ ngImport: i0,
434
+ template: `
435
+ @if (points(); as p) {
436
+ <bs-sparkline class="d-inline-block" [style.width]="settings().width" [style.height]="settings().height"
437
+ [points]="ys(p)" [yMin]="settings().yMin" [yMax]="settings().yMax"
438
+ [inputLabel]="settings().label" />
439
+ } @else {
440
+ <span class="text-muted small">—</span>
441
+ }
442
+ `,
443
+ isInline: true,
444
+ dependencies: [{
445
+ kind: "component",
446
+ type: BsSparklineComponent,
447
+ selector: "bs-sparkline",
448
+ inputs: [
449
+ "points",
450
+ "area",
451
+ "showLastDot",
452
+ "yMin",
453
+ "yMax",
454
+ "locale",
455
+ "inputLabel",
456
+ "summaryFormatter"
457
+ ]
458
+ }],
459
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
460
+ });
461
+ };
462
+ i0.ɵɵngDeclareClassMetadata({
463
+ minVersion: "12.0.0",
464
+ version: "22.2.2",
465
+ ngImport: i0,
466
+ type: SparkTrendSparklineComponent,
467
+ decorators: [{
468
+ type: Component,
469
+ args: [{
470
+ selector: "spark-trend-sparkline",
471
+ imports: [BsSparklineComponent],
472
+ template: `
473
+ @if (points(); as p) {
474
+ <bs-sparkline class="d-inline-block" [style.width]="settings().width" [style.height]="settings().height"
475
+ [points]="ys(p)" [yMin]="settings().yMin" [yMax]="settings().yMax"
476
+ [inputLabel]="settings().label" />
477
+ } @else {
478
+ <span class="text-muted small">—</span>
479
+ }
480
+ `,
481
+ changeDetection: ChangeDetectionStrategy.OnPush
482
+ }]
483
+ }]
484
+ });
485
+ var SparkTrendChartComponent = class SparkTrendChartComponent extends SparkTrendBase {
486
+ series = computed(() => {
487
+ const s = this.settings();
488
+ return [{
489
+ id: s.seriesId,
490
+ label: s.seriesLabel,
491
+ points: this.points() ?? []
492
+ }];
493
+ }, ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
494
+ static ɵfac = i0.ɵɵngDeclareFactory({
495
+ minVersion: "12.0.0",
496
+ version: "22.2.2",
497
+ ngImport: i0,
498
+ type: SparkTrendChartComponent,
499
+ deps: null,
500
+ target: i0.ɵɵFactoryTarget.Component
501
+ });
502
+ static ɵcmp = i0.ɵɵngDeclareComponent({
503
+ minVersion: "17.0.0",
504
+ version: "22.2.2",
505
+ type: SparkTrendChartComponent,
506
+ isStandalone: true,
507
+ selector: "spark-trend-chart",
508
+ usesInheritance: true,
509
+ ngImport: i0,
510
+ template: `
511
+ @if (points()) {
512
+ <bs-trend-chart [series]="series()" [yMin]="settings().yMin" [yMax]="settings().yMax"
513
+ [goal]="settings().goal" [goalLabel]="settings().goalLabel" [inputLabel]="settings().label" />
514
+ } @else {
515
+ <span class="text-muted small">—</span>
516
+ }
517
+ `,
518
+ isInline: true,
519
+ dependencies: [{
520
+ kind: "component",
521
+ type: BsTrendChartComponent,
522
+ selector: "bs-trend-chart",
523
+ inputs: [
524
+ "series",
525
+ "area",
526
+ "stacked",
527
+ "yMin",
528
+ "yMax",
529
+ "goal",
530
+ "goalLabel",
531
+ "locale",
532
+ "summary",
533
+ "inputLabel",
534
+ "summaryFormatter"
535
+ ],
536
+ outputs: ["pointHover", "pointSelect"]
537
+ }],
538
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
539
+ });
540
+ };
541
+ i0.ɵɵngDeclareClassMetadata({
542
+ minVersion: "12.0.0",
543
+ version: "22.2.2",
544
+ ngImport: i0,
545
+ type: SparkTrendChartComponent,
546
+ decorators: [{
547
+ type: Component,
548
+ args: [{
549
+ selector: "spark-trend-chart",
550
+ imports: [BsTrendChartComponent],
551
+ template: `
552
+ @if (points()) {
553
+ <bs-trend-chart [series]="series()" [yMin]="settings().yMin" [yMax]="settings().yMax"
554
+ [goal]="settings().goal" [goalLabel]="settings().goalLabel" [inputLabel]="settings().label" />
555
+ } @else {
556
+ <span class="text-muted small">—</span>
557
+ }
558
+ `,
559
+ changeDetection: ChangeDetectionStrategy.OnPush
560
+ }]
561
+ }]
562
+ });
563
+ var SparkTrendComponent = class SparkTrendComponent extends SparkTrendBase {
564
+ static ɵfac = i0.ɵɵngDeclareFactory({
565
+ minVersion: "12.0.0",
566
+ version: "22.2.2",
567
+ ngImport: i0,
568
+ type: SparkTrendComponent,
569
+ deps: null,
570
+ target: i0.ɵɵFactoryTarget.Component
571
+ });
572
+ static ɵcmp = i0.ɵɵngDeclareComponent({
573
+ minVersion: "17.0.0",
574
+ version: "22.2.2",
575
+ type: SparkTrendComponent,
576
+ isStandalone: true,
577
+ selector: "spark-trend",
578
+ usesInheritance: true,
579
+ ngImport: i0,
580
+ template: `
581
+ @if (settings().display === 'chart') {
582
+ <spark-trend-chart [value]="value()" [options]="options()" />
583
+ } @else {
584
+ <spark-trend-sparkline [value]="value()" [options]="options()" />
585
+ }
586
+ `,
587
+ isInline: true,
588
+ dependencies: [{
589
+ kind: "component",
590
+ type: SparkTrendSparklineComponent,
591
+ selector: "spark-trend-sparkline"
592
+ }, {
593
+ kind: "component",
594
+ type: SparkTrendChartComponent,
595
+ selector: "spark-trend-chart"
596
+ }],
597
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
598
+ });
599
+ };
600
+ i0.ɵɵngDeclareClassMetadata({
601
+ minVersion: "12.0.0",
602
+ version: "22.2.2",
603
+ ngImport: i0,
604
+ type: SparkTrendComponent,
605
+ decorators: [{
606
+ type: Component,
607
+ args: [{
608
+ selector: "spark-trend",
609
+ imports: [SparkTrendSparklineComponent, SparkTrendChartComponent],
610
+ template: `
611
+ @if (settings().display === 'chart') {
612
+ <spark-trend-chart [value]="value()" [options]="options()" />
613
+ } @else {
614
+ <spark-trend-sparkline [value]="value()" [options]="options()" />
615
+ }
616
+ `,
617
+ changeDetection: ChangeDetectionStrategy.OnPush
618
+ }]
619
+ }]
620
+ });
621
+ var SparkGaugeComponent = class SparkGaugeComponent {
622
+ locale = inject(LOCALE_ID);
623
+ value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
624
+ options = input(...ngDevMode ? [void 0, { debugName: "options" }] : /* istanbul ignore next */ []);
625
+ settings = computed(() => {
626
+ const o = this.options() ?? {};
627
+ return {
628
+ min: numberOption(o.min, 0),
629
+ max: numberOption(o.max, 100),
630
+ bands: resolveSparkScoreBands(o.bands),
631
+ decimals: Math.max(0, Math.trunc(numberOption(o.decimals, 0))),
632
+ suffix: stringOption(o.suffix, ""),
633
+ label: stringOption(o.label, "Score"),
634
+ size: Math.max(1, numberOption(o.size, 48))
635
+ };
636
+ }, ...ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []);
637
+ view = computed(() => {
638
+ const value = toSparkScoreNumber(this.value());
639
+ if (value === null) return null;
640
+ const s = this.settings();
641
+ const band = sparkScoreBand(value, s.bands);
642
+ const span = s.max - s.min;
643
+ const share = span > 0 ? (value - s.min) / span : 0;
644
+ return {
645
+ value,
646
+ text: formatNumber(value, this.locale, `1.${s.decimals}-${s.decimals}`) + s.suffix,
647
+ color: band?.color ?? "secondary",
648
+ grade: band?.label ?? null,
649
+ badge: Color[band?.color ?? "secondary"],
650
+ arc: Math.round(Math.min(1, Math.max(0, share)) * 1e3) / 10
651
+ };
652
+ }, ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
653
+ static ɵfac = i0.ɵɵngDeclareFactory({
654
+ minVersion: "12.0.0",
655
+ version: "22.2.2",
656
+ ngImport: i0,
657
+ type: SparkGaugeComponent,
658
+ deps: [],
659
+ target: i0.ɵɵFactoryTarget.Component
660
+ });
661
+ static ɵcmp = i0.ɵɵngDeclareComponent({
662
+ minVersion: "17.0.0",
663
+ version: "22.2.2",
664
+ type: SparkGaugeComponent,
665
+ isStandalone: true,
666
+ selector: "spark-gauge",
667
+ inputs: {
668
+ value: {
669
+ classPropertyName: "value",
670
+ publicName: "value",
671
+ isSignal: true,
672
+ isRequired: false,
673
+ transformFunction: null
674
+ },
675
+ options: {
676
+ classPropertyName: "options",
677
+ publicName: "options",
678
+ isSignal: true,
679
+ isRequired: false,
680
+ transformFunction: null
681
+ }
682
+ },
683
+ ngImport: i0,
684
+ template: `
685
+ @if (view(); as v) {
686
+ <span class="d-inline-flex align-items-center gap-2" role="meter"
687
+ [attr.aria-label]="settings().label" [attr.aria-valuenow]="v.value"
688
+ [attr.aria-valuemin]="settings().min" [attr.aria-valuemax]="settings().max"
689
+ [attr.aria-valuetext]="v.grade ? v.text + ' (' + v.grade + ')' : v.text">
690
+ <svg viewBox="0 0 36 36" [attr.width]="settings().size" [attr.height]="settings().size" aria-hidden="true">
691
+ <circle class="spark-gauge-track" cx="18" cy="18" r="15.9155" fill="none" stroke-width="3.5" />
692
+ <circle class="spark-gauge-arc" cx="18" cy="18" r="15.9155" fill="none" stroke-width="3.5"
693
+ stroke-linecap="round" transform="rotate(-90 18 18)"
694
+ [attr.stroke]="'var(--bs-' + v.color + ')'" [attr.stroke-dasharray]="v.arc + ' 100'" />
695
+ <text x="18" y="18" text-anchor="middle" dominant-baseline="central" class="spark-gauge-text">{{ v.text }}</text>
696
+ </svg>
697
+ @if (v.grade) {
698
+ <bs-badge [type]="v.badge">{{ v.grade }}</bs-badge>
699
+ }
700
+ </span>
701
+ } @else {
702
+ <span class="text-muted small">—</span>
703
+ }
704
+ `,
705
+ isInline: true,
706
+ styles: [".spark-gauge-track{stroke:var(--bs-secondary-bg)}.spark-gauge-text{fill:var(--bs-body-color);font-size:10px;font-weight:600}\n"],
707
+ dependencies: [{
708
+ kind: "component",
709
+ type: BsBadgeComponent,
710
+ selector: "bs-badge",
711
+ inputs: [
712
+ "type",
713
+ "unit",
714
+ "decorative"
715
+ ]
716
+ }],
717
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
718
+ });
719
+ };
720
+ i0.ɵɵngDeclareClassMetadata({
721
+ minVersion: "12.0.0",
722
+ version: "22.2.2",
723
+ ngImport: i0,
724
+ type: SparkGaugeComponent,
725
+ decorators: [{
726
+ type: Component,
727
+ args: [{
728
+ selector: "spark-gauge",
729
+ imports: [BsBadgeComponent],
730
+ template: `
731
+ @if (view(); as v) {
732
+ <span class="d-inline-flex align-items-center gap-2" role="meter"
733
+ [attr.aria-label]="settings().label" [attr.aria-valuenow]="v.value"
734
+ [attr.aria-valuemin]="settings().min" [attr.aria-valuemax]="settings().max"
735
+ [attr.aria-valuetext]="v.grade ? v.text + ' (' + v.grade + ')' : v.text">
736
+ <svg viewBox="0 0 36 36" [attr.width]="settings().size" [attr.height]="settings().size" aria-hidden="true">
737
+ <circle class="spark-gauge-track" cx="18" cy="18" r="15.9155" fill="none" stroke-width="3.5" />
738
+ <circle class="spark-gauge-arc" cx="18" cy="18" r="15.9155" fill="none" stroke-width="3.5"
739
+ stroke-linecap="round" transform="rotate(-90 18 18)"
740
+ [attr.stroke]="'var(--bs-' + v.color + ')'" [attr.stroke-dasharray]="v.arc + ' 100'" />
741
+ <text x="18" y="18" text-anchor="middle" dominant-baseline="central" class="spark-gauge-text">{{ v.text }}</text>
742
+ </svg>
743
+ @if (v.grade) {
744
+ <bs-badge [type]="v.badge">{{ v.grade }}</bs-badge>
745
+ }
746
+ </span>
747
+ } @else {
748
+ <span class="text-muted small">—</span>
749
+ }
750
+ `,
751
+ changeDetection: ChangeDetectionStrategy.OnPush,
752
+ styles: [".spark-gauge-track{stroke:var(--bs-secondary-bg)}.spark-gauge-text{fill:var(--bs-body-color);font-size:10px;font-weight:600}\n"]
753
+ }]
754
+ }],
755
+ propDecorators: {
756
+ value: [{
757
+ type: i0.Input,
758
+ args: [{
759
+ isSignal: true,
760
+ alias: "value",
761
+ required: false
762
+ }]
763
+ }],
764
+ options: [{
765
+ type: i0.Input,
766
+ args: [{
767
+ isSignal: true,
768
+ alias: "options",
769
+ required: false
770
+ }]
771
+ }]
772
+ }
773
+ });
774
+ const sparkScoreRenderers = [
775
+ {
776
+ name: "spark-gauge",
777
+ columnComponent: SparkGaugeComponent,
778
+ detailComponent: SparkGaugeComponent
779
+ },
780
+ {
781
+ name: "spark-threshold-bar",
782
+ columnComponent: SparkThresholdBarComponent,
783
+ detailComponent: SparkThresholdBarComponent
784
+ },
785
+ {
786
+ name: "spark-trend",
787
+ columnComponent: SparkTrendComponent,
788
+ detailComponent: SparkTrendComponent
789
+ },
790
+ {
791
+ name: "spark-delta",
792
+ columnComponent: SparkDeltaComponent,
793
+ detailComponent: SparkDeltaComponent
794
+ }
795
+ ];
796
+ function provideSparkScoreRenderers(renderers = []) {
797
+ return provideSparkAttributeRenderers([...renderers, ...sparkScoreRenderers]);
798
+ }
799
+ export { SparkDeltaComponent, SparkGaugeComponent, SparkThresholdBarComponent, SparkTrendChartComponent, SparkTrendComponent, SparkTrendSparklineComponent, formatSparkDelta, provideSparkScoreRenderers, resolveSparkScoreBands, sparkLetterGrades, sparkScoreBand, sparkScoreColor, sparkScoreRenderers, sparkTrafficLightBands, toSparkScoreNumber, toSparkTrendPoints };
800
+
801
+ //# sourceMappingURL=mintplayer-ng-spark-score-renderers.mjs.map