@forgeroute/ui 0.4.48 → 0.4.50

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.
@@ -11764,6 +11764,8 @@ var DataTableComponent = class DataTableComponent {
11764
11764
  }))];
11765
11765
  }, ...ngDevMode ? [{ debugName: "_effectiveTabs" }] : /* istanbul ignore next */ []);
11766
11766
  this._error = signal(null, ...ngDevMode ? [{ debugName: "_error" }] : /* istanbul ignore next */ []);
11767
+ this._loadFailed = signal(false, ...ngDevMode ? [{ debugName: "_loadFailed" }] : /* istanbul ignore next */ []);
11768
+ this.loadFailed = this._loadFailed.asReadonly();
11767
11769
  this._search = signal("", ...ngDevMode ? [{ debugName: "_search" }] : /* istanbul ignore next */ []);
11768
11770
  this._searchParam = computed(() => this._search().toLowerCase(), ...ngDevMode ? [{ debugName: "_searchParam" }] : /* istanbul ignore next */ []);
11769
11771
  this._page = signal(1, ...ngDevMode ? [{ debugName: "_page" }] : /* istanbul ignore next */ []);
@@ -12039,10 +12041,12 @@ var DataTableComponent = class DataTableComponent {
12039
12041
  for (const [key, vals] of Object.entries(cf)) if (vals.length > 0) params = params.set(key, encodeFilterValues(vals));
12040
12042
  return this.http.get(`${this.config.baseUrl}${this.endpoint()}`, { params }).pipe(catchError(() => {
12041
12043
  this._error.set("Something went wrong. Please try again.");
12044
+ this._loadFailed.set(true);
12042
12045
  return of(null);
12043
12046
  }));
12044
12047
  }), takeUntilDestroyed(this.destroyRef)).subscribe((response) => {
12045
12048
  if (response !== null) {
12049
+ this._loadFailed.set(false);
12046
12050
  const items = Array.isArray(response) ? response : response?.content ?? [];
12047
12051
  this._items.set(items);
12048
12052
  if (this._failedImages().size > 0) this._failedImages.set(/* @__PURE__ */ new Set());
@@ -33225,7 +33229,7 @@ var DateRangePickerComponent = class DateRangePickerComponent {
33225
33229
  this.popoverDismissed = linkedSignal({
33226
33230
  ...ngDevMode ? { debugName: "popoverDismissed" } : /* istanbul ignore next */ {},
33227
33231
  source: this.selectedPreset,
33228
- computation: () => false
33232
+ computation: (_, previous) => previous === void 0
33229
33233
  });
33230
33234
  this.popoverVisible = computed(() => this.showPresets() && this.selectedPreset() === "custom" && !this.popoverDismissed(), ...ngDevMode ? [{ debugName: "popoverVisible" }] : /* istanbul ignore next */ []);
33231
33235
  this.popTop = signal(0, ...ngDevMode ? [{ debugName: "popTop" }] : /* istanbul ignore next */ []);
@@ -33269,13 +33273,20 @@ var DateRangePickerComponent = class DateRangePickerComponent {
33269
33273
  this.popRight.set(Math.max(16, Math.round(document.documentElement.clientWidth - r.right)));
33270
33274
  }
33271
33275
  onDocumentClick(e) {
33272
- if (this.popoverVisible() && !this.host.nativeElement.contains(e.target)) this.popoverDismissed.set(true);
33276
+ if (this.popoverVisible() && !this.host.nativeElement.contains(e.target)) this.dismissWithoutApply();
33273
33277
  }
33274
33278
  onEscape(e) {
33275
33279
  if (!this.popoverVisible()) return;
33276
33280
  e.stopPropagation();
33281
+ this.dismissWithoutApply();
33282
+ }
33283
+ dismissWithoutApply() {
33284
+ this.selectedPreset.set(this.activePreset());
33277
33285
  this.popoverDismissed.set(true);
33278
33286
  }
33287
+ onPillsClick(e) {
33288
+ if ((e.target?.closest?.("[role=\"tab\"]"))?.getAttribute("aria-selected") === "true" && this.selectedPreset() === "custom" && this.popoverDismissed()) this.popoverDismissed.set(false);
33289
+ }
33279
33290
  selectPreset(key) {
33280
33291
  this.selectedPreset.set(key);
33281
33292
  this.popoverDismissed.set(false);
@@ -33347,7 +33358,7 @@ var DateRangePickerComponent = class DateRangePickerComponent {
33347
33358
  template: `
33348
33359
  <div class="date-range-picker">
33349
33360
  @if (showPresets()) {
33350
- <div class="pills" #pills>
33361
+ <div class="pills" #pills (click)="onPillsClick($event)">
33351
33362
  <ui-pill-tabs [tabs]="presetTabs()" [activeKey]="selectedPreset()" [ariaLabel]="ariaLabel()" [noWrap]="true" (tabChange)="selectPreset($any($event))" />
33352
33363
  </div>
33353
33364
  @if (popoverVisible()) {
@@ -33493,7 +33504,7 @@ i0.ɵɵngDeclareClassMetadata({
33493
33504
  template: `
33494
33505
  <div class="date-range-picker">
33495
33506
  @if (showPresets()) {
33496
- <div class="pills" #pills>
33507
+ <div class="pills" #pills (click)="onPillsClick($event)">
33497
33508
  <ui-pill-tabs [tabs]="presetTabs()" [activeKey]="selectedPreset()" [ariaLabel]="ariaLabel()" [noWrap]="true" (tabChange)="selectPreset($any($event))" />
33498
33509
  </div>
33499
33510
  @if (popoverVisible()) {
@@ -39791,6 +39802,24 @@ var CalendarComponent = class CalendarComponent {
39791
39802
  if (f && cells.some((c) => c.dateStr === f)) return f;
39792
39803
  return (cells.find((c) => c.isToday) ?? cells.find((c) => c.isCurrentMonth) ?? cells[0]).dateStr;
39793
39804
  }, ...ngDevMode ? [{ debugName: "focusDate" }] : /* istanbul ignore next */ []);
39805
+ this.pendingFocus = null;
39806
+ this.pendingSawLoading = false;
39807
+ this.host.nativeElement.addEventListener("pointerdown", () => {
39808
+ this.pendingFocus = null;
39809
+ });
39810
+ effect(() => {
39811
+ const loading = this.loading();
39812
+ if (!this.pendingFocus) return;
39813
+ if (loading) {
39814
+ this.pendingSawLoading = true;
39815
+ return;
39816
+ }
39817
+ if (!this.pendingSawLoading) return;
39818
+ const target = this.pendingFocus;
39819
+ this.pendingFocus = null;
39820
+ this.pendingSawLoading = false;
39821
+ afterNextRender(() => this.host.nativeElement.querySelector(`.month-cell[data-date="${target}"]`)?.focus(), { injector: this.injector });
39822
+ });
39794
39823
  effect(() => {
39795
39824
  const view = this.view();
39796
39825
  const views = this.views();
@@ -39891,6 +39920,7 @@ var CalendarComponent = class CalendarComponent {
39891
39920
  if (this.clickable(dateStr)) this.dateClick.emit(dateStr);
39892
39921
  }
39893
39922
  onCellKey(event, dateStr) {
39923
+ if (event.key !== "PageUp" && event.key !== "PageDown") this.pendingFocus = null;
39894
39924
  if (event.target !== event.currentTarget || event.altKey || event.ctrlKey || event.metaKey) return;
39895
39925
  if (event.key === "Enter" || event.key === " ") {
39896
39926
  event.preventDefault();
@@ -39924,8 +39954,13 @@ var CalendarComponent = class CalendarComponent {
39924
39954
  const target = new Date(y, m, Math.min(from.getDate(), new Date(y, m + 1, 0).getDate()));
39925
39955
  const targetStr = toDateStr(target);
39926
39956
  this.focusedDate.set(targetStr);
39957
+ this.pendingFocus = targetStr;
39958
+ this.pendingSawLoading = this.loading();
39927
39959
  this.anchorDate.set(target);
39928
- afterNextRender(() => this.host.nativeElement.querySelector(`.month-cell[data-date="${targetStr}"]`)?.focus(), { injector: this.injector });
39960
+ afterNextRender(() => {
39961
+ this.host.nativeElement.querySelector(`.month-cell[data-date="${targetStr}"]`)?.focus();
39962
+ if (!this.loading() && this.pendingFocus === targetStr) this.pendingFocus = null;
39963
+ }, { injector: this.injector });
39929
39964
  }
39930
39965
  onAddAllDay(dateStr, event) {
39931
39966
  event.stopPropagation();