@dereekb/dbx-web 9.24.9 → 9.24.11

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.
@@ -5,7 +5,7 @@ import { BehaviorSubject, map, combineLatest, distinctUntilChanged, shareReplay,
5
5
  import * as i1$1 from '@angular/material/snack-bar';
6
6
  import { MAT_SNACK_BAR_DATA, MatSnackBarModule } from '@angular/material/snack-bar';
7
7
  import * as i1$2 from '@dereekb/dbx-core';
8
- import { AbstractSubscriptionDirective, safeMarkForCheck, AbstractDbxButtonDirective, provideDbxButton, DbxCoreButtonModule, AbstractTransitionWatcherDirective, AbstractDbxActionValueOnTriggerDirective, safeDetectChanges, DbxInjectionComponentModule, AbstractDbxActionHandlerDirective, provideActionStoreSource, AbstractDbxAnchorDirective, expandClickableAnchorLinkTrees, AbstractTransitionDirective, tapDetectChanges, AbstractIfDirective, DbxCoreFilterModule, asSegueRef, isSegueRefActive, DBX_INJECTION_COMPONENT_DATA, checkNgContentWrapperHasContent, anchorTypeForAnchor, AnchorType, DbxCoreActionModule, isIdleActionState, canTriggerAction, onDbxAppAuth, SimpleStorageAccessorFactory } from '@dereekb/dbx-core';
8
+ import { AbstractSubscriptionDirective, safeMarkForCheck, AbstractDbxButtonDirective, provideDbxButton, DbxCoreButtonModule, AbstractTransitionWatcherDirective, AbstractDbxActionValueOnTriggerDirective, safeDetectChanges, DbxInjectionComponentModule, AbstractDbxActionHandlerDirective, provideActionStoreSource, isClickableFilterPreset, AbstractDbxAnchorDirective, expandClickableAnchorLinkTrees, AbstractTransitionDirective, tapDetectChanges, AbstractIfDirective, DbxCoreFilterModule, asSegueRef, isSegueRefActive, DBX_INJECTION_COMPONENT_DATA, checkNgContentWrapperHasContent, anchorTypeForAnchor, AnchorType, DbxCoreActionModule, isIdleActionState, canTriggerAction, onDbxAppAuth, SimpleStorageAccessorFactory } from '@dereekb/dbx-core';
9
9
  import ms from 'ms';
10
10
  import * as i1 from '@angular/common';
11
11
  import { CommonModule } from '@angular/common';
@@ -2281,18 +2281,41 @@ class AbstractDbxPresetFilterMenuComponent {
2281
2281
  //TODO: Rename to AbstractDbxPresetFilterMenuDirective with next breaking changes
2282
2282
  this._presets = new BehaviorSubject([]);
2283
2283
  this.selected$ = this.filterSourceDirective.filter$.pipe(startWith(undefined), distinctUntilChanged(), shareReplay(1));
2284
+ this.presetsWithPresetStringOnly$ = this._presets.pipe(map((x) => x.filter((y) => Boolean(y.preset))));
2284
2285
  this.selectedPresetString$ = this.selected$.pipe(map((selectedFilter) => (selectedFilter ? selectedFilter.preset : undefined)), distinctUntilChanged());
2285
- this.presetAnchors$ = combineLatest([this._presets, this.selectedPresetString$]).pipe(map(([presets, selectedPresetString]) => {
2286
- return presets.map((x) => ({
2287
- ...x,
2288
- selected: x.preset === selectedPresetString,
2289
- onClick: () => {
2290
- this.selectPreset(x);
2286
+ this.presetAnchorsPairs$ = combineLatest([this._presets, this.selected$, this.selectedPresetString$]).pipe(map(([presets, currentFilterValue, selectedPresetString]) => {
2287
+ return presets.map((x) => {
2288
+ let selected;
2289
+ let type;
2290
+ if (isClickableFilterPreset(x)) {
2291
+ selected = x.preset === selectedPresetString;
2292
+ type = 'preset';
2291
2293
  }
2292
- }));
2294
+ else {
2295
+ selected = x.isActive(currentFilterValue);
2296
+ type = 'partialPreset';
2297
+ }
2298
+ return [
2299
+ type,
2300
+ x,
2301
+ {
2302
+ ...x,
2303
+ selected,
2304
+ onClick: () => {
2305
+ this.selectPreset(x);
2306
+ }
2307
+ }
2308
+ ];
2309
+ });
2310
+ }), shareReplay(1));
2311
+ this.presetAnchors$ = this.presetAnchorsPairs$.pipe(map((x) => x.map((x) => x[2])), shareReplay(1));
2312
+ this.firstSelectedAnchorPair$ = this.presetAnchorsPairs$.pipe(map((presets) => {
2313
+ const firstSelected = presets.find((x) => x[2].selected);
2314
+ return firstSelected ? firstSelected : undefined;
2293
2315
  }), shareReplay(1));
2294
- this.selectedPreset$ = combineLatest([this._presets, this.selectedPresetString$]).pipe(map(([presets, selectedPresetString]) => {
2295
- return selectedPresetString != null ? presets.find((x) => x.preset === selectedPresetString) : undefined;
2316
+ this.selectedPreset$ = this.presetAnchorsPairs$.pipe(map((presets) => {
2317
+ const firstSelected = presets.filter((x) => x[0] === 'preset').find((x) => x[2].selected);
2318
+ return firstSelected ? firstSelected[1] : undefined;
2296
2319
  }), shareReplay(1));
2297
2320
  }
2298
2321
  get presets() {
@@ -2302,18 +2325,19 @@ class AbstractDbxPresetFilterMenuComponent {
2302
2325
  this._presets.next(presets);
2303
2326
  }
2304
2327
  selectPreset(preset) {
2305
- const presetValue = preset.presetValue;
2328
+ const presetString = preset.preset;
2329
+ const presetValue = preset.presetValue || preset.partialPresetValue;
2306
2330
  if (presetValue == null || (typeof presetValue !== 'function' && objectHasNoKeys(presetValue))) {
2307
2331
  // set and then reset if the value is null or empty
2308
2332
  this.filterSourceDirective.setFilter((presetValue ?? {}));
2309
2333
  this.filterSourceDirective.resetFilter();
2310
2334
  }
2311
2335
  else {
2312
- let filter = getValueFromGetter(preset.presetValue);
2313
- if (filter.preset !== preset.preset) {
2336
+ let filter = getValueFromGetter(presetValue);
2337
+ if (filter.preset !== presetString) {
2314
2338
  filter = {
2315
2339
  ...filter,
2316
- preset: preset.preset
2340
+ preset: presetString
2317
2341
  };
2318
2342
  }
2319
2343
  this.filterSourceDirective.setFilter(filter);
@@ -5998,15 +6022,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
5998
6022
  class DbxLinkifyComponent {
5999
6023
  constructor(sanitizer) {
6000
6024
  this.sanitizer = sanitizer;
6001
- this._text = new BehaviorSubject('');
6002
- this.linkifiedText$ = this._text.pipe(distinctUntilChanged(), map((x) => linkifyStr(x, {
6003
- defaultProtocol: 'https',
6004
- target: {
6005
- url: '_blank'
6006
- }
6007
- })), shareReplay(1));
6025
+ this._text = new BehaviorSubject(undefined);
6026
+ this.linkifiedText$ = this._text.pipe(distinctUntilChanged(), map((x) => x
6027
+ ? linkifyStr(x, {
6028
+ defaultProtocol: 'https',
6029
+ target: {
6030
+ url: '_blank'
6031
+ }
6032
+ })
6033
+ : undefined), shareReplay(1));
6008
6034
  this.linkifiedBody$ = this.linkifiedText$.pipe(map((x) => {
6009
- return this.sanitizer.bypassSecurityTrustHtml(x);
6035
+ return x ? this.sanitizer.bypassSecurityTrustHtml(x) : undefined;
6010
6036
  }), shareReplay(1));
6011
6037
  }
6012
6038
  ngOnDestroy() {
@@ -6020,16 +6046,19 @@ class DbxLinkifyComponent {
6020
6046
  }
6021
6047
  }
6022
6048
  DbxLinkifyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxLinkifyComponent, deps: [{ token: i1$9.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
6023
- DbxLinkifyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxLinkifyComponent, selector: "dbx-linkify", inputs: { text: "text" }, ngImport: i0, template: `
6024
- <span class="dbx-linkify" [innerHTML]="linkifiedBody$ | async"></span>
6049
+ DbxLinkifyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: DbxLinkifyComponent, selector: "dbx-linkify", inputs: { text: "text" }, host: { classAttribute: "dbx-i dbx-linkify" }, ngImport: i0, template: `
6050
+ <span [innerHTML]="linkifiedBody$ | async"></span>
6025
6051
  `, isInline: true, dependencies: [{ kind: "pipe", type: i1.AsyncPipe, name: "async" }] });
6026
6052
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DbxLinkifyComponent, decorators: [{
6027
6053
  type: Component,
6028
6054
  args: [{
6029
6055
  selector: 'dbx-linkify',
6030
6056
  template: `
6031
- <span class="dbx-linkify" [innerHTML]="linkifiedBody$ | async"></span>
6032
- `
6057
+ <span [innerHTML]="linkifiedBody$ | async"></span>
6058
+ `,
6059
+ host: {
6060
+ class: 'dbx-i dbx-linkify'
6061
+ }
6033
6062
  }]
6034
6063
  }], ctorParameters: function () { return [{ type: i1$9.DomSanitizer }]; }, propDecorators: { text: [{
6035
6064
  type: Input