@tilde-nlp/ngx-common 8.1.80 → 8.1.81

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.
@@ -1841,6 +1841,106 @@ class SortDomainsPipe {
1841
1841
  }]
1842
1842
  }], () => [{ type: i1.TranslateService }], null); })();
1843
1843
 
1844
+ const TIME_UNIT_TRANSLATIONS = {
1845
+ en: {
1846
+ SECOND: 'second',
1847
+ SECONDS: 'seconds',
1848
+ MINUTE: 'minute',
1849
+ MINUTES: 'minutes',
1850
+ HOUR: 'hour',
1851
+ HOURS: 'hours',
1852
+ DAY: 'day',
1853
+ DAYS: 'days',
1854
+ },
1855
+ lv: {
1856
+ SECOND: 'sekunde',
1857
+ SECONDS: 'sekundes',
1858
+ MINUTE: 'minūte',
1859
+ MINUTES: 'minūtes',
1860
+ HOUR: 'stunda',
1861
+ HOURS: 'stundas',
1862
+ DAY: 'diena',
1863
+ DAYS: 'dienas',
1864
+ },
1865
+ et: {
1866
+ SECOND: 'sekund',
1867
+ SECONDS: 'sekundid',
1868
+ MINUTE: 'minut',
1869
+ MINUTES: 'minutid',
1870
+ HOUR: 'tunnid',
1871
+ HOURS: 'tunnid',
1872
+ DAY: 'päev',
1873
+ DAYS: 'päevad',
1874
+ },
1875
+ lt: {
1876
+ SECOND: 'sekundė',
1877
+ SECONDS: 'sekundės',
1878
+ MINUTE: 'minutė',
1879
+ MINUTES: 'minutės',
1880
+ HOUR: 'valanda',
1881
+ HOURS: 'valandos',
1882
+ DAY: 'diena',
1883
+ DAYS: 'dienos',
1884
+ },
1885
+ };
1886
+
1887
+ class ExpiresInPipe {
1888
+ constructor() {
1889
+ this.translations = TIME_UNIT_TRANSLATIONS;
1890
+ }
1891
+ transform(value, currentLangCode) {
1892
+ if (!value) {
1893
+ return '';
1894
+ }
1895
+ const translations = this.translations[currentLangCode];
1896
+ const targetTimestamp = Date.parse(value.trim());
1897
+ const DAYS_30_IN_MS = 2592000000;
1898
+ const now = Date.now();
1899
+ let diffInMs = targetTimestamp - now;
1900
+ if (diffInMs <= 0) {
1901
+ return `0 ${translations.SECONDS}`;
1902
+ }
1903
+ diffInMs = Math.min(diffInMs, DAYS_30_IN_MS);
1904
+ const DAY_IN_MS = 86400000;
1905
+ const HOUR_IN_MS = 3600000;
1906
+ const MINUTE_IN_MS = 60000;
1907
+ const days = Math.floor(diffInMs / DAY_IN_MS);
1908
+ diffInMs %= DAY_IN_MS;
1909
+ const hours = Math.floor(diffInMs / HOUR_IN_MS);
1910
+ diffInMs %= HOUR_IN_MS;
1911
+ const minutes = Math.floor(diffInMs / MINUTE_IN_MS);
1912
+ diffInMs %= MINUTE_IN_MS;
1913
+ const seconds = Math.max(1, Math.floor(diffInMs / 1000));
1914
+ if (days > 0) {
1915
+ if (hours > 0) {
1916
+ return `${days} ${this.pluralize(days, translations.DAY, translations.DAYS)}, ${hours} ${this.pluralize(hours, translations.HOUR, translations.HOURS)}`;
1917
+ }
1918
+ return `${days} ${this.pluralize(days, translations.DAY, translations.DAYS)}`;
1919
+ }
1920
+ if (hours > 0) {
1921
+ if (minutes > 0) {
1922
+ return `${hours} ${this.pluralize(hours, translations.HOUR, translations.HOURS)}, ${minutes} ${this.pluralize(minutes, translations.MINUTE, translations.MINUTES)}`;
1923
+ }
1924
+ return `${hours} ${this.pluralize(hours, translations.HOUR, translations.HOURS)}`;
1925
+ }
1926
+ if (minutes > 0) {
1927
+ return `${minutes} ${this.pluralize(minutes, translations.MINUTE, translations.MINUTES)}`;
1928
+ }
1929
+ return `${seconds} ${this.pluralize(seconds, translations.SECOND, translations.SECONDS)}`;
1930
+ }
1931
+ pluralize(value, singular, plural) {
1932
+ return value === 1 ? singular : plural;
1933
+ }
1934
+ static { this.ɵfac = function ExpiresInPipe_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ExpiresInPipe)(); }; }
1935
+ static { this.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "expiresIn", type: ExpiresInPipe, pure: true }); }
1936
+ }
1937
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ExpiresInPipe, [{
1938
+ type: Pipe,
1939
+ args: [{
1940
+ name: 'expiresIn',
1941
+ }]
1942
+ }], null, null); })();
1943
+
1844
1944
  class LanguageTranslateService {
1845
1945
  constructor(translateService) {
1846
1946
  this.translateService = translateService;
@@ -10036,5 +10136,5 @@ const provideLanguageService = (config) => {
10036
10136
  * Generated bundle index. Do not edit.
10037
10137
  */
10038
10138
 
10039
- export { ALERT_CONFIGURATION_TOKEN, AccessibilityContrasts, AccessibilityDialogComponent, AccessibilityFontSizes, AccessibilityService, AccessibilityTextMagnifierService, AlertService, AnalyticsService, AuthHeadersHelper, COLLECTIONS_MENU, CUSTOM_TITLE_CONFIGURATION_TOKEN, ClickOutsideDirective, ClickOutsideModule, CloseButtonComponent, CloseButtonModule, CombinedCollection, CombinedCollectionTooltipKey, CompanyProductComponent, CompanyProductModule, Confirmation, ConfirmationModalComponent, ConfirmationModalModule, ConfirmationService, ConversionHelper, CookieConsentComponent, CustomPaginatorInernationalizationHelper, CustomTitleStrategyService, CustomTranslateLoader, CustomTranslateParseService, DEFAULT_ACCESSIBILITY_PREFERENCES, DEFAULT_COOKIE_CONSENT_PREFERENCES, DEFAULT_USER_CONFIG, DEFAULT_USER_CONFIG_IFRAME_URL, DEFAULT_USER_CONFIG_OPTIONS, DISABLE_EXPORT_ATTRIBUTE_NAME, DOMService, DateAgoModule, DateAgoPipe, DomainTranslatePipe, DragAndDropDirective, DragAndDropModule, ERROR_CODES, EngineTermApiService, EngineTermCollectionScope, EngineTermCollectionSource, EngineTermCollectionStatus, EngineTermCollectionSubStatus, ExportFormat, ExtensionDialogComponent, ExtensionDialogModule, ExtensionDialogService, FILE_SIZE_UNIT, FileCategories, FileExtensionHelper, FileExtensions, FileSizeLabelPipe, FileTypeIcons, FileTypes, FileUploadComponent, FileUploadErrorTypeEnum, FileUploadModule, FilterBarComponent, FilterBarModule, FilterWithHighlightModule, FilterWithHighlightPipe, FooterComponent, FooterModule, GlobalMessageComponent, HashHelper, HtmlElementParseHelper, HtmlHelper, IconService, InlineMessageComponent, InlineMessageIconPosition, InlineMessageModule, InlineMessageType, LAST_USED_SYSTEM_LOCAL_STORAGE_KEY, LLMActions, LLMComponent, LLMModule, LLM_CONFIGURATION_TOKEN, LOCALIZATION_CONFIGURATION_TOKEN, LanguageTranslateModule, LanguageTranslatePipe, LanguageTranslateService, MatButtonLoadingDirective, MatButtonLoadingModule, MatomoService, MissingTranslationHelper, MtCollectionStatus, MultiFunctionalTableComponent, MultiFunctionalTableModule, NewFeatureDialogWrapperComponent, NotificationMessageComponent, NotificationMessageModule, NotificationMessageType, NotificationService, OPEN_CLOSE_BTN_ICONS_TOKEN, ObjectLengthModule, ObjectLengthPipe, OpenCloseButtonComponent, OpenCloseButtonModule, OpenExtensionDialogComponent, Operations, PlausibleEventDirective, PlausibleHelper, PlausibleModule, ResolutionHelper, SCREEN_SIZE, SaveFileHelper, SelectLanguageDialogComponent, SidebarComponent, SidebarService, SortAlphabeticallyModule, SortAlphabeticallyPipe, SortByNumberPipe, SortDomainsPipe, SortHelper, SortLanguageListPipe, SortTranslationsByPropertyModule, SortTranslationsByPropertyPipe, SortTranslationsModule, SortTranslationsPipe, StatusDisplayComponent, StatusDisplayModule, SubscriptionComponent, SubscriptionPlan, SystemService, TerminologyApiService, TerminologyCollectionService, TerminologyComponent, TerminologyConfigService, TerminologyCreateCollectionComponent, TerminologyModule, TerminologyService, TextToSpeechComponent, TldLoaderComponent, TldLoaderModule, ToastComponent, ToastService, UILanguageService, USER_CONFIG_IFRAME_NAME, USER_CONFIG_IFRAME_TARGET_ORIGIN, USER_CONFIG_MESSAGE_REQUEST, USER_CONFIG_MESSAGE_SNAPSHOT, USER_CONFIG_MESSAGE_UPDATE, USER_CONFIG_OPTIONS, USER_CONFIG_STORAGE, USER_CONFIG_STORAGE_KEY, USER_CONFIG_VERSION, UserConfigStrategy, createMetadata, getFileSizeLabel, isUserConfigOptionsFactoryProvider, provideCustomTitleStrategy, provideLanguageService, provideUserConfig, userConfigStorageFactory };
10139
+ export { ALERT_CONFIGURATION_TOKEN, AccessibilityContrasts, AccessibilityDialogComponent, AccessibilityFontSizes, AccessibilityService, AccessibilityTextMagnifierService, AlertService, AnalyticsService, AuthHeadersHelper, COLLECTIONS_MENU, CUSTOM_TITLE_CONFIGURATION_TOKEN, ClickOutsideDirective, ClickOutsideModule, CloseButtonComponent, CloseButtonModule, CombinedCollection, CombinedCollectionTooltipKey, CompanyProductComponent, CompanyProductModule, Confirmation, ConfirmationModalComponent, ConfirmationModalModule, ConfirmationService, ConversionHelper, CookieConsentComponent, CustomPaginatorInernationalizationHelper, CustomTitleStrategyService, CustomTranslateLoader, CustomTranslateParseService, DEFAULT_ACCESSIBILITY_PREFERENCES, DEFAULT_COOKIE_CONSENT_PREFERENCES, DEFAULT_USER_CONFIG, DEFAULT_USER_CONFIG_IFRAME_URL, DEFAULT_USER_CONFIG_OPTIONS, DISABLE_EXPORT_ATTRIBUTE_NAME, DOMService, DateAgoModule, DateAgoPipe, DomainTranslatePipe, DragAndDropDirective, DragAndDropModule, ERROR_CODES, EngineTermApiService, EngineTermCollectionScope, EngineTermCollectionSource, EngineTermCollectionStatus, EngineTermCollectionSubStatus, ExpiresInPipe, ExportFormat, ExtensionDialogComponent, ExtensionDialogModule, ExtensionDialogService, FILE_SIZE_UNIT, FileCategories, FileExtensionHelper, FileExtensions, FileSizeLabelPipe, FileTypeIcons, FileTypes, FileUploadComponent, FileUploadErrorTypeEnum, FileUploadModule, FilterBarComponent, FilterBarModule, FilterWithHighlightModule, FilterWithHighlightPipe, FooterComponent, FooterModule, GlobalMessageComponent, HashHelper, HtmlElementParseHelper, HtmlHelper, IconService, InlineMessageComponent, InlineMessageIconPosition, InlineMessageModule, InlineMessageType, LAST_USED_SYSTEM_LOCAL_STORAGE_KEY, LLMActions, LLMComponent, LLMModule, LLM_CONFIGURATION_TOKEN, LOCALIZATION_CONFIGURATION_TOKEN, LanguageTranslateModule, LanguageTranslatePipe, LanguageTranslateService, MatButtonLoadingDirective, MatButtonLoadingModule, MatomoService, MissingTranslationHelper, MtCollectionStatus, MultiFunctionalTableComponent, MultiFunctionalTableModule, NewFeatureDialogWrapperComponent, NotificationMessageComponent, NotificationMessageModule, NotificationMessageType, NotificationService, OPEN_CLOSE_BTN_ICONS_TOKEN, ObjectLengthModule, ObjectLengthPipe, OpenCloseButtonComponent, OpenCloseButtonModule, OpenExtensionDialogComponent, Operations, PlausibleEventDirective, PlausibleHelper, PlausibleModule, ResolutionHelper, SCREEN_SIZE, SaveFileHelper, SelectLanguageDialogComponent, SidebarComponent, SidebarService, SortAlphabeticallyModule, SortAlphabeticallyPipe, SortByNumberPipe, SortDomainsPipe, SortHelper, SortLanguageListPipe, SortTranslationsByPropertyModule, SortTranslationsByPropertyPipe, SortTranslationsModule, SortTranslationsPipe, StatusDisplayComponent, StatusDisplayModule, SubscriptionComponent, SubscriptionPlan, SystemService, TerminologyApiService, TerminologyCollectionService, TerminologyComponent, TerminologyConfigService, TerminologyCreateCollectionComponent, TerminologyModule, TerminologyService, TextToSpeechComponent, TldLoaderComponent, TldLoaderModule, ToastComponent, ToastService, UILanguageService, USER_CONFIG_IFRAME_NAME, USER_CONFIG_IFRAME_TARGET_ORIGIN, USER_CONFIG_MESSAGE_REQUEST, USER_CONFIG_MESSAGE_SNAPSHOT, USER_CONFIG_MESSAGE_UPDATE, USER_CONFIG_OPTIONS, USER_CONFIG_STORAGE, USER_CONFIG_STORAGE_KEY, USER_CONFIG_VERSION, UserConfigStrategy, createMetadata, getFileSizeLabel, isUserConfigOptionsFactoryProvider, provideCustomTitleStrategy, provideLanguageService, provideUserConfig, userConfigStorageFactory };
10040
10140
  //# sourceMappingURL=tilde-nlp-ngx-common.mjs.map