quang 20.3.1 → 20.3.2

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 (41) hide show
  1. package/fesm2022/quang-auth-mobile.mjs.map +1 -1
  2. package/fesm2022/quang-auth.mjs +25 -25
  3. package/fesm2022/quang-auth.mjs.map +1 -1
  4. package/fesm2022/quang-components-autocomplete.mjs +27 -27
  5. package/fesm2022/quang-components-autocomplete.mjs.map +1 -1
  6. package/fesm2022/quang-components-checkbox.mjs +7 -7
  7. package/fesm2022/quang-components-checkbox.mjs.map +1 -1
  8. package/fesm2022/quang-components-date.mjs +35 -35
  9. package/fesm2022/quang-components-date.mjs.map +1 -1
  10. package/fesm2022/quang-components-input.mjs +15 -15
  11. package/fesm2022/quang-components-input.mjs.map +1 -1
  12. package/fesm2022/quang-components-paginator.mjs +28 -28
  13. package/fesm2022/quang-components-paginator.mjs.map +1 -1
  14. package/fesm2022/quang-components-select.mjs +15 -15
  15. package/fesm2022/quang-components-select.mjs.map +1 -1
  16. package/fesm2022/quang-components-shared.mjs +55 -52
  17. package/fesm2022/quang-components-shared.mjs.map +1 -1
  18. package/fesm2022/quang-components-table.mjs +16 -16
  19. package/fesm2022/quang-components-table.mjs.map +1 -1
  20. package/fesm2022/quang-components-wysiwyg.mjs +32 -32
  21. package/fesm2022/quang-components-wysiwyg.mjs.map +1 -1
  22. package/fesm2022/quang-data-handling.mjs.map +1 -1
  23. package/fesm2022/quang-device.mjs +3 -3
  24. package/fesm2022/quang-device.mjs.map +1 -1
  25. package/fesm2022/quang-forms.mjs.map +1 -1
  26. package/fesm2022/quang-loader.mjs +8 -8
  27. package/fesm2022/quang-loader.mjs.map +1 -1
  28. package/fesm2022/quang-overlay-modal.mjs +21 -21
  29. package/fesm2022/quang-overlay-modal.mjs.map +1 -1
  30. package/fesm2022/quang-overlay-popover.mjs +12 -12
  31. package/fesm2022/quang-overlay-popover.mjs.map +1 -1
  32. package/fesm2022/quang-overlay-shared.mjs +33 -33
  33. package/fesm2022/quang-overlay-shared.mjs.map +1 -1
  34. package/fesm2022/quang-overlay-toast.mjs +11 -11
  35. package/fesm2022/quang-overlay-toast.mjs.map +1 -1
  36. package/fesm2022/quang-overlay-tooltip.mjs +13 -13
  37. package/fesm2022/quang-overlay-tooltip.mjs.map +1 -1
  38. package/fesm2022/quang-translation.mjs +6 -6
  39. package/fesm2022/quang-translation.mjs.map +1 -1
  40. package/fesm2022/quang.mjs.map +1 -1
  41. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"file":"quang-components-table.mjs","sources":["../../../projects/quang/components/table/table.component.ts","../../../projects/quang/components/table/table.component.html","../../../projects/quang/components/table/quang-components-table.ts"],"sourcesContent":["import { NgClass, NgTemplateOutlet } from '@angular/common'\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n TemplateRef,\n effect,\n inject,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core'\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'\n\nimport { TranslocoPipe } from '@jsverse/transloco'\nimport { ResizeObservableService } from 'quang/device'\nimport { Subscription } from 'rxjs'\n\nexport interface TableHeader {\n text?: string\n sort?: SortCol\n css?: string[]\n renderer?: TemplateRef<any>\n payload?: any\n}\n\nexport interface TableConfiguration<T> {\n headers: TableHeader[]\n rows: TableRow<T>[]\n}\n\nexport interface TableCell {\n renderer?: TemplateRef<any>\n payload?: any\n text?: string\n css?: string[]\n fullWidth?: boolean\n}\n\nexport interface TableRow<T> {\n payload?: T\n rowId?: string | number\n css?: string[]\n cellData: TableCell[]\n}\n\nexport enum SortTable {\n DEFAULT = 'DEFAULT',\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport interface SortCol {\n key: string\n sort: SortTable\n}\n\n@Component({\n selector: 'quang-table',\n templateUrl: './table.component.html',\n styleUrl: './table.component.scss',\n imports: [TranslocoPipe, NgClass, NgTemplateOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\n/**\n * Table component for displaying data in a tabular format.\n *\n * It supports customizable column cells template and sorting rows by column headers.\n *\n * @usageNotes\n * The component must be configured using the {@link TableConfiguration} object\n */\nexport class QuangTableComponent<T> {\n clickableRow = input<boolean>(false)\n\n selectedRows = input<string[] | number[]>()\n\n stickyTable = input<boolean>(true)\n\n selectedRow = output<TableRow<T>>()\n\n sortChanged = output<SortCol[]>()\n\n public SortTable = SortTable\n\n destroyRef = inject(DestroyRef)\n\n _resizeObservableService = inject(ResizeObservableService)\n\n _tableHeader = viewChild<ElementRef>('tableHeader')\n\n _tableHeaderElement = viewChild<Element>('tableHeader')\n\n noResultsText = input<string>('quangTable.noResults')\n\n _tableHeaderEffect = effect(() => {\n if (this._tableHeader()) {\n this.fixTableHeaderWidth()\n }\n })\n\n _tableHeaderElementEffect = effect(() => {\n if (this._tableHeaderElement()) {\n this.fixTableHeaderWidth()\n }\n })\n\n _fakeTableHeader = viewChild<ElementRef>('fakeTableHeader')\n\n _fakeTableHeaderEffect = effect(() => {\n if (this._fakeTableHeader()) {\n this.fixTableHeaderWidth()\n }\n })\n\n tableConfigurations = input.required<TableConfiguration<T>>()\n\n _tableConfigurations = signal<TableConfiguration<T>>({\n headers: [],\n rows: [],\n })\n\n tableConfigurations$ = toObservable(this.tableConfigurations)\n .pipe(takeUntilDestroyed())\n .subscribe((data) => {\n const headers: TableHeader[] = []\n const rows: TableRow<T>[] = []\n for (const header of data.headers) {\n headers.push({ ...header })\n }\n for (const row of data.rows) {\n rows.push({ ...row })\n }\n this._tableConfigurations.set({\n headers,\n rows,\n })\n })\n\n effectTableConfigurations = effect(() => {\n if (this._tableConfigurations()) {\n this.fixTableHeaderWidth()\n }\n })\n\n hiddenColumnsObservable?: Subscription = undefined\n\n onClickRow(row: TableRow<T>): void {\n if (this.clickableRow()) {\n this.selectedRow.emit(row)\n }\n }\n\n isSelected(rowId: string | number): boolean {\n return !!this.selectedRows()?.some((x) => x === rowId)\n }\n\n lastWidth = -1\n\n fixTableHeaderWidth() {\n setTimeout(() => {\n const stickyColumns = this._tableHeader()?.nativeElement?.querySelectorAll('th')\n\n // Copy the column widths from our hidden Primary table header to our Sticky Table header.\n const hiddenColumns = this._fakeTableHeader()?.nativeElement?.querySelectorAll('th')\n\n if (stickyColumns?.length > 0 && hiddenColumns?.length > 0) {\n if (this.hiddenColumnsObservable) {\n this.hiddenColumnsObservable.unsubscribe()\n }\n this.hiddenColumnsObservable = this._resizeObservableService\n .widthResizeObservable(hiddenColumns[0])\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((data) => {\n if (data !== this.lastWidth) {\n this.lastWidth = data\n this.fixTableHeaderWidth()\n }\n })\n for (let i = 0; i < hiddenColumns?.length; i++) {\n const th = hiddenColumns[i]\n // Since the Sticky Table header is expected to be an exact copy of the Primary Table, we know their indices will be the same.\n stickyColumns[i].style.minWidth = `${th.offsetWidth}px`\n stickyColumns[i].style.maxWidth = `${th.offsetWidth}px`\n }\n }\n })\n }\n\n onSortColumn(sort: SortCol): void {\n const tableHeaders: TableHeader[] = []\n for (const header of this._tableConfigurations().headers) {\n tableHeaders.push({\n ...header,\n })\n }\n tableHeaders.forEach((header) => {\n if (!header.sort?.key) return\n\n if (header.sort?.key === sort.key) {\n switch (sort.sort) {\n case SortTable.ASC:\n header.sort.sort = SortTable.DESC\n break\n case SortTable.DESC:\n header.sort.sort = SortTable.DEFAULT\n break\n case SortTable.DEFAULT:\n default:\n header.sort.sort = SortTable.ASC\n break\n }\n } else {\n header.sort = {\n ...header.sort,\n sort: SortTable.DEFAULT,\n }\n }\n })\n this._tableConfigurations.set({ ...this._tableConfigurations(), headers: tableHeaders })\n this.sortChanged.emit([sort]) // it's an array to handle multisort in the future\n }\n}\n","<div\n [class.sticky-table]=\"stickyTable()\"\n class=\"table-responsive\"\n>\n @if (_tableConfigurations().rows.length) {\n <div\n (scroll)=\"tableContainer.scrollLeft = tableHeaderContainer.scrollLeft\"\n #tableHeaderContainer\n class=\"table-header-container\"\n id=\"tableHeaderContainer\"\n >\n <table\n #tableHeader\n id=\"tableHeader\"\n >\n <thead>\n <tr>\n @for (header of _tableConfigurations().headers; track $index) {\n <th\n [class.sort-btn]=\"header?.sort\"\n (click)=\"header?.sort ? onSortColumn(header.sort!) : null\"\n class=\"align-bottom\"\n >\n <div\n [ngClass]=\"header?.css\"\n class=\"align-self-end d-flex gap-1\"\n >\n {{ !header.renderer ? (header.text | transloco) : null }}\n <ng-container\n [ngTemplateOutlet]=\"header?.renderer ?? null\"\n [ngTemplateOutletContext]=\"{\n $implicit: header.payload,\n }\"\n ></ng-container>\n @if (header.sort?.key) {\n <div class=\"d-flex justify-content-between\">\n <ng-container\n [ngTemplateOutlet]=\"orderBtns\"\n [ngTemplateOutletContext]=\"{ $implicit: header.sort }\"\n ></ng-container>\n </div>\n }\n </div>\n </th>\n }\n </tr>\n </thead>\n </table>\n </div>\n <div\n (scroll)=\"tableHeaderContainer.scrollLeft = tableContainer.scrollLeft\"\n #tableContainer\n class=\"table-container\"\n >\n <table\n class=\"table\"\n id=\"table-content\"\n >\n <thead\n #fakeTableHeader\n class=\"fake-table-header\"\n id=\"fakeTableHeader\"\n >\n <tr>\n @for (header of _tableConfigurations().headers; track $index) {\n <th\n [class.sort-btn]=\"header?.sort\"\n (click)=\"header?.sort ? onSortColumn(header.sort!) : null\"\n class=\"align-bottom\"\n >\n <div\n [ngClass]=\"header?.css\"\n class=\"align-self-end d-flex gap-1\"\n >\n {{ !header.renderer ? (header.text | transloco) : null }}\n <ng-container\n [ngTemplateOutlet]=\"header?.renderer ?? null\"\n [ngTemplateOutletContext]=\"{\n $implicit: header.payload,\n }\"\n ></ng-container>\n @if (header.sort?.key) {\n <div class=\"d-flex justify-content-between\">\n <ng-container\n [ngTemplateOutlet]=\"orderBtns\"\n [ngTemplateOutletContext]=\"{ $implicit: header.sort }\"\n ></ng-container>\n </div>\n }\n </div>\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of _tableConfigurations().rows; track $index) {\n <tr\n [class.hover-table]=\"clickableRow()\"\n [class.selectedRow]=\"row?.rowId ? isSelected(row.rowId!) : null\"\n [ngClass]=\"row.css\"\n (click)=\"clickableRow() ? onClickRow(row) : null\"\n >\n @for (cell of row.cellData; track $index) {\n <td\n [attr.colspan]=\"cell?.fullWidth ? _tableConfigurations().headers.length : undefined\"\n [ngClass]=\"cell.css!\"\n >\n {{ !cell.renderer ? cell.text : null }}\n <ng-container\n [ngTemplateOutlet]=\"cell?.renderer ?? null\"\n [ngTemplateOutletContext]=\"{\n $implicit: cell.payload,\n }\"\n ></ng-container>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n @if (!_tableConfigurations().rows.length) {\n <h6 class=\"text-center mt-3\">\n {{ noResultsText() | transloco }}\n </h6>\n }\n</div>\n\n<ng-template\n #orderBtns\n let-order\n>\n <div\n [class.sort-asc]=\"order.sort === SortTable.ASC\"\n [class.sort-default]=\"order.sort === SortTable.DEFAULT\"\n [class.sort-desc]=\"order.sort === SortTable.DESC\"\n class=\"sort-arrows\"\n >\n <svg\n class=\"arrow-up\"\n fill=\"currentColor\"\n height=\"10\"\n stroke=\"currentColor\"\n viewBox=\"279.5 -600.5 401 201\"\n width=\"10\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"m280-400 200-200 200 200H280Z\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n ></path>\n </svg>\n <svg\n class=\"arrow-down\"\n fill=\"currentColor\"\n height=\"10\"\n stroke=\"currentColor\"\n viewBox=\"279.5 -560.5 401 201\"\n width=\"10\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M480-360 280-560h400L480-360Z\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n ></path>\n </svg>\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;IAgDY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,C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CAAC;QACxF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;;8GApJpB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAnB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,mBAAmB,qtCC1EhC,u7KA2KA,EAAA,MAAA,EAAA,CAAA,g8DAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,ED5GY,aAAa,EAAE,IAAA,EAAA,WAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,OAAO,oFAAE,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAWvC,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAf/B,SAAS;+BACE,aAAa,EAAA,OAAA,EAGd,CAAC,aAAa,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAA,eAAA,EAClC,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,u7KAAA,EAAA,MAAA,EAAA,CAAA,g8DAAA,CAAA,EAAA;;;AEhEjD;;AAEG;;;;"}
1
+ {"version":3,"file":"quang-components-table.mjs","sources":["../../../projects/quang/components/table/table.component.ts","../../../projects/quang/components/table/table.component.html","../../../projects/quang/components/table/quang-components-table.ts"],"sourcesContent":["import { NgClass, NgTemplateOutlet } from '@angular/common'\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n TemplateRef,\n effect,\n inject,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core'\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'\n\nimport { TranslocoPipe } from '@jsverse/transloco'\nimport { ResizeObservableService } from 'quang/device'\nimport { Subscription } from 'rxjs'\n\nexport interface TableHeader {\n text?: string\n sort?: SortCol\n css?: string[]\n renderer?: TemplateRef<any>\n payload?: any\n}\n\nexport interface TableConfiguration<T> {\n headers: TableHeader[]\n rows: TableRow<T>[]\n}\n\nexport interface TableCell {\n renderer?: TemplateRef<any>\n payload?: any\n text?: string\n css?: string[]\n fullWidth?: boolean\n}\n\nexport interface TableRow<T> {\n payload?: T\n rowId?: string | number\n css?: string[]\n cellData: TableCell[]\n}\n\nexport enum SortTable {\n DEFAULT = 'DEFAULT',\n ASC = 'ASC',\n DESC = 'DESC',\n}\n\nexport interface SortCol {\n key: string\n sort: SortTable\n}\n\n@Component({\n selector: 'quang-table',\n templateUrl: './table.component.html',\n styleUrl: './table.component.scss',\n imports: [TranslocoPipe, NgClass, NgTemplateOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\n/**\n * Table component for displaying data in a tabular format.\n *\n * It supports customizable column cells template and sorting rows by column headers.\n *\n * @usageNotes\n * The component must be configured using the {@link TableConfiguration} object\n */\nexport class QuangTableComponent<T> {\n clickableRow = input<boolean>(false)\n\n selectedRows = input<string[] | number[]>()\n\n stickyTable = input<boolean>(true)\n\n selectedRow = output<TableRow<T>>()\n\n sortChanged = output<SortCol[]>()\n\n public SortTable = SortTable\n\n destroyRef = inject(DestroyRef)\n\n _resizeObservableService = inject(ResizeObservableService)\n\n _tableHeader = viewChild<ElementRef>('tableHeader')\n\n _tableHeaderElement = viewChild<Element>('tableHeader')\n\n noResultsText = input<string>('quangTable.noResults')\n\n _tableHeaderEffect = effect(() => {\n if (this._tableHeader()) {\n this.fixTableHeaderWidth()\n }\n })\n\n _tableHeaderElementEffect = effect(() => {\n if (this._tableHeaderElement()) {\n this.fixTableHeaderWidth()\n }\n })\n\n _fakeTableHeader = viewChild<ElementRef>('fakeTableHeader')\n\n _fakeTableHeaderEffect = effect(() => {\n if (this._fakeTableHeader()) {\n this.fixTableHeaderWidth()\n }\n })\n\n tableConfigurations = input.required<TableConfiguration<T>>()\n\n _tableConfigurations = signal<TableConfiguration<T>>({\n headers: [],\n rows: [],\n })\n\n tableConfigurations$ = toObservable(this.tableConfigurations)\n .pipe(takeUntilDestroyed())\n .subscribe((data) => {\n const headers: TableHeader[] = []\n const rows: TableRow<T>[] = []\n for (const header of data.headers) {\n headers.push({ ...header })\n }\n for (const row of data.rows) {\n rows.push({ ...row })\n }\n this._tableConfigurations.set({\n headers,\n rows,\n })\n })\n\n effectTableConfigurations = effect(() => {\n if (this._tableConfigurations()) {\n this.fixTableHeaderWidth()\n }\n })\n\n hiddenColumnsObservable?: Subscription = undefined\n\n onClickRow(row: TableRow<T>): void {\n if (this.clickableRow()) {\n this.selectedRow.emit(row)\n }\n }\n\n isSelected(rowId: string | number): boolean {\n return !!this.selectedRows()?.some((x) => x === rowId)\n }\n\n lastWidth = -1\n\n fixTableHeaderWidth() {\n setTimeout(() => {\n const stickyColumns = this._tableHeader()?.nativeElement?.querySelectorAll('th')\n\n // Copy the column widths from our hidden Primary table header to our Sticky Table header.\n const hiddenColumns = this._fakeTableHeader()?.nativeElement?.querySelectorAll('th')\n\n if (stickyColumns?.length > 0 && hiddenColumns?.length > 0) {\n if (this.hiddenColumnsObservable) {\n this.hiddenColumnsObservable.unsubscribe()\n }\n this.hiddenColumnsObservable = this._resizeObservableService\n .widthResizeObservable(hiddenColumns[0])\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((data) => {\n if (data !== this.lastWidth) {\n this.lastWidth = data\n this.fixTableHeaderWidth()\n }\n })\n for (let i = 0; i < hiddenColumns?.length; i++) {\n const th = hiddenColumns[i]\n // Since the Sticky Table header is expected to be an exact copy of the Primary Table, we know their indices will be the same.\n stickyColumns[i].style.minWidth = `${th.offsetWidth}px`\n stickyColumns[i].style.maxWidth = `${th.offsetWidth}px`\n }\n }\n })\n }\n\n onSortColumn(sort: SortCol): void {\n const tableHeaders: TableHeader[] = []\n for (const header of this._tableConfigurations().headers) {\n tableHeaders.push({\n ...header,\n })\n }\n tableHeaders.forEach((header) => {\n if (!header.sort?.key) return\n\n if (header.sort?.key === sort.key) {\n switch (sort.sort) {\n case SortTable.ASC:\n header.sort.sort = SortTable.DESC\n break\n case SortTable.DESC:\n header.sort.sort = SortTable.DEFAULT\n break\n case SortTable.DEFAULT:\n default:\n header.sort.sort = SortTable.ASC\n break\n }\n } else {\n header.sort = {\n ...header.sort,\n sort: SortTable.DEFAULT,\n }\n }\n })\n this._tableConfigurations.set({ ...this._tableConfigurations(), headers: tableHeaders })\n this.sortChanged.emit([sort]) // it's an array to handle multisort in the future\n }\n}\n","<div\n [class.sticky-table]=\"stickyTable()\"\n class=\"table-responsive\"\n>\n @if (_tableConfigurations().rows.length) {\n <div\n (scroll)=\"tableContainer.scrollLeft = tableHeaderContainer.scrollLeft\"\n #tableHeaderContainer\n class=\"table-header-container\"\n id=\"tableHeaderContainer\"\n >\n <table\n #tableHeader\n id=\"tableHeader\"\n >\n <thead>\n <tr>\n @for (header of _tableConfigurations().headers; track $index) {\n <th\n [class.sort-btn]=\"header?.sort\"\n (click)=\"header?.sort ? onSortColumn(header.sort!) : null\"\n class=\"align-bottom\"\n >\n <div\n [ngClass]=\"header?.css\"\n class=\"align-self-end d-flex gap-1\"\n >\n {{ !header.renderer ? (header.text | transloco) : null }}\n <ng-container\n [ngTemplateOutlet]=\"header?.renderer ?? null\"\n [ngTemplateOutletContext]=\"{\n $implicit: header.payload,\n }\"\n ></ng-container>\n @if (header.sort?.key) {\n <div class=\"d-flex justify-content-between\">\n <ng-container\n [ngTemplateOutlet]=\"orderBtns\"\n [ngTemplateOutletContext]=\"{ $implicit: header.sort }\"\n ></ng-container>\n </div>\n }\n </div>\n </th>\n }\n </tr>\n </thead>\n </table>\n </div>\n <div\n (scroll)=\"tableHeaderContainer.scrollLeft = tableContainer.scrollLeft\"\n #tableContainer\n class=\"table-container\"\n >\n <table\n class=\"table\"\n id=\"table-content\"\n >\n <thead\n #fakeTableHeader\n class=\"fake-table-header\"\n id=\"fakeTableHeader\"\n >\n <tr>\n @for (header of _tableConfigurations().headers; track $index) {\n <th\n [class.sort-btn]=\"header?.sort\"\n (click)=\"header?.sort ? onSortColumn(header.sort!) : null\"\n class=\"align-bottom\"\n >\n <div\n [ngClass]=\"header?.css\"\n class=\"align-self-end d-flex gap-1\"\n >\n {{ !header.renderer ? (header.text | transloco) : null }}\n <ng-container\n [ngTemplateOutlet]=\"header?.renderer ?? null\"\n [ngTemplateOutletContext]=\"{\n $implicit: header.payload,\n }\"\n ></ng-container>\n @if (header.sort?.key) {\n <div class=\"d-flex justify-content-between\">\n <ng-container\n [ngTemplateOutlet]=\"orderBtns\"\n [ngTemplateOutletContext]=\"{ $implicit: header.sort }\"\n ></ng-container>\n </div>\n }\n </div>\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of _tableConfigurations().rows; track $index) {\n <tr\n [class.hover-table]=\"clickableRow()\"\n [class.selectedRow]=\"row?.rowId ? isSelected(row.rowId!) : null\"\n [ngClass]=\"row.css\"\n (click)=\"clickableRow() ? onClickRow(row) : null\"\n >\n @for (cell of row.cellData; track $index) {\n <td\n [attr.colspan]=\"cell?.fullWidth ? _tableConfigurations().headers.length : undefined\"\n [ngClass]=\"cell.css!\"\n >\n {{ !cell.renderer ? cell.text : null }}\n <ng-container\n [ngTemplateOutlet]=\"cell?.renderer ?? null\"\n [ngTemplateOutletContext]=\"{\n $implicit: cell.payload,\n }\"\n ></ng-container>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n @if (!_tableConfigurations().rows.length) {\n <h6 class=\"text-center mt-3\">\n {{ noResultsText() | transloco }}\n </h6>\n }\n</div>\n\n<ng-template\n #orderBtns\n let-order\n>\n <div\n [class.sort-asc]=\"order.sort === SortTable.ASC\"\n [class.sort-default]=\"order.sort === SortTable.DEFAULT\"\n [class.sort-desc]=\"order.sort === SortTable.DESC\"\n class=\"sort-arrows\"\n >\n <svg\n class=\"arrow-up\"\n fill=\"currentColor\"\n height=\"10\"\n stroke=\"currentColor\"\n viewBox=\"279.5 -600.5 401 201\"\n width=\"10\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"m280-400 200-200 200 200H280Z\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n ></path>\n </svg>\n <svg\n class=\"arrow-down\"\n fill=\"currentColor\"\n height=\"10\"\n stroke=\"currentColor\"\n viewBox=\"279.5 -560.5 401 201\"\n width=\"10\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M480-360 280-560h400L480-360Z\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n ></path>\n </svg>\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;IAgDY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,SAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACf,CAAC,EAJW,SAAS,KAAT,SAAS,GAAA,EAAA,CAAA,CAAA;AAkBrB;;;;;;;AAOG;MACU,mBAAmB,CAAA;AAfhC,IAAA,WAAA,GAAA;AAgBE,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAU,KAAK,wDAAC;QAEpC,IAAA,CAAA,YAAY,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,cAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAuB;AAE3C,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAU,IAAI,uDAAC;QAElC,IAAA,CAAA,WAAW,GAAG,MAAM,EAAe;QAEnC,I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AA,g8DAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,ED5G2B,OAAO,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,gBAAgB,+IAAxC,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAWZ,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAf/B,SAAS;+BACE,aAAa,EAAA,OAAA,EAGd,CAAC,aAAa,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAA,eAAA,EAClC,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,u7KAAA,EAAA,MAAA,EAAA,CAAA,g8DAAA,CAAA,EAAA;;;AEhEjD;;AAEG;;;;"}
@@ -25,34 +25,34 @@ import { QuangBaseComponent } from 'quang/components/shared';
25
25
  class QuangWysiwygComponent extends QuangBaseComponent {
26
26
  constructor() {
27
27
  super(...arguments);
28
- this._inputForWysiwyg = viewChild('inputForWysiwyg');
29
- this.minHeight = input('200px');
30
- this.font = input(true);
31
- this.fontSize = input(true);
32
- this.formatBlock = input(true);
33
- this.paragraphStyle = input(true);
34
- this.blockquote = input(true);
35
- this.bold = input(true);
36
- this.underline = input(true);
37
- this.italic = input(true);
38
- this.strike = input(true);
39
- this.fontColor = input(true);
40
- this.highlightColor = input(true);
41
- this.textStyle = input(true);
42
- this.removeFormat = input(true);
43
- this.align = input(true);
44
- this.list = input(true);
45
- this.table = input(true);
46
- this.link = input(true);
47
- this.image = input(true);
48
- this.fullScreen = input(true);
49
- this.showBlocks = input(true);
50
- this.onImageUploadError = input();
51
- this.onFileDrop = input();
52
- this.wysiwygOptions = input(undefined);
53
- this._sunEditorWysiwygInstance = signal(undefined);
28
+ this._inputForWysiwyg = viewChild('inputForWysiwyg', ...(ngDevMode ? [{ debugName: "_inputForWysiwyg" }] : []));
29
+ this.minHeight = input('200px', ...(ngDevMode ? [{ debugName: "minHeight" }] : []));
30
+ this.font = input(true, ...(ngDevMode ? [{ debugName: "font" }] : []));
31
+ this.fontSize = input(true, ...(ngDevMode ? [{ debugName: "fontSize" }] : []));
32
+ this.formatBlock = input(true, ...(ngDevMode ? [{ debugName: "formatBlock" }] : []));
33
+ this.paragraphStyle = input(true, ...(ngDevMode ? [{ debugName: "paragraphStyle" }] : []));
34
+ this.blockquote = input(true, ...(ngDevMode ? [{ debugName: "blockquote" }] : []));
35
+ this.bold = input(true, ...(ngDevMode ? [{ debugName: "bold" }] : []));
36
+ this.underline = input(true, ...(ngDevMode ? [{ debugName: "underline" }] : []));
37
+ this.italic = input(true, ...(ngDevMode ? [{ debugName: "italic" }] : []));
38
+ this.strike = input(true, ...(ngDevMode ? [{ debugName: "strike" }] : []));
39
+ this.fontColor = input(true, ...(ngDevMode ? [{ debugName: "fontColor" }] : []));
40
+ this.highlightColor = input(true, ...(ngDevMode ? [{ debugName: "highlightColor" }] : []));
41
+ this.textStyle = input(true, ...(ngDevMode ? [{ debugName: "textStyle" }] : []));
42
+ this.removeFormat = input(true, ...(ngDevMode ? [{ debugName: "removeFormat" }] : []));
43
+ this.align = input(true, ...(ngDevMode ? [{ debugName: "align" }] : []));
44
+ this.list = input(true, ...(ngDevMode ? [{ debugName: "list" }] : []));
45
+ this.table = input(true, ...(ngDevMode ? [{ debugName: "table" }] : []));
46
+ this.link = input(true, ...(ngDevMode ? [{ debugName: "link" }] : []));
47
+ this.image = input(true, ...(ngDevMode ? [{ debugName: "image" }] : []));
48
+ this.fullScreen = input(true, ...(ngDevMode ? [{ debugName: "fullScreen" }] : []));
49
+ this.showBlocks = input(true, ...(ngDevMode ? [{ debugName: "showBlocks" }] : []));
50
+ this.onImageUploadError = input(...(ngDevMode ? [undefined, { debugName: "onImageUploadError" }] : []));
51
+ this.onFileDrop = input(...(ngDevMode ? [undefined, { debugName: "onFileDrop" }] : []));
52
+ this.wysiwygOptions = input(undefined, ...(ngDevMode ? [{ debugName: "wysiwygOptions" }] : []));
53
+ this._sunEditorWysiwygInstance = signal(undefined, ...(ngDevMode ? [{ debugName: "_sunEditorWysiwygInstance" }] : []));
54
54
  this._sunEditorWysiwygInstance$ = toObservable(this._sunEditorWysiwygInstance);
55
- this.changeDetectorRef = signal(inject(ChangeDetectorRef));
55
+ this.changeDetectorRef = signal(inject(ChangeDetectorRef), ...(ngDevMode ? [{ debugName: "changeDetectorRef" }] : []));
56
56
  this._generateSunEditorWysiwygEffect = effect(() => {
57
57
  try {
58
58
  const inputForWysiwyg = this._inputForWysiwyg()?.nativeElement;
@@ -91,7 +91,7 @@ class QuangWysiwygComponent extends QuangBaseComponent {
91
91
  catch (_) {
92
92
  // we usually end up here when we are in a modal and then it starts in the right way
93
93
  }
94
- });
94
+ }, ...(ngDevMode ? [{ debugName: "_generateSunEditorWysiwygEffect" }] : []));
95
95
  this.STRIP_HTML_REGEX = /<[^>]*>/g;
96
96
  }
97
97
  registerEvents() {
@@ -202,16 +202,16 @@ class QuangWysiwygComponent extends QuangBaseComponent {
202
202
  }
203
203
  return buttonList;
204
204
  }
205
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: QuangWysiwygComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
206
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: QuangWysiwygComponent, isStandalone: true, selector: "quang-wysiwyg", inputs: { minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, font: { classPropertyName: "font", publicName: "font", isSignal: true, isRequired: false, transformFunction: null }, fontSize: { classPropertyName: "fontSize", publicName: "fontSize", isSignal: true, isRequired: false, transformFunction: null }, formatBlock: { classPropertyName: "formatBlock", publicName: "formatBlock", isSignal: true, isRequired: false, transformFunction: null }, paragraphStyle: { classPropertyName: "paragraphStyle", publicName: "paragraphStyle", isSignal: true, isRequired: false, transformFunction: null }, blockquote: { classPropertyName: "blockquote", publicName: "blockquote", isSignal: true, isRequired: false, transformFunction: null }, bold: { classPropertyName: "bold", publicName: "bold", isSignal: true, isRequired: false, transformFunction: null }, underline: { classPropertyName: "underline", publicName: "underline", isSignal: true, isRequired: false, transformFunction: null }, italic: { classPropertyName: "italic", publicName: "italic", isSignal: true, isRequired: false, transformFunction: null }, strike: { classPropertyName: "strike", publicName: "strike", isSignal: true, isRequired: false, transformFunction: null }, fontColor: { classPropertyName: "fontColor", publicName: "fontColor", isSignal: true, isRequired: false, transformFunction: null }, highlightColor: { classPropertyName: "highlightColor", publicName: "highlightColor", isSignal: true, isRequired: false, transformFunction: null }, textStyle: { classPropertyName: "textStyle", publicName: "textStyle", isSignal: true, isRequired: false, transformFunction: null }, removeFormat: { classPropertyName: "removeFormat", publicName: "removeFormat", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, list: { classPropertyName: "list", publicName: "list", isSignal: true, isRequired: false, transformFunction: null }, table: { classPropertyName: "table", publicName: "table", isSignal: true, isRequired: false, transformFunction: null }, link: { classPropertyName: "link", publicName: "link", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, fullScreen: { classPropertyName: "fullScreen", publicName: "fullScreen", isSignal: true, isRequired: false, transformFunction: null }, showBlocks: { classPropertyName: "showBlocks", publicName: "showBlocks", isSignal: true, isRequired: false, transformFunction: null }, onImageUploadError: { classPropertyName: "onImageUploadError", publicName: "onImageUploadError", isSignal: true, isRequired: false, transformFunction: null }, onFileDrop: { classPropertyName: "onFileDrop", publicName: "onFileDrop", isSignal: true, isRequired: false, transformFunction: null }, wysiwygOptions: { classPropertyName: "wysiwygOptions", publicName: "wysiwygOptions", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
205
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: QuangWysiwygComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
206
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.7", type: QuangWysiwygComponent, isStandalone: true, selector: "quang-wysiwyg", inputs: { minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, font: { classPropertyName: "font", publicName: "font", isSignal: true, isRequired: false, transformFunction: null }, fontSize: { classPropertyName: "fontSize", publicName: "fontSize", isSignal: true, isRequired: false, transformFunction: null }, formatBlock: { classPropertyName: "formatBlock", publicName: "formatBlock", isSignal: true, isRequired: false, transformFunction: null }, paragraphStyle: { classPropertyName: "paragraphStyle", publicName: "paragraphStyle", isSignal: true, isRequired: false, transformFunction: null }, blockquote: { classPropertyName: "blockquote", publicName: "blockquote", isSignal: true, isRequired: false, transformFunction: null }, bold: { classPropertyName: "bold", publicName: "bold", isSignal: true, isRequired: false, transformFunction: null }, underline: { classPropertyName: "underline", publicName: "underline", isSignal: true, isRequired: false, transformFunction: null }, italic: { classPropertyName: "italic", publicName: "italic", isSignal: true, isRequired: false, transformFunction: null }, strike: { classPropertyName: "strike", publicName: "strike", isSignal: true, isRequired: false, transformFunction: null }, fontColor: { classPropertyName: "fontColor", publicName: "fontColor", isSignal: true, isRequired: false, transformFunction: null }, highlightColor: { classPropertyName: "highlightColor", publicName: "highlightColor", isSignal: true, isRequired: false, transformFunction: null }, textStyle: { classPropertyName: "textStyle", publicName: "textStyle", isSignal: true, isRequired: false, transformFunction: null }, removeFormat: { classPropertyName: "removeFormat", publicName: "removeFormat", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, list: { classPropertyName: "list", publicName: "list", isSignal: true, isRequired: false, transformFunction: null }, table: { classPropertyName: "table", publicName: "table", isSignal: true, isRequired: false, transformFunction: null }, link: { classPropertyName: "link", publicName: "link", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, fullScreen: { classPropertyName: "fullScreen", publicName: "fullScreen", isSignal: true, isRequired: false, transformFunction: null }, showBlocks: { classPropertyName: "showBlocks", publicName: "showBlocks", isSignal: true, isRequired: false, transformFunction: null }, onImageUploadError: { classPropertyName: "onImageUploadError", publicName: "onImageUploadError", isSignal: true, isRequired: false, transformFunction: null }, onFileDrop: { classPropertyName: "onFileDrop", publicName: "onFileDrop", isSignal: true, isRequired: false, transformFunction: null }, wysiwygOptions: { classPropertyName: "wysiwygOptions", publicName: "wysiwygOptions", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
207
207
  {
208
208
  provide: NG_VALUE_ACCESSOR,
209
209
  useExisting: forwardRef(() => QuangWysiwygComponent),
210
210
  multi: true,
211
211
  },
212
- ], viewQueries: [{ propertyName: "_inputForWysiwyg", first: true, predicate: ["inputForWysiwyg"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"mb-3\">\n @if (componentLabel()) {\n <label\n [htmlFor]=\"componentId()\"\n class=\"form-label d-flex gap-2\"\n >\n <div>\n <span>{{ componentLabel() | transloco }}</span>\n <span [hidden]=\"!_isRequired()\">*</span>\n </div>\n @if (helpMessage() && helpMessageTooltip()) {\n <div [quangTooltip]=\"helpMessage() | transloco\">\n <ng-content select=\"[help-icon]\" />\n </div>\n }\n </label>\n }\n <div\n [class.is-invalid]=\"_showErrors()\"\n [class.is-valid]=\"_showSuccess()\"\n class=\"input-wysiwyg-container is-invalid\"\n >\n <textarea\n [disabled]=\"_isDisabled()\"\n [id]=\"componentId()\"\n [ngClass]=\"componentClass()\"\n [placeholder]=\"componentPlaceholder() | transloco\"\n [readOnly]=\"isReadonly()\"\n [tabIndex]=\"componentTabIndex()\"\n [value]=\"_value()\"\n #inputForWysiwyg\n class=\"form-control\"\n ></textarea>\n </div>\n <div class=\"valid-feedback\">\n {{ successMessage() | transloco }}\n </div>\n <div class=\"invalid-feedback\">\n {{ _currentErrorMessage() | transloco: _currentErrorMessageExtraData() }}\n </div>\n @if (helpMessage() && !helpMessageTooltip()) {\n <small\n [hidden]=\"_showSuccess() || _showErrors()\"\n aria-live=\"assertive\"\n class=\"form-text text-muted\"\n >\n {{ helpMessage() | transloco }}\n </small>\n }\n</div>\n", styles: [":host{display:block}::ng-deep .se-toolbar{color:var(--bs-body-color)!important;background-color:var(--bs-body-bg)!important;z-index:unset!important}::ng-deep .se-wrapper-inner{color:var(--bs-body-color)!important;background-color:var(--bs-body-bg)!important}::ng-deep .se-btn{color:var(--bs-body-color)!important}::ng-deep .se-btn:enabled.active{color:var(--bs-primary)!important}::ng-deep .se-btn:hover{background-color:var(--bs-secondary-bg)!important}::ng-deep .se-resizing-bar{color:var(--bs-body-color)!important;background-color:var(--bs-body-bg)!important}::ng-deep .se-navigation{color:var(--bs-body-color)!important;background-color:var(--bs-body-bg)!important}::ng-deep .sun-editor input{display:none}::ng-deep .sun-editor .se-container{border-radius:var(--bs-border-radius)}::ng-deep .se-wrapper{z-index:unset!important}::ng-deep .se-wrapper textarea:disabled+.se-wrapper-wysiwyg{background-color:var(--bs-secondary-bg)}::ng-deep .se-wrapper .se-wrapper-inner{border-top:1px solid var(--bs-border-color)}::ng-deep .is-invalid .sun-editor .se-container .se-toolbar{border-bottom:1px solid var(--bs-danger)}::ng-deep .is-invalid .sun-editor .se-container .se-wrapper .se-wrapper-inner{--bs-form-bg-icon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e\");border:1px solid var(--bs-danger);padding-right:3rem;background-position:right .75rem center,center right 2.25rem;background-size:1.5rem,calc(.75em + .375rem) calc(.75em + .375rem);background-image:var(--bs-form-bg-icon);background-repeat:no-repeat}::ng-deep .is-valid .sun-editor .se-container .se-toolbar{border-bottom:1px solid var(--bs-success)}::ng-deep .is-valid .sun-editor .se-container .se-wrapper .se-wrapper-inner{--bs-form-bg-icon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e\");border:1px solid var(--bs-success);padding-right:3rem;background-position:right .75rem center,center right 2.25rem;background-size:1.5rem,calc(.75em + .375rem) calc(.75em + .375rem);background-image:var(--bs-form-bg-icon);background-repeat:no-repeat}\n"], dependencies: [{ kind: "pipe", type: TranslocoPipe, name: "transloco" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: QuangTooltipDirective, selector: "[quangTooltip]", inputs: ["quangTooltip", "showMethod"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
212
+ ], viewQueries: [{ propertyName: "_inputForWysiwyg", first: true, predicate: ["inputForWysiwyg"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"mb-3\">\n @if (componentLabel()) {\n <label\n [htmlFor]=\"componentId()\"\n class=\"form-label d-flex gap-2\"\n >\n <div>\n <span>{{ componentLabel() | transloco }}</span>\n <span [hidden]=\"!_isRequired()\">*</span>\n </div>\n @if (helpMessage() && helpMessageTooltip()) {\n <div [quangTooltip]=\"helpMessage() | transloco\">\n <ng-content select=\"[help-icon]\" />\n </div>\n }\n </label>\n }\n <div\n [class.is-invalid]=\"_showErrors()\"\n [class.is-valid]=\"_showSuccess()\"\n class=\"input-wysiwyg-container is-invalid\"\n >\n <textarea\n [disabled]=\"_isDisabled()\"\n [id]=\"componentId()\"\n [ngClass]=\"componentClass()\"\n [placeholder]=\"componentPlaceholder() | transloco\"\n [readOnly]=\"isReadonly()\"\n [tabIndex]=\"componentTabIndex()\"\n [value]=\"_value()\"\n #inputForWysiwyg\n class=\"form-control\"\n ></textarea>\n </div>\n <div class=\"valid-feedback\">\n {{ successMessage() | transloco }}\n </div>\n <div class=\"invalid-feedback\">\n {{ _currentErrorMessage() | transloco: _currentErrorMessageExtraData() }}\n </div>\n @if (helpMessage() && !helpMessageTooltip()) {\n <small\n [hidden]=\"_showSuccess() || _showErrors()\"\n aria-live=\"assertive\"\n class=\"form-text text-muted\"\n >\n {{ helpMessage() | transloco }}\n </small>\n }\n</div>\n", styles: [":host{display:block}::ng-deep .se-toolbar{color:var(--bs-body-color)!important;background-color:var(--bs-body-bg)!important;z-index:unset!important}::ng-deep .se-wrapper-inner{color:var(--bs-body-color)!important;background-color:var(--bs-body-bg)!important}::ng-deep .se-btn{color:var(--bs-body-color)!important}::ng-deep .se-btn:enabled.active{color:var(--bs-primary)!important}::ng-deep .se-btn:hover{background-color:var(--bs-secondary-bg)!important}::ng-deep .se-resizing-bar{color:var(--bs-body-color)!important;background-color:var(--bs-body-bg)!important}::ng-deep .se-navigation{color:var(--bs-body-color)!important;background-color:var(--bs-body-bg)!important}::ng-deep .sun-editor input{display:none}::ng-deep .sun-editor .se-container{border-radius:var(--bs-border-radius)}::ng-deep .se-wrapper{z-index:unset!important}::ng-deep .se-wrapper textarea:disabled+.se-wrapper-wysiwyg{background-color:var(--bs-secondary-bg)}::ng-deep .se-wrapper .se-wrapper-inner{border-top:1px solid var(--bs-border-color)}::ng-deep .is-invalid .sun-editor .se-container .se-toolbar{border-bottom:1px solid var(--bs-danger)}::ng-deep .is-invalid .sun-editor .se-container .se-wrapper .se-wrapper-inner{--bs-form-bg-icon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e\");border:1px solid var(--bs-danger);padding-right:3rem;background-position:right .75rem center,center right 2.25rem;background-size:1.5rem,calc(.75em + .375rem) calc(.75em + .375rem);background-image:var(--bs-form-bg-icon);background-repeat:no-repeat}::ng-deep .is-valid .sun-editor .se-container .se-toolbar{border-bottom:1px solid var(--bs-success)}::ng-deep .is-valid .sun-editor .se-container .se-wrapper .se-wrapper-inner{--bs-form-bg-icon: url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e\");border:1px solid var(--bs-success);padding-right:3rem;background-position:right .75rem center,center right 2.25rem;background-size:1.5rem,calc(.75em + .375rem) calc(.75em + .375rem);background-image:var(--bs-form-bg-icon);background-repeat:no-repeat}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: QuangTooltipDirective, selector: "[quangTooltip]", inputs: ["quangTooltip", "showMethod"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
213
213
  }
214
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: QuangWysiwygComponent, decorators: [{
214
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: QuangWysiwygComponent, decorators: [{
215
215
  type: Component,
216
216
  args: [{ selector: 'quang-wysiwyg', providers: [
217
217
  {
@@ -1 +1 @@
1
- {"version":3,"file":"quang-components-wysiwyg.mjs","sources":["../../../projects/quang/components/wysiwyg/wysiwyg.component.ts","../../../projects/quang/components/wysiwyg/wysiwyg.component.html","../../../projects/quang/components/wysiwyg/quang-components-wysiwyg.ts"],"sourcesContent":["import { NgClass } from '@angular/common'\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n effect,\n forwardRef,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core'\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'\nimport { AbstractControl, NG_VALUE_ACCESSOR, ValidationErrors, Validators } from '@angular/forms'\n\nimport { TranslocoPipe } from '@jsverse/transloco'\nimport { QuangTooltipDirective } from 'quang/overlay/tooltip'\nimport { filter, take } from 'rxjs'\nimport sunEditor from 'suneditor'\nimport SunEditorCore from 'suneditor/src/lib/core'\nimport { SunEditorOptions } from 'suneditor/src/options'\nimport plugins from 'suneditor/src/plugins'\n\nimport { QuangBaseComponent } from 'quang/components/shared'\n\nexport type QuangWysiwygOptions = SunEditorOptions\n\n@Component({\n selector: 'quang-wysiwyg',\n templateUrl: './wysiwyg.component.html',\n styleUrl: './wysiwyg.component.scss',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => QuangWysiwygComponent),\n multi: true,\n },\n ],\n imports: [TranslocoPipe, NgClass, QuangTooltipDirective],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\n/**\n * WYSIWYG (What You See Is What You Get) component based on {@link https://github.com/JiHong88/SunEditor}.\n *\n * This component provides a rich text editor for users to create and edit HTML content.\n * It supports a wide range of formatting options.\n *\n * @usageNotes\n * The component allows you to show or hide buttons from the WYSIWYG editor.\n * By default, all the available buttons are shown in the editor bar.\n *\n * The height of the editor can be customized by setting the `minHeight` property. By default, it is `200px`.\n */\nexport class QuangWysiwygComponent extends QuangBaseComponent<string> implements AfterViewInit {\n _inputForWysiwyg = viewChild<ElementRef>('inputForWysiwyg')\n\n minHeight = input<string | undefined>('200px')\n\n font = input<boolean>(true)\n\n fontSize = input<boolean>(true)\n\n formatBlock = input<boolean>(true)\n\n paragraphStyle = input<boolean>(true)\n\n blockquote = input<boolean>(true)\n\n bold = input<boolean>(true)\n\n underline = input<boolean>(true)\n\n italic = input<boolean>(true)\n\n strike = input<boolean>(true)\n\n fontColor = input<boolean>(true)\n\n highlightColor = input<boolean>(true)\n\n textStyle = input<boolean>(true)\n\n removeFormat = input<boolean>(true)\n\n align = input<boolean>(true)\n\n list = input<boolean>(true)\n\n table = input<boolean>(true)\n\n link = input<boolean>(true)\n\n image = input<boolean>(true)\n\n fullScreen = input<boolean>(true)\n\n showBlocks = input<boolean>(true)\n\n onImageUploadError = input<(errorMessage: any, result: any, core: any) => boolean>()\n onFileDrop = input<(e: any, cleanData: any, maxCharCount: any, core: any) => boolean>()\n\n wysiwygOptions = input<QuangWysiwygOptions | undefined>(undefined)\n\n _sunEditorWysiwygInstance = signal<SunEditorCore | undefined>(undefined)\n _sunEditorWysiwygInstance$ = toObservable(this._sunEditorWysiwygInstance)\n\n changeDetectorRef = signal(inject(ChangeDetectorRef))\n\n _generateSunEditorWysiwygEffect = effect(() => {\n try {\n const inputForWysiwyg = this._inputForWysiwyg()?.nativeElement\n if (inputForWysiwyg) {\n const sunEditorOptions: SunEditorOptions = {\n plugins,\n defaultTag: 'div',\n buttonList: this._ngControl()?.control?.enabled && !this.isReadonly() ? [this.getButtonList()] : [],\n minHeight: this.minHeight(),\n width: '100%',\n ...(this.wysiwygOptions() ?? {}),\n }\n\n let sunEditorWysiwygInstance = this._sunEditorWysiwygInstance()\n const ngControl = this._ngControl()\n\n if (sunEditorWysiwygInstance) {\n if (ngControl?.control?.enabled) {\n sunEditorWysiwygInstance.enable()\n }\n sunEditorWysiwygInstance.setOptions(sunEditorOptions)\n } else {\n sunEditorWysiwygInstance = sunEditor.create(inputForWysiwyg, sunEditorOptions)\n this._sunEditorWysiwygInstance.set(sunEditorWysiwygInstance)\n }\n\n const imageUploadError = this.onImageUploadError()\n const onFileDrop = this.onFileDrop()\n\n if (imageUploadError && sunEditorWysiwygInstance) {\n sunEditorWysiwygInstance.onImageUploadError = imageUploadError\n }\n if (onFileDrop && sunEditorWysiwygInstance) {\n sunEditorWysiwygInstance.onDrop = onFileDrop\n }\n\n this.registerEvents()\n }\n } catch (_) {\n // we usually end up here when we are in a modal and then it starts in the right way\n }\n })\n\n STRIP_HTML_REGEX = /<[^>]*>/g\n\n registerEvents(): void {\n const sunEditorInstance = this._sunEditorWysiwygInstance()\n if (sunEditorInstance) {\n sunEditorInstance.onChange = (contents) => {\n this.onChangedHandler(contents)\n this.changeDetectorRef().markForCheck()\n }\n sunEditorInstance.onBlur = () => {\n this.onBlurHandler()\n }\n if (this._isDisabled()) {\n sunEditorInstance.disable()\n }\n }\n }\n\n override writeValue(val: string): void {\n super.writeValue(val)\n this._sunEditorWysiwygInstance$\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n filter((x) => !!x),\n take(1)\n )\n .subscribe((sunEditorWysiwygInstance) => {\n if (sunEditorWysiwygInstance) {\n try {\n sunEditorWysiwygInstance.setContents(val)\n } catch (_) {\n // we usually end up here when we are in a modal and then it starts in the right way\n }\n }\n })\n }\n\n validate(control: AbstractControl): ValidationErrors | null {\n if (control.hasValidator(Validators.required) && control.value?.replace(this.STRIP_HTML_REGEX, '') === '') {\n return { required: true }\n }\n return null\n }\n\n override onChangedHandler(value: string): void {\n super.onChangedHandler(value)\n const control = this._ngControl()\n if (control?.control) {\n if (this.validate(control.control)) control.control.setErrors(this.validate(control.control))\n }\n }\n\n getButtonList(): string[] {\n const buttonList: string[] = []\n if (this.font()) {\n buttonList.push('font')\n }\n if (this.fontSize()) {\n buttonList.push('fontSize')\n }\n if (this.formatBlock()) {\n buttonList.push('formatBlock')\n }\n if (this.paragraphStyle()) {\n buttonList.push('paragraphStyle')\n }\n if (this.blockquote()) {\n buttonList.push('blockquote')\n }\n if (this.bold()) {\n buttonList.push('bold')\n }\n if (this.underline()) {\n buttonList.push('underline')\n }\n if (this.italic()) {\n buttonList.push('italic')\n }\n if (this.strike()) {\n buttonList.push('strike')\n }\n if (this.fontColor()) {\n buttonList.push('fontColor')\n }\n if (this.highlightColor()) {\n buttonList.push('hiliteColor')\n }\n if (this.textStyle()) {\n buttonList.push('textStyle')\n }\n if (this.removeFormat()) {\n buttonList.push('removeFormat')\n }\n if (this.align()) {\n buttonList.push('align')\n }\n if (this.list()) {\n buttonList.push('list')\n }\n if (this.table()) {\n buttonList.push('table')\n }\n if (this.link()) {\n buttonList.push('link')\n }\n if (this.image()) {\n buttonList.push('image')\n }\n if (this.fullScreen()) {\n buttonList.push('fullScreen')\n }\n if (this.showBlocks()) {\n buttonList.push('showBlocks')\n }\n return buttonList\n }\n}\n","<div class=\"mb-3\">\n @if (componentLabel()) {\n <label\n [htmlFor]=\"componentId()\"\n class=\"form-label d-flex gap-2\"\n >\n <div>\n <span>{{ componentLabel() | transloco }}</span>\n <span [hidden]=\"!_isRequired()\">*</span>\n </div>\n @if (helpMessage() && helpMessageTooltip()) {\n <div [quangTooltip]=\"helpMessage() | transloco\">\n <ng-content select=\"[help-icon]\" />\n </div>\n }\n </label>\n }\n <div\n [class.is-invalid]=\"_showErrors()\"\n [class.is-valid]=\"_showSuccess()\"\n class=\"input-wysiwyg-container is-invalid\"\n >\n <textarea\n [disabled]=\"_isDisabled()\"\n [id]=\"componentId()\"\n [ngClass]=\"componentClass()\"\n [placeholder]=\"componentPlaceholder() | transloco\"\n [readOnly]=\"isReadonly()\"\n [tabIndex]=\"componentTabIndex()\"\n [value]=\"_value()\"\n #inputForWysiwyg\n class=\"form-control\"\n ></textarea>\n </div>\n <div class=\"valid-feedback\">\n {{ successMessage() | transloco }}\n </div>\n <div class=\"invalid-feedback\">\n {{ _currentErrorMessage() | transloco: _currentErrorMessageExtraData() }}\n </div>\n @if (helpMessage() && !helpMessageTooltip()) {\n <small\n [hidden]=\"_showSuccess() || _showErrors()\"\n aria-live=\"assertive\"\n class=\"form-text text-muted\"\n >\n {{ helpMessage() | transloco }}\n </small>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AA2CA;;;;;;;;;;;AAWG;AACG,MAAO,qBAAsB,SAAQ,kBAA0B,CAAA;AA1BrE,IAAA,WAAA,GAAA;;AA2BE,QAAA,IAAA,CAAA,gBAAgB,GAAG,SAAS,CAAa,iBAAiB,CAAC;AAE3D,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAqB,OAAO,CAAC;AAE9C,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAU,IAAI,CAAC;AAE3B,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,IAAI,CAAC;AAE/B,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAU,IAAI,CAAC;AAElC,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK,CAAU,IAAI,CAAC;AAErC,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAU,IAAI,CAAC;AAEjC,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAU,IAAI,CAAC;AAE3B,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAU,IAAI,CAAC;AAEhC,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK,CAAU,IAAI,CAAC;AAE7B,QAAA,IAAA,CAAA,MAAM,GAAG,KAAK,CAAU,IAAI,CAAC;AAE7B,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAU,IAAI,CAAC;AAEhC,QAAA,IAAA,CAAA,cAAc,GAAG,KAAK,CAAU,IAAI,CAAC;AAErC,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAU,IAAI,CAAC;AAEhC,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAU,IAAI,CAAC;AAEnC,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAU,IAAI,C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KAAA,EAAA,IAAA,EAAA,SAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,WAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECvCH,07CAkDA,EDVY,MAAA,EAAA,CAAA,g6EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,aAAa,EAAE,IAAA,EAAA,WAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,OAAO,oFAAE,qBAAqB,EAAA,QAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,CAAA,cAAA,EAAA,YAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAe5C,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBA1BjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,EAGd,SAAA,EAAA;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,2BAA2B,CAAC;AACpD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EACQ,OAAA,EAAA,CAAC,aAAa,EAAE,OAAO,EAAE,qBAAqB,CAAC,EAAA,eAAA,EACvC,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,07CAAA,EAAA,MAAA,EAAA,CAAA,g6EAAA,CAAA,EAAA;;;AEzCjD;;AAEG;;;;"}
1
+ {"version":3,"file":"quang-components-wysiwyg.mjs","sources":["../../../projects/quang/components/wysiwyg/wysiwyg.component.ts","../../../projects/quang/components/wysiwyg/wysiwyg.component.html","../../../projects/quang/components/wysiwyg/quang-components-wysiwyg.ts"],"sourcesContent":["import { NgClass } from '@angular/common'\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n effect,\n forwardRef,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core'\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'\nimport { AbstractControl, NG_VALUE_ACCESSOR, ValidationErrors, Validators } from '@angular/forms'\n\nimport { TranslocoPipe } from '@jsverse/transloco'\nimport { QuangTooltipDirective } from 'quang/overlay/tooltip'\nimport { filter, take } from 'rxjs'\nimport sunEditor from 'suneditor'\nimport SunEditorCore from 'suneditor/src/lib/core'\nimport { SunEditorOptions } from 'suneditor/src/options'\nimport plugins from 'suneditor/src/plugins'\n\nimport { QuangBaseComponent } from 'quang/components/shared'\n\nexport type QuangWysiwygOptions = SunEditorOptions\n\n@Component({\n selector: 'quang-wysiwyg',\n templateUrl: './wysiwyg.component.html',\n styleUrl: './wysiwyg.component.scss',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => QuangWysiwygComponent),\n multi: true,\n },\n ],\n imports: [TranslocoPipe, NgClass, QuangTooltipDirective],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\n/**\n * WYSIWYG (What You See Is What You Get) component based on {@link https://github.com/JiHong88/SunEditor}.\n *\n * This component provides a rich text editor for users to create and edit HTML content.\n * It supports a wide range of formatting options.\n *\n * @usageNotes\n * The component allows you to show or hide buttons from the WYSIWYG editor.\n * By default, all the available buttons are shown in the editor bar.\n *\n * The height of the editor can be customized by setting the `minHeight` property. By default, it is `200px`.\n */\nexport class QuangWysiwygComponent extends QuangBaseComponent<string> implements AfterViewInit {\n _inputForWysiwyg = viewChild<ElementRef>('inputForWysiwyg')\n\n minHeight = input<string | undefined>('200px')\n\n font = input<boolean>(true)\n\n fontSize = input<boolean>(true)\n\n formatBlock = input<boolean>(true)\n\n paragraphStyle = input<boolean>(true)\n\n blockquote = input<boolean>(true)\n\n bold = input<boolean>(true)\n\n underline = input<boolean>(true)\n\n italic = input<boolean>(true)\n\n strike = input<boolean>(true)\n\n fontColor = input<boolean>(true)\n\n highlightColor = input<boolean>(true)\n\n textStyle = input<boolean>(true)\n\n removeFormat = input<boolean>(true)\n\n align = input<boolean>(true)\n\n list = input<boolean>(true)\n\n table = input<boolean>(true)\n\n link = input<boolean>(true)\n\n image = input<boolean>(true)\n\n fullScreen = input<boolean>(true)\n\n showBlocks = input<boolean>(true)\n\n onImageUploadError = input<(errorMessage: any, result: any, core: any) => boolean>()\n onFileDrop = input<(e: any, cleanData: any, maxCharCount: any, core: any) => boolean>()\n\n wysiwygOptions = input<QuangWysiwygOptions | undefined>(undefined)\n\n _sunEditorWysiwygInstance = signal<SunEditorCore | undefined>(undefined)\n _sunEditorWysiwygInstance$ = toObservable(this._sunEditorWysiwygInstance)\n\n changeDetectorRef = signal(inject(ChangeDetectorRef))\n\n _generateSunEditorWysiwygEffect = effect(() => {\n try {\n const inputForWysiwyg = this._inputForWysiwyg()?.nativeElement\n if (inputForWysiwyg) {\n const sunEditorOptions: SunEditorOptions = {\n plugins,\n defaultTag: 'div',\n buttonList: this._ngControl()?.control?.enabled && !this.isReadonly() ? [this.getButtonList()] : [],\n minHeight: this.minHeight(),\n width: '100%',\n ...(this.wysiwygOptions() ?? {}),\n }\n\n let sunEditorWysiwygInstance = this._sunEditorWysiwygInstance()\n const ngControl = this._ngControl()\n\n if (sunEditorWysiwygInstance) {\n if (ngControl?.control?.enabled) {\n sunEditorWysiwygInstance.enable()\n }\n sunEditorWysiwygInstance.setOptions(sunEditorOptions)\n } else {\n sunEditorWysiwygInstance = sunEditor.create(inputForWysiwyg, sunEditorOptions)\n this._sunEditorWysiwygInstance.set(sunEditorWysiwygInstance)\n }\n\n const imageUploadError = this.onImageUploadError()\n const onFileDrop = this.onFileDrop()\n\n if (imageUploadError && sunEditorWysiwygInstance) {\n sunEditorWysiwygInstance.onImageUploadError = imageUploadError\n }\n if (onFileDrop && sunEditorWysiwygInstance) {\n sunEditorWysiwygInstance.onDrop = onFileDrop\n }\n\n this.registerEvents()\n }\n } catch (_) {\n // we usually end up here when we are in a modal and then it starts in the right way\n }\n })\n\n STRIP_HTML_REGEX = /<[^>]*>/g\n\n registerEvents(): void {\n const sunEditorInstance = this._sunEditorWysiwygInstance()\n if (sunEditorInstance) {\n sunEditorInstance.onChange = (contents) => {\n this.onChangedHandler(contents)\n this.changeDetectorRef().markForCheck()\n }\n sunEditorInstance.onBlur = () => {\n this.onBlurHandler()\n }\n if (this._isDisabled()) {\n sunEditorInstance.disable()\n }\n }\n }\n\n override writeValue(val: string): void {\n super.writeValue(val)\n this._sunEditorWysiwygInstance$\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n filter((x) => !!x),\n take(1)\n )\n .subscribe((sunEditorWysiwygInstance) => {\n if (sunEditorWysiwygInstance) {\n try {\n sunEditorWysiwygInstance.setContents(val)\n } catch (_) {\n // we usually end up here when we are in a modal and then it starts in the right way\n }\n }\n })\n }\n\n validate(control: AbstractControl): ValidationErrors | null {\n if (control.hasValidator(Validators.required) && control.value?.replace(this.STRIP_HTML_REGEX, '') === '') {\n return { required: true }\n }\n return null\n }\n\n override onChangedHandler(value: string): void {\n super.onChangedHandler(value)\n const control = this._ngControl()\n if (control?.control) {\n if (this.validate(control.control)) control.control.setErrors(this.validate(control.control))\n }\n }\n\n getButtonList(): string[] {\n const buttonList: string[] = []\n if (this.font()) {\n buttonList.push('font')\n }\n if (this.fontSize()) {\n buttonList.push('fontSize')\n }\n if (this.formatBlock()) {\n buttonList.push('formatBlock')\n }\n if (this.paragraphStyle()) {\n buttonList.push('paragraphStyle')\n }\n if (this.blockquote()) {\n buttonList.push('blockquote')\n }\n if (this.bold()) {\n buttonList.push('bold')\n }\n if (this.underline()) {\n buttonList.push('underline')\n }\n if (this.italic()) {\n buttonList.push('italic')\n }\n if (this.strike()) {\n buttonList.push('strike')\n }\n if (this.fontColor()) {\n buttonList.push('fontColor')\n }\n if (this.highlightColor()) {\n buttonList.push('hiliteColor')\n }\n if (this.textStyle()) {\n buttonList.push('textStyle')\n }\n if (this.removeFormat()) {\n buttonList.push('removeFormat')\n }\n if (this.align()) {\n buttonList.push('align')\n }\n if (this.list()) {\n buttonList.push('list')\n }\n if (this.table()) {\n buttonList.push('table')\n }\n if (this.link()) {\n buttonList.push('link')\n }\n if (this.image()) {\n buttonList.push('image')\n }\n if (this.fullScreen()) {\n buttonList.push('fullScreen')\n }\n if (this.showBlocks()) {\n buttonList.push('showBlocks')\n }\n return buttonList\n }\n}\n","<div class=\"mb-3\">\n @if (componentLabel()) {\n <label\n [htmlFor]=\"componentId()\"\n class=\"form-label d-flex gap-2\"\n >\n <div>\n <span>{{ componentLabel() | transloco }}</span>\n <span [hidden]=\"!_isRequired()\">*</span>\n </div>\n @if (helpMessage() && helpMessageTooltip()) {\n <div [quangTooltip]=\"helpMessage() | transloco\">\n <ng-content select=\"[help-icon]\" />\n </div>\n }\n </label>\n }\n <div\n [class.is-invalid]=\"_showErrors()\"\n [class.is-valid]=\"_showSuccess()\"\n class=\"input-wysiwyg-container is-invalid\"\n >\n <textarea\n [disabled]=\"_isDisabled()\"\n [id]=\"componentId()\"\n [ngClass]=\"componentClass()\"\n [placeholder]=\"componentPlaceholder() | transloco\"\n [readOnly]=\"isReadonly()\"\n [tabIndex]=\"componentTabIndex()\"\n [value]=\"_value()\"\n #inputForWysiwyg\n class=\"form-control\"\n ></textarea>\n </div>\n <div class=\"valid-feedback\">\n {{ successMessage() | transloco }}\n </div>\n <div class=\"invalid-feedback\">\n {{ _currentErrorMessage() | transloco: _currentErrorMessageExtraData() }}\n </div>\n @if (helpMessage() && !helpMessageTooltip()) {\n <small\n [hidden]=\"_showSuccess() || _showErrors()\"\n aria-live=\"assertive\"\n class=\"form-text text-muted\"\n >\n {{ helpMessage() | transloco }}\n </small>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AA2CA;;;;;;;;;;;AAWG;AACG,MAAO,qBAAsB,SAAQ,kBAA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AAA,EAAA,KAAA,EAAA,IAAA,EAAA,SAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,WAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECvCH,07CAkDA,EAAA,MAAA,EAAA,CAAA,g6EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDV2B,OAAO,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,qBAAqB,8FAA7C,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAeZ,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBA1BjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,EAAA,SAAA,EAGd;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,2BAA2B,CAAC;AACpD,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EAAA,OAAA,EACQ,CAAC,aAAa,EAAE,OAAO,EAAE,qBAAqB,CAAC,EAAA,eAAA,EACvC,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,07CAAA,EAAA,MAAA,EAAA,CAAA,g6EAAA,CAAA,EAAA;;;AEzCjD;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"quang-data-handling.mjs","sources":["../../../projects/quang/data-handling/conversion.ts","../../../projects/quang/data-handling/download.ts","../../../projects/quang/data-handling/quang-data-handling.ts"],"sourcesContent":["export async function blobToBase64(blob: Blob): Promise<string | ArrayBuffer | null> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onloadend = () => {\n resolve(reader.result)\n }\n reader.onerror = (error) => {\n reject(error)\n }\n reader.readAsDataURL(blob)\n })\n}\n\nexport async function base64ToDataUri(base64: string, type = 'application/octet-stream') {\n return `data:${type};base64,${base64}`\n}\n\nexport async function dataUriToBlob(dataUri: string): Promise<Blob> {\n return (await fetch(dataUri)).blob()\n}\n","import { HttpResponse } from '@angular/common/http'\n\nexport function downloadFile(file: File, filename: string): void {\n const a = document.createElement('a')\n const url = window.URL.createObjectURL(file)\n a.href = url\n a.download = filename\n a.click()\n window.URL.revokeObjectURL(url)\n a.remove()\n}\n\nexport function handleDownload(response: HttpResponse<Blob>, defaultExtension = 'xls'): void {\n const { body, headers } = response\n if (!body) throw new Error('No body')\n let filename: string\n try {\n const contentDisposition = headers.get('content-disposition') ?? ''\n const r = /filename[^;=\\n]*=((['\"]).*?\\2|[^;\\n]*)/\n\n filename = r.exec(contentDisposition)![1]\n filename = filename.replace(/['\"]/g, '')\n } catch (_error) {\n filename = `download-${new Date().getTime()}.${defaultExtension}`\n }\n const file = new File([body], filename, {\n type: headers.get('content-type') ?? 'blob',\n })\n downloadFile(file, filename)\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAO,eAAe,YAAY,CAAC,IAAU,EAAA;IAC3C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACrC,QAAA,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE;AAC/B,QAAA,MAAM,CAAC,SAAS,GAAG,MAAK;AACtB,YAAA,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;AACxB,SAAC;AACD,QAAA,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,KAAI;YACzB,MAAM,CAAC,KAAK,CAAC;AACf,SAAC;AACD,QAAA,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC;AAC5B,KAAC,CAAC;AACJ;AAEO,eAAe,eAAe,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AAA,EAAI,gBAAgB,CAAA,CAAE;;IAEnE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE;QACtC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,MAAM;AAC5C,KAAA,CAAC;AACF,IAAA,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC;AAC9B;;AC7BA;;AAEG;;;;"}
1
+ {"version":3,"file":"quang-data-handling.mjs","sources":["../../../projects/quang/data-handling/conversion.ts","../../../projects/quang/data-handling/download.ts","../../../projects/quang/data-handling/quang-data-handling.ts"],"sourcesContent":["export async function blobToBase64(blob: Blob): Promise<string | ArrayBuffer | null> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onloadend = () => {\n resolve(reader.result)\n }\n reader.onerror = (error) => {\n reject(error)\n }\n reader.readAsDataURL(blob)\n })\n}\n\nexport async function base64ToDataUri(base64: string, type = 'application/octet-stream') {\n return `data:${type};base64,${base64}`\n}\n\nexport async function dataUriToBlob(dataUri: string): Promise<Blob> {\n return (await fetch(dataUri)).blob()\n}\n","import { HttpResponse } from '@angular/common/http'\n\nexport function downloadFile(file: File, filename: string): void {\n const a = document.createElement('a')\n const url = window.URL.createObjectURL(file)\n a.href = url\n a.download = filename\n a.click()\n window.URL.revokeObjectURL(url)\n a.remove()\n}\n\nexport function handleDownload(response: HttpResponse<Blob>, defaultExtension = 'xls'): void {\n const { body, headers } = response\n if (!body) throw new Error('No body')\n let filename: string\n try {\n const contentDisposition = headers.get('content-disposition') ?? ''\n const r = /filename[^;=\\n]*=((['\"]).*?\\2|[^;\\n]*)/\n\n filename = r.exec(contentDisposition)![1]\n filename = filename.replace(/['\"]/g, '')\n } catch (_error) {\n filename = `download-${new Date().getTime()}.${defaultExtension}`\n }\n const file = new File([body], filename, {\n type: headers.get('content-type') ?? 'blob',\n })\n downloadFile(file, filename)\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport *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IAAI;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC;AACrC,IAAA,IAAI,QAAgB;AACpB,IAAA,IAAI;QACF,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,EAAE;QACnE,MAAM,CAAC,GAAG,wCAAwC;QAElD,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAE,CAAC,CAAC,CAAC;QACzC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;;IACxC,OAAO,MAAM,EAAE;QACf,QAAQ,GAAG,CAAA,SAAA,EAAY,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA,CAAA,EAAI,gBAAgB,CAAA,CAAE;;IAEnE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE;QACtC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,MAAM;AAC5C,KAAA,CAAC;AACF,IAAA,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC;AAC9B;;AC7BA;;AAEG;;;;"}
@@ -24,10 +24,10 @@ class ResizeObservableService {
24
24
  widthResizeObservable(elem) {
25
25
  return this.resizeObservable(elem).pipe(map((entry) => entry.borderBoxSize[0].inlineSize), filter(Boolean));
26
26
  }
27
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ResizeObservableService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
28
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ResizeObservableService, providedIn: 'root' }); }
27
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ResizeObservableService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
28
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ResizeObservableService, providedIn: 'root' }); }
29
29
  }
30
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: ResizeObservableService, decorators: [{
30
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: ResizeObservableService, decorators: [{
31
31
  type: Injectable,
32
32
  args: [{
33
33
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"quang-device.mjs","sources":["../../../projects/quang/device/resize-observable.service.ts","../../../projects/quang/device/quang-device.ts"],"sourcesContent":["import { Injectable } from '@angular/core'\n\nimport { NextObserver, Observable, Subscriber, filter, map, throttleTime } from 'rxjs'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ResizeObservableService {\n private resizeObserver: ResizeObserver\n\n private notifiers: NextObserver<ResizeObserverEntry[]>[] = []\n\n constructor() {\n this.resizeObserver = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n this.notifiers.forEach((obs) => obs.next(entries))\n })\n }\n\n resizeObservable(elem: Element): Observable<ResizeObserverEntry> {\n this.resizeObserver.observe(elem)\n const newObserverCandidate = new Observable<ResizeObserverEntry[]>(\n (subscriber: Subscriber<ResizeObserverEntry[]>) => {\n this.notifiers.push(subscriber)\n\n return () => {\n const idx = this.notifiers.findIndex((val) => val === subscriber)\n this.notifiers.splice(idx, 1)\n this.resizeObserver.unobserve(elem)\n }\n }\n )\n\n return newObserverCandidate.pipe(\n map((entries) => entries.find((entry) => entry.target === elem)),\n filter(Boolean),\n throttleTime(30)\n )\n }\n\n widthResizeObservable(elem: Element): Observable<number> {\n return this.resizeObservable(elem).pipe(\n map((entry) => entry.borderBoxSize[0].inlineSize),\n filter(Boolean)\n )\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAOa,uBAAuB,CAAA;AAKlC,IAAA,WAA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AuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cAFtB,MAAM,EAAA,CAAA,CAAA;;2FAEP,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAHnC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACND;;AAEG;;;;"}
1
+ {"version":3,"file":"quang-device.mjs","sources":["../../../projects/quang/device/resize-observable.service.ts","../../../projects/quang/device/quang-device.ts"],"sourcesContent":["import { Injectable } from '@angular/core'\n\nimport { NextObserver, Observable, Subscriber, filter, map, throttleTime } from 'rxjs'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ResizeObservableService {\n private resizeObserver: ResizeObserver\n\n private notifiers: NextObserver<ResizeObserverEntry[]>[] = []\n\n constructor() {\n this.resizeObserver = new ResizeObserver((entries: ResizeObserverEntry[]) => {\n this.notifiers.forEach((obs) => obs.next(entries))\n })\n }\n\n resizeObservable(elem: Element): Observable<ResizeObserverEntry> {\n this.resizeObserver.observe(elem)\n const newObserverCandidate = new Observable<ResizeObserverEntry[]>(\n (subscriber: Subscriber<ResizeObserverEntry[]>) => {\n this.notifiers.push(subscriber)\n\n return () => {\n const idx = this.notifiers.findIndex((val) => val === subscriber)\n this.notifiers.splice(idx, 1)\n this.resizeObserver.unobserve(elem)\n }\n }\n )\n\n return newObserverCandidate.pipe(\n map((entries) => entries.find((entry) => entry.target === elem)),\n filter(Boolean),\n throttleTime(30)\n )\n }\n\n widthResizeObservable(elem: Element): Observable<number> {\n return this.resizeObservable(elem).pipe(\n map((entry) => entry.borderBoxSize[0].inlineSize),\n fil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CAAC,KAAK,KAAK,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EACjD,MAAM,CAAC,OAAO,CAAC,CAChB;;8GApCQ,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cAFtB,MAAM,EAAA,CAAA,CAAA;;2FAEP,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAHnC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACND;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"quang-forms.mjs","sources":["../../../projects/quang/forms/validators.ts","../../../projects/quang/forms/form-group-model.ts","../../../projects/quang/forms/quang-forms.ts"],"sourcesContent":["import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { isAfter, isBefore, isWithinInterval } from 'date-fns'\n\nexport enum EuroLocale {\n AT = 'AT',\n BE = 'BE',\n BG = 'BG',\n CY = 'CY',\n CZ = 'CZ',\n DE = 'DE',\n DK = 'DK',\n EE = 'EE',\n GR = 'GR',\n ES = 'ES',\n FI = 'FI',\n FR = 'FR',\n GB = 'GB',\n HU = 'HU',\n IE = 'IE',\n IT = 'IT',\n LT = 'LT',\n LU = 'LU',\n LV = 'LV',\n MT = 'MT',\n NL = 'NL',\n PL = 'PL',\n PT = 'PT',\n RO = 'RO',\n SE = 'SE',\n SI = 'SI',\n SK = 'SK',\n}\n\nexport const europeanVatNumber: Record<EuroLocale, RegExp> = {\n [EuroLocale.AT]: /U[0-9]{8}/gm,\n [EuroLocale.BE]: /0[0-9]{9}/gm,\n [EuroLocale.BG]: /[0-9]{9,10}/gm,\n [EuroLocale.CY]: /[0-9]{8}L/gm,\n [EuroLocale.CZ]: /[0-9]{8,10}/gm,\n [EuroLocale.DE]: /[0-9]{9}/gm,\n [EuroLocale.DK]: /[0-9]{8}/gm,\n [EuroLocale.EE]: /[0-9]{9}/gm,\n [EuroLocale.GR]: /[0-9]{9}/gm,\n [EuroLocale.ES]: /[0-9A-Z][0-9]{7}[0-9A-Z]/gm,\n [EuroLocale.FI]: /[0-9]{8}/gm,\n [EuroLocale.FR]: /[0-9A-Z]{2}[0-9]{9}/gm,\n [EuroLocale.GB]: /([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})/gm,\n [EuroLocale.HU]: /[0-9]{8}/gm,\n [EuroLocale.IE]: /[0-9]S[0-9]{5}L/gm,\n [EuroLocale.IT]: /[0-9]{11}/gm,\n [EuroLocale.LT]: /([0-9]{9}|[0-9]{12})/gm,\n [EuroLocale.LU]: /[0-9]{8}/gm,\n [EuroLocale.LV]: /[0-9]{11}/gm,\n [EuroLocale.MT]: /[0-9]{8}/gm,\n [EuroLocale.NL]: /[0-9]{9}B[0-9]{2}/gm,\n [EuroLocale.PL]: /[0-9]{10}/gm,\n [EuroLocale.PT]: /[0-9]{9}/gm,\n [EuroLocale.RO]: /[0-9]{2,10}/gm,\n [EuroLocale.SE]: /[0-9]{12}/gm,\n [EuroLocale.SI]: /[0-9]{8}/gm,\n [EuroLocale.SK]: /[0-9]{10}/gm,\n}\nexport function fileMaxSize(maxSize: number): ValidatorFn {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && control.value instanceof File && control.value?.size > maxSize) {\n return { maxSize: { requiredValue: maxSize } }\n }\n return null\n }\n}\n\nexport function fileMinSize(minSize: number): ValidatorFn {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && control.value instanceof File && control.value?.size < minSize) {\n return { minSize: { requiredValue: minSize } }\n }\n return null\n }\n}\n\nexport function isFile(): ValidatorFn {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && control.value instanceof File) {\n return null\n }\n return { isFile: {} }\n }\n}\n\nexport function fileType(fileTypes: string[]) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && !fileTypes.includes(control.value?.type)) {\n return { fileType: { requiredValue: fileTypes.toString() } }\n }\n return null\n }\n}\n\nexport function fileExtensions(list: string[]) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && !list.includes(control.value?.name?.match(/(?:\\.([^.]+))?$/g)[0])) {\n return { fileExtension: { requiredValue: list.toString() } }\n }\n return null\n }\n}\n\nexport function requiredCheckbox() {\n return (control: AbstractControl): Record<string, any> | null => {\n if (!control.value) {\n return { required: { requiredValue: control.value } }\n }\n return null\n }\n}\n\nexport function minDate(dateToCompare: Date) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (isBefore(new Date(control.value), dateToCompare)) {\n return { minDate: { requiredValue: dateToCompare } }\n }\n return null\n }\n}\n\nexport function maxDate(dateToCompare: Date) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (isAfter(new Date(control.value), dateToCompare)) {\n return { maxDate: { requiredValue: dateToCompare } }\n }\n return null\n }\n}\n\nexport function dateBetween(start: Date, end: Date) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (\n !isWithinInterval(new Date(control.value), {\n start,\n end,\n })\n ) {\n return { dateBetween: { requiredValue: [start, end] } }\n }\n return null\n }\n}\n\nexport function isFiscalCode() {\n return (control: AbstractControl): Record<string, any> | null => {\n if (\n control?.value &&\n !/^([A-Z]{6}[0-9LMNPQRSTUV]{2}[ABCDEHLMPRST]{1}[0-9LMNPQRSTUV]{2}[A-Z]{1}[0-9LMNPQRSTUV]{3}[A-Z]{1})$|([0-9]{11})$/gm.test(\n control.value.toUpperCase()\n )\n ) {\n return { fiscalCode: true }\n }\n return null\n }\n}\n\nexport function isVatNumber(localeList: EuroLocale[]) {\n return (control: AbstractControl): Record<string, any> | null => {\n let isInvalidVat = true\n for (const locale of localeList) {\n if (europeanVatNumber[locale]?.test(control?.value)) {\n isInvalidVat = false\n break\n }\n }\n return isInvalidVat ? { vatNumber: false } : null\n }\n}\n\nexport function wysiwygRequired() {\n return (control: AbstractControl): Record<string, any> | null => {\n const cleanHTML = control.value.replace(/<\\/?[^>]+(>|$)/g, '')\n if (!cleanHTML?.length) {\n return { required: { required: true } }\n }\n return null\n }\n}\n","import { FormControl, FormGroup } from '@angular/forms'\n\nexport type FormGroupModel<T> = FormGroup<{\n [K in keyof T]: FormControl<T[K]>\n}>\n\n/**\n * @example\n * interface Person {\n * name: string\n * lastName: string\n * age: number\n * }\n *\n * myForm: FormGroupModel<Person> = this.formBuilder.group({\n * name: this.formBuilder.control<string>('', Validators.required),\n * lastName: this.formBuilder.control<string>(''),\n * age: this.formBuilder.control<number>({value: 20, disabled: true})\n * })\n */\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;IAIY;AAAZ,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,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;;AAE7B,QAAA,OAAO,IAAI;AACb,KAAC;AACH;AAEM,SAAU,WAAW,CAAC,UAAwB,EAAA;IAClD,OAAO,CAAC,OAAwB,KAAgC;QAC9D,IAAI,YAAY,GAAG,IAAI;AACvB,QAAA,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;AAC/B,YAAA,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;gBACnD,YAAY,GAAG,KAAK;gBACpB;;;AAGJ,QAAA,OAAO,YAAY,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;AACnD,KAAC;AACH;SAEgB,eAAe,GAAA;IAC7B,OAAO,CAAC,OAAwB,KAAgC;AAC9D,QAAA,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;AAC9D,QAAA,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE;YACtB,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;;AAEzC,QAAA,OAAO,IAAI;AACb,KAAC;AACH;;AClLA;;;;;;;;;;;;;AAaG;;ACnBH;;AAEG;;;;"}
1
+ {"version":3,"file":"quang-forms.mjs","sources":["../../../projects/quang/forms/validators.ts","../../../projects/quang/forms/form-group-model.ts","../../../projects/quang/forms/quang-forms.ts"],"sourcesContent":["import { AbstractControl, ValidatorFn } from '@angular/forms'\n\nimport { isAfter, isBefore, isWithinInterval } from 'date-fns'\n\nexport enum EuroLocale {\n AT = 'AT',\n BE = 'BE',\n BG = 'BG',\n CY = 'CY',\n CZ = 'CZ',\n DE = 'DE',\n DK = 'DK',\n EE = 'EE',\n GR = 'GR',\n ES = 'ES',\n FI = 'FI',\n FR = 'FR',\n GB = 'GB',\n HU = 'HU',\n IE = 'IE',\n IT = 'IT',\n LT = 'LT',\n LU = 'LU',\n LV = 'LV',\n MT = 'MT',\n NL = 'NL',\n PL = 'PL',\n PT = 'PT',\n RO = 'RO',\n SE = 'SE',\n SI = 'SI',\n SK = 'SK',\n}\n\nexport const europeanVatNumber: Record<EuroLocale, RegExp> = {\n [EuroLocale.AT]: /U[0-9]{8}/gm,\n [EuroLocale.BE]: /0[0-9]{9}/gm,\n [EuroLocale.BG]: /[0-9]{9,10}/gm,\n [EuroLocale.CY]: /[0-9]{8}L/gm,\n [EuroLocale.CZ]: /[0-9]{8,10}/gm,\n [EuroLocale.DE]: /[0-9]{9}/gm,\n [EuroLocale.DK]: /[0-9]{8}/gm,\n [EuroLocale.EE]: /[0-9]{9}/gm,\n [EuroLocale.GR]: /[0-9]{9}/gm,\n [EuroLocale.ES]: /[0-9A-Z][0-9]{7}[0-9A-Z]/gm,\n [EuroLocale.FI]: /[0-9]{8}/gm,\n [EuroLocale.FR]: /[0-9A-Z]{2}[0-9]{9}/gm,\n [EuroLocale.GB]: /([0-9]{9}([0-9]{3})?|[A-Z]{2}[0-9]{3})/gm,\n [EuroLocale.HU]: /[0-9]{8}/gm,\n [EuroLocale.IE]: /[0-9]S[0-9]{5}L/gm,\n [EuroLocale.IT]: /[0-9]{11}/gm,\n [EuroLocale.LT]: /([0-9]{9}|[0-9]{12})/gm,\n [EuroLocale.LU]: /[0-9]{8}/gm,\n [EuroLocale.LV]: /[0-9]{11}/gm,\n [EuroLocale.MT]: /[0-9]{8}/gm,\n [EuroLocale.NL]: /[0-9]{9}B[0-9]{2}/gm,\n [EuroLocale.PL]: /[0-9]{10}/gm,\n [EuroLocale.PT]: /[0-9]{9}/gm,\n [EuroLocale.RO]: /[0-9]{2,10}/gm,\n [EuroLocale.SE]: /[0-9]{12}/gm,\n [EuroLocale.SI]: /[0-9]{8}/gm,\n [EuroLocale.SK]: /[0-9]{10}/gm,\n}\nexport function fileMaxSize(maxSize: number): ValidatorFn {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && control.value instanceof File && control.value?.size > maxSize) {\n return { maxSize: { requiredValue: maxSize } }\n }\n return null\n }\n}\n\nexport function fileMinSize(minSize: number): ValidatorFn {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && control.value instanceof File && control.value?.size < minSize) {\n return { minSize: { requiredValue: minSize } }\n }\n return null\n }\n}\n\nexport function isFile(): ValidatorFn {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && control.value instanceof File) {\n return null\n }\n return { isFile: {} }\n }\n}\n\nexport function fileType(fileTypes: string[]) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && !fileTypes.includes(control.value?.type)) {\n return { fileType: { requiredValue: fileTypes.toString() } }\n }\n return null\n }\n}\n\nexport function fileExtensions(list: string[]) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (control.value && !list.includes(control.value?.name?.match(/(?:\\.([^.]+))?$/g)[0])) {\n return { fileExtension: { requiredValue: list.toString() } }\n }\n return null\n }\n}\n\nexport function requiredCheckbox() {\n return (control: AbstractControl): Record<string, any> | null => {\n if (!control.value) {\n return { required: { requiredValue: control.value } }\n }\n return null\n }\n}\n\nexport function minDate(dateToCompare: Date) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (isBefore(new Date(control.value), dateToCompare)) {\n return { minDate: { requiredValue: dateToCompare } }\n }\n return null\n }\n}\n\nexport function maxDate(dateToCompare: Date) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (isAfter(new Date(control.value), dateToCompare)) {\n return { maxDate: { requiredValue: dateToCompare } }\n }\n return null\n }\n}\n\nexport function dateBetween(start: Date, end: Date) {\n return (control: AbstractControl): Record<string, any> | null => {\n if (\n !isWithinInterval(new Date(control.value), {\n start,\n end,\n })\n ) {\n return { dateBetween: { requiredValue: [start, end] } }\n }\n return null\n }\n}\n\nexport function isFiscalCode() {\n return (control: AbstractControl): Record<string, any> | null => {\n if (\n control?.value &&\n !/^([A-Z]{6}[0-9LMNPQRSTUV]{2}[ABCDEHLMPRST]{1}[0-9LMNPQRSTUV]{2}[A-Z]{1}[0-9LMNPQRSTUV]{3}[A-Z]{1})$|([0-9]{11})$/gm.test(\n control.value.toUpperCase()\n )\n ) {\n return { fiscalCode: true }\n }\n return null\n }\n}\n\nexport function isVatNumber(localeList: EuroLocale[]) {\n return (control: AbstractControl): Record<string, any> | null => {\n let isInvalidVat = true\n for (const locale of localeList) {\n if (europeanVatNumber[locale]?.test(control?.value)) {\n isInvalidVat = false\n break\n }\n }\n return isInvalidVat ? { vatNumber: false } : null\n }\n}\n\nexport function wysiwygRequired() {\n return (control: AbstractControl): Record<string, any> | null => {\n const cleanHTML = control.value.replace(/<\\/?[^>]+(>|$)/g, '')\n if (!cleanHTML?.length) {\n return { required: { required: true } }\n }\n return null\n }\n}\n","import { FormControl, FormGroup } from '@angular/forms'\n\nexport type FormGroupModel<T> = FormGroup<{\n [K in keyof T]: FormControl<T[K]>\n}>\n\n/**\n * @example\n * interface Person {\n * name: string\n * lastName: string\n * age: number\n * }\n *\n * myForm: FormGroupModel<Person> = this.formBuilder.group({\n * name: this.formBuilder.control<string>('', Validators.required),\n * lastName: this.formBuilder.control<string>(''),\n * age: this.formBuilder.control<number>({value: 20, disabled: true})\n * })\n */\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;IAIY;AAAZ,CAAA,UAAY,UAAU,EAAA;AACpB,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAAA,CAAA,IAAA,CAAA,GAAA,IAAS;AACT,IAAA,UAA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,CAAC,OAAwB,KAAgC;QAC9D,IACE,OAAO,EAAE,KAAK;AACd,YAAA,CAAC,oHAAoH,CAAC,IAAI,CACxH,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAC5B,EACD;AACA,YAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE;;AAE7B,QAAA,OAAO,IAAI;AACb,KAAC;AACH;AAEM,SAAU,WAAW,CAAC,UAAwB,EAAA;IAClD,OAAO,CAAC,OAAwB,KAAgC;QAC9D,IAAI,YAAY,GAAG,IAAI;AACvB,QAAA,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE;AAC/B,YAAA,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;gBACnD,YAAY,GAAG,KAAK;gBACpB;;;AAGJ,QAAA,OAAO,YAAY,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;AACnD,KAAC;AACH;SAEgB,eAAe,GAAA;IAC7B,OAAO,CAAC,OAAwB,KAAgC;AAC9D,QAAA,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;AAC9D,QAAA,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE;YACtB,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;;AAEzC,QAAA,OAAO,IAAI;AACb,KAAC;AACH;;AClLA;;;;;;;;;;;;;AAaG;;ACnBH;;AAEG;;;;"}
@@ -9,7 +9,7 @@ import { quangFeature } from 'quang';
9
9
  class QuangLoaderService {
10
10
  constructor() {
11
11
  this.loaderState = signalState({ count: 0 });
12
- this.isLoading = computed(() => this.loaderState.count() > 0);
12
+ this.isLoading = computed(() => this.loaderState.count() > 0, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
13
13
  }
14
14
  show() {
15
15
  patchState(this.loaderState, { count: this.loaderState().count + 1 });
@@ -17,10 +17,10 @@ class QuangLoaderService {
17
17
  hide() {
18
18
  patchState(this.loaderState, { count: this.loaderState().count - 1 });
19
19
  }
20
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: QuangLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
21
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: QuangLoaderService, providedIn: 'root' }); }
20
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: QuangLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
21
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: QuangLoaderService, providedIn: 'root' }); }
22
22
  }
23
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: QuangLoaderService, decorators: [{
23
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: QuangLoaderService, decorators: [{
24
24
  type: Injectable,
25
25
  args: [{
26
26
  providedIn: 'root',
@@ -63,16 +63,16 @@ class QuangLoaderComponent {
63
63
  * Minimum time (in milliseconds) to show the loader for
64
64
  * @default 500
65
65
  */
66
- this.showAtLeastFor = input(500);
66
+ this.showAtLeastFor = input(500, ...(ngDevMode ? [{ debugName: "showAtLeastFor" }] : []));
67
67
  this.loaderService = inject(QuangLoaderService);
68
68
  this.isLoading = this.loaderService.isLoading;
69
69
  this.showLoaderBuffer$ = toObservable(this.isLoading).pipe(map((isLoading) => (isLoading ? of(isLoading) : timer(this.showAtLeastFor()).pipe(map(() => isLoading)))), switchAll());
70
70
  this.showLoader = toSignal(this.showLoaderBuffer$);
71
71
  }
72
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: QuangLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
73
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: QuangLoaderComponent, isStandalone: true, selector: "quang-loader", inputs: { showAtLeastFor: { classPropertyName: "showAtLeastFor", publicName: "showAtLeastFor", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (showLoader()) {\n <div class=\"loader-container\">\n @if (!ref?.children?.length) {\n <span class=\"loader\"></span>\n }\n <div #ref>\n <ng-content></ng-content>\n </div>\n </div>\n}\n", styles: [":host{display:block}.loader-container{position:fixed;width:100%;height:100%;display:flex;top:0;left:0;background-color:#00000080;align-items:center;justify-content:center;z-index:99999}.loader-container .loader{width:48px;height:48px;border-radius:50%;display:inline-block;position:relative;border:3px solid;border-color:rgba(255,255,255,.7607843137) rgba(255,255,255,.7607843137) rgba(255,255,255,.7607843137) transparent;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotationBack{0%{transform:rotate(0)}to{transform:rotate(-360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
72
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: QuangLoaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
73
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.7", type: QuangLoaderComponent, isStandalone: true, selector: "quang-loader", inputs: { showAtLeastFor: { classPropertyName: "showAtLeastFor", publicName: "showAtLeastFor", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (showLoader()) {\n <div class=\"loader-container\">\n @if (!ref?.children?.length) {\n <span class=\"loader\"></span>\n }\n <div #ref>\n <ng-content></ng-content>\n </div>\n </div>\n}\n", styles: [":host{display:block}.loader-container{position:fixed;width:100%;height:100%;display:flex;top:0;left:0;background-color:#00000080;align-items:center;justify-content:center;z-index:99999}.loader-container .loader{width:48px;height:48px;border-radius:50%;display:inline-block;position:relative;border:3px solid;border-color:rgba(255,255,255,.7607843137) rgba(255,255,255,.7607843137) rgba(255,255,255,.7607843137) transparent;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotationBack{0%{transform:rotate(0)}to{transform:rotate(-360deg)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
74
74
  }
75
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: QuangLoaderComponent, decorators: [{
75
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: QuangLoaderComponent, decorators: [{
76
76
  type: Component,
77
77
  args: [{ selector: 'quang-loader', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (showLoader()) {\n <div class=\"loader-container\">\n @if (!ref?.children?.length) {\n <span class=\"loader\"></span>\n }\n <div #ref>\n <ng-content></ng-content>\n </div>\n </div>\n}\n", styles: [":host{display:block}.loader-container{position:fixed;width:100%;height:100%;display:flex;top:0;left:0;background-color:#00000080;align-items:center;justify-content:center;z-index:99999}.loader-container .loader{width:48px;height:48px;border-radius:50%;display:inline-block;position:relative;border:3px solid;border-color:rgba(255,255,255,.7607843137) rgba(255,255,255,.7607843137) rgba(255,255,255,.7607843137) transparent;box-sizing:border-box;animation:rotation 1s linear infinite}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotationBack{0%{transform:rotate(0)}to{transform:rotate(-360deg)}}\n"] }]
78
78
  }] });
@@ -1 +1 @@
1
- {"version":3,"file":"quang-loader.mjs","sources":["../../../projects/quang/loader/loader.service.ts","../../../projects/quang/loader/loader.interceptor.ts","../../../projects/quang/loader/loader.component.ts","../../../projects/quang/loader/loader.component.html","../../../projects/quang/loader/loader-providers.ts","../../../projects/quang/loader/quang-loader.ts"],"sourcesContent":["import { Injectable, computed } from '@angular/core'\n\nimport { patchState, signalState } from '@ngrx/signals'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class QuangLoaderService {\n private loaderState = signalState({ count: 0 })\n\n public isLoading = computed(() => this.loaderState.count() > 0)\n\n public show(): void {\n patchState(this.loaderState, { count: this.loaderState().count + 1 })\n }\n\n public hide(): void {\n patchState(this.loaderState, { count: this.loaderState().count - 1 })\n }\n}\n","import { HttpInterceptorFn } from '@angular/common/http'\nimport { InjectionToken, inject } from '@angular/core'\n\nimport { UrlData, getExcludedUrlsByMethod, isHttpMethod } from 'quang/shared'\nimport { finalize } from 'rxjs'\n\nimport { QuangLoaderService } from './loader.service'\n\nexport const LOADER_EXCLUDED_URLS = new InjectionToken<UrlData[]>('LOADER_EXCLUDED_URLS')\n\n/**\n * @deprecated\n * @see {@link LOADER_EXCLUDED_URLS}\n */\nexport const EXCLUDED_URL = LOADER_EXCLUDED_URLS\n\nexport const quangLoaderInterceptor: HttpInterceptorFn = (request, next) => {\n const excludedUrlsByMethod = getExcludedUrlsByMethod(inject(LOADER_EXCLUDED_URLS, { optional: true }) ?? [])\n const loaderService = inject(QuangLoaderService)\n if (!isHttpMethod(request.method)) {\n return next(request)\n }\n\n if (\n Array.from(excludedUrlsByMethod.get(request.method) ?? []).some((excludedUrl) =>\n request.url.match(excludedUrl.replace(/\\//g, '\\\\/'))\n )\n ) {\n return next(request)\n }\n\n loaderService.show()\n\n return next(request).pipe(\n finalize(() => {\n loaderService.hide()\n })\n )\n}\n","import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop'\n\nimport { map, of, switchAll, timer } from 'rxjs'\n\nimport { QuangLoaderService } from './loader.service'\n\n/**\n * @example\n * <quang-loader></quang-loader>\n *\n * @example\n * <quang-loader>\n * custom loader here\n * </quang-loader>\n */\n@Component({\n selector: 'quang-loader',\n imports: [],\n templateUrl: './loader.component.html',\n styleUrl: './loader.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class QuangLoaderComponent {\n /**\n * Minimum time (in milliseconds) to show the loader for\n * @default 500\n */\n showAtLeastFor = input<number>(500)\n\n private readonly loaderService = inject(QuangLoaderService)\n\n isLoading = this.loaderService.isLoading\n\n showLoaderBuffer$ = toObservable(this.isLoading).pipe(\n map((isLoading) => (isLoading ? of(isLoading) : timer(this.showAtLeastFor()).pipe(map(() => isLoading)))),\n switchAll()\n )\n\n showLoader = toSignal(this.showLoaderBuffer$)\n}\n","@if (showLoader()) {\n <div class=\"loader-container\">\n @if (!ref?.children?.length) {\n <span class=\"loader\"></span>\n }\n <div #ref>\n <ng-content></ng-content>\n </div>\n </div>\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core'\n\nimport { QuangFeature, QuangFeatureKind, quangFeature } from 'quang'\nimport { UrlData } from 'quang/shared'\n\nimport { LOADER_EXCLUDED_URLS } from './loader.interceptor'\n\n/**\n * @example\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideLoader([\n * {\n * url: 'assets',\n * method: 'GET',\n * },\n * ])\n * ]\n * }\n */\nexport function provideQuangLoaderExcludedUrls(excludedUrls: UrlData[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: LOADER_EXCLUDED_URLS,\n useValue: excludedUrls,\n },\n ])\n}\n\nexport function withLoaderExcludedUrls(excludedUrls: UrlData[]): QuangFeature<QuangFeatureKind.LoaderFeature> {\n return quangFeature(QuangFeatureKind.LoaderFeature, [provideQuangLoaderExcludedUrls(excludedUrls)])\n}\n\n/**\n * @deprecated\n * @see {@link provideQuangLoaderExcludedUrls}\n */\nexport const provideLoader = provideQuangLoaderExcludedUrls\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAOa,kBAAkB,CAAA;AAH/B,IAAA,WAAA,GAAA;QAIU,IAAW,CAAA,WAAA,GAAG,WAAW,CAAC,EAAE,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eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAApB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,oBAAoB,uOCvBjC,uNAUA,EAAA,MAAA,EAAA,CAAA,4nBAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FDaa,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAPhC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,cAAc,EACf,OAAA,EAAA,EAAE,EAGM,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,uNAAA,EAAA,MAAA,EAAA,CAAA,4nBAAA,CAAA,EAAA;;;AEdjD;;;;;;;;;;;;AAYG;AACG,SAAU,8BAA8B,CAAC,YAAuB,EAAA;AACpE,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA;AACE,YAAA,OAAO,EAAE,oBAAoB;AAC7B,YAAA,QAAQ,EAAE,YAAY;AACvB,SAAA;AACF,KAAA,CAAC;AACJ;AAEM,SAAU,sBAAsB,CAAC,YAAuB,EAAA;IAC5D,OAAO,YAAY,yCAAiC,CAAC,8BAA8B,CAAC,YAAY,CAAC,CAAC,CAAC;AACrG;AAEA;;;AAGG;AACI,MAAM,aAAa,GAAG;;ACrC7B;;AAEG;;;;"}
1
+ {"version":3,"file":"quang-loader.mjs","sources":["../../../projects/quang/loader/loader.service.ts","../../../projects/quang/loader/loader.interceptor.ts","../../../projects/quang/loader/loader.component.ts","../../../projects/quang/loader/loader.component.html","../../../projects/quang/loader/loader-providers.ts","../../../projects/quang/loader/quang-loader.ts"],"sourcesContent":["import { Injectable, computed } from '@angular/core'\n\nimport { patchState, signalState } from '@ngrx/signals'\n\n@Injectable({\n providedIn: 'root',\n})\nexport class QuangLoaderService {\n private loaderState = signalState({ count: 0 })\n\n public isLoading = computed(() => this.loaderState.count() > 0)\n\n public show(): void {\n patchState(this.loaderState, { count: this.loaderState().count + 1 })\n }\n\n public hide(): void {\n patchState(this.loaderState, { count: this.loaderState().count - 1 })\n }\n}\n","import { HttpInterceptorFn } from '@angular/common/http'\nimport { InjectionToken, inject } from '@angular/core'\n\nimport { UrlData, getExcludedUrlsByMethod, isHttpMethod } from 'quang/shared'\nimport { finalize } from 'rxjs'\n\nimport { QuangLoaderService } from './loader.service'\n\nexport const LOADER_EXCLUDED_URLS = new InjectionToken<UrlData[]>('LOADER_EXCLUDED_URLS')\n\n/**\n * @deprecated\n * @see {@link LOADER_EXCLUDED_URLS}\n */\nexport const EXCLUDED_URL = LOADER_EXCLUDED_URLS\n\nexport const quangLoaderInterceptor: HttpInterceptorFn = (request, next) => {\n const excludedUrlsByMethod = getExcludedUrlsByMethod(inject(LOADER_EXCLUDED_URLS, { optional: true }) ?? [])\n const loaderService = inject(QuangLoaderService)\n if (!isHttpMethod(request.method)) {\n return next(request)\n }\n\n if (\n Array.from(excludedUrlsByMethod.get(request.method) ?? []).some((excludedUrl) =>\n request.url.match(excludedUrl.replace(/\\//g, '\\\\/'))\n )\n ) {\n return next(request)\n }\n\n loaderService.show()\n\n return next(request).pipe(\n finalize(() => {\n loaderService.hide()\n })\n )\n}\n","import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'\nimport { toObservable, toSignal } from '@angular/core/rxjs-interop'\n\nimport { map, of, switchAll, timer } from 'rxjs'\n\nimport { QuangLoaderService } from './loader.service'\n\n/**\n * @example\n * <quang-loader></quang-loader>\n *\n * @example\n * <quang-loader>\n * custom loader here\n * </quang-loader>\n */\n@Component({\n selector: 'quang-loader',\n imports: [],\n templateUrl: './loader.component.html',\n styleUrl: './loader.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class QuangLoaderComponent {\n /**\n * Minimum time (in milliseconds) to show the loader for\n * @default 500\n */\n showAtLeastFor = input<number>(500)\n\n private readonly loaderService = inject(QuangLoaderService)\n\n isLoading = this.loaderService.isLoading\n\n showLoaderBuffer$ = toObservable(this.isLoading).pipe(\n map((isLoading) => (isLoading ? of(isLoading) : timer(this.showAtLeastFor()).pipe(map(() => isLoading)))),\n switchAll()\n )\n\n showLoader = toSignal(this.showLoaderBuffer$)\n}\n","@if (showLoader()) {\n <div class=\"loader-container\">\n @if (!ref?.children?.length) {\n <span class=\"loader\"></span>\n }\n <div #ref>\n <ng-content></ng-content>\n </div>\n </div>\n}\n","import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core'\n\nimport { QuangFeature, QuangFeatureKind, quangFeature } from 'quang'\nimport { UrlData } from 'quang/shared'\n\nimport { LOADER_EXCLUDED_URLS } from './loader.interceptor'\n\n/**\n * @example\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideLoader([\n * {\n * url: 'assets',\n * method: 'GET',\n * },\n * ])\n * ]\n * }\n */\nexport function provideQuangLoaderExcludedUrls(excludedUrls: UrlData[]): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: LOADER_EXCLUDED_URLS,\n useValue: excludedUrls,\n },\n ])\n}\n\nexport function withLoaderExcludedUrls(excludedUrls: UrlData[]): QuangFeature<QuangFeatureKind.LoaderFeature> {\n return quangFeature(QuangFeatureKind.LoaderFeature, [provideQuangLoaderExcludedUrls(excludedUrls)])\n}\n\n/**\n * @deprecated\n * @see {@link provideQuangLoaderExcludedUrls}\n */\nexport const provideLoader = provideQuangLoaderExcludedUrls\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAOa,kBAAkB,CAAA;AAH/B,IAAA,WAAA,GAAA;QAIU,IAAA,CAAA,WAAW,GAAG,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAExC,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CA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