@arsedizioni/ars-utils 19.0.13 → 19.0.15
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.
- package/core/core.module.d.ts +1 -7
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +14 -12
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-core.mjs +243 -467
- package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +13 -10
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-support.common.mjs +12 -10
- package/fesm2022/arsedizioni-ars-utils-support.common.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -1,150 +1,81 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject,
|
|
3
|
-
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
|
-
import { parseISO, parse, format, setHours, endOfDay, getYear, getMonth, getDate, getDay, getDaysInMonth, addYears, addMonths, addDays, formatISO, isDate, isValid } from 'date-fns';
|
|
5
|
-
import { it } from 'date-fns/locale';
|
|
2
|
+
import { inject, ElementRef, Directive, input, HostListener, output, Injectable, forwardRef, Pipe, EventEmitter, signal, RendererFactory2, computed, NgModule } from '@angular/core';
|
|
6
3
|
import { HttpParams } from '@angular/common/http';
|
|
4
|
+
import { parseISO, parse, format, setHours, endOfDay } from 'date-fns';
|
|
5
|
+
import { it } from 'date-fns/locale';
|
|
7
6
|
import { TZDate } from '@date-fns/tz';
|
|
8
|
-
import { NG_VALIDATORS } from '@angular/forms';
|
|
9
7
|
import { debounceTime } from 'rxjs/operators';
|
|
10
8
|
import { Subject, BehaviorSubject } from 'rxjs';
|
|
11
|
-
import {
|
|
9
|
+
import { NG_VALIDATORS } from '@angular/forms';
|
|
10
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
12
11
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
13
12
|
|
|
14
|
-
class
|
|
13
|
+
class AutoFocusDirective {
|
|
15
14
|
constructor() {
|
|
16
|
-
this.
|
|
15
|
+
this.elementRef = inject(ElementRef);
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
replaceValue = '<br>';
|
|
23
|
-
}
|
|
24
|
-
return this.sanitizer.bypassSecurityTrustHtml(value.replace(new RegExp(regexValue, 'g'), replaceValue));
|
|
17
|
+
ngAfterContentInit() {
|
|
18
|
+
setTimeout(() => {
|
|
19
|
+
this.elementRef.nativeElement.focus();
|
|
20
|
+
}, 500);
|
|
25
21
|
}
|
|
26
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
27
|
-
static { this.ɵ
|
|
28
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ReplacePipe }); }
|
|
22
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AutoFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
23
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: AutoFocusDirective, isStandalone: true, selector: "[autoFocus]", ngImport: i0 }); }
|
|
29
24
|
}
|
|
30
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
31
|
-
type:
|
|
32
|
-
}, {
|
|
33
|
-
type: Pipe,
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AutoFocusDirective, decorators: [{
|
|
26
|
+
type: Directive,
|
|
34
27
|
args: [{
|
|
35
|
-
|
|
28
|
+
selector: "[autoFocus]",
|
|
36
29
|
standalone: true
|
|
37
30
|
}]
|
|
38
31
|
}] });
|
|
39
32
|
|
|
40
|
-
class
|
|
41
|
-
|
|
42
|
-
this.
|
|
43
|
-
}
|
|
44
|
-
transform(value) {
|
|
45
|
-
return this.sanitizer.bypassSecurityTrustHtml(value ?? '');
|
|
33
|
+
class FileInfo {
|
|
34
|
+
isValid() {
|
|
35
|
+
return this.valid;
|
|
46
36
|
}
|
|
47
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SafeHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
48
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: SafeHtmlPipe, isStandalone: true, name: "safeHtml" }); }
|
|
49
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SafeHtmlPipe }); }
|
|
50
37
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
class ValueModel {
|
|
39
|
+
}
|
|
40
|
+
class IDModel {
|
|
41
|
+
}
|
|
42
|
+
class GroupModel {
|
|
43
|
+
}
|
|
44
|
+
class DeleteModel extends GroupModel {
|
|
45
|
+
}
|
|
46
|
+
class RelationModel {
|
|
47
|
+
}
|
|
48
|
+
class UpdateRelationsModel {
|
|
49
|
+
}
|
|
50
|
+
class QueryModel {
|
|
51
|
+
}
|
|
52
|
+
class ImportModel {
|
|
53
|
+
}
|
|
54
|
+
class DateInterval {
|
|
55
|
+
get fromAsDate() {
|
|
56
|
+
return this.from
|
|
57
|
+
? new Date(this.from.getFullYear(), this.from.getMonth(), this.from.getDate(), 2, 0, 0)
|
|
58
|
+
: null;
|
|
64
59
|
}
|
|
65
|
-
|
|
66
|
-
return this.
|
|
60
|
+
get toAsDate() {
|
|
61
|
+
return this.to
|
|
62
|
+
? new Date(this.to.getFullYear(), this.to.getMonth(), this.to.getDate(), 2, 0, 0)
|
|
63
|
+
: null;
|
|
67
64
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
type: Injectable
|
|
74
|
-
}, {
|
|
75
|
-
type: Pipe,
|
|
76
|
-
args: [{
|
|
77
|
-
name: 'safeUrl',
|
|
78
|
-
standalone: true
|
|
79
|
-
}]
|
|
80
|
-
}] });
|
|
81
|
-
|
|
82
|
-
class SearchCallbackPipe {
|
|
83
|
-
transform(items, callback) {
|
|
84
|
-
if (!items || !callback) {
|
|
85
|
-
return items;
|
|
86
|
-
}
|
|
87
|
-
return items.filter(item => callback(item));
|
|
65
|
+
constructor(from = null, to = null) {
|
|
66
|
+
this.from = null;
|
|
67
|
+
this.to = null;
|
|
68
|
+
this.from = from;
|
|
69
|
+
this.to = to;
|
|
88
70
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
name: 'callback',
|
|
96
|
-
pure: false,
|
|
97
|
-
standalone: true
|
|
98
|
-
}]
|
|
99
|
-
}] });
|
|
100
|
-
|
|
101
|
-
// ---------------------------------------------------------------------------------
|
|
102
|
-
// 2023.0921 aggiunto un campo opzionale di tipo SearchFilterMetadata per i conteggi
|
|
103
|
-
//
|
|
104
|
-
// - nel chiamante:
|
|
105
|
-
// let items: Searchable[] = [...];
|
|
106
|
-
// let myFilterText: string = 'testo del filtro';
|
|
107
|
-
// const myFilterMetadata: SearchFilterMetadata = { total: 0, count: 0 };
|
|
108
|
-
//
|
|
109
|
-
// <div *ngFor="let item of items | search:myFilterText:myFilterMetadata">
|
|
110
|
-
// <div>Totale: {{ myFilterMetadata.total }}, Filtrati: {{ myFilterMetadata.count }}</div>
|
|
111
|
-
// ---------------------------------------------------------------------------------
|
|
112
|
-
class SearchFilterPipe {
|
|
113
|
-
transform(items, value, metadata) {
|
|
114
|
-
// se non vengono passati i metadati ne crea una copia locale per evitare gli if
|
|
115
|
-
metadata = metadata || { total: 0, count: 0 };
|
|
116
|
-
if (!items || !value) {
|
|
117
|
-
return items;
|
|
118
|
-
}
|
|
119
|
-
let result = items.filter(item => {
|
|
120
|
-
if (item) {
|
|
121
|
-
if (item.searchBag)
|
|
122
|
-
return item.searchBag.name
|
|
123
|
-
.toLowerCase()
|
|
124
|
-
.indexOf(value.toLowerCase()) !== -1;
|
|
125
|
-
else
|
|
126
|
-
return item.toLowerCase().indexOf(value.toLowerCase()) !== -1;
|
|
127
|
-
}
|
|
128
|
-
return null;
|
|
129
|
-
});
|
|
130
|
-
// aggiorna i conteggi
|
|
131
|
-
metadata.total = items.length;
|
|
132
|
-
metadata.count = result.length;
|
|
133
|
-
return result;
|
|
71
|
+
/**
|
|
72
|
+
* Clear interval
|
|
73
|
+
*/
|
|
74
|
+
clear() {
|
|
75
|
+
this.from = null,
|
|
76
|
+
this.to = null;
|
|
134
77
|
}
|
|
135
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SearchFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
136
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: SearchFilterPipe, isStandalone: true, name: "search" }); }
|
|
137
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SearchFilterPipe }); }
|
|
138
78
|
}
|
|
139
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SearchFilterPipe, decorators: [{
|
|
140
|
-
type: Injectable
|
|
141
|
-
}, {
|
|
142
|
-
type: Pipe,
|
|
143
|
-
args: [{
|
|
144
|
-
name: 'search',
|
|
145
|
-
standalone: true
|
|
146
|
-
}]
|
|
147
|
-
}] });
|
|
148
79
|
|
|
149
80
|
var DateFormat;
|
|
150
81
|
(function (DateFormat) {
|
|
@@ -806,53 +737,43 @@ class SystemUtils {
|
|
|
806
737
|
}
|
|
807
738
|
}
|
|
808
739
|
|
|
809
|
-
class
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
case 'N0':
|
|
831
|
-
case 'number0':
|
|
832
|
-
if (value > 0)
|
|
833
|
-
return new Intl.NumberFormat('it-IT', { style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(value);
|
|
834
|
-
break;
|
|
835
|
-
case 'P':
|
|
836
|
-
case 'percentage':
|
|
837
|
-
if (value > 0)
|
|
838
|
-
return new Intl.NumberFormat('it-IT', { style: 'percent', minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(value);
|
|
839
|
-
break;
|
|
740
|
+
class DateIntervalChangeDirective {
|
|
741
|
+
constructor() {
|
|
742
|
+
this.dateIntervalChange = input(new DateInterval(null, null));
|
|
743
|
+
this.end = input(false);
|
|
744
|
+
this.subject = new Subject();
|
|
745
|
+
}
|
|
746
|
+
ngOnInit() {
|
|
747
|
+
this.subscription = this.subject
|
|
748
|
+
.pipe(debounceTime(100))
|
|
749
|
+
.subscribe((e) => {
|
|
750
|
+
const value = e.target.value;
|
|
751
|
+
SystemUtils.changeDateInterval(value, this.dateIntervalChange(), this.end(), e.key === ' ');
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
ngOnDestroy() {
|
|
755
|
+
this.subscription.unsubscribe();
|
|
756
|
+
}
|
|
757
|
+
onKeyup(event) {
|
|
758
|
+
if (event.key === ' ') {
|
|
759
|
+
event.preventDefault();
|
|
760
|
+
event.stopPropagation();
|
|
840
761
|
}
|
|
841
|
-
|
|
762
|
+
this.subject.next(event);
|
|
842
763
|
}
|
|
843
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
844
|
-
static { this.ɵ
|
|
845
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: FormatPipe }); }
|
|
764
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: DateIntervalChangeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
765
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.0", type: DateIntervalChangeDirective, isStandalone: true, selector: "[dateIntervalChange]", inputs: { dateIntervalChange: { classPropertyName: "dateIntervalChange", publicName: "dateIntervalChange", isSignal: true, isRequired: false, transformFunction: null }, end: { classPropertyName: "end", publicName: "end", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keyup": "onKeyup($event)" } }, ngImport: i0 }); }
|
|
846
766
|
}
|
|
847
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
848
|
-
type:
|
|
849
|
-
}, {
|
|
850
|
-
type: Pipe,
|
|
767
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: DateIntervalChangeDirective, decorators: [{
|
|
768
|
+
type: Directive,
|
|
851
769
|
args: [{
|
|
852
|
-
|
|
853
|
-
standalone: true
|
|
770
|
+
selector: '[dateIntervalChange]',
|
|
771
|
+
standalone: true,
|
|
854
772
|
}]
|
|
855
|
-
}]
|
|
773
|
+
}], propDecorators: { onKeyup: [{
|
|
774
|
+
type: HostListener,
|
|
775
|
+
args: ['keyup', ['$event']]
|
|
776
|
+
}] } });
|
|
856
777
|
|
|
857
778
|
class CopyClipboardDirective {
|
|
858
779
|
constructor() {
|
|
@@ -1388,305 +1309,185 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
1388
1309
|
}]
|
|
1389
1310
|
}] });
|
|
1390
1311
|
|
|
1391
|
-
class
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1312
|
+
class FormatPipe {
|
|
1313
|
+
transform(value, type = 'date', pattern = "dd/MM/yyyy") {
|
|
1314
|
+
if (!value)
|
|
1315
|
+
return null;
|
|
1316
|
+
switch (type) {
|
|
1317
|
+
case 'D':
|
|
1318
|
+
case 'date':
|
|
1319
|
+
const d = SystemUtils.parseDate(value, it);
|
|
1320
|
+
if (d)
|
|
1321
|
+
return format(d, pattern, { locale: it });
|
|
1322
|
+
break;
|
|
1323
|
+
case 'C':
|
|
1324
|
+
case 'currency':
|
|
1325
|
+
if (value > 0)
|
|
1326
|
+
return new Intl.NumberFormat('it-IT', { style: 'currency', currency: 'EUR' }).format(value);
|
|
1327
|
+
break;
|
|
1328
|
+
case 'N':
|
|
1329
|
+
case 'number':
|
|
1330
|
+
if (value > 0)
|
|
1331
|
+
return new Intl.NumberFormat('it-IT', { style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 2 }).format(value);
|
|
1332
|
+
break;
|
|
1333
|
+
case 'N0':
|
|
1334
|
+
case 'number0':
|
|
1335
|
+
if (value > 0)
|
|
1336
|
+
return new Intl.NumberFormat('it-IT', { style: 'decimal', minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(value);
|
|
1337
|
+
break;
|
|
1338
|
+
case 'P':
|
|
1339
|
+
case 'percentage':
|
|
1340
|
+
if (value > 0)
|
|
1341
|
+
return new Intl.NumberFormat('it-IT', { style: 'percent', minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(value);
|
|
1342
|
+
break;
|
|
1343
|
+
}
|
|
1344
|
+
return null;
|
|
1422
1345
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1346
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: FormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1347
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: FormatPipe, isStandalone: true, name: "format" }); }
|
|
1348
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: FormatPipe }); }
|
|
1349
|
+
}
|
|
1350
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: FormatPipe, decorators: [{
|
|
1351
|
+
type: Injectable
|
|
1352
|
+
}, {
|
|
1353
|
+
type: Pipe,
|
|
1354
|
+
args: [{
|
|
1355
|
+
name: 'format',
|
|
1356
|
+
standalone: true
|
|
1357
|
+
}]
|
|
1358
|
+
}] });
|
|
1359
|
+
|
|
1360
|
+
class ReplacePipe {
|
|
1361
|
+
constructor() {
|
|
1362
|
+
this.sanitizer = inject(DomSanitizer);
|
|
1428
1363
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1364
|
+
transform(value, regexValue, replaceValue) {
|
|
1365
|
+
if (!value)
|
|
1366
|
+
return null;
|
|
1367
|
+
if (regexValue === '\n' && !replaceValue) {
|
|
1368
|
+
replaceValue = '<br>';
|
|
1369
|
+
}
|
|
1370
|
+
return this.sanitizer.bypassSecurityTrustHtml(value.replace(new RegExp(regexValue, 'g'), replaceValue));
|
|
1435
1371
|
}
|
|
1372
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ReplacePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1373
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: ReplacePipe, isStandalone: true, name: "replace" }); }
|
|
1374
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ReplacePipe }); }
|
|
1436
1375
|
}
|
|
1376
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ReplacePipe, decorators: [{
|
|
1377
|
+
type: Injectable
|
|
1378
|
+
}, {
|
|
1379
|
+
type: Pipe,
|
|
1380
|
+
args: [{
|
|
1381
|
+
name: 'replace',
|
|
1382
|
+
standalone: true
|
|
1383
|
+
}]
|
|
1384
|
+
}] });
|
|
1437
1385
|
|
|
1438
|
-
class
|
|
1386
|
+
class SafeHtmlPipe {
|
|
1439
1387
|
constructor() {
|
|
1440
|
-
this.
|
|
1441
|
-
this.end = input(false);
|
|
1442
|
-
this.subject = new Subject();
|
|
1388
|
+
this.sanitizer = inject(DomSanitizer);
|
|
1443
1389
|
}
|
|
1444
|
-
|
|
1445
|
-
this.
|
|
1446
|
-
.pipe(debounceTime(100))
|
|
1447
|
-
.subscribe((e) => {
|
|
1448
|
-
const value = e.target.value;
|
|
1449
|
-
SystemUtils.changeDateInterval(value, this.dateIntervalChange(), this.end(), e.key === ' ');
|
|
1450
|
-
});
|
|
1390
|
+
transform(value) {
|
|
1391
|
+
return this.sanitizer.bypassSecurityTrustHtml(value ?? '');
|
|
1451
1392
|
}
|
|
1452
|
-
|
|
1453
|
-
|
|
1393
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SafeHtmlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1394
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: SafeHtmlPipe, isStandalone: true, name: "safeHtml" }); }
|
|
1395
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SafeHtmlPipe }); }
|
|
1396
|
+
}
|
|
1397
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SafeHtmlPipe, decorators: [{
|
|
1398
|
+
type: Injectable
|
|
1399
|
+
}, {
|
|
1400
|
+
type: Pipe,
|
|
1401
|
+
args: [{
|
|
1402
|
+
name: 'safeHtml',
|
|
1403
|
+
standalone: true
|
|
1404
|
+
}]
|
|
1405
|
+
}] });
|
|
1406
|
+
|
|
1407
|
+
class SafeUrlPipe {
|
|
1408
|
+
constructor() {
|
|
1409
|
+
this.sanitizer = inject(DomSanitizer);
|
|
1454
1410
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
event.preventDefault();
|
|
1458
|
-
event.stopPropagation();
|
|
1459
|
-
}
|
|
1460
|
-
this.subject.next(event);
|
|
1411
|
+
transform(value) {
|
|
1412
|
+
return this.sanitizer.bypassSecurityTrustResourceUrl(value ?? '');
|
|
1461
1413
|
}
|
|
1462
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
1463
|
-
static { this.ɵ
|
|
1414
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SafeUrlPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1415
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: SafeUrlPipe, isStandalone: true, name: "safeUrl" }); }
|
|
1416
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SafeUrlPipe }); }
|
|
1464
1417
|
}
|
|
1465
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
1466
|
-
type:
|
|
1418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SafeUrlPipe, decorators: [{
|
|
1419
|
+
type: Injectable
|
|
1420
|
+
}, {
|
|
1421
|
+
type: Pipe,
|
|
1467
1422
|
args: [{
|
|
1468
|
-
|
|
1469
|
-
standalone: true
|
|
1423
|
+
name: 'safeUrl',
|
|
1424
|
+
standalone: true
|
|
1470
1425
|
}]
|
|
1471
|
-
}]
|
|
1472
|
-
type: HostListener,
|
|
1473
|
-
args: ['keyup', ['$event']]
|
|
1474
|
-
}] } });
|
|
1426
|
+
}] });
|
|
1475
1427
|
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1428
|
+
class SearchCallbackPipe {
|
|
1429
|
+
transform(items, callback) {
|
|
1430
|
+
if (!items || !callback) {
|
|
1431
|
+
return items;
|
|
1432
|
+
}
|
|
1433
|
+
return items.filter(item => callback(item));
|
|
1481
1434
|
}
|
|
1482
|
-
|
|
1435
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SearchCallbackPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1436
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: SearchCallbackPipe, isStandalone: true, name: "callback", pure: false }); }
|
|
1483
1437
|
}
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
super();
|
|
1511
|
-
if (matDateLocale) {
|
|
1512
|
-
this.setLocale(matDateLocale);
|
|
1438
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SearchCallbackPipe, decorators: [{
|
|
1439
|
+
type: Pipe,
|
|
1440
|
+
args: [{
|
|
1441
|
+
name: 'callback',
|
|
1442
|
+
pure: false,
|
|
1443
|
+
standalone: true
|
|
1444
|
+
}]
|
|
1445
|
+
}] });
|
|
1446
|
+
|
|
1447
|
+
// ---------------------------------------------------------------------------------
|
|
1448
|
+
// 2023.0921 aggiunto un campo opzionale di tipo SearchFilterMetadata per i conteggi
|
|
1449
|
+
//
|
|
1450
|
+
// - nel chiamante:
|
|
1451
|
+
// let items: Searchable[] = [...];
|
|
1452
|
+
// let myFilterText: string = 'testo del filtro';
|
|
1453
|
+
// const myFilterMetadata: SearchFilterMetadata = { total: 0, count: 0 };
|
|
1454
|
+
//
|
|
1455
|
+
// <div *ngFor="let item of items | search:myFilterText:myFilterMetadata">
|
|
1456
|
+
// <div>Totale: {{ myFilterMetadata.total }}, Filtrati: {{ myFilterMetadata.count }}</div>
|
|
1457
|
+
// ---------------------------------------------------------------------------------
|
|
1458
|
+
class SearchFilterPipe {
|
|
1459
|
+
transform(items, value, metadata) {
|
|
1460
|
+
// se non vengono passati i metadati ne crea una copia locale per evitare gli if
|
|
1461
|
+
metadata = metadata || { total: 0, count: 0 };
|
|
1462
|
+
if (!items || !value) {
|
|
1463
|
+
return items;
|
|
1513
1464
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
return getDate(date);
|
|
1523
|
-
}
|
|
1524
|
-
getDayOfWeek(date) {
|
|
1525
|
-
return getDay(date);
|
|
1526
|
-
}
|
|
1527
|
-
getMonthNames(style) {
|
|
1528
|
-
const pattern = MONTH_FORMATS[style];
|
|
1529
|
-
return range(12, i => this.format(new Date(2017, i, 1), pattern));
|
|
1530
|
-
}
|
|
1531
|
-
getDateNames() {
|
|
1532
|
-
const dtf = typeof Intl !== 'undefined'
|
|
1533
|
-
? new Intl.DateTimeFormat(this.locale.code, {
|
|
1534
|
-
day: 'numeric',
|
|
1535
|
-
timeZone: 'utc',
|
|
1536
|
-
})
|
|
1537
|
-
: null;
|
|
1538
|
-
return range(31, i => {
|
|
1539
|
-
if (dtf) {
|
|
1540
|
-
// date-fns doesn't appear to support this functionality.
|
|
1541
|
-
// Fall back to `Intl` on supported browsers.
|
|
1542
|
-
const date = new Date();
|
|
1543
|
-
date.setUTCFullYear(2017, 0, i + 1);
|
|
1544
|
-
date.setUTCHours(0, 0, 0, 0);
|
|
1545
|
-
return dtf.format(date).replace(/[\u200e\u200f]/g, '');
|
|
1465
|
+
let result = items.filter(item => {
|
|
1466
|
+
if (item) {
|
|
1467
|
+
if (item.searchBag)
|
|
1468
|
+
return item.searchBag.name
|
|
1469
|
+
.toLowerCase()
|
|
1470
|
+
.indexOf(value.toLowerCase()) !== -1;
|
|
1471
|
+
else
|
|
1472
|
+
return item.toLowerCase().indexOf(value.toLowerCase()) !== -1;
|
|
1546
1473
|
}
|
|
1547
|
-
return
|
|
1474
|
+
return null;
|
|
1548
1475
|
});
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
return range(7, i => this.format(new Date(2017, 0, i + 1), pattern));
|
|
1553
|
-
}
|
|
1554
|
-
getYearName(date) {
|
|
1555
|
-
return this.format(date, 'y');
|
|
1556
|
-
}
|
|
1557
|
-
getFirstDayOfWeek() {
|
|
1558
|
-
return this.locale.options?.weekStartsOn ?? 0;
|
|
1559
|
-
}
|
|
1560
|
-
getNumDaysInMonth(date) {
|
|
1561
|
-
return getDaysInMonth(date);
|
|
1562
|
-
}
|
|
1563
|
-
clone(date) {
|
|
1564
|
-
return new Date(date.getTime());
|
|
1565
|
-
}
|
|
1566
|
-
createDate(year, month, date) {
|
|
1567
|
-
// Check for invalid month and date (except upper bound on date which we have to check after
|
|
1568
|
-
// creating the Date).
|
|
1569
|
-
if (month < 0 || month > 11) {
|
|
1570
|
-
throw Error(`Invalid month index "${month}". Month index has to be between 0 and 11.`);
|
|
1571
|
-
}
|
|
1572
|
-
if (date < 1) {
|
|
1573
|
-
throw Error(`Invalid date "${date}". Date has to be greater than 0.`);
|
|
1574
|
-
}
|
|
1575
|
-
// Passing the year to the constructor causes year numbers <100 to be converted to 19xx.
|
|
1576
|
-
// To work around this we use `setFullYear` and `setHours` instead.
|
|
1577
|
-
let result = new Date();
|
|
1578
|
-
result.setFullYear(year, month, date);
|
|
1579
|
-
result.setHours(0, 0, 0, 0);
|
|
1580
|
-
result = new TZDate(result, "UTC");
|
|
1581
|
-
// Check that the date wasn't above the upper bound for the month, causing the month to overflow
|
|
1582
|
-
if (result.getMonth() != month) {
|
|
1583
|
-
throw Error(`Invalid date "${date}" for month with index "${month}".`);
|
|
1584
|
-
}
|
|
1476
|
+
// aggiorna i conteggi
|
|
1477
|
+
metadata.total = items.length;
|
|
1478
|
+
metadata.count = result.length;
|
|
1585
1479
|
return result;
|
|
1586
1480
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
}
|
|
1590
|
-
parse(value, parseFormat) {
|
|
1591
|
-
if (typeof value == 'string' && value.length > 0) {
|
|
1592
|
-
let iso8601Date = parseISO(value);
|
|
1593
|
-
if (this.isValid(iso8601Date)) {
|
|
1594
|
-
iso8601Date = new TZDate(iso8601Date, "UTC");
|
|
1595
|
-
return iso8601Date;
|
|
1596
|
-
}
|
|
1597
|
-
const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];
|
|
1598
|
-
if (!parseFormat.length) {
|
|
1599
|
-
throw Error('Formats array must not be empty.');
|
|
1600
|
-
}
|
|
1601
|
-
for (const currentFormat of formats) {
|
|
1602
|
-
let fromFormat = parse(value, currentFormat, new Date(), { locale: this.locale });
|
|
1603
|
-
if (this.isValid(fromFormat)) {
|
|
1604
|
-
fromFormat = new TZDate(fromFormat, "UTC");
|
|
1605
|
-
return fromFormat;
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
return this.invalid();
|
|
1609
|
-
}
|
|
1610
|
-
else if (typeof value === 'number') {
|
|
1611
|
-
return new Date(value);
|
|
1612
|
-
}
|
|
1613
|
-
else if (value instanceof Date) {
|
|
1614
|
-
return this.clone(value);
|
|
1615
|
-
}
|
|
1616
|
-
return null;
|
|
1617
|
-
}
|
|
1618
|
-
format(date, displayFormat) {
|
|
1619
|
-
if (!this.isValid(date)) {
|
|
1620
|
-
throw Error('DateFnsAdapter: Cannot format invalid date.');
|
|
1621
|
-
}
|
|
1622
|
-
return format(date, displayFormat, { locale: this.locale });
|
|
1623
|
-
}
|
|
1624
|
-
addCalendarYears(date, years) {
|
|
1625
|
-
return addYears(date, years);
|
|
1626
|
-
}
|
|
1627
|
-
addCalendarMonths(date, months) {
|
|
1628
|
-
return addMonths(date, months);
|
|
1629
|
-
}
|
|
1630
|
-
addCalendarDays(date, days) {
|
|
1631
|
-
return addDays(date, days);
|
|
1632
|
-
}
|
|
1633
|
-
toIso8601(date) {
|
|
1634
|
-
return formatISO(date, { representation: 'date' });
|
|
1635
|
-
}
|
|
1636
|
-
/**
|
|
1637
|
-
* Returns the given value if given a valid Date or null. Deserializes valid ISO 8601 strings
|
|
1638
|
-
* (https://www.ietf.org/rfc/rfc3339.txt) into valid Dates and empty string into null. Returns an
|
|
1639
|
-
* invalid date for all other values.
|
|
1640
|
-
*/
|
|
1641
|
-
deserialize(value) {
|
|
1642
|
-
if (typeof value === 'string') {
|
|
1643
|
-
if (!value) {
|
|
1644
|
-
return null;
|
|
1645
|
-
}
|
|
1646
|
-
const date = parseISO(value);
|
|
1647
|
-
if (this.isValid(date)) {
|
|
1648
|
-
return date;
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
return super.deserialize(value);
|
|
1652
|
-
}
|
|
1653
|
-
isDateInstance(obj) {
|
|
1654
|
-
return isDate(obj);
|
|
1655
|
-
}
|
|
1656
|
-
isValid(date) {
|
|
1657
|
-
return isValid(date);
|
|
1658
|
-
}
|
|
1659
|
-
invalid() {
|
|
1660
|
-
return new Date(NaN);
|
|
1661
|
-
}
|
|
1662
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: DateFnsAdapter, deps: [{ token: MAT_DATE_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1663
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: DateFnsAdapter }); }
|
|
1481
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SearchFilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1482
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: SearchFilterPipe, isStandalone: true, name: "search" }); }
|
|
1483
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SearchFilterPipe }); }
|
|
1664
1484
|
}
|
|
1665
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type:
|
|
1485
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: SearchFilterPipe, decorators: [{
|
|
1666
1486
|
type: Injectable
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
}, {
|
|
1670
|
-
type: Inject,
|
|
1671
|
-
args: [MAT_DATE_LOCALE]
|
|
1672
|
-
}] }] });
|
|
1673
|
-
|
|
1674
|
-
class AutoFocusDirective {
|
|
1675
|
-
constructor() {
|
|
1676
|
-
this.elementRef = inject(ElementRef);
|
|
1677
|
-
}
|
|
1678
|
-
ngAfterContentInit() {
|
|
1679
|
-
setTimeout(() => {
|
|
1680
|
-
this.elementRef.nativeElement.focus();
|
|
1681
|
-
}, 500);
|
|
1682
|
-
}
|
|
1683
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AutoFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1684
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0", type: AutoFocusDirective, isStandalone: true, selector: "[autoFocus]", ngImport: i0 }); }
|
|
1685
|
-
}
|
|
1686
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: AutoFocusDirective, decorators: [{
|
|
1687
|
-
type: Directive,
|
|
1487
|
+
}, {
|
|
1488
|
+
type: Pipe,
|
|
1688
1489
|
args: [{
|
|
1689
|
-
|
|
1490
|
+
name: 'search',
|
|
1690
1491
|
standalone: true
|
|
1691
1492
|
}]
|
|
1692
1493
|
}] });
|
|
@@ -2114,31 +1915,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
2114
1915
|
}]
|
|
2115
1916
|
}], ctorParameters: () => [] });
|
|
2116
1917
|
|
|
2117
|
-
class ArsDateFnsModule {
|
|
2118
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ArsDateFnsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2119
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: ArsDateFnsModule }); }
|
|
2120
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ArsDateFnsModule, providers: [
|
|
2121
|
-
{
|
|
2122
|
-
provide: DateAdapter,
|
|
2123
|
-
useClass: DateFnsAdapter,
|
|
2124
|
-
deps: [MAT_DATE_LOCALE],
|
|
2125
|
-
},
|
|
2126
|
-
{ provide: MAT_DATE_FORMATS, useValue: MAT_DATE_FNS_FORMATS }
|
|
2127
|
-
] }); }
|
|
2128
|
-
}
|
|
2129
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ArsDateFnsModule, decorators: [{
|
|
2130
|
-
type: NgModule,
|
|
2131
|
-
args: [{
|
|
2132
|
-
providers: [
|
|
2133
|
-
{
|
|
2134
|
-
provide: DateAdapter,
|
|
2135
|
-
useClass: DateFnsAdapter,
|
|
2136
|
-
deps: [MAT_DATE_LOCALE],
|
|
2137
|
-
},
|
|
2138
|
-
{ provide: MAT_DATE_FORMATS, useValue: MAT_DATE_FNS_FORMATS }
|
|
2139
|
-
],
|
|
2140
|
-
}]
|
|
2141
|
-
}] });
|
|
2142
1918
|
class ArsCoreModule {
|
|
2143
1919
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0", ngImport: i0, type: ArsCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2144
1920
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0", ngImport: i0, type: ArsCoreModule, imports: [FileSizeValidatorDirective,
|
|
@@ -2251,5 +2027,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
2251
2027
|
* Generated bundle index. Do not edit.
|
|
2252
2028
|
*/
|
|
2253
2029
|
|
|
2254
|
-
export { ArsCoreModule,
|
|
2030
|
+
export { ArsCoreModule, AutoFocusDirective, BroadcastChannelManager, BroadcastService, CopyClipboardDirective, DateFormat, DateInterval, DateIntervalChangeDirective, DeleteModel, EmailsValidatorDirective, EnvironmentService, EqualsValidatorDirective, FileInfo, FileSizeValidatorDirective, FormatPipe, GroupModel, GuidValidatorDirective, IDModel, ImportModel, NotEqualValidatorDirective, NotFutureValidatorDirective, PasswordValidatorDirective, QueryModel, RelationModel, ReplacePipe, SafeHtmlPipe, SafeUrlPipe, ScreenService, SearchCallbackPipe, SearchFilterPipe, SelectableModel, SqlDateValidatorDirective, SystemUtils, ThemeService, TimeValidatorDirective, UpdateRelationsModel, UrlValidatorDirective, ValidIfDirective, ValidatorDirective, ValueModel };
|
|
2255
2031
|
//# sourceMappingURL=arsedizioni-ars-utils-core.mjs.map
|