@colijnit/corecomponents_v12 259.1.15 → 260.1.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/bundles/colijnit-corecomponents_v12.umd.js +95 -10
- package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
- package/colijnit-corecomponents_v12.metadata.json +1 -1
- package/esm2015/lib/components/filter-item/filter-item.component.js +4 -3
- package/esm2015/lib/components/input-date-picker/input-date-picker.component.js +5 -2
- package/esm2015/lib/components/input-date-range-picker/input-date-range-picker.component.js +5 -2
- package/esm2015/lib/components/input-text/input-text.component.js +88 -8
- package/esm2015/lib/components/simple-grid/simple-grid.component.js +9 -1
- package/fesm2015/colijnit-corecomponents_v12.js +104 -9
- package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
- package/lib/components/filter-item/filter-item.component.d.ts +1 -0
- package/lib/components/input-date-picker/input-date-picker.component.d.ts +1 -0
- package/lib/components/input-date-range-picker/input-date-range-picker.component.d.ts +1 -0
- package/lib/components/input-text/input-text.component.d.ts +5 -1
- package/package.json +2 -2
|
@@ -5438,6 +5438,7 @@ class InputDatePickerComponent extends BaseInputDatePickerDirective {
|
|
|
5438
5438
|
this.formUserChangeListener = formUserChangeListener;
|
|
5439
5439
|
this.ngZoneWrapper = ngZoneWrapper;
|
|
5440
5440
|
this.elementRef = elementRef;
|
|
5441
|
+
this.firstDayOfWeek = '';
|
|
5441
5442
|
super._markAsOnPush();
|
|
5442
5443
|
}
|
|
5443
5444
|
showClass() {
|
|
@@ -5530,6 +5531,7 @@ InputDatePickerComponent.decorators = [
|
|
|
5530
5531
|
(modelChange)="modelAsString = $event"
|
|
5531
5532
|
(clearIconClick)="handleClearIconClicked()"
|
|
5532
5533
|
[emptyPlace]="true"
|
|
5534
|
+
[firstDayOfWeek]="firstDayOfWeek"
|
|
5533
5535
|
(keydown.enter)="finalizeDate()"
|
|
5534
5536
|
(keydown.tab)="finalizeDate()"
|
|
5535
5537
|
(blur)="finalizeDate()"
|
|
@@ -5556,6 +5558,7 @@ InputDatePickerComponent.ctorParameters = () => [
|
|
|
5556
5558
|
{ type: ElementRef }
|
|
5557
5559
|
];
|
|
5558
5560
|
InputDatePickerComponent.propDecorators = {
|
|
5561
|
+
firstDayOfWeek: [{ type: Input }],
|
|
5559
5562
|
showClass: [{ type: HostBinding, args: ['class.co-input-date',] }]
|
|
5560
5563
|
};
|
|
5561
5564
|
|
|
@@ -5773,6 +5776,7 @@ class InputTextComponent extends BaseInputComponent {
|
|
|
5773
5776
|
this.showPlaceholderOnFocus = true;
|
|
5774
5777
|
this.selectOnFocus = false;
|
|
5775
5778
|
this.emptyPlace = false;
|
|
5779
|
+
this.firstDayOfWeek = '1'; // default is sunday ioneJS
|
|
5776
5780
|
this.noStyle = false;
|
|
5777
5781
|
this.hideArrowButtons = false;
|
|
5778
5782
|
this.leftIconClick = new EventEmitter();
|
|
@@ -5785,6 +5789,8 @@ class InputTextComponent extends BaseInputComponent {
|
|
|
5785
5789
|
this.isFocused = new EventEmitter();
|
|
5786
5790
|
this.hasOwnLabel = true;
|
|
5787
5791
|
this.isFocusedOnDate = false;
|
|
5792
|
+
this.weekInputBuffer = '';
|
|
5793
|
+
this.isWeekInputMode = false;
|
|
5788
5794
|
this._isLeftIconMouseDown = false;
|
|
5789
5795
|
this._isRightIconMouseDown = false;
|
|
5790
5796
|
super._markAsOnPush();
|
|
@@ -5836,11 +5842,6 @@ class InputTextComponent extends BaseInputComponent {
|
|
|
5836
5842
|
}
|
|
5837
5843
|
return this.model;
|
|
5838
5844
|
}
|
|
5839
|
-
// exclude some non-digit characters, since input type 'number' still allows the characters -, + and e
|
|
5840
|
-
excludeNonDigitChars(event) {
|
|
5841
|
-
const excludedKeys = this.excludePlusMinus ? ['e', '-', '+'] : ['e'];
|
|
5842
|
-
return !excludedKeys.includes(event.key);
|
|
5843
|
-
}
|
|
5844
5845
|
handleLeftIconClick(event) {
|
|
5845
5846
|
event.preventDefault();
|
|
5846
5847
|
event.stopPropagation();
|
|
@@ -5903,6 +5904,87 @@ class InputTextComponent extends BaseInputComponent {
|
|
|
5903
5904
|
this.setModel(null);
|
|
5904
5905
|
this.clearIconClick.emit(event);
|
|
5905
5906
|
}
|
|
5907
|
+
handleKeyDownInput(event) {
|
|
5908
|
+
const key = event.key.toLowerCase();
|
|
5909
|
+
if (this.type === 'date') {
|
|
5910
|
+
if (key === 'w') {
|
|
5911
|
+
event.preventDefault();
|
|
5912
|
+
this.isWeekInputMode = true;
|
|
5913
|
+
this.weekInputBuffer = 'w';
|
|
5914
|
+
this.model = 'w';
|
|
5915
|
+
this.modelChange.emit(this.model);
|
|
5916
|
+
return;
|
|
5917
|
+
}
|
|
5918
|
+
if (this.isWeekInputMode) {
|
|
5919
|
+
if (/^\d$/.test(key)) {
|
|
5920
|
+
event.preventDefault();
|
|
5921
|
+
this.weekInputBuffer += key;
|
|
5922
|
+
this.model = this.weekInputBuffer;
|
|
5923
|
+
this.modelChange.emit(this.model);
|
|
5924
|
+
return;
|
|
5925
|
+
}
|
|
5926
|
+
if (key === 'enter' || key === 'tab') {
|
|
5927
|
+
event.preventDefault();
|
|
5928
|
+
this.convertWeekToDate(this.weekInputBuffer);
|
|
5929
|
+
this.isWeekInputMode = false;
|
|
5930
|
+
this.weekInputBuffer = '';
|
|
5931
|
+
return;
|
|
5932
|
+
}
|
|
5933
|
+
if (!['backspace', 'delete'].includes(key)) {
|
|
5934
|
+
this.isWeekInputMode = false;
|
|
5935
|
+
this.weekInputBuffer = '';
|
|
5936
|
+
}
|
|
5937
|
+
}
|
|
5938
|
+
}
|
|
5939
|
+
/* old excludeCharacter function */
|
|
5940
|
+
if (this.digitsOnly && !this.isWeekInputMode) {
|
|
5941
|
+
const excludedKeys = this.excludePlusMinus ? ['e', '-', '+'] : ['e'];
|
|
5942
|
+
if (excludedKeys.includes(event.key)) {
|
|
5943
|
+
event.preventDefault();
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
}
|
|
5947
|
+
convertWeekToDate(weekStr) {
|
|
5948
|
+
const match = weekStr.match(/^w0*(\d{1,2})$/i);
|
|
5949
|
+
if (!match)
|
|
5950
|
+
return;
|
|
5951
|
+
const week = parseInt(match[1], 10);
|
|
5952
|
+
if (week < 1 || week > 53)
|
|
5953
|
+
return;
|
|
5954
|
+
const today = new Date();
|
|
5955
|
+
let year = today.getFullYear();
|
|
5956
|
+
// Internal default first day of week
|
|
5957
|
+
let weekdayOffset = parseInt(this.firstDayOfWeek, 10);
|
|
5958
|
+
if (isNaN(weekdayOffset) || weekdayOffset < 1 || weekdayOffset > 7) {
|
|
5959
|
+
weekdayOffset = 2;
|
|
5960
|
+
}
|
|
5961
|
+
// Convert to JS weekday index where 0 = Sunday ... 6 = Saturday
|
|
5962
|
+
const jsWeekdayIndex = (weekdayOffset - 1) % 7;
|
|
5963
|
+
const jan4 = new Date(year, 0, 4);
|
|
5964
|
+
const jan4Day = jan4.getDay();
|
|
5965
|
+
const diffToMonday = (jan4Day + 6) % 7;
|
|
5966
|
+
const firstWeekMonday = new Date(jan4);
|
|
5967
|
+
firstWeekMonday.setDate(jan4.getDate() - diffToMonday); // Monday of week 1
|
|
5968
|
+
const baseWeekStart = new Date(firstWeekMonday);
|
|
5969
|
+
baseWeekStart.setDate(baseWeekStart.getDate() + (week - 1) * 7);
|
|
5970
|
+
const targetDate = new Date(baseWeekStart);
|
|
5971
|
+
targetDate.setDate(baseWeekStart.getDate() + jsWeekdayIndex);
|
|
5972
|
+
if (targetDate < today) {
|
|
5973
|
+
year += 1;
|
|
5974
|
+
const jan4Next = new Date(year, 0, 4);
|
|
5975
|
+
const jan4DayNext = jan4Next.getDay();
|
|
5976
|
+
const diffToMondayNext = (jan4DayNext + 6) % 7;
|
|
5977
|
+
const firstWeekMondayNext = new Date(jan4Next);
|
|
5978
|
+
firstWeekMondayNext.setDate(jan4Next.getDate() - diffToMondayNext);
|
|
5979
|
+
const baseWeekStartNext = new Date(firstWeekMondayNext);
|
|
5980
|
+
baseWeekStartNext.setDate(baseWeekStartNext.getDate() + (week - 1) * 7);
|
|
5981
|
+
targetDate.setFullYear(year);
|
|
5982
|
+
targetDate.setMonth(baseWeekStartNext.getMonth());
|
|
5983
|
+
targetDate.setDate(baseWeekStartNext.getDate() + jsWeekdayIndex);
|
|
5984
|
+
}
|
|
5985
|
+
this.model = targetDate.toISOString().substring(0, 10);
|
|
5986
|
+
this.modelChange.emit(this.model);
|
|
5987
|
+
}
|
|
5906
5988
|
}
|
|
5907
5989
|
InputTextComponent.decorators = [
|
|
5908
5990
|
{ type: Component, args: [{
|
|
@@ -5925,7 +6007,7 @@ InputTextComponent.decorators = [
|
|
|
5925
6007
|
<input [class.show]="focused || !formatPipe" #input
|
|
5926
6008
|
[class.input-input-hidden]="useContent"
|
|
5927
6009
|
[ngClass]="align"
|
|
5928
|
-
[type]="(isFocusedOnDate || (hasValue && emptyPlace)) ? 'date' : (digitsOnly ? 'number' : (type === 'date' ? 'text' : type))"
|
|
6010
|
+
[type]="isWeekInputMode ? 'text' : (isFocusedOnDate || (hasValue && emptyPlace)) ? 'date' : (digitsOnly ? 'number' : (type === 'date' ? 'text' : type))"
|
|
5929
6011
|
[placeholder]="type === 'date' && !isFocusedOnDate ? '' : ''"
|
|
5930
6012
|
[pattern]="type === 'date' ? pattern : undefined"
|
|
5931
6013
|
[ngModel]="model"
|
|
@@ -5934,7 +6016,7 @@ InputTextComponent.decorators = [
|
|
|
5934
6016
|
[readonly]="readonly"
|
|
5935
6017
|
[required]="required"
|
|
5936
6018
|
(ngModelChange)="modelChange.emit($event)"
|
|
5937
|
-
(keydown)="
|
|
6019
|
+
(keydown)="handleKeyDownInput($event)"
|
|
5938
6020
|
(keyup)="keyUp.emit($event)"
|
|
5939
6021
|
(focusin)="handleInputFocus($event)"
|
|
5940
6022
|
(focusout)="handleBlur($event)"
|
|
@@ -6006,6 +6088,7 @@ InputTextComponent.propDecorators = {
|
|
|
6006
6088
|
rightIconData: [{ type: Input }],
|
|
6007
6089
|
selectOnFocus: [{ type: Input }],
|
|
6008
6090
|
emptyPlace: [{ type: Input }],
|
|
6091
|
+
firstDayOfWeek: [{ type: Input }],
|
|
6009
6092
|
noStyle: [{ type: HostBinding, args: ['class.no-style',] }, { type: Input }],
|
|
6010
6093
|
hideArrowButtons: [{ type: Input }, { type: HostBinding, args: ['class.hide-arrows',] }],
|
|
6011
6094
|
isDate: [{ type: HostBinding, args: ["class.isDate",] }],
|
|
@@ -7101,6 +7184,7 @@ class InputDateRangePickerComponent extends BaseInputDatePickerDirective {
|
|
|
7101
7184
|
super(...arguments);
|
|
7102
7185
|
this.EARLIEST_DATE = new Date(1900, 0, 1); // 1900-01-01
|
|
7103
7186
|
this.LATEST_DATE = new Date(2100, 11, 31); // 2100-12-31
|
|
7187
|
+
this.firstDayOfWeek = '';
|
|
7104
7188
|
}
|
|
7105
7189
|
showClass() {
|
|
7106
7190
|
return true;
|
|
@@ -7238,6 +7322,7 @@ InputDateRangePickerComponent.decorators = [
|
|
|
7238
7322
|
[pattern]="'yyyy-MM-dd'"
|
|
7239
7323
|
[type]="'date'"
|
|
7240
7324
|
[rightIcon]="rightIcon"
|
|
7325
|
+
[firstDayOfWeek]="firstDayOfWeek"
|
|
7241
7326
|
(rightIconClick)="toggleCalendar()"
|
|
7242
7327
|
(modelChange)="handleSecondDateChanged(secondDateAsString)"
|
|
7243
7328
|
(clearIconClick)="clearDate(1)"
|
|
@@ -7261,6 +7346,7 @@ InputDateRangePickerComponent.decorators = [
|
|
|
7261
7346
|
},] }
|
|
7262
7347
|
];
|
|
7263
7348
|
InputDateRangePickerComponent.propDecorators = {
|
|
7349
|
+
firstDayOfWeek: [{ type: Input }],
|
|
7264
7350
|
firstInput: [{ type: ViewChild, args: ['firstInput',] }],
|
|
7265
7351
|
secondInput: [{ type: ViewChild, args: ['secondInput',] }],
|
|
7266
7352
|
showClass: [{ type: HostBinding, args: ['class.co-input-date-range',] }]
|
|
@@ -10232,6 +10318,14 @@ SimpleGridComponent.decorators = [
|
|
|
10232
10318
|
(click)="cancelEditRow(); $event.stopPropagation() "></co-button>
|
|
10233
10319
|
</div>
|
|
10234
10320
|
</ng-container>
|
|
10321
|
+
<ng-container *ngIf="!(inlineEdit && showRowButtons)">
|
|
10322
|
+
<div class="icons-container">
|
|
10323
|
+
<co-icon class="icon-item icon-delete"
|
|
10324
|
+
[iconData]="icons.getIcon(Icons.TrashBin)" *ngIf="hoveredRowIndex === rowIndex"
|
|
10325
|
+
(click)="selectTheRow(rowIndex); removeRow();">
|
|
10326
|
+
</co-icon>
|
|
10327
|
+
</div>
|
|
10328
|
+
</ng-container>
|
|
10235
10329
|
</ng-container>
|
|
10236
10330
|
</tr>
|
|
10237
10331
|
</co-form>
|
|
@@ -12992,12 +13086,12 @@ FilterItemComponent.decorators = [
|
|
|
12992
13086
|
<div class="co-filter-item-dateField-content" *ngIf="mode === modes.DateField">
|
|
12993
13087
|
<co-input-date
|
|
12994
13088
|
#dateInput
|
|
12995
|
-
[(model)]="dateFieldValue" [readonly]="readonly"
|
|
13089
|
+
[(model)]="dateFieldValue" [readonly]="readonly" [firstDayOfWeek]="firstDayOfWeek"
|
|
12996
13090
|
(modelChange)="handleModelChange($event)"
|
|
12997
13091
|
></co-input-date>
|
|
12998
13092
|
</div>
|
|
12999
13093
|
<div class="co-filter-item-dateField-content" *ngIf="mode === modes.DateRangeField">
|
|
13000
|
-
<co-input-date-range [readonly]="readonly"
|
|
13094
|
+
<co-input-date-range [readonly]="readonly" [firstDayOfWeek]="firstDayOfWeek"
|
|
13001
13095
|
#dateRangeInput
|
|
13002
13096
|
[model]="[dateRangeStart, dateRangeEnd]"
|
|
13003
13097
|
(modelChange)="handleModelChange($event)"
|
|
@@ -13041,6 +13135,7 @@ FilterItemComponent.propDecorators = {
|
|
|
13041
13135
|
sliderDefaultMax: [{ type: Input }],
|
|
13042
13136
|
fullRangeIsNull: [{ type: Input }],
|
|
13043
13137
|
canFilterByCode: [{ type: Input }],
|
|
13138
|
+
firstDayOfWeek: [{ type: Input }],
|
|
13044
13139
|
model: [{ type: Input }],
|
|
13045
13140
|
modelChange: [{ type: Output }],
|
|
13046
13141
|
collectionChange: [{ type: Output }],
|