@guajiritos/general-autocomplete 0.0.7 → 0.0.8
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/esm2020/guajiritos-general-autocomplete.mjs +4 -4
- package/esm2020/lib/guachos-general-autocomplete.component.mjs +327 -319
- package/esm2020/lib/guachos-general-autocomplete.module.mjs +108 -108
- package/esm2020/public-api.mjs +7 -7
- package/esm2020/utils/constants/contacts.mjs +9 -9
- package/esm2020/utils/interfaces/interfaces.mjs +11 -11
- package/esm2020/utils/pipes/duration.pipe.mjs +17 -17
- package/esm2020/utils/pipes/humanize-duration.pipe.mjs +16 -16
- package/esm2020/utils/pipes/i18n-field.pipe.mjs +27 -27
- package/esm2020/utils/pipes/ida-return.pipe.mjs +22 -22
- package/esm2020/utils/pipes/resolve-property-path.pipe.mjs +79 -79
- package/esm2020/utils/pipes/show-roles.pipe.mjs +23 -23
- package/esm2020/utils/pipes/show-segments.pipe.mjs +23 -23
- package/esm2020/utils/pipes/show-transport-types.pipe.mjs +23 -23
- package/esm2020/utils/services/autocomplete.service.mjs +160 -160
- package/esm2020/utils/services/utils.service.mjs +47 -47
- package/fesm2015/guajiritos-general-autocomplete.mjs +800 -792
- package/fesm2015/guajiritos-general-autocomplete.mjs.map +1 -1
- package/fesm2020/guajiritos-general-autocomplete.mjs +796 -788
- package/fesm2020/guajiritos-general-autocomplete.mjs.map +1 -1
- package/index.d.ts +5 -5
- package/lib/guachos-general-autocomplete.component.d.ts +72 -72
- package/lib/guachos-general-autocomplete.module.d.ts +24 -24
- package/package.json +1 -1
- package/public-api.d.ts +4 -4
- package/utils/constants/contacts.d.ts +2 -2
- package/utils/interfaces/interfaces.d.ts +33 -33
- package/utils/pipes/duration.pipe.d.ts +8 -8
- package/utils/pipes/humanize-duration.pipe.d.ts +7 -7
- package/utils/pipes/i18n-field.pipe.d.ts +7 -7
- package/utils/pipes/ida-return.pipe.d.ts +8 -8
- package/utils/pipes/resolve-property-path.pipe.d.ts +24 -24
- package/utils/pipes/show-roles.pipe.d.ts +8 -8
- package/utils/pipes/show-segments.pipe.d.ts +8 -8
- package/utils/pipes/show-transport-types.pipe.d.ts +8 -8
- package/utils/services/autocomplete.service.d.ts +15 -15
- package/utils/services/utils.service.d.ts +25 -25
@@ -25,824 +25,832 @@ import * as i10 from '@angular/material/autocomplete';
|
|
25
25
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
26
26
|
import * as i11 from '@angular/material/core';
|
27
27
|
|
28
|
-
var CustomPipes;
|
29
|
-
(function (CustomPipes) {
|
30
|
-
CustomPipes["SHOW_SEGMENTS"] = "showSegments";
|
31
|
-
CustomPipes["DURATION_TIME"] = "durationTime";
|
32
|
-
CustomPipes["HUMANIZE_DURATION"] = "humanizeDuration";
|
33
|
-
CustomPipes["SHOW_TRANSPORT_TYPES"] = "showTransportTypes";
|
34
|
-
CustomPipes["SHOW_ROLES"] = "showRoles";
|
35
|
-
CustomPipes["IDA_RETURN"] = "idaReturn";
|
36
|
-
CustomPipes["CURRENCY"] = "currency";
|
37
|
-
CustomPipes["UPPERCASE"] = "uppercase";
|
28
|
+
var CustomPipes;
|
29
|
+
(function (CustomPipes) {
|
30
|
+
CustomPipes["SHOW_SEGMENTS"] = "showSegments";
|
31
|
+
CustomPipes["DURATION_TIME"] = "durationTime";
|
32
|
+
CustomPipes["HUMANIZE_DURATION"] = "humanizeDuration";
|
33
|
+
CustomPipes["SHOW_TRANSPORT_TYPES"] = "showTransportTypes";
|
34
|
+
CustomPipes["SHOW_ROLES"] = "showRoles";
|
35
|
+
CustomPipes["IDA_RETURN"] = "idaReturn";
|
36
|
+
CustomPipes["CURRENCY"] = "currency";
|
37
|
+
CustomPipes["UPPERCASE"] = "uppercase";
|
38
38
|
})(CustomPipes || (CustomPipes = {}));
|
39
39
|
|
40
|
-
const GENERAL_DISPLAY_OPTIONS = {
|
41
|
-
firthLabel: [
|
42
|
-
{
|
43
|
-
type: 'path',
|
44
|
-
path: ['name']
|
45
|
-
}
|
46
|
-
],
|
47
|
-
applyTranslate: true
|
40
|
+
const GENERAL_DISPLAY_OPTIONS = {
|
41
|
+
firthLabel: [
|
42
|
+
{
|
43
|
+
type: 'path',
|
44
|
+
path: ['name']
|
45
|
+
}
|
46
|
+
],
|
47
|
+
applyTranslate: true
|
48
48
|
};
|
49
49
|
|
50
|
-
class AutocompleteService {
|
51
|
-
constructor(_httpClient) {
|
52
|
-
this._httpClient = _httpClient;
|
53
|
-
this.httpOptions = {};
|
54
|
-
}
|
55
|
-
processParams(filters, value) {
|
56
|
-
return new Promise((resolve, reject) => {
|
57
|
-
setTimeout(async () => {
|
58
|
-
let filter = {};
|
59
|
-
if (Array.isArray(filters)) {
|
60
|
-
for (const f of filters) {
|
61
|
-
await this.processFilterString(f, value).then((resp) => {
|
62
|
-
if (Object.keys(filter)?.length) {
|
63
|
-
merge(filter, resp);
|
64
|
-
}
|
65
|
-
else {
|
66
|
-
filter = {
|
67
|
-
...filter,
|
68
|
-
...resp
|
69
|
-
};
|
70
|
-
}
|
71
|
-
if (f === filters[filters?.length - 1]) {
|
72
|
-
resolve(filter);
|
73
|
-
}
|
74
|
-
});
|
75
|
-
}
|
76
|
-
}
|
77
|
-
else if (typeof filters === 'string') {
|
78
|
-
await this.processFilterString(filters, value).then((resp) => {
|
79
|
-
filter = {
|
80
|
-
...filter,
|
81
|
-
...resp
|
82
|
-
};
|
83
|
-
resolve(filter);
|
84
|
-
});
|
85
|
-
}
|
86
|
-
else {
|
87
|
-
reject(null);
|
88
|
-
}
|
89
|
-
}, 100);
|
90
|
-
});
|
91
|
-
}
|
92
|
-
async processFilterString(filter, value) {
|
93
|
-
let f = {};
|
94
|
-
const arrayFilters = filter?.split('[');
|
95
|
-
if (arrayFilters?.findIndex((a) => a === 'filter') >= 0) {
|
96
|
-
arrayFilters?.splice(0, 1);
|
97
|
-
}
|
98
|
-
await this.createObjectFilters(arrayFilters, value).then((data) => {
|
99
|
-
f = data;
|
100
|
-
});
|
101
|
-
return f;
|
102
|
-
}
|
103
|
-
async createObjectFilters(array, value) {
|
104
|
-
for (let filter of array) {
|
105
|
-
filter = filter?.replace(']', '');
|
106
|
-
if (array.length > 1) {
|
107
|
-
array.splice(0, 1);
|
108
|
-
return { [filter]: await this.createObjectFilters(array, value) };
|
109
|
-
}
|
110
|
-
else {
|
111
|
-
if (filter === '$like') {
|
112
|
-
return { [filter]: '%' + value + '%' };
|
113
|
-
}
|
114
|
-
else {
|
115
|
-
return { [filter]: value };
|
116
|
-
}
|
117
|
-
}
|
118
|
-
}
|
119
|
-
}
|
120
|
-
async getAutocompleteByText(url, text, field, restrictions, removeProperties, order, bodyRequest) {
|
121
|
-
let httpParams = new HttpParams().set('offset', '0');
|
122
|
-
httpParams = httpParams.append('limit', '20');
|
123
|
-
if (order) {
|
124
|
-
httpParams = httpParams.append('order', order);
|
125
|
-
}
|
126
|
-
if (!text) {
|
127
|
-
text = '';
|
128
|
-
}
|
129
|
-
if (bodyRequest) {
|
130
|
-
let body = {};
|
131
|
-
if (text && text !== '') {
|
132
|
-
await this.processParams(field, text)
|
133
|
-
.then((data) => {
|
134
|
-
body = {
|
135
|
-
...bodyRequest,
|
136
|
-
filter: data
|
137
|
-
};
|
138
|
-
});
|
139
|
-
}
|
140
|
-
else {
|
141
|
-
body = JSON.parse(JSON.stringify(bodyRequest));
|
142
|
-
}
|
143
|
-
if (restrictions?.length) {
|
144
|
-
for (let r of restrictions) {
|
145
|
-
await this.processParams(r?.filter, r?.value?.toString())
|
146
|
-
.then((data) => {
|
147
|
-
let filtersAux = { ...body?.filter };
|
148
|
-
merge(filtersAux, data);
|
149
|
-
body = {
|
150
|
-
...body,
|
151
|
-
filter: filtersAux
|
152
|
-
};
|
153
|
-
httpParams = httpParams.set('form', JSON.stringify(body));
|
154
|
-
});
|
155
|
-
}
|
156
|
-
}
|
157
|
-
else {
|
158
|
-
httpParams = httpParams.append('form', JSON.stringify(body));
|
159
|
-
}
|
160
|
-
}
|
161
|
-
else {
|
162
|
-
if (text && text !== '') {
|
163
|
-
if (Array.isArray(field)) {
|
164
|
-
for (const f of field) {
|
165
|
-
httpParams = httpParams.append(f, '%' + text + '%');
|
166
|
-
}
|
167
|
-
}
|
168
|
-
else {
|
169
|
-
if (field?.includes('$like')) {
|
170
|
-
httpParams = httpParams.append(field, '%' + text + '%');
|
171
|
-
}
|
172
|
-
else if (field) {
|
173
|
-
httpParams = httpParams.append(field, text);
|
174
|
-
}
|
175
|
-
}
|
176
|
-
}
|
177
|
-
restrictions?.forEach((restriction) => {
|
178
|
-
if (restriction?.value) {
|
179
|
-
httpParams = httpParams.append(restriction?.filter, restriction.value?.toString());
|
180
|
-
}
|
181
|
-
});
|
182
|
-
}
|
183
|
-
this.httpOptions = { params: httpParams };
|
184
|
-
return this._httpClient
|
185
|
-
.get(url, this.httpOptions)
|
186
|
-
.pipe(map((result) => {
|
187
|
-
result?.data?.map((item) => {
|
188
|
-
removeProperties?.forEach((property) => {
|
189
|
-
delete item[property];
|
190
|
-
});
|
191
|
-
});
|
192
|
-
return result;
|
193
|
-
}));
|
194
|
-
}
|
195
|
-
}
|
196
|
-
AutocompleteService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AutocompleteService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
197
|
-
AutocompleteService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AutocompleteService, providedIn: 'root' });
|
198
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AutocompleteService, decorators: [{
|
199
|
-
type: Injectable,
|
200
|
-
args: [{
|
201
|
-
providedIn: 'root'
|
202
|
-
}]
|
50
|
+
class AutocompleteService {
|
51
|
+
constructor(_httpClient) {
|
52
|
+
this._httpClient = _httpClient;
|
53
|
+
this.httpOptions = {};
|
54
|
+
}
|
55
|
+
processParams(filters, value) {
|
56
|
+
return new Promise((resolve, reject) => {
|
57
|
+
setTimeout(async () => {
|
58
|
+
let filter = {};
|
59
|
+
if (Array.isArray(filters)) {
|
60
|
+
for (const f of filters) {
|
61
|
+
await this.processFilterString(f, value).then((resp) => {
|
62
|
+
if (Object.keys(filter)?.length) {
|
63
|
+
merge(filter, resp);
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
filter = {
|
67
|
+
...filter,
|
68
|
+
...resp
|
69
|
+
};
|
70
|
+
}
|
71
|
+
if (f === filters[filters?.length - 1]) {
|
72
|
+
resolve(filter);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
}
|
77
|
+
else if (typeof filters === 'string') {
|
78
|
+
await this.processFilterString(filters, value).then((resp) => {
|
79
|
+
filter = {
|
80
|
+
...filter,
|
81
|
+
...resp
|
82
|
+
};
|
83
|
+
resolve(filter);
|
84
|
+
});
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
reject(null);
|
88
|
+
}
|
89
|
+
}, 100);
|
90
|
+
});
|
91
|
+
}
|
92
|
+
async processFilterString(filter, value) {
|
93
|
+
let f = {};
|
94
|
+
const arrayFilters = filter?.split('[');
|
95
|
+
if (arrayFilters?.findIndex((a) => a === 'filter') >= 0) {
|
96
|
+
arrayFilters?.splice(0, 1);
|
97
|
+
}
|
98
|
+
await this.createObjectFilters(arrayFilters, value).then((data) => {
|
99
|
+
f = data;
|
100
|
+
});
|
101
|
+
return f;
|
102
|
+
}
|
103
|
+
async createObjectFilters(array, value) {
|
104
|
+
for (let filter of array) {
|
105
|
+
filter = filter?.replace(']', '');
|
106
|
+
if (array.length > 1) {
|
107
|
+
array.splice(0, 1);
|
108
|
+
return { [filter]: await this.createObjectFilters(array, value) };
|
109
|
+
}
|
110
|
+
else {
|
111
|
+
if (filter === '$like') {
|
112
|
+
return { [filter]: '%' + value + '%' };
|
113
|
+
}
|
114
|
+
else {
|
115
|
+
return { [filter]: value };
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
async getAutocompleteByText(url, text, field, restrictions, removeProperties, order, bodyRequest) {
|
121
|
+
let httpParams = new HttpParams().set('offset', '0');
|
122
|
+
httpParams = httpParams.append('limit', '20');
|
123
|
+
if (order) {
|
124
|
+
httpParams = httpParams.append('order', order);
|
125
|
+
}
|
126
|
+
if (!text) {
|
127
|
+
text = '';
|
128
|
+
}
|
129
|
+
if (bodyRequest) {
|
130
|
+
let body = {};
|
131
|
+
if (text && text !== '') {
|
132
|
+
await this.processParams(field, text)
|
133
|
+
.then((data) => {
|
134
|
+
body = {
|
135
|
+
...bodyRequest,
|
136
|
+
filter: data
|
137
|
+
};
|
138
|
+
});
|
139
|
+
}
|
140
|
+
else {
|
141
|
+
body = JSON.parse(JSON.stringify(bodyRequest));
|
142
|
+
}
|
143
|
+
if (restrictions?.length) {
|
144
|
+
for (let r of restrictions) {
|
145
|
+
await this.processParams(r?.filter, r?.value?.toString())
|
146
|
+
.then((data) => {
|
147
|
+
let filtersAux = { ...body?.filter };
|
148
|
+
merge(filtersAux, data);
|
149
|
+
body = {
|
150
|
+
...body,
|
151
|
+
filter: filtersAux
|
152
|
+
};
|
153
|
+
httpParams = httpParams.set('form', JSON.stringify(body));
|
154
|
+
});
|
155
|
+
}
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
httpParams = httpParams.append('form', JSON.stringify(body));
|
159
|
+
}
|
160
|
+
}
|
161
|
+
else {
|
162
|
+
if (text && text !== '') {
|
163
|
+
if (Array.isArray(field)) {
|
164
|
+
for (const f of field) {
|
165
|
+
httpParams = httpParams.append(f, '%' + text + '%');
|
166
|
+
}
|
167
|
+
}
|
168
|
+
else {
|
169
|
+
if (field?.includes('$like')) {
|
170
|
+
httpParams = httpParams.append(field, '%' + text + '%');
|
171
|
+
}
|
172
|
+
else if (field) {
|
173
|
+
httpParams = httpParams.append(field, text);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
restrictions?.forEach((restriction) => {
|
178
|
+
if (restriction?.value) {
|
179
|
+
httpParams = httpParams.append(restriction?.filter, restriction.value?.toString());
|
180
|
+
}
|
181
|
+
});
|
182
|
+
}
|
183
|
+
this.httpOptions = { params: httpParams };
|
184
|
+
return this._httpClient
|
185
|
+
.get(url, this.httpOptions)
|
186
|
+
.pipe(map((result) => {
|
187
|
+
result?.data?.map((item) => {
|
188
|
+
removeProperties?.forEach((property) => {
|
189
|
+
delete item[property];
|
190
|
+
});
|
191
|
+
});
|
192
|
+
return result;
|
193
|
+
}));
|
194
|
+
}
|
195
|
+
}
|
196
|
+
AutocompleteService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AutocompleteService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
197
|
+
AutocompleteService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AutocompleteService, providedIn: 'root' });
|
198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AutocompleteService, decorators: [{
|
199
|
+
type: Injectable,
|
200
|
+
args: [{
|
201
|
+
providedIn: 'root'
|
202
|
+
}]
|
203
203
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
|
204
204
|
|
205
|
-
class UtilsService {
|
206
|
-
/**
|
207
|
-
* Convierte el tiempo pasado por parámetro en horas y minutos
|
208
|
-
*
|
209
|
-
* @param time - Tiempo
|
210
|
-
* @returns Devuelve las horas y minutos
|
211
|
-
*/
|
212
|
-
static getTime(time) {
|
213
|
-
const hours = parseInt(Number(time) / 3600 + '', 10);
|
214
|
-
time = Number(time) - (hours * 3600);
|
215
|
-
const minutes = parseInt(Number(time) / 60 + '', 10);
|
216
|
-
return { hours, minutes };
|
217
|
-
}
|
218
|
-
/**
|
219
|
-
* Devuelve el tiempo en formato 'hh:mm'
|
220
|
-
*
|
221
|
-
* @param time - Tiempo
|
222
|
-
*/
|
223
|
-
static getTimePretty(time) {
|
224
|
-
const { hours, minutes } = UtilsService.getTime(time);
|
225
|
-
return (hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes);
|
226
|
-
}
|
227
|
-
/**
|
228
|
-
* Devuelve el tiempo en formato 'hhh : mmm'
|
229
|
-
*
|
230
|
-
* @param time - Tiempo
|
231
|
-
*/
|
232
|
-
static humanizeDuration(time) {
|
233
|
-
const { hours, minutes } = UtilsService.getTime(time);
|
234
|
-
return (hours < 10 ? '0' + hours : hours) + 'h : ' + (minutes < 10 ? '0' + minutes : minutes) + 'm';
|
235
|
-
}
|
236
|
-
static resolvePropertyByPath(obj, path) {
|
237
|
-
return path.reduce((prev, curr) => {
|
238
|
-
return prev ? prev[curr] : null;
|
239
|
-
}, obj || self);
|
240
|
-
}
|
241
|
-
}
|
242
|
-
UtilsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
243
|
-
UtilsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: UtilsService, providedIn: 'root' });
|
244
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: UtilsService, decorators: [{
|
245
|
-
type: Injectable,
|
246
|
-
args: [{
|
247
|
-
providedIn: 'root'
|
248
|
-
}]
|
205
|
+
class UtilsService {
|
206
|
+
/**
|
207
|
+
* Convierte el tiempo pasado por parámetro en horas y minutos
|
208
|
+
*
|
209
|
+
* @param time - Tiempo
|
210
|
+
* @returns Devuelve las horas y minutos
|
211
|
+
*/
|
212
|
+
static getTime(time) {
|
213
|
+
const hours = parseInt(Number(time) / 3600 + '', 10);
|
214
|
+
time = Number(time) - (hours * 3600);
|
215
|
+
const minutes = parseInt(Number(time) / 60 + '', 10);
|
216
|
+
return { hours, minutes };
|
217
|
+
}
|
218
|
+
/**
|
219
|
+
* Devuelve el tiempo en formato 'hh:mm'
|
220
|
+
*
|
221
|
+
* @param time - Tiempo
|
222
|
+
*/
|
223
|
+
static getTimePretty(time) {
|
224
|
+
const { hours, minutes } = UtilsService.getTime(time);
|
225
|
+
return (hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes);
|
226
|
+
}
|
227
|
+
/**
|
228
|
+
* Devuelve el tiempo en formato 'hhh : mmm'
|
229
|
+
*
|
230
|
+
* @param time - Tiempo
|
231
|
+
*/
|
232
|
+
static humanizeDuration(time) {
|
233
|
+
const { hours, minutes } = UtilsService.getTime(time);
|
234
|
+
return (hours < 10 ? '0' + hours : hours) + 'h : ' + (minutes < 10 ? '0' + minutes : minutes) + 'm';
|
235
|
+
}
|
236
|
+
static resolvePropertyByPath(obj, path) {
|
237
|
+
return path.reduce((prev, curr) => {
|
238
|
+
return prev ? prev[curr] : null;
|
239
|
+
}, obj || self);
|
240
|
+
}
|
241
|
+
}
|
242
|
+
UtilsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
243
|
+
UtilsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: UtilsService, providedIn: 'root' });
|
244
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: UtilsService, decorators: [{
|
245
|
+
type: Injectable,
|
246
|
+
args: [{
|
247
|
+
providedIn: 'root'
|
248
|
+
}]
|
249
249
|
}] });
|
250
250
|
|
251
|
-
class I18nFieldPipe {
|
252
|
-
transform(value, lang) {
|
253
|
-
if (!value) {
|
254
|
-
return '';
|
255
|
-
}
|
256
|
-
if (typeof value === 'string') {
|
257
|
-
return value;
|
258
|
-
}
|
259
|
-
const keys = Object.keys(value);
|
260
|
-
if (!value[lang]) {
|
261
|
-
let i = 0;
|
262
|
-
while (i < keys?.length && (value[keys[i]] === null || value[keys[i]] === '')) {
|
263
|
-
i++;
|
264
|
-
}
|
265
|
-
return keys?.length > i ? value[keys[i]] : 'No está definido';
|
266
|
-
}
|
267
|
-
return value[lang] || 'No está definido';
|
268
|
-
}
|
269
|
-
}
|
270
|
-
I18nFieldPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: I18nFieldPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
271
|
-
I18nFieldPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: I18nFieldPipe, name: "i18nField" });
|
272
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: I18nFieldPipe, decorators: [{
|
273
|
-
type: Pipe,
|
274
|
-
args: [{ name: 'i18nField' }]
|
251
|
+
class I18nFieldPipe {
|
252
|
+
transform(value, lang) {
|
253
|
+
if (!value) {
|
254
|
+
return '';
|
255
|
+
}
|
256
|
+
if (typeof value === 'string') {
|
257
|
+
return value;
|
258
|
+
}
|
259
|
+
const keys = Object.keys(value);
|
260
|
+
if (!value[lang]) {
|
261
|
+
let i = 0;
|
262
|
+
while (i < keys?.length && (value[keys[i]] === null || value[keys[i]] === '')) {
|
263
|
+
i++;
|
264
|
+
}
|
265
|
+
return keys?.length > i ? value[keys[i]] : 'No está definido';
|
266
|
+
}
|
267
|
+
return value[lang] || 'No está definido';
|
268
|
+
}
|
269
|
+
}
|
270
|
+
I18nFieldPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: I18nFieldPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
271
|
+
I18nFieldPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: I18nFieldPipe, name: "i18nField" });
|
272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: I18nFieldPipe, decorators: [{
|
273
|
+
type: Pipe,
|
274
|
+
args: [{ name: 'i18nField' }]
|
275
275
|
}] });
|
276
276
|
|
277
|
-
class DurationTimePipe {
|
278
|
-
transform(value) {
|
279
|
-
return UtilsService.getTimePretty(value);
|
280
|
-
}
|
281
|
-
}
|
282
|
-
DurationTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DurationTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
283
|
-
DurationTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: DurationTimePipe, name: "durationTime" });
|
284
|
-
DurationTimePipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DurationTimePipe });
|
285
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DurationTimePipe, decorators: [{
|
286
|
-
type: Injectable
|
287
|
-
}, {
|
288
|
-
type: Pipe,
|
289
|
-
args: [{ name: 'durationTime' }]
|
277
|
+
class DurationTimePipe {
|
278
|
+
transform(value) {
|
279
|
+
return UtilsService.getTimePretty(value);
|
280
|
+
}
|
281
|
+
}
|
282
|
+
DurationTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DurationTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
283
|
+
DurationTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: DurationTimePipe, name: "durationTime" });
|
284
|
+
DurationTimePipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DurationTimePipe });
|
285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DurationTimePipe, decorators: [{
|
286
|
+
type: Injectable
|
287
|
+
}, {
|
288
|
+
type: Pipe,
|
289
|
+
args: [{ name: 'durationTime' }]
|
290
290
|
}] });
|
291
291
|
|
292
|
-
class HumanizeDurationPipe {
|
293
|
-
transform(input) {
|
294
|
-
return UtilsService.humanizeDuration(input);
|
295
|
-
}
|
296
|
-
}
|
297
|
-
HumanizeDurationPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: HumanizeDurationPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
298
|
-
HumanizeDurationPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: HumanizeDurationPipe, name: "humanizeDuration" });
|
299
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: HumanizeDurationPipe, decorators: [{
|
300
|
-
type: Pipe,
|
301
|
-
args: [{
|
302
|
-
name: 'humanizeDuration'
|
303
|
-
}]
|
292
|
+
class HumanizeDurationPipe {
|
293
|
+
transform(input) {
|
294
|
+
return UtilsService.humanizeDuration(input);
|
295
|
+
}
|
296
|
+
}
|
297
|
+
HumanizeDurationPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: HumanizeDurationPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
298
|
+
HumanizeDurationPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: HumanizeDurationPipe, name: "humanizeDuration" });
|
299
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: HumanizeDurationPipe, decorators: [{
|
300
|
+
type: Pipe,
|
301
|
+
args: [{
|
302
|
+
name: 'humanizeDuration'
|
303
|
+
}]
|
304
304
|
}] });
|
305
305
|
|
306
|
-
class IdaReturnPipe {
|
307
|
-
transform(value) {
|
308
|
-
if (value === CustomPipes.IDA_RETURN) {
|
309
|
-
return 'Ida y Vuelta';
|
310
|
-
}
|
311
|
-
else {
|
312
|
-
return 'solo Ida';
|
313
|
-
}
|
314
|
-
}
|
315
|
-
}
|
316
|
-
IdaReturnPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: IdaReturnPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
317
|
-
IdaReturnPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: IdaReturnPipe, name: "idaReturn" });
|
318
|
-
IdaReturnPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: IdaReturnPipe });
|
319
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: IdaReturnPipe, decorators: [{
|
320
|
-
type: Injectable
|
321
|
-
}, {
|
322
|
-
type: Pipe,
|
323
|
-
args: [{ name: 'idaReturn' }]
|
306
|
+
class IdaReturnPipe {
|
307
|
+
transform(value) {
|
308
|
+
if (value === CustomPipes.IDA_RETURN) {
|
309
|
+
return 'Ida y Vuelta';
|
310
|
+
}
|
311
|
+
else {
|
312
|
+
return 'solo Ida';
|
313
|
+
}
|
314
|
+
}
|
315
|
+
}
|
316
|
+
IdaReturnPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: IdaReturnPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
317
|
+
IdaReturnPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: IdaReturnPipe, name: "idaReturn" });
|
318
|
+
IdaReturnPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: IdaReturnPipe });
|
319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: IdaReturnPipe, decorators: [{
|
320
|
+
type: Injectable
|
321
|
+
}, {
|
322
|
+
type: Pipe,
|
323
|
+
args: [{ name: 'idaReturn' }]
|
324
324
|
}] });
|
325
325
|
|
326
|
-
class ShowRolesPipe {
|
327
|
-
transform(value) {
|
328
|
-
let result = '';
|
329
|
-
if (value?.length) {
|
330
|
-
value.forEach(item => {
|
331
|
-
result += item?.Rol?.name + ', ';
|
332
|
-
});
|
333
|
-
result = result.substring(0, result?.length - 2);
|
334
|
-
}
|
335
|
-
return result;
|
336
|
-
}
|
337
|
-
}
|
338
|
-
ShowRolesPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowRolesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
339
|
-
ShowRolesPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: ShowRolesPipe, name: "showSegments" });
|
340
|
-
ShowRolesPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowRolesPipe });
|
341
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowRolesPipe, decorators: [{
|
342
|
-
type: Injectable
|
343
|
-
}, {
|
344
|
-
type: Pipe,
|
345
|
-
args: [{ name: 'showSegments' }]
|
326
|
+
class ShowRolesPipe {
|
327
|
+
transform(value) {
|
328
|
+
let result = '';
|
329
|
+
if (value?.length) {
|
330
|
+
value.forEach(item => {
|
331
|
+
result += item?.Rol?.name + ', ';
|
332
|
+
});
|
333
|
+
result = result.substring(0, result?.length - 2);
|
334
|
+
}
|
335
|
+
return result;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
ShowRolesPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowRolesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
339
|
+
ShowRolesPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: ShowRolesPipe, name: "showSegments" });
|
340
|
+
ShowRolesPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowRolesPipe });
|
341
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowRolesPipe, decorators: [{
|
342
|
+
type: Injectable
|
343
|
+
}, {
|
344
|
+
type: Pipe,
|
345
|
+
args: [{ name: 'showSegments' }]
|
346
346
|
}] });
|
347
347
|
|
348
|
-
class ShowSegmentsPipe {
|
349
|
-
transform(value) {
|
350
|
-
let result = '';
|
351
|
-
if (value?.length) {
|
352
|
-
value.forEach(item => {
|
353
|
-
result += item?.Segment?.PlaceOrigin?.alpha3 + '-' + item?.Segment?.PlaceDestination?.alpha3 + ', ';
|
354
|
-
});
|
355
|
-
result = result.substring(0, result?.length - 2);
|
356
|
-
}
|
357
|
-
return result;
|
358
|
-
}
|
359
|
-
}
|
360
|
-
ShowSegmentsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowSegmentsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
361
|
-
ShowSegmentsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: ShowSegmentsPipe, name: "showSegments" });
|
362
|
-
ShowSegmentsPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowSegmentsPipe });
|
363
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowSegmentsPipe, decorators: [{
|
364
|
-
type: Injectable
|
365
|
-
}, {
|
366
|
-
type: Pipe,
|
367
|
-
args: [{ name: 'showSegments' }]
|
348
|
+
class ShowSegmentsPipe {
|
349
|
+
transform(value) {
|
350
|
+
let result = '';
|
351
|
+
if (value?.length) {
|
352
|
+
value.forEach(item => {
|
353
|
+
result += item?.Segment?.PlaceOrigin?.alpha3 + '-' + item?.Segment?.PlaceDestination?.alpha3 + ', ';
|
354
|
+
});
|
355
|
+
result = result.substring(0, result?.length - 2);
|
356
|
+
}
|
357
|
+
return result;
|
358
|
+
}
|
359
|
+
}
|
360
|
+
ShowSegmentsPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowSegmentsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
361
|
+
ShowSegmentsPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: ShowSegmentsPipe, name: "showSegments" });
|
362
|
+
ShowSegmentsPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowSegmentsPipe });
|
363
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowSegmentsPipe, decorators: [{
|
364
|
+
type: Injectable
|
365
|
+
}, {
|
366
|
+
type: Pipe,
|
367
|
+
args: [{ name: 'showSegments' }]
|
368
368
|
}] });
|
369
369
|
|
370
|
-
class ShowTransportTypesPipe {
|
371
|
-
transform(value) {
|
372
|
-
let result = '';
|
373
|
-
if (value?.length) {
|
374
|
-
value.forEach(item => {
|
375
|
-
result += item?.TransportType?.name['es'] + ', ';
|
376
|
-
});
|
377
|
-
result = result.substring(0, result?.length - 2);
|
378
|
-
}
|
379
|
-
return result;
|
380
|
-
}
|
381
|
-
}
|
382
|
-
ShowTransportTypesPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowTransportTypesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
383
|
-
ShowTransportTypesPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: ShowTransportTypesPipe, name: "showTransportTypes" });
|
384
|
-
ShowTransportTypesPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowTransportTypesPipe });
|
385
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowTransportTypesPipe, decorators: [{
|
386
|
-
type: Injectable
|
387
|
-
}, {
|
388
|
-
type: Pipe,
|
389
|
-
args: [{ name: 'showTransportTypes' }]
|
370
|
+
class ShowTransportTypesPipe {
|
371
|
+
transform(value) {
|
372
|
+
let result = '';
|
373
|
+
if (value?.length) {
|
374
|
+
value.forEach(item => {
|
375
|
+
result += item?.TransportType?.name['es'] + ', ';
|
376
|
+
});
|
377
|
+
result = result.substring(0, result?.length - 2);
|
378
|
+
}
|
379
|
+
return result;
|
380
|
+
}
|
381
|
+
}
|
382
|
+
ShowTransportTypesPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowTransportTypesPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
383
|
+
ShowTransportTypesPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: ShowTransportTypesPipe, name: "showTransportTypes" });
|
384
|
+
ShowTransportTypesPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowTransportTypesPipe });
|
385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ShowTransportTypesPipe, decorators: [{
|
386
|
+
type: Injectable
|
387
|
+
}, {
|
388
|
+
type: Pipe,
|
389
|
+
args: [{ name: 'showTransportTypes' }]
|
390
390
|
}] });
|
391
391
|
|
392
|
-
class ResolvePropertyPath {
|
393
|
-
constructor(_showSegmentPipe, _showRolesPipe, _showTransportTypesPipe, _idaReturnPipe, _currencyPipe, _humanizeDurationPipe, _upperCasePipe, _durationPipe) {
|
394
|
-
this._showSegmentPipe = _showSegmentPipe;
|
395
|
-
this._showRolesPipe = _showRolesPipe;
|
396
|
-
this._showTransportTypesPipe = _showTransportTypesPipe;
|
397
|
-
this._idaReturnPipe = _idaReturnPipe;
|
398
|
-
this._currencyPipe = _currencyPipe;
|
399
|
-
this._humanizeDurationPipe = _humanizeDurationPipe;
|
400
|
-
this._upperCasePipe = _upperCasePipe;
|
401
|
-
this._durationPipe = _durationPipe;
|
402
|
-
}
|
403
|
-
transform(obj, path) {
|
404
|
-
let result = '';
|
405
|
-
path?.forEach(item => {
|
406
|
-
if (item?.type === 'divider') {
|
407
|
-
result += item?.divider;
|
408
|
-
}
|
409
|
-
else {
|
410
|
-
if (item?.path) {
|
411
|
-
let value = UtilsService.resolvePropertyByPath(obj, item.path);
|
412
|
-
switch (item?.customPipe) {
|
413
|
-
case CustomPipes.SHOW_SEGMENTS:
|
414
|
-
value = this._showSegmentPipe.transform(value);
|
415
|
-
break;
|
416
|
-
case CustomPipes.DURATION_TIME:
|
417
|
-
value = this._durationPipe.transform(value);
|
418
|
-
break;
|
419
|
-
case CustomPipes.HUMANIZE_DURATION:
|
420
|
-
value = this._humanizeDurationPipe.transform(value);
|
421
|
-
break;
|
422
|
-
case CustomPipes.SHOW_TRANSPORT_TYPES:
|
423
|
-
value = this._showTransportTypesPipe.transform(value);
|
424
|
-
break;
|
425
|
-
case CustomPipes.SHOW_ROLES:
|
426
|
-
value = this._showRolesPipe.transform(value);
|
427
|
-
break;
|
428
|
-
case CustomPipes.IDA_RETURN:
|
429
|
-
value = this._idaReturnPipe.transform(value);
|
430
|
-
break;
|
431
|
-
case CustomPipes.CURRENCY:
|
432
|
-
value = this._currencyPipe.transform(value);
|
433
|
-
break;
|
434
|
-
case CustomPipes.UPPERCASE:
|
435
|
-
value = this._upperCasePipe.transform(value);
|
436
|
-
break;
|
437
|
-
default:
|
438
|
-
break;
|
439
|
-
}
|
440
|
-
result += value;
|
441
|
-
}
|
442
|
-
}
|
443
|
-
});
|
444
|
-
return result;
|
445
|
-
}
|
446
|
-
}
|
447
|
-
ResolvePropertyPath.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ResolvePropertyPath, deps: [{ token: ShowSegmentsPipe }, { token: ShowRolesPipe }, { token: ShowTransportTypesPipe }, { token: IdaReturnPipe }, { token: i3.CurrencyPipe }, { token: HumanizeDurationPipe }, { token: i3.UpperCasePipe }, { token: DurationTimePipe }], target: i0.ɵɵFactoryTarget.Pipe });
|
448
|
-
ResolvePropertyPath.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: ResolvePropertyPath, name: "resolvePropertyPath" });
|
449
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ResolvePropertyPath, decorators: [{
|
450
|
-
type: Pipe,
|
451
|
-
args: [{ name: 'resolvePropertyPath' }]
|
392
|
+
class ResolvePropertyPath {
|
393
|
+
constructor(_showSegmentPipe, _showRolesPipe, _showTransportTypesPipe, _idaReturnPipe, _currencyPipe, _humanizeDurationPipe, _upperCasePipe, _durationPipe) {
|
394
|
+
this._showSegmentPipe = _showSegmentPipe;
|
395
|
+
this._showRolesPipe = _showRolesPipe;
|
396
|
+
this._showTransportTypesPipe = _showTransportTypesPipe;
|
397
|
+
this._idaReturnPipe = _idaReturnPipe;
|
398
|
+
this._currencyPipe = _currencyPipe;
|
399
|
+
this._humanizeDurationPipe = _humanizeDurationPipe;
|
400
|
+
this._upperCasePipe = _upperCasePipe;
|
401
|
+
this._durationPipe = _durationPipe;
|
402
|
+
}
|
403
|
+
transform(obj, path) {
|
404
|
+
let result = '';
|
405
|
+
path?.forEach(item => {
|
406
|
+
if (item?.type === 'divider') {
|
407
|
+
result += item?.divider;
|
408
|
+
}
|
409
|
+
else {
|
410
|
+
if (item?.path) {
|
411
|
+
let value = UtilsService.resolvePropertyByPath(obj, item.path);
|
412
|
+
switch (item?.customPipe) {
|
413
|
+
case CustomPipes.SHOW_SEGMENTS:
|
414
|
+
value = this._showSegmentPipe.transform(value);
|
415
|
+
break;
|
416
|
+
case CustomPipes.DURATION_TIME:
|
417
|
+
value = this._durationPipe.transform(value);
|
418
|
+
break;
|
419
|
+
case CustomPipes.HUMANIZE_DURATION:
|
420
|
+
value = this._humanizeDurationPipe.transform(value);
|
421
|
+
break;
|
422
|
+
case CustomPipes.SHOW_TRANSPORT_TYPES:
|
423
|
+
value = this._showTransportTypesPipe.transform(value);
|
424
|
+
break;
|
425
|
+
case CustomPipes.SHOW_ROLES:
|
426
|
+
value = this._showRolesPipe.transform(value);
|
427
|
+
break;
|
428
|
+
case CustomPipes.IDA_RETURN:
|
429
|
+
value = this._idaReturnPipe.transform(value);
|
430
|
+
break;
|
431
|
+
case CustomPipes.CURRENCY:
|
432
|
+
value = this._currencyPipe.transform(value);
|
433
|
+
break;
|
434
|
+
case CustomPipes.UPPERCASE:
|
435
|
+
value = this._upperCasePipe.transform(value);
|
436
|
+
break;
|
437
|
+
default:
|
438
|
+
break;
|
439
|
+
}
|
440
|
+
result += value;
|
441
|
+
}
|
442
|
+
}
|
443
|
+
});
|
444
|
+
return result;
|
445
|
+
}
|
446
|
+
}
|
447
|
+
ResolvePropertyPath.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ResolvePropertyPath, deps: [{ token: ShowSegmentsPipe }, { token: ShowRolesPipe }, { token: ShowTransportTypesPipe }, { token: IdaReturnPipe }, { token: i3.CurrencyPipe }, { token: HumanizeDurationPipe }, { token: i3.UpperCasePipe }, { token: DurationTimePipe }], target: i0.ɵɵFactoryTarget.Pipe });
|
448
|
+
ResolvePropertyPath.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: ResolvePropertyPath, name: "resolvePropertyPath" });
|
449
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ResolvePropertyPath, decorators: [{
|
450
|
+
type: Pipe,
|
451
|
+
args: [{ name: 'resolvePropertyPath' }]
|
452
452
|
}], ctorParameters: function () { return [{ type: ShowSegmentsPipe }, { type: ShowRolesPipe }, { type: ShowTransportTypesPipe }, { type: IdaReturnPipe }, { type: i3.CurrencyPipe }, { type: HumanizeDurationPipe }, { type: i3.UpperCasePipe }, { type: DurationTimePipe }]; } });
|
453
453
|
|
454
|
-
class GuajiritosGeneralAutocompleteComponent {
|
455
|
-
constructor(_autocompleteService, _cdRef, _zone, translateService) {
|
456
|
-
this._autocompleteService = _autocompleteService;
|
457
|
-
this._cdRef = _cdRef;
|
458
|
-
this._zone = _zone;
|
459
|
-
this.translateService = translateService;
|
460
|
-
this.unsubscribeAll$ = new Subject();
|
461
|
-
this.firstCall = true;
|
462
|
-
this.restrictionsFilters = [];
|
463
|
-
this.required = true;
|
464
|
-
this.component = new UntypedFormControl({
|
465
|
-
value: null, disabled: false
|
466
|
-
});
|
467
|
-
this.disabledButton = false;
|
468
|
-
this.loading = false;
|
469
|
-
/**
|
470
|
-
* Possible values 'never', 'auto' or 'always'
|
471
|
-
*/
|
472
|
-
this.floatLabel = 'auto';
|
473
|
-
this.debounceTimeValue = 250;
|
474
|
-
this.label = 'Seleccione';
|
475
|
-
this.placeholder = 'Seleccione un elemento';
|
476
|
-
this.field = ['name'];
|
477
|
-
this.filterString = 'filter[$and][name][$like]';
|
478
|
-
this.displayOptions = GENERAL_DISPLAY_OPTIONS;
|
479
|
-
this.withoutPaddingBottom = true;
|
480
|
-
this.valueId = false;
|
481
|
-
this.order = null;
|
482
|
-
this.removeProperties = [];
|
483
|
-
this.SelectElement = new EventEmitter();
|
484
|
-
this.onChanged = () => {
|
485
|
-
};
|
486
|
-
this.onTouched = () => {
|
487
|
-
};
|
488
|
-
this.displayFn = (value) => {
|
489
|
-
if (value) {
|
490
|
-
if (typeof value === 'string') {
|
491
|
-
return value;
|
492
|
-
}
|
493
|
-
let displayText = '';
|
494
|
-
if (!this.displayOptions) {
|
495
|
-
this.displayOptions = GENERAL_DISPLAY_OPTIONS;
|
496
|
-
}
|
497
|
-
this.displayOptions?.firthLabel?.forEach((field) => {
|
498
|
-
if (field?.type === 'path') {
|
499
|
-
displayText += UtilsService.resolvePropertyByPath(value, field?.path);
|
500
|
-
}
|
501
|
-
else {
|
502
|
-
displayText += field?.divider;
|
503
|
-
}
|
504
|
-
});
|
505
|
-
return displayText;
|
506
|
-
}
|
507
|
-
};
|
508
|
-
}
|
509
|
-
set disable(flag) {
|
510
|
-
this.disabledButton = flag;
|
511
|
-
if (flag) {
|
512
|
-
this.component.disable();
|
513
|
-
}
|
514
|
-
else {
|
515
|
-
this.component.enable();
|
516
|
-
}
|
517
|
-
this._cdRef.detectChanges();
|
518
|
-
}
|
519
|
-
set url(data) {
|
520
|
-
if (data) {
|
521
|
-
this._url = data;
|
522
|
-
this.subscribeComponentChanges();
|
523
|
-
}
|
524
|
-
}
|
525
|
-
set clearData(value) {
|
526
|
-
this.clearData$ = value;
|
527
|
-
if (this.clearData$) {
|
528
|
-
this.clearData$
|
529
|
-
.pipe(takeUntil(this.unsubscribeAll$))
|
530
|
-
.subscribe(
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
if (typeof value === '
|
629
|
-
|
630
|
-
}
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
this._cdRef.detectChanges();
|
651
|
-
}
|
652
|
-
|
653
|
-
this.
|
654
|
-
this.
|
655
|
-
|
656
|
-
|
657
|
-
this.
|
658
|
-
this.
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
this.
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
this.
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
}
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
i0.ɵɵ
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
}],
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
}],
|
717
|
-
type: Input
|
718
|
-
}],
|
719
|
-
type: Input
|
720
|
-
}],
|
721
|
-
type: Input
|
722
|
-
}],
|
723
|
-
type: Input
|
724
|
-
}],
|
725
|
-
type: Input
|
726
|
-
}],
|
727
|
-
type: Input
|
728
|
-
}],
|
729
|
-
type: Input
|
730
|
-
}],
|
731
|
-
type: Input
|
732
|
-
}],
|
733
|
-
type: Input
|
734
|
-
}],
|
735
|
-
type:
|
736
|
-
}],
|
737
|
-
type: Input
|
738
|
-
}],
|
739
|
-
type: Input
|
740
|
-
}],
|
741
|
-
type: Input
|
742
|
-
}],
|
743
|
-
type:
|
744
|
-
}],
|
745
|
-
type: Input
|
746
|
-
}],
|
747
|
-
type: Input
|
748
|
-
}],
|
749
|
-
type: Input
|
454
|
+
class GuajiritosGeneralAutocompleteComponent {
|
455
|
+
constructor(_autocompleteService, _cdRef, _zone, translateService) {
|
456
|
+
this._autocompleteService = _autocompleteService;
|
457
|
+
this._cdRef = _cdRef;
|
458
|
+
this._zone = _zone;
|
459
|
+
this.translateService = translateService;
|
460
|
+
this.unsubscribeAll$ = new Subject();
|
461
|
+
this.firstCall = true;
|
462
|
+
this.restrictionsFilters = [];
|
463
|
+
this.required = true;
|
464
|
+
this.component = new UntypedFormControl({
|
465
|
+
value: null, disabled: false
|
466
|
+
});
|
467
|
+
this.disabledButton = false;
|
468
|
+
this.loading = false;
|
469
|
+
/**
|
470
|
+
* Possible values 'never', 'auto' or 'always'
|
471
|
+
*/
|
472
|
+
this.floatLabel = 'auto';
|
473
|
+
this.debounceTimeValue = 250;
|
474
|
+
this.label = 'Seleccione';
|
475
|
+
this.placeholder = 'Seleccione un elemento';
|
476
|
+
this.field = ['name'];
|
477
|
+
this.filterString = 'filter[$and][name][$like]';
|
478
|
+
this.displayOptions = GENERAL_DISPLAY_OPTIONS;
|
479
|
+
this.withoutPaddingBottom = true;
|
480
|
+
this.valueId = false;
|
481
|
+
this.order = null;
|
482
|
+
this.removeProperties = [];
|
483
|
+
this.SelectElement = new EventEmitter();
|
484
|
+
this.onChanged = () => {
|
485
|
+
};
|
486
|
+
this.onTouched = () => {
|
487
|
+
};
|
488
|
+
this.displayFn = (value) => {
|
489
|
+
if (value) {
|
490
|
+
if (typeof value === 'string') {
|
491
|
+
return value;
|
492
|
+
}
|
493
|
+
let displayText = '';
|
494
|
+
if (!this.displayOptions) {
|
495
|
+
this.displayOptions = GENERAL_DISPLAY_OPTIONS;
|
496
|
+
}
|
497
|
+
this.displayOptions?.firthLabel?.forEach((field) => {
|
498
|
+
if (field?.type === 'path') {
|
499
|
+
displayText += UtilsService.resolvePropertyByPath(value, field?.path);
|
500
|
+
}
|
501
|
+
else {
|
502
|
+
displayText += field?.divider;
|
503
|
+
}
|
504
|
+
});
|
505
|
+
return displayText;
|
506
|
+
}
|
507
|
+
};
|
508
|
+
}
|
509
|
+
set disable(flag) {
|
510
|
+
this.disabledButton = flag;
|
511
|
+
if (flag) {
|
512
|
+
this.component.disable();
|
513
|
+
}
|
514
|
+
else {
|
515
|
+
this.component.enable();
|
516
|
+
}
|
517
|
+
this._cdRef.detectChanges();
|
518
|
+
}
|
519
|
+
set url(data) {
|
520
|
+
if (data) {
|
521
|
+
this._url = data;
|
522
|
+
this.subscribeComponentChanges();
|
523
|
+
}
|
524
|
+
}
|
525
|
+
set clearData(value) {
|
526
|
+
this.clearData$ = value;
|
527
|
+
if (this.clearData$) {
|
528
|
+
this.clearData$
|
529
|
+
.pipe(takeUntil(this.unsubscribeAll$))
|
530
|
+
.subscribe({
|
531
|
+
next: () => {
|
532
|
+
this.component.setValue(null);
|
533
|
+
this.selectedElement = null;
|
534
|
+
this.SelectElement.emit(null);
|
535
|
+
this.filteredOptions = [];
|
536
|
+
this.onChanged(null);
|
537
|
+
}
|
538
|
+
});
|
539
|
+
}
|
540
|
+
}
|
541
|
+
set initialValue(value) {
|
542
|
+
this.component.setValue(value);
|
543
|
+
}
|
544
|
+
set restrictions(value) {
|
545
|
+
if (value) {
|
546
|
+
this.restrictionsFilters = value;
|
547
|
+
}
|
548
|
+
else {
|
549
|
+
this.restrictionsFilters = [];
|
550
|
+
}
|
551
|
+
}
|
552
|
+
set isRequired(value) {
|
553
|
+
this.required = value;
|
554
|
+
if (this.required) {
|
555
|
+
this.component.setValidators([Validators.required, GuajiritosGeneralAutocompleteComponent.ValidateAutocomplete]);
|
556
|
+
}
|
557
|
+
else {
|
558
|
+
this.component.clearValidators();
|
559
|
+
}
|
560
|
+
this.component.updateValueAndValidity();
|
561
|
+
}
|
562
|
+
get doFocus() {
|
563
|
+
return this.doFocusSubject$;
|
564
|
+
}
|
565
|
+
set doFocus(value) {
|
566
|
+
this.doFocusSubject$ = value;
|
567
|
+
if (value) {
|
568
|
+
this.doFocusSubject$
|
569
|
+
.pipe(takeUntil(this.unsubscribeAll$))
|
570
|
+
.subscribe({
|
571
|
+
next: () => {
|
572
|
+
this._zone.run(() => {
|
573
|
+
setTimeout(() => {
|
574
|
+
this.inputText.nativeElement.focus();
|
575
|
+
}, 500);
|
576
|
+
});
|
577
|
+
}
|
578
|
+
});
|
579
|
+
}
|
580
|
+
}
|
581
|
+
static ValidateAutocomplete(control) {
|
582
|
+
if (control?.value?.constructor !== Object || !control?.value?.id) {
|
583
|
+
return { invalidSelection: true };
|
584
|
+
}
|
585
|
+
return null;
|
586
|
+
}
|
587
|
+
subscribeComponentChanges() {
|
588
|
+
this.component?.valueChanges
|
589
|
+
?.pipe(debounceTime(this.debounceTimeValue), takeUntil(this.unsubscribeAll$))
|
590
|
+
?.subscribe({
|
591
|
+
next: () => {
|
592
|
+
if (!this.firstCall) {
|
593
|
+
this.getAutocompleteByTextHandler(this.getAutocompleteSearchText());
|
594
|
+
}
|
595
|
+
else {
|
596
|
+
this.firstCall = false;
|
597
|
+
}
|
598
|
+
}
|
599
|
+
});
|
600
|
+
}
|
601
|
+
getAutocompleteByTextHandler(text) {
|
602
|
+
this._autocompleteService
|
603
|
+
.getAutocompleteByText(this._url, text, this.filterString, this.restrictionsFilters, this.removeProperties, this.order, this.bodyRequest)
|
604
|
+
.then((resp) => {
|
605
|
+
resp?.subscribe({
|
606
|
+
next: (result) => {
|
607
|
+
this.filteredOptions = result?.payload?.data || result?.data;
|
608
|
+
this.loading = false;
|
609
|
+
this._cdRef.detectChanges();
|
610
|
+
}
|
611
|
+
});
|
612
|
+
});
|
613
|
+
}
|
614
|
+
getAutocompleteSearchText() {
|
615
|
+
this.loading = true;
|
616
|
+
let text = null;
|
617
|
+
if (this.component?.value) {
|
618
|
+
if (typeof this.component.value === 'object') {
|
619
|
+
const componentValue = this.component?.value[this.field[0]];
|
620
|
+
if (typeof componentValue === 'object') {
|
621
|
+
let lang = 'es';
|
622
|
+
if (this.field[1]) {
|
623
|
+
lang = this.field[1];
|
624
|
+
}
|
625
|
+
text = componentValue[lang];
|
626
|
+
}
|
627
|
+
}
|
628
|
+
else if (typeof this.component?.value === 'string') {
|
629
|
+
text = this.component.value;
|
630
|
+
}
|
631
|
+
}
|
632
|
+
return text;
|
633
|
+
}
|
634
|
+
writeValue(value) {
|
635
|
+
if (value) {
|
636
|
+
if (typeof value === 'number') {
|
637
|
+
this.value = value;
|
638
|
+
}
|
639
|
+
else if (typeof value === 'object') {
|
640
|
+
this.component.setValue(value);
|
641
|
+
this.value = value.id;
|
642
|
+
}
|
643
|
+
else {
|
644
|
+
this.value = value;
|
645
|
+
}
|
646
|
+
}
|
647
|
+
else {
|
648
|
+
this.value = null;
|
649
|
+
}
|
650
|
+
this._cdRef.detectChanges();
|
651
|
+
}
|
652
|
+
registerOnChange(fn) {
|
653
|
+
this.onChanged = fn;
|
654
|
+
this._cdRef.detectChanges();
|
655
|
+
}
|
656
|
+
registerOnTouched(fn) {
|
657
|
+
this.onTouched = fn;
|
658
|
+
this._cdRef.detectChanges();
|
659
|
+
}
|
660
|
+
clear(trigger) {
|
661
|
+
this.component.setValue(null);
|
662
|
+
this.selectedElement = null;
|
663
|
+
this.SelectElement.emit(null);
|
664
|
+
this._cdRef.detectChanges();
|
665
|
+
this.onChanged(null);
|
666
|
+
this._zone.run(() => {
|
667
|
+
setTimeout(() => {
|
668
|
+
trigger.openPanel();
|
669
|
+
this._cdRef.detectChanges();
|
670
|
+
}, 200);
|
671
|
+
});
|
672
|
+
}
|
673
|
+
onFocus() {
|
674
|
+
this.getAutocompleteByTextHandler(this.getAutocompleteSearchText());
|
675
|
+
}
|
676
|
+
onSelectElement(item) {
|
677
|
+
this.selectedElement = item;
|
678
|
+
this.SelectElement.emit(item);
|
679
|
+
this.value = item;
|
680
|
+
if (this.valueId) {
|
681
|
+
this.onChanged(item?.id);
|
682
|
+
}
|
683
|
+
else {
|
684
|
+
this.onChanged(item);
|
685
|
+
}
|
686
|
+
this._cdRef.detectChanges();
|
687
|
+
}
|
688
|
+
ngOnInit() {
|
689
|
+
this.component.markAllAsTouched();
|
690
|
+
}
|
691
|
+
ngOnDestroy() {
|
692
|
+
this.unsubscribeAll$.next();
|
693
|
+
this.unsubscribeAll$.complete();
|
694
|
+
}
|
695
|
+
}
|
696
|
+
GuajiritosGeneralAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteComponent, deps: [{ token: AutocompleteService }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i2.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
697
|
+
GuajiritosGeneralAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: GuajiritosGeneralAutocompleteComponent, selector: "guajiritos-general-autocomplete", inputs: { floatLabel: "floatLabel", bodyRequest: "bodyRequest", debounceTimeValue: "debounceTimeValue", detailsTemplate: "detailsTemplate", label: "label", placeholder: "placeholder", field: "field", filterString: "filterString", displayOptions: "displayOptions", withoutPaddingBottom: "withoutPaddingBottom", valueId: "valueId", order: "order", removeProperties: "removeProperties", disable: "disable", url: "url", clearData: "clearData", initialValue: "initialValue", restrictions: "restrictions", isRequired: "isRequired", doFocus: "doFocus" }, outputs: { SelectElement: "SelectElement" }, providers: [
|
698
|
+
{
|
699
|
+
provide: NG_VALUE_ACCESSOR,
|
700
|
+
useExisting: forwardRef(() => GuajiritosGeneralAutocompleteComponent),
|
701
|
+
multi: true
|
702
|
+
}
|
703
|
+
], viewQueries: [{ propertyName: "inputText", first: true, predicate: ["inputText"], descendants: true, static: true }], ngImport: i0, template: "<mat-form-field [floatLabel]=\"floatLabel\" [ngClass]=\"{'without-padding-bottom': withoutPaddingBottom}\"\r\n appearance=\"outline\" class=\"w-100\" color=\"accent\">\r\n\r\n <mat-label>{{label | translate}}</mat-label>\r\n <input #inputText #trigger=\"matAutocompleteTrigger\" (blur)=\"onTouched()\" (focus)=\"onFocus()\"\r\n [formControl]=\"component\" [matAutocomplete]=\"autocomplete\" [placeholder]=\"placeholder | translate\"\r\n aria-label=\"Number\" autocomplete=\"off\" matInput type=\"text\">\r\n <button (click)=\"clear(trigger)\" *ngIf=\"!loading && component?.value\" [disabled]=\"disabledButton\" aria-label=\"Clear\"\r\n mat-icon-button matSuffix>\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <button *ngIf=\"loading\" aria-label=\"Clear\" mat-icon-button matSuffix>\r\n <mat-spinner [value]=\"90\" color=\"accent\" diameter=\"25\"></mat-spinner>\r\n </button>\r\n <mat-autocomplete #autocomplete=\"matAutocomplete\" [displayWith]=\"displayFn\">\r\n <mat-option *ngFor=\"let option of filteredOptions\" [value]=\"option\"\r\n (onSelectionChange)=\"onSelectElement(option)\">\r\n\r\n <ng-container *ngIf=\"!displayOptions && !detailsTemplate\">\r\n {{ option?.name | i18nField: translateService.currentLang }}\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"!detailsTemplate\">\r\n <div class=\"display-options\">\r\n <span [ngStyle]=\"{'line-height': displayOptions?.secondLabel ? '16px' : ''}\">\r\n {{option | resolvePropertyPath:displayOptions?.firthLabel | i18nField: translateService.currentLang}}\r\n </span>\r\n <span *ngIf=\"displayOptions?.secondLabel\" class=\"mat-caption\">\r\n {{option | resolvePropertyPath: displayOptions?.secondLabel | i18nField: translateService.currentLang}}\r\n </span>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"detailsTemplate\">\r\n <ng-container *ngTemplateOutlet=\"detailsTemplate;context:{$implicit: option }\"></ng-container>\r\n </ng-container>\r\n\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field>\r\n", styles: ["::ng-deep .without-padding-bottom .mat-form-field-wrapper{padding-bottom:0!important}.w-100{width:100%}.display-options{display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i5.MatLabel, selector: "mat-label" }, { kind: "directive", type: i5.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i7.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i8.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i10.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: I18nFieldPipe, name: "i18nField" }, { kind: "pipe", type: ResolvePropertyPath, name: "resolvePropertyPath" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
704
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteComponent, decorators: [{
|
705
|
+
type: Component,
|
706
|
+
args: [{ selector: 'guajiritos-general-autocomplete', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
707
|
+
{
|
708
|
+
provide: NG_VALUE_ACCESSOR,
|
709
|
+
useExisting: forwardRef(() => GuajiritosGeneralAutocompleteComponent),
|
710
|
+
multi: true
|
711
|
+
}
|
712
|
+
], template: "<mat-form-field [floatLabel]=\"floatLabel\" [ngClass]=\"{'without-padding-bottom': withoutPaddingBottom}\"\r\n appearance=\"outline\" class=\"w-100\" color=\"accent\">\r\n\r\n <mat-label>{{label | translate}}</mat-label>\r\n <input #inputText #trigger=\"matAutocompleteTrigger\" (blur)=\"onTouched()\" (focus)=\"onFocus()\"\r\n [formControl]=\"component\" [matAutocomplete]=\"autocomplete\" [placeholder]=\"placeholder | translate\"\r\n aria-label=\"Number\" autocomplete=\"off\" matInput type=\"text\">\r\n <button (click)=\"clear(trigger)\" *ngIf=\"!loading && component?.value\" [disabled]=\"disabledButton\" aria-label=\"Clear\"\r\n mat-icon-button matSuffix>\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <button *ngIf=\"loading\" aria-label=\"Clear\" mat-icon-button matSuffix>\r\n <mat-spinner [value]=\"90\" color=\"accent\" diameter=\"25\"></mat-spinner>\r\n </button>\r\n <mat-autocomplete #autocomplete=\"matAutocomplete\" [displayWith]=\"displayFn\">\r\n <mat-option *ngFor=\"let option of filteredOptions\" [value]=\"option\"\r\n (onSelectionChange)=\"onSelectElement(option)\">\r\n\r\n <ng-container *ngIf=\"!displayOptions && !detailsTemplate\">\r\n {{ option?.name | i18nField: translateService.currentLang }}\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"!detailsTemplate\">\r\n <div class=\"display-options\">\r\n <span [ngStyle]=\"{'line-height': displayOptions?.secondLabel ? '16px' : ''}\">\r\n {{option | resolvePropertyPath:displayOptions?.firthLabel | i18nField: translateService.currentLang}}\r\n </span>\r\n <span *ngIf=\"displayOptions?.secondLabel\" class=\"mat-caption\">\r\n {{option | resolvePropertyPath: displayOptions?.secondLabel | i18nField: translateService.currentLang}}\r\n </span>\r\n </div>\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"detailsTemplate\">\r\n <ng-container *ngTemplateOutlet=\"detailsTemplate;context:{$implicit: option }\"></ng-container>\r\n </ng-container>\r\n\r\n </mat-option>\r\n </mat-autocomplete>\r\n</mat-form-field>\r\n", styles: ["::ng-deep .without-padding-bottom .mat-form-field-wrapper{padding-bottom:0!important}.w-100{width:100%}.display-options{display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start}\n"] }]
|
713
|
+
}], ctorParameters: function () { return [{ type: AutocompleteService }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i2.TranslateService }]; }, propDecorators: { inputText: [{
|
714
|
+
type: ViewChild,
|
715
|
+
args: ['inputText', { static: true }]
|
716
|
+
}], floatLabel: [{
|
717
|
+
type: Input
|
718
|
+
}], bodyRequest: [{
|
719
|
+
type: Input
|
720
|
+
}], debounceTimeValue: [{
|
721
|
+
type: Input
|
722
|
+
}], detailsTemplate: [{
|
723
|
+
type: Input
|
724
|
+
}], label: [{
|
725
|
+
type: Input
|
726
|
+
}], placeholder: [{
|
727
|
+
type: Input
|
728
|
+
}], field: [{
|
729
|
+
type: Input
|
730
|
+
}], filterString: [{
|
731
|
+
type: Input
|
732
|
+
}], displayOptions: [{
|
733
|
+
type: Input
|
734
|
+
}], withoutPaddingBottom: [{
|
735
|
+
type: Input
|
736
|
+
}], valueId: [{
|
737
|
+
type: Input
|
738
|
+
}], order: [{
|
739
|
+
type: Input
|
740
|
+
}], removeProperties: [{
|
741
|
+
type: Input
|
742
|
+
}], SelectElement: [{
|
743
|
+
type: Output
|
744
|
+
}], disable: [{
|
745
|
+
type: Input
|
746
|
+
}], url: [{
|
747
|
+
type: Input
|
748
|
+
}], clearData: [{
|
749
|
+
type: Input
|
750
|
+
}], initialValue: [{
|
751
|
+
type: Input
|
752
|
+
}], restrictions: [{
|
753
|
+
type: Input
|
754
|
+
}], isRequired: [{
|
755
|
+
type: Input
|
756
|
+
}], doFocus: [{
|
757
|
+
type: Input
|
750
758
|
}] } });
|
751
759
|
|
752
|
-
class GuajiritosGeneralAutocompleteModule {
|
753
|
-
}
|
754
|
-
GuajiritosGeneralAutocompleteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
755
|
-
GuajiritosGeneralAutocompleteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteModule, declarations: [GuajiritosGeneralAutocompleteComponent,
|
756
|
-
DurationTimePipe,
|
757
|
-
I18nFieldPipe,
|
758
|
-
ResolvePropertyPath,
|
759
|
-
HumanizeDurationPipe,
|
760
|
-
IdaReturnPipe,
|
761
|
-
ShowRolesPipe,
|
762
|
-
ShowSegmentsPipe,
|
763
|
-
ShowTransportTypesPipe], imports: [CommonModule,
|
764
|
-
TranslateModule,
|
765
|
-
FormsModule,
|
766
|
-
ReactiveFormsModule,
|
767
|
-
MatFormFieldModule,
|
768
|
-
MatIconModule,
|
769
|
-
MatProgressSpinnerModule,
|
770
|
-
MatButtonModule,
|
771
|
-
MatInputModule,
|
772
|
-
MatAutocompleteModule], exports: [GuajiritosGeneralAutocompleteComponent] });
|
773
|
-
GuajiritosGeneralAutocompleteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteModule, providers: [
|
774
|
-
UpperCasePipe,
|
775
|
-
CurrencyPipe,
|
776
|
-
AutocompleteService,
|
777
|
-
DurationTimePipe,
|
778
|
-
I18nFieldPipe,
|
779
|
-
ResolvePropertyPath,
|
780
|
-
HumanizeDurationPipe,
|
781
|
-
IdaReturnPipe,
|
782
|
-
ShowRolesPipe,
|
783
|
-
ShowSegmentsPipe,
|
784
|
-
ShowTransportTypesPipe
|
785
|
-
], imports: [CommonModule,
|
786
|
-
TranslateModule,
|
787
|
-
FormsModule,
|
788
|
-
ReactiveFormsModule,
|
789
|
-
MatFormFieldModule,
|
790
|
-
MatIconModule,
|
791
|
-
MatProgressSpinnerModule,
|
792
|
-
MatButtonModule,
|
793
|
-
MatInputModule,
|
794
|
-
MatAutocompleteModule] });
|
795
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteModule, decorators: [{
|
796
|
-
type: NgModule,
|
797
|
-
args: [{
|
798
|
-
declarations: [
|
799
|
-
GuajiritosGeneralAutocompleteComponent,
|
800
|
-
DurationTimePipe,
|
801
|
-
I18nFieldPipe,
|
802
|
-
ResolvePropertyPath,
|
803
|
-
HumanizeDurationPipe,
|
804
|
-
IdaReturnPipe,
|
805
|
-
ShowRolesPipe,
|
806
|
-
ShowSegmentsPipe,
|
807
|
-
ShowTransportTypesPipe
|
808
|
-
],
|
809
|
-
imports: [
|
810
|
-
CommonModule,
|
811
|
-
TranslateModule,
|
812
|
-
FormsModule,
|
813
|
-
ReactiveFormsModule,
|
814
|
-
MatFormFieldModule,
|
815
|
-
MatIconModule,
|
816
|
-
MatProgressSpinnerModule,
|
817
|
-
MatButtonModule,
|
818
|
-
MatInputModule,
|
819
|
-
MatAutocompleteModule
|
820
|
-
],
|
821
|
-
providers: [
|
822
|
-
UpperCasePipe,
|
823
|
-
CurrencyPipe,
|
824
|
-
AutocompleteService,
|
825
|
-
DurationTimePipe,
|
826
|
-
I18nFieldPipe,
|
827
|
-
ResolvePropertyPath,
|
828
|
-
HumanizeDurationPipe,
|
829
|
-
IdaReturnPipe,
|
830
|
-
ShowRolesPipe,
|
831
|
-
ShowSegmentsPipe,
|
832
|
-
ShowTransportTypesPipe
|
833
|
-
],
|
834
|
-
exports: [
|
835
|
-
GuajiritosGeneralAutocompleteComponent
|
836
|
-
]
|
837
|
-
}]
|
760
|
+
class GuajiritosGeneralAutocompleteModule {
|
761
|
+
}
|
762
|
+
GuajiritosGeneralAutocompleteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
763
|
+
GuajiritosGeneralAutocompleteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteModule, declarations: [GuajiritosGeneralAutocompleteComponent,
|
764
|
+
DurationTimePipe,
|
765
|
+
I18nFieldPipe,
|
766
|
+
ResolvePropertyPath,
|
767
|
+
HumanizeDurationPipe,
|
768
|
+
IdaReturnPipe,
|
769
|
+
ShowRolesPipe,
|
770
|
+
ShowSegmentsPipe,
|
771
|
+
ShowTransportTypesPipe], imports: [CommonModule,
|
772
|
+
TranslateModule,
|
773
|
+
FormsModule,
|
774
|
+
ReactiveFormsModule,
|
775
|
+
MatFormFieldModule,
|
776
|
+
MatIconModule,
|
777
|
+
MatProgressSpinnerModule,
|
778
|
+
MatButtonModule,
|
779
|
+
MatInputModule,
|
780
|
+
MatAutocompleteModule], exports: [GuajiritosGeneralAutocompleteComponent] });
|
781
|
+
GuajiritosGeneralAutocompleteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteModule, providers: [
|
782
|
+
UpperCasePipe,
|
783
|
+
CurrencyPipe,
|
784
|
+
AutocompleteService,
|
785
|
+
DurationTimePipe,
|
786
|
+
I18nFieldPipe,
|
787
|
+
ResolvePropertyPath,
|
788
|
+
HumanizeDurationPipe,
|
789
|
+
IdaReturnPipe,
|
790
|
+
ShowRolesPipe,
|
791
|
+
ShowSegmentsPipe,
|
792
|
+
ShowTransportTypesPipe
|
793
|
+
], imports: [CommonModule,
|
794
|
+
TranslateModule,
|
795
|
+
FormsModule,
|
796
|
+
ReactiveFormsModule,
|
797
|
+
MatFormFieldModule,
|
798
|
+
MatIconModule,
|
799
|
+
MatProgressSpinnerModule,
|
800
|
+
MatButtonModule,
|
801
|
+
MatInputModule,
|
802
|
+
MatAutocompleteModule] });
|
803
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: GuajiritosGeneralAutocompleteModule, decorators: [{
|
804
|
+
type: NgModule,
|
805
|
+
args: [{
|
806
|
+
declarations: [
|
807
|
+
GuajiritosGeneralAutocompleteComponent,
|
808
|
+
DurationTimePipe,
|
809
|
+
I18nFieldPipe,
|
810
|
+
ResolvePropertyPath,
|
811
|
+
HumanizeDurationPipe,
|
812
|
+
IdaReturnPipe,
|
813
|
+
ShowRolesPipe,
|
814
|
+
ShowSegmentsPipe,
|
815
|
+
ShowTransportTypesPipe
|
816
|
+
],
|
817
|
+
imports: [
|
818
|
+
CommonModule,
|
819
|
+
TranslateModule,
|
820
|
+
FormsModule,
|
821
|
+
ReactiveFormsModule,
|
822
|
+
MatFormFieldModule,
|
823
|
+
MatIconModule,
|
824
|
+
MatProgressSpinnerModule,
|
825
|
+
MatButtonModule,
|
826
|
+
MatInputModule,
|
827
|
+
MatAutocompleteModule
|
828
|
+
],
|
829
|
+
providers: [
|
830
|
+
UpperCasePipe,
|
831
|
+
CurrencyPipe,
|
832
|
+
AutocompleteService,
|
833
|
+
DurationTimePipe,
|
834
|
+
I18nFieldPipe,
|
835
|
+
ResolvePropertyPath,
|
836
|
+
HumanizeDurationPipe,
|
837
|
+
IdaReturnPipe,
|
838
|
+
ShowRolesPipe,
|
839
|
+
ShowSegmentsPipe,
|
840
|
+
ShowTransportTypesPipe
|
841
|
+
],
|
842
|
+
exports: [
|
843
|
+
GuajiritosGeneralAutocompleteComponent
|
844
|
+
]
|
845
|
+
}]
|
838
846
|
}] });
|
839
847
|
|
840
|
-
/*
|
841
|
-
* Public API Surface of guachos-general-autocomplete
|
848
|
+
/*
|
849
|
+
* Public API Surface of guachos-general-autocomplete
|
842
850
|
*/
|
843
851
|
|
844
|
-
/**
|
845
|
-
* Generated bundle index. Do not edit.
|
852
|
+
/**
|
853
|
+
* Generated bundle index. Do not edit.
|
846
854
|
*/
|
847
855
|
|
848
856
|
export { CustomPipes, GENERAL_DISPLAY_OPTIONS, GuajiritosGeneralAutocompleteComponent, GuajiritosGeneralAutocompleteModule };
|