ecabs-components 1.1.72 → 1.1.74
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/README.md +3 -0
- package/esm2022/lib/base/models/waypoint.models.mjs +1 -1
- package/esm2022/lib/ecabs-date-range-picker-v2/ecabs-date-range-picker-v2.component.mjs +11 -24
- package/esm2022/lib/ecabs-place-autocomplete/ecabs-place-autocomplete.component.mjs +2 -2
- package/esm2022/lib/ecabs-place-autocomplete-v2/ecabs-place-autocomplete-v2.component.mjs +50 -40
- package/fesm2022/ecabs-components.mjs +58 -61
- package/fesm2022/ecabs-components.mjs.map +1 -1
- package/lib/base/models/waypoint.models.d.ts +1 -1
- package/lib/ecabs-date-range-picker-v2/ecabs-date-range-picker-v2.component.d.ts +1 -2
- package/lib/ecabs-place-autocomplete-v2/ecabs-place-autocomplete-v2.component.d.ts +12 -13
- package/package.json +1 -1
|
@@ -7917,7 +7917,7 @@ class EcabsPlaceAutocompleteComponent extends EcabsElementBaseComponent {
|
|
|
7917
7917
|
const autocomplete = new google.maps.places.Autocomplete(this.getElement(), {
|
|
7918
7918
|
types: [],
|
|
7919
7919
|
componentRestrictions: { country: [this.countryCode] },
|
|
7920
|
-
fields: ['address_components', 'geometry.location'],
|
|
7920
|
+
fields: ['address_components', 'geometry.location', 'place_id'],
|
|
7921
7921
|
});
|
|
7922
7922
|
this.listener = autocomplete.addListener('place_changed', () => {
|
|
7923
7923
|
this.ngZone.run(() => {
|
|
@@ -7999,6 +7999,7 @@ class EcabsPlaceAutocompleteV2Component extends EcabsElementBaseComponent {
|
|
|
7999
7999
|
countryCode = 'MT';
|
|
8000
8000
|
googleLoaded;
|
|
8001
8001
|
waypointType;
|
|
8002
|
+
debounceTime = 240;
|
|
8002
8003
|
placeResult = new EventEmitter();
|
|
8003
8004
|
deleteItem = new EventEmitter();
|
|
8004
8005
|
queryChanged = new EventEmitter();
|
|
@@ -8007,21 +8008,20 @@ class EcabsPlaceAutocompleteV2Component extends EcabsElementBaseComponent {
|
|
|
8007
8008
|
waypointSuggestions$;
|
|
8008
8009
|
selectedIndex = -1;
|
|
8009
8010
|
displayedSuggestions = [];
|
|
8010
|
-
|
|
8011
|
-
listener;
|
|
8011
|
+
_value = '';
|
|
8012
8012
|
mapAutocompleteService;
|
|
8013
8013
|
placesService;
|
|
8014
8014
|
sessionToken;
|
|
8015
8015
|
get value() {
|
|
8016
|
-
return this.
|
|
8016
|
+
return this._value;
|
|
8017
8017
|
}
|
|
8018
|
-
set value(
|
|
8019
|
-
if (this.
|
|
8020
|
-
|
|
8021
|
-
this.value$.next(val);
|
|
8022
|
-
this.onChange(val);
|
|
8023
|
-
this.onTouch(val);
|
|
8018
|
+
set value(value) {
|
|
8019
|
+
if (this._value === value) {
|
|
8020
|
+
return;
|
|
8024
8021
|
}
|
|
8022
|
+
this._value = value;
|
|
8023
|
+
this.value$.next(value);
|
|
8024
|
+
this.onChange(value);
|
|
8025
8025
|
}
|
|
8026
8026
|
constructor(ngZone, injector) {
|
|
8027
8027
|
super();
|
|
@@ -8042,7 +8042,7 @@ class EcabsPlaceAutocompleteV2Component extends EcabsElementBaseComponent {
|
|
|
8042
8042
|
this.waypointSuggestions$ = combineLatest([
|
|
8043
8043
|
this.isFocused$,
|
|
8044
8044
|
this.value$,
|
|
8045
|
-
]).pipe(debounceTime(
|
|
8045
|
+
]).pipe(debounceTime(this.debounceTime), switchMap(([isFocused, value]) => {
|
|
8046
8046
|
if (!isFocused) {
|
|
8047
8047
|
return of([]);
|
|
8048
8048
|
}
|
|
@@ -8056,8 +8056,13 @@ class EcabsPlaceAutocompleteV2Component extends EcabsElementBaseComponent {
|
|
|
8056
8056
|
return results;
|
|
8057
8057
|
}));
|
|
8058
8058
|
}
|
|
8059
|
+
onChange = () => { };
|
|
8060
|
+
onTouch = () => { };
|
|
8059
8061
|
getWaypointResults(query) {
|
|
8060
|
-
this.queryChanged.emit({
|
|
8062
|
+
this.queryChanged.emit({
|
|
8063
|
+
waypoint_type: this.waypointType,
|
|
8064
|
+
place_name: query,
|
|
8065
|
+
});
|
|
8061
8066
|
return combineLatest([
|
|
8062
8067
|
of(this.waypointsHistory),
|
|
8063
8068
|
this.getPlacesResults(query),
|
|
@@ -8073,35 +8078,41 @@ class EcabsPlaceAutocompleteV2Component extends EcabsElementBaseComponent {
|
|
|
8073
8078
|
componentRestrictions: { country: this.countryCode },
|
|
8074
8079
|
sessionToken: this.sessionToken,
|
|
8075
8080
|
}, (predictions) => {
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
source: 'google',
|
|
8081
|
-
prediction_term: prediction.terms,
|
|
8082
|
-
};
|
|
8083
|
-
}));
|
|
8084
|
-
observer.complete();
|
|
8081
|
+
this.ngZone.run(() => {
|
|
8082
|
+
observer.next(this.toWaypointSuggestions(predictions));
|
|
8083
|
+
observer.complete();
|
|
8084
|
+
});
|
|
8085
8085
|
});
|
|
8086
8086
|
});
|
|
8087
8087
|
}
|
|
8088
|
+
toWaypointSuggestions(predictions) {
|
|
8089
|
+
return (predictions ?? []).map((prediction) => ({
|
|
8090
|
+
additional_info: prediction.description,
|
|
8091
|
+
place_id: prediction.place_id,
|
|
8092
|
+
source: 'google',
|
|
8093
|
+
prediction_term: prediction.terms,
|
|
8094
|
+
}));
|
|
8095
|
+
}
|
|
8088
8096
|
onSelectSuggestion(suggestion) {
|
|
8089
8097
|
const { additional_info, place_id } = suggestion ?? {};
|
|
8090
8098
|
this.value = additional_info;
|
|
8091
8099
|
this.placesService.getDetails({
|
|
8092
8100
|
placeId: place_id,
|
|
8093
8101
|
sessionToken: this.sessionToken,
|
|
8094
|
-
fields: ['address_components', 'geometry.location'],
|
|
8102
|
+
fields: ['address_components', 'geometry.location', 'place_id'],
|
|
8095
8103
|
}, (place, status) => {
|
|
8096
|
-
|
|
8097
|
-
|
|
8104
|
+
this.ngZone.run(() => {
|
|
8105
|
+
if (status === google.maps.places.PlacesServiceStatus.OK && place) {
|
|
8098
8106
|
this.placeResult.emit({
|
|
8099
8107
|
place,
|
|
8100
8108
|
text: additional_info,
|
|
8101
8109
|
});
|
|
8102
|
-
}
|
|
8103
|
-
|
|
8104
|
-
|
|
8110
|
+
}
|
|
8111
|
+
else {
|
|
8112
|
+
console.warn('Place details lookup failed', { status, place_id });
|
|
8113
|
+
}
|
|
8114
|
+
this.resetSessionToken();
|
|
8115
|
+
});
|
|
8105
8116
|
});
|
|
8106
8117
|
}
|
|
8107
8118
|
onKeyDown(event) {
|
|
@@ -8132,25 +8143,22 @@ class EcabsPlaceAutocompleteV2Component extends EcabsElementBaseComponent {
|
|
|
8132
8143
|
break;
|
|
8133
8144
|
}
|
|
8134
8145
|
}
|
|
8135
|
-
ngOnDestroy() {
|
|
8136
|
-
if (this.listener) {
|
|
8137
|
-
this.listener.remove();
|
|
8138
|
-
}
|
|
8139
|
-
}
|
|
8140
|
-
onChange = () => { };
|
|
8141
|
-
onTouch = () => { };
|
|
8142
8146
|
onBlur() {
|
|
8143
8147
|
this.isFocused$.next(false);
|
|
8144
|
-
this.onTouch;
|
|
8148
|
+
this.onTouch();
|
|
8145
8149
|
}
|
|
8146
8150
|
onFocus() {
|
|
8147
|
-
this.isFocused$.next(true);
|
|
8148
8151
|
if (!this.value) {
|
|
8149
8152
|
this.resetSessionToken();
|
|
8150
8153
|
}
|
|
8154
|
+
setTimeout(() => this.ngZone.run(() => this.isFocused$.next(true)));
|
|
8151
8155
|
}
|
|
8152
|
-
writeValue(
|
|
8153
|
-
this.
|
|
8156
|
+
writeValue(nextValue = '') {
|
|
8157
|
+
if (this._value === nextValue) {
|
|
8158
|
+
return;
|
|
8159
|
+
}
|
|
8160
|
+
this._value = nextValue;
|
|
8161
|
+
this.value$.next(nextValue);
|
|
8154
8162
|
}
|
|
8155
8163
|
registerOnChange(fn) {
|
|
8156
8164
|
this.onChange = fn;
|
|
@@ -8174,7 +8182,7 @@ class EcabsPlaceAutocompleteV2Component extends EcabsElementBaseComponent {
|
|
|
8174
8182
|
this.sessionToken = new google.maps.places.AutocompleteSessionToken();
|
|
8175
8183
|
}
|
|
8176
8184
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EcabsPlaceAutocompleteV2Component, deps: [{ token: i0.NgZone }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
8177
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EcabsPlaceAutocompleteV2Component, selector: "ecabs-place-autocomplete-v2", inputs: { showDeleteItem: "showDeleteItem", waypointsHistory: "waypointsHistory", showSuffix: "showSuffix", countryCode: "countryCode", googleLoaded: "googleLoaded", waypointType: "waypointType" }, outputs: { placeResult: "placeResult", deleteItem: "deleteItem", queryChanged: "queryChanged" }, providers: [
|
|
8185
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EcabsPlaceAutocompleteV2Component, selector: "ecabs-place-autocomplete-v2", inputs: { showDeleteItem: "showDeleteItem", waypointsHistory: "waypointsHistory", showSuffix: "showSuffix", countryCode: "countryCode", googleLoaded: "googleLoaded", waypointType: "waypointType", debounceTime: "debounceTime" }, outputs: { placeResult: "placeResult", deleteItem: "deleteItem", queryChanged: "queryChanged" }, providers: [
|
|
8178
8186
|
{
|
|
8179
8187
|
provide: NG_VALUE_ACCESSOR,
|
|
8180
8188
|
useExisting: EcabsPlaceAutocompleteV2Component,
|
|
@@ -8206,6 +8214,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
8206
8214
|
type: Input
|
|
8207
8215
|
}], waypointType: [{
|
|
8208
8216
|
type: Input
|
|
8217
|
+
}], debounceTime: [{
|
|
8218
|
+
type: Input
|
|
8209
8219
|
}], placeResult: [{
|
|
8210
8220
|
type: Output
|
|
8211
8221
|
}], deleteItem: [{
|
|
@@ -9202,7 +9212,6 @@ class EcabsDateRangePickerComponentV2 extends EcabsElementBaseComponent {
|
|
|
9202
9212
|
excludeWeekends;
|
|
9203
9213
|
specificDates;
|
|
9204
9214
|
holidayOptions;
|
|
9205
|
-
dateToOptional = false;
|
|
9206
9215
|
onblur = new EventEmitter();
|
|
9207
9216
|
val;
|
|
9208
9217
|
pickerTo;
|
|
@@ -9243,7 +9252,7 @@ class EcabsDateRangePickerComponentV2 extends EcabsElementBaseComponent {
|
|
|
9243
9252
|
if (val && isValid(new Date(val))) {
|
|
9244
9253
|
this._dateFrom = val;
|
|
9245
9254
|
this.minDateTo = new Date(val);
|
|
9246
|
-
if (!this.dateTo
|
|
9255
|
+
if (!this.dateTo) {
|
|
9247
9256
|
this.pickerTo?.open();
|
|
9248
9257
|
}
|
|
9249
9258
|
}
|
|
@@ -9365,32 +9374,22 @@ class EcabsDateRangePickerComponentV2 extends EcabsElementBaseComponent {
|
|
|
9365
9374
|
return true;
|
|
9366
9375
|
}
|
|
9367
9376
|
dateRangeValidator(control) {
|
|
9368
|
-
const required = control?.hasValidator(Validators.required);
|
|
9369
9377
|
if (!control.value) {
|
|
9370
|
-
if (required) {
|
|
9371
|
-
control.setErrors({ required: true });
|
|
9372
|
-
}
|
|
9373
9378
|
return;
|
|
9374
9379
|
}
|
|
9375
9380
|
const { dateFrom, dateTo } = control.value;
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
(!dateTo || dateTo?.length === 0)) {
|
|
9380
|
-
control.setErrors({ required: true });
|
|
9381
|
-
}
|
|
9382
|
-
else if (!dateFrom && dateTo) {
|
|
9383
|
-
control.setErrors({ rangeFrom: true });
|
|
9384
|
-
}
|
|
9385
|
-
else if (dateFrom && !dateTo && !this.dateToOptional) {
|
|
9386
|
-
control.setErrors({ rangeTo: true });
|
|
9387
|
-
}
|
|
9388
|
-
else if (dateFrom && dateTo && new Date(dateFrom) > new Date(dateTo)) {
|
|
9381
|
+
const from = new Date(dateFrom);
|
|
9382
|
+
const to = new Date(dateTo);
|
|
9383
|
+
if (dateFrom && dateTo && from > to) {
|
|
9389
9384
|
control.setErrors({ rangeOrder: true });
|
|
9390
9385
|
}
|
|
9386
|
+
else if (control.hasError('rangeOrder')) {
|
|
9387
|
+
const { rangeOrder: _, ...rest } = control.errors ?? {};
|
|
9388
|
+
control.setErrors(Object.keys(rest).length ? rest : null);
|
|
9389
|
+
}
|
|
9391
9390
|
}
|
|
9392
9391
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EcabsDateRangePickerComponentV2, deps: [{ token: i0.Injector }, { token: EcabsDatePickerHeaderService }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
9393
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EcabsDateRangePickerComponentV2, selector: "ecabs-date-range-picker-v2", inputs: { minDate: "minDate", maxDate: "maxDate", touchUi: "touchUi", cancelLabel: "cancelLabel", applyLabel: "applyLabel", startDatePlaceholder: "startDatePlaceholder", endDatePlaceholder: "endDatePlaceholder", separatorLabel: "separatorLabel", excludeHolidays: "excludeHolidays", excludeWeekends: "excludeWeekends", specificDates: "specificDates", holidayOptions: "holidayOptions"
|
|
9392
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EcabsDateRangePickerComponentV2, selector: "ecabs-date-range-picker-v2", inputs: { minDate: "minDate", maxDate: "maxDate", touchUi: "touchUi", cancelLabel: "cancelLabel", applyLabel: "applyLabel", startDatePlaceholder: "startDatePlaceholder", endDatePlaceholder: "endDatePlaceholder", separatorLabel: "separatorLabel", excludeHolidays: "excludeHolidays", excludeWeekends: "excludeWeekends", specificDates: "specificDates", holidayOptions: "holidayOptions" }, outputs: { onblur: "onblur" }, providers: [
|
|
9394
9393
|
{
|
|
9395
9394
|
provide: NG_VALUE_ACCESSOR,
|
|
9396
9395
|
useExisting: EcabsDateRangePickerComponentV2,
|
|
@@ -9431,8 +9430,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
9431
9430
|
type: Input
|
|
9432
9431
|
}], holidayOptions: [{
|
|
9433
9432
|
type: Input
|
|
9434
|
-
}], dateToOptional: [{
|
|
9435
|
-
type: Input
|
|
9436
9433
|
}], onblur: [{
|
|
9437
9434
|
type: Output
|
|
9438
9435
|
}], pickerTo: [{
|