@colijnit/corecomponents_v12 261.20.16 → 261.20.17
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.
|
Binary file
|
|
@@ -7190,7 +7190,7 @@ class InputTextComponent extends BaseInputComponent {
|
|
|
7190
7190
|
rightIconData;
|
|
7191
7191
|
selectOnFocus = false;
|
|
7192
7192
|
emptyPlace = false;
|
|
7193
|
-
firstDayOfWeek = '1'; //
|
|
7193
|
+
firstDayOfWeek = '1'; // Monday by default
|
|
7194
7194
|
noStyle = false;
|
|
7195
7195
|
hideArrowButtons = false;
|
|
7196
7196
|
get isDate() {
|
|
@@ -7402,18 +7402,19 @@ class InputTextComponent extends BaseInputComponent {
|
|
|
7402
7402
|
// Internal default first day of week
|
|
7403
7403
|
let weekdayOffset = parseInt(this.firstDayOfWeek, 10);
|
|
7404
7404
|
if (isNaN(weekdayOffset) || weekdayOffset < 1 || weekdayOffset > 7) {
|
|
7405
|
-
weekdayOffset =
|
|
7405
|
+
weekdayOffset = 1; // Monday
|
|
7406
7406
|
}
|
|
7407
|
-
|
|
7407
|
+
// 1 = Monday, 2 = Tuesday, 3 = Wednesday, ..., 7 = Sunday
|
|
7408
|
+
const jsWeekdayIndex = weekdayOffset - 1;
|
|
7408
7409
|
const jan4 = new Date(year, 0, 4);
|
|
7409
7410
|
const jan4Day = jan4.getDay();
|
|
7410
7411
|
const diffToMonday = (jan4Day + 6) % 7;
|
|
7411
7412
|
const firstWeekMonday = new Date(jan4);
|
|
7412
|
-
firstWeekMonday.setDate(jan4.getDate() - diffToMonday);
|
|
7413
|
+
firstWeekMonday.setDate(jan4.getDate() - diffToMonday);
|
|
7413
7414
|
const baseWeekStart = new Date(firstWeekMonday);
|
|
7414
|
-
baseWeekStart.setDate(
|
|
7415
|
-
|
|
7416
|
-
targetDate.setDate(
|
|
7415
|
+
baseWeekStart.setDate(firstWeekMonday.getDate() + (week - 1) * 7);
|
|
7416
|
+
let targetDate = new Date(baseWeekStart);
|
|
7417
|
+
targetDate.setDate(targetDate.getDate() + jsWeekdayIndex);
|
|
7417
7418
|
if (targetDate < today) {
|
|
7418
7419
|
year += 1;
|
|
7419
7420
|
const jan4Next = new Date(year, 0, 4);
|
|
@@ -7422,14 +7423,19 @@ class InputTextComponent extends BaseInputComponent {
|
|
|
7422
7423
|
const firstWeekMondayNext = new Date(jan4Next);
|
|
7423
7424
|
firstWeekMondayNext.setDate(jan4Next.getDate() - diffToMondayNext);
|
|
7424
7425
|
const baseWeekStartNext = new Date(firstWeekMondayNext);
|
|
7425
|
-
baseWeekStartNext.setDate(
|
|
7426
|
-
targetDate
|
|
7427
|
-
targetDate.
|
|
7428
|
-
targetDate.setDate(baseWeekStartNext.getDate() + jsWeekdayIndex);
|
|
7426
|
+
baseWeekStartNext.setDate(firstWeekMondayNext.getDate() + (week - 1) * 7);
|
|
7427
|
+
targetDate = new Date(baseWeekStartNext);
|
|
7428
|
+
targetDate.setDate(targetDate.getDate() + jsWeekdayIndex);
|
|
7429
7429
|
}
|
|
7430
|
-
this.model =
|
|
7430
|
+
this.model = this.formatDateLocal(targetDate);
|
|
7431
7431
|
this.modelChange.emit(this.model);
|
|
7432
7432
|
}
|
|
7433
|
+
formatDateLocal(date) {
|
|
7434
|
+
const year = date.getFullYear();
|
|
7435
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
7436
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
7437
|
+
return `${year}-${month}-${day}`;
|
|
7438
|
+
}
|
|
7433
7439
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: InputTextComponent, deps: [{ token: FormComponent, optional: true }, { token: i0.ChangeDetectorRef }, { token: OverlayService }, { token: FormInputUserModelChangeListenerService }, { token: NgZoneWrapperService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
7434
7440
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: InputTextComponent, isStandalone: false, selector: "co-input-text", inputs: { useContent: "useContent", placeholder: "placeholder", align: "align", type: "type", formatPipe: "formatPipe", min: "min", max: "max", pattern: "pattern", digitsOnly: "digitsOnly", excludePlusMinus: "excludePlusMinus", showClearButton: "showClearButton", keyDownWhiteList: "keyDownWhiteList", showPlaceholderOnFocus: "showPlaceholderOnFocus", leftIcon: "leftIcon", rightIcon: "rightIcon", leftIconData: "leftIconData", rightIconData: "rightIconData", selectOnFocus: "selectOnFocus", emptyPlace: "emptyPlace", firstDayOfWeek: "firstDayOfWeek", noStyle: "noStyle", hideArrowButtons: "hideArrowButtons", model: "model" }, outputs: { leftIconClick: "leftIconClick", leftIconMouseDown: "leftIconMouseDown", leftIconMouseUp: "leftIconMouseUp", rightIconClick: "rightIconClick", rightIconMouseDown: "rightIconMouseDown", rightIconMouseUp: "rightIconMouseUp", clearIconClick: "clearIconClick", isFocused: "isFocused" }, host: { listeners: { "document:pointerup": "handleDocumentPointerUp($event)", "document:pointercancel": "handleDocumentPointerUp($event)" }, properties: { "class.no-style": "this.noStyle", "class.hide-arrows": "this.hideArrowButtons", "class.isDate": "this.isDate", "class.co-input-text": "this.showClass", "class.has-left-icon": "this.hasLeftIcon", "class.has-right-icon": "this.hasRightIcon", "class.has-own-label": "this.hasOwnLabel" } }, providers: [
|
|
7435
7441
|
OverlayService, {
|