@ptsecurity/mosaic 15.2.0 → 15.3.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.
Files changed (115) hide show
  1. package/_theming.scss +7 -6
  2. package/checkbox/_checkbox-theme.scss +4 -2
  3. package/core/datetime/date-adapter.d.ts +2 -2
  4. package/core/formatters/number/formatter.d.ts +5 -5
  5. package/core/forms/_forms.scss +1 -1
  6. package/core/locales/en-US.d.ts +11 -0
  7. package/core/locales/es-LA.d.ts +7 -0
  8. package/core/locales/fa-IR.d.ts +7 -0
  9. package/core/locales/index.d.ts +4 -0
  10. package/core/locales/locale-service.d.ts +63 -0
  11. package/core/locales/locale-service.module.d.ts +6 -0
  12. package/core/locales/pt-BR.d.ts +7 -0
  13. package/core/locales/ru-RU.d.ts +11 -0
  14. package/core/locales/zh-CN.d.ts +7 -0
  15. package/core/option/option.d.ts +2 -1
  16. package/core/public-api.d.ts +2 -0
  17. package/core/styles/theming/_components-theming.scss +0 -1
  18. package/core/title/index.d.ts +1 -0
  19. package/core/title/title-text-ref.d.ts +6 -0
  20. package/datepicker/calendar.component.d.ts +3 -2
  21. package/datepicker/datepicker-input.directive.d.ts +9 -4
  22. package/dropdown/dropdown-item.component.d.ts +3 -2
  23. package/esm2020/core/datetime/date-adapter.mjs +1 -1
  24. package/esm2020/core/formatters/number/formatter.mjs +17 -9
  25. package/esm2020/core/locales/en-US.mjs +10 -0
  26. package/esm2020/core/locales/es-LA.mjs +6 -0
  27. package/esm2020/core/locales/fa-IR.mjs +6 -0
  28. package/esm2020/core/locales/index.mjs +5 -0
  29. package/esm2020/core/locales/locale-service.mjs +70 -0
  30. package/esm2020/core/locales/locale-service.module.mjs +19 -0
  31. package/esm2020/core/locales/pt-BR.mjs +6 -0
  32. package/esm2020/core/locales/ru-RU.mjs +10 -0
  33. package/esm2020/core/locales/zh-CN.mjs +6 -0
  34. package/esm2020/core/option/option.mjs +9 -4
  35. package/esm2020/core/public-api.mjs +3 -1
  36. package/esm2020/core/title/index.mjs +2 -0
  37. package/esm2020/core/title/title-text-ref.mjs +3 -0
  38. package/esm2020/core/version.mjs +2 -2
  39. package/esm2020/datepicker/calendar.component.mjs +7 -4
  40. package/esm2020/datepicker/datepicker-input.directive.mjs +36 -13
  41. package/esm2020/dropdown/dropdown-item.component.mjs +13 -6
  42. package/esm2020/form-field/form-field.mjs +2 -2
  43. package/esm2020/list/list-selection.component.mjs +13 -8
  44. package/esm2020/list/list.component.mjs +2 -2
  45. package/esm2020/popover/popover.module.mjs +10 -4
  46. package/esm2020/select/select.component.mjs +56 -33
  47. package/esm2020/sidepanel/sidepanel-directives.mjs +5 -4
  48. package/esm2020/sidepanel/sidepanel.module.mjs +5 -1
  49. package/esm2020/tags/tag.component.mjs +9 -6
  50. package/esm2020/title/index.mjs +2 -0
  51. package/esm2020/title/ptsecurity-mosaic-title.mjs +5 -0
  52. package/esm2020/title/public-api.mjs +3 -0
  53. package/esm2020/title/title.directive.mjs +107 -0
  54. package/esm2020/title/title.module.mjs +21 -0
  55. package/esm2020/tree/tree-option.component.mjs +10 -5
  56. package/fesm2015/ptsecurity-mosaic-core.mjs +143 -14
  57. package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
  58. package/fesm2015/ptsecurity-mosaic-datepicker.mjs +42 -15
  59. package/fesm2015/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  60. package/fesm2015/ptsecurity-mosaic-dropdown.mjs +12 -5
  61. package/fesm2015/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  62. package/fesm2015/ptsecurity-mosaic-form-field.mjs +2 -2
  63. package/fesm2015/ptsecurity-mosaic-form-field.mjs.map +1 -1
  64. package/fesm2015/ptsecurity-mosaic-list.mjs +14 -9
  65. package/fesm2015/ptsecurity-mosaic-list.mjs.map +1 -1
  66. package/fesm2015/ptsecurity-mosaic-popover.mjs +9 -3
  67. package/fesm2015/ptsecurity-mosaic-popover.mjs.map +1 -1
  68. package/fesm2015/ptsecurity-mosaic-select.mjs +66 -41
  69. package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
  70. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs +8 -3
  71. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  72. package/fesm2015/ptsecurity-mosaic-tags.mjs +8 -5
  73. package/fesm2015/ptsecurity-mosaic-tags.mjs.map +1 -1
  74. package/fesm2015/ptsecurity-mosaic-title.mjs +131 -0
  75. package/fesm2015/ptsecurity-mosaic-title.mjs.map +1 -0
  76. package/fesm2015/ptsecurity-mosaic-tree.mjs +9 -4
  77. package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
  78. package/fesm2020/ptsecurity-mosaic-core.mjs +149 -14
  79. package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
  80. package/fesm2020/ptsecurity-mosaic-datepicker.mjs +41 -15
  81. package/fesm2020/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  82. package/fesm2020/ptsecurity-mosaic-dropdown.mjs +12 -5
  83. package/fesm2020/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  84. package/fesm2020/ptsecurity-mosaic-form-field.mjs +2 -2
  85. package/fesm2020/ptsecurity-mosaic-form-field.mjs.map +1 -1
  86. package/fesm2020/ptsecurity-mosaic-list.mjs +14 -9
  87. package/fesm2020/ptsecurity-mosaic-list.mjs.map +1 -1
  88. package/fesm2020/ptsecurity-mosaic-popover.mjs +9 -3
  89. package/fesm2020/ptsecurity-mosaic-popover.mjs.map +1 -1
  90. package/fesm2020/ptsecurity-mosaic-select.mjs +64 -41
  91. package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
  92. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs +8 -3
  93. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  94. package/fesm2020/ptsecurity-mosaic-tags.mjs +8 -5
  95. package/fesm2020/ptsecurity-mosaic-tags.mjs.map +1 -1
  96. package/fesm2020/ptsecurity-mosaic-title.mjs +128 -0
  97. package/fesm2020/ptsecurity-mosaic-title.mjs.map +1 -0
  98. package/fesm2020/ptsecurity-mosaic-tree.mjs +9 -4
  99. package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
  100. package/form-field/_form-field-theme.scss +1 -0
  101. package/input/_input-theme.scss +2 -1
  102. package/list/_list-base.scss +4 -0
  103. package/list/list-selection.component.d.ts +3 -2
  104. package/package.json +10 -2
  105. package/prebuilt-themes/dark-theme.css +1 -1
  106. package/prebuilt-themes/default-theme.css +1 -1
  107. package/select/select.component.d.ts +10 -5
  108. package/sidepanel/_sidepanel-theme.scss +4 -4
  109. package/sidepanel/sidepanel.module.d.ts +3 -2
  110. package/tags/tag.component.d.ts +3 -2
  111. package/title/index.d.ts +1 -0
  112. package/title/public-api.d.ts +2 -0
  113. package/title/title.directive.d.ts +31 -0
  114. package/title/title.module.d.ts +11 -0
  115. package/tree/tree-option.component.d.ts +3 -2
@@ -13,7 +13,7 @@ import { McIconModule } from '@ptsecurity/mosaic/icon';
13
13
  import * as i5 from '@ptsecurity/mosaic/select';
14
14
  import { McSelectModule } from '@ptsecurity/mosaic/select';
15
15
  import * as i1$1 from '@ptsecurity/mosaic/core';
16
- import { MC_DATE_FORMATS, validationTooltipShowDelay, validationTooltipHideDelay } from '@ptsecurity/mosaic/core';
16
+ import { MC_DATE_FORMATS, validationTooltipShowDelay, validationTooltipHideDelay, MC_LOCALE_SERVICE } from '@ptsecurity/mosaic/core';
17
17
  import * as i4 from '@ptsecurity/mosaic/form-field';
18
18
  import { McFormFieldControl } from '@ptsecurity/mosaic/form-field';
19
19
  import { Subject, Subscription, merge, of } from 'rxjs';
@@ -499,17 +499,17 @@ class McCalendar {
499
499
  }
500
500
  /**
501
501
  * The current active date. This determines which time period is shown and which date is
502
- * highlighted when using keyboard navigation.
502
+ * highlighted and used as the anchor on when using keyboard navigation.
503
503
  */
504
504
  get activeDate() {
505
505
  return this._activeDate;
506
506
  }
507
507
  set activeDate(value) {
508
- this._activeDate = this.adapter.clampDate(value, this.minDate, this.maxDate);
508
+ this._activeDate = this.adapter.clampDate(value || this.getActiveDateDefault(), this.minDate, this.maxDate);
509
509
  this.stateChanges.next();
510
510
  }
511
511
  ngAfterContentInit() {
512
- this.activeDate = this.startAt || this.adapter.today();
512
+ this.activeDate = this.getActiveDateDefault();
513
513
  }
514
514
  ngOnDestroy() {
515
515
  this.intlChanges.unsubscribe();
@@ -548,6 +548,9 @@ class McCalendar {
548
548
  getValidDateOrNull(obj) {
549
549
  return (this.adapter.isDateInstance(obj) && this.adapter.isValid(obj)) ? obj : null;
550
550
  }
551
+ getActiveDateDefault() {
552
+ return this.startAt || this.adapter.today();
553
+ }
551
554
  }
552
555
  /** @nocollapse */ McCalendar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: McCalendar, deps: [{ token: McDatepickerIntl }, { token: i1$1.DateAdapter, optional: true }, { token: MC_DATE_FORMATS, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
553
556
  /** @nocollapse */ McCalendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.2", type: McCalendar, selector: "mc-calendar", inputs: { startAt: "startAt", selected: "selected", minDate: "minDate", maxDate: "maxDate", dateFilter: "dateFilter", dateClass: "dateClass" }, outputs: { selectedChange: "selectedChange", yearSelected: "yearSelected", monthSelected: "monthSelected", userSelection: "userSelection" }, host: { classAttribute: "mc-calendar" }, viewQueries: [{ propertyName: "monthView", first: true, predicate: McMonthView, descendants: true }], exportAs: ["mcCalendar"], usesOnChanges: true, ngImport: i0, template: "<mc-calendar-header\n [(activeDate)]=\"activeDate\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (monthSelected)=\"monthSelected.emit(activeDate)\"\n (yearSelected)=\"yearSelected.emit(activeDate)\">\n</mc-calendar-header>\n\n<div class=\"mc-calendar__content\">\n <mc-month-view\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass\"\n (selectedChange)=\"dateSelected($event!)\"\n (userSelection)=\"userSelected()\">\n </mc-month-view>\n</div>\n", styles: [".mc-calendar{display:block}.mc-calendar__content{padding:0 var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px);outline:none}.mc-calendar__table{border-spacing:0;border-collapse:collapse;width:100%}.mc-calendar__table-header th{text-align:center;height:30px}.mc-calendar__table-header th.mc-calendar__table-header-divider{position:relative;height:calc(var(--mc-datepicker-calendar-size-padding-blocks, 12px) - 2px)}.mc-calendar__table-header th.mc-calendar__table-header-divider:after{content:\"\";position:absolute;top:0;left:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));right:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));height:var(--mc-datepicker-calendar-size-divider-width, 1px)}\n"], dependencies: [{ kind: "component", type: McMonthView, selector: "mc-month-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass"], outputs: ["selectedChange", "userSelection", "activeDateChange"], exportAs: ["mcMonthView"] }, { kind: "component", type: McCalendarHeader, selector: "mc-calendar-header", inputs: ["activeDate", "maxDate", "minDate"], outputs: ["activeDateChange", "monthSelected", "yearSelected"], exportAs: ["mcCalendarHeader"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
@@ -1105,11 +1108,12 @@ class McDatepickerInputEvent {
1105
1108
  let uniqueComponentIdSuffix = 0;
1106
1109
  /** Directive used to connect an input to a McDatepicker. */
1107
1110
  class McDatepickerInput {
1108
- constructor(elementRef, renderer, adapter, dateFormats) {
1111
+ constructor(elementRef, renderer, adapter, dateFormats, localeService) {
1109
1112
  this.elementRef = elementRef;
1110
1113
  this.renderer = renderer;
1111
1114
  this.adapter = adapter;
1112
1115
  this.dateFormats = dateFormats;
1116
+ this.localeService = localeService;
1113
1117
  this.stateChanges = new Subject();
1114
1118
  this.controlType = 'datepicker';
1115
1119
  this.focused = false;
@@ -1117,6 +1121,7 @@ class McDatepickerInput {
1117
1121
  this.valueChange = new EventEmitter();
1118
1122
  /** Emits when the disabled state has changed */
1119
1123
  this.disabledChange = new EventEmitter();
1124
+ this._placeholder = '';
1120
1125
  this._disabled = false;
1121
1126
  this.incorrectInput = new EventEmitter();
1122
1127
  /** Emits when a `change` event is fired on this `<input>`. */
@@ -1131,6 +1136,7 @@ class McDatepickerInput {
1131
1136
  this.firstDigit = null;
1132
1137
  this.secondDigit = null;
1133
1138
  this.thirdDigit = null;
1139
+ this.usePlaceholderFromInput = false;
1134
1140
  // tslint:disable-next-line:no-empty
1135
1141
  this.onTouched = () => { };
1136
1142
  this.onInput = () => {
@@ -1140,15 +1146,15 @@ class McDatepickerInput {
1140
1146
  this.lastValueValid = !!newTimeObj;
1141
1147
  if (!newTimeObj) {
1142
1148
  if (!this.viewValue) {
1143
- this._value = null;
1144
- this.cvaOnChange(null);
1149
+ this.lastValueValid = false;
1150
+ this.updateValue(newTimeObj);
1145
1151
  }
1146
1152
  else {
1147
1153
  this.control.updateValueAndValidity();
1148
1154
  }
1149
1155
  return;
1150
1156
  }
1151
- this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput), true);
1157
+ this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateInputFormat), true);
1152
1158
  this.selectNextDigitByCursor(this.selectionStart);
1153
1159
  this.updateValue(newTimeObj);
1154
1160
  };
@@ -1191,11 +1197,14 @@ class McDatepickerInput {
1191
1197
  return setTimeout(() => this.control.updateValueAndValidity());
1192
1198
  }
1193
1199
  this.lastValueValid = !!newTimeObj;
1194
- this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput), true);
1200
+ this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateInputFormat), true);
1195
1201
  this.updateValue(newTimeObj);
1196
1202
  };
1197
1203
  this.updateLocaleParams = () => {
1198
- this.setFormat(this.dateFormats.dateInput);
1204
+ this.setFormat(this.dateInputFormat);
1205
+ if (!this.usePlaceholderFromInput) {
1206
+ this._placeholder = this.localeService.getParams('datepicker').placeholder;
1207
+ }
1199
1208
  this.value = this.value;
1200
1209
  };
1201
1210
  // tslint:disable-next-line:no-empty
@@ -1240,10 +1249,17 @@ class McDatepickerInput {
1240
1249
  if (!this.dateFormats) {
1241
1250
  throw createMissingDateImplError('MC_DATE_FORMATS');
1242
1251
  }
1243
- this.setFormat(dateFormats.dateInput);
1252
+ this.setFormat(this.dateInputFormat);
1244
1253
  this.localeSubscription = adapter.localeChanges
1245
1254
  .subscribe(this.updateLocaleParams);
1246
1255
  }
1256
+ get placeholder() {
1257
+ return this._placeholder;
1258
+ }
1259
+ set placeholder(value) {
1260
+ this._placeholder = value;
1261
+ this.usePlaceholderFromInput = true;
1262
+ }
1247
1263
  get required() {
1248
1264
  return this._required;
1249
1265
  }
@@ -1355,6 +1371,9 @@ class McDatepickerInput {
1355
1371
  get isReadOnly() {
1356
1372
  return this.elementRef.nativeElement.readOnly;
1357
1373
  }
1374
+ get dateInputFormat() {
1375
+ return this.localeService?.getParams('datepicker').dateInput || this.dateFormats.dateInput;
1376
+ }
1358
1377
  get readyForParse() {
1359
1378
  return !!(this.firstDigit && this.secondDigit && this.thirdDigit);
1360
1379
  }
@@ -1465,7 +1484,9 @@ class McDatepickerInput {
1465
1484
  }
1466
1485
  }
1467
1486
  onChange() {
1468
- this.dateChange.emit(new McDatepickerInputEvent(this, this.elementRef.nativeElement));
1487
+ setTimeout(() => {
1488
+ this.dateChange.emit(new McDatepickerInputEvent(this, this.elementRef.nativeElement));
1489
+ });
1469
1490
  }
1470
1491
  /** Handles blur events on the input. */
1471
1492
  onBlur() {
@@ -1495,7 +1516,7 @@ class McDatepickerInput {
1495
1516
  this.setViewValue(value);
1496
1517
  return value;
1497
1518
  }
1498
- this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput));
1519
+ this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateInputFormat));
1499
1520
  this.updateValue(newTimeObj);
1500
1521
  }
1501
1522
  toISO8601(value) {
@@ -1783,7 +1804,7 @@ class McDatepickerInput {
1783
1804
  }
1784
1805
  /** Formats a value and sets it on the input element. */
1785
1806
  formatValue(value) {
1786
- const formattedValue = value ? this.adapter.format(value, this.dateFormats.dateInput) : '';
1807
+ const formattedValue = value ? this.adapter.format(value, this.dateInputFormat) : '';
1787
1808
  this.setViewValue(formattedValue);
1788
1809
  }
1789
1810
  setControl(control) {
@@ -1845,7 +1866,7 @@ class McDatepickerInput {
1845
1866
  }
1846
1867
  }
1847
1868
  }
1848
- /** @nocollapse */ McDatepickerInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: McDatepickerInput, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1$1.DateAdapter, optional: true }, { token: MC_DATE_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
1869
+ /** @nocollapse */ McDatepickerInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: McDatepickerInput, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1$1.DateAdapter, optional: true }, { token: MC_DATE_FORMATS, optional: true }, { token: MC_LOCALE_SERVICE, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
1849
1870
  /** @nocollapse */ McDatepickerInput.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.2", type: McDatepickerInput, selector: "input[mcDatepicker]", inputs: { placeholder: "placeholder", required: "required", mcDatepicker: "mcDatepicker", mcDatepickerFilter: "mcDatepickerFilter", value: "value", min: "min", max: "max", disabled: "disabled", id: "id", mcValidationTooltip: "mcValidationTooltip" }, outputs: { incorrectInput: "incorrectInput", dateChange: "dateChange", dateInput: "dateInput" }, host: { listeners: { "paste": "onPaste($event)", "change": "onChange()", "focus": "focusChanged(true)", "blur": "onBlur()", "keydown": "onKeyDown($event)" }, properties: { "attr.placeholder": "placeholder", "attr.required": "required", "attr.disabled": "disabled || null", "attr.min": "min ? toISO8601(min) : null", "attr.max": "max ? toISO8601(max) : null", "attr.autocomplete": "\"off\"" }, classAttribute: "mc-input mc-datepicker" }, providers: [
1850
1871
  MC_DATEPICKER_VALUE_ACCESSOR,
1851
1872
  MC_DATEPICKER_VALIDATORS,
@@ -1883,6 +1904,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
1883
1904
  }, {
1884
1905
  type: Inject,
1885
1906
  args: [MC_DATE_FORMATS]
1907
+ }] }, { type: i1$1.McLocaleService, decorators: [{
1908
+ type: Optional
1909
+ }, {
1910
+ type: Inject,
1911
+ args: [MC_LOCALE_SERVICE]
1886
1912
  }] }]; }, propDecorators: { placeholder: [{
1887
1913
  type: Input
1888
1914
  }], required: [{