data-grid-workspace 0.0.120
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/.editorconfig +16 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +265 -0
- package/angular.json +144 -0
- package/backup-04112025/projects/data-grid/README.md +24 -0
- package/backup-04112025/projects/data-grid/ng-package.json +18 -0
- package/backup-04112025/projects/data-grid/package-lock.json +25 -0
- package/backup-04112025/projects/data-grid/package.json +23 -0
- package/backup-04112025/projects/data-grid/src/lib/css/bootstrap.css +12043 -0
- package/backup-04112025/projects/data-grid/src/lib/data-grid/animations.ts +228 -0
- package/backup-04112025/projects/data-grid/src/lib/data-grid/data-grid.component.html +5356 -0
- package/backup-04112025/projects/data-grid/src/lib/data-grid/data-grid.component.scss +2005 -0
- package/backup-04112025/projects/data-grid/src/lib/data-grid/data-grid.component.spec.ts +28 -0
- package/backup-04112025/projects/data-grid/src/lib/data-grid/data-grid.component.ts +5368 -0
- package/backup-04112025/projects/data-grid/src/lib/data-grid/statuses.ts +49 -0
- package/backup-04112025/projects/data-grid/src/lib/data-grid.module.ts +19 -0
- package/backup-04112025/projects/data-grid/src/lib/data-grid.service.spec.ts +16 -0
- package/backup-04112025/projects/data-grid/src/lib/data-grid.service.ts +9 -0
- package/backup-04112025/projects/data-grid/src/lib/directives/draggable-header.directive.spec.ts +11 -0
- package/backup-04112025/projects/data-grid/src/lib/directives/draggable-header.directive.ts +172 -0
- package/backup-04112025/projects/data-grid/src/lib/pipes/filter.pipe.spec.ts +11 -0
- package/backup-04112025/projects/data-grid/src/lib/pipes/filter.pipe.ts +22 -0
- package/backup-04112025/projects/data-grid/src/lib/services/cell-selection.service.spec.ts +16 -0
- package/backup-04112025/projects/data-grid/src/lib/services/cell-selection.service.ts +205 -0
- package/backup-04112025/projects/data-grid/src/lib/services/common.service.spec.ts +16 -0
- package/backup-04112025/projects/data-grid/src/lib/services/common.service.ts +278 -0
- package/backup-04112025/projects/data-grid/src/lib/services/copy-service.service.spec.ts +16 -0
- package/backup-04112025/projects/data-grid/src/lib/services/copy-service.service.ts +252 -0
- package/backup-04112025/projects/data-grid/src/lib/services/drag-drp.service.spec.ts +16 -0
- package/backup-04112025/projects/data-grid/src/lib/services/drag-drp.service.ts +58 -0
- package/backup-04112025/projects/data-grid/src/lib/services/export.service.spec.ts +16 -0
- package/backup-04112025/projects/data-grid/src/lib/services/export.service.ts +189 -0
- package/backup-04112025/projects/data-grid/src/lib/services/split-columns.service.spec.ts +16 -0
- package/backup-04112025/projects/data-grid/src/lib/services/split-columns.service.ts +148 -0
- package/backup-04112025/projects/data-grid/src/lib/services/swap-columns.service.spec.ts +16 -0
- package/backup-04112025/projects/data-grid/src/lib/services/swap-columns.service.ts +162 -0
- package/backup-04112025/projects/data-grid/src/public-api.ts +6 -0
- package/backup-04112025/projects/data-grid/src/typings.d.ts +4 -0
- package/backup-04112025/projects/data-grid/tsconfig.lib.json +19 -0
- package/backup-04112025/projects/data-grid/tsconfig.lib.prod.json +10 -0
- package/backup-04112025/projects/data-grid/tsconfig.spec.json +14 -0
- package/backup-29-10-2025/projects/data-grid/README.md +24 -0
- package/backup-29-10-2025/projects/data-grid/ng-package.json +10 -0
- package/backup-29-10-2025/projects/data-grid/package-lock.json +25 -0
- package/backup-29-10-2025/projects/data-grid/package.json +12 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/css/bootstrap.css +12043 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/data-grid/animations.ts +228 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/data-grid/data-grid.component.html +5236 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/data-grid/data-grid.component.scss +1717 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/data-grid/data-grid.component.spec.ts +28 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/data-grid/data-grid.component.ts +5092 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/data-grid/statuses.ts +47 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/data-grid.module.ts +19 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/data-grid.service.spec.ts +16 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/data-grid.service.ts +9 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/directives/draggable-header.directive.spec.ts +11 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/directives/draggable-header.directive.ts +172 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/pipes/filter.pipe.spec.ts +11 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/pipes/filter.pipe.ts +22 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/cell-selection.service.spec.ts +16 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/cell-selection.service.ts +205 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/common.service.spec.ts +16 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/common.service.ts +274 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/copy-service.service.spec.ts +16 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/copy-service.service.ts +251 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/drag-drp.service.spec.ts +16 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/drag-drp.service.ts +58 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/split-columns.service.spec.ts +16 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/split-columns.service.ts +148 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/swap-columns.service.spec.ts +16 -0
- package/backup-29-10-2025/projects/data-grid/src/lib/services/swap-columns.service.ts +162 -0
- package/backup-29-10-2025/projects/data-grid/src/public-api.ts +6 -0
- package/backup-29-10-2025/projects/data-grid/tsconfig.lib.json +16 -0
- package/backup-29-10-2025/projects/data-grid/tsconfig.lib.prod.json +10 -0
- package/backup-29-10-2025/projects/data-grid/tsconfig.spec.json +14 -0
- package/image.png +0 -0
- package/package.json +52 -0
- package/projects/data-grid/README.md +324 -0
- package/projects/data-grid/ng-package.json +19 -0
- package/projects/data-grid/package-lock.json +25 -0
- package/projects/data-grid/package.json +38 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/Inter-Italic-VariableFont_opsz,wght.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/Inter-VariableFont_opsz,wght.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/OFL.txt +93 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/README.txt +118 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-Black.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-BlackItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-Bold.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-BoldItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-ExtraBold.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-ExtraBoldItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-ExtraLight.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-ExtraLightItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-Italic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-Light.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-LightItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-Medium.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-MediumItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-Regular.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-SemiBold.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-SemiBoldItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-Thin.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_18pt-ThinItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-Black.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-BlackItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-Bold.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-BoldItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-ExtraBold.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-ExtraBoldItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-ExtraLight.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-ExtraLightItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-Italic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-Light.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-LightItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-Medium.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-MediumItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-Regular.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-SemiBold.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-SemiBoldItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-Thin.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_24pt-ThinItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-Black.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-BlackItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-Bold.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-BoldItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-ExtraBold.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-ExtraBoldItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-ExtraLight.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-ExtraLightItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-Italic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-Light.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-LightItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-Medium.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-MediumItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-Regular.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-SemiBold.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-SemiBoldItalic.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-Thin.ttf +0 -0
- package/projects/data-grid/src/lib/assets/fonts/Inter/static/Inter_28pt-ThinItalic.ttf +0 -0
- package/projects/data-grid/src/lib/css/bootstrap.css +12043 -0
- package/projects/data-grid/src/lib/data-grid/animations.ts +267 -0
- package/projects/data-grid/src/lib/data-grid/data-grid.component.html +5759 -0
- package/projects/data-grid/src/lib/data-grid/data-grid.component.scss +2154 -0
- package/projects/data-grid/src/lib/data-grid/data-grid.component.spec.ts +28 -0
- package/projects/data-grid/src/lib/data-grid/data-grid.component.ts +6773 -0
- package/projects/data-grid/src/lib/data-grid/data-grid.tokens.ts +4 -0
- package/projects/data-grid/src/lib/data-grid/statuses.ts +49 -0
- package/projects/data-grid/src/lib/data-grid.module.ts +23 -0
- package/projects/data-grid/src/lib/data-grid.service.spec.ts +16 -0
- package/projects/data-grid/src/lib/data-grid.service.ts +9 -0
- package/projects/data-grid/src/lib/directives/cell-editor.directive.spec.ts +11 -0
- package/projects/data-grid/src/lib/directives/cell-editor.directive.ts +88 -0
- package/projects/data-grid/src/lib/directives/cell-render-init.directive.spec.ts +11 -0
- package/projects/data-grid/src/lib/directives/cell-render-init.directive.ts +98 -0
- package/projects/data-grid/src/lib/directives/cellHost.directive.spec.ts +11 -0
- package/projects/data-grid/src/lib/directives/cellHost.directive.ts +10 -0
- package/projects/data-grid/src/lib/directives/draggable-header.directive.spec.ts +11 -0
- package/projects/data-grid/src/lib/directives/draggable-header.directive.ts +172 -0
- package/projects/data-grid/src/lib/interfaces/data-grid-config.ts.ts +136 -0
- package/projects/data-grid/src/lib/pipes/filter.pipe.spec.ts +11 -0
- package/projects/data-grid/src/lib/pipes/filter.pipe.ts +22 -0
- package/projects/data-grid/src/lib/pipes/format-currency.pipe.spec.ts +11 -0
- package/projects/data-grid/src/lib/pipes/format-currency.pipe.ts +59 -0
- package/projects/data-grid/src/lib/pipes/format-index.pipe.spec.ts +11 -0
- package/projects/data-grid/src/lib/pipes/format-index.pipe.ts +20 -0
- package/projects/data-grid/src/lib/services/cell-selection.service.spec.ts +16 -0
- package/projects/data-grid/src/lib/services/cell-selection.service.ts +372 -0
- package/projects/data-grid/src/lib/services/common.service.spec.ts +16 -0
- package/projects/data-grid/src/lib/services/common.service.ts +395 -0
- package/projects/data-grid/src/lib/services/copy-service.service.spec.ts +16 -0
- package/projects/data-grid/src/lib/services/copy-service.service.ts +252 -0
- package/projects/data-grid/src/lib/services/drag-drp.service.spec.ts +16 -0
- package/projects/data-grid/src/lib/services/drag-drp.service.ts +58 -0
- package/projects/data-grid/src/lib/services/export.service.spec.ts +16 -0
- package/projects/data-grid/src/lib/services/export.service.ts +189 -0
- package/projects/data-grid/src/lib/services/row-action.service.ts +203 -0
- package/projects/data-grid/src/lib/services/split-columns.service.spec.ts +16 -0
- package/projects/data-grid/src/lib/services/split-columns.service.ts +168 -0
- package/projects/data-grid/src/lib/services/swap-columns.service.spec.ts +16 -0
- package/projects/data-grid/src/lib/services/swap-columns.service.ts +162 -0
- package/projects/data-grid/src/lib/styles/font-style.css +34 -0
- package/projects/data-grid/src/public-api.ts +8 -0
- package/projects/data-grid/src/typings.d.ts +4 -0
- package/projects/data-grid/tsconfig.lib.json +19 -0
- package/projects/data-grid/tsconfig.lib.prod.json +10 -0
- package/projects/data-grid/tsconfig.spec.json +14 -0
- package/src/app/app.component.html +61 -0
- package/src/app/app.component.scss +1 -0
- package/src/app/app.component.spec.ts +27 -0
- package/src/app/app.component.ts +166 -0
- package/src/app/app.module.ts +33 -0
- package/src/app/dropdown-filter/dropdown-filter.component.css +122 -0
- package/src/app/dropdown-filter/dropdown-filter.component.html +118 -0
- package/src/app/dropdown-filter/dropdown-filter.component.spec.ts +28 -0
- package/src/app/dropdown-filter/dropdown-filter.component.ts +139 -0
- package/src/app/status-cell/status-cell.component.css +0 -0
- package/src/app/status-cell/status-cell.component.html +1 -0
- package/src/app/status-cell/status-cell.component.spec.ts +28 -0
- package/src/app/status-cell/status-cell.component.ts +18 -0
- package/src/app/status-cell-editor/status-cell-editor.component.css +0 -0
- package/src/app/status-cell-editor/status-cell-editor.component.html +12 -0
- package/src/app/status-cell-editor/status-cell-editor.component.spec.ts +28 -0
- package/src/app/status-cell-editor/status-cell-editor.component.ts +77 -0
- package/src/app/sub-category-cell-component/sub-category-cell-component.component.css +6 -0
- package/src/app/sub-category-cell-component/sub-category-cell-component.component.html +3 -0
- package/src/app/sub-category-cell-component/sub-category-cell-component.component.spec.ts +28 -0
- package/src/app/sub-category-cell-component/sub-category-cell-component.component.ts +26 -0
- package/src/app/testing-data/api-translation/data.ts +1929 -0
- package/src/app/testing-data/assets-category/data.ts +1410 -0
- package/src/app/testing-data/assets-list/data.ts +26633 -0
- package/src/app/testing-data/invoices/data.ts +3698 -0
- package/src/app/testing-data/manage-employee/data.ts +83205 -0
- package/src/app/testing-data/single-day-timesheet/data.ts +4450 -0
- package/src/app/testing-data/task-management/tasks.ts +2536 -0
- package/src/app/testing-data/translation.ts +135580 -0
- package/src/app/testing-data/writeup/data.ts +29506 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/data-grid/document-icons/Newxlsx.svg +19 -0
- package/src/assets/data-grid/document-icons/Presentation.pptx +0 -0
- package/src/assets/data-grid/document-icons/Untitled spreadsheet.xlsx +0 -0
- package/src/assets/data-grid/document-icons/bell-icon.svg +31 -0
- package/src/assets/data-grid/document-icons/blank sheet ppt.pptx +0 -0
- package/src/assets/data-grid/document-icons/blank-docs-file.docx +0 -0
- package/src/assets/data-grid/document-icons/csv.svg +34 -0
- package/src/assets/data-grid/document-icons/doc.svg +34 -0
- package/src/assets/data-grid/document-icons/document-download.svg +18 -0
- package/src/assets/data-grid/document-icons/document-upload.svg +6 -0
- package/src/assets/data-grid/document-icons/docx.svg +35 -0
- package/src/assets/data-grid/document-icons/downloadDOC.svg +7 -0
- package/src/assets/data-grid/document-icons/edit-doc.svg +6 -0
- package/src/assets/data-grid/document-icons/empty-trash.svg +47 -0
- package/src/assets/data-grid/document-icons/jpeg.svg +40 -0
- package/src/assets/data-grid/document-icons/jpg.svg +24 -0
- package/src/assets/data-grid/document-icons/loading gif.gif +0 -0
- package/src/assets/data-grid/document-icons/more-Icon.svg +19 -0
- package/src/assets/data-grid/document-icons/mp4.svg +28 -0
- package/src/assets/data-grid/document-icons/my-request-empty.svg +37 -0
- package/src/assets/data-grid/document-icons/newDoc.svg +16 -0
- package/src/assets/data-grid/document-icons/newppt.svg +16 -0
- package/src/assets/data-grid/document-icons/overDue.svg +8 -0
- package/src/assets/data-grid/document-icons/ownerShare.svg +13 -0
- package/src/assets/data-grid/document-icons/pdf.svg +36 -0
- package/src/assets/data-grid/document-icons/permanantDelete.svg +4 -0
- package/src/assets/data-grid/document-icons/png.svg +53 -0
- package/src/assets/data-grid/document-icons/ppt.svg +24 -0
- package/src/assets/data-grid/document-icons/pptx.svg +25 -0
- package/src/assets/data-grid/document-icons/restore-delete.svg +4 -0
- package/src/assets/data-grid/document-icons/restoreTrash.svg +10 -0
- package/src/assets/data-grid/document-icons/send-2.svg +16 -0
- package/src/assets/data-grid/document-icons/send-request-empty.svg +41 -0
- package/src/assets/data-grid/document-icons/shareIcon.svg +6 -0
- package/src/assets/data-grid/document-icons/sharedFileIcon.svg +6 -0
- package/src/assets/data-grid/document-icons/sharedriveempty.svg +40 -0
- package/src/assets/data-grid/document-icons/task-square.svg +25 -0
- package/src/assets/data-grid/document-icons/trash-01.svg +3 -0
- package/src/assets/data-grid/document-icons/trashRestore.svg +4 -0
- package/src/assets/data-grid/document-icons/txt.svg +34 -0
- package/src/assets/data-grid/document-icons/uploadFile.svg +16 -0
- package/src/assets/data-grid/document-icons/uploadfilefolder.svg +40 -0
- package/src/assets/data-grid/document-icons/xls.svg +34 -0
- package/src/assets/data-grid/document-icons/xlsx.svg +36 -0
- package/src/assets/data-grid/icons/Buttons.svg +3 -0
- package/src/assets/data-grid/icons/High.svg +3 -0
- package/src/assets/data-grid/icons/Low.svg +3 -0
- package/src/assets/data-grid/icons/Medium.svg +3 -0
- package/src/assets/data-grid/icons/Vector.svg +3 -0
- package/src/assets/data-grid/icons/arrow-counterclockwise.svg +4 -0
- package/src/assets/data-grid/icons/arrow-down.svg +3 -0
- package/src/assets/data-grid/icons/arrow-left.svg +3 -0
- package/src/assets/data-grid/icons/arrow-right-solid-full.svg +1 -0
- package/src/assets/data-grid/icons/arrow-right.svg +10 -0
- package/src/assets/data-grid/icons/arrow-up.svg +3 -0
- package/src/assets/data-grid/icons/arrows-angle-expand.svg +3 -0
- package/src/assets/data-grid/icons/arrows-expand-vertical.svg +3 -0
- package/src/assets/data-grid/icons/arrows-move.svg +3 -0
- package/src/assets/data-grid/icons/attachments.svg +3 -0
- package/src/assets/data-grid/icons/ban.svg +3 -0
- package/src/assets/data-grid/icons/check-blue.svg +3 -0
- package/src/assets/data-grid/icons/chevron-down.svg +3 -0
- package/src/assets/data-grid/icons/chevron-right.svg +3 -0
- package/src/assets/data-grid/icons/comments.svg +3 -0
- package/src/assets/data-grid/icons/cross-primary.svg +3 -0
- package/src/assets/data-grid/icons/dash.svg +3 -0
- package/src/assets/data-grid/icons/delete.svg +3 -0
- package/src/assets/data-grid/icons/diagram-3.svg +3 -0
- package/src/assets/data-grid/icons/download.svg +5 -0
- package/src/assets/data-grid/icons/edit.svg +3 -0
- package/src/assets/data-grid/icons/expend.svg +3 -0
- package/src/assets/data-grid/icons/eye-cross.svg +10 -0
- package/src/assets/data-grid/icons/eye.svg +4 -0
- package/src/assets/data-grid/icons/filter-2.svg +5 -0
- package/src/assets/data-grid/icons/grid-3x2-gap.svg +3 -0
- package/src/assets/data-grid/icons/grip-vertical.svg +8 -0
- package/src/assets/data-grid/icons/horizontal-dots.svg +5 -0
- package/src/assets/data-grid/icons/justify.svg +3 -0
- package/src/assets/data-grid/icons/layout-three-columns.svg +3 -0
- package/src/assets/data-grid/icons/list-details.svg +8 -0
- package/src/assets/data-grid/icons/minimize.svg +4 -0
- package/src/assets/data-grid/icons/pin-blue.svg +5 -0
- package/src/assets/data-grid/icons/pin-left.svg +3 -0
- package/src/assets/data-grid/icons/pin-right.svg +3 -0
- package/src/assets/data-grid/icons/pin.svg +5 -0
- package/src/assets/data-grid/icons/plus.svg +3 -0
- package/src/assets/data-grid/icons/resize-handle.svg +3 -0
- package/src/assets/data-grid/icons/search.svg +3 -0
- package/src/assets/data-grid/icons/settings-2.svg +3 -0
- package/src/assets/data-grid/icons/sort-asc.svg +4 -0
- package/src/assets/data-grid/icons/sort-desc.svg +4 -0
- package/src/assets/data-grid/icons/star-blue.svg +3 -0
- package/src/assets/data-grid/icons/star.svg +3 -0
- package/src/assets/data-grid/icons/table-2.svg +3 -0
- package/src/assets/data-grid/icons/three-dots-vertical.svg +5 -0
- package/src/assets/data-grid/icons/trash-red.svg +7 -0
- package/src/assets/data-grid/icons/ui-checks-grid.svg +3 -0
- package/src/assets/data-grid/icons/x.svg +3 -0
- package/src/assets/data-grid/icons/zoom-charge.svg +4 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +19 -0
- package/src/main.ts +7 -0
- package/src/styles.scss +3 -0
- package/tsconfig.app.json +14 -0
- package/tsconfig.json +44 -0
- package/tsconfig.spec.json +14 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Injectable({
|
|
4
|
+
providedIn: 'root'
|
|
5
|
+
})
|
|
6
|
+
export class CommonService {
|
|
7
|
+
|
|
8
|
+
constructor() { }
|
|
9
|
+
gethasVisibleColumns(columns: any[]): boolean {
|
|
10
|
+
const checkVisible = (columns: any[]): boolean => {
|
|
11
|
+
return columns.some((col) => {
|
|
12
|
+
if (col?.is_visible) return true;
|
|
13
|
+
if (col?.children?.length) {
|
|
14
|
+
return checkVisible(col.children);
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
return checkVisible(columns);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
gethasInVisibleColumns(columns: any[]): boolean {
|
|
23
|
+
const checkVisible = (columns: any[]): boolean => {
|
|
24
|
+
return columns.some((col) => {
|
|
25
|
+
if (!col?.is_visible) return true;
|
|
26
|
+
if (col?.children?.length) {
|
|
27
|
+
return checkVisible(col.children);
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return checkVisible(columns);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
getTotalColumnsLength(columns: any[]): number {
|
|
37
|
+
let count = 0;
|
|
38
|
+
|
|
39
|
+
columns.forEach(col => {
|
|
40
|
+
if (col.children && Array.isArray(col.children) && col.children.length) {
|
|
41
|
+
count += col.children.length; // count children instead of parent
|
|
42
|
+
} else {
|
|
43
|
+
count += 1; // count parent directly
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return count;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
gethasRightPinnedColumns(columns: any[]): boolean {
|
|
51
|
+
const checkPinnedRight = (columns: any[]): boolean => {
|
|
52
|
+
return columns.some((col) => {
|
|
53
|
+
if (col?.pinned === 'right' && col?.is_visible) return true;
|
|
54
|
+
if (col?.children?.length) {
|
|
55
|
+
return checkPinnedRight(col.children);
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return checkPinnedRight(columns);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
gethasLeftPinnedColumns(columns: any[]): boolean {
|
|
64
|
+
const checkPinnedRight = (columns: any[]): boolean => {
|
|
65
|
+
return columns.some((col) => {
|
|
66
|
+
if (col?.pinned === 'left' && col?.is_visible) return true;
|
|
67
|
+
if (col?.children?.length) {
|
|
68
|
+
return checkPinnedRight(col.children);
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
return checkPinnedRight(columns);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
getExpandedRowCount(data: any[]): number {
|
|
78
|
+
let groupCount = 0;
|
|
79
|
+
let rowCount = 0;
|
|
80
|
+
|
|
81
|
+
data.forEach(group => {
|
|
82
|
+
if (group?.isGroup) {
|
|
83
|
+
groupCount++;
|
|
84
|
+
|
|
85
|
+
if (group?.isExpand && Array.isArray(group?.children)) {
|
|
86
|
+
group.children.forEach((child: any) => {
|
|
87
|
+
if (child.isGroup) {
|
|
88
|
+
if (child.isExpand && Array.isArray(child.children)) {
|
|
89
|
+
rowCount += child.children.length;
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
rowCount++;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
if (groupCount === 0) {
|
|
100
|
+
return data.length;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return groupCount + rowCount;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
getFiltersFromColumns(columns: any[], filtersConfig:any []): any[] {
|
|
108
|
+
const result: any[] = [];
|
|
109
|
+
|
|
110
|
+
const checkColumn = (col: any) => {
|
|
111
|
+
const hasFirstValue = col.query?.first_value != null && col.query?.first_value !== "" && filtersConfig.some((ele)=> ele.field == col.field);
|
|
112
|
+
const hasIds = Array.isArray(col.query?._ids) && col.query._ids.length > 0 && filtersConfig.some((ele)=> ele.field == col.field);
|
|
113
|
+
if (hasFirstValue || hasIds) {
|
|
114
|
+
result.push({
|
|
115
|
+
search: col.search ?? "",
|
|
116
|
+
field: col.field,
|
|
117
|
+
type: col.type,
|
|
118
|
+
_ids: col.type == 'dropdown'? col.query?._ids: [],
|
|
119
|
+
query: col.type == 'dropdown'? null : (col?.query?.first_value ? col?.query : null)
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (Array.isArray(col.children) && col.children.length > 0) {
|
|
124
|
+
col.children.forEach(checkColumn);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
columns.forEach(checkColumn);
|
|
128
|
+
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async applyFiltersToColumns(columns: any[], filters: any[]): Promise<any[]> {
|
|
133
|
+
for (const col of columns) {
|
|
134
|
+
if (!col.query) {
|
|
135
|
+
col.query = {
|
|
136
|
+
first_value: null,
|
|
137
|
+
second_value: null,
|
|
138
|
+
first_condition: col.type !== 'date' ? 'contain' : 'equal',
|
|
139
|
+
second_condition: null,
|
|
140
|
+
condition: 'none',
|
|
141
|
+
_ids: []
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const filter = filters.find(f => f.field === col.field);
|
|
146
|
+
|
|
147
|
+
if (filter) {
|
|
148
|
+
if (col.type === 'dropdown') {
|
|
149
|
+
const selectedIds = filter._ids ?? [];
|
|
150
|
+
const dropdownValues = col.column_dropdown_value ?? [];
|
|
151
|
+
|
|
152
|
+
// ✅ Map depending on dropdown value structure
|
|
153
|
+
let selectedLabels: string[] = [];
|
|
154
|
+
|
|
155
|
+
if (Array.isArray(dropdownValues) && dropdownValues.length > 0) {
|
|
156
|
+
if (typeof dropdownValues[0] === 'object') {
|
|
157
|
+
// object-based dropdowns: { id, name/label/value/text }
|
|
158
|
+
selectedLabels = dropdownValues
|
|
159
|
+
.filter(opt => selectedIds.includes(opt.id))
|
|
160
|
+
.map(opt => opt.name ?? opt.label ?? opt.value ?? opt.text ?? '');
|
|
161
|
+
} else {
|
|
162
|
+
// string-based dropdowns
|
|
163
|
+
selectedLabels = dropdownValues.filter(opt => selectedIds.includes(opt));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ✅ Store readable text in filterValue (comma-separated)
|
|
168
|
+
col.filterValue = selectedLabels.join(', ');
|
|
169
|
+
|
|
170
|
+
// maintain query state
|
|
171
|
+
col.query._ids = selectedIds;
|
|
172
|
+
col.search = filter.search ?? '';
|
|
173
|
+
|
|
174
|
+
} else {
|
|
175
|
+
// ✅ Non-dropdown filters (text/date/number)
|
|
176
|
+
col.filterValue = filter.search || filter.query?.first_value || '';
|
|
177
|
+
col.search = filter.search ?? '';
|
|
178
|
+
col.query.first_value = filter.query?.first_value ?? null;
|
|
179
|
+
col.query.second_value = filter.query?.second_value ?? null;
|
|
180
|
+
col.query.first_condition =
|
|
181
|
+
filter.query?.first_condition ??
|
|
182
|
+
(col.type !== 'date' ? 'contain' : 'equal');
|
|
183
|
+
col.query.second_condition = filter.query?.second_condition ?? null;
|
|
184
|
+
col.query.condition = filter.query?.condition ?? 'none';
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
// Clear filter if not present
|
|
188
|
+
col.filterValue = null;
|
|
189
|
+
col.search = '';
|
|
190
|
+
col.query._ids = [];
|
|
191
|
+
col.query.first_value = null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// ✅ Recursively apply for children
|
|
195
|
+
if (Array.isArray(col.children) && col.children.length > 0) {
|
|
196
|
+
col.children = await this.applyFiltersToColumns(col.children, filters);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return columns;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
activeFilteredColumns: any[] = [];
|
|
209
|
+
updateActiveFilteredColumns(columns: any[]): any[] {
|
|
210
|
+
const collectFiltered = (cols: any[]): any[] => {
|
|
211
|
+
let result: any[] = [];
|
|
212
|
+
|
|
213
|
+
for (let i = 0; i < cols.length; i++) {
|
|
214
|
+
const col = cols[i];
|
|
215
|
+
if (col.children && col.children.length > 0) {
|
|
216
|
+
result = result.concat(collectFiltered(col.children));
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (col.query) {
|
|
220
|
+
const hasDropdownFilter =
|
|
221
|
+
Array.isArray(col.query._ids) && col.query._ids.length > 0;
|
|
222
|
+
|
|
223
|
+
const hasValueFilter =
|
|
224
|
+
(col.query.first_value && col.query.first_value !== '') ||
|
|
225
|
+
(col.query.second_value && col.query.second_value !== '');
|
|
226
|
+
|
|
227
|
+
if (hasDropdownFilter || hasValueFilter) {
|
|
228
|
+
result.push(col);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return result;
|
|
233
|
+
};
|
|
234
|
+
this.activeFilteredColumns = [...collectFiltered(columns)];
|
|
235
|
+
return this.activeFilteredColumns;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
hasFieldChanged(current: any, original: any, type: string): boolean {
|
|
241
|
+
switch (type) {
|
|
242
|
+
case 'number':
|
|
243
|
+
return Number(current) !== Number(original);
|
|
244
|
+
|
|
245
|
+
case 'string':
|
|
246
|
+
return String(current || '') !== String(original || '');
|
|
247
|
+
|
|
248
|
+
case 'dropdown':
|
|
249
|
+
if (typeof current === 'object' && typeof original === 'object') {
|
|
250
|
+
return current?.id !== original?.id || current?.value !== original?.value;
|
|
251
|
+
}
|
|
252
|
+
return current !== original;
|
|
253
|
+
|
|
254
|
+
case 'boolean':
|
|
255
|
+
return Boolean(current) !== Boolean(original);
|
|
256
|
+
|
|
257
|
+
case 'date':
|
|
258
|
+
const currentDate = new Date(current).getTime();
|
|
259
|
+
const originalDate = new Date(original).getTime();
|
|
260
|
+
return isNaN(currentDate) || isNaN(originalDate)
|
|
261
|
+
? current !== original
|
|
262
|
+
: currentDate !== originalDate;
|
|
263
|
+
|
|
264
|
+
default:
|
|
265
|
+
return JSON.stringify(current) !== JSON.stringify(original);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* tslint:disable:no-unused-variable */
|
|
2
|
+
|
|
3
|
+
import { TestBed, async, inject } from '@angular/core/testing';
|
|
4
|
+
import { CopyServiceService } from './copy-service.service';
|
|
5
|
+
|
|
6
|
+
describe('Service: CopyService', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
TestBed.configureTestingModule({
|
|
9
|
+
providers: [CopyServiceService]
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should ...', inject([CopyServiceService], (service: CopyServiceService) => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Injectable({
|
|
4
|
+
providedIn: 'root'
|
|
5
|
+
})
|
|
6
|
+
export class CopyServiceService {
|
|
7
|
+
|
|
8
|
+
constructor() { }
|
|
9
|
+
getSelectedDataForCopy(
|
|
10
|
+
dataSet: any[],
|
|
11
|
+
columns: any[],
|
|
12
|
+
rowSelectedIndexes: Set<number>,
|
|
13
|
+
selectedCells: any[],
|
|
14
|
+
getNestedValue: (obj: any, path: string) => any
|
|
15
|
+
): any[][] {
|
|
16
|
+
const copiedRows: any[][] = [];
|
|
17
|
+
const findRowByVirtualIndex = (vIndex: number) =>
|
|
18
|
+
dataSet.find((r: any) => r.__virtualIndex === vIndex);
|
|
19
|
+
if (rowSelectedIndexes && rowSelectedIndexes.size > 0) {
|
|
20
|
+
const sortedIndexes = [...rowSelectedIndexes].sort((a, b) => a - b);
|
|
21
|
+
for (const vIndex of sortedIndexes) {
|
|
22
|
+
const row = findRowByVirtualIndex(vIndex);
|
|
23
|
+
if (!row) continue;
|
|
24
|
+
const extractValue = (field: string): string => {
|
|
25
|
+
const nested = getNestedValue(row, field);
|
|
26
|
+
const value =
|
|
27
|
+
nested?.value ??
|
|
28
|
+
nested?.name ??
|
|
29
|
+
nested ??
|
|
30
|
+
'-';
|
|
31
|
+
|
|
32
|
+
if (Array.isArray(value)) {
|
|
33
|
+
return value
|
|
34
|
+
.map(v =>
|
|
35
|
+
typeof v === 'object'
|
|
36
|
+
? (v.departmentName ?? v.roleName ?? '')
|
|
37
|
+
: (v?.toString() ?? '')
|
|
38
|
+
)
|
|
39
|
+
.join(', ');
|
|
40
|
+
}
|
|
41
|
+
return value ?? '';
|
|
42
|
+
};
|
|
43
|
+
const mapped = columns.map(col => {
|
|
44
|
+
if (col.children && Array.isArray(col.children)) {
|
|
45
|
+
return col.children.map((c: { field: string }) => extractValue(c.field));
|
|
46
|
+
}
|
|
47
|
+
return [extractValue(col.field)];
|
|
48
|
+
});
|
|
49
|
+
const rowValues = mapped.reduce<string[]>((acc, curr) => acc.concat(curr), []);
|
|
50
|
+
copiedRows.push(rowValues);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (selectedCells && selectedCells.length > 0) {
|
|
54
|
+
const rowsMap = new Map<number, any[]>();
|
|
55
|
+
for (const cell of selectedCells) {
|
|
56
|
+
const row = findRowByVirtualIndex(cell.rowIndex);
|
|
57
|
+
if (!row) continue;
|
|
58
|
+
const col = columns[cell.colIndex];
|
|
59
|
+
let fieldName = col?.field;
|
|
60
|
+
if (col?.children && col.children[cell.subColIndex]) {
|
|
61
|
+
fieldName = col.children[cell.subColIndex].field;
|
|
62
|
+
}
|
|
63
|
+
let value = getNestedValue(row, fieldName) || getNestedValue(row, fieldName)?.name || getNestedValue(row, fieldName) || '-';
|
|
64
|
+
if (Array.isArray(value)) {
|
|
65
|
+
value = value
|
|
66
|
+
.map(v =>
|
|
67
|
+
typeof v === 'object'
|
|
68
|
+
? v.departmentName ?? v.roleName ?? ''
|
|
69
|
+
: v?.toString() ?? ''
|
|
70
|
+
)
|
|
71
|
+
.join(', ');
|
|
72
|
+
} else {
|
|
73
|
+
value = value ?? '';
|
|
74
|
+
}
|
|
75
|
+
if (!rowsMap.has(cell.rowIndex)) rowsMap.set(cell.rowIndex, []);
|
|
76
|
+
rowsMap.get(cell.rowIndex)!.push(value);
|
|
77
|
+
}
|
|
78
|
+
const sortedCells = [...rowsMap.entries()]
|
|
79
|
+
.sort(([a], [b]) => a - b)
|
|
80
|
+
.map(([_, v]) => v);
|
|
81
|
+
copiedRows.push(...sortedCells);
|
|
82
|
+
}
|
|
83
|
+
if (copiedRows.length === 0) {
|
|
84
|
+
const activeCell = document.querySelector('.active-cell');
|
|
85
|
+
if (activeCell) return [[activeCell.textContent?.trim() || '']];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const maxCols = copiedRows.reduce((max, row) => Math.max(max, row.length), 0);
|
|
89
|
+
return copiedRows.map(row => {
|
|
90
|
+
const newRow = [...row];
|
|
91
|
+
while (newRow.length < maxCols) newRow.push('');
|
|
92
|
+
return newRow;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
copyToClipboard(
|
|
98
|
+
selectedData: any[][],
|
|
99
|
+
selector = '.selected-cell, .active-cell, .row-selected'
|
|
100
|
+
): void {
|
|
101
|
+
if (!selectedData || selectedData.length === 0) return;
|
|
102
|
+
const textToCopy = selectedData
|
|
103
|
+
.map(row => row.map(cell => (cell ?? '').toString()).join('\t'))
|
|
104
|
+
.join('\n');
|
|
105
|
+
navigator.clipboard.writeText(textToCopy).catch(err => console.error(err));
|
|
106
|
+
const selectedEls = document.querySelectorAll(selector);
|
|
107
|
+
selectedEls.forEach(el => el.classList.add('flash-bg'));
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
selectedEls.forEach(el => el.classList.remove('flash-bg'));
|
|
110
|
+
}, 1000);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
updateRows: any[] = [];
|
|
115
|
+
currentColums : any = []
|
|
116
|
+
async pasteFromClipboardText(
|
|
117
|
+
text: string,
|
|
118
|
+
dataSet: any[],
|
|
119
|
+
columns: any[],
|
|
120
|
+
startRowIndex: number,
|
|
121
|
+
startColIndex: number,
|
|
122
|
+
startSubColIndex: number = 0
|
|
123
|
+
): Promise<any> {
|
|
124
|
+
if (!text) return [];
|
|
125
|
+
this.updateRows = [];
|
|
126
|
+
const rows = text.split(/\r?\n/).map(r => r.split('\t'));
|
|
127
|
+
const flattenedColumns: any[] = [];
|
|
128
|
+
columns.forEach(col => {
|
|
129
|
+
if (col.children?.length) {
|
|
130
|
+
col.children.forEach((child: any) => flattenedColumns.push({ parent: col, ...child }));
|
|
131
|
+
} else {
|
|
132
|
+
flattenedColumns.push(col);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
let startFlattenedIndex = 0;
|
|
136
|
+
for (let i = 0; i < startColIndex; i++) {
|
|
137
|
+
const col = columns[i];
|
|
138
|
+
startFlattenedIndex += col.children?.length || 1;
|
|
139
|
+
}
|
|
140
|
+
const startCol = columns[startColIndex];
|
|
141
|
+
if (startCol?.children?.length) {
|
|
142
|
+
startFlattenedIndex += Math.min(startSubColIndex, startCol.children.length - 1);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
rows.forEach((rowValues, rOffset) => {
|
|
146
|
+
const targetRowIndex = startRowIndex + rOffset;
|
|
147
|
+
const row = dataSet.find(r => r?.__virtualIndex === targetRowIndex);
|
|
148
|
+
if (!row) return;
|
|
149
|
+
|
|
150
|
+
rowValues.forEach((value, cOffset) => {
|
|
151
|
+
const targetIndex = startFlattenedIndex + cOffset;
|
|
152
|
+
if (targetIndex < 0 || targetIndex >= flattenedColumns.length) return;
|
|
153
|
+
|
|
154
|
+
const targetColumn = flattenedColumns[targetIndex];
|
|
155
|
+
if(!targetColumn || !targetColumn.is_editable) return;
|
|
156
|
+
if (targetColumn?.type === 'string') {
|
|
157
|
+
this.currentColums.push(targetColumn);
|
|
158
|
+
this.setNestedValue(row, targetColumn, value);
|
|
159
|
+
} else if (targetColumn.type === 'number') {
|
|
160
|
+
const num = Number(value);
|
|
161
|
+
if (!isNaN(num) && value !== '') {
|
|
162
|
+
this.currentColums.push(targetColumn);
|
|
163
|
+
this.setNestedValue(row, targetColumn, num);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
return {updateRows : this.updateRows, currentColums : this.currentColums};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
setNestedValue(obj: any, column: any, option: any, calledFromInput = false): void {
|
|
174
|
+
if (column.type === 'date' || column.type === 'image') return;
|
|
175
|
+
const path = column.field;
|
|
176
|
+
if (!path) return;
|
|
177
|
+
const keys = path.split('.');
|
|
178
|
+
const lastKey = keys.pop();
|
|
179
|
+
const parent = keys.reduce((acc: any, key: string) => (acc[key] ??= {}), obj);
|
|
180
|
+
if (parent && lastKey) {
|
|
181
|
+
if (typeof option === 'object' && option !== null) {
|
|
182
|
+
parent[lastKey] = {
|
|
183
|
+
id: option.id ?? 1,
|
|
184
|
+
value: option.value ?? option,
|
|
185
|
+
};
|
|
186
|
+
} else {
|
|
187
|
+
parent[lastKey] = option;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const sendObj = {
|
|
191
|
+
data: { ...obj },
|
|
192
|
+
eventType: 'onCellEdit',
|
|
193
|
+
};
|
|
194
|
+
this.updateRows.push(obj);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
cutSelectedSelectedData(
|
|
199
|
+
dataSet: any[],
|
|
200
|
+
rowSelectedIndexes: Set<number>,
|
|
201
|
+
selectedCells: any[],
|
|
202
|
+
columns: any[],
|
|
203
|
+
setNestedValue: (obj: any, column: any, value: any) => void
|
|
204
|
+
): any {
|
|
205
|
+
let updatedData = [...dataSet];
|
|
206
|
+
if (rowSelectedIndexes?.size) {
|
|
207
|
+
const indexes = [...rowSelectedIndexes];
|
|
208
|
+
updatedData = updatedData.filter(
|
|
209
|
+
(row: any) => !indexes.includes(row.__virtualIndex)
|
|
210
|
+
);
|
|
211
|
+
// rowSelectedIndexes.clear();
|
|
212
|
+
}
|
|
213
|
+
else if (selectedCells?.length) {
|
|
214
|
+
this.updateRows = [];
|
|
215
|
+
for (const cell of selectedCells) {
|
|
216
|
+
const row = updatedData.find(r => r.__virtualIndex === cell.rowIndex);
|
|
217
|
+
if (!row) continue;
|
|
218
|
+
let col = columns[cell.colIndex];
|
|
219
|
+
if (col?.children && col.children[cell.subColIndex]) {
|
|
220
|
+
col = col.children[cell.subColIndex];
|
|
221
|
+
}
|
|
222
|
+
this.setNestedValue(row, col, '');
|
|
223
|
+
}
|
|
224
|
+
// selectedCells.length = 0;
|
|
225
|
+
}
|
|
226
|
+
return {updatedData: updatedData, updatedRows: this.updateRows};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
cutWithAnimation(
|
|
231
|
+
selectedData: any[][],
|
|
232
|
+
selector = '.selected-cell, .active-cell, .row-selected'
|
|
233
|
+
): void {
|
|
234
|
+
if (!selectedData || selectedData.length === 0) return;
|
|
235
|
+
|
|
236
|
+
const textToCopy = selectedData
|
|
237
|
+
.map(row => row.map(cell => (cell ?? '').toString()).join('\t'))
|
|
238
|
+
.join('\n');
|
|
239
|
+
|
|
240
|
+
navigator.clipboard.writeText(textToCopy).catch(err => console.error(err));
|
|
241
|
+
|
|
242
|
+
// Apply red cut animation
|
|
243
|
+
const selectedEls = document.querySelectorAll(selector);
|
|
244
|
+
selectedEls.forEach(el => el.classList.add('cut-flash-bg'));
|
|
245
|
+
setTimeout(() => {
|
|
246
|
+
selectedEls.forEach(el => el.classList.remove('cut-flash-bg'));
|
|
247
|
+
}, 1000);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* tslint:disable:no-unused-variable */
|
|
2
|
+
|
|
3
|
+
import { TestBed, async, inject } from '@angular/core/testing';
|
|
4
|
+
import { DragDrpService } from './drag-drp.service';
|
|
5
|
+
|
|
6
|
+
describe('Service: DragDrp', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
TestBed.configureTestingModule({
|
|
9
|
+
providers: [DragDrpService]
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should ...', inject([DragDrpService], (service: DragDrpService) => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { moveItemInArray } from '@angular/cdk/drag-drop';
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root',
|
|
6
|
+
})
|
|
7
|
+
export class DragDrpService {
|
|
8
|
+
constructor() {}
|
|
9
|
+
|
|
10
|
+
// sortChildColumnInGroup(
|
|
11
|
+
// columns: any[],
|
|
12
|
+
// draggedChild: any,
|
|
13
|
+
// section: 'leftPinnedColumns' | 'centerColumns' | 'rightPinnedColumns',
|
|
14
|
+
// previousIndex: number,
|
|
15
|
+
// currentIndex: number
|
|
16
|
+
// ): any {
|
|
17
|
+
// const pinned =
|
|
18
|
+
// section === 'leftPinnedColumns'
|
|
19
|
+
// ? 'left'
|
|
20
|
+
// : section === 'rightPinnedColumns'
|
|
21
|
+
// ? 'right'
|
|
22
|
+
// : null;
|
|
23
|
+
|
|
24
|
+
// const group = columns.find(
|
|
25
|
+
// (col: any) =>
|
|
26
|
+
// Array.isArray(col.children) &&
|
|
27
|
+
// col.children.some((child: any) => child?.field === draggedChild?.field)
|
|
28
|
+
// );
|
|
29
|
+
|
|
30
|
+
// if (!group) return;
|
|
31
|
+
|
|
32
|
+
// const groupIndex = columns.findIndex((col) => col.header === group.header);
|
|
33
|
+
// const filteredGroup = group.children.filter(
|
|
34
|
+
// (col: any) => col.pinned === pinned
|
|
35
|
+
// );
|
|
36
|
+
|
|
37
|
+
// const prevField = filteredGroup[previousIndex]?.field;
|
|
38
|
+
// const currField = filteredGroup[currentIndex]?.field;
|
|
39
|
+
|
|
40
|
+
// const visiblePrevIndex = group.children.findIndex(
|
|
41
|
+
// (col: any) => col.field === prevField
|
|
42
|
+
// );
|
|
43
|
+
// const visibleCurrIndex = group.children.findIndex(
|
|
44
|
+
// (col: any) => col.field === currField
|
|
45
|
+
// );
|
|
46
|
+
|
|
47
|
+
// moveItemInArray(
|
|
48
|
+
// columns[groupIndex]?.children,
|
|
49
|
+
// visiblePrevIndex,
|
|
50
|
+
// visibleCurrIndex
|
|
51
|
+
// );
|
|
52
|
+
|
|
53
|
+
// return {
|
|
54
|
+
// group,
|
|
55
|
+
// movedField: currField,
|
|
56
|
+
// };
|
|
57
|
+
// }
|
|
58
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* tslint:disable:no-unused-variable */
|
|
2
|
+
|
|
3
|
+
import { TestBed, async, inject } from '@angular/core/testing';
|
|
4
|
+
import { SplitColumnsService } from './split-columns.service';
|
|
5
|
+
|
|
6
|
+
describe('Service: SplitColumns', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
TestBed.configureTestingModule({
|
|
9
|
+
providers: [SplitColumnsService]
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should ...', inject([SplitColumnsService], (service: SplitColumnsService) => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
}));
|
|
16
|
+
});
|