@ptsecurity/mosaic 15.2.1 → 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 (111) hide show
  1. package/_theming.scss +1 -3
  2. package/core/datetime/date-adapter.d.ts +2 -2
  3. package/core/formatters/number/formatter.d.ts +5 -5
  4. package/core/forms/_forms.scss +1 -1
  5. package/core/locales/en-US.d.ts +11 -0
  6. package/core/locales/es-LA.d.ts +7 -0
  7. package/core/locales/fa-IR.d.ts +7 -0
  8. package/core/locales/index.d.ts +4 -0
  9. package/core/locales/locale-service.d.ts +63 -0
  10. package/core/locales/locale-service.module.d.ts +6 -0
  11. package/core/locales/pt-BR.d.ts +7 -0
  12. package/core/locales/ru-RU.d.ts +11 -0
  13. package/core/locales/zh-CN.d.ts +7 -0
  14. package/core/option/option.d.ts +2 -1
  15. package/core/public-api.d.ts +2 -0
  16. package/core/styles/theming/_components-theming.scss +0 -1
  17. package/core/title/index.d.ts +1 -0
  18. package/core/title/title-text-ref.d.ts +6 -0
  19. package/datepicker/datepicker-input.directive.d.ts +9 -4
  20. package/dropdown/dropdown-item.component.d.ts +3 -2
  21. package/esm2020/core/datetime/date-adapter.mjs +1 -1
  22. package/esm2020/core/formatters/number/formatter.mjs +17 -9
  23. package/esm2020/core/locales/en-US.mjs +10 -0
  24. package/esm2020/core/locales/es-LA.mjs +6 -0
  25. package/esm2020/core/locales/fa-IR.mjs +6 -0
  26. package/esm2020/core/locales/index.mjs +5 -0
  27. package/esm2020/core/locales/locale-service.mjs +70 -0
  28. package/esm2020/core/locales/locale-service.module.mjs +19 -0
  29. package/esm2020/core/locales/pt-BR.mjs +6 -0
  30. package/esm2020/core/locales/ru-RU.mjs +10 -0
  31. package/esm2020/core/locales/zh-CN.mjs +6 -0
  32. package/esm2020/core/option/option.mjs +9 -4
  33. package/esm2020/core/public-api.mjs +3 -1
  34. package/esm2020/core/title/index.mjs +2 -0
  35. package/esm2020/core/title/title-text-ref.mjs +3 -0
  36. package/esm2020/core/version.mjs +2 -2
  37. package/esm2020/datepicker/datepicker-input.directive.mjs +31 -10
  38. package/esm2020/dropdown/dropdown-item.component.mjs +13 -6
  39. package/esm2020/form-field/form-field.mjs +2 -2
  40. package/esm2020/list/list-selection.component.mjs +13 -8
  41. package/esm2020/list/list.component.mjs +2 -2
  42. package/esm2020/popover/popover.module.mjs +10 -4
  43. package/esm2020/select/select.component.mjs +56 -33
  44. package/esm2020/sidepanel/sidepanel-directives.mjs +5 -4
  45. package/esm2020/sidepanel/sidepanel.module.mjs +5 -1
  46. package/esm2020/tags/tag.component.mjs +9 -6
  47. package/esm2020/title/index.mjs +2 -0
  48. package/esm2020/title/ptsecurity-mosaic-title.mjs +5 -0
  49. package/esm2020/title/public-api.mjs +3 -0
  50. package/esm2020/title/title.directive.mjs +107 -0
  51. package/esm2020/title/title.module.mjs +21 -0
  52. package/esm2020/tree/tree-option.component.mjs +10 -5
  53. package/fesm2015/ptsecurity-mosaic-core.mjs +143 -14
  54. package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
  55. package/fesm2015/ptsecurity-mosaic-datepicker.mjs +31 -9
  56. package/fesm2015/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  57. package/fesm2015/ptsecurity-mosaic-dropdown.mjs +12 -5
  58. package/fesm2015/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  59. package/fesm2015/ptsecurity-mosaic-form-field.mjs +2 -2
  60. package/fesm2015/ptsecurity-mosaic-form-field.mjs.map +1 -1
  61. package/fesm2015/ptsecurity-mosaic-list.mjs +14 -9
  62. package/fesm2015/ptsecurity-mosaic-list.mjs.map +1 -1
  63. package/fesm2015/ptsecurity-mosaic-popover.mjs +9 -3
  64. package/fesm2015/ptsecurity-mosaic-popover.mjs.map +1 -1
  65. package/fesm2015/ptsecurity-mosaic-select.mjs +66 -41
  66. package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
  67. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs +8 -3
  68. package/fesm2015/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  69. package/fesm2015/ptsecurity-mosaic-tags.mjs +8 -5
  70. package/fesm2015/ptsecurity-mosaic-tags.mjs.map +1 -1
  71. package/fesm2015/ptsecurity-mosaic-title.mjs +131 -0
  72. package/fesm2015/ptsecurity-mosaic-title.mjs.map +1 -0
  73. package/fesm2015/ptsecurity-mosaic-tree.mjs +9 -4
  74. package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
  75. package/fesm2020/ptsecurity-mosaic-core.mjs +149 -14
  76. package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
  77. package/fesm2020/ptsecurity-mosaic-datepicker.mjs +30 -9
  78. package/fesm2020/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  79. package/fesm2020/ptsecurity-mosaic-dropdown.mjs +12 -5
  80. package/fesm2020/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  81. package/fesm2020/ptsecurity-mosaic-form-field.mjs +2 -2
  82. package/fesm2020/ptsecurity-mosaic-form-field.mjs.map +1 -1
  83. package/fesm2020/ptsecurity-mosaic-list.mjs +14 -9
  84. package/fesm2020/ptsecurity-mosaic-list.mjs.map +1 -1
  85. package/fesm2020/ptsecurity-mosaic-popover.mjs +9 -3
  86. package/fesm2020/ptsecurity-mosaic-popover.mjs.map +1 -1
  87. package/fesm2020/ptsecurity-mosaic-select.mjs +64 -41
  88. package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
  89. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs +8 -3
  90. package/fesm2020/ptsecurity-mosaic-sidepanel.mjs.map +1 -1
  91. package/fesm2020/ptsecurity-mosaic-tags.mjs +8 -5
  92. package/fesm2020/ptsecurity-mosaic-tags.mjs.map +1 -1
  93. package/fesm2020/ptsecurity-mosaic-title.mjs +128 -0
  94. package/fesm2020/ptsecurity-mosaic-title.mjs.map +1 -0
  95. package/fesm2020/ptsecurity-mosaic-tree.mjs +9 -4
  96. package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
  97. package/form-field/_form-field-theme.scss +1 -0
  98. package/list/_list-base.scss +4 -0
  99. package/list/list-selection.component.d.ts +3 -2
  100. package/package.json +10 -2
  101. package/prebuilt-themes/dark-theme.css +1 -1
  102. package/prebuilt-themes/default-theme.css +1 -1
  103. package/select/select.component.d.ts +10 -5
  104. package/sidepanel/_sidepanel-theme.scss +4 -4
  105. package/sidepanel/sidepanel.module.d.ts +3 -2
  106. package/tags/tag.component.d.ts +3 -2
  107. package/title/index.d.ts +1 -0
  108. package/title/public-api.d.ts +2 -0
  109. package/title/title.directive.d.ts +31 -0
  110. package/title/title.module.d.ts +11 -0
  111. 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';
@@ -1108,11 +1108,12 @@ class McDatepickerInputEvent {
1108
1108
  let uniqueComponentIdSuffix = 0;
1109
1109
  /** Directive used to connect an input to a McDatepicker. */
1110
1110
  class McDatepickerInput {
1111
- constructor(elementRef, renderer, adapter, dateFormats) {
1111
+ constructor(elementRef, renderer, adapter, dateFormats, localeService) {
1112
1112
  this.elementRef = elementRef;
1113
1113
  this.renderer = renderer;
1114
1114
  this.adapter = adapter;
1115
1115
  this.dateFormats = dateFormats;
1116
+ this.localeService = localeService;
1116
1117
  this.stateChanges = new Subject();
1117
1118
  this.controlType = 'datepicker';
1118
1119
  this.focused = false;
@@ -1120,6 +1121,7 @@ class McDatepickerInput {
1120
1121
  this.valueChange = new EventEmitter();
1121
1122
  /** Emits when the disabled state has changed */
1122
1123
  this.disabledChange = new EventEmitter();
1124
+ this._placeholder = '';
1123
1125
  this._disabled = false;
1124
1126
  this.incorrectInput = new EventEmitter();
1125
1127
  /** Emits when a `change` event is fired on this `<input>`. */
@@ -1134,6 +1136,7 @@ class McDatepickerInput {
1134
1136
  this.firstDigit = null;
1135
1137
  this.secondDigit = null;
1136
1138
  this.thirdDigit = null;
1139
+ this.usePlaceholderFromInput = false;
1137
1140
  // tslint:disable-next-line:no-empty
1138
1141
  this.onTouched = () => { };
1139
1142
  this.onInput = () => {
@@ -1151,7 +1154,7 @@ class McDatepickerInput {
1151
1154
  }
1152
1155
  return;
1153
1156
  }
1154
- this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput), true);
1157
+ this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateInputFormat), true);
1155
1158
  this.selectNextDigitByCursor(this.selectionStart);
1156
1159
  this.updateValue(newTimeObj);
1157
1160
  };
@@ -1194,11 +1197,14 @@ class McDatepickerInput {
1194
1197
  return setTimeout(() => this.control.updateValueAndValidity());
1195
1198
  }
1196
1199
  this.lastValueValid = !!newTimeObj;
1197
- this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput), true);
1200
+ this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateInputFormat), true);
1198
1201
  this.updateValue(newTimeObj);
1199
1202
  };
1200
1203
  this.updateLocaleParams = () => {
1201
- this.setFormat(this.dateFormats.dateInput);
1204
+ this.setFormat(this.dateInputFormat);
1205
+ if (!this.usePlaceholderFromInput) {
1206
+ this._placeholder = this.localeService.getParams('datepicker').placeholder;
1207
+ }
1202
1208
  this.value = this.value;
1203
1209
  };
1204
1210
  // tslint:disable-next-line:no-empty
@@ -1243,10 +1249,17 @@ class McDatepickerInput {
1243
1249
  if (!this.dateFormats) {
1244
1250
  throw createMissingDateImplError('MC_DATE_FORMATS');
1245
1251
  }
1246
- this.setFormat(dateFormats.dateInput);
1252
+ this.setFormat(this.dateInputFormat);
1247
1253
  this.localeSubscription = adapter.localeChanges
1248
1254
  .subscribe(this.updateLocaleParams);
1249
1255
  }
1256
+ get placeholder() {
1257
+ return this._placeholder;
1258
+ }
1259
+ set placeholder(value) {
1260
+ this._placeholder = value;
1261
+ this.usePlaceholderFromInput = true;
1262
+ }
1250
1263
  get required() {
1251
1264
  return this._required;
1252
1265
  }
@@ -1358,6 +1371,9 @@ class McDatepickerInput {
1358
1371
  get isReadOnly() {
1359
1372
  return this.elementRef.nativeElement.readOnly;
1360
1373
  }
1374
+ get dateInputFormat() {
1375
+ return this.localeService?.getParams('datepicker').dateInput || this.dateFormats.dateInput;
1376
+ }
1361
1377
  get readyForParse() {
1362
1378
  return !!(this.firstDigit && this.secondDigit && this.thirdDigit);
1363
1379
  }
@@ -1500,7 +1516,7 @@ class McDatepickerInput {
1500
1516
  this.setViewValue(value);
1501
1517
  return value;
1502
1518
  }
1503
- this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput));
1519
+ this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateInputFormat));
1504
1520
  this.updateValue(newTimeObj);
1505
1521
  }
1506
1522
  toISO8601(value) {
@@ -1788,7 +1804,7 @@ class McDatepickerInput {
1788
1804
  }
1789
1805
  /** Formats a value and sets it on the input element. */
1790
1806
  formatValue(value) {
1791
- const formattedValue = value ? this.adapter.format(value, this.dateFormats.dateInput) : '';
1807
+ const formattedValue = value ? this.adapter.format(value, this.dateInputFormat) : '';
1792
1808
  this.setViewValue(formattedValue);
1793
1809
  }
1794
1810
  setControl(control) {
@@ -1850,7 +1866,7 @@ class McDatepickerInput {
1850
1866
  }
1851
1867
  }
1852
1868
  }
1853
- /** @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 });
1854
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: [
1855
1871
  MC_DATEPICKER_VALUE_ACCESSOR,
1856
1872
  MC_DATEPICKER_VALIDATORS,
@@ -1888,6 +1904,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
1888
1904
  }, {
1889
1905
  type: Inject,
1890
1906
  args: [MC_DATE_FORMATS]
1907
+ }] }, { type: i1$1.McLocaleService, decorators: [{
1908
+ type: Optional
1909
+ }, {
1910
+ type: Inject,
1911
+ args: [MC_LOCALE_SERVICE]
1891
1912
  }] }]; }, propDecorators: { placeholder: [{
1892
1913
  type: Input
1893
1914
  }], required: [{