mis-crystal-design-system 2.4.5 → 2.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/mis-crystal-design-system-datepicker_v2.umd.js +24 -10
- package/bundles/mis-crystal-design-system-datepicker_v2.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-datepicker_v2.umd.min.js +2 -2
- package/bundles/mis-crystal-design-system-datepicker_v2.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.js +17 -26
- package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.min.js +2 -2
- package/bundles/mis-crystal-design-system-daterangepicker_v2.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-table.umd.js +11 -7
- package/bundles/mis-crystal-design-system-table.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-table.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-table.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-tooltip.umd.js +86 -120
- package/bundles/mis-crystal-design-system-tooltip.umd.js.map +1 -1
- package/bundles/mis-crystal-design-system-tooltip.umd.min.js +1 -1
- package/bundles/mis-crystal-design-system-tooltip.umd.min.js.map +1 -1
- package/bundles/mis-crystal-design-system-utils.umd.js +33 -0
- package/bundles/mis-crystal-design-system-utils.umd.js.map +1 -0
- package/bundles/mis-crystal-design-system-utils.umd.min.js +2 -0
- package/bundles/mis-crystal-design-system-utils.umd.min.js.map +1 -0
- package/datepicker_v2/mis-crystal-design-system-datepicker_v2.metadata.json +1 -1
- package/daterangepicker_v2/mis-crystal-design-system-daterangepicker_v2.metadata.json +1 -1
- package/daterangepicker_v2/tz-daterangepicker.directive.d.ts +0 -1
- package/esm2015/datepicker_v2/tz-datepicker.directive.js +23 -8
- package/esm2015/daterangepicker_v2/tz-daterangepicker.directive.js +17 -25
- package/esm2015/table/table.component.js +12 -8
- package/esm2015/tooltip/index.js +2 -2
- package/esm2015/tooltip/models/tooltip.model.js +2 -0
- package/esm2015/tooltip/public_api.js +4 -4
- package/esm2015/tooltip/tooltip-container/tooltip.component.js +34 -0
- package/esm2015/tooltip/tooltip.directive.js +68 -57
- package/esm2015/tooltip/tooltip.module.js +5 -5
- package/esm2015/utils/index.js +17 -0
- package/esm2015/utils/mis-crystal-design-system-utils.js +5 -0
- package/fesm2015/mis-crystal-design-system-datepicker_v2.js +21 -6
- package/fesm2015/mis-crystal-design-system-datepicker_v2.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-daterangepicker_v2.js +15 -23
- package/fesm2015/mis-crystal-design-system-daterangepicker_v2.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-table.js +11 -7
- package/fesm2015/mis-crystal-design-system-table.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-tooltip.js +86 -101
- package/fesm2015/mis-crystal-design-system-tooltip.js.map +1 -1
- package/fesm2015/mis-crystal-design-system-utils.js +24 -0
- package/fesm2015/mis-crystal-design-system-utils.js.map +1 -0
- package/package.json +1 -1
- package/table/mis-crystal-design-system-table.metadata.json +1 -1
- package/table/table.component.d.ts +2 -1
- package/tooltip/index.d.ts +1 -1
- package/tooltip/mis-crystal-design-system-tooltip.metadata.json +1 -1
- package/tooltip/models/tooltip.model.d.ts +1 -0
- package/tooltip/public_api.d.ts +4 -3
- package/tooltip/tooltip-container/tooltip.component.d.ts +10 -0
- package/tooltip/tooltip.directive.d.ts +10 -13
- package/tooltip/tooltip.module.d.ts +1 -1
- package/utils/index.d.ts +7 -0
- package/utils/mis-crystal-design-system-utils.d.ts +4 -0
- package/utils/mis-crystal-design-system-utils.metadata.json +1 -0
- package/utils/package.json +11 -0
- package/esm2015/tooltip/tooltip.component.js +0 -60
- package/tooltip/tooltip.component.d.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-table.js","sources":["../../../projects/mis-components/table/table.component.ts","../../../projects/mis-components/table/custom-table-cell.directive.ts","../../../projects/mis-components/table/sub-table/sub-table.component.ts","../../../projects/mis-components/table/filter/filter.component.ts","../../../projects/mis-components/table/table.module.ts","../../../projects/mis-components/table/mis-crystal-design-system-table.ts"],"sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnInit,\n Output,\n QueryList,\n Renderer2,\n ViewChild,\n ViewChildren,\n} from '@angular/core';\nimport { Filter, TableFilterComponent } from './filter/filter.component';\n\n@Component({\n selector: 'mis-table',\n templateUrl: 'table.component.html',\n styleUrls: ['table.component.css'],\n})\nexport class TableComponent implements OnInit, AfterViewInit {\n // Filter related variables\n showFilter: boolean = false;\n filterName: string = '';\n filterData: Array<Filter> = [];\n filterContainerStyles: any = {};\n appliedFilters: { [key: string]: Array<{ name: string; value: string }> } =\n {};\n @Output() filtersUpdated = new EventEmitter<{\n [key: string]: Array<{ name: string; value: string }>;\n }>();\n\n @ViewChild('filter') filter: TableFilterComponent | any;\n @ViewChildren('colHeaderRef') colHeaders: QueryList<ElementRef> | any;\n\n // Pagination related variables\n selectedPage = 1;\n pages: Array<number> = [];\n\n @Output() pageSelected = new EventEmitter<number>();\n\n @Input('tableConfig') config: TableConfig | any;\n @Input() subTableconfig: TableConfig | any;\n @Input() tableDataLoading: boolean | any;\n @Input() expandedIndex: number | any;\n @Input() tableData: Array<Array<any>> = [];\n @Input() subTableData: Array<Array<any>> = [];\n @Input() subTableDataLoading: boolean | any;\n @ViewChild('table') table: ElementRef | any;\n\n constructor(private renderer: Renderer2) { }\n\n ngOnInit(): void {\n this.initializeFilters()\n if (this.config.paginationConfig) {\n this.initializePagination();\n }\n if (this.config.canScrollHorizontally === undefined) {\n this.config.canScrollHorizontally = false;\n }\n document.addEventListener('click', (event) => {\n if (this.filter) {\n let isCheckBoxClicked = true;\n let targetElement = event.target as HTMLSpanElement;\n if (targetElement.className === 'checkmark') {\n isCheckBoxClicked = true;\n this.showFilter = true;\n }\n let isClickInsideElement = this.filter.container.nativeElement.contains(\n event.target\n );\n if (!isClickInsideElement && !isCheckBoxClicked) {\n this.toggleFilter(this.filterName);\n }\n }\n });\n }\n ngAfterViewInit() {\n if (this.config.paginationConfig) {\n let height = this.table.nativeElement.offsetHeight;\n this.renderer.setStyle(\n this.table.nativeElement,\n 'height',\n (height - 56) + 'px'\n );\n }\n }\n\n // Filter related functions\n initializeFilters() {\n for (let colHeader of this.config.colHeaderConfig) {\n if (colHeader.filters) {\n let filters = []\n for (let filter of colHeader.filters) {\n if (filter.checked) {\n filters.push({\n name: filter.name,\n value: filter.value\n })\n }\n }\n if (filters.length > 0) this.appliedFilters[colHeader.data] = filters\n }\n }\n }\n toggleFilter(filterName: string) {\n if (!this.showFilter) {\n this.filterName = filterName\n this.showFilter = true\n\n let offSet = 0;\n let colHeadersReversed = this.colHeaders.toArray().reverse();\n\n for (let header of colHeadersReversed) {\n if (header.nativeElement.innerText === filterName) break;\n offSet += header.nativeElement.offsetWidth;\n }\n this.filterContainerStyles = {\n top: '44px',\n right: offSet > 0 ? offSet - 116 + 'px' : '12px',\n };\n } else {\n this.filterName = '';\n this.filterData = [];\n this.showFilter = false;\n }\n }\n updateAppliedFilters(appliedFilters: Array<{ name: string; value: string }>) {\n if (appliedFilters.length == 0) {\n delete this.appliedFilters[this.filterName];\n } else {\n this.appliedFilters[this.filterName] = appliedFilters;\n }\n this.filtersUpdated.emit({ ...this.appliedFilters });\n this.toggleFilter(this.filterName);\n }\n\n // Pagination related functions\n initializePagination() {\n if (this.config.paginationConfig) {\n let len = this.config.paginationConfig.noOfPages;\n if (len <= 7) {\n for (let i = 1; i <= len; i++) {\n this.pages.push(i);\n }\n } else {\n this.pages = [1, 2, 3, 4, 0, len];\n }\n }\n }\n updateSelectedPage(pageNumber: number) {\n if (pageNumber < 1 || pageNumber > this.config.paginationConfig.noOfPages)\n return;\n this.selectedPage = pageNumber;\n let len = this.config.paginationConfig.noOfPages;\n if (len > 7) {\n if (pageNumber - 2 <= 1) {\n this.pages = [1, 2, 3, 4, 0, len];\n } else if (pageNumber - 2 > 1 && pageNumber + 2 < len) {\n this.pages = [1, 0, pageNumber - 1, pageNumber, pageNumber + 1, 0, len];\n } else if (pageNumber + 2 >= len) {\n this.pages = [1, 0, len - 3, len - 2, len - 1, len];\n }\n }\n this.pageSelected.emit(this.selectedPage);\n }\n\n // Main container related functions\n getContainerHeight() {\n if (this.config.height) return this.config.height;\n else return '';\n }\n getContainerWidth() {\n if (this.config.width) return this.config.width;\n else return '';\n }\n\n // Column Headers related functions\n getColHeadersRowHeight() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.height\n ) {\n return this.config.colHeadersRowConfig.height;\n } else return '44px';\n }\n getColHeadersRowBorderTop() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.style?.borderTop\n ) {\n return this.config.colHeadersRowConfig.style?.borderTop;\n } else return '';\n }\n getColHeadersRowBorderBottom() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.style?.borderBottom\n ) {\n return this.config.colHeadersRowConfig.style?.borderBottom;\n } else return '1px solid #E0E0E0';\n }\n}\n\nexport interface TableConfig {\n height: string | '100%';\n width: string | '100%';\n paginationConfig?: PaginationConfig | undefined | null;\n colHeadersRowConfig: RowConfig | undefined | null;\n rowConfig: RowConfig | undefined | null;\n colHeaderConfig: Array<ColHeaderConfig>;\n colConfig: Array<ColConfig>;\n canExpand?: boolean;\n canScrollHorizontally?: boolean;\n cellHover?: boolean;\n}\nexport interface PaginationConfig {\n noOfPages: number;\n rowsPerPage: number;\n totalNoOfRows: number;\n}\nexport interface RowConfig {\n height?: string | undefined | null;\n style?: {};\n}\nexport interface ColHeaderConfig {\n type: 'text' | 'number' | 'custom';\n data: any;\n componentRef?: any;\n filters?: Array<Filter> | null;\n style?: {};\n action?: any;\n}\nexport interface ColConfig {\n type: 'text' | 'number' | 'custom';\n componentRef?: any;\n style?: {};\n action?: any;\n}\n","import {\n ComponentFactoryResolver,\n Directive,\n Input,\n ViewContainerRef,\n} from '@angular/core';\n\n@Directive({\n selector: '[customTableCell]',\n})\nexport class CustomTableCellDirective {\n private ref: any;\n private component: any;\n private cellData: any;\n\n @Input() set customComponent(value: any) {\n this.component = value;\n this.createComponent();\n }\n @Input() set data(value: any) {\n this.cellData = value;\n if (this.ref) { this.ref.instance.data = this.cellData; }\n }\n\n\n constructor(\n private viewContainerRef: ViewContainerRef,\n private componentFactoryResolver: ComponentFactoryResolver\n ) { }\n\n createComponent() {\n if (this.component) {\n const cmpFactoryResolver =\n this.componentFactoryResolver.resolveComponentFactory(this.component);\n this.viewContainerRef.clear();\n this.ref = this.viewContainerRef.createComponent(cmpFactoryResolver);\n this.setData();\n }\n }\n setData() {\n this.ref.instance.data = this.cellData;\n }\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n Input,\n OnInit,\n Renderer2,\n ViewChild,\n} from '@angular/core';\n\n@Component({\n selector: 'sub-table',\n templateUrl: 'sub-table.component.html',\n styleUrls: ['sub-table.component.css'],\n})\nexport class SubTableComponent implements OnInit, AfterViewInit {\n selectedPage = 1;\n pages: Array<number> = [];\n\n @Input() config: SubTableConfig | any;\n @Input() tableData: Array<Array<any>> = [];\n @ViewChild('table') table: ElementRef | any;\n constructor(private renderer: Renderer2) { }\n\n ngOnInit() { }\n\n ngAfterViewInit() {\n if (this.config.paginationConfig) {\n let height = this.table.nativeElement.offsetHeight;\n this.renderer.setStyle(\n this.table.nativeElement,\n 'height',\n height - 56 + 'px'\n );\n }\n }\n\n // Main container related functions\n getContainerHeight() {\n if (this.config.height) return this.config.height;\n else return '';\n }\n getContainerWidth() {\n if (this.config.width) return this.config.width;\n else return '';\n }\n\n // Column Headers related functions\n getColHeadersRowHeight() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.height\n ) {\n return this.config.colHeadersRowConfig.height;\n } else return '44px';\n }\n getColHeadersRowBorderTop() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.style?.borderTop\n ) {\n return this.config.colHeadersRowConfig.style?.borderTop;\n } else return '';\n }\n getColHeadersRowBorderBottom() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.style?.borderBottom\n ) {\n return this.config.colHeadersRowConfig.style?.borderBottom;\n } else return '1px solid #E0E0E0';\n }\n}\n\nexport interface SubTableConfig {\n height: string | '100%';\n width: string | '100%';\n dataContainerMaxHeight: string | '400px';\n showHeader?: boolean | undefined;\n rowConfig: SubTableRowConfig | undefined | null;\n colHeaderConfig?: Array<SubTableColHeaderConfig>;\n colConfig: Array<SubTableColConfig>;\n}\n\nexport interface SubTableRowConfig {\n height?: string | undefined | null;\n style?: {};\n}\nexport interface SubTableColHeaderConfig {\n type: 'text' | 'number' | 'custom';\n data: any;\n componentRef?: any;\n style?: {};\n action?: any;\n}\nexport interface SubTableColConfig {\n type: 'text' | 'number' | 'custom';\n componentRef?: any;\n style?: {};\n action?: any;\n}\n","import {\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnInit,\n Output,\n ViewChild,\n} from '@angular/core';\n\n@Component({\n selector: 'mis-table-filter',\n templateUrl: 'filter.component.html',\n styleUrls: ['filter.component.css'],\n})\nexport class TableFilterComponent implements OnInit {\n @Input() filtersData: Array<Filter> = [];\n @Input() containerStyles: any = {};\n\n @Output() filtersApplied = new EventEmitter<any>();\n\n @ViewChild('mainContainer') container: ElementRef | undefined;\n\n filtersMap: any = {};\n searchValue: string = '';\n\n constructor() { }\n\n ngOnInit(): void {\n this.filtersData.forEach((filter) => {\n this.filtersMap[filter.value] = filter;\n });\n }\n resetFilters() {\n this.filtersData.forEach((filter) => {\n this.filtersMap[filter.value].checked = false;\n });\n this.filtersApplied.emit([]);\n }\n applyFilters() {\n let list = Object.values(this.filtersMap)\n .filter((filter: Filter | any) => filter.checked)\n .map((filter: Filter | any) => {\n return {\n name: filter.name,\n value: filter.value,\n };\n });\n this.filtersApplied.emit(list);\n }\n updateSearchValue(event: any) {\n this.searchValue = event.target.value;\n }\n updateFilter(data: any) {\n if (this.filtersMap[data.name]) {\n this.filtersMap[data.name].checked = !this.filtersMap[data.name].checked;\n }\n }\n getFiltersBasedOnSearchValue(): Filter[] | any {\n let list = Object.values(this.filtersMap);\n list = list.filter((filter: Filter | any) => {\n return filter.name.match(new RegExp(this.searchValue, 'i'));\n });\n return list.sort(this.mySort);\n }\n getCheckedFilters(): Filter[] | any {\n let list = Object.values(this.filtersMap);\n list = list\n .filter((filter: Filter | any) => filter.checked)\n .sort(this.mySort);\n return list;\n }\n mySort = (a: Filter | any, b: Filter | any) => {\n if (a.name < b.name) return -1;\n else if (b.name < a.name) return 1;\n else return 0;\n };\n}\nexport interface Filter {\n name: string;\n value: string;\n checked: boolean;\n}\n","import { ModuleWithProviders, NgModule } from \"@angular/core\";\nimport { TableComponent } from \"./table.component\";\nimport { CustomTableCellDirective } from \"./custom-table-cell.directive\";\nimport { SubTableComponent } from './sub-table/sub-table.component';\nimport { CommonModule } from \"@angular/common\";\nimport { TableFilterComponent } from \"./filter/filter.component\";\nimport { CheckboxModule } from 'mis-crystal-design-system/checkbox';\nimport { ScrollingModule } from '@angular/cdk/scrolling';\n\n@NgModule({\n declarations: [\n TableComponent,\n SubTableComponent,\n TableFilterComponent,\n CustomTableCellDirective,\n ],\n imports: [\n CommonModule,\n CheckboxModule,\n ScrollingModule\n ],\n exports: [\n TableComponent,\n SubTableComponent,\n TableFilterComponent,\n CustomTableCellDirective\n ]\n})\nexport class TableModule {\n static forRoot(): ModuleWithProviders<TableModule> {\n return { ngModule: TableModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {SubTableComponent as ɵa} from './sub-table/sub-table.component';"],"names":[],"mappings":";;;;;MAoBa,cAAc;IA8BzB,YAAoB,QAAmB;QAAnB,aAAQ,GAAR,QAAQ,CAAW;;QA5BvC,eAAU,GAAY,KAAK,CAAC;QAC5B,eAAU,GAAW,EAAE,CAAC;Q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ACzB;aACF;;;AC3BD;;;;;;"}
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-table.js","sources":["../../../projects/mis-components/table/table.component.ts","../../../projects/mis-components/table/custom-table-cell.directive.ts","../../../projects/mis-components/table/sub-table/sub-table.component.ts","../../../projects/mis-components/table/filter/filter.component.ts","../../../projects/mis-components/table/table.module.ts","../../../projects/mis-components/table/mis-crystal-design-system-table.ts"],"sourcesContent":["import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnInit,\n Output,\n QueryList,\n Renderer2,\n ViewChild,\n ViewChildren,\n} from '@angular/core';\nimport { Filter, TableFilterComponent } from './filter/filter.component';\n\n@Component({\n selector: 'mis-table',\n templateUrl: 'table.component.html',\n styleUrls: ['table.component.css'],\n})\nexport class TableComponent implements OnInit, AfterViewInit {\n // Filter related variables\n showFilter: boolean = false;\n filterName: string = '';\n filterData: Array<Filter> = [];\n filterContainerStyles: any = {};\n appliedFilters: { [key: string]: Array<{ name: string; value: string }> } =\n {};\n @Output() filtersUpdated = new EventEmitter<{\n [key: string]: Array<{ name: string; value: string }>;\n }>();\n\n @ViewChild('filter') filter: TableFilterComponent | any;\n @ViewChildren('colHeaderRef') colHeaders: QueryList<ElementRef> | any;\n\n // Pagination related variables\n pages: Array<number> = [];\n tableLength: number;\n @Output() pageSelected = new EventEmitter<number>();\n\n @Input('tableConfig') config: TableConfig | any;\n @Input() subTableconfig: TableConfig | any;\n @Input() tableDataLoading: boolean | any;\n @Input() expandedIndex: number | any;\n @Input() tableData: Array<Array<any>> = [];\n @Input() subTableData: Array<Array<any>> = [];\n @Input() subTableDataLoading: boolean | any;\n @ViewChild('table') table: ElementRef | any;\n\n constructor(private renderer: Renderer2) { }\n\n ngOnInit(): void {\n this.tableLength = [].concat(...this.tableData).length;\n this.initializeFilters()\n if (this.config.paginationConfig) {\n this.initializePagination();\n }\n if (this.config.canScrollHorizontally === undefined) {\n this.config.canScrollHorizontally = false;\n }\n document.addEventListener('click', (event) => {\n if (this.filter) {\n let isCheckBoxClicked = true;\n let targetElement = event.target as HTMLSpanElement;\n if (targetElement.className === 'checkmark') {\n isCheckBoxClicked = true;\n this.showFilter = true;\n }\n let isClickInsideElement = this.filter.container.nativeElement.contains(\n event.target\n );\n if (!isClickInsideElement && !isCheckBoxClicked) {\n this.toggleFilter(this.filterName);\n }\n }\n });\n }\n ngAfterViewInit() {\n if (this.config.paginationConfig) {\n let height = this.table.nativeElement.offsetHeight;\n this.renderer.setStyle(\n this.table.nativeElement,\n 'height',\n (height - 56) + 'px'\n );\n }\n }\n\n // Filter related functions\n initializeFilters() {\n for (let colHeader of this.config?.colHeaderConfig) {\n if (colHeader.filters) {\n let filters = []\n for (let filter of colHeader.filters) {\n if (filter.checked) {\n filters.push({\n name: filter.name,\n value: filter.value\n })\n }\n }\n if (filters.length > 0) this.appliedFilters[colHeader.data] = filters\n }\n }\n }\n toggleFilter(filterName: string) {\n if (!this.showFilter) {\n this.filterName = filterName\n this.showFilter = true\n\n let offSet = 0;\n let colHeadersReversed = this.colHeaders.toArray().reverse();\n\n for (let header of colHeadersReversed) {\n if (header.nativeElement.innerText === filterName) break;\n offSet += header.nativeElement.offsetWidth;\n }\n this.filterContainerStyles = {\n top: '44px',\n right: offSet > 0 ? offSet - 116 + 'px' : '12px',\n };\n } else {\n this.filterName = '';\n this.filterData = [];\n this.showFilter = false;\n }\n }\n updateAppliedFilters(appliedFilters: Array<{ name: string; value: string }>) {\n if (appliedFilters.length == 0) {\n delete this.appliedFilters[this.filterName];\n } else {\n this.appliedFilters[this.filterName] = appliedFilters;\n }\n this.filtersUpdated.emit({ ...this.appliedFilters });\n this.toggleFilter(this.filterName);\n }\n\n // Pagination related functions\n initializePagination() {\n if (this.config.paginationConfig) {\n let len = this.config.paginationConfig.noOfPages;\n if (len <= 7) {\n for (let i = 1; i <= len; i++) {\n this.pages.push(i);\n }\n } else {\n this.pages = [1, 2, 3, 4, 0, len];\n }\n }\n }\n updateSelectedPage(pageNumber: number) {\n if (pageNumber < 1 || pageNumber > this.config.paginationConfig.noOfPages)\n return;\n this.config.paginationConfig.selectedPage = pageNumber;\n let len = this.config.paginationConfig.noOfPages;\n if (len > 7) {\n if (pageNumber - 2 <= 1) {\n this.pages = [1, 2, 3, 4, 0, len];\n } else if (pageNumber - 2 > 1 && pageNumber + 2 < len) {\n this.pages = [1, 0, pageNumber - 1, pageNumber, pageNumber + 1, 0, len];\n } else if (pageNumber + 2 >= len) {\n this.pages = [1, 0, len - 3, len - 2, len - 1, len];\n }\n }\n this.pageSelected.emit(this.config.paginationConfig?.selectedPage);\n }\n\n // Main container related functions\n getContainerHeight() {\n if (this.config?.height) return this.config.height;\n else return '';\n }\n getContainerWidth() {\n if (this.config?.width) return this.config.width;\n else return '';\n }\n\n // Column Headers related functions\n getColHeadersRowHeight() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.height\n ) {\n return this.config.colHeadersRowConfig.height;\n } else return '44px';\n }\n getColHeadersRowBorderTop() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.style?.borderTop\n ) {\n return this.config.colHeadersRowConfig.style?.borderTop;\n } else return '';\n }\n getColHeadersRowBorderBottom() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.style?.borderBottom\n ) {\n return this.config.colHeadersRowConfig.style?.borderBottom;\n } else return '1px solid #E0E0E0';\n }\n}\n\nexport interface TableConfig {\n height: string | '100%';\n width: string | '100%';\n paginationConfig?: PaginationConfig | undefined | null;\n colHeadersRowConfig: RowConfig | undefined | null;\n rowConfig: RowConfig | undefined | null;\n colHeaderConfig: Array<ColHeaderConfig>;\n colConfig: Array<ColConfig>;\n canExpand?: boolean;\n canScrollHorizontally?: boolean;\n cellHover?: boolean;\n}\nexport interface PaginationConfig {\n noOfPages: number;\n rowsPerPage: number;\n totalNoOfRows: number;\n selectedPage?: number;\n}\nexport interface RowConfig {\n height?: string | undefined | null;\n style?: {};\n}\nexport interface ColHeaderConfig {\n type: 'text' | 'number' | 'custom';\n data: any;\n componentRef?: any;\n filters?: Array<Filter> | null;\n style?: {};\n action?: any;\n}\nexport interface ColConfig {\n type: 'text' | 'number' | 'custom';\n componentRef?: any;\n style?: {};\n action?: any;\n}\n","import {\n ComponentFactoryResolver,\n Directive,\n Input,\n ViewContainerRef,\n} from '@angular/core';\n\n@Directive({\n selector: '[customTableCell]',\n})\nexport class CustomTableCellDirective {\n private ref: any;\n private component: any;\n private cellData: any;\n\n @Input() set customComponent(value: any) {\n this.component = value;\n this.createComponent();\n }\n @Input() set data(value: any) {\n this.cellData = value;\n if (this.ref) { this.ref.instance.data = this.cellData; }\n }\n\n\n constructor(\n private viewContainerRef: ViewContainerRef,\n private componentFactoryResolver: ComponentFactoryResolver\n ) { }\n\n createComponent() {\n if (this.component) {\n const cmpFactoryResolver =\n this.componentFactoryResolver.resolveComponentFactory(this.component);\n this.viewContainerRef.clear();\n this.ref = this.viewContainerRef.createComponent(cmpFactoryResolver);\n this.setData();\n }\n }\n setData() {\n this.ref.instance.data = this.cellData;\n }\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n Input,\n OnInit,\n Renderer2,\n ViewChild,\n} from '@angular/core';\n\n@Component({\n selector: 'sub-table',\n templateUrl: 'sub-table.component.html',\n styleUrls: ['sub-table.component.css'],\n})\nexport class SubTableComponent implements OnInit, AfterViewInit {\n selectedPage = 1;\n pages: Array<number> = [];\n\n @Input() config: SubTableConfig | any;\n @Input() tableData: Array<Array<any>> = [];\n @ViewChild('table') table: ElementRef | any;\n constructor(private renderer: Renderer2) { }\n\n ngOnInit() { }\n\n ngAfterViewInit() {\n if (this.config.paginationConfig) {\n let height = this.table.nativeElement.offsetHeight;\n this.renderer.setStyle(\n this.table.nativeElement,\n 'height',\n height - 56 + 'px'\n );\n }\n }\n\n // Main container related functions\n getContainerHeight() {\n if (this.config.height) return this.config.height;\n else return '';\n }\n getContainerWidth() {\n if (this.config.width) return this.config.width;\n else return '';\n }\n\n // Column Headers related functions\n getColHeadersRowHeight() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.height\n ) {\n return this.config.colHeadersRowConfig.height;\n } else return '44px';\n }\n getColHeadersRowBorderTop() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.style?.borderTop\n ) {\n return this.config.colHeadersRowConfig.style?.borderTop;\n } else return '';\n }\n getColHeadersRowBorderBottom() {\n if (\n this.config.colHeadersRowConfig &&\n this.config.colHeadersRowConfig.style?.borderBottom\n ) {\n return this.config.colHeadersRowConfig.style?.borderBottom;\n } else return '1px solid #E0E0E0';\n }\n}\n\nexport interface SubTableConfig {\n height: string | '100%';\n width: string | '100%';\n dataContainerMaxHeight: string | '400px';\n showHeader?: boolean | undefined;\n rowConfig: SubTableRowConfig | undefined | null;\n colHeaderConfig?: Array<SubTableColHeaderConfig>;\n colConfig: Array<SubTableColConfig>;\n}\n\nexport interface SubTableRowConfig {\n height?: string | undefined | null;\n style?: {};\n}\nexport interface SubTableColHeaderConfig {\n type: 'text' | 'number' | 'custom';\n data: any;\n componentRef?: any;\n style?: {};\n action?: any;\n}\nexport interface SubTableColConfig {\n type: 'text' | 'number' | 'custom';\n componentRef?: any;\n style?: {};\n action?: any;\n}\n","import {\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnInit,\n Output,\n ViewChild,\n} from '@angular/core';\n\n@Component({\n selector: 'mis-table-filter',\n templateUrl: 'filter.component.html',\n styleUrls: ['filter.component.css'],\n})\nexport class TableFilterComponent implements OnInit {\n @Input() filtersData: Array<Filter> = [];\n @Input() containerStyles: any = {};\n\n @Output() filtersApplied = new EventEmitter<any>();\n\n @ViewChild('mainContainer') container: ElementRef | undefined;\n\n filtersMap: any = {};\n searchValue: string = '';\n\n constructor() { }\n\n ngOnInit(): void {\n this.filtersData.forEach((filter) => {\n this.filtersMap[filter.value] = filter;\n });\n }\n resetFilters() {\n this.filtersData.forEach((filter) => {\n this.filtersMap[filter.value].checked = false;\n });\n this.filtersApplied.emit([]);\n }\n applyFilters() {\n let list = Object.values(this.filtersMap)\n .filter((filter: Filter | any) => filter.checked)\n .map((filter: Filter | any) => {\n return {\n name: filter.name,\n value: filter.value,\n };\n });\n this.filtersApplied.emit(list);\n }\n updateSearchValue(event: any) {\n this.searchValue = event.target.value;\n }\n updateFilter(data: any) {\n if (this.filtersMap[data.name]) {\n this.filtersMap[data.name].checked = !this.filtersMap[data.name].checked;\n }\n }\n getFiltersBasedOnSearchValue(): Filter[] | any {\n let list = Object.values(this.filtersMap);\n list = list.filter((filter: Filter | any) => {\n return filter.name.match(new RegExp(this.searchValue, 'i'));\n });\n return list.sort(this.mySort);\n }\n getCheckedFilters(): Filter[] | any {\n let list = Object.values(this.filtersMap);\n list = list\n .filter((filter: Filter | any) => filter.checked)\n .sort(this.mySort);\n return list;\n }\n mySort = (a: Filter | any, b: Filter | any) => {\n if (a.name < b.name) return -1;\n else if (b.name < a.name) return 1;\n else return 0;\n };\n}\nexport interface Filter {\n name: string;\n value: string;\n checked: boolean;\n}\n","import { ModuleWithProviders, NgModule } from \"@angular/core\";\nimport { TableComponent } from \"./table.component\";\nimport { CustomTableCellDirective } from \"./custom-table-cell.directive\";\nimport { SubTableComponent } from './sub-table/sub-table.component';\nimport { CommonModule } from \"@angular/common\";\nimport { TableFilterComponent } from \"./filter/filter.component\";\nimport { CheckboxModule } from 'mis-crystal-design-system/checkbox';\nimport { ScrollingModule } from '@angular/cdk/scrolling';\n\n@NgModule({\n declarations: [\n TableComponent,\n SubTableComponent,\n TableFilterComponent,\n CustomTableCellDirective,\n ],\n imports: [\n CommonModule,\n CheckboxModule,\n ScrollingModule\n ],\n exports: [\n TableComponent,\n SubTableComponent,\n TableFilterComponent,\n CustomTableCellDirective\n ]\n})\nexport class TableModule {\n static forRoot(): ModuleWithProviders<TableModule> {\n return { ngModule: TableModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n\nexport {SubTableComponent as ɵa} from './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AAE,WAAW,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;KACjD;;;YAtBF,QAAQ,SAAC;gBACR,YAAY,EAAE;oBACZ,cAAc;oBACd,iBAAiB;oBACjB,oBAAoB;oBACpB,wBAAwB;iBACzB;gBACD,OAAO,EAAE;oBACP,YAAY;oBACZ,cAAc;oBACd,eAAe;iBAChB;gBACD,OAAO,EAAE;oBACP,cAAc;oBACd,iBAAiB;oBACjB,oBAAoB;oBACpB,wBAAwB;iBACzB;aACF;;;AC3BD;;;;;;"}
|
|
@@ -1,77 +1,52 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, ViewChild, Directive, ElementRef, ViewContainerRef, Input, HostListener, NgModule } from '@angular/core';
|
|
2
|
+
import { OverlayConfig, Overlay } from '@angular/cdk/overlay';
|
|
3
|
+
import { take } from 'rxjs/operators';
|
|
4
|
+
import { ComponentPortal } from '@angular/cdk/portal';
|
|
5
|
+
import { genPositionPairs } from 'mis-crystal-design-system/utils';
|
|
2
6
|
import { CommonModule } from '@angular/common';
|
|
3
7
|
|
|
4
8
|
class ToolTipComponent {
|
|
5
|
-
constructor(
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
8
|
-
this.toolTipWidth = '';
|
|
9
|
-
this.toolTipPosition = 'Bottom';
|
|
10
|
-
}
|
|
11
|
-
set text(value) {
|
|
12
|
-
this.toolTipText = value;
|
|
13
|
-
this.updateToolTipPosition();
|
|
14
|
-
}
|
|
15
|
-
set width(value) {
|
|
16
|
-
this.toolTipWidth = value;
|
|
17
|
-
this.updateToolTipPosition();
|
|
18
|
-
}
|
|
19
|
-
set position(value) {
|
|
20
|
-
this.toolTipPosition = value;
|
|
21
|
-
this.updateToolTipPosition();
|
|
22
|
-
}
|
|
23
|
-
ngOnInit() {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.toolTipText = "";
|
|
11
|
+
this.toolTipPosition = "bottom";
|
|
24
12
|
}
|
|
13
|
+
ngOnInit() { }
|
|
25
14
|
ngAfterViewInit() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
this.renderer.setStyle(this.container.nativeElement, 'right', `-${width + 12}px`);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
this.renderer.setStyle(this.container.nativeElement, 'left', '50%');
|
|
41
|
-
this.renderer.setStyle(this.container.nativeElement, 'right', '');
|
|
42
|
-
}
|
|
15
|
+
var _a;
|
|
16
|
+
if (!((_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement))
|
|
17
|
+
return;
|
|
18
|
+
if (this.toolTipPosition === "top" || this.toolTipPosition === "bottom") {
|
|
19
|
+
const eleWidth = this.container.nativeElement.getBoundingClientRect();
|
|
20
|
+
this.container.nativeElement.style.left = eleWidth.width / -2 + "px";
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (this.toolTipPosition === "left") {
|
|
24
|
+
const eleWidth = this.container.nativeElement.getBoundingClientRect();
|
|
25
|
+
this.container.nativeElement.style.left = -eleWidth.width + "px";
|
|
43
26
|
}
|
|
44
27
|
}
|
|
45
28
|
}
|
|
46
29
|
ToolTipComponent.decorators = [
|
|
47
30
|
{ type: Component, args: [{
|
|
48
|
-
selector:
|
|
49
|
-
template: "<div id=\"tooltip-container\"
|
|
50
|
-
styles: ["#tooltip-container{position:absolute;z-index:1}#tooltip
|
|
31
|
+
selector: "mis-tooltip",
|
|
32
|
+
template: "<div id=\"tooltip-container\" *ngIf=\"toolTipText.length > 0\" #container>\n <div id=\"tooltip\">\n <div id=\"tooltip-text\">{{ toolTipText }}</div>\n <span\n id=\"arrow\"\n [ngClass]=\"{\n 'arrow-left': toolTipPosition === 'left',\n 'arrow-right': toolTipPosition === 'right',\n 'arrow-top': toolTipPosition === 'top',\n 'arrow-bottom': toolTipPosition === 'bottom'\n }\"\n ></span>\n </div>\n</div>\n",
|
|
33
|
+
styles: ["#tooltip-container{position:absolute;z-index:1}#tooltip{position:relative;display:block;padding:8px 12px;border-radius:8px;color:#fff;background:#181f33;font-family:Lato,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:20px;text-align:center;letter-spacing:.2px}#tooltip-text{width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}#arrow{position:absolute;height:12px;width:12px;background:#181f33;z-index:1}.arrow-top{bottom:-6px}.arrow-bottom,.arrow-top{left:50%;transform:translateX(-50%) rotate(-45deg);-webkit-transform:translateX(-50%) rotate(-45deg)}.arrow-bottom{top:-6px}.arrow-left{right:-6px}.arrow-left,.arrow-right{top:50%;transform:translateY(-50%) rotate(-45deg);-webkit-transform:translateY(-50%) rotate(-45deg)}.arrow-right{left:-6px}"]
|
|
51
34
|
},] }
|
|
52
35
|
];
|
|
53
|
-
ToolTipComponent.ctorParameters = () => [
|
|
54
|
-
{ type: Renderer2 }
|
|
55
|
-
];
|
|
36
|
+
ToolTipComponent.ctorParameters = () => [];
|
|
56
37
|
ToolTipComponent.propDecorators = {
|
|
57
|
-
|
|
58
|
-
width: [{ type: Input }],
|
|
59
|
-
position: [{ type: Input }],
|
|
60
|
-
container: [{ type: ViewChild, args: ['container',] }]
|
|
38
|
+
container: [{ type: ViewChild, args: ["container",] }]
|
|
61
39
|
};
|
|
62
40
|
|
|
63
41
|
class ToolTipDirective {
|
|
64
|
-
constructor(
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
42
|
+
constructor(element, overlay, viewContainerRef) {
|
|
43
|
+
this.element = element;
|
|
44
|
+
this.overlay = overlay;
|
|
67
45
|
this.viewContainerRef = viewContainerRef;
|
|
68
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
69
46
|
this.isToolTipDisplayed = false;
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.responsivePosition = false;
|
|
74
|
-
this.showOnHover = false;
|
|
47
|
+
this.toolTipText = "";
|
|
48
|
+
this.toolTipPosition = "bottom";
|
|
49
|
+
this.showOnHover = true;
|
|
75
50
|
}
|
|
76
51
|
set showToolTip(value) {
|
|
77
52
|
this.isToolTipDisplayed = value;
|
|
@@ -80,17 +55,11 @@ class ToolTipDirective {
|
|
|
80
55
|
else
|
|
81
56
|
this.hideToolTip();
|
|
82
57
|
}
|
|
83
|
-
set width(value) {
|
|
84
|
-
this.toolTipWidth = value;
|
|
85
|
-
this.createToolTip();
|
|
86
|
-
}
|
|
87
58
|
set text(value) {
|
|
88
59
|
this.toolTipText = value;
|
|
89
|
-
this.createToolTip();
|
|
90
60
|
}
|
|
91
61
|
set position(value) {
|
|
92
62
|
this.toolTipPosition = value;
|
|
93
|
-
this.createToolTip();
|
|
94
63
|
}
|
|
95
64
|
onMouseEnter() {
|
|
96
65
|
if (this.showOnHover)
|
|
@@ -100,68 +69,84 @@ class ToolTipDirective {
|
|
|
100
69
|
if (this.showOnHover)
|
|
101
70
|
this.hideToolTip();
|
|
102
71
|
}
|
|
103
|
-
ngOnInit() {
|
|
104
|
-
this.createToolTip();
|
|
105
|
-
}
|
|
72
|
+
ngOnInit() { }
|
|
106
73
|
ngAfterViewInit() {
|
|
107
|
-
this.renderer.setStyle(this.elementRef.nativeElement, 'position', 'relative');
|
|
108
74
|
if (this.isToolTipDisplayed)
|
|
109
75
|
this.displayToolTip();
|
|
110
76
|
else
|
|
111
77
|
this.hideToolTip();
|
|
112
|
-
if (this.isToolTipDisplayed && this.responsivePosition)
|
|
113
|
-
this.updatePosition();
|
|
114
|
-
}
|
|
115
|
-
createToolTip() {
|
|
116
|
-
const cmpFactoryResolver = this.componentFactoryResolver.resolveComponentFactory(ToolTipComponent);
|
|
117
|
-
this.viewContainerRef.clear();
|
|
118
|
-
this.componentRef = this.viewContainerRef.createComponent(cmpFactoryResolver);
|
|
119
|
-
this.componentRef.instance.width = this.toolTipWidth;
|
|
120
|
-
this.componentRef.instance.text = this.toolTipText;
|
|
121
|
-
this.componentRef.instance.position = this.toolTipPosition;
|
|
122
78
|
}
|
|
123
79
|
displayToolTip() {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
80
|
+
const positionStrategy = this.overlay
|
|
81
|
+
.position()
|
|
82
|
+
.flexibleConnectedTo(this.element)
|
|
83
|
+
.withPositions(genPositionPairs({
|
|
84
|
+
positionX: "center",
|
|
85
|
+
positionY: this.toolTipPosition === "top" ? "top" : "center",
|
|
86
|
+
offsetX: this.positionTooltip("OFFSET_X"),
|
|
87
|
+
offsetY: this.positionTooltip("OFFSET_Y")
|
|
88
|
+
}, false))
|
|
89
|
+
.withPush(true);
|
|
90
|
+
const config = new OverlayConfig({
|
|
91
|
+
hasBackdrop: false,
|
|
92
|
+
positionStrategy,
|
|
93
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition()
|
|
94
|
+
});
|
|
95
|
+
this.overlayRef = this.overlay.create(config);
|
|
96
|
+
const tempRef = new ComponentPortal(ToolTipComponent, this.viewContainerRef);
|
|
97
|
+
const tooltipRef = this.overlayRef.attach(tempRef);
|
|
98
|
+
tooltipRef.instance.toolTipText = this.toolTipText;
|
|
99
|
+
tooltipRef.instance.toolTipPosition = this.toolTipPosition;
|
|
100
|
+
this.overlayRef
|
|
101
|
+
.backdropClick()
|
|
102
|
+
.pipe(take(1))
|
|
103
|
+
.subscribe(() => {
|
|
104
|
+
this.hideToolTip();
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
positionTooltip(type) {
|
|
108
|
+
if (type === "OFFSET_X") {
|
|
109
|
+
return this.toolTipPosition === "right"
|
|
110
|
+
? this.element.nativeElement.offsetWidth / 2 + 8
|
|
111
|
+
: this.toolTipPosition === "left"
|
|
112
|
+
? (this.element.nativeElement.offsetWidth / 2 + 8) * -1
|
|
113
|
+
: this.toolTipPosition === "top" || this.toolTipPosition === "bottom"
|
|
114
|
+
? 0
|
|
115
|
+
: 8;
|
|
116
|
+
}
|
|
117
|
+
if (type !== "OFFSET_Y")
|
|
118
|
+
return;
|
|
119
|
+
return this.toolTipPosition === "right" || this.toolTipPosition === "left"
|
|
120
|
+
? -18
|
|
121
|
+
: this.toolTipPosition === "top"
|
|
122
|
+
? -44
|
|
123
|
+
: this.toolTipPosition === "bottom"
|
|
124
|
+
? this.element.nativeElement.offsetHeight / 2 + 8
|
|
125
|
+
: 8;
|
|
129
126
|
}
|
|
130
127
|
hideToolTip() {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
updatePosition() {
|
|
136
|
-
// let rect: any = this.componentRef.location.nativeElement.children[0].getBoundingClientRect()
|
|
137
|
-
// let {x, y, height, width} = rect
|
|
138
|
-
//TODO: Add logic for responsive positioning
|
|
139
|
-
// Use default value as priority and dont change it here 'toolTipPosition'
|
|
140
|
-
// Update the position using below line
|
|
141
|
-
// this.componentRef.instance.position = 'Right'
|
|
142
|
-
// console.log(x, y, height, width)
|
|
128
|
+
var _a, _b;
|
|
129
|
+
(_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.detach();
|
|
130
|
+
(_b = this.overlayRef) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
143
131
|
}
|
|
144
132
|
}
|
|
145
133
|
ToolTipDirective.decorators = [
|
|
146
134
|
{ type: Directive, args: [{
|
|
147
|
-
selector:
|
|
135
|
+
selector: "[misToolTip]"
|
|
148
136
|
},] }
|
|
149
137
|
];
|
|
150
138
|
ToolTipDirective.ctorParameters = () => [
|
|
151
139
|
{ type: ElementRef },
|
|
152
|
-
{ type:
|
|
153
|
-
{ type: ViewContainerRef }
|
|
154
|
-
{ type: ComponentFactoryResolver }
|
|
140
|
+
{ type: Overlay },
|
|
141
|
+
{ type: ViewContainerRef }
|
|
155
142
|
];
|
|
156
143
|
ToolTipDirective.propDecorators = {
|
|
157
|
-
responsivePosition: [{ type: Input }],
|
|
158
144
|
showOnHover: [{ type: Input }],
|
|
159
145
|
showToolTip: [{ type: Input }],
|
|
160
|
-
width: [{ type: Input }],
|
|
161
146
|
text: [{ type: Input }],
|
|
162
147
|
position: [{ type: Input }],
|
|
163
|
-
onMouseEnter: [{ type: HostListener, args: [
|
|
164
|
-
onMouseLeave: [{ type: HostListener, args: [
|
|
148
|
+
onMouseEnter: [{ type: HostListener, args: ["mouseenter",] }],
|
|
149
|
+
onMouseLeave: [{ type: HostListener, args: ["mouseleave",] }]
|
|
165
150
|
};
|
|
166
151
|
|
|
167
152
|
class ToolTipModule {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mis-crystal-design-system-tooltip.js","sources":["../../../projects/mis-components/tooltip/tooltip.component.ts","../../../projects/mis-components/tooltip/tooltip.directive.ts","../../../projects/mis-components/tooltip/tooltip.module.ts","../../../projects/mis-components/tooltip/mis-crystal-design-system-tooltip.ts"],"sourcesContent":["import {AfterViewInit, Component, ElementRef, Input, OnInit, Renderer2, ViewChild} from '@angular/core';\n\n@Component({\n selector: 'mis-tooltip',\n templateUrl: './tooltip.component.html',\n styleUrls: ['./tooltip.component.scss']\n})\nexport class ToolTipComponent implements OnInit, AfterViewInit{\n\n public toolTipText: string = ''\n public toolTipWidth: string = ''\n public toolTipPosition: 'Left' | 'Right' | 'Top' | 'Bottom' = 'Bottom'\n\n @Input() set text(value: string){\n this.toolTipText = value\n this.updateToolTipPosition()\n }\n @Input() set width(value: string){\n this.toolTipWidth = value;\n this.updateToolTipPosition()\n }\n @Input() set position(value: 'Left' | 'Right' | 'Top' | 'Bottom'){\n this.toolTipPosition = value\n this.updateToolTipPosition()\n }\n\n @ViewChild('container') container: ElementRef\n\n constructor(private renderer: Renderer2) {\n }\n ngOnInit() {\n }\n ngAfterViewInit(){\n this.updateToolTipPosition()\n }\n updateToolTipPosition(){\n if(this.container){\n let width = this.container.nativeElement.offsetWidth\n if(this.toolTipPosition === 'Left'){\n this.renderer.setStyle(this.container.nativeElement, 'left', `-${width + 12}px`)\n this.renderer.setStyle(this.container.nativeElement, 'right', '')\n }\n else if(this.toolTipPosition === 'Right'){\n this.renderer.setStyle(this.container.nativeElement, 'left', '')\n this.renderer.setStyle(this.container.nativeElement, 'right', `-${width + 12}px`)\n }\n else{\n this.renderer.setStyle(this.container.nativeElement, 'left', '50%')\n this.renderer.setStyle(this.container.nativeElement, 'right', '')\n }\n }\n }\n}\n","import {\n AfterViewInit,\n ComponentFactoryResolver, ComponentRef,\n Directive,\n ElementRef, HostListener, Input,\n OnInit,\n Renderer2,\n ViewContainerRef\n} from '@angular/core';\nimport {ToolTipComponent} from './tooltip.component';\nimport {isChildNodeOf} from 'codelyzer/util/isChildNodeOf';\n\n@Directive({\n selector: '[misToolTip]'\n})\nexport class ToolTipDirective implements OnInit, AfterViewInit {\n public isToolTipDisplayed: boolean = false\n public toolTipWidth: string = ''\n public toolTipText: string = ''\n public toolTipPosition: 'Left' | 'Right' | 'Top' | 'Bottom' = 'Bottom'\n\n @Input() responsivePosition: boolean = false\n @Input() showOnHover: boolean = false\n @Input() set showToolTip(value: boolean){\n this.isToolTipDisplayed = value\n if(value) this.displayToolTip()\n else this.hideToolTip()\n }\n @Input() set width(value: string){\n this.toolTipWidth = value\n this.createToolTip()\n }\n @Input() set text(value: string){\n this.toolTipText = value\n this.createToolTip()\n }\n @Input() set position(value: 'Left' | 'Right' | 'Top' | 'Bottom'){\n this.toolTipPosition = value\n this.createToolTip()\n }\n\n @HostListener('mouseenter',) onMouseEnter() {\n if (this.showOnHover) this.displayToolTip()\n }\n @HostListener('mouseleave',) onMouseLeave(){\n if(this.showOnHover) this.hideToolTip()\n }\n\n private componentRef: ComponentRef<ToolTipComponent>\n constructor(\n private elementRef: ElementRef,\n private renderer: Renderer2,\n private viewContainerRef: ViewContainerRef,\n private componentFactoryResolver: ComponentFactoryResolver\n ) {\n }\n\n ngOnInit() {\n this.createToolTip()\n }\n ngAfterViewInit(){\n this.renderer.setStyle(this.elementRef.nativeElement, 'position', 'relative')\n if(this.isToolTipDisplayed) this.displayToolTip()\n else this.hideToolTip()\n if(this.isToolTipDisplayed && this.responsivePosition) this.updatePosition()\n }\n createToolTip(){\n const cmpFactoryResolver = this.componentFactoryResolver.resolveComponentFactory(ToolTipComponent);\n this.viewContainerRef.clear();\n this.componentRef = this.viewContainerRef.createComponent(cmpFactoryResolver);\n this.componentRef.instance.width = this.toolTipWidth\n this.componentRef.instance.text = this.toolTipText\n this.componentRef.instance.position = this.toolTipPosition\n }\n displayToolTip(){\n let isChild = this.elementRef.nativeElement.contains(this.componentRef.location.nativeElement)\n if(!isChild) this.renderer.appendChild(this.elementRef.nativeElement, this.componentRef.location.nativeElement)\n if(this.responsivePosition) this.updatePosition()\n }\n hideToolTip(){\n let isChild = this.elementRef.nativeElement.contains(this.componentRef.location.nativeElement)\n if(isChild) this.renderer.removeChild(this.elementRef.nativeElement, this.componentRef.location.nativeElement)\n }\n updatePosition(){\n // let rect: any = this.componentRef.location.nativeElement.children[0].getBoundingClientRect()\n // let {x, y, height, width} = rect\n //TODO: Add logic for responsive positioning\n // Use default value as priority and dont change it here 'toolTipPosition'\n // Update the position using below line\n // this.componentRef.instance.position = 'Right'\n // console.log(x, y, height, width)\n }\n}\n\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { ToolTipDirective } from './tooltip.directive';\nimport {ToolTipComponent} from './tooltip.component';\n\n@NgModule({\n declarations: [ToolTipDirective, ToolTipComponent],\n imports: [CommonModule],\n exports: [ToolTipDirective, ToolTipComponent],\n entryComponents:[ToolTipComponent]\n})\nexport class ToolTipModule {\n static forRoot(): ModuleWithProviders<ToolTipModule> {\n return { ngModule: ToolTipModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAOa,gBAAgB;IAqB3B,YAAoB,QAAmB;QAAnB,aAAQ,GAAR,QAAQ,CAAW;QAnBhC,gBAAW,GAAW,EAAE,CAAA;QACxB,iBAAY,GAAW,EAAE,CAAA;QACzB,oBAAe,GAA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container/tooltip.component.ts","../../../projects/mis-components/tooltip/tooltip.directive.ts","../../../projects/mis-components/tooltip/tooltip.module.ts","../../../projects/mis-components/tooltip/mis-crystal-design-system-tooltip.ts"],"sourcesContent":["import { AfterViewInit, Component, ElementRef, Inject, OnInit, ViewChild } from \"@angular/core\";\nimport { ITooltipPositions } from \"../models/tooltip.model\";\n\n@Component({\n selector: \"mis-tooltip\",\n templateUrl: \"./tooltip.component.html\",\n styleUrls: [\"./tooltip.component.scss\"]\n})\nexport class ToolTipComponent implements OnInit, AfterViewInit {\n public toolTipText: string = \"\";\n public toolTipPosition: ITooltipPositions = \"bottom\";\n\n @ViewChild(\"container\") container: ElementRef;\n\n constructor() {}\n ngOnInit() {}\n ngAfterViewInit() {\n if (!this.container?.nativeElement) return;\n if (this.toolTipPosition === \"top\" || this.toolTipPosition === \"bottom\") {\n const eleWidth = this.container.nativeElement.getBoundingClientRect();\n this.container.nativeElement.style.left = eleWidth.width / -2 + \"px\";\n return;\n }\n if (this.toolTipPosition === \"left\") {\n const eleWidth = this.container.nativeElement.getBoundingClientRect();\n this.container.nativeElement.style.left = -eleWidth.width + \"px\";\n }\n }\n}\n","import { AfterViewInit, Directive, ElementRef, HostListener, Input, OnInit, ViewContainerRef, Injector } from \"@angular/core\";\nimport { Overlay, OverlayConfig, OverlayRef } from \"@angular/cdk/overlay\";\nimport { take } from \"rxjs/operators\";\nimport { ComponentPortal } from \"@angular/cdk/portal\";\nimport { ToolTipComponent } from \"./tooltip-container/tooltip.component\";\nimport { genPositionPairs } from \"mis-crystal-design-system/utils\";\nimport { ITooltipPositions } from \"./models/tooltip.model\";\n\n@Directive({\n selector: \"[misToolTip]\"\n})\nexport class ToolTipDirective implements OnInit, AfterViewInit {\n public isToolTipDisplayed: boolean = false;\n public toolTipText: string = \"\";\n public toolTipPosition: ITooltipPositions = \"bottom\";\n private overlayRef: OverlayRef;\n\n @Input() showOnHover: boolean = true;\n @Input() set showToolTip(value: boolean) {\n this.isToolTipDisplayed = value;\n if (value) this.displayToolTip();\n else this.hideToolTip();\n }\n @Input() set text(value: string) {\n this.toolTipText = value;\n }\n @Input() set position(value: ITooltipPositions) {\n this.toolTipPosition = value;\n }\n\n @HostListener(\"mouseenter\") onMouseEnter() {\n if (this.showOnHover) this.displayToolTip();\n }\n @HostListener(\"mouseleave\") onMouseLeave() {\n if (this.showOnHover) this.hideToolTip();\n }\n\n constructor(private element: ElementRef, private overlay: Overlay, private viewContainerRef: ViewContainerRef) {}\n\n ngOnInit() {}\n ngAfterViewInit() {\n if (this.isToolTipDisplayed) this.displayToolTip();\n else this.hideToolTip();\n }\n\n displayToolTip() {\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.element)\n .withPositions(\n genPositionPairs(\n {\n positionX: \"center\",\n positionY: this.toolTipPosition === \"top\" ? \"top\" : \"center\",\n offsetX: this.positionTooltip(\"OFFSET_X\"),\n offsetY: this.positionTooltip(\"OFFSET_Y\")\n },\n false\n )\n )\n .withPush(true);\n const config = new OverlayConfig({\n hasBackdrop: false,\n positionStrategy,\n scrollStrategy: this.overlay.scrollStrategies.reposition()\n });\n this.overlayRef = this.overlay.create(config);\n const tempRef = new ComponentPortal(ToolTipComponent, this.viewContainerRef);\n const tooltipRef = this.overlayRef.attach(tempRef);\n tooltipRef.instance.toolTipText = this.toolTipText;\n tooltipRef.instance.toolTipPosition = this.toolTipPosition;\n this.overlayRef\n .backdropClick()\n .pipe(take(1))\n .subscribe(() => {\n this.hideToolTip();\n });\n }\n\n positionTooltip(type: \"OFFSET_X\" | \"OFFSET_Y\") {\n if (type === \"OFFSET_X\") {\n return this.toolTipPosition === \"right\"\n ? this.element.nativeElement.offsetWidth / 2 + 8\n : this.toolTipPosition === \"left\"\n ? (this.element.nativeElement.offsetWidth / 2 + 8) * -1\n : this.toolTipPosition === \"top\" || this.toolTipPosition === \"bottom\"\n ? 0\n : 8;\n }\n if (type !== \"OFFSET_Y\") return;\n return this.toolTipPosition === \"right\" || this.toolTipPosition === \"left\"\n ? -18\n : this.toolTipPosition === \"top\"\n ? -44\n : this.toolTipPosition === \"bottom\"\n ? this.element.nativeElement.offsetHeight / 2 + 8\n : 8;\n }\n\n hideToolTip() {\n this.overlayRef?.detach();\n this.overlayRef?.dispose();\n }\n}\n","import { NgModule, ModuleWithProviders } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\n\nimport { ToolTipDirective } from \"./tooltip.directive\";\nimport { ToolTipComponent } from \"./tooltip-container/tooltip.component\";\n\n@NgModule({\n declarations: [ToolTipDirective, ToolTipComponent],\n imports: [CommonModule],\n exports: [ToolTipDirective, ToolTipComponent],\n entryComponents: [ToolTipComponent]\n})\nexport class ToolTipModule {\n static forRoot(): ModuleWithProviders<ToolTipModule> {\n return { ngModule: ToolTipModule, providers: [] };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAQa,gBAAgB;IAM3B;QALO,gBAAW,GAAW,EAAE,CAAC;QACzB,oBAAe,GAAsB,QAAQ,CAAC;KAIrC;IAChB,QAAQ,MAAK;IACb,eAAe;;QACb,IAAI,QAAC,IAAI,CAAC,SAAS,0CAAE,aAAa,CAAA;YAAE,OAAO;QAC3C,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,IAAI,IAAI,CAAC,eAAe,KAAK,QAAQ,EAAE;YACvE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC;YACtE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;YACrE,OAAO;SACR;QACD,IAAI,IAAI,CAAC,eAAe,KAAK,MAAM,EAAE;YACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,qBAAqB,EAAE,CAAC;YACtE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAA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@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConnectionPositionPair } from '@angular/cdk/overlay';
|
|
2
|
+
|
|
3
|
+
const genPositionPairs = ({ positionX, positionY, offsetX = 0, offsetY = 0 }, isResponsive) => {
|
|
4
|
+
const positions = [
|
|
5
|
+
new ConnectionPositionPair({ originX: positionX, originY: positionY }, {
|
|
6
|
+
overlayX: positionX,
|
|
7
|
+
overlayY: positionY
|
|
8
|
+
}, offsetX, offsetY),
|
|
9
|
+
new ConnectionPositionPair({ originX: "center", originY: "bottom" }, { overlayX: "center", overlayY: "top" }, offsetX, offsetY),
|
|
10
|
+
new ConnectionPositionPair({ originX: "center", originY: "top" }, { overlayX: "center", overlayY: "bottom" }, offsetX, offsetY),
|
|
11
|
+
new ConnectionPositionPair({ originX: "start", originY: "bottom" }, { overlayX: "start", overlayY: "top" }, offsetX, offsetY),
|
|
12
|
+
new ConnectionPositionPair({ originX: "start", originY: "top" }, { overlayX: "start", overlayY: "bottom" }, offsetX, offsetY),
|
|
13
|
+
new ConnectionPositionPair({ originX: "end", originY: "bottom" }, { overlayX: "end", overlayY: "top" }, offsetX, offsetY),
|
|
14
|
+
new ConnectionPositionPair({ originX: "end", originY: "top" }, { overlayX: "end", overlayY: "bottom" }, offsetX, offsetY)
|
|
15
|
+
];
|
|
16
|
+
return isResponsive ? positions : positions.slice(0, 1);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generated bundle index. Do not edit.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export { genPositionPairs };
|
|
24
|
+
//# sourceMappingURL=mis-crystal-design-system-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mis-crystal-design-system-utils.js","sources":["../../../projects/mis-components/utils/index.ts","../../../projects/mis-components/utils/mis-crystal-design-system-utils.ts"],"sourcesContent":["import { ConnectionPositionPair } from \"@angular/cdk/overlay\";\n\nexport const genPositionPairs = ({ positionX, positionY, offsetX = 0, offsetY = 0 }, isResponsive: boolean): ConnectionPositionPair[] => {\n const positions = [\n new ConnectionPositionPair(\n { originX: positionX, originY: positionY },\n {\n overlayX: positionX,\n overlayY: positionY\n },\n offsetX,\n offsetY\n ),\n new ConnectionPositionPair({ originX: \"center\", originY: \"bottom\" }, { overlayX: \"center\", overlayY: \"top\" }, offsetX, offsetY),\n new ConnectionPositionPair({ originX: \"center\", originY: \"top\" }, { overlayX: \"center\", overlayY: \"bottom\" }, offsetX, offsetY),\n new ConnectionPositionPair({ originX: \"start\", originY: \"bottom\" }, { overlayX: \"start\", overlayY: \"top\" }, offsetX, offsetY),\n new ConnectionPositionPair({ originX: \"start\", originY: \"top\" }, { overlayX: \"start\", overlayY: \"bottom\" }, offsetX, offsetY),\n new ConnectionPositionPair({ originX: \"end\", originY: \"bottom\" }, { overlayX: \"end\", overlayY: \"top\" }, offsetX, offsetY),\n new ConnectionPositionPair({ originX: \"end\", originY: \"top\" }, { overlayX: \"end\", overlayY: \"bottom\" }, offsetX, offsetY)\n ];\n return isResponsive ? positions : positions.slice(0, 1);\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;MAEa,gBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC,EAAE,EAAE,YAAqB;IACxG,MAAM,SAAS,GAAG;QAChB,IAAI,sBAAsB,CACxB,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,EAC1C;YACE,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE,SAAS;SACpB,EACD,OAAO,EACP,OAAO,CACR;QACD,IAAI,sBAAsB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC;QAC/H,IAAI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