@haiilo/catalyst-angular 10.7.0 → 10.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/directives/date-value-accessor.mjs +25 -6
- package/esm2020/lib/directives/proxies.mjs +4 -4
- package/fesm2015/haiilo-catalyst-angular.mjs +27 -8
- package/fesm2015/haiilo-catalyst-angular.mjs.map +1 -1
- package/fesm2020/haiilo-catalyst-angular.mjs +27 -8
- package/fesm2020/haiilo-catalyst-angular.mjs.map +1 -1
- package/lib/directives/date-value-accessor.d.ts +2 -0
- package/lib/directives/proxies.d.ts +1 -1
- package/package.json +3 -3
|
@@ -300,10 +300,10 @@ let CatDateInline = class CatDateInline {
|
|
|
300
300
|
}
|
|
301
301
|
};
|
|
302
302
|
CatDateInline.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CatDateInline, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
303
|
-
CatDateInline.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: CatDateInline, selector: "cat-date-inline", inputs: { max: "max", min: "min", noClear: "noClear",
|
|
303
|
+
CatDateInline.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: CatDateInline, selector: "cat-date-inline", inputs: { hint: "hint", max: "max", min: "min", noClear: "noClear", noToday: "noToday", range: "range", value: "value", weeks: "weeks" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
304
304
|
CatDateInline = __decorate([
|
|
305
305
|
ProxyCmp({
|
|
306
|
-
inputs: ['
|
|
306
|
+
inputs: ['hint', 'max', 'min', 'noClear', 'noToday', 'range', 'value', 'weeks'],
|
|
307
307
|
methods: ['select', 'clear', 'resetView']
|
|
308
308
|
})
|
|
309
309
|
], CatDateInline);
|
|
@@ -314,7 +314,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
314
314
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
315
315
|
template: '<ng-content></ng-content>',
|
|
316
316
|
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
|
|
317
|
-
inputs: ['
|
|
317
|
+
inputs: ['hint', 'max', 'min', 'noClear', 'noToday', 'range', 'value', 'weeks'],
|
|
318
318
|
}]
|
|
319
319
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; } });
|
|
320
320
|
let CatDatepicker = class CatDatepicker {
|
|
@@ -959,17 +959,36 @@ class DateValueAccessor extends ValueAccessor {
|
|
|
959
959
|
return this.el.nativeElement;
|
|
960
960
|
}
|
|
961
961
|
writeValue(value) {
|
|
962
|
-
if (
|
|
962
|
+
if (!this.el.nativeElement.range) {
|
|
963
|
+
return super.writeValue(this.toISO(value));
|
|
964
|
+
}
|
|
965
|
+
else if (value instanceof Array) {
|
|
966
|
+
const data = [this.toISO(value[0]), this.toISO(value[1])];
|
|
967
|
+
return super.writeValue(JSON.stringify(data));
|
|
968
|
+
}
|
|
969
|
+
return super.writeValue(undefined);
|
|
970
|
+
}
|
|
971
|
+
handleChangeEvent(value) {
|
|
972
|
+
if (!this.el.nativeElement.range) {
|
|
973
|
+
return super.handleChangeEvent(this.toDate(value));
|
|
974
|
+
}
|
|
975
|
+
else if (typeof value === 'string') {
|
|
976
|
+
return super.handleChangeEvent(JSON.parse(value).map(this.toDate));
|
|
977
|
+
}
|
|
978
|
+
super.handleChangeEvent(null);
|
|
979
|
+
}
|
|
980
|
+
toISO(value) {
|
|
981
|
+
if (value instanceof Date) {
|
|
963
982
|
const year = value.getFullYear();
|
|
964
983
|
const month = (value.getMonth() + 1).toString().padStart(2, '0');
|
|
965
984
|
const day = value.getDate().toString().padStart(2, '0');
|
|
966
|
-
return
|
|
985
|
+
return `${year}-${month}-${day}`;
|
|
967
986
|
}
|
|
968
|
-
return
|
|
987
|
+
return undefined;
|
|
969
988
|
}
|
|
970
|
-
|
|
989
|
+
toDate(value) {
|
|
971
990
|
const [match, year, month, day] = value?.match(/^(\d{4})-(\d{2})-(\d{2})/) ?? [];
|
|
972
|
-
return
|
|
991
|
+
return match ? new Date(Number(year), Number(month) - 1, Number(day)) : null;
|
|
973
992
|
}
|
|
974
993
|
}
|
|
975
994
|
DateValueAccessor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DateValueAccessor, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|