@c10t/nice-component-library
Version:
nice-component-library
1 lines • 669 kB
Source Map (JSON)
{"version":3,"file":"c10t-nice-component-library.mjs","sources":["../../NiceComponentLibrary/src/models/navigator.model.ts","../../NiceComponentLibrary/src/models/button-click.event.ts","../../NiceComponentLibrary/src/enums/icon-type.enum.ts","../../NiceComponentLibrary/src/models/components/button.model.ts","../../NiceComponentLibrary/src/models/components/checkbox.model.ts","../../NiceComponentLibrary/src/enums/column-type.enum.ts","../../NiceComponentLibrary/src/enums/align.enum.ts","../../NiceComponentLibrary/src/models/components/column.model.ts","../../NiceComponentLibrary/src/models/base.model.ts","../../NiceComponentLibrary/src/models/menu.model.ts","../../NiceComponentLibrary/src/models/oauth/oAuth2AuthenticationDto.ts","../../NiceComponentLibrary/src/models/oauth/authority.ts","../../NiceComponentLibrary/src/models/components/table-paging-response.model.ts","../../NiceComponentLibrary/src/models/components/table-paging-request.model.ts","../../NiceComponentLibrary/src/models/role.model.ts","../../NiceComponentLibrary/src/models/components/select.model.ts","../../NiceComponentLibrary/src/models/ui.state.ts","../../NiceComponentLibrary/src/enums/file-type.enum.ts","../../NiceComponentLibrary/src/models/components/upload.model.ts","../../NiceComponentLibrary/src/models/components/bread-crumb.model.ts","../../NiceComponentLibrary/src/models/components/flat-tree.model.ts","../../NiceComponentLibrary/src/models/components/table-footer.model.ts","../../NiceComponentLibrary/src/models/components/range-date-picker.model.ts","../../NiceComponentLibrary/src/models/components/flat-tree-config.model.ts","../../NiceComponentLibrary/src/models/components/flat-tree-node.model.ts","../../NiceComponentLibrary/src/enums/dialog-type.enum.ts","../../NiceComponentLibrary/src/models/components/custom-dialog-data-config.model.ts","../../NiceComponentLibrary/src/models/oauth/principal.ts","../../NiceComponentLibrary/src/models/components/dialog-import-file-config.model.ts","../../NiceComponentLibrary/src/models/permission.model.ts","../../NiceComponentLibrary/src/enums/action-type.enum.ts","../../NiceComponentLibrary/src/enums/base-status.enum.ts","../../NiceComponentLibrary/src/components/base/base-table.component.ts","../../NiceComponentLibrary/src/models/nice-component-library.config.ts","../../NiceComponentLibrary/src/components/cva-custom-dialog.component.ts","../../NiceComponentLibrary/src/services/utils.service.ts","../../NiceComponentLibrary/src/services/api.service.ts","../../NiceComponentLibrary/src/services/form-state.service.ts","../../NiceComponentLibrary/src/services/authorities.service.ts","../../NiceComponentLibrary/src/components/base/base-search.component.ts","../../NiceComponentLibrary/src/components/base/base-add-edit.component.ts","../../NiceComponentLibrary/src/services/MultiTranslateHttpLoader.ts","../../NiceComponentLibrary/src/directives/multi-language-table-paginator.ts","../../NiceComponentLibrary/src/services/table.service.ts","../../NiceComponentLibrary/src/services/loader.service.ts","../../NiceComponentLibrary/src/components/table/cva-table-header-cell.component.ts","../../NiceComponentLibrary/src/services/validator.service.ts","../../NiceComponentLibrary/src/components/cva-counter-input.component.ts","../../NiceComponentLibrary/src/directives/style-paginator.directive.ts","../../NiceComponentLibrary/src/components/table/cva-header-expand-button.component.ts","../../NiceComponentLibrary/src/pipes/secure.pipe.ts","../../NiceComponentLibrary/src/components/table/cva-table.component.ts","../../NiceComponentLibrary/src/directives/numeric-input-format.ts","../../NiceComponentLibrary/src/directives/pattern.directive.ts","../../NiceComponentLibrary/src/directives/format-input.directive.ts","../../NiceComponentLibrary/src/components/cva-input.component.ts","../../NiceComponentLibrary/src/directives/format-datepicker.ts","../../NiceComponentLibrary/src/services/date-util.service.ts","../../NiceComponentLibrary/src/components/datepicker/cva-date-picker.component.ts","../../NiceComponentLibrary/src/components/cva-multi-select-autocomplete.ts","../../NiceComponentLibrary/src/components/cva-live-searching.component.ts","../../NiceComponentLibrary/src/components/table/cva-smart-table.component.ts","../../NiceComponentLibrary/src/components/datepicker/cva-range-date-picker.component.ts","../../NiceComponentLibrary/src/directives/drag-drop.directive.ts","../../NiceComponentLibrary/src/components/upload/cva-multi-upload.component.ts","../../NiceComponentLibrary/src/components/upload/cva-upload-file.component.ts","../../NiceComponentLibrary/src/components/upload/cva-multi-upload-img.component.ts","../../NiceComponentLibrary/src/components/cva-breadcrumb.component.ts","../../NiceComponentLibrary/src/components/cva-loader.component.ts","../../NiceComponentLibrary/src/components/cva-tree.component.ts","../../NiceComponentLibrary/src/components/cva-radiobutton.component.ts","../../NiceComponentLibrary/src/services/flat.tree.service.ts","../../NiceComponentLibrary/src/components/tree/cva-flat-tree-node-left.component.ts","../../NiceComponentLibrary/src/components/tree/cva-flat-tree-node-right.component.ts","../../NiceComponentLibrary/src/components/tree/cva-flat-tree.component.ts","../../NiceComponentLibrary/src/components/upload/cva-dialog-import-file.component.ts","../../NiceComponentLibrary/src/components/cva-quill-editor.component.ts","../../NiceComponentLibrary/src/services/jsog.http.interceptor.ts","../../NiceComponentLibrary/src/services/loader.interceptor.ts","../../NiceComponentLibrary/src/services/authorities.resolver.service.ts","../../NiceComponentLibrary/src/services/singleton.translate.service.ts","../../NiceComponentLibrary/src/modules/angular-material.module.ts","../../NiceComponentLibrary/src/modules/nice-component-library.module.ts","../../NiceComponentLibrary/src/index.ts","../../NiceComponentLibrary/src/c10t-nice-component-library.ts"],"sourcesContent":["export class NavigatorModel {\r\n displayName: string = '';\r\n disabled?: boolean = true;\r\n iconName: string = '';\r\n roleMenu: string = '';\r\n route?: string = '';\r\n children?: NavigatorModel[] = [];\r\n isOnlyIcon: boolean = true;\r\n expanded: boolean = false;\r\n}\r\n","export class ButtonClickEvent {\r\n action: string;\r\n object: any;\r\n index: number | null | undefined;\r\n\r\n constructor(action: string, object: any, index?: number | null) {\r\n this.action = action;\r\n this.object = object;\r\n this.index = index;\r\n }\r\n}\r\n","export enum IconTypeEnum {\r\n MATERIAL_ICON='MATERIAL_ICON',\r\n FONT_AWESOME='FONT_AWESOME'\r\n}\r\n","import {AlignEnum} from \"../../enums/align.enum\";\r\nimport {IconTypeEnum} from \"../../enums/icon-type.enum\";\r\n\r\nexport class ButtonModel {\r\n columnDef: string = '';\r\n color?: string = 'warn';\r\n icon: string = '';\r\n iconType?: IconTypeEnum = IconTypeEnum.MATERIAL_ICON;\r\n click: string = '';\r\n isShowHeader?: boolean;\r\n title?: string = '';\r\n display?: (e: any) => boolean;\r\n disabled?: (e: any) => boolean;\r\n className?: string;\r\n header?: ButtonModel | string;\r\n alignHeader?: AlignEnum;\r\n}\r\n","export class CheckboxModel {\r\n id: number;\r\n viewValue: string;\r\n checked: boolean;\r\n disabled: boolean | undefined;\r\n\r\n constructor(id: number, viewValue: string, checked: boolean, disabled?: boolean) {\r\n this.id = id;\r\n this.viewValue = viewValue;\r\n this.checked = checked;\r\n this.disabled = disabled;\r\n }\r\n}\r\n","export enum ColumnTypeEnum {\r\n VIEW = 'VIEW',\r\n INPUT_COUNTER = 'INPUT_COUNTER',\r\n INPUT_CURRENCY = 'INPUT_CURRENCY',\r\n DATE_PICKER = 'DATE_PICKER',\r\n MULTI_SELECT_AUTOCOMPLETE = 'MULTI_SELECT_AUTOCOMPLETE',\r\n CHECKBOX = 'CHECKBOX',\r\n BASE64 = 'BASE64',\r\n IMG = 'IMG',\r\n IMG_NO_SECURE = 'IMG_NO_SECURE',\r\n // HTML = 'HTML',\r\n // INNER_TEXT = 'INNER_TEXT',\r\n BUTTON = 'BUTTON',\r\n INPUT = 'INPUT',\r\n LINK = 'LINK',\r\n STYLE_CSS = 'STYLE_CSS',\r\n LIVE_SEARCHING = 'LIVE_SEARCHING'\r\n}\r\n","export enum AlignEnum {\r\n LEFT = 'start',\r\n CENTER = 'center',\r\n RIGHT = 'end'\r\n}\r\n","import {ColumnTypeEnum} from '../../enums/column-type.enum';\r\nimport {SelectModel} from './select.model';\r\nimport {AlignEnum} from '../../enums/align.enum';\r\nimport {TableFooterModel} from './table-footer.model';\r\nimport {ButtonModel} from './button.model';\r\nimport {Observable} from 'rxjs';\r\n\r\nexport class ColumnModel {\r\n columnDef: string = '';\r\n header: ((e: any) => string) | string | undefined;\r\n title: (e: any) => string = (e) => `${e}`;\r\n cell: (e: any) => string = (e) => `${e}`;\r\n // set default theo ly thuyet, phai gan lai\r\n align?: AlignEnum = AlignEnum.LEFT;\r\n alignHeader?: AlignEnum;\r\n // phục vụ cho loại cột là hiển thị đường dẫn\r\n link?: (e: any) => string;\r\n // Phục vụ cho style css\r\n style?: (e: any) => string;\r\n className?: ((e: any) => string) | string;\r\n headerClassName?: (() => string) | string;\r\n columnType?: ColumnTypeEnum | ((e: any) => ColumnTypeEnum) = ColumnTypeEnum.VIEW;\r\n onCellValueChange?: (e: any) => void;\r\n onHeaderCellValueChange?: (val: any) => void;\r\n disabled?: (e: any) => boolean;\r\n optionValues?: (e: any) => SelectModel[];\r\n display?: (e: any) => boolean;\r\n isShowHeader?: boolean = false;\r\n isNotShowHeaderCheckbox?: boolean = false;\r\n isRequired?: boolean | (() => boolean) = false;\r\n min?: (e: any) => any;\r\n max?: (e: any) => any;\r\n hasWordBreakStyle?: boolean = false;\r\n validate?: (e: any) => any | null;\r\n errorMessage?: Map<string, () => string>;\r\n isTree?: boolean = false;\r\n isMultipleSelect?: boolean = false;\r\n isDecimal?: boolean | (() => boolean) = false;\r\n isExpandOptionColumn?: () => boolean;\r\n footer?: TableFooterModel;\r\n footers?: TableFooterModel[] = [];\r\n button?: ButtonModel;\r\n // Dùng cho cva-live-searching\r\n displayKey?: string;\r\n mappingConfig?: Record<string, string> = {};\r\n searchFn?: (term: string) => Observable<any[]>;\r\n rowSpan?: number = 1;\r\n colSpan?: number = 1;\r\n pattern?: string;\r\n patternFilter?: string;\r\n}\r\n","export class BaseModel {\r\n id?: number | null;\r\n checked?: boolean = false;\r\n invalid?: boolean = false;\r\n createdDate?: string;\r\n createdBy?: string;\r\n lastModifiedDate?: string;\r\n lastModifiedBy?: string;\r\n}\r\n","import {FormGroup} from \"@angular/forms\";\r\nimport {BaseModel} from \"./base.model\";\r\n\r\nexport class MenuModel extends BaseModel {\r\n clientId: string | null = null;\r\n code: string | null = null;\r\n url: string | null = null;\r\n appType: string | null = null;\r\n parentMenu: MenuModel | null = null;\r\n\r\n constructor(form: FormGroup | number) {\r\n super();\r\n if (form instanceof FormGroup) {\r\n this.id = form.get('id')?.value;\r\n this.clientId = form.get('clientId')?.value;\r\n this.code = form.get('code')?.value;\r\n this.url = form.get('url')?.value;\r\n this.appType = form.get('appType')?.value;\r\n if (form.get('parentMenu')?.value) {\r\n this.parentMenu = new MenuModel(form.get('parentMenu')?.value);\r\n }\r\n } else {\r\n this.id = form;\r\n }\r\n }\r\n}\r\n","import { UserAuthentication } from './user.authentication';\r\nimport { Authority } from './authority';\r\n\r\nexport class OAuth2AuthenticationDto {\r\n userAuthentication: UserAuthentication | null = null;\r\n authorities: Authority[] | null = null;\r\n name: string | null = null;\r\n orgId: number | null = null;\r\n orgCode: string | null = null;\r\n orgName: string | null = null;\r\n orgType: string | null = null;\r\n orgForm: string | null = null;\r\n orgPath: string | null = null;\r\n orgIsApproveVo: boolean | null = null;\r\n sapId: number | null = null;\r\n voAuthentication: string | null = null;\r\n}\r\n\r\n","export class Authority {\r\n authority: string = '';\r\n}\r\n","export class TablePagingResponseModel {\r\n content: any[] = [];\r\n page: {\r\n size: number | null;\r\n number: number | null;\r\n totalElements: number | null;\r\n totalPages: number | null;\r\n } = {\r\n size: null,\r\n number: null,\r\n totalElements: null,\r\n totalPages: null,\r\n };\r\n}\r\n","export class TablePagingRequestModel {\r\n text: string = '';\r\n pageSize: number = 0;\r\n pageNumber: number = 0;\r\n totalElements: number = 0;\r\n}\r\n","import {MenuModel} from './menu.model';\r\nimport {AbstractControl, FormGroup} from '@angular/forms';\r\nimport {PermissionModel} from \"./permission.model\";\r\nimport {BaseModel} from \"./base.model\";\r\n\r\nexport class RoleModel extends BaseModel {\r\n clientId: string | null = null;\r\n roleName: string | null = null;\r\n description: string = '';\r\n permissions: PermissionModel[] = [];\r\n menus: MenuModel[] = [];\r\n\r\n constructor(form: FormGroup | number) {\r\n super();\r\n if (!form) {\r\n return;\r\n }\r\n if (form instanceof FormGroup) {\r\n const formId: AbstractControl | null = form.get('id');\r\n if (formId) {\r\n this.id = formId.value;\r\n }\r\n const formClientId: AbstractControl | null = form.get('clientId');\r\n if (formClientId) {\r\n this.clientId = formClientId.value;\r\n }\r\n const formRoleName: AbstractControl | null = form.get('roleName');\r\n if (formRoleName) {\r\n this.roleName = formRoleName.value;\r\n }\r\n const formDescription: AbstractControl | null = form.get('description');\r\n if (formDescription) {\r\n this.description = formDescription.value;\r\n }\r\n } else {\r\n this.id = form;\r\n }\r\n }\r\n}\r\n","export class SelectModel {\r\n value: any;\r\n displayValue: string;\r\n disabled: boolean | undefined;\r\n rawData: any;\r\n\r\n constructor(value: any, displayValue: string, disabled?: boolean, rawData?: any) {\r\n this.value = value;\r\n this.displayValue = displayValue;\r\n this.disabled = disabled;\r\n this.rawData = rawData;\r\n }\r\n}\r\n","import { FormGroup } from '@angular/forms';\r\n\r\nexport class UIState {\r\n moduleName: string = '';\r\n formGroup: FormGroup = new FormGroup({});\r\n}\r\n","export enum FileTypeEnum {\r\n DOCX = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\r\n JPG = 'image/jpeg',\r\n PDF = 'application/pdf',\r\n PNG = 'image/png',\r\n RTF = 'application/msword',\r\n TXT = 'text/plain',\r\n XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\r\n XML = 'text/xml',\r\n ZIP = 'application/x-zip-compressed',\r\n DOC = 'application/msword',\r\n XLS = 'application/vnd.ms-excel'\r\n}\r\n","export class UploadModel {\r\n id?:number;\r\n name: string;\r\n type?: string;\r\n binary: File|null;\r\n previewValue: string | ArrayBuffer | null;\r\n\r\n constructor(name: string, binary: File|null, previewValue: string | ArrayBuffer | null, type?: string,\r\n id?:number) {\r\n this.name = name;\r\n this.binary = binary;\r\n this.previewValue = previewValue;\r\n this.type = type;\r\n this.id = id;\r\n }\r\n static init(url: string){\r\n const type = UploadModel.getFileType(url);\r\n const name = UploadModel.getFileName(url);\r\n return new UploadModel(name?name:'', null, url, type);\r\n }\r\n\r\n static getFileType(url: string) {\r\n const fileTypes = url ? url.split('.') : [];\r\n const type = fileTypes.length > 0 ? fileTypes[fileTypes.length - 1] : '';\r\n if (['png', 'jpg', 'jpeg', 'img'].includes(type?.toLowerCase())) {\r\n return 'image/' + type;\r\n } else if ('pdf' === type?.toLowerCase()) {\r\n return 'application/pdf';\r\n }\r\n return type;\r\n }\r\n\r\n static getFileName(url: string) {\r\n let fileName = url ? url.split('/') : [];\r\n\r\n return fileName.pop();\r\n }\r\n}\r\n","export class BreadCrumbModel {\r\n label: string;\r\n url: string;\r\n\r\n constructor(label: string, url: string) {\r\n this.label = label;\r\n this.url = url;\r\n }\r\n}\r\n","import {BaseModel} from \"../base.model\";\r\n\r\nexport class FlatTreeModel {\r\n rootData: BaseModel[] = [];\r\n value: (node: any) => string | number = (node) => `${node}`;\r\n display: (node: any) => string = (node) => `${node}`;\r\n children: (node: any) => any[] = (node) => [];\r\n}\r\n","import { AlignEnum } from '../../enums/align.enum';\r\n\r\nexport class TableFooterModel {\r\n columnDef: string = '';\r\n title: (e: any) => string = (e) => `${e}`;\r\n cell: (e: any) => string = (e) => `${e}`;\r\n colspan: number | ((e: any) => number) = 1;\r\n align?: AlignEnum = AlignEnum.LEFT;\r\n className?: ((e: any) => string) | string;\r\n display?: (e:any) => boolean; // default is false\r\n}\r\n","export class RangeDatePickerModel {\r\n fromDate: any = '';\r\n toDate: any = '';\r\n\r\n constructor(fromDate?: any, toDate?: any) {\r\n this.fromDate = fromDate ? fromDate : '';\r\n this.toDate = toDate ? toDate : '';\r\n }\r\n\r\n isString(inputValue: any): boolean {\r\n return typeof inputValue === 'string' || inputValue instanceof String;\r\n }\r\n\r\n reset() {\r\n this.toDate = '';\r\n this.fromDate = '';\r\n }\r\n\r\n}\r\n","export class FlatTreeConfigModel {\r\n isDynamicConfig = false; /* bằng true khi muốn call liên tục hàm display và hàm disabled */\r\n display: ((node: any) => boolean) | boolean = true;\r\n disabled: ((node: any) => boolean) | boolean = false;\r\n}\r\n","export class FlatTreeNodeModel {\r\n children?: FlatTreeNodeModel[] = [];\r\n value: any;\r\n displayValue = '';\r\n iconClass?: string = '';\r\n checked?: boolean;\r\n checkedDisplay?: boolean;\r\n filterChecked?: boolean;\r\n level = 0;\r\n expandable?: boolean;\r\n isExpanded?: boolean; // storage expanded status in selected tree\r\n isFilterExpanded?: boolean; // storage expanded status in choose tree\r\n display?: boolean = true;\r\n _displayFuncInput?: ((node: any) => boolean) | boolean;\r\n disabled?: boolean = false;\r\n _disabledFuncInput?: ((node: any) => boolean) | boolean;\r\n}\r\n","export enum DialogTypeEnum {\r\n CONFIRM='CONFIRM',\r\n ERROR='ERROR',\r\n INPUT_CONFIRM='INPUT_CONFIRM'\r\n}\r\n","import {DialogTypeEnum} from \"../../enums/dialog-type.enum\";\r\n\r\nexport class CustomDialogDataConfigModel {\r\n type: DialogTypeEnum = DialogTypeEnum.CONFIRM;\r\n maxLength?: number;\r\n msg?: string;\r\n msgDetail?: string;\r\n errorMsg?: string;\r\n btnOKString?: string;\r\n btnOKClass?: string;\r\n btnOK_IconClass?: string;\r\n btnCancelClass?: string;\r\n btnCancel_IconClass?: string;\r\n btnCancelString?: string;\r\n customClass?: string;\r\n hideIconButton?: boolean;\r\n}\r\n","import { RoleModel } from '../role.model';\r\n\r\nexport class Principal {\r\n username: string | null = null;\r\n firstName: string | null = null;\r\n middleName: string | null = null;\r\n lastName: string | null = null;\r\n fullName: string | null = null;\r\n gender: string | null = null;\r\n email: string | null = null;\r\n phone: string | null = null;\r\n voAuthentication: string | null = null;\r\n orgId: number | null = null;\r\n orgCode: string | null = null;\r\n orgName: string | null = null;\r\n orgType: string | null = null;\r\n orgForm: string | null = null;\r\n orgSapId: number | null = null;\r\n orgPath: string | null = null;\r\n orgIsApproveVo: boolean | null = null;\r\n roles: RoleModel[] | null = [];\r\n mustChangePassword: boolean | null = null;\r\n}\r\n","import {Observable} from \"rxjs\";\r\n\r\nexport class DialogImportFileConfigModel {\r\n downloadTemplateFunc?: () => void;\r\n importFunc?: (file: File | undefined) => Observable<any>;\r\n downloadErrorFile?: (errorImportExcelUrl: String) => void;\r\n confirmMsgKey = '';\r\n successMsgKey = '';\r\n errorMsgKey = '';\r\n}\r\n","import {BaseModel} from \"./base.model\";\r\n\r\nexport class PermissionModel extends BaseModel{\r\n clientId: string | undefined;\r\n description: string | undefined;\r\n id: number | null = null;\r\n url: string | undefined;\r\n}\r\n","export enum ActionTypeEnum {\r\n '_ADD' = 'add',\r\n '_EDIT' = 'edit',\r\n '_VIEW' = 'view'\r\n}\r\n","export enum BaseStatusEnum {\r\n _ = 'base.status.all',\r\n _DRAFT = 'base.status.draft',\r\n _APPROVED = 'base.status.approved',\r\n _REJECTED = 'base.status.rejected',\r\n}\r\n","import { ButtonClickEvent } from '../../models/button-click.event';\r\nimport { OAuth2AuthenticationDto } from '../../models/oauth/oAuth2AuthenticationDto';\r\nimport { ActivatedRoute } from '@angular/router';\r\nimport { AuthoritiesService } from '../../services/authorities.service';\r\nimport { FormGroup } from '@angular/forms';\r\nimport { HttpParams } from '@angular/common/http';\r\n\r\nexport class BaseTableComponent {\r\n me: OAuth2AuthenticationDto | null = null;\r\n\r\n constructor(protected activatedRoute: ActivatedRoute, protected authoritiesService: AuthoritiesService) {\r\n if (!this.authoritiesService.me && this.activatedRoute.snapshot.data) {\r\n this.me = this.activatedRoute.snapshot.data['me'];\r\n }\r\n if (!!this.authoritiesService.me) {\r\n this.me = this.authoritiesService.me;\r\n }\r\n if (!!this.me) {\r\n this.authoritiesService.me = this.me;\r\n this.authoritiesService.stateMe.next(this.me);\r\n }\r\n }\r\n\r\n onRowButtonClick(event: ButtonClickEvent) {\r\n const window = this as any;\r\n if (window[event.action]) {\r\n window[event.action](event.object, event.index);\r\n }\r\n }\r\n\r\n _collectParams(searchForm: FormGroup, map: { [key: string]: string }): HttpParams {\r\n let params = new HttpParams();\r\n for (const key of Object.keys(map)) {\r\n const value = map[key];\r\n if (value) {\r\n const control = searchForm.get(value);\r\n if (control) {\r\n params = params.set(key, control.value ? control.value : '');\r\n }\r\n }\r\n }\r\n return params;\r\n }\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\n\r\nexport interface NiceComponentLibraryConfig {\r\n BASE_URL: string;\r\n BASE_AUTHORIZATION_URL: string;\r\n PAGE_SIZE: number;\r\n PAGE_SIZE_OPTIONS: number[];\r\n API_DATE_FORMAT: string;\r\n DIS_DATE_FORMAT: string;\r\n DIS_DATE_TIME_FORMAT?: string;\r\n DIALOG_LOGO?: string;\r\n NO_IMAGE_AVAILABLE?: string;\r\n STYLE_DISABLE: 'TEXT' | 'CONTROL';\r\n}\r\n\r\nexport const InjectTokenNextSolutionsConfig = new InjectionToken<NiceComponentLibraryConfig>('InjectTokenNextSolutionsConfig');\r\n","import { Component, Inject, Injector, OnInit, Optional, Self } from '@angular/core';\r\nimport { InjectTokenNextSolutionsConfig, NiceComponentLibraryConfig } from '../models/nice-component-library.config';\r\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\r\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';\r\nimport { DialogTypeEnum } from '../enums/dialog-type.enum';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { CustomDialogDataConfigModel } from '../models/components/custom-dialog-data-config.model';\r\n\r\n@Component({\r\n selector: 'cva-custom-dialog',\r\n standalone: false,\r\n template: `\r\n <div class=\"cva-custom-dialog dialog-content {{data.customClass}}\" *ngIf=\"data\"\r\n\r\n style=\"padding-bottom: 0px !important;\"\r\n fxLayout=\"column\">\r\n <div class=\"img\"\r\n fxLayoutAlign=\"center center\"\r\n fxLayout\r\n *ngIf=\"config && config.DIALOG_LOGO\">\r\n <img src=\"{{config.DIALOG_LOGO}}\" alt=\"confirm-logo\" />\r\n </div>\r\n <div class=\"content\"\r\n fxLayoutAlign=\"start stretch\"\r\n fxLayout=\"column\">\r\n <div class=\"text-msg\">\r\n {{ data && data.msg ? data.msg : '' }}\r\n </div>\r\n <div class=\"text-msg-detail\" *ngIf=\"data && data.msgDetail\">\r\n {{ data.msgDetail }}\r\n </div>\r\n <!-- <div class=\"text-error\" *ngIf=\"data.type === DialogTypeEnum.ERROR\">-->\r\n <!-- {{data && data.msg ? data.msg : ''}}-->\r\n <!-- </div>-->\r\n <!-- <div class=\"text-area\" *ngIf=\"data.type === DialogTypeEnum.INPUT_CONFIRM\"-->\r\n <!-- fxLayoutAlign=\"center center\"-->\r\n <!-- fxLayout=\"column\">-->\r\n <!-- <label fxLayoutAlign=\"center center\"-->\r\n <!-- fxLayout>{{data && data.msg ? data.msg : ''}}</label>-->\r\n\r\n <mat-form-field appearance=\"outline\" class=\"input-confirm-dialog\" fxFlex=\"100%\"\r\n fxLayout=\"column\" *ngIf=\"data.type === DialogTypeEnum.INPUT_CONFIRM\">\r\n <textarea matInput [(ngModel)]=\"inputText\" fxFlex=\"100%\"\r\n maxlength=\"{{(data && !!data.maxLength) ? data.maxLength : 524288}}\"\r\n (ngModelChange)=\"onChangeInput()\"></textarea>\r\n <span *ngIf=\"!!data && !!data.maxLength\" class=\"input-suffix\"\r\n matSuffix>{{ (inputText?.length ? inputText.length : 0) + '/' + data.maxLength }}</span>\r\n <mat-hint style=\"color: red\" *ngIf=\"isError\">{{ errorInputText }}</mat-hint>\r\n </mat-form-field>\r\n <!-- </div>-->\r\n </div>\r\n </div>\r\n <hr class=\"display-hr-tag\" *ngIf=\"data.type !== DialogTypeEnum.INPUT_CONFIRM\">\r\n <div class=\"buttonArea margin-top-10\">\r\n <button mat-button\r\n class=\"{{data.btnCancelClass ? data.btnCancelClass : 'primary outline'}} btn-Cancel\"\r\n *ngIf=\"data.type !== DialogTypeEnum.ERROR\"\r\n (click)=\"onCancel()\">\r\n <i *ngIf=\"!data.hideIconButton\"\r\n class=\"{{data.btnCancel_IconClass ? data.btnCancel_IconClass : 'fa fa-times' }}\"></i> {{ data && data.btnCancelString ? data.btnCancelString : ('common.Cancel' | translate) }}\r\n </button>\r\n <button mat-button\r\n class=\"{{data.btnOKClass ? data.btnOKClass : 'primary'}} btn-OK\"\r\n (click)=\"onConfirm()\">\r\n <i *ngIf=\"!data.hideIconButton\"\r\n class=\"{{data.btnOK_IconClass ? data.btnOK_IconClass : 'fa fa-check'}}\"></i> {{ data && data.btnOKString ? data.btnOKString : ('common.OK' | translate) }}\r\n </button>\r\n </div>\r\n\r\n `,\r\n styles: [],\r\n})\r\nexport class CvaCustomDialogComponent implements OnInit, ControlValueAccessor {\r\n\r\n config: NiceComponentLibraryConfig;\r\n\r\n get DialogTypeEnum() {\r\n return DialogTypeEnum;\r\n }\r\n\r\n inputText = '';\r\n errorInputText = '';\r\n isError = false;\r\n\r\n constructor(\r\n private translateService: TranslateService,\r\n private dialogRef: MatDialogRef<CvaCustomDialogComponent>,\r\n private injector: Injector,\r\n @Self() @Optional() ngControl: NgControl,\r\n @Inject(MAT_DIALOG_DATA) public data: CustomDialogDataConfigModel) {\r\n if (ngControl) {\r\n // Hành động này thay cho provide: NG_VALUE_ACCESSOR và gắn ControlValueAccessor này vào parent FormControl\r\n ngControl.valueAccessor = this;\r\n }\r\n this.config = injector.get(InjectTokenNextSolutionsConfig);\r\n }\r\n\r\n writeValue(obj: any): void {\r\n this.inputText = obj;\r\n }\r\n\r\n propagateChange = (_: any) => {\r\n /*NON-EMPTY FOR COMPILE*/\r\n };\r\n\r\n registerOnChange(fn: any): void {\r\n this.propagateChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: any): void {\r\n\r\n }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n onConfirm() {\r\n if (this.data && this.data.type) {\r\n if (this.data.type === DialogTypeEnum.INPUT_CONFIRM) {\r\n this.isError = !this.inputText.trim();\r\n if (this.isError) {\r\n this.errorInputText = !!this.data?.errorMsg ? this.translateService.instant(this.data.errorMsg) : this.translateService.instant('common.required');\r\n return;\r\n }\r\n this.dialogRef.close({ value: this.inputText });\r\n } else {\r\n this.dialogRef.close({ value: 1 });\r\n }\r\n }\r\n }\r\n\r\n onCancel() {\r\n this.dialogRef.close();\r\n }\r\n\r\n onChangeInput() {\r\n this.isError = !this.inputText.trim();\r\n if (this.isError) {\r\n this.errorInputText = !!this.data?.errorMsg ? this.translateService.instant(this.data.errorMsg) : this.translateService.instant('common.required');\r\n }\r\n }\r\n}\r\n","import { ToastrService } from 'ngx-toastr';\r\nimport { TranslateService } from '@ngx-translate/core';\r\nimport { MatTableDataSource } from '@angular/material/table';\r\nimport { TablePagingRequestModel } from '../models/components/table-paging-request.model';\r\nimport { BaseModel } from '../models/base.model';\r\nimport { AbstractControl, FormArray, FormControl, FormGroup, NgControl } from '@angular/forms';\r\nimport { SelectModel } from '../models/components/select.model';\r\nimport { FlatTreeModel } from '../models/components/flat-tree.model';\r\nimport { MatDialog, MatDialogConfig } from '@angular/material/dialog';\r\nimport { CvaCustomDialogComponent } from '../components/cva-custom-dialog.component';\r\nimport { DialogTypeEnum } from '../enums/dialog-type.enum';\r\nimport { CustomDialogDataConfigModel } from '../models/components/custom-dialog-data-config.model';\r\nimport { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class UtilsService {\r\n\r\n constructor(\r\n private dialog: MatDialog,\r\n private transService: TranslateService, private toastr: ToastrService) {\r\n }\r\n\r\n static getEnumValue<T>(o: T, value: string): { [P in keyof T]: T[P] }[keyof T] {\r\n return (o as any)['_' + value]; // No type safety here unfrotunately\r\n }\r\n\r\n static calcPosition(e: any, results: MatTableDataSource<BaseModel>, paging: TablePagingRequestModel) {\r\n return (paging ? ((paging.pageNumber - 1) * paging.pageSize) : 0) + (results.data.indexOf(e) + 1);\r\n }\r\n\r\n static reduceEntityAttributeForFormControl(formGroup: FormGroup, e: any,\r\n dateRangeConfigList?: {\r\n dateRangeControlName: string,\r\n fromDateControlName: string,\r\n toDateControlName: string\r\n }[]) {\r\n return Object.keys(formGroup.controls).reduce(reduceEntityAttributeForFormControlByControlName, {});\r\n\r\n function reduceEntityAttributeForFormControlByControlName(formControl: any, ctrlName: string) {\r\n if (e) {\r\n let includesOfDateRangeConfig = false;\r\n if (dateRangeConfigList) {\r\n for (const dateRangeConfig of dateRangeConfigList) {\r\n if (dateRangeConfig\r\n && [dateRangeConfig.dateRangeControlName,\r\n dateRangeConfig.fromDateControlName, dateRangeConfig.toDateControlName].includes(ctrlName)) {\r\n includesOfDateRangeConfig = true;\r\n switch (ctrlName) {\r\n case dateRangeConfig.dateRangeControlName:\r\n formControl[ctrlName] = {\r\n fromDate: e[dateRangeConfig.fromDateControlName] ? e[dateRangeConfig.fromDateControlName] : null,\r\n toDate: e[dateRangeConfig.toDateControlName] ? e[dateRangeConfig.toDateControlName] : null,\r\n };\r\n break;\r\n case dateRangeConfig.fromDateControlName:\r\n formControl[ctrlName] = e[ctrlName];\r\n if (formControl[dateRangeConfig.dateRangeControlName]\r\n && typeof (formControl[dateRangeConfig.dateRangeControlName]) === 'object') {\r\n formControl[dateRangeConfig.dateRangeControlName].fromDate = e[ctrlName];\r\n }\r\n break;\r\n case dateRangeConfig.toDateControlName:\r\n formControl[ctrlName] = e[ctrlName];\r\n if (formControl[dateRangeConfig.dateRangeControlName]\r\n && typeof (formControl[dateRangeConfig.dateRangeControlName]) === 'object') {\r\n formControl[dateRangeConfig.dateRangeControlName].toDate = e[ctrlName];\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n if (!includesOfDateRangeConfig) {\r\n if (typeof (e[ctrlName]) === 'boolean') {\r\n formControl[ctrlName] = e[ctrlName] ? '1' : '0';\r\n } else if (e[ctrlName] instanceof Array) {\r\n formControl[ctrlName] = e[ctrlName];\r\n } else if (typeof (e[ctrlName]) === 'object') {\r\n formControl[ctrlName] = e[ctrlName]\r\n ? (e[ctrlName].id\r\n ? e[ctrlName].id\r\n : (e[ctrlName].code ? e[ctrlName].code : ''))\r\n : null;\r\n } else {\r\n formControl[ctrlName] = (e[ctrlName] != null && e[ctrlName] != undefined) ? e[ctrlName] : '';\r\n }\r\n }\r\n } else {\r\n formControl[ctrlName] = '';\r\n }\r\n return formControl;\r\n }\r\n }\r\n\r\n static cloneAbstractControl<T extends AbstractControl>(control: T): T | undefined {\r\n let newControl: T | undefined;\r\n\r\n if (control instanceof FormGroup) {\r\n const formGroup = new FormGroup({}, control.validator, control.asyncValidator);\r\n const controls = control.controls;\r\n if (controls) {\r\n Object.keys(controls).forEach(key => {\r\n const tempControl: AbstractControl | undefined = UtilsService.cloneAbstractControl(controls[key]);\r\n if (tempControl) {\r\n formGroup.addControl(key, tempControl);\r\n }\r\n });\r\n }\r\n newControl = formGroup as any;\r\n } else if (control instanceof FormArray) {\r\n const formArray = new FormArray<AbstractControl<any, any>>([], control.validator, control.asyncValidator);\r\n const controls = control.controls;\r\n if (controls) {\r\n controls.forEach((formControl: AbstractControl) => {\r\n const tempControl: AbstractControl | undefined = UtilsService.cloneAbstractControl<AbstractControl>(formControl);\r\n if (tempControl) {\r\n formArray.push(tempControl);\r\n }\r\n });\r\n }\r\n newControl = formArray as any;\r\n } else if (control instanceof FormControl || this.isNgControl(control)) {\r\n newControl = new FormControl(control.value, control.validator, control.asyncValidator) as any;\r\n } else {\r\n console.error('Error: unexpected formControl value', control);\r\n }\r\n\r\n if (control.disabled && newControl) newControl.disable({ emitEvent: false });\r\n\r\n return newControl;\r\n }\r\n\r\n static isNgControl(control: any): control is NgControl {\r\n return control && 'control' in control;\r\n }\r\n\r\n static convertTreeDataToAutocompleteData(treeFields: FlatTreeModel,\r\n symbol: string,\r\n hasChildFn: (_: number, node: any) => boolean,\r\n nodes: BaseModel[],\r\n prefixDisplayValue: string | null): SelectModel[] {\r\n let result: SelectModel[] = [];\r\n if (treeFields) {\r\n for (const node of nodes) {\r\n const value = treeFields.value(node).toString();\r\n const displayValue = prefixDisplayValue ? prefixDisplayValue + symbol + treeFields.display(node) : treeFields.display(node);\r\n const hasChild = hasChildFn(0, node);\r\n if (hasChild) {\r\n const childen = treeFields.children(node);\r\n result.push(...this.convertTreeDataToAutocompleteData(treeFields, symbol, hasChildFn, childen, displayValue));\r\n } else {\r\n result.push(new SelectModel(value, displayValue, hasChild, node));\r\n }\r\n }\r\n }\r\n return result;\r\n }\r\n\r\n public strFormat(str: string, replacement?: string[]) {\r\n let a = this.transService.instant(str);\r\n if (replacement === null || replacement === undefined || replacement.length === 0) {\r\n return a;\r\n }\r\n replacement.forEach((value, index) => {\r\n a = a.replace('{' + index + '}', this.transService.instant(value));\r\n });\r\n return a;\r\n }\r\n\r\n public onSuccessFunc = (onSuccessMessage?: string): void => {\r\n if (onSuccessMessage) {\r\n const msg = this.transService.instant(onSuccessMessage);\r\n this.toastr.toastrConfig.positionClass = 'toast-bottom-right';\r\n this.toastr.success(msg);\r\n }\r\n };\r\n\r\n public showWarningToarst(msgKey: string, replacement?: string[]) {\r\n const msg = this.strFormat(msgKey, replacement);\r\n this.toastr.toastrConfig.positionClass = 'toast-bottom-right';\r\n this.toastr.warning(msg);\r\n }\r\n\r\n public showErrorToarst(msgKey: string, replacement?: string[]) {\r\n const msg = this.strFormat(msgKey, replacement);\r\n this.toastr.toastrConfig.positionClass = 'toast-bottom-right';\r\n this.toastr.error(msg);\r\n }\r\n\r\n public showError = (err: string): void => {\r\n let errLocale = '';\r\n if (err !== undefined && err !== null) {\r\n errLocale = this.transService.instant(err);\r\n }\r\n this.dialog.open(CvaCustomDialogComponent, {\r\n width: '500px',\r\n data: {\r\n msg: `${errLocale}`,\r\n type: DialogTypeEnum.ERROR,\r\n },\r\n });\r\n };\r\n\r\n public execute3(apiCall: any, onSuccessFunc: (this: void, data: any, onSuccessMessage?: string) => void, onSuccessMessage: string,\r\n onErrorFunc?: (err: any) => void) {\r\n\r\n if (!apiCall) {\r\n if (onSuccessFunc) {\r\n onSuccessFunc(null);\r\n }\r\n return;\r\n }\r\n apiCall.subscribe((data: any) => {\r\n if (onSuccessFunc) {\r\n if (onSuccessMessage) {\r\n onSuccessFunc(data, onSuccessMessage);\r\n } else {\r\n onSuccessFunc(data);\r\n }\r\n } else {\r\n this.onSuccessFunc(onSuccessMessage);\r\n }\r\n }, (error1: any) => {\r\n if (error1 !== '401') {\r\n if (!!onErrorFunc) {\r\n onErrorFunc(error1);\r\n }\r\n if (error1 === '0') {\r\n this.showErrorToarst('error.serverNotResponse');\r\n } else {\r\n this.showError(error1);\r\n }\r\n }\r\n });\r\n }\r\n\r\n public execute(apiCall: any, onSuccessFunc: (this: void, d: any, onSuccessMessage?: string) => void, onSuccessMessage: string,\r\n confirmMsgTitle: string, confirmMsgTitleParamsFormat: string[] = [],\r\n confirmMsgDetail: string = '', confirmMsgDetailParamsFormat: string[] = [],\r\n confirmDialogConfig: MatDialogConfig<CustomDialogDataConfigModel> | undefined = undefined,\r\n confirmDialogButtonOk: string = 'common.OK', confirmDialogButtonCancel: string = 'common.Cancel',\r\n ) {\r\n if (confirmMsgTitle !== undefined && confirmMsgTitle !== null && confirmMsgTitle !== '') {\r\n this.showConfirmDialog(confirmMsgTitle, confirmMsgTitleParamsFormat, confirmMsgDetail, confirmMsgDetailParamsFormat,\r\n confirmDialogConfig, confirmDialogButtonOk, confirmDialogButtonCancel)\r\n .afterClosed().subscribe(result => {\r\n if (result && result.value) {\r\n this.execute3(apiCall, onSuccessFunc, onSuccessMessage);\r\n }\r\n });\r\n } else {\r\n this.execute3(apiCall, onSuccessFunc, onSuccessMessage);\r\n }\r\n }\r\n\r\n public executeWithErrorHandle(method: () => Observable<any>,\r\n onSuccessFunc: (this: void, d: any, onSuccessMessage?: string) => void,\r\n onSuccessMessage: string,\r\n confirmMsgTitle: string,\r\n confirmMsgParamsFormat: string[] = [],\r\n confirmMsgDetail: string = '',\r\n confirmMsgDetailParamsFormat: string[] = [],\r\n onErrorFunc: ((err: any) => void) | undefined,\r\n dialogConfig?: MatDialogConfig<CustomDialogDataConfigModel>,\r\n confirmDialogButtonOk: string = 'common.OK', confirmDialogButtonCancel: string = 'common.Cancel',\r\n ) {\r\n\r\n if (confirmMsgTitle !== undefined && confirmMsgTitle !== null && confirmMsgTitle !== '') {\r\n this.showConfirmDialog(confirmMsgTitle, confirmMsgParamsFormat, confirmMsgDetail, confirmMsgDetailParamsFormat, dialogConfig,\r\n confirmDialogButtonOk, confirmDialogButtonCancel)\r\n .afterClosed().subscribe((result: any) => {\r\n if (result && result.value) {\r\n this.execute3(method(), onSuccessFunc, onSuccessMessage, onErrorFunc);\r\n }\r\n });\r\n } else {\r\n this.execute3(method(), onSuccessFunc, onSuccessMessage, onErrorFunc);\r\n }\r\n }\r\n\r\n public showConfirmDialog(strTitle: string, replacementTitle: string[],\r\n strDetailMsg: string = '', replacementDetail: string[] = [],\r\n confirmDialogConfig: MatDialogConfig<CustomDialogDataConfigModel> | undefined = undefined,\r\n strOkText: string = 'common.OK', strCancelTex: string = 'common.Cancel', strCustomClass?: string,\r\n ) {\r\n const msgTitle = this.strFormat(strTitle, replacementTitle);\r\n const msgDetail = !!strDetailMsg ? this.strFormat(strDetailMsg, replacementDetail) : '';\r\n const strOk = this.transService.instant(strOkText);\r\n const strCancel = this.transService.instant(strCancelTex);\r\n const re = /\\./gi;\r\n const customClass = (strCustomClass ? strCustomClass : strTitle).replace(re, '-');\r\n return this.dialog.open(CvaCustomDialogComponent, confirmDialogConfig ? confirmDialogConfig : {\r\n width: '500px',\r\n\r\n data: {\r\n customClass: customClass,\r\n msg: msgTitle,\r\n msgDetail: msgDetail,\r\n type: DialogTypeEnum.CONFIRM,\r\n btnOKString: strOk,\r\n btnCanceString: strCancel,\r\n } as CustomDialogDataConfigModel,\r\n });\r\n }\r\n\r\n public showConfirmInputDialog(str1: string, replacement: string[],\r\n confirmInputDialogConfig: MatDialogConfig<CustomDialogDataConfigModel> | undefined = undefined,\r\n strOkText: string = 'common.OK', strCancelTex: string = 'common.Cancel', strCustomClass?: string,\r\n ) {\r\n const str = this.strFormat(str1, replacement);\r\n const strOk = this.transService.instant(strOkText);\r\n const strCancel = this.transService.instant(strCancelTex);\r\n const re = /\\./gi;\r\n const customClass = (strCustomClass ? strCustomClass : str1).replace(re, '-');\r\n\r\n return this.dialog.open(CvaCustomDialogComponent,\r\n confirmInputDialogConfig ? confirmInputDialogConfig : {\r\n width: '500px',\r\n\r\n data: {\r\n customClass: customClass,\r\n msg: str,\r\n type: DialogTypeEnum.INPUT_CONFIRM,\r\n btnOKString: strOk,\r\n btnCancelString: strCancel,\r\n } as CustomDialogDataConfigModel,\r\n });\r\n }\r\n\r\n public getEnumValueTranslated<T>(o: T, value: string): { [P in keyof T]: T[P] }[keyof T] {\r\n const key = (o as any)['_' + value]; // No type safety here unfrotunately\r\n return this.transService.instant(key);\r\n }\r\n\r\n public toBlobJon(obj: any): Blob {\r\n return new Blob([JSON.stringify(obj)], {\r\n type: 'application/json',\r\n });\r\n }\r\n}\r\n","import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';\r\nimport { Injectable, Injector } from '@angular/core';\r\nimport { FileSaverService } from 'ngx-filesaver';\r\nimport { InjectTokenNextSolutionsConfig, NiceComponentLibraryConfig } from '../models/nice-component-library.config';\r\nimport { Observable } from 'rxjs';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ApiService {\r\n\r\n config: NiceComponentLibraryConfig;\r\n\r\n constructor(private http: HttpClient, private fileSaver: FileSaverService, private injector: Injector) {\r\n this.config = injector.get(InjectTokenNextSolutionsConfig);\r\n }\r\n\r\n getFullUrl(url: string) {\r\n return this.config.BASE_URL + url;\r\n }\r\n\r\n get<T>(nativeUrl: string, params: HttpParams, baseUrl?: string): Observable<T> {\r\n return this.http.get<T>(baseUrl ? (baseUrl + nativeUrl) : this.getFullUrl(nativeUrl), { params });\r\n }\r\n\r\n getJSON<T>(file: string): Observable<T> {\r\n return this.http.get<T>(file);\r\n }\r\n\r\n getBlob(nativeUrl: string, params: HttpParams, baseUrl?: string): Observable<Blob> {\r\n const url = baseUrl ? (baseUrl + nativeUrl) : this.getFullUrl(nativeUrl);\r\n return this.http.get(url, {\r\n responseType: 'blob', // Đặt responseType thành 'blob'\r\n });\r\n }\r\n\r\n post(nativeUrl: string, obj: any, options?: { headers?: HttpHeaders, params?: HttpParams }, baseUrl?: string) {\r\n return this.http.post(baseUrl ? (baseUrl + nativeUrl) : this.getFullUrl(nativeUrl), obj, options ? {\r\n headers: options.headers,\r\n params: options.params,\r\n } : {});\r\n }\r\n\r\n postBlob(nativeUrl: string, obj: any, options: { headers?: HttpHeaders; params?: HttpParams }, baseUrl?: string) {\r\n return this.http.post(baseUrl ? (baseUrl + nativeUrl) : this.getFullUrl(nativeUrl), obj, {\r\n headers: options.headers,\r\n params: options.params,\r\n observe: 'response',\r\n responseType: 'blob',\r\n });\r\n }\r\n\r\n patch(nativeUrl: string, obj: any, options?: { headers?: HttpHeaders, params?: HttpParams }, baseUrl?: string) {\r\n return this.http.patch(baseUrl ? (baseUrl + nativeUrl) : this.getFullUrl(nativeUrl), obj,\r\n options ? { headers: options.headers, params: options.params } : {});\r\n }\r\n\r\n put(nativeUrl: string, obj: any, options?: { headers?: HttpHeaders, params?: HttpParams }, baseUrl?: string) {\r\n return this.http.put(baseUrl ? (baseUrl + nativeUrl) : this.getFullUrl(nativeUrl), obj,\r\n options ? { headers: options.headers, params: options.params } : {});\r\n }\r\n\r\n delete(nativeUrl: string, options?: { headers?: HttpHeaders, params?: HttpParams }, baseUrl?: string) {\r\n return this.http.delete(baseUrl ? (baseUrl + nativeUrl) : this.getFullUrl(nativeUrl), options ? {\r\n headers: options.headers,\r\n params: options.params,\r\n } : {});\r\n }\r\n\r\n saveFile(nativeUrl: string, obj: any, options: {\r\n headers?: HttpHeaders;\r\n params?: HttpParams\r\n }, baseUrl?: string, onErrorFunc?: (err: any) => void) {\r\n this.http.post(baseUrl ? (baseUrl + nativeUrl) : this.getFullUrl(nativeUrl), obj, {\r\n headers: options.headers,\r\n params: options.params,\r\n observe: 'response',\r\n responseType: 'blob',\r\n }).subscribe((l: HttpResponse<Blob>) => {\r\n let filename = '';\r\n const disposition = l.headers.get('Content-Disposition');\r\n if (disposition && disposition.indexOf('attachment') !== -1) {\r\n const filenameRegex = /filename[^;=\\n]*=((['\"]).*?\\2|[^;\\n]*)/;\r\n const matches = filenameRegex.exec(disposition);\r\n if (matches != null && matches[1]) {\r\n filename = matches[1].replace(/['\"]/g, '');\r\n }\r\n }\r\n const blobData: Blob | null = l.body;\r\n const contentType: string | null = l.headers.get('Content-Type');\r\n if (blobData && contentType) {\r\n this.fileSaver.save(blobData, filename, contentType);\r\n }\r\n }, (err) => {\r\n if (onErrorFunc) {\r\n onErrorFunc(err);\r\n }\r\n });\r\n }\r\n\r\n\r\n}\r\n","import { BehaviorSubject } from 'rxjs';\r\nimport { Injectable } from '@angular/core';\r\nimport { FormGroup } from '@angular/forms';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class FormStateService {\r\n private subject = new BehaviorSubject<Map<string, FormGroup>>(new Map<string, FormGroup>());\r\n uiState$ = this.subject.asObservable();\r\n\r\n setMapState(mapState: Map<string, FormGroup>) {\r\n this.subject.next(mapState);\r\n }\r\n}\r\n","import { OAuth2AuthenticationDto } from '../models/oauth/oAuth2AuthenticationDto';\r\nimport { Injectable } from '@angular/core';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class AuthoritiesService {\r\n\r\n me: OAuth2AuthenticationDto | null = null;\r\n stateMe: BehaviorSubject<OAuth2AuthenticationDto> = new BehaviorSubject<OAuth2AuthenticationDto>(new