{ "version": 3, "sources": ["src/app/shared/read-more/read-more.component.ts", "src/app/shared/read-more/read-more.component.html"], "sourcesContent": ["import {ChangeDetectionStrategy, ChangeDetectorRef, Component, inject, Input, OnChanges} from '@angular/core';\nimport {NgClass} from \"@angular/common\";\nimport {SafeHtmlPipe} from \"../../_pipes/safe-html.pipe\";\nimport {TranslocoDirective} from \"@jsverse/transloco\";\n\n@Component({\n selector: 'app-read-more',\n standalone: true,\n imports: [SafeHtmlPipe, TranslocoDirective, NgClass],\n templateUrl: './read-more.component.html',\n styleUrls: ['./read-more.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ReadMoreComponent implements OnChanges {\n private readonly cdRef = inject(ChangeDetectorRef);\n\n /**\n * String to apply read more on\n */\n @Input({required: true}) text!: string;\n /**\n * Max length before apply read more. Defaults to 250 characters.\n */\n @Input() maxLength: number = 250;\n /**\n * If the field is collapsed and blur true, text will not be readable\n */\n @Input() blur: boolean = false;\n /**\n * If the read more toggle is visible\n */\n @Input() showToggle: boolean = true;\n\n currentText!: string;\n hideToggle: boolean = true;\n isCollapsed: boolean = true;\n\n\n toggleView() {\n this.isCollapsed = !this.isCollapsed;\n this.determineView();\n }\n\n determineView() {\n const text = this.text ? this.text.replace(/\\n/g, '
') : '';\n\n if (!this.text || this.text.length <= this.maxLength) {\n this.currentText = text;\n this.isCollapsed = true;\n this.hideToggle = true;\n this.cdRef.markForCheck();\n return;\n }\n\n this.hideToggle = false;\n if (this.isCollapsed) {\n this.currentText = text.substring(0, this.maxLength);\n this.currentText = this.currentText.substring(0, Math.min(this.currentText.length, this.currentText.lastIndexOf(' ')));\n this.currentText = this.currentText + '…';\n } else if (!this.isCollapsed) {\n this.currentText = text;\n }\n\n this.cdRef.markForCheck();\n }\n ngOnChanges() {\n this.determineView();\n }\n}\n", "\n
\n
\n\n @if (text && text.length > maxLength && showToggle) {\n \n  \n  {{isCollapsed ? t('read-more') : t('read-less')}}\n \n }\n
\n
\n"], "mappings": "6ZCK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AA", "names": ["\u0275\u0275elementStart", "\u0275\u0275listener", "\u0275\u0275restoreView", "_r1", "ctx_r1", "\u0275\u0275nextContext", "\u0275\u0275resetView", "toggleView", "\u0275\u0275text", "\u0275\u0275element", "\u0275\u0275elementEnd", "\u0275\u0275classProp", "hideToggle", "\u0275\u0275advance", "\u0275\u0275property", "\u0275\u0275pureFunction2", "_c1", "isCollapsed", "\u0275\u0275textInterpolate1", "t_r3", "\u0275\u0275elementContainerStart", "\u0275\u0275template", "ReadMoreComponent_ng_container_0_Conditional_4_Template", "\u0275\u0275pipeBind1", "currentText", "\u0275\u0275sanitizeHtml", "\u0275\u0275pureFunction1", "_c0", "blur", "\u0275\u0275conditional", "text", "length", "maxLength", "showToggle", "ReadMoreComponent", "constructor", "cdRef", "inject", "ChangeDetectorRef", "determineView", "replace", "markForCheck", "substring", "Math", "min", "lastIndexOf", "ngOnChanges", "selectors", "inputs", "standalone", "features", "\u0275\u0275NgOnChangesFeature", "\u0275\u0275StandaloneFeature", "decls", "vars", "consts", "template", "rf", "ctx", "ReadMoreComponent_ng_container_0_Template", "SafeHtmlPipe", "TranslocoDirective", "NgClass", "styles", "changeDetection"] }