@forgeroute/ui 0.3.5 → 0.3.7

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
- import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, Directive, ElementRef, HostBinding, HostListener, Injectable, InjectionToken, Injector, Input, NgZone, Renderer2, afterNextRender, computed, effect, forwardRef, inject, input, linkedSignal, model, output, signal, untracked, viewChild } from "@angular/core";
2
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, Directive, ElementRef, HostBinding, HostListener, Injectable, InjectionToken, Injector, Input, Renderer2, afterNextRender, computed, effect, forwardRef, inject, input, linkedSignal, model, output, signal, untracked, viewChild } from "@angular/core";
3
3
  import { HttpClient, HttpErrorResponse, HttpParams } from "@angular/common/http";
4
4
  import { takeUntilDestroyed, toObservable } from "@angular/core/rxjs-interop";
5
5
  import { catchError, debounceTime, distinctUntilChanged, skip, switchMap } from "rxjs/operators";
@@ -8,7 +8,6 @@ import { DOCUMENT, DatePipe, DecimalPipe, NgTemplateOutlet } from "@angular/comm
8
8
  import * as i1 from "@angular/forms";
9
9
  import { FormsModule, NG_VALIDATORS, NG_VALUE_ACCESSOR } from "@angular/forms";
10
10
  import { NavigationEnd, Router, RouterLink, RouterLinkActive } from "@angular/router";
11
- import { BarController, BarElement, CategoryScale, Chart, LinearScale, Tooltip } from "chart.js";
12
11
  import { DomSanitizer } from "@angular/platform-browser";
13
12
  const FORGEROUTE_CONFIG = new InjectionToken("FORGEROUTE_CONFIG");
14
13
  const DROPDOWN_GROUP = new InjectionToken("DROPDOWN_GROUP");
@@ -10685,170 +10684,44 @@ i0.ɵɵngDeclareClassMetadata({
10685
10684
  }]
10686
10685
  }
10687
10686
  });
10688
- let registered = false;
10689
- function registerChartParts() {
10690
- if (registered) return;
10691
- Chart.register(BarController, BarElement, CategoryScale, LinearScale, Tooltip);
10692
- registered = true;
10693
- }
10694
- const VALUE_LABELS = {
10695
- id: "uiBarChartValueLabels",
10696
- afterDatasetsDraw(chart) {
10697
- if (chart.options.plugins["uiBarChartValueLabels"]?.enabled === false) return;
10698
- const ctx = chart.ctx;
10699
- ctx.save();
10700
- ctx.fillStyle = "#475569";
10701
- ctx.font = "600 11px sans-serif";
10702
- ctx.textAlign = "center";
10703
- ctx.textBaseline = "bottom";
10704
- chart.getDatasetMeta(0).data.forEach((bar, i) => {
10705
- const value = chart.data.datasets[0]?.data[i];
10706
- if (typeof value === "number" && value !== 0) ctx.fillText(String(value), bar.x, bar.y - 2);
10707
- });
10708
- ctx.restore();
10709
- }
10710
- };
10711
- var BarChartComponent = class BarChartComponent {
10687
+ var AudioPlayerComponent = class AudioPlayerComponent {
10712
10688
  constructor() {
10713
- this.labels = input([], ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
10714
- this.values = input([], ...ngDevMode ? [{ debugName: "values" }] : /* istanbul ignore next */ []);
10715
- this.color = input("#3b82f6", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
10716
- this.hoverColor = input("#2563eb", ...ngDevMode ? [{ debugName: "hoverColor" }] : /* istanbul ignore next */ []);
10717
- this.height = input(240, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
10689
+ this.src = input("", ...ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []);
10718
10690
  this.ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
10719
- this.showValues = input(true, ...ngDevMode ? [{ debugName: "showValues" }] : /* istanbul ignore next */ []);
10720
- this.unitSingular = input("", ...ngDevMode ? [{ debugName: "unitSingular" }] : /* istanbul ignore next */ []);
10721
- this.unitPlural = input("", ...ngDevMode ? [{ debugName: "unitPlural" }] : /* istanbul ignore next */ []);
10722
- this.canvas = viewChild.required("canvas", ...ngDevMode ? [{ debugName: "canvas" }] : /* istanbul ignore next */ []);
10723
- this.zone = inject(NgZone);
10724
- this.chart = null;
10725
- this.tooltipText = (value) => {
10726
- const unit = value === 1 ? this.unitSingular() : this.unitPlural();
10727
- return unit ? `${value} ${unit}` : String(value);
10728
- };
10729
- this.series = computed(() => ({
10730
- labels: this.labels(),
10731
- data: this.values(),
10732
- color: this.color(),
10733
- hoverColor: this.hoverColor(),
10734
- showValues: this.showValues()
10735
- }), ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
10691
+ this.preload = input("metadata", ...ngDevMode ? [{ debugName: "preload" }] : /* istanbul ignore next */ []);
10692
+ this.playbackError = output();
10693
+ this.failed = signal(false, ...ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []);
10736
10694
  effect(() => {
10737
- const s = this.series();
10738
- const canvas = this.canvas().nativeElement;
10739
- if (!this.chart) {
10740
- registerChartParts();
10741
- this.zone.runOutsideAngular(() => {
10742
- this.chart = new Chart(canvas, {
10743
- type: "bar",
10744
- data: {
10745
- labels: s.labels,
10746
- datasets: [{
10747
- data: s.data,
10748
- backgroundColor: s.color,
10749
- hoverBackgroundColor: s.hoverColor,
10750
- borderRadius: 3,
10751
- borderSkipped: false
10752
- }]
10753
- },
10754
- options: {
10755
- responsive: true,
10756
- maintainAspectRatio: false,
10757
- animation: false,
10758
- layout: { padding: { top: 20 } },
10759
- plugins: {
10760
- legend: { display: false },
10761
- tooltip: { callbacks: { label: (item) => this.tooltipText(Number(item.raw)) } }
10762
- },
10763
- scales: {
10764
- y: {
10765
- beginAtZero: true,
10766
- ticks: {
10767
- precision: 0,
10768
- color: "#94a3b8",
10769
- font: { size: 11 }
10770
- },
10771
- grid: { color: "#e2e8f0" },
10772
- border: { display: false }
10773
- },
10774
- x: {
10775
- grid: { display: false },
10776
- ticks: {
10777
- maxRotation: 0,
10778
- color: "#94a3b8",
10779
- font: { size: 10 }
10780
- },
10781
- border: { display: false }
10782
- }
10783
- }
10784
- },
10785
- plugins: [VALUE_LABELS]
10786
- });
10787
- });
10788
- }
10789
- const chart = this.chart;
10790
- chart.data.labels = s.labels;
10791
- const ds = chart.data.datasets[0];
10792
- ds.data = s.data;
10793
- ds.backgroundColor = s.color;
10794
- ds.hoverBackgroundColor = s.hoverColor;
10795
- chart.options.plugins["uiBarChartValueLabels"] = { enabled: s.showValues };
10796
- chart.update("none");
10797
- });
10798
- inject(DestroyRef).onDestroy(() => {
10799
- this.chart?.destroy();
10800
- this.chart = null;
10695
+ this.src();
10696
+ this.failed.set(false);
10801
10697
  });
10802
10698
  }
10699
+ onError() {
10700
+ if (!this.src()) return;
10701
+ this.failed.set(true);
10702
+ this.playbackError.emit();
10703
+ }
10803
10704
  static {
10804
10705
  this.ɵfac = i0.ɵɵngDeclareFactory({
10805
10706
  minVersion: "12.0.0",
10806
10707
  version: "22.2.2",
10807
10708
  ngImport: i0,
10808
- type: BarChartComponent,
10709
+ type: AudioPlayerComponent,
10809
10710
  deps: [],
10810
10711
  target: i0.ɵɵFactoryTarget.Component
10811
10712
  });
10812
10713
  }
10813
10714
  static {
10814
10715
  this.ɵcmp = i0.ɵɵngDeclareComponent({
10815
- minVersion: "17.2.0",
10716
+ minVersion: "17.0.0",
10816
10717
  version: "22.2.2",
10817
- type: BarChartComponent,
10718
+ type: AudioPlayerComponent,
10818
10719
  isStandalone: true,
10819
- selector: "ui-bar-chart",
10720
+ selector: "ui-audio-player",
10820
10721
  inputs: {
10821
- labels: {
10822
- classPropertyName: "labels",
10823
- publicName: "labels",
10824
- isSignal: true,
10825
- isRequired: false,
10826
- transformFunction: null
10827
- },
10828
- values: {
10829
- classPropertyName: "values",
10830
- publicName: "values",
10831
- isSignal: true,
10832
- isRequired: false,
10833
- transformFunction: null
10834
- },
10835
- color: {
10836
- classPropertyName: "color",
10837
- publicName: "color",
10838
- isSignal: true,
10839
- isRequired: false,
10840
- transformFunction: null
10841
- },
10842
- hoverColor: {
10843
- classPropertyName: "hoverColor",
10844
- publicName: "hoverColor",
10845
- isSignal: true,
10846
- isRequired: false,
10847
- transformFunction: null
10848
- },
10849
- height: {
10850
- classPropertyName: "height",
10851
- publicName: "height",
10722
+ src: {
10723
+ classPropertyName: "src",
10724
+ publicName: "src",
10852
10725
  isSignal: true,
10853
10726
  isRequired: false,
10854
10727
  transformFunction: null
@@ -10860,44 +10733,28 @@ var BarChartComponent = class BarChartComponent {
10860
10733
  isRequired: false,
10861
10734
  transformFunction: null
10862
10735
  },
10863
- showValues: {
10864
- classPropertyName: "showValues",
10865
- publicName: "showValues",
10866
- isSignal: true,
10867
- isRequired: false,
10868
- transformFunction: null
10869
- },
10870
- unitSingular: {
10871
- classPropertyName: "unitSingular",
10872
- publicName: "unitSingular",
10873
- isSignal: true,
10874
- isRequired: false,
10875
- transformFunction: null
10876
- },
10877
- unitPlural: {
10878
- classPropertyName: "unitPlural",
10879
- publicName: "unitPlural",
10736
+ preload: {
10737
+ classPropertyName: "preload",
10738
+ publicName: "preload",
10880
10739
  isSignal: true,
10881
10740
  isRequired: false,
10882
10741
  transformFunction: null
10883
10742
  }
10884
10743
  },
10885
- viewQueries: [{
10886
- propertyName: "canvas",
10887
- first: true,
10888
- predicate: ["canvas"],
10889
- descendants: true,
10890
- isSignal: true
10891
- }],
10744
+ outputs: { playbackError: "playbackError" },
10892
10745
  ngImport: i0,
10893
10746
  template: `
10894
- <div class="bc-wrap" [class.bc-default-height]="height() === 240" [style.height.px]="height()"
10895
- [attr.role]="ariaLabel() ? 'img' : null" [attr.aria-label]="ariaLabel() || null">
10896
- <canvas #canvas></canvas>
10897
- </div>
10747
+ @if (failed()) {
10748
+ <p class="ap-error" role="alert">Audio could not be played.</p>
10749
+ } @else {
10750
+ <audio class="ap-audio" controls [attr.preload]="preload()" [src]="src() || null" [attr.aria-label]="ariaLabel() || null"
10751
+ (error)="onError()">
10752
+ Your browser does not support the audio element.
10753
+ </audio>
10754
+ }
10898
10755
  `,
10899
10756
  isInline: true,
10900
- styles: [":host{display:block}.bc-wrap{position:relative}@media(max-width:768px){.bc-wrap.bc-default-height{height:200px!important}}@media(max-width:480px){.bc-wrap.bc-default-height{height:160px!important}}\n"],
10757
+ styles: [":host{display:block}.ap-audio{display:block;width:100%;height:40px;border-radius:8px;outline:none;accent-color:#3b82f6}.ap-audio:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.ap-error{margin:0;font-size:.8125rem;line-height:1.4;color:#dc2626}\n"],
10901
10758
  changeDetection: i0.ChangeDetectionStrategy.OnPush
10902
10759
  });
10903
10760
  }
@@ -10906,61 +10763,33 @@ i0.ɵɵngDeclareClassMetadata({
10906
10763
  minVersion: "12.0.0",
10907
10764
  version: "22.2.2",
10908
10765
  ngImport: i0,
10909
- type: BarChartComponent,
10766
+ type: AudioPlayerComponent,
10910
10767
  decorators: [{
10911
10768
  type: Component,
10912
10769
  args: [{
10913
- selector: "ui-bar-chart",
10770
+ selector: "ui-audio-player",
10914
10771
  standalone: true,
10915
10772
  changeDetection: ChangeDetectionStrategy.OnPush,
10916
10773
  template: `
10917
- <div class="bc-wrap" [class.bc-default-height]="height() === 240" [style.height.px]="height()"
10918
- [attr.role]="ariaLabel() ? 'img' : null" [attr.aria-label]="ariaLabel() || null">
10919
- <canvas #canvas></canvas>
10920
- </div>
10774
+ @if (failed()) {
10775
+ <p class="ap-error" role="alert">Audio could not be played.</p>
10776
+ } @else {
10777
+ <audio class="ap-audio" controls [attr.preload]="preload()" [src]="src() || null" [attr.aria-label]="ariaLabel() || null"
10778
+ (error)="onError()">
10779
+ Your browser does not support the audio element.
10780
+ </audio>
10781
+ }
10921
10782
  `,
10922
- styles: [":host{display:block}.bc-wrap{position:relative}@media(max-width:768px){.bc-wrap.bc-default-height{height:200px!important}}@media(max-width:480px){.bc-wrap.bc-default-height{height:160px!important}}\n"]
10783
+ styles: [":host{display:block}.ap-audio{display:block;width:100%;height:40px;border-radius:8px;outline:none;accent-color:#3b82f6}.ap-audio:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.ap-error{margin:0;font-size:.8125rem;line-height:1.4;color:#dc2626}\n"]
10923
10784
  }]
10924
10785
  }],
10925
10786
  ctorParameters: () => [],
10926
10787
  propDecorators: {
10927
- labels: [{
10928
- type: i0.Input,
10929
- args: [{
10930
- isSignal: true,
10931
- alias: "labels",
10932
- required: false
10933
- }]
10934
- }],
10935
- values: [{
10936
- type: i0.Input,
10937
- args: [{
10938
- isSignal: true,
10939
- alias: "values",
10940
- required: false
10941
- }]
10942
- }],
10943
- color: [{
10944
- type: i0.Input,
10945
- args: [{
10946
- isSignal: true,
10947
- alias: "color",
10948
- required: false
10949
- }]
10950
- }],
10951
- hoverColor: [{
10952
- type: i0.Input,
10953
- args: [{
10954
- isSignal: true,
10955
- alias: "hoverColor",
10956
- required: false
10957
- }]
10958
- }],
10959
- height: [{
10788
+ src: [{
10960
10789
  type: i0.Input,
10961
10790
  args: [{
10962
10791
  isSignal: true,
10963
- alias: "height",
10792
+ alias: "src",
10964
10793
  required: false
10965
10794
  }]
10966
10795
  }],
@@ -10972,33 +10801,17 @@ i0.ɵɵngDeclareClassMetadata({
10972
10801
  required: false
10973
10802
  }]
10974
10803
  }],
10975
- showValues: [{
10804
+ preload: [{
10976
10805
  type: i0.Input,
10977
10806
  args: [{
10978
10807
  isSignal: true,
10979
- alias: "showValues",
10808
+ alias: "preload",
10980
10809
  required: false
10981
10810
  }]
10982
10811
  }],
10983
- unitSingular: [{
10984
- type: i0.Input,
10985
- args: [{
10986
- isSignal: true,
10987
- alias: "unitSingular",
10988
- required: false
10989
- }]
10990
- }],
10991
- unitPlural: [{
10992
- type: i0.Input,
10993
- args: [{
10994
- isSignal: true,
10995
- alias: "unitPlural",
10996
- required: false
10997
- }]
10998
- }],
10999
- canvas: [{
11000
- type: i0.ViewChild,
11001
- args: ["canvas", { isSignal: true }]
10812
+ playbackError: [{
10813
+ type: i0.Output,
10814
+ args: ["playbackError"]
11002
10815
  }]
11003
10816
  }
11004
10817
  });
@@ -28356,6 +28169,6 @@ i0.ɵɵngDeclareClassMetadata({
28356
28169
  }]
28357
28170
  }
28358
28171
  });
28359
- export { AlertComponent, AppShellComponent, AvatarComponent, BADGE_VARIANT_STYLES, BadgeComponent, BarChartComponent, BulkMessagePanelComponent, ButtonComponent, CheckboxComponent, ChipComponent, ChipGroupComponent, ColumnFilterComponent, ComboboxComponent, ConfirmOutletComponent, ConfirmService, ContactPickerComponent, DEFAULT_DOCUMENT_SUBJECT, DOCUMENT_PURPOSE_OPTIONS, DROPDOWN_GROUP, DataTableComponent, DateInputComponent, DateRangePickerComponent, DatetimeInputComponent, DetailCardComponent, DiscountSelectorComponent, DividerComponent, DocumentSendOptionsComponent, DropdownComponent, EmptyStateComponent, ErrorComponent, ErrorStateComponent, FORGEROUTE_CONFIG, FileInputComponent, FormRowComponent, FormSectionComponent, HintComponent, ImagePreviewComponent, ImageRepositionComponent, ImportExportComponent, KpiCardComponent, ListItemComponent, MAX_CC, ModalComponent, MoreMenuComponent, MultiSelectComponent, PaginationComponent, PanelInfoListComponent, PillTabsComponent, ProgressBarComponent, QrCodeComponent, QuickFilterTabsComponent, RICH_TEXT_OPTIONS, RadioComponent, RadioGroupComponent, RadioMatrixComponent, RichTextEditorComponent, SEMANTIC_BADGE_MAP, SearchInputComponent, SelectComponent, SendMessagePanelComponent, SidePanelComponent, SkeletonComponent, TableToolbarComponent, TemplatePickerComponent, TextInputComponent, TextareaInputComponent, TimeInputComponent, ToastComponent, ToastService, ToggleBadgeComponent, TooltipDirective, US_STATES, UiFieldValidity, VideoPickerComponent, appShellGroupsStorageKey, autoVariant, builtInActionIcon, createFieldReveal, decodeFilterValues, encodeFilterValue, encodeFilterValues, errorContextInterceptor, formatIsoDate, formatIsoDateTime, formatTime, getEligibleIds, getEligibleOptions, getErrorMessage, humanReadableMessage, isoKey, issueToErrors, maxLengthIssue, messagePreviewHtml, parseCcList, parseIso, parseTime, pluralize, requiredIssue, resolvePreset, suggestDocumentSubject };
28172
+ export { AlertComponent, AppShellComponent, AudioPlayerComponent, AvatarComponent, BADGE_VARIANT_STYLES, BadgeComponent, BulkMessagePanelComponent, ButtonComponent, CheckboxComponent, ChipComponent, ChipGroupComponent, ColumnFilterComponent, ComboboxComponent, ConfirmOutletComponent, ConfirmService, ContactPickerComponent, DEFAULT_DOCUMENT_SUBJECT, DOCUMENT_PURPOSE_OPTIONS, DROPDOWN_GROUP, DataTableComponent, DateInputComponent, DateRangePickerComponent, DatetimeInputComponent, DetailCardComponent, DiscountSelectorComponent, DividerComponent, DocumentSendOptionsComponent, DropdownComponent, EmptyStateComponent, ErrorComponent, ErrorStateComponent, FORGEROUTE_CONFIG, FileInputComponent, FormRowComponent, FormSectionComponent, HintComponent, ImagePreviewComponent, ImageRepositionComponent, ImportExportComponent, KpiCardComponent, ListItemComponent, MAX_CC, ModalComponent, MoreMenuComponent, MultiSelectComponent, PaginationComponent, PanelInfoListComponent, PillTabsComponent, ProgressBarComponent, QrCodeComponent, QuickFilterTabsComponent, RICH_TEXT_OPTIONS, RadioComponent, RadioGroupComponent, RadioMatrixComponent, RichTextEditorComponent, SEMANTIC_BADGE_MAP, SearchInputComponent, SelectComponent, SendMessagePanelComponent, SidePanelComponent, SkeletonComponent, TableToolbarComponent, TemplatePickerComponent, TextInputComponent, TextareaInputComponent, TimeInputComponent, ToastComponent, ToastService, ToggleBadgeComponent, TooltipDirective, US_STATES, UiFieldValidity, VideoPickerComponent, appShellGroupsStorageKey, autoVariant, builtInActionIcon, createFieldReveal, decodeFilterValues, encodeFilterValue, encodeFilterValues, errorContextInterceptor, formatIsoDate, formatIsoDateTime, formatTime, getEligibleIds, getEligibleOptions, getErrorMessage, humanReadableMessage, isoKey, issueToErrors, maxLengthIssue, messagePreviewHtml, parseCcList, parseIso, parseTime, pluralize, requiredIssue, resolvePreset, suggestDocumentSubject };
28360
28173
 
28361
28174
  //# sourceMappingURL=forgeroute-ui.mjs.map