@ngutil/data 0.0.19 → 0.0.24

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,11 +1,10 @@
1
- import { flattenDepth, isEqual, intersection, flattenDeep } from 'lodash';
2
- import * as i1 from '@ngutil/common';
3
- import { deepClone, deepFreeze, isPlainObject, toSorted } from '@ngutil/common';
4
- import { BehaviorSubject, Observable, combineLatest, map, shareReplay, take, of, ReplaySubject, switchMap, distinctUntilChanged, tap, debounceTime, finalize, Subject, takeUntil, share, Subscription, throwError } from 'rxjs';
5
- import { DataSource as DataSource$1 } from '@angular/cdk/collections';
6
1
  import * as i0 from '@angular/core';
7
- import { Directive, Optional, Input } from '@angular/core';
8
- import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
2
+ import { Directive, Input, inject, input, NgModule } from '@angular/core';
3
+ import { DataSource as DataSource$1 } from '@angular/cdk/collections';
4
+ import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
5
+ import { BehaviorSubject, Observable, combineLatest, map, shareReplay, take, of, ReplaySubject, switchMap, distinctUntilChanged, tap, debounceTime, finalize, Subject, takeUntil, throwError } from 'rxjs';
6
+ import { deepClone, deepFreeze, isPlainObject, toSorted, Busy } from '@ngutil/common';
7
+ import { flattenDepth, isEqual, intersection, flattenDeep } from 'lodash';
9
8
 
10
9
  function pathGetterCompile(path) {
11
10
  if (!path || path.length === 0) {
@@ -725,8 +724,11 @@ function sliceInsert(slice, array, newItems) {
725
724
  let result = array.slice(0, slice.start);
726
725
  result.length = slice.start;
727
726
  result = result.concat(newItems);
728
- result.length = slice.end;
729
- return result.concat(array.slice(slice.end));
727
+ if (!isNaN(slice.end) && isFinite(slice.end)) {
728
+ result.length = slice.end;
729
+ result = result.concat(array.slice(slice.end));
730
+ }
731
+ return result;
730
732
  }
731
733
  function sliceClamp(slice, constraint) {
732
734
  return {
@@ -829,129 +831,6 @@ function compileExec(input, prev, compiler) {
829
831
  return exec;
830
832
  }
831
833
 
832
- class ModelMeta {
833
- static coerce(value) {
834
- if (value instanceof ModelMeta) {
835
- return value;
836
- }
837
- else {
838
- return new ModelMeta(value);
839
- }
840
- }
841
- #getKey;
842
- constructor(props) {
843
- this.keys = props.keys;
844
- if (this.keys.length > 0) {
845
- const getters = this.keys.map(pathGetterCompile);
846
- if (props.trackBy == null) {
847
- this.trackBy = (index, item) => getters.map(p => p(item)).join("∀");
848
- }
849
- else {
850
- this.trackBy = props.trackBy;
851
- }
852
- this.#getKey = (item) => getters.map(p => p(item)).join("∀");
853
- }
854
- else {
855
- if (props.trackBy == null) {
856
- throw new Error("Can't compile track by function without `keys` declaration");
857
- }
858
- else {
859
- this.trackBy = props.trackBy;
860
- }
861
- }
862
- }
863
- isEqual(a, b) {
864
- return isEqual(a, b);
865
- }
866
- isEqualByTrack(a, b) {
867
- if (a == null || b == null) {
868
- return a == null && b == null;
869
- }
870
- if (a.index == null || b.index == null) {
871
- return a.index == null && b.index == null;
872
- }
873
- if (a.model == null || b.model == null) {
874
- return a.model == null && b.model == null;
875
- }
876
- return this.trackBy(a.index, a.model) === this.trackBy(b.index, b.model);
877
- }
878
- isEqualByKey(a, b) {
879
- if (this.#getKey != null) {
880
- if (a == null || b == null) {
881
- return a == null && b == null;
882
- }
883
- return this.#getKey(a) === this.#getKey(b);
884
- }
885
- console.warn("Primary keys is not defined for", a, b);
886
- return false;
887
- }
888
- normalizeRef(ref) {
889
- if (ref instanceof ModelRefNorm) {
890
- return ref;
891
- }
892
- if (ref.key != null && ref.index != null) {
893
- throw new Error("Only provide `pk` or `index` value not both");
894
- }
895
- if (ref.key != null) {
896
- const keyValue = (Array.isArray(ref.key) ? ref.key : [ref.key]);
897
- if (keyValue.length > 0) {
898
- if (this.keys.length === 0) {
899
- throw new Error("Can't normalize ref without `keys`");
900
- }
901
- if (keyValue.length !== this.keys.length) {
902
- throw new Error(`Wrong number of \`key\` values for this keys: [${this.keys.join(",")}]`);
903
- }
904
- return new ModelRefByKey(keyValue, this.keys);
905
- }
906
- else {
907
- console.warn("Empty key in ModelRef", ref);
908
- }
909
- }
910
- if (ref.index != null) {
911
- return new ModelRefByIndex(ref.index);
912
- }
913
- throw new Error("Missing `key` or `index` value");
914
- }
915
- }
916
- class ModelRefNorm {
917
- #filter;
918
- toFilter() {
919
- if (this.#filter == null) {
920
- return (this.#filter = this._asFilter());
921
- }
922
- return this.#filter;
923
- }
924
- }
925
- class ModelRefByKey extends ModelRefNorm {
926
- #keys;
927
- constructor(key, keys) {
928
- super();
929
- this.key = key;
930
- this.#keys = keys;
931
- }
932
- _asFilter() {
933
- const filter = {};
934
- for (let i = 0; i < this.#keys.length; i++) {
935
- filter[this.#keys[i]] = this.key[i];
936
- }
937
- return filterBy(filter);
938
- }
939
- }
940
- class ModelRefByIndex extends ModelRefNorm {
941
- constructor(index) {
942
- super();
943
- this.index = index;
944
- }
945
- _asFilter() {
946
- return (item, index) => this.index === index;
947
- }
948
- }
949
- class UnknownMeta extends ModelMeta {
950
- constructor() {
951
- super({ keys: [], trackBy: (index) => index });
952
- }
953
- }
954
-
955
834
  class CollectionStore {
956
835
  }
957
836
 
@@ -1133,6 +1012,21 @@ class DataSource extends DataSource$1 {
1133
1012
  }
1134
1013
  }
1135
1014
 
1015
+ class DataProvider {
1016
+ /**
1017
+ * Froce Slice boundaries, useful in array, or obeservable providers
1018
+ */
1019
+ clampSlice(slice) {
1020
+ return of(slice);
1021
+ }
1022
+ /**
1023
+ * @returns New data source instance
1024
+ */
1025
+ toDataSource(store) {
1026
+ return new DataSource(this, store);
1027
+ }
1028
+ }
1029
+
1136
1030
  /**
1137
1031
  * @example
1138
1032
  * ```html
@@ -1164,66 +1058,20 @@ class DataSource extends DataSource$1 {
1164
1058
  * ```
1165
1059
  */
1166
1060
  class DataSourceProxy extends DataSource$1 {
1167
- set value(value) {
1168
- this.#valueSub?.unsubscribe();
1169
- this.#valueSub = coerceDataSource(value)
1170
- .pipe(tap(v => {
1171
- if (v == null) {
1172
- throw new Error("Missing DataSource");
1173
- }
1174
- }))
1175
- .subscribe(this.#value);
1176
- }
1177
- #valueSub;
1178
- #value;
1179
- set forcedFilterInput(value) {
1180
- // this.query.filter.forced.update(value)
1181
- this.#filter.next(value);
1182
- }
1183
- #filter;
1184
- set forcedSorterInput(value) {
1185
- this.#sorter.next(value);
1186
- }
1187
- #sorter;
1188
- set forcedGrouperInput(value) {
1189
- this.#grouper.next(value);
1190
- }
1191
- #grouper;
1192
- set forcedSlimerInput(value) {
1193
- this.#slimer.next(value);
1194
- }
1195
- #slimer;
1196
- #subs;
1197
- constructor(busy) {
1198
- super();
1061
+ constructor() {
1062
+ super(...arguments);
1199
1063
  this.#value = new ReplaySubject(1);
1200
1064
  this.value$ = this.#value.pipe(takeUntilDestroyed());
1201
1065
  this.query$ = this.value$.pipe(map(value => value.query$), shareReplay(1));
1202
- this.items$ = this.value$.pipe(switchMap(value => value.items$), share());
1203
- this.busy$ = this.value$.pipe(switchMap(value => value.busy$), share());
1204
- this.isBusy = toSignal(this.busy$, { rejectErrors: true, initialValue: false });
1205
- this.#filter = new ReplaySubject(1);
1206
- this.#sorter = new ReplaySubject(1);
1207
- this.#grouper = new ReplaySubject(1);
1208
- this.#slimer = new ReplaySubject(1);
1209
- this.#subs = new Subscription();
1066
+ this.items$ = this.value$.pipe(switchMap(value => value.items$), shareReplay(1));
1210
1067
  this.#cvSubs = new Map();
1211
- if (busy != null) {
1212
- this.#subs.add(busy.connect(this.busy$).subscribe());
1213
- }
1214
- this.#subs.add(combineLatest({ query: this.query$, filter: this.#filter }).subscribe(({ query, filter }) => {
1215
- query.filter.forced.set(filter);
1216
- }));
1217
- this.#subs.add(combineLatest({ query: this.query$, sorter: this.#sorter }).subscribe(({ query, sorter }) => {
1218
- query.sorter.forced.set(sorter);
1219
- }));
1220
- this.#subs.add(combineLatest({ query: this.query$, grouper: this.#grouper }).subscribe(({ query, grouper }) => {
1221
- query.grouper.forced.set(grouper);
1222
- }));
1223
- this.#subs.add(combineLatest({ query: this.query$, slimer: this.#slimer }).subscribe(({ query, slimer }) => {
1224
- query.slimer.forced.set(slimer);
1225
- }));
1226
1068
  }
1069
+ set value(value) {
1070
+ this.#valueSub?.unsubscribe();
1071
+ this.#valueSub = coerceDataSource(value).subscribe(this.#value);
1072
+ }
1073
+ #valueSub;
1074
+ #value;
1227
1075
  #cvSubs;
1228
1076
  connect(collectionViewer) {
1229
1077
  const until = new Subject();
@@ -1238,10 +1086,9 @@ class DataSourceProxy extends DataSource$1 {
1238
1086
  ngOnDestroy() {
1239
1087
  this.#valueSub?.unsubscribe();
1240
1088
  this.#valueSub = undefined;
1241
- this.#subs.unsubscribe();
1242
1089
  }
1243
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxy, deps: [{ token: i1.Busy, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
1244
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.6", type: DataSourceProxy, isStandalone: true, selector: "[nuDataSource]", inputs: { value: ["nuDataSource", "value"], forcedFilterInput: "forcedFilterInput", forcedSorterInput: "forcedSorterInput", forcedGrouperInput: "forcedGrouperInput", forcedSlimerInput: "forcedSlimerInput" }, exportAs: ["nuDataSource"], usesInheritance: true, ngImport: i0 }); }
1090
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxy, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
1091
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.6", type: DataSourceProxy, isStandalone: true, selector: "[nuDataSource]", inputs: { value: ["nuDataSource", "value"] }, exportAs: ["nuDataSource"], usesInheritance: true, ngImport: i0 }); }
1245
1092
  }
1246
1093
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxy, decorators: [{
1247
1094
  type: Directive,
@@ -1250,20 +1097,109 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImpor
1250
1097
  selector: "[nuDataSource]",
1251
1098
  exportAs: "nuDataSource"
1252
1099
  }]
1253
- }], ctorParameters: () => [{ type: i1.Busy, decorators: [{
1254
- type: Optional
1255
- }] }], propDecorators: { value: [{
1100
+ }], propDecorators: { value: [{
1256
1101
  type: Input,
1257
1102
  args: [{ required: true, alias: "nuDataSource" }]
1258
- }], forcedFilterInput: [{
1259
- type: Input
1260
- }], forcedSorterInput: [{
1261
- type: Input
1262
- }], forcedGrouperInput: [{
1263
- type: Input
1264
- }], forcedSlimerInput: [{
1265
- type: Input
1266
1103
  }] } });
1104
+ class DataSourceProxyFilter {
1105
+ #proxy;
1106
+ constructor() {
1107
+ this.#proxy = inject(DataSourceProxy);
1108
+ this.filter = input.required();
1109
+ this.filter$ = toObservable(this.filter);
1110
+ combineLatest({ query: this.#proxy.query$, filter: this.filter$ })
1111
+ .pipe(takeUntilDestroyed())
1112
+ .subscribe(({ query, filter }) => query.filter.forced.set(filter));
1113
+ }
1114
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxyFilter, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1115
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "17.3.6", type: DataSourceProxyFilter, isStandalone: true, selector: "[nuDataSource][filter]", inputs: { filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
1116
+ }
1117
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxyFilter, decorators: [{
1118
+ type: Directive,
1119
+ args: [{
1120
+ standalone: true,
1121
+ selector: "[nuDataSource][filter]"
1122
+ }]
1123
+ }], ctorParameters: () => [] });
1124
+ class DataSourceProxySorter {
1125
+ #proxy;
1126
+ constructor() {
1127
+ this.#proxy = inject(DataSourceProxy);
1128
+ this.sorter = input.required();
1129
+ this.sorter$ = toObservable(this.sorter);
1130
+ combineLatest({ query: this.#proxy.query$, sorter: this.sorter$ })
1131
+ .pipe(takeUntilDestroyed())
1132
+ .subscribe(({ query, sorter }) => query.sorter.forced.set(sorter));
1133
+ }
1134
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxySorter, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1135
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "17.3.6", type: DataSourceProxySorter, isStandalone: true, selector: "[nuDataSource][sorter]", inputs: { sorter: { classPropertyName: "sorter", publicName: "sorter", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
1136
+ }
1137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxySorter, decorators: [{
1138
+ type: Directive,
1139
+ args: [{
1140
+ standalone: true,
1141
+ selector: "[nuDataSource][sorter]"
1142
+ }]
1143
+ }], ctorParameters: () => [] });
1144
+ class DataSourceProxySlimer {
1145
+ #proxy;
1146
+ constructor() {
1147
+ this.#proxy = inject(DataSourceProxy);
1148
+ this.slimer = input.required();
1149
+ this.slimer$ = toObservable(this.slimer);
1150
+ combineLatest({ query: this.#proxy.query$, slimer: this.slimer$ })
1151
+ .pipe(takeUntilDestroyed())
1152
+ .subscribe(({ query, slimer }) => query.slimer.forced.set(slimer));
1153
+ }
1154
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxySlimer, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1155
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "17.3.6", type: DataSourceProxySlimer, isStandalone: true, selector: "[nuDataSource][slimer]", inputs: { slimer: { classPropertyName: "slimer", publicName: "slimer", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
1156
+ }
1157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxySlimer, decorators: [{
1158
+ type: Directive,
1159
+ args: [{
1160
+ standalone: true,
1161
+ selector: "[nuDataSource][slimer]"
1162
+ }]
1163
+ }], ctorParameters: () => [] });
1164
+ class DataSourceProxyGrouper {
1165
+ #proxy;
1166
+ constructor() {
1167
+ this.#proxy = inject(DataSourceProxy);
1168
+ this.grouper = input.required();
1169
+ this.grouper$ = toObservable(this.grouper);
1170
+ combineLatest({ query: this.#proxy.query$, grouper: this.grouper$ })
1171
+ .pipe(takeUntilDestroyed())
1172
+ .subscribe(({ query, grouper }) => query.grouper.forced.set(grouper));
1173
+ }
1174
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxyGrouper, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1175
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "17.3.6", type: DataSourceProxyGrouper, isStandalone: true, selector: "[nuDataSource][grouper]", inputs: { grouper: { classPropertyName: "grouper", publicName: "grouper", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
1176
+ }
1177
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxyGrouper, decorators: [{
1178
+ type: Directive,
1179
+ args: [{
1180
+ standalone: true,
1181
+ selector: "[nuDataSource][grouper]"
1182
+ }]
1183
+ }], ctorParameters: () => [] });
1184
+ class DataSourceProxyBusy {
1185
+ #proxy;
1186
+ #busy;
1187
+ constructor() {
1188
+ this.#proxy = inject(DataSourceProxy);
1189
+ this.#busy = inject(Busy);
1190
+ this.busy$ = this.#proxy.value$.pipe(switchMap(value => value.busy$), shareReplay(1));
1191
+ this.#busy.connect(this.busy$).pipe(takeUntilDestroyed()).subscribe();
1192
+ }
1193
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxyBusy, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1194
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.6", type: DataSourceProxyBusy, isStandalone: true, selector: "[nuDataSource][nuBusy]", ngImport: i0 }); }
1195
+ }
1196
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceProxyBusy, decorators: [{
1197
+ type: Directive,
1198
+ args: [{
1199
+ standalone: true,
1200
+ selector: "[nuDataSource][nuBusy]"
1201
+ }]
1202
+ }], ctorParameters: () => [] });
1267
1203
  function coerceDataSource(value) {
1268
1204
  if (value instanceof DataSourceProxy) {
1269
1205
  return value.value$;
@@ -1279,18 +1215,126 @@ function coerceDataSource(value) {
1279
1215
  }
1280
1216
  }
1281
1217
 
1282
- class DataProvider {
1283
- /**
1284
- * Froce Slice boundaries, useful in array, or obeservable providers
1285
- */
1286
- clampSlice(slice) {
1287
- return of(slice);
1218
+ class ModelMeta {
1219
+ static coerce(value) {
1220
+ if (value instanceof ModelMeta) {
1221
+ return value;
1222
+ }
1223
+ else {
1224
+ return new ModelMeta(value);
1225
+ }
1288
1226
  }
1289
- /**
1290
- * @returns New data source instance
1291
- */
1292
- toDataSource(store) {
1293
- return new DataSource(this, store);
1227
+ #getKey;
1228
+ constructor(props) {
1229
+ this.keys = props.keys;
1230
+ if (this.keys.length > 0) {
1231
+ const getters = this.keys.map(pathGetterCompile);
1232
+ if (props.trackBy == null) {
1233
+ this.trackBy = (index, item) => getters.map(p => p(item)).join("∀");
1234
+ }
1235
+ else {
1236
+ this.trackBy = props.trackBy;
1237
+ }
1238
+ this.#getKey = (item) => getters.map(p => p(item)).join("∀");
1239
+ }
1240
+ else {
1241
+ if (props.trackBy == null) {
1242
+ throw new Error("Can't compile track by function without `keys` declaration");
1243
+ }
1244
+ else {
1245
+ this.trackBy = props.trackBy;
1246
+ }
1247
+ }
1248
+ }
1249
+ isEqual(a, b) {
1250
+ return isEqual(a, b);
1251
+ }
1252
+ isEqualByTrack(a, b) {
1253
+ if (a == null || b == null) {
1254
+ return a == null && b == null;
1255
+ }
1256
+ if (a.index == null || b.index == null) {
1257
+ return a.index == null && b.index == null;
1258
+ }
1259
+ if (a.model == null || b.model == null) {
1260
+ return a.model == null && b.model == null;
1261
+ }
1262
+ return this.trackBy(a.index, a.model) === this.trackBy(b.index, b.model);
1263
+ }
1264
+ isEqualByKey(a, b) {
1265
+ if (this.#getKey != null) {
1266
+ if (a == null || b == null) {
1267
+ return a == null && b == null;
1268
+ }
1269
+ return this.#getKey(a) === this.#getKey(b);
1270
+ }
1271
+ console.warn("Primary keys is not defined for", a, b);
1272
+ return false;
1273
+ }
1274
+ normalizeRef(ref) {
1275
+ if (ref instanceof ModelRefNorm) {
1276
+ return ref;
1277
+ }
1278
+ if (ref.key != null && ref.index != null) {
1279
+ throw new Error("Only provide `pk` or `index` value not both");
1280
+ }
1281
+ if (ref.key != null) {
1282
+ const keyValue = (Array.isArray(ref.key) ? ref.key : [ref.key]);
1283
+ if (keyValue.length > 0) {
1284
+ if (this.keys.length === 0) {
1285
+ throw new Error("Can't normalize ref without `keys`");
1286
+ }
1287
+ if (keyValue.length !== this.keys.length) {
1288
+ throw new Error(`Wrong number of \`key\` values for this keys: [${this.keys.join(",")}]`);
1289
+ }
1290
+ return new ModelRefByKey(keyValue, this.keys);
1291
+ }
1292
+ else {
1293
+ console.warn("Empty key in ModelRef", ref);
1294
+ }
1295
+ }
1296
+ if (ref.index != null) {
1297
+ return new ModelRefByIndex(ref.index);
1298
+ }
1299
+ throw new Error("Missing `key` or `index` value");
1300
+ }
1301
+ }
1302
+ class ModelRefNorm {
1303
+ #filter;
1304
+ toFilter() {
1305
+ if (this.#filter == null) {
1306
+ return (this.#filter = this._asFilter());
1307
+ }
1308
+ return this.#filter;
1309
+ }
1310
+ }
1311
+ class ModelRefByKey extends ModelRefNorm {
1312
+ #keys;
1313
+ constructor(key, keys) {
1314
+ super();
1315
+ this.key = key;
1316
+ this.#keys = keys;
1317
+ }
1318
+ _asFilter() {
1319
+ const filter = {};
1320
+ for (let i = 0; i < this.#keys.length; i++) {
1321
+ filter[this.#keys[i]] = this.key[i];
1322
+ }
1323
+ return filterBy(filter);
1324
+ }
1325
+ }
1326
+ class ModelRefByIndex extends ModelRefNorm {
1327
+ constructor(index) {
1328
+ super();
1329
+ this.index = index;
1330
+ }
1331
+ _asFilter() {
1332
+ return (item, index) => this.index === index;
1333
+ }
1334
+ }
1335
+ class UnknownMeta extends ModelMeta {
1336
+ constructor() {
1337
+ super({ keys: [], trackBy: (index) => index });
1294
1338
  }
1295
1339
  }
1296
1340
 
@@ -1333,9 +1377,46 @@ class ObservableProvider extends LocalProvider {
1333
1377
  }
1334
1378
  }
1335
1379
 
1380
+ class DataSourceModule {
1381
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1382
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.6", ngImport: i0, type: DataSourceModule, imports: [DataSourceProxy,
1383
+ DataSourceProxyBusy,
1384
+ DataSourceProxyFilter,
1385
+ DataSourceProxyGrouper,
1386
+ DataSourceProxySlimer,
1387
+ DataSourceProxySorter], exports: [DataSourceProxy,
1388
+ DataSourceProxyBusy,
1389
+ DataSourceProxyFilter,
1390
+ DataSourceProxyGrouper,
1391
+ DataSourceProxySlimer,
1392
+ DataSourceProxySorter] }); }
1393
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceModule }); }
1394
+ }
1395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: DataSourceModule, decorators: [{
1396
+ type: NgModule,
1397
+ args: [{
1398
+ imports: [
1399
+ DataSourceProxy,
1400
+ DataSourceProxyBusy,
1401
+ DataSourceProxyFilter,
1402
+ DataSourceProxyGrouper,
1403
+ DataSourceProxySlimer,
1404
+ DataSourceProxySorter
1405
+ ],
1406
+ exports: [
1407
+ DataSourceProxy,
1408
+ DataSourceProxyBusy,
1409
+ DataSourceProxyFilter,
1410
+ DataSourceProxyGrouper,
1411
+ DataSourceProxySlimer,
1412
+ DataSourceProxySorter
1413
+ ]
1414
+ }]
1415
+ }] });
1416
+
1336
1417
  /**
1337
1418
  * Generated bundle index. Do not edit.
1338
1419
  */
1339
1420
 
1340
- export { ArrayProvider, CollectionStore, DataProvider, DataSource, DataSourceProxy, LocalProvider, MemoryStore, ModelMeta, ModelRefByIndex, ModelRefByKey, ModelRefNorm, ObservableProvider, UnknownMeta, filterBy, filterMerge, filterNormalize, groupBy, grouperMerge, pathGetterCompile, queryExecutor, querySubject, sliceApply, sliceClamp, sliceEq, sliceInsert, sliceMerge, sliceToPages, slimBy, slimerMerge, sortBy, sorterMerge, sorterNormalize };
1421
+ export { ArrayProvider, CollectionStore, DataProvider, DataSource, DataSourceModule, DataSourceProxy, DataSourceProxyBusy, DataSourceProxyFilter, DataSourceProxyGrouper, DataSourceProxySlimer, DataSourceProxySorter, LocalProvider, MemoryStore, ModelMeta, ModelRefByIndex, ModelRefByKey, ModelRefNorm, ObservableProvider, UnknownMeta, filterBy, filterMerge, filterNormalize, groupBy, grouperMerge, pathGetterCompile, queryExecutor, querySubject, sliceApply, sliceClamp, sliceEq, sliceInsert, sliceMerge, sliceToPages, slimBy, slimerMerge, sortBy, sorterMerge, sorterNormalize };
1341
1422
  //# sourceMappingURL=ngutil-data.mjs.map