@colijnit/corecomponents_v12 256.1.17 → 256.1.19

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.
Files changed (23) hide show
  1. package/bundles/colijnit-corecomponents_v12.umd.js +102 -34
  2. package/bundles/colijnit-corecomponents_v12.umd.js.map +1 -1
  3. package/colijnit-corecomponents_v12.metadata.json +1 -1
  4. package/esm2015/lib/components/base/base-input.component.js +8 -1
  5. package/esm2015/lib/components/button/button.component.js +1 -1
  6. package/esm2015/lib/components/filter-item/filter-item.component.js +6 -3
  7. package/esm2015/lib/components/input-date-picker/input-date-picker.component.js +20 -2
  8. package/esm2015/lib/components/input-date-range-picker/input-date-range-picker.component.js +65 -30
  9. package/esm2015/lib/components/list-of-values/list-of-values.module.js +1 -2
  10. package/esm2015/lib/directives/screen-configuration/screen-configuration.directive.js +2 -1
  11. package/esm2015/lib/interfaces/screen-config-adapter.component.interface.js +1 -1
  12. package/esm2015/lib/service/base-module-screen-config.service.js +2 -2
  13. package/fesm2015/colijnit-corecomponents_v12.js +97 -34
  14. package/fesm2015/colijnit-corecomponents_v12.js.map +1 -1
  15. package/lib/components/base/base-input.component.d.ts +4 -0
  16. package/lib/components/button/button.component.d.ts +2 -0
  17. package/lib/components/calendar/style/_layout.scss +14 -14
  18. package/lib/components/calendar/style/_material-definition.scss +3 -3
  19. package/lib/components/filter-item/filter-item.component.d.ts +3 -0
  20. package/lib/components/input-date-picker/input-date-picker.component.d.ts +2 -0
  21. package/lib/components/input-date-range-picker/input-date-range-picker.component.d.ts +5 -0
  22. package/lib/interfaces/screen-config-adapter.component.interface.d.ts +2 -0
  23. package/package.json +1 -1
@@ -1955,6 +1955,12 @@ class BaseInputComponent {
1955
1955
  get maxLength() {
1956
1956
  return notNill(this.forcedMaxLength) ? this.forcedMaxLength : this._maxLength;
1957
1957
  }
1958
+ set defaultValue(defaultValue) {
1959
+ this._defaultValue = defaultValue;
1960
+ }
1961
+ get defaultValue() {
1962
+ return this._defaultValue;
1963
+ }
1958
1964
  set readonly(readonly) {
1959
1965
  if (this._forceReadonly !== undefined || readonly === this._readonly) {
1960
1966
  return;
@@ -2600,6 +2606,7 @@ BaseInputComponent.propDecorators = {
2600
2606
  businessObjectId: [{ type: Input }],
2601
2607
  disabled: [{ type: Input }],
2602
2608
  maxLength: [{ type: Input }],
2609
+ defaultValue: [{ type: Input }],
2603
2610
  forcedMaxLength: [{ type: Input }],
2604
2611
  readonly: [{ type: Input }],
2605
2612
  forceReadonly: [{ type: Input }],
@@ -5439,6 +5446,23 @@ class InputDatePickerComponent extends BaseInputDatePickerDirective {
5439
5446
  this.overlayService.removeComponent(this._calendarComponentRef);
5440
5447
  }
5441
5448
  }
5449
+ finalizeDate() {
5450
+ if (this.isValidDateString(this.modelAsString)) {
5451
+ const [year, month, day] = this.modelAsString.split('-').map(Number);
5452
+ const date = new Date(year, month - 1, day);
5453
+ this.setModel(date);
5454
+ }
5455
+ }
5456
+ isValidDateString(value) {
5457
+ const regex = /^\d{4}-\d{2}-\d{2}$/;
5458
+ if (!regex.test(value))
5459
+ return false;
5460
+ const [year, month, day] = value.split('-').map(Number);
5461
+ const date = new Date(year, month - 1, day);
5462
+ return (date.getFullYear() === year &&
5463
+ date.getMonth() === month - 1 &&
5464
+ date.getDate() === day);
5465
+ }
5442
5466
  handleDateChange(value) {
5443
5467
  if (value) {
5444
5468
  this.setModel(new Date(value));
@@ -5478,9 +5502,10 @@ InputDatePickerComponent.decorators = [
5478
5502
  [placeholder]="placeholder"
5479
5503
  (leftIconClick)="leftIconClick.emit($event)"
5480
5504
  (rightIconClick)="toggleCalendar(true)"
5481
- (blur)="handleDateChange(modelAsString)"
5505
+ (modelChange)="modelAsString = $event"
5482
5506
  (clearIconClick)="handleClearIconClicked()"
5483
5507
  [emptyPlace]="true"
5508
+ (keyup.enter)="finalizeDate()"
5484
5509
  ></co-input-text>
5485
5510
  `,
5486
5511
  providers: [
@@ -6907,6 +6932,11 @@ DoubleCalendarModule.decorators = [
6907
6932
  ];
6908
6933
 
6909
6934
  class InputDateRangePickerComponent extends BaseInputDatePickerDirective {
6935
+ constructor() {
6936
+ super(...arguments);
6937
+ this.EARLIEST_DATE = new Date(1900, 0, 1); // 1900-01-01
6938
+ this.LATEST_DATE = new Date(2100, 11, 31); // 2100-12-31
6939
+ }
6910
6940
  showClass() {
6911
6941
  return true;
6912
6942
  }
@@ -6947,43 +6977,71 @@ class InputDateRangePickerComponent extends BaseInputDatePickerDirective {
6947
6977
  }
6948
6978
  }
6949
6979
  handleFirstDateChanged(value) {
6950
- if (value) {
6951
- if (!this.model) {
6952
- this.setModel([]);
6980
+ setTimeout(() => {
6981
+ var _a, _b;
6982
+ if (this.isValidDateString(value)) {
6983
+ const [year, month, day] = value.split('-').map(Number);
6984
+ const date = new Date(year, month - 1, day);
6985
+ if (!this.model)
6986
+ this.setModel([]);
6987
+ this.setModel([date, (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : null]);
6953
6988
  }
6954
- this.setModel([new Date(value), this.model[1] ? this.model[1] : null]);
6955
- }
6989
+ });
6956
6990
  }
6957
6991
  handleSecondDateChanged(value) {
6958
- if (value) {
6959
- if (!this.model) {
6960
- this.setModel([]);
6992
+ setTimeout(() => {
6993
+ var _a, _b;
6994
+ if (this.isValidDateString(value)) {
6995
+ const [year, month, day] = value.split('-').map(Number);
6996
+ const date = new Date(year, month - 1, day);
6997
+ if (!this.model)
6998
+ this.setModel([]);
6999
+ this.setModel([(_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null, date]);
6961
7000
  }
6962
- this.setModel([this.model[0] ? this.model[0] : null, new Date(value)]);
7001
+ });
7002
+ }
7003
+ finalizeDates() {
7004
+ let startDate = this.EARLIEST_DATE;
7005
+ let endDate = this.LATEST_DATE;
7006
+ if (this.isValidDateString(this.firstDateAsString)) {
7007
+ const [y, m, d] = this.firstDateAsString.split('-').map(Number);
7008
+ startDate = new Date(y, m - 1, d);
7009
+ }
7010
+ if (this.isValidDateString(this.secondDateAsString)) {
7011
+ const [y, m, d] = this.secondDateAsString.split('-').map(Number);
7012
+ endDate = new Date(y, m - 1, d);
6963
7013
  }
7014
+ this.setModel([startDate, endDate]);
7015
+ }
7016
+ isValidDateString(value) {
7017
+ const regex = /^\d{4}-\d{2}-\d{2}$/;
7018
+ if (!regex.test(value))
7019
+ return false;
7020
+ const [yearStr, monthStr, dayStr] = value.split('-');
7021
+ const [year, month, day] = [Number(yearStr), Number(monthStr), Number(dayStr)];
7022
+ // Prevent ancient years or too-far future
7023
+ if (year < 1900 || year > 2100)
7024
+ return false;
7025
+ const date = new Date(year, month - 1, day);
7026
+ return (date.getFullYear() === year &&
7027
+ date.getMonth() === month - 1 &&
7028
+ date.getDate() === day);
6964
7029
  }
6965
7030
  modelSet() {
6966
7031
  this.setModelAsString();
6967
7032
  }
6968
7033
  setModelAsString() {
6969
- if (this.model[0]) {
6970
- const year = this.model[0].toLocaleString("default", { year: "numeric" });
6971
- const month = this.model[0].toLocaleString("default", { month: "2-digit" });
6972
- const day = this.model[0].toLocaleString("default", { day: "2-digit" });
6973
- this.firstDateAsString = `${year}-${month}-${day}`;
6974
- }
6975
- else {
6976
- this.firstDateAsString = ``;
6977
- }
6978
- if (this.model[1]) {
6979
- const year = this.model[1].toLocaleString("default", { year: "numeric" });
6980
- const month = this.model[1].toLocaleString("default", { month: "2-digit" });
6981
- const day = this.model[1].toLocaleString("default", { day: "2-digit" });
6982
- this.secondDateAsString = `${year}-${month}-${day}`;
6983
- }
6984
- else {
6985
- this.secondDateAsString = ``;
6986
- }
7034
+ var _a, _b;
7035
+ const isStartDefault = ((_a = this.model[0]) === null || _a === void 0 ? void 0 : _a.getTime()) === this.EARLIEST_DATE.getTime();
7036
+ const isEndDefault = ((_b = this.model[1]) === null || _b === void 0 ? void 0 : _b.getTime()) === this.LATEST_DATE.getTime();
7037
+ this.firstDateAsString = (!this.model[0] || isStartDefault) ? '' : this.formatDate(this.model[0]);
7038
+ this.secondDateAsString = (!this.model[1] || isEndDefault) ? '' : this.formatDate(this.model[1]);
7039
+ }
7040
+ formatDate(date) {
7041
+ const year = date.toLocaleString("default", { year: "numeric" });
7042
+ const month = date.toLocaleString("default", { month: "2-digit" });
7043
+ const day = date.toLocaleString("default", { day: "2-digit" });
7044
+ return `${year}-${month}-${day}`;
6987
7045
  }
6988
7046
  }
6989
7047
  InputDateRangePickerComponent.decorators = [
@@ -6999,10 +7057,11 @@ InputDateRangePickerComponent.decorators = [
6999
7057
  [leftIcon]="leftIcon"
7000
7058
  [leftIconData]="leftIconData"
7001
7059
  [placeholder]="placeholder"
7002
- (blur)="handleFirstDateChanged(firstDateAsString)"
7060
+ (modelChange)="handleFirstDateChanged(firstDateAsString)"
7003
7061
  (clearIconClick)="clearDate(0)"
7004
7062
  (click)="handleFirstInputClick($event)"
7005
7063
  [emptyPlace]="true"
7064
+ (keyup.enter)="finalizeDates()"
7006
7065
  ></co-input-text>
7007
7066
  <co-input-text #secondInput class="no-focus-line custom-height"
7008
7067
  [(model)]= "secondDateAsString"
@@ -7011,10 +7070,11 @@ InputDateRangePickerComponent.decorators = [
7011
7070
  [type]="'date'"
7012
7071
  [rightIcon]="rightIcon"
7013
7072
  (rightIconClick)="toggleCalendar()"
7014
- (blur)="handleSecondDateChanged(secondDateAsString)"
7073
+ (modelChange)="handleSecondDateChanged(secondDateAsString)"
7015
7074
  (clearIconClick)="clearDate(1)"
7016
7075
  (click)="handleSecondInputClick($event)"
7017
7076
  [emptyPlace]="true"
7077
+ (keyup.enter)="finalizeDates()"
7018
7078
  ></co-input-text>
7019
7079
  </div>
7020
7080
  `,
@@ -11435,7 +11495,6 @@ ListOfValuesModule.decorators = [
11435
11495
  OverlayModule,
11436
11496
  ClickoutsideModule,
11437
11497
  IconModule,
11438
- InputTextModule,
11439
11498
  InputSearchModule
11440
11499
  ],
11441
11500
  declarations: [
@@ -11990,6 +12049,9 @@ class FilterItemComponent {
11990
12049
  get configObject() {
11991
12050
  return this._configObject;
11992
12051
  }
12052
+ get hasClass() {
12053
+ return true; // Ensures it never gets removed
12054
+ }
11993
12055
  ngOnInit() {
11994
12056
  this.setToInitialLimit();
11995
12057
  this.showButton = this.valueSelected();
@@ -12559,7 +12621,7 @@ FilterItemComponent.decorators = [
12559
12621
  <co-input-date-range [readonly]="readonly"
12560
12622
  [model]="[dateRangeStart, dateRangeEnd]"
12561
12623
  (modelChange)="handleModelChange($event)"
12562
- [placeholder]="'SELECT_DATE' | coreLocalize">
12624
+ [placeholder]="'Kies datum' | coreLocalize">
12563
12625
  </co-input-date-range>
12564
12626
  </div>
12565
12627
  </ng-template>
@@ -12602,7 +12664,7 @@ FilterItemComponent.propDecorators = {
12602
12664
  modelChange: [{ type: Output }],
12603
12665
  collectionChange: [{ type: Output }],
12604
12666
  filterButtonClicked: [{ type: Output }],
12605
- filteredCollection: [{ type: HostBinding, args: ["class.co-filter-item",] }],
12667
+ hasClass: [{ type: HostBinding, args: ["class.co-filter-item",] }],
12606
12668
  hidden: [{ type: HostBinding, args: ['class.co-hidden',] }]
12607
12669
  };
12608
12670
 
@@ -13444,7 +13506,7 @@ class BaseModuleScreenConfigService {
13444
13506
  }
13445
13507
  getDefaultValue(configName) {
13446
13508
  const objectConfig = this._objectConfigsMap.get(configName);
13447
- return objectConfig ? objectConfig.getDefaultValue() : undefined;
13509
+ return objectConfig ? objectConfig.defaultValue : undefined;
13448
13510
  }
13449
13511
  getDefaultStringValue(configName) {
13450
13512
  const objectConfig = this._objectConfigsMap.get(configName);
@@ -13661,6 +13723,7 @@ class ScreenConfigurationDirective {
13661
13723
  this.hostComponent.readonly = this.hostComponent.forceReadonly || this._moduleInReadonlyMode() || myCfgObj.isReadonly();
13662
13724
  this.hostComponent.decimals = myCfgObj.scale;
13663
13725
  this.hostComponent.maxLength = myCfgObj.maxLength;
13726
+ this.hostComponent.defaultValue = myCfgObj.defaultValue;
13664
13727
  if ('configObject' in this.hostComponent) {
13665
13728
  this.hostComponent.configObject = myCfgObj;
13666
13729
  }