@daffodil/core 0.94.1-rc.0 → 0.95.0

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,660 +1,1080 @@
1
- import * as i0 from '@angular/core';
2
- import { Pipe, NgModule, Injectable } from '@angular/core';
3
- import { UniqueEnforcer } from 'enforce-unique';
4
- import { range, DaffSortDirectionEnum, DaffFilterType, daffFilterArrayToDict, daffIdentifiableArrayToDict } from '@daffodil/core';
5
- import { faker } from '@faker-js/faker/locale/en_US';
6
-
7
- /**
8
- * @docs
9
- * A mock CurrencyPipe that does nothing to a given input.
10
- * This pipe is useful for asserting that a CurrencyPipe is in use via a spy,
11
- * but ignoring the actual underlying implementation
12
- */
13
- class DaffMockCurrencyPipe {
14
- transform(value) { }
15
- ;
16
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMockCurrencyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
17
- /** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffMockCurrencyPipe, isStandalone: false, name: "currency" }); }
18
- }
19
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMockCurrencyPipe, decorators: [{
20
- type: Pipe,
21
- args: [{
22
- name: 'currency',
23
- standalone: false,
24
- }]
25
- }] });
26
-
27
- class DaffCoreTestingModule {
28
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCoreTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
29
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffCoreTestingModule, declarations: [DaffMockCurrencyPipe] }); }
30
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCoreTestingModule }); }
31
- }
32
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCoreTestingModule, decorators: [{
33
- type: NgModule,
34
- args: [{
35
- declarations: [
36
- DaffMockCurrencyPipe,
37
- ],
38
- }]
39
- }] });
40
-
41
- const store = new Map();
42
- /**
43
- * Wraps `UniqueEnforcer` to provide function-specific instances.
44
- */
1
+ import * as i0 from "@angular/core";
2
+ import { Injectable, NgModule, Pipe } from "@angular/core";
3
+ import { UniqueEnforcer } from "enforce-unique";
4
+ import { DaffFilterType, DaffSortDirectionEnum, daffFilterArrayToDict, daffIdentifiableArrayToDict, range } from "@daffodil/core";
5
+ import { faker } from "@faker-js/faker/locale/en_US";
6
+ var DaffMockCurrencyPipe = class DaffMockCurrencyPipe {
7
+ transform(value) {}
8
+ static {
9
+ this.ɵfac = i0.ɵɵngDeclareFactory({
10
+ minVersion: "12.0.0",
11
+ version: "22.2.4",
12
+ ngImport: i0,
13
+ type: DaffMockCurrencyPipe,
14
+ deps: [],
15
+ target: i0.ɵɵFactoryTarget.Pipe
16
+ });
17
+ }
18
+ static {
19
+ this.ɵpipe = i0.ɵɵngDeclarePipe({
20
+ minVersion: "14.0.0",
21
+ version: "22.2.4",
22
+ ngImport: i0,
23
+ type: DaffMockCurrencyPipe,
24
+ isStandalone: true,
25
+ name: "currency"
26
+ });
27
+ }
28
+ };
29
+ i0.ɵɵngDeclareClassMetadata({
30
+ minVersion: "12.0.0",
31
+ version: "22.2.4",
32
+ ngImport: i0,
33
+ type: DaffMockCurrencyPipe,
34
+ decorators: [{
35
+ type: Pipe,
36
+ args: [{ name: "currency" }]
37
+ }]
38
+ });
39
+ var DaffCoreTestingModule = class DaffCoreTestingModule {
40
+ static {
41
+ this.ɵfac = i0.ɵɵngDeclareFactory({
42
+ minVersion: "12.0.0",
43
+ version: "22.2.4",
44
+ ngImport: i0,
45
+ type: DaffCoreTestingModule,
46
+ deps: [],
47
+ target: i0.ɵɵFactoryTarget.NgModule
48
+ });
49
+ }
50
+ static {
51
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
52
+ minVersion: "14.0.0",
53
+ version: "22.2.4",
54
+ ngImport: i0,
55
+ type: DaffCoreTestingModule,
56
+ imports: [DaffMockCurrencyPipe],
57
+ exports: [DaffMockCurrencyPipe]
58
+ });
59
+ }
60
+ static {
61
+ this.ɵinj = i0.ɵɵngDeclareInjector({
62
+ minVersion: "12.0.0",
63
+ version: "22.2.4",
64
+ ngImport: i0,
65
+ type: DaffCoreTestingModule
66
+ });
67
+ }
68
+ };
69
+ i0.ɵɵngDeclareClassMetadata({
70
+ minVersion: "12.0.0",
71
+ version: "22.2.4",
72
+ ngImport: i0,
73
+ type: DaffCoreTestingModule,
74
+ decorators: [{
75
+ type: NgModule,
76
+ args: [{
77
+ imports: [DaffMockCurrencyPipe],
78
+ exports: [DaffMockCurrencyPipe]
79
+ }]
80
+ }]
81
+ });
82
+ const store = /* @__PURE__ */ new Map();
45
83
  const enforceUnique = (func, options) => {
46
- if (!store.has(func)) {
47
- store.set(func, new UniqueEnforcer());
48
- }
49
- return store.get(func)?.enforce(func, options);
84
+ if (!store.has(func)) store.set(func, new UniqueEnforcer());
85
+ return store.get(func)?.enforce(func, options);
86
+ };
87
+ var DaffModelFactory = class {
88
+ constructor(type, ...args) {
89
+ this.type = type;
90
+ this._instantiationArgs = args;
91
+ }
92
+ create(partial = {}) {
93
+ if (!this.type) throw new Error("`type` is required if `create` is not overriden.");
94
+ return {
95
+ ...new this.type(...this._instantiationArgs),
96
+ ...partial
97
+ };
98
+ }
99
+ createMany(qty = 1, partial = {}) {
100
+ return range(0, qty - 1).map(() => this.create(partial));
101
+ }
102
+ };
103
+ var MockDaffIdentifiable = class {
104
+ constructor() {
105
+ this.id = faker.string.uuid();
106
+ }
107
+ };
108
+ var DaffIdentifiableFactory = class DaffIdentifiableFactory extends DaffModelFactory {
109
+ constructor() {
110
+ super(MockDaffIdentifiable);
111
+ }
112
+ static {
113
+ this.ɵfac = i0.ɵɵngDeclareFactory({
114
+ minVersion: "12.0.0",
115
+ version: "22.2.4",
116
+ ngImport: i0,
117
+ type: DaffIdentifiableFactory,
118
+ deps: [],
119
+ target: i0.ɵɵFactoryTarget.Injectable
120
+ });
121
+ }
122
+ static {
123
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
124
+ minVersion: "12.0.0",
125
+ version: "22.2.4",
126
+ ngImport: i0,
127
+ type: DaffIdentifiableFactory,
128
+ providedIn: "root"
129
+ });
130
+ }
131
+ };
132
+ i0.ɵɵngDeclareClassMetadata({
133
+ minVersion: "12.0.0",
134
+ version: "22.2.4",
135
+ ngImport: i0,
136
+ type: DaffIdentifiableFactory,
137
+ decorators: [{
138
+ type: Injectable,
139
+ args: [{ providedIn: "root" }]
140
+ }],
141
+ ctorParameters: () => []
142
+ });
143
+ var MockDaffNumericallyPaginable = class {
144
+ constructor() {
145
+ this.totalPages = faker.number.int({
146
+ min: 1,
147
+ max: 100
148
+ });
149
+ this.currentPage = faker.number.int({
150
+ min: 1,
151
+ max: this.totalPages
152
+ });
153
+ this.pageSize = faker.number.int({
154
+ min: 1,
155
+ max: 100
156
+ });
157
+ }
158
+ };
159
+ var DaffNumericallyPaginableFactory = class DaffNumericallyPaginableFactory extends DaffModelFactory {
160
+ constructor() {
161
+ super(MockDaffNumericallyPaginable);
162
+ }
163
+ static {
164
+ this.ɵfac = i0.ɵɵngDeclareFactory({
165
+ minVersion: "12.0.0",
166
+ version: "22.2.4",
167
+ ngImport: i0,
168
+ type: DaffNumericallyPaginableFactory,
169
+ deps: [],
170
+ target: i0.ɵɵFactoryTarget.Injectable
171
+ });
172
+ }
173
+ static {
174
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
175
+ minVersion: "12.0.0",
176
+ version: "22.2.4",
177
+ ngImport: i0,
178
+ type: DaffNumericallyPaginableFactory,
179
+ providedIn: "root"
180
+ });
181
+ }
182
+ };
183
+ i0.ɵɵngDeclareClassMetadata({
184
+ minVersion: "12.0.0",
185
+ version: "22.2.4",
186
+ ngImport: i0,
187
+ type: DaffNumericallyPaginableFactory,
188
+ decorators: [{
189
+ type: Injectable,
190
+ args: [{ providedIn: "root" }]
191
+ }],
192
+ ctorParameters: () => []
193
+ });
194
+ var MockDaffSortOption = class {
195
+ constructor() {
196
+ this.label = faker.lorem.word();
197
+ this.value = faker.lorem.word();
198
+ }
199
+ };
200
+ var DaffSortOptionFactory = class DaffSortOptionFactory extends DaffModelFactory {
201
+ constructor() {
202
+ super(MockDaffSortOption);
203
+ }
204
+ static {
205
+ this.ɵfac = i0.ɵɵngDeclareFactory({
206
+ minVersion: "12.0.0",
207
+ version: "22.2.4",
208
+ ngImport: i0,
209
+ type: DaffSortOptionFactory,
210
+ deps: [],
211
+ target: i0.ɵɵFactoryTarget.Injectable
212
+ });
213
+ }
214
+ static {
215
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
216
+ minVersion: "12.0.0",
217
+ version: "22.2.4",
218
+ ngImport: i0,
219
+ type: DaffSortOptionFactory,
220
+ providedIn: "root"
221
+ });
222
+ }
223
+ };
224
+ i0.ɵɵngDeclareClassMetadata({
225
+ minVersion: "12.0.0",
226
+ version: "22.2.4",
227
+ ngImport: i0,
228
+ type: DaffSortOptionFactory,
229
+ decorators: [{
230
+ type: Injectable,
231
+ args: [{ providedIn: "root" }]
232
+ }],
233
+ ctorParameters: () => []
234
+ });
235
+ var MockDaffSortOptions = class {
236
+ constructor(optionFactory) {
237
+ this.optionFactory = optionFactory;
238
+ this.options = this.createOptions();
239
+ this.default = faker.helpers.arrayElement(this.options).value;
240
+ }
241
+ createOptions() {
242
+ return this.optionFactory.createMany(faker.number.int({
243
+ min: 1,
244
+ max: 5
245
+ }));
246
+ }
247
+ };
248
+ var DaffSortOptionsFactory = class DaffSortOptionsFactory extends DaffModelFactory {
249
+ constructor(optionFactory) {
250
+ super(MockDaffSortOptions, optionFactory);
251
+ }
252
+ static {
253
+ this.ɵfac = i0.ɵɵngDeclareFactory({
254
+ minVersion: "12.0.0",
255
+ version: "22.2.4",
256
+ ngImport: i0,
257
+ type: DaffSortOptionsFactory,
258
+ deps: [{ token: DaffSortOptionFactory }],
259
+ target: i0.ɵɵFactoryTarget.Injectable
260
+ });
261
+ }
262
+ static {
263
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
264
+ minVersion: "12.0.0",
265
+ version: "22.2.4",
266
+ ngImport: i0,
267
+ type: DaffSortOptionsFactory,
268
+ providedIn: "root"
269
+ });
270
+ }
271
+ };
272
+ i0.ɵɵngDeclareClassMetadata({
273
+ minVersion: "12.0.0",
274
+ version: "22.2.4",
275
+ ngImport: i0,
276
+ type: DaffSortOptionsFactory,
277
+ decorators: [{
278
+ type: Injectable,
279
+ args: [{ providedIn: "root" }]
280
+ }],
281
+ ctorParameters: () => [{ type: DaffSortOptionFactory }]
282
+ });
283
+ var MockDaffSortable = class {
284
+ constructor(optionFactory) {
285
+ this.optionFactory = optionFactory;
286
+ this.sortOptions = this.createOptions();
287
+ this.appliedSortOption = faker.helpers.arrayElement(this.sortOptions.options).value;
288
+ this.appliedSortDirection = faker.helpers.arrayElement([DaffSortDirectionEnum.Ascending, DaffSortDirectionEnum.Descending]);
289
+ }
290
+ createOptions() {
291
+ return this.optionFactory.create();
292
+ }
293
+ };
294
+ var DaffSortableFactory = class DaffSortableFactory extends DaffModelFactory {
295
+ constructor(optionFactory) {
296
+ super(MockDaffSortable, optionFactory);
297
+ }
298
+ static {
299
+ this.ɵfac = i0.ɵɵngDeclareFactory({
300
+ minVersion: "12.0.0",
301
+ version: "22.2.4",
302
+ ngImport: i0,
303
+ type: DaffSortableFactory,
304
+ deps: [{ token: DaffSortOptionsFactory }],
305
+ target: i0.ɵɵFactoryTarget.Injectable
306
+ });
307
+ }
308
+ static {
309
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
310
+ minVersion: "12.0.0",
311
+ version: "22.2.4",
312
+ ngImport: i0,
313
+ type: DaffSortableFactory,
314
+ providedIn: "root"
315
+ });
316
+ }
317
+ };
318
+ i0.ɵɵngDeclareClassMetadata({
319
+ minVersion: "12.0.0",
320
+ version: "22.2.4",
321
+ ngImport: i0,
322
+ type: DaffSortableFactory,
323
+ decorators: [{
324
+ type: Injectable,
325
+ args: [{ providedIn: "root" }]
326
+ }],
327
+ ctorParameters: () => [{ type: DaffSortOptionsFactory }]
328
+ });
329
+ var MockFilterEqual = class {
330
+ constructor() {
331
+ this.type = DaffFilterType.Equal;
332
+ this.label = faker.lorem.word();
333
+ this.name = faker.string.uuid();
334
+ this.options = {};
335
+ }
336
+ };
337
+ var DaffFilterEqualFactory = class DaffFilterEqualFactory extends DaffModelFactory {
338
+ constructor() {
339
+ super(MockFilterEqual);
340
+ }
341
+ static {
342
+ this.ɵfac = i0.ɵɵngDeclareFactory({
343
+ minVersion: "12.0.0",
344
+ version: "22.2.4",
345
+ ngImport: i0,
346
+ type: DaffFilterEqualFactory,
347
+ deps: [],
348
+ target: i0.ɵɵFactoryTarget.Injectable
349
+ });
350
+ }
351
+ static {
352
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
353
+ minVersion: "12.0.0",
354
+ version: "22.2.4",
355
+ ngImport: i0,
356
+ type: DaffFilterEqualFactory,
357
+ providedIn: "root"
358
+ });
359
+ }
360
+ };
361
+ i0.ɵɵngDeclareClassMetadata({
362
+ minVersion: "12.0.0",
363
+ version: "22.2.4",
364
+ ngImport: i0,
365
+ type: DaffFilterEqualFactory,
366
+ decorators: [{
367
+ type: Injectable,
368
+ args: [{ providedIn: "root" }]
369
+ }],
370
+ ctorParameters: () => []
371
+ });
372
+ var MockFilterRangeNumeric = class {
373
+ constructor() {
374
+ this.type = DaffFilterType.RangeNumeric;
375
+ this.label = faker.lorem.word();
376
+ this.name = faker.string.uuid();
377
+ this.min = faker.number.int({
378
+ min: 1,
379
+ max: 10
380
+ });
381
+ this.max = faker.number.int({
382
+ min: 10,
383
+ max: 200
384
+ });
385
+ this.options = {};
386
+ }
387
+ };
388
+ var DaffFilterRangeNumericFactory = class DaffFilterRangeNumericFactory extends DaffModelFactory {
389
+ constructor() {
390
+ super(MockFilterRangeNumeric);
391
+ }
392
+ static {
393
+ this.ɵfac = i0.ɵɵngDeclareFactory({
394
+ minVersion: "12.0.0",
395
+ version: "22.2.4",
396
+ ngImport: i0,
397
+ type: DaffFilterRangeNumericFactory,
398
+ deps: [],
399
+ target: i0.ɵɵFactoryTarget.Injectable
400
+ });
401
+ }
402
+ static {
403
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
404
+ minVersion: "12.0.0",
405
+ version: "22.2.4",
406
+ ngImport: i0,
407
+ type: DaffFilterRangeNumericFactory,
408
+ providedIn: "root"
409
+ });
410
+ }
411
+ };
412
+ i0.ɵɵngDeclareClassMetadata({
413
+ minVersion: "12.0.0",
414
+ version: "22.2.4",
415
+ ngImport: i0,
416
+ type: DaffFilterRangeNumericFactory,
417
+ decorators: [{
418
+ type: Injectable,
419
+ args: [{ providedIn: "root" }]
420
+ }],
421
+ ctorParameters: () => []
422
+ });
423
+ var MockDaffFilter = class {};
424
+ var DaffFilterFactory = class DaffFilterFactory extends DaffModelFactory {
425
+ constructor(equalFactory, rangeFactory) {
426
+ super(MockDaffFilter);
427
+ this.equalFactory = equalFactory;
428
+ this.rangeFactory = rangeFactory;
429
+ }
430
+ create(partial = {}) {
431
+ let factory;
432
+ switch (partial.type) {
433
+ case DaffFilterType.Equal:
434
+ factory = this.equalFactory;
435
+ break;
436
+ case DaffFilterType.RangeNumeric:
437
+ factory = this.rangeFactory;
438
+ break;
439
+ default: factory = faker.number.int({
440
+ min: 1,
441
+ max: 2
442
+ }) === 2 ? this.equalFactory : this.rangeFactory;
443
+ }
444
+ return {
445
+ ...new this.type(),
446
+ ...factory.create(partial)
447
+ };
448
+ }
449
+ static {
450
+ this.ɵfac = i0.ɵɵngDeclareFactory({
451
+ minVersion: "12.0.0",
452
+ version: "22.2.4",
453
+ ngImport: i0,
454
+ type: DaffFilterFactory,
455
+ deps: [{ token: DaffFilterEqualFactory }, { token: DaffFilterRangeNumericFactory }],
456
+ target: i0.ɵɵFactoryTarget.Injectable
457
+ });
458
+ }
459
+ static {
460
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
461
+ minVersion: "12.0.0",
462
+ version: "22.2.4",
463
+ ngImport: i0,
464
+ type: DaffFilterFactory,
465
+ providedIn: "root"
466
+ });
467
+ }
468
+ };
469
+ i0.ɵɵngDeclareClassMetadata({
470
+ minVersion: "12.0.0",
471
+ version: "22.2.4",
472
+ ngImport: i0,
473
+ type: DaffFilterFactory,
474
+ decorators: [{
475
+ type: Injectable,
476
+ args: [{ providedIn: "root" }]
477
+ }],
478
+ ctorParameters: () => [{ type: DaffFilterEqualFactory }, { type: DaffFilterRangeNumericFactory }]
479
+ });
480
+ var MockDaffFilterEqualRequest = class {
481
+ constructor() {
482
+ this.type = DaffFilterType.Equal;
483
+ this.name = faker.lorem.word();
484
+ this.value = [faker.string.uuid()];
485
+ }
486
+ };
487
+ var DaffFilterRequestEqualFactory = class DaffFilterRequestEqualFactory extends DaffModelFactory {
488
+ constructor() {
489
+ super(MockDaffFilterEqualRequest);
490
+ }
491
+ static {
492
+ this.ɵfac = i0.ɵɵngDeclareFactory({
493
+ minVersion: "12.0.0",
494
+ version: "22.2.4",
495
+ ngImport: i0,
496
+ type: DaffFilterRequestEqualFactory,
497
+ deps: [],
498
+ target: i0.ɵɵFactoryTarget.Injectable
499
+ });
500
+ }
501
+ static {
502
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
503
+ minVersion: "12.0.0",
504
+ version: "22.2.4",
505
+ ngImport: i0,
506
+ type: DaffFilterRequestEqualFactory,
507
+ providedIn: "root"
508
+ });
509
+ }
510
+ };
511
+ i0.ɵɵngDeclareClassMetadata({
512
+ minVersion: "12.0.0",
513
+ version: "22.2.4",
514
+ ngImport: i0,
515
+ type: DaffFilterRequestEqualFactory,
516
+ decorators: [{
517
+ type: Injectable,
518
+ args: [{ providedIn: "root" }]
519
+ }],
520
+ ctorParameters: () => []
521
+ });
522
+ var MockDaffFilterRangeNumericRequestOption = class {
523
+ constructor() {
524
+ this.min = faker.number.int({
525
+ min: 0,
526
+ max: 100
527
+ });
528
+ this.max = faker.number.int({
529
+ min: 100,
530
+ max: 1e3
531
+ });
532
+ }
533
+ };
534
+ var DaffFilterRangeNumericRequestOptionFactory = class DaffFilterRangeNumericRequestOptionFactory extends DaffModelFactory {
535
+ constructor() {
536
+ super(MockDaffFilterRangeNumericRequestOption);
537
+ }
538
+ static {
539
+ this.ɵfac = i0.ɵɵngDeclareFactory({
540
+ minVersion: "12.0.0",
541
+ version: "22.2.4",
542
+ ngImport: i0,
543
+ type: DaffFilterRangeNumericRequestOptionFactory,
544
+ deps: [],
545
+ target: i0.ɵɵFactoryTarget.Injectable
546
+ });
547
+ }
548
+ static {
549
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
550
+ minVersion: "12.0.0",
551
+ version: "22.2.4",
552
+ ngImport: i0,
553
+ type: DaffFilterRangeNumericRequestOptionFactory,
554
+ providedIn: "root"
555
+ });
556
+ }
557
+ };
558
+ i0.ɵɵngDeclareClassMetadata({
559
+ minVersion: "12.0.0",
560
+ version: "22.2.4",
561
+ ngImport: i0,
562
+ type: DaffFilterRangeNumericRequestOptionFactory,
563
+ decorators: [{
564
+ type: Injectable,
565
+ args: [{ providedIn: "root" }]
566
+ }],
567
+ ctorParameters: () => []
568
+ });
569
+ var MockDaffFilterRangeNumericRequest = class {
570
+ constructor() {
571
+ this.type = DaffFilterType.RangeNumeric;
572
+ this.name = faker.lorem.word();
573
+ }
574
+ };
575
+ var DaffFilterRequestRangeNumericFactory = class DaffFilterRequestRangeNumericFactory extends DaffModelFactory {
576
+ constructor(option = new DaffFilterRangeNumericRequestOptionFactory()) {
577
+ super(MockDaffFilterRangeNumericRequest);
578
+ this.option = option;
579
+ }
580
+ create(partial = {}) {
581
+ return {
582
+ ...new this.type(),
583
+ value: this.option.create(),
584
+ ...partial
585
+ };
586
+ }
587
+ static {
588
+ this.ɵfac = i0.ɵɵngDeclareFactory({
589
+ minVersion: "12.0.0",
590
+ version: "22.2.4",
591
+ ngImport: i0,
592
+ type: DaffFilterRequestRangeNumericFactory,
593
+ deps: [{ token: DaffFilterRangeNumericRequestOptionFactory }],
594
+ target: i0.ɵɵFactoryTarget.Injectable
595
+ });
596
+ }
597
+ static {
598
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
599
+ minVersion: "12.0.0",
600
+ version: "22.2.4",
601
+ ngImport: i0,
602
+ type: DaffFilterRequestRangeNumericFactory,
603
+ providedIn: "root"
604
+ });
605
+ }
606
+ };
607
+ i0.ɵɵngDeclareClassMetadata({
608
+ minVersion: "12.0.0",
609
+ version: "22.2.4",
610
+ ngImport: i0,
611
+ type: DaffFilterRequestRangeNumericFactory,
612
+ decorators: [{
613
+ type: Injectable,
614
+ args: [{ providedIn: "root" }]
615
+ }],
616
+ ctorParameters: () => [{ type: DaffFilterRangeNumericRequestOptionFactory }]
617
+ });
618
+ var DaffFilterRequestFactory = class DaffFilterRequestFactory extends DaffModelFactory {
619
+ constructor(equalFactory, rangeFactory) {
620
+ super(faker.number.int({
621
+ min: 1,
622
+ max: 2
623
+ }) === 2 ? equalFactory.type : rangeFactory.type);
624
+ }
625
+ static {
626
+ this.ɵfac = i0.ɵɵngDeclareFactory({
627
+ minVersion: "12.0.0",
628
+ version: "22.2.4",
629
+ ngImport: i0,
630
+ type: DaffFilterRequestFactory,
631
+ deps: [{ token: DaffFilterRequestEqualFactory }, { token: DaffFilterRequestRangeNumericFactory }],
632
+ target: i0.ɵɵFactoryTarget.Injectable
633
+ });
634
+ }
635
+ static {
636
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
637
+ minVersion: "12.0.0",
638
+ version: "22.2.4",
639
+ ngImport: i0,
640
+ type: DaffFilterRequestFactory,
641
+ providedIn: "root"
642
+ });
643
+ }
644
+ };
645
+ i0.ɵɵngDeclareClassMetadata({
646
+ minVersion: "12.0.0",
647
+ version: "22.2.4",
648
+ ngImport: i0,
649
+ type: DaffFilterRequestFactory,
650
+ decorators: [{
651
+ type: Injectable,
652
+ args: [{ providedIn: "root" }]
653
+ }],
654
+ ctorParameters: () => [{ type: DaffFilterRequestEqualFactory }, { type: DaffFilterRequestRangeNumericFactory }]
655
+ });
656
+ var MockDaffFilterToggleEqualRequest = class {
657
+ constructor() {
658
+ this.type = DaffFilterType.Equal;
659
+ this.name = faker.lorem.word();
660
+ this.value = faker.string.uuid();
661
+ }
662
+ };
663
+ var DaffFilterToggleRequestEqualFactory = class DaffFilterToggleRequestEqualFactory extends DaffModelFactory {
664
+ constructor() {
665
+ super(MockDaffFilterToggleEqualRequest);
666
+ }
667
+ static {
668
+ this.ɵfac = i0.ɵɵngDeclareFactory({
669
+ minVersion: "12.0.0",
670
+ version: "22.2.4",
671
+ ngImport: i0,
672
+ type: DaffFilterToggleRequestEqualFactory,
673
+ deps: [],
674
+ target: i0.ɵɵFactoryTarget.Injectable
675
+ });
676
+ }
677
+ static {
678
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
679
+ minVersion: "12.0.0",
680
+ version: "22.2.4",
681
+ ngImport: i0,
682
+ type: DaffFilterToggleRequestEqualFactory,
683
+ providedIn: "root"
684
+ });
685
+ }
686
+ };
687
+ i0.ɵɵngDeclareClassMetadata({
688
+ minVersion: "12.0.0",
689
+ version: "22.2.4",
690
+ ngImport: i0,
691
+ type: DaffFilterToggleRequestEqualFactory,
692
+ decorators: [{
693
+ type: Injectable,
694
+ args: [{ providedIn: "root" }]
695
+ }],
696
+ ctorParameters: () => []
697
+ });
698
+ var MockDaffFilterToggleRangeNumericRequest = class {
699
+ constructor() {
700
+ this.type = DaffFilterType.RangeNumeric;
701
+ this.name = faker.lorem.word();
702
+ }
703
+ };
704
+ var DaffFilterToggleRequestRangeNumericFactory = class DaffFilterToggleRequestRangeNumericFactory extends DaffModelFactory {
705
+ constructor(option) {
706
+ super(MockDaffFilterToggleRangeNumericRequest);
707
+ this.option = option;
708
+ }
709
+ create(partial = {}) {
710
+ return {
711
+ ...new this.type(),
712
+ value: this.option.create(),
713
+ ...partial
714
+ };
715
+ }
716
+ static {
717
+ this.ɵfac = i0.ɵɵngDeclareFactory({
718
+ minVersion: "12.0.0",
719
+ version: "22.2.4",
720
+ ngImport: i0,
721
+ type: DaffFilterToggleRequestRangeNumericFactory,
722
+ deps: [{ token: DaffFilterRangeNumericRequestOptionFactory }],
723
+ target: i0.ɵɵFactoryTarget.Injectable
724
+ });
725
+ }
726
+ static {
727
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
728
+ minVersion: "12.0.0",
729
+ version: "22.2.4",
730
+ ngImport: i0,
731
+ type: DaffFilterToggleRequestRangeNumericFactory,
732
+ providedIn: "root"
733
+ });
734
+ }
735
+ };
736
+ i0.ɵɵngDeclareClassMetadata({
737
+ minVersion: "12.0.0",
738
+ version: "22.2.4",
739
+ ngImport: i0,
740
+ type: DaffFilterToggleRequestRangeNumericFactory,
741
+ decorators: [{
742
+ type: Injectable,
743
+ args: [{ providedIn: "root" }]
744
+ }],
745
+ ctorParameters: () => [{ type: DaffFilterRangeNumericRequestOptionFactory }]
746
+ });
747
+ var MockDaffFilterToggleRequest = class {};
748
+ var DaffFilterToggleRequestFactory = class DaffFilterToggleRequestFactory extends DaffModelFactory {
749
+ constructor(equalFactory, rangeFactory) {
750
+ super(MockDaffFilterToggleRequest);
751
+ this.equalFactory = equalFactory;
752
+ this.rangeFactory = rangeFactory;
753
+ }
754
+ create(partial) {
755
+ return {
756
+ ...new this.type(),
757
+ ...faker.number.int({
758
+ min: 1,
759
+ max: 2
760
+ }) === 2 ? this.equalFactory.create() : this.rangeFactory.create()
761
+ };
762
+ }
763
+ static {
764
+ this.ɵfac = i0.ɵɵngDeclareFactory({
765
+ minVersion: "12.0.0",
766
+ version: "22.2.4",
767
+ ngImport: i0,
768
+ type: DaffFilterToggleRequestFactory,
769
+ deps: [{ token: DaffFilterToggleRequestEqualFactory }, { token: DaffFilterToggleRequestRangeNumericFactory }],
770
+ target: i0.ɵɵFactoryTarget.Injectable
771
+ });
772
+ }
773
+ static {
774
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
775
+ minVersion: "12.0.0",
776
+ version: "22.2.4",
777
+ ngImport: i0,
778
+ type: DaffFilterToggleRequestFactory,
779
+ providedIn: "root"
780
+ });
781
+ }
782
+ };
783
+ i0.ɵɵngDeclareClassMetadata({
784
+ minVersion: "12.0.0",
785
+ version: "22.2.4",
786
+ ngImport: i0,
787
+ type: DaffFilterToggleRequestFactory,
788
+ decorators: [{
789
+ type: Injectable,
790
+ args: [{ providedIn: "root" }]
791
+ }],
792
+ ctorParameters: () => [{ type: DaffFilterToggleRequestEqualFactory }, { type: DaffFilterToggleRequestRangeNumericFactory }]
793
+ });
794
+ var MockDaffFilterEqualOption = class {
795
+ constructor() {
796
+ this.applied = false;
797
+ this.value = faker.string.uuid();
798
+ this.label = faker.lorem.word();
799
+ this.count = faker.number.int({
800
+ min: 1,
801
+ max: 1e3
802
+ });
803
+ }
804
+ };
805
+ var DaffFilterEqualOptionFactory = class DaffFilterEqualOptionFactory extends DaffModelFactory {
806
+ constructor() {
807
+ super(MockDaffFilterEqualOption);
808
+ }
809
+ static {
810
+ this.ɵfac = i0.ɵɵngDeclareFactory({
811
+ minVersion: "12.0.0",
812
+ version: "22.2.4",
813
+ ngImport: i0,
814
+ type: DaffFilterEqualOptionFactory,
815
+ deps: [],
816
+ target: i0.ɵɵFactoryTarget.Injectable
817
+ });
818
+ }
819
+ static {
820
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
821
+ minVersion: "12.0.0",
822
+ version: "22.2.4",
823
+ ngImport: i0,
824
+ type: DaffFilterEqualOptionFactory,
825
+ providedIn: "root"
826
+ });
827
+ }
828
+ };
829
+ i0.ɵɵngDeclareClassMetadata({
830
+ minVersion: "12.0.0",
831
+ version: "22.2.4",
832
+ ngImport: i0,
833
+ type: DaffFilterEqualOptionFactory,
834
+ decorators: [{
835
+ type: Injectable,
836
+ args: [{ providedIn: "root" }]
837
+ }],
838
+ ctorParameters: () => []
839
+ });
840
+ var MockFilterRangeNumericOption = class {
841
+ constructor() {
842
+ this.value = faker.number.int({
843
+ min: 0,
844
+ max: 10
845
+ });
846
+ this.label = faker.string.alpha({ length: 3 });
847
+ }
848
+ };
849
+ var DaffFilterRangeNumericOptionFactory = class DaffFilterRangeNumericOptionFactory extends DaffModelFactory {
850
+ constructor() {
851
+ super(MockFilterRangeNumericOption);
852
+ }
853
+ static {
854
+ this.ɵfac = i0.ɵɵngDeclareFactory({
855
+ minVersion: "12.0.0",
856
+ version: "22.2.4",
857
+ ngImport: i0,
858
+ type: DaffFilterRangeNumericOptionFactory,
859
+ deps: [],
860
+ target: i0.ɵɵFactoryTarget.Injectable
861
+ });
862
+ }
863
+ static {
864
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
865
+ minVersion: "12.0.0",
866
+ version: "22.2.4",
867
+ ngImport: i0,
868
+ type: DaffFilterRangeNumericOptionFactory,
869
+ providedIn: "root"
870
+ });
871
+ }
872
+ };
873
+ i0.ɵɵngDeclareClassMetadata({
874
+ minVersion: "12.0.0",
875
+ version: "22.2.4",
876
+ ngImport: i0,
877
+ type: DaffFilterRangeNumericOptionFactory,
878
+ decorators: [{
879
+ type: Injectable,
880
+ args: [{ providedIn: "root" }]
881
+ }],
882
+ ctorParameters: () => []
883
+ });
884
+ var MockDaffFilterRangeNumericPair = class {
885
+ constructor() {
886
+ this.applied = true;
887
+ }
888
+ };
889
+ var DaffFilterRangeNumericPairFactory = class DaffFilterRangeNumericPairFactory extends DaffModelFactory {
890
+ constructor(option) {
891
+ super(MockDaffFilterRangeNumericPair);
892
+ this.option = option;
893
+ }
894
+ create(partial = {}) {
895
+ return {
896
+ ...new this.type(),
897
+ min: this.option.create({ value: faker.number.int({
898
+ min: 0,
899
+ max: 100
900
+ }) }),
901
+ max: this.option.create({ value: faker.number.int({
902
+ min: 100,
903
+ max: 1e3
904
+ }) }),
905
+ ...partial
906
+ };
907
+ }
908
+ static {
909
+ this.ɵfac = i0.ɵɵngDeclareFactory({
910
+ minVersion: "12.0.0",
911
+ version: "22.2.4",
912
+ ngImport: i0,
913
+ type: DaffFilterRangeNumericPairFactory,
914
+ deps: [{ token: DaffFilterRangeNumericOptionFactory }],
915
+ target: i0.ɵɵFactoryTarget.Injectable
916
+ });
917
+ }
918
+ static {
919
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
920
+ minVersion: "12.0.0",
921
+ version: "22.2.4",
922
+ ngImport: i0,
923
+ type: DaffFilterRangeNumericPairFactory,
924
+ providedIn: "root"
925
+ });
926
+ }
927
+ };
928
+ i0.ɵɵngDeclareClassMetadata({
929
+ minVersion: "12.0.0",
930
+ version: "22.2.4",
931
+ ngImport: i0,
932
+ type: DaffFilterRangeNumericPairFactory,
933
+ decorators: [{
934
+ type: Injectable,
935
+ args: [{ providedIn: "root" }]
936
+ }],
937
+ ctorParameters: () => [{ type: DaffFilterRangeNumericOptionFactory }]
938
+ });
939
+ var MockCollectionMetadata = class {
940
+ constructor(pageInfoFactory, sortFieldsFactory, filterFactory) {
941
+ const _pageInfo = pageInfoFactory.create();
942
+ const _sortFields = sortFieldsFactory.create();
943
+ this.count = faker.number.int({
944
+ min: 1,
945
+ max: 1e3
946
+ });
947
+ this.ids = new Array(this.count).fill(null).map(() => faker.string.uuid());
948
+ this.currentPage = _pageInfo.currentPage;
949
+ this.totalPages = _pageInfo.totalPages;
950
+ this.pageSize = _pageInfo.pageSize;
951
+ this.appliedSortDirection = _sortFields.appliedSortDirection;
952
+ this.appliedSortOption = _sortFields.appliedSortOption;
953
+ this.sortOptions = _sortFields.sortOptions;
954
+ this.filters = daffFilterArrayToDict(filterFactory.createMany(faker.number.int({
955
+ min: 1,
956
+ max: 5
957
+ })));
958
+ }
959
+ };
960
+ var DaffCollectionMetadataFactory = class DaffCollectionMetadataFactory extends DaffModelFactory {
961
+ constructor(pageInfoFactory, sortFieldsFactory, filterFactory) {
962
+ super(MockCollectionMetadata, pageInfoFactory, sortFieldsFactory, filterFactory);
963
+ }
964
+ static {
965
+ this.ɵfac = i0.ɵɵngDeclareFactory({
966
+ minVersion: "12.0.0",
967
+ version: "22.2.4",
968
+ ngImport: i0,
969
+ type: DaffCollectionMetadataFactory,
970
+ deps: [
971
+ { token: DaffNumericallyPaginableFactory },
972
+ { token: DaffSortableFactory },
973
+ { token: DaffFilterFactory }
974
+ ],
975
+ target: i0.ɵɵFactoryTarget.Injectable
976
+ });
977
+ }
978
+ static {
979
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
980
+ minVersion: "12.0.0",
981
+ version: "22.2.4",
982
+ ngImport: i0,
983
+ type: DaffCollectionMetadataFactory,
984
+ providedIn: "root"
985
+ });
986
+ }
987
+ };
988
+ i0.ɵɵngDeclareClassMetadata({
989
+ minVersion: "12.0.0",
990
+ version: "22.2.4",
991
+ ngImport: i0,
992
+ type: DaffCollectionMetadataFactory,
993
+ decorators: [{
994
+ type: Injectable,
995
+ args: [{ providedIn: "root" }]
996
+ }],
997
+ ctorParameters: () => [
998
+ { type: DaffNumericallyPaginableFactory },
999
+ { type: DaffSortableFactory },
1000
+ { type: DaffFilterFactory }
1001
+ ]
1002
+ });
1003
+ var MockCollectionRequest = class {
1004
+ constructor(filterRequestFactory) {
1005
+ this.filterRequestFactory = filterRequestFactory;
1006
+ this.currentPage = faker.number.int({
1007
+ min: 1,
1008
+ max: 100
1009
+ });
1010
+ this.appliedSortDirection = faker.helpers.arrayElement([DaffSortDirectionEnum.Ascending, DaffSortDirectionEnum.Descending]);
1011
+ this.pageSize = faker.number.int({
1012
+ min: 1,
1013
+ max: 100
1014
+ });
1015
+ this.appliedSortOption = faker.lorem.word();
1016
+ this.filterRequests = this.createFilterRequests();
1017
+ }
1018
+ createFilterRequests() {
1019
+ return this.filterRequestFactory.createMany(faker.number.int({
1020
+ min: 1,
1021
+ max: 5
1022
+ }));
1023
+ }
1024
+ };
1025
+ var DaffCollectionRequestFactory = class DaffCollectionRequestFactory extends DaffModelFactory {
1026
+ constructor(filterRequestFactory) {
1027
+ super(MockCollectionRequest, filterRequestFactory);
1028
+ }
1029
+ static {
1030
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1031
+ minVersion: "12.0.0",
1032
+ version: "22.2.4",
1033
+ ngImport: i0,
1034
+ type: DaffCollectionRequestFactory,
1035
+ deps: [{ token: DaffFilterRequestFactory }],
1036
+ target: i0.ɵɵFactoryTarget.Injectable
1037
+ });
1038
+ }
1039
+ static {
1040
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1041
+ minVersion: "12.0.0",
1042
+ version: "22.2.4",
1043
+ ngImport: i0,
1044
+ type: DaffCollectionRequestFactory,
1045
+ providedIn: "root"
1046
+ });
1047
+ }
1048
+ };
1049
+ i0.ɵɵngDeclareClassMetadata({
1050
+ minVersion: "12.0.0",
1051
+ version: "22.2.4",
1052
+ ngImport: i0,
1053
+ type: DaffCollectionRequestFactory,
1054
+ decorators: [{
1055
+ type: Injectable,
1056
+ args: [{ providedIn: "root" }]
1057
+ }],
1058
+ ctorParameters: () => [{ type: DaffFilterRequestFactory }]
1059
+ });
1060
+ var MockCollection = class {
1061
+ constructor(itemFactory, metadataFactory) {
1062
+ this.itemFactory = itemFactory;
1063
+ this.metadataFactory = metadataFactory;
1064
+ this._items = this.createItems();
1065
+ this.metadata = this.createMetadata();
1066
+ this.data = daffIdentifiableArrayToDict(this._items);
1067
+ }
1068
+ createItems() {
1069
+ return this.itemFactory.createMany();
1070
+ }
1071
+ createMetadata() {
1072
+ return this.metadataFactory.create({
1073
+ ids: this._items.map(({ id }) => id),
1074
+ count: this._items.length
1075
+ });
1076
+ }
50
1077
  };
51
-
52
- /**
53
- * The base class for model factories.
54
- *
55
- * The mock class is passed as the first constructor arg
56
- * and any additional args are passed to the mock class constructor.
57
- *
58
- * The constructor args can be omitted if the `create` method is overridden.
59
- *
60
- * @example Injecting a different factory into a mock class
61
- * ```ts
62
- * class MyMockModel {
63
- * constructor(
64
- * private otherFactory: MyOtherFactory
65
- * ) {}
66
- *
67
- * private createOtherModel() {
68
- * return this.otherFactory.create()
69
- * }
70
- *
71
- * otherModel = this.createOtherModel()
72
- * }
73
- *
74
- * @Injectable()
75
- * class TestFactory extends DaffModelFactory<MyMockModel> {
76
- * constructor(
77
- * otherFactory: MyOtherFactory
78
- * ) {
79
- * super(MyMockModel, otherFactory)
80
- * }
81
- * }
82
- * ```
83
- */
84
- class DaffModelFactory {
85
- constructor(type, ...args) {
86
- this.type = type;
87
- this._instantiationArgs = args;
88
- }
89
- create(partial = {}) {
90
- if (!this.type) {
91
- throw new Error('`type` is required if `create` is not overriden.');
92
- }
93
- return {
94
- ...new this.type(...this._instantiationArgs),
95
- ...partial,
96
- };
97
- }
98
- createMany(qty = 1, partial = {}) {
99
- return range(0, qty - 1).map(() => this.create(partial));
100
- }
101
- }
102
-
103
- class MockDaffIdentifiable {
104
- constructor() {
105
- this.id = faker.string.uuid();
106
- }
107
- }
108
- class DaffIdentifiableFactory extends DaffModelFactory {
109
- constructor() {
110
- super(MockDaffIdentifiable);
111
- }
112
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffIdentifiableFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
113
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffIdentifiableFactory, providedIn: 'root' }); }
114
- }
115
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffIdentifiableFactory, decorators: [{
116
- type: Injectable,
117
- args: [{
118
- providedIn: 'root',
119
- }]
120
- }], ctorParameters: () => [] });
121
-
122
- class MockDaffNumericallyPaginable {
123
- constructor() {
124
- this.totalPages = faker.number.int({ min: 1, max: 100 });
125
- this.currentPage = faker.number.int({ min: 1, max: this.totalPages });
126
- this.pageSize = faker.number.int({ min: 1, max: 100 });
127
- }
128
- }
129
- class DaffNumericallyPaginableFactory extends DaffModelFactory {
130
- constructor() {
131
- super(MockDaffNumericallyPaginable);
132
- }
133
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffNumericallyPaginableFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
134
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffNumericallyPaginableFactory, providedIn: 'root' }); }
135
- }
136
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffNumericallyPaginableFactory, decorators: [{
137
- type: Injectable,
138
- args: [{
139
- providedIn: 'root',
140
- }]
141
- }], ctorParameters: () => [] });
142
-
143
- class MockDaffSortOption {
144
- constructor() {
145
- this.label = faker.lorem.word();
146
- this.value = faker.lorem.word();
147
- }
148
- }
149
- class DaffSortOptionFactory extends DaffModelFactory {
150
- constructor() {
151
- super(MockDaffSortOption);
152
- }
153
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSortOptionFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
154
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSortOptionFactory, providedIn: 'root' }); }
155
- }
156
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSortOptionFactory, decorators: [{
157
- type: Injectable,
158
- args: [{
159
- providedIn: 'root',
160
- }]
161
- }], ctorParameters: () => [] });
162
-
163
- class MockDaffSortOptions {
164
- constructor(optionFactory) {
165
- this.optionFactory = optionFactory;
166
- this.options = this.createOptions();
167
- this.default = faker.helpers.arrayElement(this.options).value;
168
- }
169
- createOptions() {
170
- return this.optionFactory.createMany(faker.number.int({ min: 1, max: 5 }));
171
- }
172
- }
173
- class DaffSortOptionsFactory extends DaffModelFactory {
174
- constructor(optionFactory) {
175
- super(MockDaffSortOptions, optionFactory);
176
- }
177
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSortOptionsFactory, deps: [{ token: DaffSortOptionFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
178
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSortOptionsFactory, providedIn: 'root' }); }
179
- }
180
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSortOptionsFactory, decorators: [{
181
- type: Injectable,
182
- args: [{
183
- providedIn: 'root',
184
- }]
185
- }], ctorParameters: () => [{ type: DaffSortOptionFactory }] });
186
-
187
- class MockDaffSortable {
188
- constructor(optionFactory) {
189
- this.optionFactory = optionFactory;
190
- this.sortOptions = this.createOptions();
191
- this.appliedSortOption = faker.helpers.arrayElement(this.sortOptions.options).value;
192
- this.appliedSortDirection = faker.helpers.arrayElement([DaffSortDirectionEnum.Ascending, DaffSortDirectionEnum.Descending]);
193
- }
194
- createOptions() {
195
- return this.optionFactory.create();
196
- }
197
- }
198
- class DaffSortableFactory extends DaffModelFactory {
199
- constructor(optionFactory) {
200
- super(MockDaffSortable, optionFactory);
201
- }
202
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSortableFactory, deps: [{ token: DaffSortOptionsFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
203
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSortableFactory, providedIn: 'root' }); }
204
- }
205
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffSortableFactory, decorators: [{
206
- type: Injectable,
207
- args: [{
208
- providedIn: 'root',
209
- }]
210
- }], ctorParameters: () => [{ type: DaffSortOptionsFactory }] });
211
-
212
- class MockFilterEqual {
213
- constructor() {
214
- this.type = DaffFilterType.Equal;
215
- this.label = faker.lorem.word();
216
- this.name = faker.string.uuid();
217
- this.options = {};
218
- }
219
- }
220
- /**
221
- * A factory for creating a {@link DaffFilterEqual}.
222
- */
223
- class DaffFilterEqualFactory extends DaffModelFactory {
224
- constructor() {
225
- super(MockFilterEqual);
226
- }
227
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterEqualFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
228
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterEqualFactory, providedIn: 'root' }); }
229
- }
230
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterEqualFactory, decorators: [{
231
- type: Injectable,
232
- args: [{
233
- providedIn: 'root',
234
- }]
235
- }], ctorParameters: () => [] });
236
-
237
- class MockFilterRangeNumeric {
238
- constructor() {
239
- this.type = DaffFilterType.RangeNumeric;
240
- this.label = faker.lorem.word();
241
- this.name = faker.string.uuid();
242
- this.min = faker.number.int({ min: 1, max: 10 });
243
- this.max = faker.number.int({ min: 10, max: 200 });
244
- this.options = {};
245
- }
246
- }
247
- /**
248
- * A factory for creating a {@link DaffFilterRangeNumeric}.
249
- */
250
- class DaffFilterRangeNumericFactory extends DaffModelFactory {
251
- constructor() {
252
- super(MockFilterRangeNumeric);
253
- }
254
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
255
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericFactory, providedIn: 'root' }); }
256
- }
257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericFactory, decorators: [{
258
- type: Injectable,
259
- args: [{
260
- providedIn: 'root',
261
- }]
262
- }], ctorParameters: () => [] });
263
-
264
- class MockDaffFilter {
265
- }
266
- /**
267
- * A factory for creating a {@link DaffFilter}.
268
- */
269
- class DaffFilterFactory extends DaffModelFactory {
270
- constructor(equalFactory, rangeFactory) {
271
- super(MockDaffFilter);
272
- this.equalFactory = equalFactory;
273
- this.rangeFactory = rangeFactory;
274
- }
275
- create(partial = {}) {
276
- let factory;
277
- switch (partial.type) {
278
- case DaffFilterType.Equal:
279
- factory = this.equalFactory;
280
- break;
281
- case DaffFilterType.RangeNumeric:
282
- factory = this.rangeFactory;
283
- break;
284
- default:
285
- factory = faker.number.int({ min: 1, max: 2 }) === 2
286
- ? this.equalFactory
287
- : this.rangeFactory;
288
- break;
289
- }
290
- return {
291
- ...new this.type(),
292
- ...factory.create(partial),
293
- };
294
- }
295
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterFactory, deps: [{ token: DaffFilterEqualFactory }, { token: DaffFilterRangeNumericFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
296
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterFactory, providedIn: 'root' }); }
297
- }
298
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterFactory, decorators: [{
299
- type: Injectable,
300
- args: [{
301
- providedIn: 'root',
302
- }]
303
- }], ctorParameters: () => [{ type: DaffFilterEqualFactory }, { type: DaffFilterRangeNumericFactory }] });
304
-
305
- class MockDaffFilterEqualRequest {
306
- constructor() {
307
- this.type = DaffFilterType.Equal;
308
- this.name = faker.lorem.word();
309
- this.value = [faker.string.uuid()];
310
- }
311
- }
312
- /**
313
- * A factory for creating a {@link DaffFilterEqualRequest}.
314
- */
315
- class DaffFilterRequestEqualFactory extends DaffModelFactory {
316
- constructor() {
317
- super(MockDaffFilterEqualRequest);
318
- }
319
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRequestEqualFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
320
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRequestEqualFactory, providedIn: 'root' }); }
321
- }
322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRequestEqualFactory, decorators: [{
323
- type: Injectable,
324
- args: [{
325
- providedIn: 'root',
326
- }]
327
- }], ctorParameters: () => [] });
328
-
329
- class MockDaffFilterRangeNumericRequestOption {
330
- constructor() {
331
- this.min = faker.number.int({ min: 0, max: 100 });
332
- this.max = faker.number.int({ min: 100, max: 1000 });
333
- }
334
- }
335
- /**
336
- * A factory for creating a {@link DaffFilterRangeRequestOption}.
337
- */
338
- class DaffFilterRangeNumericRequestOptionFactory extends DaffModelFactory {
339
- constructor() {
340
- super(MockDaffFilterRangeNumericRequestOption);
341
- }
342
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericRequestOptionFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
343
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericRequestOptionFactory, providedIn: 'root' }); }
344
- }
345
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericRequestOptionFactory, decorators: [{
346
- type: Injectable,
347
- args: [{
348
- providedIn: 'root',
349
- }]
350
- }], ctorParameters: () => [] });
351
-
352
- class MockDaffFilterRangeNumericRequest {
353
- constructor() {
354
- this.type = DaffFilterType.RangeNumeric;
355
- this.name = faker.lorem.word();
356
- }
357
- }
358
- /**
359
- * A factory for creating a {@link DaffFilterRangeNumericRequest}.
360
- */
361
- class DaffFilterRequestRangeNumericFactory extends DaffModelFactory {
362
- constructor(option = new DaffFilterRangeNumericRequestOptionFactory()) {
363
- super(MockDaffFilterRangeNumericRequest);
364
- this.option = option;
365
- }
366
- create(partial = {}) {
367
- return {
368
- ...new this.type(),
369
- value: this.option.create(),
370
- ...partial,
371
- };
372
- }
373
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRequestRangeNumericFactory, deps: [{ token: DaffFilterRangeNumericRequestOptionFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
374
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRequestRangeNumericFactory, providedIn: 'root' }); }
375
- }
376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRequestRangeNumericFactory, decorators: [{
377
- type: Injectable,
378
- args: [{
379
- providedIn: 'root',
380
- }]
381
- }], ctorParameters: () => [{ type: DaffFilterRangeNumericRequestOptionFactory }] });
382
-
383
- /**
384
- * A factory for creating a {@link DaffFilterRequest}.
385
- */
386
- class DaffFilterRequestFactory extends DaffModelFactory {
387
- constructor(equalFactory, rangeFactory) {
388
- super(faker.number.int({ min: 1, max: 2 }) === 2 ? equalFactory.type : rangeFactory.type);
389
- }
390
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRequestFactory, deps: [{ token: DaffFilterRequestEqualFactory }, { token: DaffFilterRequestRangeNumericFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
391
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRequestFactory, providedIn: 'root' }); }
392
- }
393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRequestFactory, decorators: [{
394
- type: Injectable,
395
- args: [{
396
- providedIn: 'root',
397
- }]
398
- }], ctorParameters: () => [{ type: DaffFilterRequestEqualFactory }, { type: DaffFilterRequestRangeNumericFactory }] });
399
-
400
- class MockDaffFilterToggleEqualRequest {
401
- constructor() {
402
- this.type = DaffFilterType.Equal;
403
- this.name = faker.lorem.word();
404
- this.value = faker.string.uuid();
405
- }
406
- }
407
- /**
408
- * A factory for creating a {@link DaffFilterEqualToggleRequest}.
409
- */
410
- class DaffFilterToggleRequestEqualFactory extends DaffModelFactory {
411
- constructor() {
412
- super(MockDaffFilterToggleEqualRequest);
413
- }
414
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterToggleRequestEqualFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
415
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterToggleRequestEqualFactory, providedIn: 'root' }); }
416
- }
417
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterToggleRequestEqualFactory, decorators: [{
418
- type: Injectable,
419
- args: [{
420
- providedIn: 'root',
421
- }]
422
- }], ctorParameters: () => [] });
423
-
424
- class MockDaffFilterToggleRangeNumericRequest {
425
- constructor() {
426
- this.type = DaffFilterType.RangeNumeric;
427
- this.name = faker.lorem.word();
428
- }
429
- }
430
- /**
431
- * A factory for creating a {@link DaffFilterRangeNumericToggleRequest}.
432
- */
433
- class DaffFilterToggleRequestRangeNumericFactory extends DaffModelFactory {
434
- constructor(option) {
435
- super(MockDaffFilterToggleRangeNumericRequest);
436
- this.option = option;
437
- }
438
- create(partial = {}) {
439
- return {
440
- ...new this.type(),
441
- value: this.option.create(),
442
- ...partial,
443
- };
444
- }
445
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterToggleRequestRangeNumericFactory, deps: [{ token: DaffFilterRangeNumericRequestOptionFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
446
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterToggleRequestRangeNumericFactory, providedIn: 'root' }); }
447
- }
448
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterToggleRequestRangeNumericFactory, decorators: [{
449
- type: Injectable,
450
- args: [{
451
- providedIn: 'root',
452
- }]
453
- }], ctorParameters: () => [{ type: DaffFilterRangeNumericRequestOptionFactory }] });
454
-
455
- class MockDaffFilterToggleRequest {
456
- }
457
- /**
458
- * A factory for creating a {@link DaffFilterToggleRequest}.
459
- */
460
- class DaffFilterToggleRequestFactory extends DaffModelFactory {
461
- constructor(equalFactory, rangeFactory) {
462
- super(MockDaffFilterToggleRequest);
463
- this.equalFactory = equalFactory;
464
- this.rangeFactory = rangeFactory;
465
- }
466
- create(partial) {
467
- return {
468
- ...new this.type(),
469
- ...faker.number.int({ min: 1, max: 2 }) === 2 ? this.equalFactory.create() : this.rangeFactory.create(),
470
- };
471
- }
472
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterToggleRequestFactory, deps: [{ token: DaffFilterToggleRequestEqualFactory }, { token: DaffFilterToggleRequestRangeNumericFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
473
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterToggleRequestFactory, providedIn: 'root' }); }
474
- }
475
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterToggleRequestFactory, decorators: [{
476
- type: Injectable,
477
- args: [{
478
- providedIn: 'root',
479
- }]
480
- }], ctorParameters: () => [{ type: DaffFilterToggleRequestEqualFactory }, { type: DaffFilterToggleRequestRangeNumericFactory }] });
481
-
482
- class MockDaffFilterEqualOption {
483
- constructor() {
484
- this.applied = false;
485
- this.value = faker.string.uuid();
486
- this.label = faker.lorem.word();
487
- this.count = faker.number.int({ min: 1, max: 1000 });
488
- }
489
- }
490
- /**
491
- * A factory for creating a {@link DaffFilterEqualOption}.
492
- */
493
- class DaffFilterEqualOptionFactory extends DaffModelFactory {
494
- constructor() {
495
- super(MockDaffFilterEqualOption);
496
- }
497
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterEqualOptionFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
498
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterEqualOptionFactory, providedIn: 'root' }); }
499
- }
500
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterEqualOptionFactory, decorators: [{
501
- type: Injectable,
502
- args: [{
503
- providedIn: 'root',
504
- }]
505
- }], ctorParameters: () => [] });
506
-
507
- class MockFilterRangeNumericOption {
508
- constructor() {
509
- this.value = faker.number.int({ min: 0, max: 10 });
510
- this.label = faker.string.alpha({ length: 3 });
511
- }
512
- }
513
- /**
514
- * A factory for creating a {@link DaffFilterRangeOption}.
515
- */
516
- class DaffFilterRangeNumericOptionFactory extends DaffModelFactory {
517
- constructor() {
518
- super(MockFilterRangeNumericOption);
519
- }
520
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericOptionFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
521
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericOptionFactory, providedIn: 'root' }); }
522
- }
523
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericOptionFactory, decorators: [{
524
- type: Injectable,
525
- args: [{
526
- providedIn: 'root',
527
- }]
528
- }], ctorParameters: () => [] });
529
-
530
- class MockDaffFilterRangeNumericPair {
531
- constructor() {
532
- this.applied = true;
533
- }
534
- }
535
- /**
536
- * A factory for creating a {@link DaffFilterRangePair}.
537
- */
538
- class DaffFilterRangeNumericPairFactory extends DaffModelFactory {
539
- constructor(option) {
540
- super(MockDaffFilterRangeNumericPair);
541
- this.option = option;
542
- }
543
- create(partial = {}) {
544
- return {
545
- ...new this.type(),
546
- min: this.option.create({ value: faker.number.int({ min: 0, max: 100 }) }),
547
- max: this.option.create({ value: faker.number.int({ min: 100, max: 1000 }) }),
548
- ...partial,
549
- };
550
- }
551
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericPairFactory, deps: [{ token: DaffFilterRangeNumericOptionFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
552
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericPairFactory, providedIn: 'root' }); }
553
- }
554
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffFilterRangeNumericPairFactory, decorators: [{
555
- type: Injectable,
556
- args: [{
557
- providedIn: 'root',
558
- }]
559
- }], ctorParameters: () => [{ type: DaffFilterRangeNumericOptionFactory }] });
560
-
561
- /**
562
- * Mocked {@link DaffCollectionMetadata} object.
563
- */
564
- class MockCollectionMetadata {
565
- constructor(pageInfoFactory, sortFieldsFactory, filterFactory) {
566
- const _pageInfo = pageInfoFactory.create();
567
- const _sortFields = sortFieldsFactory.create();
568
- this.count = faker.number.int({ min: 1, max: 1000 });
569
- this.ids = new Array(this.count).fill(null).map(() => faker.string.uuid());
570
- this.currentPage = _pageInfo.currentPage;
571
- this.totalPages = _pageInfo.totalPages;
572
- this.pageSize = _pageInfo.pageSize;
573
- this.appliedSortDirection = _sortFields.appliedSortDirection;
574
- this.appliedSortOption = _sortFields.appliedSortOption;
575
- this.sortOptions = _sortFields.sortOptions;
576
- this.filters = daffFilterArrayToDict(filterFactory.createMany(faker.number.int({ min: 1, max: 5 })));
577
- }
578
- }
579
- /**
580
- * Factory for creating {@link DaffCollectionMetadata}s.
581
- */
582
- class DaffCollectionMetadataFactory extends DaffModelFactory {
583
- constructor(pageInfoFactory, sortFieldsFactory, filterFactory) {
584
- super(MockCollectionMetadata, pageInfoFactory, sortFieldsFactory, filterFactory);
585
- }
586
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCollectionMetadataFactory, deps: [{ token: DaffNumericallyPaginableFactory }, { token: DaffSortableFactory }, { token: DaffFilterFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
587
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCollectionMetadataFactory, providedIn: 'root' }); }
588
- }
589
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCollectionMetadataFactory, decorators: [{
590
- type: Injectable,
591
- args: [{
592
- providedIn: 'root',
593
- }]
594
- }], ctorParameters: () => [{ type: DaffNumericallyPaginableFactory }, { type: DaffSortableFactory }, { type: DaffFilterFactory }] });
595
-
596
- /**
597
- * Mocked {@link DaffCollectionRequest} object.
598
- */
599
- class MockCollectionRequest {
600
- constructor(filterRequestFactory) {
601
- this.filterRequestFactory = filterRequestFactory;
602
- this.currentPage = faker.number.int({ min: 1, max: 100 });
603
- this.appliedSortDirection = faker.helpers.arrayElement([DaffSortDirectionEnum.Ascending, DaffSortDirectionEnum.Descending]);
604
- this.pageSize = faker.number.int({ min: 1, max: 100 });
605
- this.appliedSortOption = faker.lorem.word();
606
- this.filterRequests = this.createFilterRequests();
607
- }
608
- createFilterRequests() {
609
- return this.filterRequestFactory.createMany(faker.number.int({ min: 1, max: 5 }));
610
- }
611
- }
612
- /**
613
- * Factory for creating {@link DaffCollectionRequest}s.
614
- */
615
- class DaffCollectionRequestFactory extends DaffModelFactory {
616
- constructor(filterRequestFactory) {
617
- super(MockCollectionRequest, filterRequestFactory);
618
- }
619
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCollectionRequestFactory, deps: [{ token: DaffFilterRequestFactory }], target: i0.ɵɵFactoryTarget.Injectable }); }
620
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCollectionRequestFactory, providedIn: 'root' }); }
621
- }
622
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCollectionRequestFactory, decorators: [{
623
- type: Injectable,
624
- args: [{
625
- providedIn: 'root',
626
- }]
627
- }], ctorParameters: () => [{ type: DaffFilterRequestFactory }] });
628
-
629
- /**
630
- * Mocked {@link DaffCollection} object.
631
- *
632
- * It should be customized by passing the factory for the contained entity as the first constructor argument.
633
- */
634
- class MockCollection {
635
- constructor(itemFactory, metadataFactory) {
636
- this.itemFactory = itemFactory;
637
- this.metadataFactory = metadataFactory;
638
- this._items = this.createItems();
639
- this.metadata = this.createMetadata();
640
- this.data = daffIdentifiableArrayToDict(this._items);
641
- }
642
- createItems() {
643
- return this.itemFactory.createMany();
644
- }
645
- createMetadata() {
646
- return this.metadataFactory.create({
647
- ids: this._items.map(({ id }) => id),
648
- count: this._items.length,
649
- });
650
- }
651
- }
652
-
653
- //@angular/core
654
-
655
- /**
656
- * Generated bundle index. Do not edit.
657
- */
658
-
659
1078
  export { DaffCollectionMetadataFactory, DaffCollectionRequestFactory, DaffCoreTestingModule, DaffFilterEqualFactory, DaffFilterEqualOptionFactory, DaffFilterFactory, DaffFilterRangeNumericFactory, DaffFilterRangeNumericOptionFactory, DaffFilterRangeNumericPairFactory, DaffFilterRangeNumericRequestOptionFactory, DaffFilterRequestEqualFactory, DaffFilterRequestFactory, DaffFilterRequestRangeNumericFactory, DaffFilterToggleRequestEqualFactory, DaffFilterToggleRequestFactory, DaffFilterToggleRequestRangeNumericFactory, DaffIdentifiableFactory, DaffMockCurrencyPipe, DaffModelFactory, DaffNumericallyPaginableFactory, DaffSortOptionFactory, DaffSortOptionsFactory, DaffSortableFactory, MockCollection, MockCollectionMetadata, MockCollectionRequest, MockDaffFilterEqualOption, MockDaffFilterEqualRequest, MockDaffFilterRangeNumericPair, MockDaffFilterRangeNumericRequest, MockDaffFilterRangeNumericRequestOption, MockDaffFilterToggleEqualRequest, MockDaffFilterToggleRangeNumericRequest, MockDaffIdentifiable, MockFilterEqual, MockFilterRangeNumeric, MockFilterRangeNumericOption, enforceUnique };
660
- //# sourceMappingURL=daffodil-core-testing.mjs.map
1079
+
1080
+ //# sourceMappingURL=daffodil-core-testing.mjs.map