@ethlete/query 4.2.0 → 4.2.1

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 (67) hide show
  1. package/esm2022/lib/directives/infinity-query-trigger.directive.mjs +55 -0
  2. package/esm2022/lib/directives/infinity-query.directive.mjs +176 -0
  3. package/esm2022/lib/directives/query.directive.mjs +113 -0
  4. package/esm2022/lib/query-form/query-form.mjs +173 -0
  5. package/{esm2020 → esm2022}/lib/query-form/query-form.types.mjs +1 -1
  6. package/{fesm2020 → fesm2022}/ethlete-query.mjs +32 -16
  7. package/{fesm2020 → fesm2022}/ethlete-query.mjs.map +1 -1
  8. package/lib/auth/bearer-auth-provider.d.ts +3 -3
  9. package/lib/directives/infinity-query-trigger.directive.d.ts +1 -1
  10. package/lib/directives/infinity-query.directive.d.ts +1 -1
  11. package/lib/directives/query.directive.d.ts +1 -1
  12. package/lib/query/query.utils.d.ts +12 -8
  13. package/lib/query-form/query-form.d.ts +11 -8
  14. package/lib/query-form/query-form.types.d.ts +4 -0
  15. package/package.json +8 -14
  16. package/esm2020/lib/directives/infinity-query-trigger.directive.mjs +0 -54
  17. package/esm2020/lib/directives/infinity-query.directive.mjs +0 -175
  18. package/esm2020/lib/directives/query.directive.mjs +0 -112
  19. package/esm2020/lib/query-form/query-form.mjs +0 -157
  20. package/fesm2015/ethlete-query.mjs +0 -2273
  21. package/fesm2015/ethlete-query.mjs.map +0 -1
  22. /package/{esm2020 → esm2022}/ethlete-query.mjs +0 -0
  23. /package/{esm2020 → esm2022}/index.mjs +0 -0
  24. /package/{esm2020 → esm2022}/lib/auth/auth-provider.types.mjs +0 -0
  25. /package/{esm2020 → esm2022}/lib/auth/auth-provider.utils.mjs +0 -0
  26. /package/{esm2020 → esm2022}/lib/auth/basic-auth-provider.mjs +0 -0
  27. /package/{esm2020 → esm2022}/lib/auth/bearer-auth-provider.mjs +0 -0
  28. /package/{esm2020 → esm2022}/lib/auth/custom-header-auth-provider.mjs +0 -0
  29. /package/{esm2020 → esm2022}/lib/auth/index.mjs +0 -0
  30. /package/{esm2020 → esm2022}/lib/directives/index.mjs +0 -0
  31. /package/{esm2020 → esm2022}/lib/entity/entity-store.mjs +0 -0
  32. /package/{esm2020 → esm2022}/lib/entity/entity.types.mjs +0 -0
  33. /package/{esm2020 → esm2022}/lib/entity/entity.utils.mjs +0 -0
  34. /package/{esm2020 → esm2022}/lib/entity/index.mjs +0 -0
  35. /package/{esm2020 → esm2022}/lib/gql/gql.mjs +0 -0
  36. /package/{esm2020 → esm2022}/lib/gql/index.mjs +0 -0
  37. /package/{esm2020 → esm2022}/lib/infinite-query/index.mjs +0 -0
  38. /package/{esm2020 → esm2022}/lib/infinite-query/infinity-query.mjs +0 -0
  39. /package/{esm2020 → esm2022}/lib/infinite-query/infinity-query.types.mjs +0 -0
  40. /package/{esm2020 → esm2022}/lib/infinite-query/infinity-query.utils.mjs +0 -0
  41. /package/{esm2020 → esm2022}/lib/logger/index.mjs +0 -0
  42. /package/{esm2020 → esm2022}/lib/logger/logger.mjs +0 -0
  43. /package/{esm2020 → esm2022}/lib/query/index.mjs +0 -0
  44. /package/{esm2020 → esm2022}/lib/query/query.mjs +0 -0
  45. /package/{esm2020 → esm2022}/lib/query/query.types.mjs +0 -0
  46. /package/{esm2020 → esm2022}/lib/query/query.utils.mjs +0 -0
  47. /package/{esm2020 → esm2022}/lib/query-client/index.mjs +0 -0
  48. /package/{esm2020 → esm2022}/lib/query-client/query-client.mjs +0 -0
  49. /package/{esm2020 → esm2022}/lib/query-client/query-client.types.mjs +0 -0
  50. /package/{esm2020 → esm2022}/lib/query-client/query-client.utils.mjs +0 -0
  51. /package/{esm2020 → esm2022}/lib/query-creator/index.mjs +0 -0
  52. /package/{esm2020 → esm2022}/lib/query-creator/query-creator.mjs +0 -0
  53. /package/{esm2020 → esm2022}/lib/query-creator/query-creator.types.mjs +0 -0
  54. /package/{esm2020 → esm2022}/lib/query-form/index.mjs +0 -0
  55. /package/{esm2020 → esm2022}/lib/query-form/query-form.utils.mjs +0 -0
  56. /package/{esm2020 → esm2022}/lib/query-store/index.mjs +0 -0
  57. /package/{esm2020 → esm2022}/lib/query-store/query-store.mjs +0 -0
  58. /package/{esm2020 → esm2022}/lib/request/index.mjs +0 -0
  59. /package/{esm2020 → esm2022}/lib/request/request.mjs +0 -0
  60. /package/{esm2020 → esm2022}/lib/request/request.types.mjs +0 -0
  61. /package/{esm2020 → esm2022}/lib/request/request.util.mjs +0 -0
  62. /package/{esm2020 → esm2022}/lib/symfony/index.mjs +0 -0
  63. /package/{esm2020 → esm2022}/lib/symfony/symfony.types.mjs +0 -0
  64. /package/{esm2020 → esm2022}/lib/symfony/symfony.utils.mjs +0 -0
  65. /package/{esm2020 → esm2022}/lib/utils/deep-freeze.util.mjs +0 -0
  66. /package/{esm2020 → esm2022}/lib/utils/def.util.mjs +0 -0
  67. /package/{esm2020 → esm2022}/lib/utils/index.mjs +0 -0
@@ -1243,10 +1243,10 @@ class QueryDirective {
1243
1243
  this._viewContainerRef.createEmbeddedView(this._mainTemplateRef, this._viewContext);
1244
1244
  }
1245
1245
  }
1246
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: QueryDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ErrorHandler }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1247
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: QueryDirective, isStandalone: true, selector: "[etQuery]", inputs: { query: ["etQuery", "query"], cache: ["etQueryCache", "cache"] }, ngImport: i0 }); }
1246
1248
  }
1247
- QueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: QueryDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }, { token: i0.ErrorHandler }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1248
- QueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: QueryDirective, isStandalone: true, selector: "[etQuery]", inputs: { query: ["etQuery", "query"], cache: ["etQueryCache", "cache"] }, ngImport: i0 });
1249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: QueryDirective, decorators: [{
1249
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: QueryDirective, decorators: [{
1250
1250
  type: Directive,
1251
1251
  args: [{
1252
1252
  // eslint-disable-next-line @angular-eslint/directive-selector
@@ -1572,10 +1572,10 @@ class InfinityQueryDirective {
1572
1572
  this._viewContext.currentQuery = null;
1573
1573
  this._data$.next([]);
1574
1574
  }
1575
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: InfinityQueryDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1576
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: InfinityQueryDirective, isStandalone: true, selector: "[etInfinityQuery]", inputs: { infinityQuery: ["etInfinityQuery", "infinityQuery"] }, providers: [{ provide: INFINITY_QUERY_TOKEN, useExisting: InfinityQueryDirective }, DestroyService], exportAs: ["etInfinityQuery"], hostDirectives: [{ directive: i1.DelayableDirective }], ngImport: i0 }); }
1575
1577
  }
1576
- InfinityQueryDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: InfinityQueryDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1577
- InfinityQueryDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: InfinityQueryDirective, isStandalone: true, selector: "[etInfinityQuery]", inputs: { infinityQuery: ["etInfinityQuery", "infinityQuery"] }, providers: [{ provide: INFINITY_QUERY_TOKEN, useExisting: InfinityQueryDirective }, DestroyService], exportAs: ["etInfinityQuery"], hostDirectives: [{ directive: i1.DelayableDirective }], ngImport: i0 });
1578
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: InfinityQueryDirective, decorators: [{
1578
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: InfinityQueryDirective, decorators: [{
1579
1579
  type: Directive,
1580
1580
  args: [{
1581
1581
  // eslint-disable-next-line @angular-eslint/directive-selector
@@ -1626,10 +1626,10 @@ class InfinityQueryTriggerDirective {
1626
1626
  });
1627
1627
  this._observer.observe(this._elementRef.nativeElement);
1628
1628
  }
1629
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: InfinityQueryTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1630
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: InfinityQueryTriggerDirective, isStandalone: true, selector: "[etInfinityQueryTrigger], et-infinity-query-trigger", inputs: { scrollContainerSelector: "scrollContainerSelector" }, ngImport: i0 }); }
1629
1631
  }
1630
- InfinityQueryTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: InfinityQueryTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1631
- InfinityQueryTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: InfinityQueryTriggerDirective, isStandalone: true, selector: "[etInfinityQueryTrigger], et-infinity-query-trigger", inputs: { scrollContainerSelector: "scrollContainerSelector" }, ngImport: i0 });
1632
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: InfinityQueryTriggerDirective, decorators: [{
1632
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: InfinityQueryTriggerDirective, decorators: [{
1633
1633
  type: Directive,
1634
1634
  args: [{
1635
1635
  // eslint-disable-next-line @angular-eslint/directive-selector
@@ -2026,19 +2026,33 @@ class QueryField {
2026
2026
  }
2027
2027
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2028
2028
  class QueryForm {
2029
+ get _formValue() {
2030
+ return this.form.getRawValue();
2031
+ }
2032
+ get controls() {
2033
+ return this.form.controls;
2034
+ }
2035
+ get value() {
2036
+ return this._changes$.value.currentValue;
2037
+ }
2029
2038
  constructor(_fields) {
2030
2039
  this._fields = _fields;
2031
2040
  this._router = inject(Router, { optional: true });
2032
2041
  this._activatedRoute = inject(ActivatedRoute, { optional: true });
2033
2042
  this._defaultValues = this._extractDefaultValues();
2034
2043
  this.form = this._setupFormGroup();
2044
+ this._changes$ = new BehaviorSubject({
2045
+ previousValue: null,
2046
+ currentValue: this.form.getRawValue(),
2047
+ });
2048
+ this.changes$ = this._changes$.asObservable();
2035
2049
  }
2036
2050
  observe(options) {
2037
- return combineLatest(Object.values(this._fields).map((field) => field.changes$)).pipe(map(() => this.form.getRawValue()), distinctUntilChanged((a, b) => equal(a, b)), tap((values) => {
2051
+ return combineLatest(Object.values(this._fields).map((field) => field.changes$)).pipe(map(() => this._formValue), distinctUntilChanged((a, b) => equal(a, b)), tap((values) => {
2038
2052
  if (options?.syncViaUrlQueryParams !== false) {
2039
2053
  this._syncViaUrlQueryParams(values);
2040
2054
  }
2041
- }), pairwise(), startWith([null, this.form.getRawValue()]), map(([previousValue, currentValue]) => ({ previousValue, currentValue })), map(({ previousValue, currentValue }) => {
2055
+ }), pairwise(), startWith([null, this._formValue]), map(([previousValue, currentValue]) => ({ previousValue, currentValue })), tap(({ previousValue, currentValue }) => {
2042
2056
  let didResetValues = false;
2043
2057
  for (const formFieldKey in this._fields) {
2044
2058
  const resets = this._fields[formFieldKey].data.isResetBy;
@@ -2066,11 +2080,13 @@ class QueryForm {
2066
2080
  }
2067
2081
  }
2068
2082
  }
2069
- return (didResetValues || {
2070
- previousValue,
2071
- currentValue,
2072
- });
2073
- }), filter((value) => value !== true));
2083
+ if (!didResetValues) {
2084
+ this._changes$.next({
2085
+ previousValue,
2086
+ currentValue,
2087
+ });
2088
+ }
2089
+ }), shareReplay({ bufferSize: 1, refCount: true }), map(() => null));
2074
2090
  }
2075
2091
  setFormValueFromUrlQueryParams(options) {
2076
2092
  if (!this._activatedRoute) {