@indigina/ui-kit 1.1.397 → 1.1.398

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.
@@ -10080,10 +10080,14 @@ class KitSchedulerToolbarComponent {
10080
10080
  }, ...(ngDevMode ? [{ debugName: "viewSettingsMap" }] : []));
10081
10081
  }
10082
10082
  onDateChange(date) {
10083
- this.navigate({
10084
- type: 'select-date',
10085
- date: new Date(date),
10086
- });
10083
+ const today = new Date();
10084
+ if (!date) {
10085
+ this.navigateToDate(today);
10086
+ return;
10087
+ }
10088
+ if (this.isDateWithinRange(new Date(date), today)) {
10089
+ this.navigateToDate(new Date(date));
10090
+ }
10087
10091
  }
10088
10092
  next() {
10089
10093
  this.navigate({ type: 'next' });
@@ -10107,6 +10111,20 @@ class KitSchedulerToolbarComponent {
10107
10111
  navigate(action) {
10108
10112
  this.toolbarService.navigate(action);
10109
10113
  }
10114
+ navigateToDate(date) {
10115
+ this.navigate({
10116
+ type: 'select-date',
10117
+ date,
10118
+ });
10119
+ }
10120
+ isDateWithinRange(date, referenceDate) {
10121
+ const yearsRange = 20;
10122
+ const minDate = new Date(referenceDate);
10123
+ minDate.setFullYear(referenceDate.getFullYear() - yearsRange);
10124
+ const maxDate = new Date(referenceDate);
10125
+ maxDate.setFullYear(referenceDate.getFullYear() + yearsRange);
10126
+ return date >= minDate && date <= maxDate;
10127
+ }
10110
10128
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: KitSchedulerToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
10111
10129
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: KitSchedulerToolbarComponent, isStandalone: true, selector: "kit-scheduler-toolbar", inputs: { selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null }, selectedView: { classPropertyName: "selectedView", publicName: "selectedView", isSignal: true, isRequired: false, transformFunction: null }, showTimePill: { classPropertyName: "showTimePill", publicName: "showTimePill", isSignal: true, isRequired: false, transformFunction: null }, views: { classPropertyName: "views", publicName: "views", isSignal: true, isRequired: false, transformFunction: null }, viewModes: { classPropertyName: "viewModes", publicName: "viewModes", isSignal: true, isRequired: true, transformFunction: null }, selectedViewIndex: { classPropertyName: "selectedViewIndex", publicName: "selectedViewIndex", isSignal: true, isRequired: false, transformFunction: null }, showExportButton: { classPropertyName: "showExportButton", publicName: "showExportButton", isSignal: true, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { exportPDF: "exportPDF" }, ngImport: i0, template: "<div class=\"kit-scheduler-toolbar\">\n <div class=\"kit-scheduler-toolbar-nav\">\n <kit-button [type]=\"kitButtonType.GHOST\"\n [kind]=\"kitButtonKind.MEDIUM\"\n [icon]=\"kitSvgIcon.CHEVRON_LEFT\"\n (clicked)=\"prev()\"\n ></kit-button>\n <kit-button label=\"Today\"\n [type]=\"kitButtonType.GHOST\"\n [kind]=\"kitButtonKind.MEDIUM\"\n (clicked)=\"today()\"></kit-button>\n <kit-button [type]=\"kitButtonType.GHOST\"\n [kind]=\"kitButtonKind.MEDIUM\"\n [icon]=\"kitSvgIcon.CHEVRON_RIGHT\"\n (clicked)=\"next()\">\n </kit-button>\n </div>\n\n <div class=\"kit-scheduler-toolbar-views\">\n @for (view of views(); track $index) {\n <kit-button [type]=\"selectedViewIndex() === $index ? kitButtonType.PRIMARY : kitButtonType.TEXT\"\n [label]=\"viewSettingsMap()[$index].title\"\n [kind]=\"kitButtonKind.MEDIUM\"\n (clicked)=\"onViewChange(view)\"\n ></kit-button>\n }\n </div>\n\n <kit-datepicker class=\"kit-scheduler-toolbar-datepicker\"\n [defaultDate]=\"selectedDate()\"\n [size]=\"kitDatepickerSize.SMALL\"\n [format]=\"getDatepickerFormat()\"\n (changed)=\"onDateChange($event)\"\n ></kit-datepicker>\n @if (showTimePill()) {\n <kit-pill class=\"kit-scheduler-toolbar-time-pill\">\n GMT standard time\n </kit-pill>\n }\n\n @if (showExportButton()) {\n <kit-button kitTooltip\n kitTooltipFilter=\"kit-button\"\n [title]=\"'kit.export.title' | translate\"\n [disabled]=\"isLoading()\"\n [icon]=\"kitSvgIcon.DOWNLOAD\"\n [type]=\"kitButtonType.GHOST\"\n [kind]=\"kitButtonKind.MEDIUM\"\n (clicked)=\"exportPDF.emit()\" />\n }\n</div>\n", styles: [".kit-scheduler-toolbar{display:flex;align-items:center;gap:20px;width:100%}.kit-scheduler-toolbar-nav{display:flex;align-items:center;gap:1px;padding-right:20px;border-right:1px solid var(--ui-kit-color-grey-11)}.kit-scheduler-toolbar-views{display:flex;align-items:center}.kit-scheduler-toolbar-datepicker{margin-left:auto;width:235px}.kit-scheduler-toolbar ::ng-deep .kit-scheduler-toolbar-time-pill .kit-pill{border-color:var(--ui-kit-color-grey-11)}\n"], dependencies: [{ kind: "component", type: KitButtonComponent, selector: "kit-button", inputs: ["disabled", "label", "type", "icon", "iconType", "kind", "state", "iconPosition", "buttonClass", "active"], outputs: ["clicked"] }, { kind: "component", type: KitDatepickerComponent, selector: "kit-datepicker", inputs: ["placeholder", "label", "labelTooltip", "defaultDate", "disabled", "format", "min", "max", "messageIcon", "messageText", "size", "readonly"], outputs: ["defaultDateChange", "disabledChange", "changed"] }, { kind: "component", type: KitPillComponent, selector: "kit-pill", inputs: ["removable", "selectable", "selected", "type", "theme", "icon", "iconType"], outputs: ["clicked", "removed"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10112
10130
  }