@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, of, merge } from 'rxjs';
@@ -707,11 +707,12 @@ class McDatepickerInputEvent {
707
707
  let uniqueComponentIdSuffix = 0;
708
708
  /** Directive used to connect an input to a McDatepicker. */
709
709
  class McDatepickerInput {
710
- constructor(elementRef, renderer, adapter, dateFormats) {
710
+ constructor(elementRef, renderer, adapter, dateFormats, localeService) {
711
711
  this.elementRef = elementRef;
712
712
  this.renderer = renderer;
713
713
  this.adapter = adapter;
714
714
  this.dateFormats = dateFormats;
715
+ this.localeService = localeService;
715
716
  this.stateChanges = new Subject();
716
717
  this.controlType = 'datepicker';
717
718
  this.focused = false;
@@ -719,6 +720,7 @@ class McDatepickerInput {
719
720
  this.valueChange = new EventEmitter();
720
721
  /** Emits when the disabled state has changed */
721
722
  this.disabledChange = new EventEmitter();
723
+ this._placeholder = '';
722
724
  this._disabled = false;
723
725
  this.incorrectInput = new EventEmitter();
724
726
  /** Emits when a `change` event is fired on this `<input>`. */
@@ -733,6 +735,7 @@ class McDatepickerInput {
733
735
  this.firstDigit = null;
734
736
  this.secondDigit = null;
735
737
  this.thirdDigit = null;
738
+ this.usePlaceholderFromInput = false;
736
739
  // tslint:disable-next-line:no-empty
737
740
  this.onTouched = () => { };
738
741
  this.onInput = () => {
@@ -750,7 +753,7 @@ class McDatepickerInput {
750
753
  }
751
754
  return;
752
755
  }
753
- this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput), true);
756
+ this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateInputFormat), true);
754
757
  this.selectNextDigitByCursor(this.selectionStart);
755
758
  this.updateValue(newTimeObj);
756
759
  };
@@ -793,11 +796,14 @@ class McDatepickerInput {
793
796
  return setTimeout(() => this.control.updateValueAndValidity());
794
797
  }
795
798
  this.lastValueValid = !!newTimeObj;
796
- this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput), true);
799
+ this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateInputFormat), true);
797
800
  this.updateValue(newTimeObj);
798
801
  };
799
802
  this.updateLocaleParams = () => {
800
- this.setFormat(this.dateFormats.dateInput);
803
+ this.setFormat(this.dateInputFormat);
804
+ if (!this.usePlaceholderFromInput) {
805
+ this._placeholder = this.localeService.getParams('datepicker').placeholder;
806
+ }
801
807
  this.value = this.value;
802
808
  };
803
809
  // tslint:disable-next-line:no-empty
@@ -842,10 +848,17 @@ class McDatepickerInput {
842
848
  if (!this.dateFormats) {
843
849
  throw createMissingDateImplError('MC_DATE_FORMATS');
844
850
  }
845
- this.setFormat(dateFormats.dateInput);
851
+ this.setFormat(this.dateInputFormat);
846
852
  this.localeSubscription = adapter.localeChanges
847
853
  .subscribe(this.updateLocaleParams);
848
854
  }
855
+ get placeholder() {
856
+ return this._placeholder;
857
+ }
858
+ set placeholder(value) {
859
+ this._placeholder = value;
860
+ this.usePlaceholderFromInput = true;
861
+ }
849
862
  get required() {
850
863
  return this._required;
851
864
  }
@@ -957,6 +970,10 @@ class McDatepickerInput {
957
970
  get isReadOnly() {
958
971
  return this.elementRef.nativeElement.readOnly;
959
972
  }
973
+ get dateInputFormat() {
974
+ var _a;
975
+ return ((_a = this.localeService) === null || _a === void 0 ? void 0 : _a.getParams('datepicker').dateInput) || this.dateFormats.dateInput;
976
+ }
960
977
  get readyForParse() {
961
978
  return !!(this.firstDigit && this.secondDigit && this.thirdDigit);
962
979
  }
@@ -1101,7 +1118,7 @@ class McDatepickerInput {
1101
1118
  this.setViewValue(value);
1102
1119
  return value;
1103
1120
  }
1104
- this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateFormats.dateInput));
1121
+ this.setViewValue(this.getTimeStringFromDate(newTimeObj, this.dateInputFormat));
1105
1122
  this.updateValue(newTimeObj);
1106
1123
  }
1107
1124
  toISO8601(value) {
@@ -1390,7 +1407,7 @@ class McDatepickerInput {
1390
1407
  }
1391
1408
  /** Formats a value and sets it on the input element. */
1392
1409
  formatValue(value) {
1393
- const formattedValue = value ? this.adapter.format(value, this.dateFormats.dateInput) : '';
1410
+ const formattedValue = value ? this.adapter.format(value, this.dateInputFormat) : '';
1394
1411
  this.setViewValue(formattedValue);
1395
1412
  }
1396
1413
  setControl(control) {
@@ -1452,7 +1469,7 @@ class McDatepickerInput {
1452
1469
  }
1453
1470
  }
1454
1471
  }
1455
- /** @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 });
1472
+ /** @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 });
1456
1473
  /** @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: [
1457
1474
  MC_DATEPICKER_VALUE_ACCESSOR,
1458
1475
  MC_DATEPICKER_VALIDATORS,
@@ -1491,6 +1508,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImpor
1491
1508
  }, {
1492
1509
  type: Inject,
1493
1510
  args: [MC_DATE_FORMATS]
1511
+ }] }, { type: i1$1.McLocaleService, decorators: [{
1512
+ type: Optional
1513
+ }, {
1514
+ type: Inject,
1515
+ args: [MC_LOCALE_SERVICE]
1494
1516
  }] }];
1495
1517
  }, propDecorators: { placeholder: [{
1496
1518
  type: Input