@ptsecurity/mosaic 14.6.1 → 14.7.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 (212) hide show
  1. package/_theming.scss +3790 -2072
  2. package/_visual.scss +341 -0
  3. package/button/button.component.d.ts +2 -0
  4. package/card/card.component.d.ts +2 -0
  5. package/checkbox/checkbox.d.ts +1 -0
  6. package/code-block/README.md +32 -0
  7. package/code-block/actionbar.component.d.ts +22 -0
  8. package/code-block/code-block.component.d.ts +74 -0
  9. package/code-block/code-block.module.d.ts +14 -0
  10. package/code-block/code-block.types.d.ts +17 -0
  11. package/code-block/index.d.ts +1 -0
  12. package/code-block/public-api.d.ts +3 -0
  13. package/core/formatters/date/formatter.d.ts +55 -1
  14. package/core/option/action.d.ts +2 -0
  15. package/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts +1 -0
  16. package/datepicker/calendar-body.component.d.ts +3 -11
  17. package/datepicker/calendar-header.component.d.ts +45 -0
  18. package/datepicker/calendar.component.d.ts +10 -81
  19. package/datepicker/datepicker-input.directive.d.ts +3 -3
  20. package/datepicker/datepicker-module.d.ts +8 -8
  21. package/datepicker/datepicker.component.d.ts +2 -12
  22. package/datepicker/month-view.component.d.ts +7 -26
  23. package/datepicker/public-api.d.ts +1 -2
  24. package/design-tokens/legacy-2017/tokens/components/code-block.json5 +704 -0
  25. package/design-tokens/legacy-2017/tokens.d.ts +341 -0
  26. package/design-tokens/pt-2022/tokens/components/code-block.json5 +697 -0
  27. package/design-tokens/pt-2022/tokens.d.ts +341 -0
  28. package/design-tokens/style-dictionary/configs/index.js +6 -8
  29. package/dropdown/dropdown-item.component.d.ts +1 -0
  30. package/esm2020/button/button.component.mjs +3 -3
  31. package/esm2020/card/card.component.mjs +3 -3
  32. package/esm2020/checkbox/checkbox.mjs +2 -2
  33. package/esm2020/code-block/actionbar.component.mjs +67 -0
  34. package/esm2020/code-block/code-block.component.mjs +157 -0
  35. package/esm2020/code-block/code-block.module.mjs +60 -0
  36. package/esm2020/code-block/code-block.types.mjs +2 -0
  37. package/esm2020/code-block/index.mjs +2 -0
  38. package/esm2020/code-block/ptsecurity-mosaic-code-block.mjs +5 -0
  39. package/esm2020/code-block/public-api.mjs +4 -0
  40. package/esm2020/core/formatters/date/formatter.mjs +77 -1
  41. package/esm2020/core/formatters/date/templates/en-US.mjs +56 -1
  42. package/esm2020/core/formatters/date/templates/ru-RU.mjs +92 -1
  43. package/esm2020/core/option/action.mjs +3 -2
  44. package/esm2020/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +2 -2
  45. package/esm2020/core/version.mjs +2 -2
  46. package/esm2020/datepicker/calendar-body.component.mjs +9 -28
  47. package/esm2020/datepicker/calendar-header.component.mjs +135 -0
  48. package/esm2020/datepicker/calendar.component.mjs +25 -212
  49. package/esm2020/datepicker/datepicker-input.directive.mjs +54 -54
  50. package/esm2020/datepicker/datepicker-module.mjs +13 -17
  51. package/esm2020/datepicker/datepicker.component.mjs +10 -21
  52. package/esm2020/datepicker/month-view.component.mjs +32 -131
  53. package/esm2020/datepicker/public-api.mjs +2 -3
  54. package/esm2020/design-tokens/legacy-2017/tokens.mjs +342 -1
  55. package/esm2020/design-tokens/pt-2022/tokens.mjs +342 -1
  56. package/esm2020/dropdown/dropdown-item.component.mjs +2 -2
  57. package/esm2020/form-field/form-field.mjs +3 -2
  58. package/esm2020/form-field/hint.mjs +3 -2
  59. package/esm2020/icon/icon.component.mjs +3 -2
  60. package/esm2020/input/input-number-validators.mjs +3 -7
  61. package/esm2020/input/input.mjs +3 -2
  62. package/esm2020/link/link.component.mjs +3 -2
  63. package/esm2020/list/list-selection.component.mjs +3 -2
  64. package/esm2020/modal/modal.component.mjs +4 -3
  65. package/esm2020/progress-bar/progress-bar.component.mjs +3 -2
  66. package/esm2020/progress-spinner/progress-spinner.component.mjs +3 -2
  67. package/esm2020/radio/radio.component.mjs +3 -4
  68. package/esm2020/select/select.component.mjs +18 -6
  69. package/esm2020/select/select.module.mjs +6 -2
  70. package/esm2020/tabs/tab-group.component.mjs +2 -2
  71. package/esm2020/tabs/tab-label-wrapper.directive.mjs +2 -2
  72. package/esm2020/tabs/tab-nav-bar/tab-nav-bar.mjs +3 -2
  73. package/esm2020/tabs/tab.component.mjs +3 -2
  74. package/esm2020/tags/tag-list.component.mjs +3 -2
  75. package/esm2020/tags/tag.component.mjs +3 -2
  76. package/esm2020/textarea/textarea.component.mjs +3 -2
  77. package/esm2020/timezone/timezone-select.component.mjs +2 -2
  78. package/esm2020/toggle/toggle.component.mjs +3 -2
  79. package/esm2020/tree/control/flat-tree-control.mjs +1 -1
  80. package/esm2020/tree/toggle.mjs +3 -2
  81. package/esm2020/tree/tree-base.mjs +1 -1
  82. package/esm2020/tree-select/tree-select.component.mjs +3 -2
  83. package/fesm2015/ptsecurity-mosaic-button.mjs +2 -2
  84. package/fesm2015/ptsecurity-mosaic-button.mjs.map +1 -1
  85. package/fesm2015/ptsecurity-mosaic-card.mjs +2 -2
  86. package/fesm2015/ptsecurity-mosaic-card.mjs.map +1 -1
  87. package/fesm2015/ptsecurity-mosaic-checkbox.mjs +1 -1
  88. package/fesm2015/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  89. package/fesm2015/ptsecurity-mosaic-code-block.mjs +280 -0
  90. package/fesm2015/ptsecurity-mosaic-code-block.mjs.map +1 -0
  91. package/fesm2015/ptsecurity-mosaic-core.mjs +226 -3
  92. package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
  93. package/fesm2015/ptsecurity-mosaic-datepicker.mjs +272 -906
  94. package/fesm2015/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  95. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs +1024 -1
  96. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  97. package/fesm2015/ptsecurity-mosaic-dropdown.mjs +1 -1
  98. package/fesm2015/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  99. package/fesm2015/ptsecurity-mosaic-form-field.mjs +4 -2
  100. package/fesm2015/ptsecurity-mosaic-form-field.mjs.map +1 -1
  101. package/fesm2015/ptsecurity-mosaic-icon.mjs +2 -1
  102. package/fesm2015/ptsecurity-mosaic-icon.mjs.map +1 -1
  103. package/fesm2015/ptsecurity-mosaic-input.mjs +4 -7
  104. package/fesm2015/ptsecurity-mosaic-input.mjs.map +1 -1
  105. package/fesm2015/ptsecurity-mosaic-link.mjs +2 -1
  106. package/fesm2015/ptsecurity-mosaic-link.mjs.map +1 -1
  107. package/fesm2015/ptsecurity-mosaic-list.mjs +2 -1
  108. package/fesm2015/ptsecurity-mosaic-list.mjs.map +1 -1
  109. package/fesm2015/ptsecurity-mosaic-modal.mjs +3 -2
  110. package/fesm2015/ptsecurity-mosaic-modal.mjs.map +1 -1
  111. package/fesm2015/ptsecurity-mosaic-progress-bar.mjs +2 -1
  112. package/fesm2015/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
  113. package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs +2 -1
  114. package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
  115. package/fesm2015/ptsecurity-mosaic-radio.mjs +2 -3
  116. package/fesm2015/ptsecurity-mosaic-radio.mjs.map +1 -1
  117. package/fesm2015/ptsecurity-mosaic-select.mjs +22 -6
  118. package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
  119. package/fesm2015/ptsecurity-mosaic-tabs.mjs +6 -4
  120. package/fesm2015/ptsecurity-mosaic-tabs.mjs.map +1 -1
  121. package/fesm2015/ptsecurity-mosaic-tags.mjs +4 -2
  122. package/fesm2015/ptsecurity-mosaic-tags.mjs.map +1 -1
  123. package/fesm2015/ptsecurity-mosaic-textarea.mjs +2 -1
  124. package/fesm2015/ptsecurity-mosaic-textarea.mjs.map +1 -1
  125. package/fesm2015/ptsecurity-mosaic-timezone.mjs +2 -2
  126. package/fesm2015/ptsecurity-mosaic-timezone.mjs.map +1 -1
  127. package/fesm2015/ptsecurity-mosaic-toggle.mjs +2 -1
  128. package/fesm2015/ptsecurity-mosaic-toggle.mjs.map +1 -1
  129. package/fesm2015/ptsecurity-mosaic-tree-select.mjs +2 -1
  130. package/fesm2015/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  131. package/fesm2015/ptsecurity-mosaic-tree.mjs +2 -1
  132. package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
  133. package/fesm2020/ptsecurity-mosaic-button.mjs +2 -2
  134. package/fesm2020/ptsecurity-mosaic-button.mjs.map +1 -1
  135. package/fesm2020/ptsecurity-mosaic-card.mjs +2 -2
  136. package/fesm2020/ptsecurity-mosaic-card.mjs.map +1 -1
  137. package/fesm2020/ptsecurity-mosaic-checkbox.mjs +1 -1
  138. package/fesm2020/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  139. package/fesm2020/ptsecurity-mosaic-code-block.mjs +278 -0
  140. package/fesm2020/ptsecurity-mosaic-code-block.mjs.map +1 -0
  141. package/fesm2020/ptsecurity-mosaic-core.mjs +226 -3
  142. package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
  143. package/fesm2020/ptsecurity-mosaic-datepicker.mjs +270 -901
  144. package/fesm2020/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  145. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs +1024 -1
  146. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  147. package/fesm2020/ptsecurity-mosaic-dropdown.mjs +1 -1
  148. package/fesm2020/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  149. package/fesm2020/ptsecurity-mosaic-form-field.mjs +4 -2
  150. package/fesm2020/ptsecurity-mosaic-form-field.mjs.map +1 -1
  151. package/fesm2020/ptsecurity-mosaic-icon.mjs +2 -1
  152. package/fesm2020/ptsecurity-mosaic-icon.mjs.map +1 -1
  153. package/fesm2020/ptsecurity-mosaic-input.mjs +4 -7
  154. package/fesm2020/ptsecurity-mosaic-input.mjs.map +1 -1
  155. package/fesm2020/ptsecurity-mosaic-link.mjs +2 -1
  156. package/fesm2020/ptsecurity-mosaic-link.mjs.map +1 -1
  157. package/fesm2020/ptsecurity-mosaic-list.mjs +2 -1
  158. package/fesm2020/ptsecurity-mosaic-list.mjs.map +1 -1
  159. package/fesm2020/ptsecurity-mosaic-modal.mjs +3 -2
  160. package/fesm2020/ptsecurity-mosaic-modal.mjs.map +1 -1
  161. package/fesm2020/ptsecurity-mosaic-progress-bar.mjs +2 -1
  162. package/fesm2020/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
  163. package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs +2 -1
  164. package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
  165. package/fesm2020/ptsecurity-mosaic-radio.mjs +2 -3
  166. package/fesm2020/ptsecurity-mosaic-radio.mjs.map +1 -1
  167. package/fesm2020/ptsecurity-mosaic-select.mjs +22 -6
  168. package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
  169. package/fesm2020/ptsecurity-mosaic-tabs.mjs +6 -4
  170. package/fesm2020/ptsecurity-mosaic-tabs.mjs.map +1 -1
  171. package/fesm2020/ptsecurity-mosaic-tags.mjs +4 -2
  172. package/fesm2020/ptsecurity-mosaic-tags.mjs.map +1 -1
  173. package/fesm2020/ptsecurity-mosaic-textarea.mjs +2 -1
  174. package/fesm2020/ptsecurity-mosaic-textarea.mjs.map +1 -1
  175. package/fesm2020/ptsecurity-mosaic-timezone.mjs +2 -2
  176. package/fesm2020/ptsecurity-mosaic-timezone.mjs.map +1 -1
  177. package/fesm2020/ptsecurity-mosaic-toggle.mjs +2 -1
  178. package/fesm2020/ptsecurity-mosaic-toggle.mjs.map +1 -1
  179. package/fesm2020/ptsecurity-mosaic-tree-select.mjs +2 -1
  180. package/fesm2020/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  181. package/fesm2020/ptsecurity-mosaic-tree.mjs +2 -1
  182. package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
  183. package/form-field/form-field.d.ts +2 -0
  184. package/form-field/hint.d.ts +2 -0
  185. package/icon/icon.component.d.ts +2 -0
  186. package/input/input-number-validators.d.ts +2 -6
  187. package/input/input.d.ts +2 -0
  188. package/link/link.component.d.ts +2 -0
  189. package/list/list-selection.component.d.ts +2 -0
  190. package/package.json +12 -4
  191. package/prebuilt-themes/dark-theme.css +1 -1
  192. package/prebuilt-themes/default-theme.css +1 -1
  193. package/progress-bar/progress-bar.component.d.ts +2 -0
  194. package/progress-spinner/progress-spinner.component.d.ts +2 -0
  195. package/radio/radio.component.d.ts +2 -0
  196. package/select/select.component.d.ts +9 -2
  197. package/select/select.module.d.ts +1 -1
  198. package/tabs/tab-group.component.d.ts +1 -0
  199. package/tabs/tab-label-wrapper.directive.d.ts +1 -0
  200. package/tabs/tab-nav-bar/tab-nav-bar.d.ts +2 -0
  201. package/tabs/tab.component.d.ts +2 -0
  202. package/tags/tag-list.component.d.ts +2 -0
  203. package/tags/tag.component.d.ts +2 -0
  204. package/textarea/textarea.component.d.ts +2 -0
  205. package/toggle/toggle.component.d.ts +2 -0
  206. package/tree/control/flat-tree-control.d.ts +4 -4
  207. package/tree/toggle.d.ts +2 -0
  208. package/tree-select/tree-select.component.d.ts +2 -0
  209. package/datepicker/multi-year-view.component.d.ts +0 -72
  210. package/datepicker/year-view.component.d.ts +0 -90
  211. package/esm2020/datepicker/multi-year-view.component.mjs +0 -218
  212. package/esm2020/datepicker/year-view.component.mjs +0 -253
@@ -17,7 +17,7 @@ import { takeUntil, distinctUntilChanged, delay } from 'rxjs/operators';
17
17
  import * as i1$1 from '@angular/cdk/a11y';
18
18
  import { ComponentPortal } from '@angular/cdk/portal';
19
19
 
20
- const VERSION = new Version('14.6.1+sha-e1042d9');
20
+ const VERSION = new Version('14.7.0+sha-3a206be');
21
21
 
22
22
  function isBoolean(val) { return typeof val === 'boolean'; }
23
23
  function toBoolean(value) {
@@ -563,6 +563,61 @@ const enUS = {
563
563
  }`
564
564
  }
565
565
  }
566
+ },
567
+ durationTemplates: {
568
+ shortest: {
569
+ FULL: '{D, duration}{SHOW_MILLISECONDS, select, yes{,{MILLISECONDS}} other {}}',
570
+ ONLY_MINUTES: '{HOURS}:{MINUTES, number, ::integer-width/00}'
571
+ },
572
+ long: {
573
+ SEPARATOR: '',
574
+ YEARS: `{years, plural,
575
+ =1 {# year}
576
+ other {# years}
577
+ }`,
578
+ MONTHS: `{months, plural,
579
+ =1 {# month}
580
+ other {# months}
581
+ }`,
582
+ WEEKS: `{weeks, plural,
583
+ =1 {# week}
584
+ other {# weeks}
585
+ }`,
586
+ DAYS: `{days, plural,
587
+ =1 {# day}
588
+ other {# days}
589
+ }`,
590
+ HOURS: `{hours, plural,
591
+ =1 {# hour}
592
+ other {# hours}
593
+ }`,
594
+ MINUTES: `{minutes, plural,
595
+ =1 {# minute}
596
+ other {# minutes}
597
+ }`,
598
+ SECONDS: `{seconds, plural,
599
+ =1 {# second}
600
+ other {# seconds}
601
+ }`,
602
+ YEARS_FRACTION: `{years} years`,
603
+ MONTHS_FRACTION: `{months} months`
604
+ },
605
+ short: {
606
+ SEPARATOR: '',
607
+ YEARS: `{years} y`,
608
+ MONTHS: `{months} mo`,
609
+ WEEKS: `{weeks} w`,
610
+ DAYS: `{days} d`,
611
+ HOURS: `{hours} h`,
612
+ MINUTES: `{minutes} min`,
613
+ SECONDS: `{SHOW_MILLISECONDS, select, yes
614
+ {{seconds}.{milliseconds} s}
615
+ other
616
+ {{seconds} s}
617
+ }`,
618
+ YEARS_FRACTION: '{years} y',
619
+ MONTHS_FRACTION: '{months} mo'
620
+ }
566
621
  }
567
622
  };
568
623
 
@@ -844,6 +899,97 @@ const ruRU = {
844
899
  }`
845
900
  }
846
901
  }
902
+ },
903
+ durationTemplates: {
904
+ shortest: {
905
+ FULL: '{D, duration}{SHOW_MILLISECONDS, select, yes{,{MILLISECONDS}} other {}}',
906
+ ONLY_MINUTES: '{HOURS}:{MINUTES, number, ::integer-width/00}'
907
+ },
908
+ long: {
909
+ SEPARATOR: 'и',
910
+ YEARS: `{years, plural,
911
+ one {# год}
912
+ few {# года}
913
+ many {# лет}
914
+ other {}
915
+ }`,
916
+ MONTHS: `{months, plural,
917
+ one {# месяц}
918
+ few {# месяца}
919
+ many {# месяцев}
920
+ other {}
921
+ }`,
922
+ WEEKS: `{weeks, plural,
923
+ one {# неделя}
924
+ few {# недели}
925
+ many {# недель}
926
+ other {}
927
+ }`,
928
+ DAYS: `{days, plural,
929
+ one {# день}
930
+ few {# дня}
931
+ many {# дней}
932
+ other {}
933
+ }`,
934
+ HOURS: `{hours, plural,
935
+ one {# час}
936
+ few {# часа}
937
+ many {# часов}
938
+ other {}
939
+ }`,
940
+ MINUTES: `{minutes, plural,
941
+ one {# минута}
942
+ few {# минуты}
943
+ many {# минут}
944
+ other {}
945
+ }`,
946
+ SECONDS: `{seconds, plural,
947
+ one {# секунда}
948
+ few {# секунды}
949
+ many {# секунд}
950
+ other {}
951
+ }`,
952
+ YEARS_FRACTION: `{floorValue, plural,
953
+ =1 {{years, number, ::#,#} года}
954
+ one {{years, number, ::#,#} год}
955
+ few {{years, number, ::#,#} года}
956
+ other {{years, number, ::#,#} лет}
957
+ }`,
958
+ MONTHS_FRACTION: `{floorValue, plural,
959
+ =1 {{months, number, ::#,#} месяца}
960
+ one {{months, number, ::#,#} месяц}
961
+ few {{months, number, ::#,#} месяца}
962
+ other {{months, number, ::#,#} месяцев}
963
+ }`
964
+ },
965
+ short: {
966
+ SEPARATOR: '',
967
+ YEARS: `{years, plural,
968
+ one {# г}
969
+ few {# г}
970
+ many {# л}
971
+ other {}
972
+ }`,
973
+ MONTHS: `{months} мес`,
974
+ WEEKS: `{weeks} нед`,
975
+ DAYS: `{days} д`,
976
+ HOURS: `{hours} ч`,
977
+ MINUTES: `{minutes} мин`,
978
+ SECONDS: `{SHOW_MILLISECONDS, select, yes
979
+ {{seconds},{milliseconds} с}
980
+ other
981
+ {{seconds} с}
982
+ }`,
983
+ YEARS_FRACTION: `{floorValue, plural,
984
+ one {{years, number, ::#,#} г}
985
+ few {{years, number, ::#,#} г}
986
+ other {{years, number, ::#,#} л}
987
+ }`,
988
+ MONTHS_FRACTION: `{floorValue, plural,
989
+ =1 {{months, number, ::#,#} мес}
990
+ other {{months, number, ::#,#} мес}
991
+ }`
992
+ }
847
993
  }
848
994
  };
849
995
 
@@ -1134,6 +1280,82 @@ class DateFormatter {
1134
1280
  rangeMiddleDateTime(startDate, endDate, options) {
1135
1281
  return this.rangeDateTime(startDate, endDate, this.config.rangeTemplates.closedRange.middle, options === null || options === void 0 ? void 0 : options.seconds, options === null || options === void 0 ? void 0 : options.milliseconds);
1136
1282
  }
1283
+ /**
1284
+ * @param startDate - start date
1285
+ * @param endDate - end date
1286
+ * @param seconds - add seconds to formatted value
1287
+ * @param milliseconds - add milliseconds to formatted value
1288
+ * @returns formatted duration as string like 48:02:25
1289
+ */
1290
+ durationShortest(startDate, endDate, seconds = true, milliseconds = false) {
1291
+ this.checkDates(startDate, endDate);
1292
+ if (startDate > endDate) {
1293
+ throw new Error(this.invalidDateErrorText);
1294
+ }
1295
+ const durationObject = this.adapter.durationObjectFromDates(startDate, endDate, ['hours', 'minutes', 'seconds', 'milliseconds']);
1296
+ const roundedSeconds = Math.floor(this.adapter.durationAs(durationObject, 'seconds'));
1297
+ if (seconds) {
1298
+ return this.compileMessage(this.config.durationTemplates.shortest.FULL, {
1299
+ D: roundedSeconds,
1300
+ SHOW_MILLISECONDS: milliseconds ? 'yes' : 'no',
1301
+ MILLISECONDS: durationObject.milliseconds
1302
+ });
1303
+ }
1304
+ return roundedSeconds - (roundedSeconds % 60) ? this.compileMessage(this.config.durationTemplates.shortest.ONLY_MINUTES, {
1305
+ HOURS: durationObject.hours,
1306
+ MINUTES: durationObject.minutes
1307
+ }) : '';
1308
+ }
1309
+ /**
1310
+ * @param startDate - start date
1311
+ * @param endDate - end date
1312
+ * @param units - if defined, units to show will be specified
1313
+ * @param fraction - shows fraction part for years and months
1314
+ * @param template - specify template
1315
+ * @returns formatted duration as string
1316
+ */
1317
+ duration(startDate, endDate, units, fraction, template) {
1318
+ this.checkDates(startDate, endDate);
1319
+ if (startDate > endDate) {
1320
+ throw new Error(this.invalidDateErrorText);
1321
+ }
1322
+ const values = this.adapter.durationObjectFromDates(startDate, endDate, units, fraction);
1323
+ const variables = Object.assign({}, values);
1324
+ variables.SHOW_MILLISECONDS = values.milliseconds ? 'yes' : 'no';
1325
+ return Object
1326
+ .keys(values)
1327
+ .reduce((acc, unit, index, arr) => {
1328
+ if (fraction) {
1329
+ variables.floorValue = Math.floor(values[unit]);
1330
+ acc.push(this.compileMessage(template[`${unit.toUpperCase()}_FRACTION`], variables));
1331
+ }
1332
+ else {
1333
+ if (arr.length > 1 && index === arr.length - 1) {
1334
+ acc.push(this.compileMessage(template.SEPARATOR, variables));
1335
+ }
1336
+ acc.push(this.compileMessage(template[unit.toUpperCase()], variables));
1337
+ }
1338
+ return acc;
1339
+ }, [])
1340
+ .filter((text) => !!text)
1341
+ .join(' ');
1342
+ }
1343
+ durationLong(startDate, endDate, units = [], fraction = false) {
1344
+ return this.duration(startDate, endDate, units, fraction, this.config.durationTemplates.long);
1345
+ }
1346
+ durationShort(startDate, endDate, units = [], fraction = false) {
1347
+ return this.duration(startDate, endDate, units, fraction, this.config.durationTemplates.short);
1348
+ }
1349
+ checkDates(...args) {
1350
+ args.forEach((date) => {
1351
+ if (!this.adapter.isDateInstance(date) || !this.adapter.isValid(date)) {
1352
+ throw new Error(this.invalidDateErrorText);
1353
+ }
1354
+ });
1355
+ }
1356
+ compileMessage(message, variables) {
1357
+ return this.messageFormat.compile(message)(variables);
1358
+ }
1137
1359
  /**
1138
1360
  * @param date - date for compile
1139
1361
  * @param variables - date template variables
@@ -1997,7 +2219,7 @@ class McPseudoCheckboxBase {
1997
2219
  this.elementRef = elementRef;
1998
2220
  }
1999
2221
  }
2000
- // tslint:disable-next-line:naming-convention
2222
+ /** @docs-private */
2001
2223
  const McPseudoCheckboxMixinBase = mixinColor(mixinDisabled(McPseudoCheckboxBase), ThemePalette.Primary);
2002
2224
  /**
2003
2225
  * Component that shows a simplified checkbox without including any kind of "real" checkbox.
@@ -2375,9 +2597,10 @@ function getOptionScrollPosition(optionIndex, optionHeight, currentScrollPositio
2375
2597
  }
2376
2598
 
2377
2599
  const MC_OPTION_ACTION_PARENT = new InjectionToken('MC_OPTION_ACTION_PARENT');
2600
+ /** @docs-private */
2378
2601
  class McOptionActionBase {
2379
2602
  }
2380
- // tslint:disable-next-line:naming-convention
2603
+ /** @docs-private */
2381
2604
  const McOptionActionMixinBase = mixinTabIndex(mixinDisabled(McOptionActionBase));
2382
2605
  class McOptionActionComponent extends McOptionActionMixinBase {
2383
2606
  constructor(elementRef, focusMonitor, option) {