@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.
- package/_theming.scss +3790 -2072
- package/_visual.scss +341 -0
- package/button/button.component.d.ts +2 -0
- package/card/card.component.d.ts +2 -0
- package/checkbox/checkbox.d.ts +1 -0
- package/code-block/README.md +32 -0
- package/code-block/actionbar.component.d.ts +22 -0
- package/code-block/code-block.component.d.ts +74 -0
- package/code-block/code-block.module.d.ts +14 -0
- package/code-block/code-block.types.d.ts +17 -0
- package/code-block/index.d.ts +1 -0
- package/code-block/public-api.d.ts +3 -0
- package/core/formatters/date/formatter.d.ts +55 -1
- package/core/option/action.d.ts +2 -0
- package/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts +1 -0
- package/datepicker/calendar-body.component.d.ts +3 -11
- package/datepicker/calendar-header.component.d.ts +45 -0
- package/datepicker/calendar.component.d.ts +10 -81
- package/datepicker/datepicker-input.directive.d.ts +3 -3
- package/datepicker/datepicker-module.d.ts +8 -8
- package/datepicker/datepicker.component.d.ts +2 -12
- package/datepicker/month-view.component.d.ts +7 -26
- package/datepicker/public-api.d.ts +1 -2
- package/design-tokens/legacy-2017/tokens/components/code-block.json5 +704 -0
- package/design-tokens/legacy-2017/tokens.d.ts +341 -0
- package/design-tokens/pt-2022/tokens/components/code-block.json5 +697 -0
- package/design-tokens/pt-2022/tokens.d.ts +341 -0
- package/design-tokens/style-dictionary/configs/index.js +6 -8
- package/dropdown/dropdown-item.component.d.ts +1 -0
- package/esm2020/button/button.component.mjs +3 -3
- package/esm2020/card/card.component.mjs +3 -3
- package/esm2020/checkbox/checkbox.mjs +2 -2
- package/esm2020/code-block/actionbar.component.mjs +67 -0
- package/esm2020/code-block/code-block.component.mjs +157 -0
- package/esm2020/code-block/code-block.module.mjs +60 -0
- package/esm2020/code-block/code-block.types.mjs +2 -0
- package/esm2020/code-block/index.mjs +2 -0
- package/esm2020/code-block/ptsecurity-mosaic-code-block.mjs +5 -0
- package/esm2020/code-block/public-api.mjs +4 -0
- package/esm2020/core/formatters/date/formatter.mjs +77 -1
- package/esm2020/core/formatters/date/templates/en-US.mjs +56 -1
- package/esm2020/core/formatters/date/templates/ru-RU.mjs +92 -1
- package/esm2020/core/option/action.mjs +3 -2
- package/esm2020/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +2 -2
- package/esm2020/core/version.mjs +2 -2
- package/esm2020/datepicker/calendar-body.component.mjs +9 -28
- package/esm2020/datepicker/calendar-header.component.mjs +135 -0
- package/esm2020/datepicker/calendar.component.mjs +25 -212
- package/esm2020/datepicker/datepicker-input.directive.mjs +54 -54
- package/esm2020/datepicker/datepicker-module.mjs +13 -17
- package/esm2020/datepicker/datepicker.component.mjs +10 -21
- package/esm2020/datepicker/month-view.component.mjs +32 -131
- package/esm2020/datepicker/public-api.mjs +2 -3
- package/esm2020/design-tokens/legacy-2017/tokens.mjs +342 -1
- package/esm2020/design-tokens/pt-2022/tokens.mjs +342 -1
- package/esm2020/dropdown/dropdown-item.component.mjs +2 -2
- package/esm2020/form-field/form-field.mjs +3 -2
- package/esm2020/form-field/hint.mjs +3 -2
- package/esm2020/icon/icon.component.mjs +3 -2
- package/esm2020/input/input-number-validators.mjs +3 -7
- package/esm2020/input/input.mjs +3 -2
- package/esm2020/link/link.component.mjs +3 -2
- package/esm2020/list/list-selection.component.mjs +3 -2
- package/esm2020/modal/modal.component.mjs +4 -3
- package/esm2020/progress-bar/progress-bar.component.mjs +3 -2
- package/esm2020/progress-spinner/progress-spinner.component.mjs +3 -2
- package/esm2020/radio/radio.component.mjs +3 -4
- package/esm2020/select/select.component.mjs +18 -6
- package/esm2020/select/select.module.mjs +6 -2
- package/esm2020/tabs/tab-group.component.mjs +2 -2
- package/esm2020/tabs/tab-label-wrapper.directive.mjs +2 -2
- package/esm2020/tabs/tab-nav-bar/tab-nav-bar.mjs +3 -2
- package/esm2020/tabs/tab.component.mjs +3 -2
- package/esm2020/tags/tag-list.component.mjs +3 -2
- package/esm2020/tags/tag.component.mjs +3 -2
- package/esm2020/textarea/textarea.component.mjs +3 -2
- package/esm2020/timezone/timezone-select.component.mjs +2 -2
- package/esm2020/toggle/toggle.component.mjs +3 -2
- package/esm2020/tree/control/flat-tree-control.mjs +1 -1
- package/esm2020/tree/toggle.mjs +3 -2
- package/esm2020/tree/tree-base.mjs +1 -1
- package/esm2020/tree-select/tree-select.component.mjs +3 -2
- package/fesm2015/ptsecurity-mosaic-button.mjs +2 -2
- package/fesm2015/ptsecurity-mosaic-button.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-card.mjs +2 -2
- package/fesm2015/ptsecurity-mosaic-card.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-checkbox.mjs +1 -1
- package/fesm2015/ptsecurity-mosaic-checkbox.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-code-block.mjs +280 -0
- package/fesm2015/ptsecurity-mosaic-code-block.mjs.map +1 -0
- package/fesm2015/ptsecurity-mosaic-core.mjs +226 -3
- package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-datepicker.mjs +272 -906
- package/fesm2015/ptsecurity-mosaic-datepicker.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-design-tokens.mjs +1024 -1
- package/fesm2015/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-dropdown.mjs +1 -1
- package/fesm2015/ptsecurity-mosaic-dropdown.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-form-field.mjs +4 -2
- package/fesm2015/ptsecurity-mosaic-form-field.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-icon.mjs +2 -1
- package/fesm2015/ptsecurity-mosaic-icon.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-input.mjs +4 -7
- package/fesm2015/ptsecurity-mosaic-input.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-link.mjs +2 -1
- package/fesm2015/ptsecurity-mosaic-link.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-list.mjs +2 -1
- package/fesm2015/ptsecurity-mosaic-list.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-modal.mjs +3 -2
- package/fesm2015/ptsecurity-mosaic-modal.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-progress-bar.mjs +2 -1
- package/fesm2015/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs +2 -1
- package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-radio.mjs +2 -3
- package/fesm2015/ptsecurity-mosaic-radio.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-select.mjs +22 -6
- package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tabs.mjs +6 -4
- package/fesm2015/ptsecurity-mosaic-tabs.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tags.mjs +4 -2
- package/fesm2015/ptsecurity-mosaic-tags.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-textarea.mjs +2 -1
- package/fesm2015/ptsecurity-mosaic-textarea.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-timezone.mjs +2 -2
- package/fesm2015/ptsecurity-mosaic-timezone.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-toggle.mjs +2 -1
- package/fesm2015/ptsecurity-mosaic-toggle.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tree-select.mjs +2 -1
- package/fesm2015/ptsecurity-mosaic-tree-select.mjs.map +1 -1
- package/fesm2015/ptsecurity-mosaic-tree.mjs +2 -1
- package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-button.mjs +2 -2
- package/fesm2020/ptsecurity-mosaic-button.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-card.mjs +2 -2
- package/fesm2020/ptsecurity-mosaic-card.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-checkbox.mjs +1 -1
- package/fesm2020/ptsecurity-mosaic-checkbox.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-code-block.mjs +278 -0
- package/fesm2020/ptsecurity-mosaic-code-block.mjs.map +1 -0
- package/fesm2020/ptsecurity-mosaic-core.mjs +226 -3
- package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-datepicker.mjs +270 -901
- package/fesm2020/ptsecurity-mosaic-datepicker.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-design-tokens.mjs +1024 -1
- package/fesm2020/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-dropdown.mjs +1 -1
- package/fesm2020/ptsecurity-mosaic-dropdown.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-form-field.mjs +4 -2
- package/fesm2020/ptsecurity-mosaic-form-field.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-icon.mjs +2 -1
- package/fesm2020/ptsecurity-mosaic-icon.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-input.mjs +4 -7
- package/fesm2020/ptsecurity-mosaic-input.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-link.mjs +2 -1
- package/fesm2020/ptsecurity-mosaic-link.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-list.mjs +2 -1
- package/fesm2020/ptsecurity-mosaic-list.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-modal.mjs +3 -2
- package/fesm2020/ptsecurity-mosaic-modal.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-progress-bar.mjs +2 -1
- package/fesm2020/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs +2 -1
- package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-radio.mjs +2 -3
- package/fesm2020/ptsecurity-mosaic-radio.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-select.mjs +22 -6
- package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-tabs.mjs +6 -4
- package/fesm2020/ptsecurity-mosaic-tabs.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-tags.mjs +4 -2
- package/fesm2020/ptsecurity-mosaic-tags.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-textarea.mjs +2 -1
- package/fesm2020/ptsecurity-mosaic-textarea.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-timezone.mjs +2 -2
- package/fesm2020/ptsecurity-mosaic-timezone.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-toggle.mjs +2 -1
- package/fesm2020/ptsecurity-mosaic-toggle.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-tree-select.mjs +2 -1
- package/fesm2020/ptsecurity-mosaic-tree-select.mjs.map +1 -1
- package/fesm2020/ptsecurity-mosaic-tree.mjs +2 -1
- package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
- package/form-field/form-field.d.ts +2 -0
- package/form-field/hint.d.ts +2 -0
- package/icon/icon.component.d.ts +2 -0
- package/input/input-number-validators.d.ts +2 -6
- package/input/input.d.ts +2 -0
- package/link/link.component.d.ts +2 -0
- package/list/list-selection.component.d.ts +2 -0
- package/package.json +12 -4
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/default-theme.css +1 -1
- package/progress-bar/progress-bar.component.d.ts +2 -0
- package/progress-spinner/progress-spinner.component.d.ts +2 -0
- package/radio/radio.component.d.ts +2 -0
- package/select/select.component.d.ts +9 -2
- package/select/select.module.d.ts +1 -1
- package/tabs/tab-group.component.d.ts +1 -0
- package/tabs/tab-label-wrapper.directive.d.ts +1 -0
- package/tabs/tab-nav-bar/tab-nav-bar.d.ts +2 -0
- package/tabs/tab.component.d.ts +2 -0
- package/tags/tag-list.component.d.ts +2 -0
- package/tags/tag.component.d.ts +2 -0
- package/textarea/textarea.component.d.ts +2 -0
- package/toggle/toggle.component.d.ts +2 -0
- package/tree/control/flat-tree-control.d.ts +4 -4
- package/tree/toggle.d.ts +2 -0
- package/tree-select/tree-select.component.d.ts +2 -0
- package/datepicker/multi-year-view.component.d.ts +0 -72
- package/datepicker/year-view.component.d.ts +0 -90
- package/esm2020/datepicker/multi-year-view.component.mjs +0 -218
- 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.
|
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
|
-
|
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
|
-
|
2603
|
+
/** @docs-private */
|
2381
2604
|
const McOptionActionMixinBase = mixinTabIndex(mixinDisabled(McOptionActionBase));
|
2382
2605
|
class McOptionActionComponent extends McOptionActionMixinBase {
|
2383
2606
|
constructor(elementRef, focusMonitor, option) {
|