├── .browserslistrc ├── .editorconfig ├── .eslintrc.json ├── .github ├── dependabot.yml └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── LICENSE ├── README.md ├── SECURITY.md ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ └── app.po.ts └── tsconfig.e2e.json ├── package-lock.json ├── package.json ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── model │ │ ├── column.ts │ │ └── matrix.ts │ └── pivot │ │ ├── change-notification.service.spec.ts │ │ ├── change-notification.service.ts │ │ ├── pivot-table │ │ ├── pivot-table.component.html │ │ ├── pivot-table.component.scss │ │ ├── pivot-table.component.spec.ts │ │ └── pivot-table.component.ts │ │ ├── pivot.component.html │ │ ├── pivot.component.scss │ │ ├── pivot.component.spec.ts │ │ └── pivot.component.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── karma.conf.js ├── main.ts ├── polyfills.ts ├── styles.scss ├── test.ts ├── tsconfig.app.json └── tsconfig.spec.json └── tsconfig.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "ignorePatterns": [ 4 | "projects/**/*" 5 | ], 6 | "overrides": [ 7 | { 8 | "files": [ 9 | "*.ts" 10 | ], 11 | "parserOptions": { 12 | "project": [ 13 | "tsconfig.json" 14 | ], 15 | "createDefaultProgram": true 16 | }, 17 | "extends": [ 18 | "plugin:@angular-eslint/recommended", 19 | "plugin:@angular-eslint/template/process-inline-templates" 20 | ], 21 | "rules": { 22 | "@angular-eslint/directive-selector": [ 23 | "error", 24 | { 25 | "type": "attribute", 26 | "prefix": "app", 27 | "style": "camelCase" 28 | } 29 | ], 30 | "@angular-eslint/component-selector": [ 31 | "error", 32 | { 33 | "type": "element", 34 | "prefix": "app", 35 | "style": "kebab-case" 36 | } 37 | ] 38 | } 39 | }, 40 | { 41 | "files": [ 42 | "*.html" 43 | ], 44 | "extends": [ 45 | "plugin:@angular-eslint/template/recommended" 46 | ], 47 | "rules": {} 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | 8 | - package-ecosystem: "npm" 9 | directory: "/" 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ main ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ main ] 20 | schedule: 21 | - cron: '40 17 * * 3' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | language: [ 'javascript' ] 32 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 33 | # Learn more: 34 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 35 | 36 | steps: 37 | - name: Checkout repository 38 | uses: actions/checkout@v4 39 | 40 | # Initializes the CodeQL tools for scanning. 41 | - name: Initialize CodeQL 42 | uses: github/codeql-action/init@v3 43 | with: 44 | languages: ${{ matrix.language }} 45 | # If you wish to specify custom queries, you can do so here or in a config file. 46 | # By default, queries listed here will override any specified in a config file. 47 | # Prefix the list here with "+" to use these queries and those in the config file. 48 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 49 | 50 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 51 | # If this step fails, then you should remove it and run the build manually (see below) 52 | - name: Autobuild 53 | uses: github/codeql-action/autobuild@v3 54 | 55 | # ℹ️ Command-line programs to run using the OS shell. 56 | # 📚 https://git.io/JvXDl 57 | 58 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 59 | # and modify them (or add more) to build your code if your project 60 | # uses a compiled language 61 | 62 | #- run: | 63 | # make bootstrap 64 | # make release 65 | 66 | - name: Perform CodeQL Analysis 67 | uses: github/codeql-action/analyze@v3 68 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | *.iml 20 | 21 | # IDE - VSCode 22 | .vscode/* 23 | !.vscode/settings.json 24 | !.vscode/tasks.json 25 | !.vscode/launch.json 26 | !.vscode/extensions.json 27 | 28 | # misc 29 | /.angular/cache 30 | /.sass-cache 31 | /connect.lock 32 | /coverage 33 | /libpeerconnection.log 34 | npm-debug.log 35 | yarn-error.log 36 | testem.log 37 | /typings 38 | 39 | # System Files 40 | .DS_Store 41 | Thumbs.db 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PivotHelper 2 | 3 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 4 | ![Version](https://img.shields.io/github/package-json/v/BjoernKW/PivotHelper.svg?style=shield) 5 | 6 | **PivotHelper** is a utility web app that generates Pivot tables and charts from CSV files and [Microsoft Excel](https://products.office.com/en/excel) spreadsheets. 7 | 8 | ## Usage 9 | 10 | Go to https://bjoernkw.github.io/PivotHelper/ . 11 | 12 | ## Development 13 | 14 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.2. 15 | 16 | ### Development server 17 | 18 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 19 | 20 | ### Build 21 | 22 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 23 | 24 | ### Running unit tests 25 | 26 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 27 | 28 | ## Built With 29 | 30 | * [Angular](https://angular.io/) 31 | * [Bootstrap](https://getbootstrap.com) 32 | * [C3.js](https://c3js.org/) 33 | * JavaScript 34 | * [PivotTable.js](https://pivottable.js.org/examples/) 35 | * [PrimeNG](https://www.primefaces.org/primeng/#/) 36 | * [SheetJS](https://sheetjs.com/) 37 | 38 | ## License 39 | 40 | [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) 41 | 42 | ## Authors 43 | 44 | * **[Björn Wilmsmann](https://bjoernkw.com)** 45 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Currently, only the latest version will receive security updates. 6 | 7 | ## Reporting a Vulnerability 8 | 9 | You can get in touch by writing an email to bjoern@bjoernkw.com 10 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "PivotHelper": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "app", 11 | "schematics": { 12 | "@schematics/angular:component": { 13 | "style": "scss" 14 | } 15 | }, 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/PivotHelper", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "src/tsconfig.app.json", 25 | "assets": [ 26 | "src/favicon.ico", 27 | "src/assets" 28 | ], 29 | "styles": [ 30 | "node_modules/bootstrap/dist/css/bootstrap.min.css", 31 | "node_modules/primeicons/primeicons.css", 32 | "node_modules/primeng/resources/themes/saga-blue/theme.css", 33 | "node_modules/primeng/resources/primeng.min.css", 34 | "node_modules/c3/c3.min.css", 35 | "node_modules/pivottable/dist/pivot.css", 36 | "src/styles.scss" 37 | ], 38 | "scripts": [ 39 | "node_modules/d3/dist/d3.min.js", 40 | "node_modules/c3/c3.min.js", 41 | "node_modules/jquery/dist/jquery.min.js", 42 | "node_modules/jquery-ui-dist/jquery-ui.min.js", 43 | "node_modules/pivottable/dist/pivot.min.js", 44 | "node_modules/pivottable/dist/c3_renderers.min.js", 45 | "node_modules/save-svg-as-png/lib/saveSvgAsPng.js" 46 | ], 47 | "allowedCommonJsDependencies": [ 48 | "xlsx", 49 | "chart.js" 50 | ], 51 | "vendorChunk": true, 52 | "extractLicenses": false, 53 | "buildOptimizer": false, 54 | "sourceMap": true, 55 | "optimization": false, 56 | "namedChunks": true 57 | }, 58 | "configurations": { 59 | "production": { 60 | "fileReplacements": [ 61 | { 62 | "replace": "src/environments/environment.ts", 63 | "with": "src/environments/environment.prod.ts" 64 | } 65 | ], 66 | "optimization": true, 67 | "outputHashing": "all", 68 | "sourceMap": false, 69 | "namedChunks": false, 70 | "extractLicenses": true, 71 | "vendorChunk": false, 72 | "buildOptimizer": true, 73 | "aot": true, 74 | "budgets": [ 75 | { 76 | "type": "initial", 77 | "maximumWarning": "2mb", 78 | "maximumError": "5mb" 79 | }, 80 | { 81 | "type": "anyComponentStyle", 82 | "maximumWarning": "6kb" 83 | } 84 | ] 85 | } 86 | } 87 | }, 88 | "serve": { 89 | "builder": "@angular-devkit/build-angular:dev-server", 90 | "options": { 91 | "browserTarget": "PivotHelper:build" 92 | }, 93 | "configurations": { 94 | "production": { 95 | "browserTarget": "PivotHelper:build:production" 96 | } 97 | } 98 | }, 99 | "extract-i18n": { 100 | "builder": "@angular-devkit/build-angular:extract-i18n", 101 | "options": { 102 | "browserTarget": "PivotHelper:build" 103 | } 104 | }, 105 | "test": { 106 | "builder": "@angular-devkit/build-angular:karma", 107 | "options": { 108 | "main": "src/test.ts", 109 | "polyfills": "src/polyfills.ts", 110 | "tsConfig": "src/tsconfig.spec.json", 111 | "karmaConfig": "src/karma.conf.js", 112 | "styles": [ 113 | "src/styles.scss" 114 | ], 115 | "scripts": [ 116 | "node_modules/d3/dist/d3.min.js", 117 | "node_modules/c3/c3.min.js", 118 | "node_modules/jquery/dist/jquery.min.js", 119 | "node_modules/jquery-ui-dist/jquery-ui.min.js", 120 | "node_modules/pivottable/dist/pivot.min.js", 121 | "node_modules/pivottable/dist/c3_renderers.min.js" 122 | ], 123 | "assets": [ 124 | "src/favicon.ico", 125 | "src/assets" 126 | ] 127 | } 128 | }, 129 | "lint": { 130 | "builder": "@angular-eslint/builder:lint", 131 | "options": { 132 | "lintFilePatterns": [ 133 | "src/**/*.ts", 134 | "src/**/*.html" 135 | ] 136 | } 137 | } 138 | } 139 | } 140 | }, 141 | "cli": { 142 | "schematicCollections": [ 143 | "@angular-eslint/schematics" 144 | ] 145 | }, 146 | "schematics": { 147 | "@angular-eslint/schematics:application": { 148 | "setParserOptionsProject": true 149 | }, 150 | "@angular-eslint/schematics:library": { 151 | "setParserOptionsProject": true 152 | } 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pivot-helper", 3 | "version": "0.1.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e", 11 | "preinstall": "npx npm-force-resolutions" 12 | }, 13 | "private": true, 14 | "resolutions": { 15 | "json-schema": "0.4.0", 16 | "jszip": "3.7.1", 17 | "quill": "2.0.3", 18 | "ini": "2.0.0" 19 | }, 20 | "dependencies": { 21 | "@angular/animations": "^19.1.5", 22 | "@angular/cdk": "^19.1.3", 23 | "@angular/common": "^19.1.5", 24 | "@angular/compiler": "^19.1.5", 25 | "@angular/core": "^19.1.5", 26 | "@angular/forms": "^19.1.5", 27 | "@angular/platform-browser": "^19.1.5", 28 | "@angular/platform-browser-dynamic": "^19.1.5", 29 | "@angular/router": "^19.1.5", 30 | "@fullcalendar/core": "^6.1.15", 31 | "bootstrap": "^5.3.3", 32 | "c3": "^0.7.20", 33 | "chart.js": "^4.4.7", 34 | "core-js": "^3.40.0", 35 | "jquery": "^3.7.1", 36 | "jquery-ui-dist": "^1.13.3", 37 | "pivottable": "^2.23.0", 38 | "popper.js": "^1.16.1", 39 | "primeicons": "^7.0.0", 40 | "primeng": "^19.0.6", 41 | "quill": "^2.0.3", 42 | "rxjs": "~7.8.1", 43 | "save-svg-as-png": "^1.4.17", 44 | "tslib": "^2.8.1", 45 | "xlsx": "^0.18.5", 46 | "zone.js": "~0.15.0" 47 | }, 48 | "devDependencies": { 49 | "@angular-devkit/build-angular": "^19.1.6", 50 | "@angular-eslint/builder": "19.0.2", 51 | "@angular-eslint/eslint-plugin": "19.0.2", 52 | "@angular-eslint/eslint-plugin-template": "19.0.2", 53 | "@angular-eslint/schematics": "19.0.2", 54 | "@angular-eslint/template-parser": "19.0.2", 55 | "@angular/cli": "^19.1.6", 56 | "@angular/compiler-cli": "^19.1.5", 57 | "@angular/language-service": "^19.1.5", 58 | "@types/jasmine": "~5.1.5", 59 | "@types/jasminewd2": "~2.0.13", 60 | "@types/node": "^22.13.1", 61 | "@typescript-eslint/eslint-plugin": "^8.23.0", 62 | "@typescript-eslint/parser": "^8.23.0", 63 | "ajv-keywords": "^5.1.0", 64 | "angular-cli-ghpages": "^2.0.3", 65 | "codelyzer": "^6.0.2", 66 | "eslint": "^9.20.0", 67 | "jasmine-core": "~5.6.0", 68 | "jasmine-spec-reporter": "~7.0.0", 69 | "karma": "~6.4.4", 70 | "karma-chrome-launcher": "~3.2.0", 71 | "karma-coverage-istanbul-reporter": "~3.0.3", 72 | "karma-jasmine": "~5.1.0", 73 | "karma-jasmine-html-reporter": "^2.1.0", 74 | "npm-check-updates": "^17.1.14", 75 | "npm-force-resolutions": "^0.0.10", 76 | "protractor": "~7.0.0", 77 | "ts-node": "~10.9.2", 78 | "typescript": "~5.7.3" 79 | } 80 | } -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; 3 | import { PivotComponent } from './pivot/pivot.component'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: PivotComponent 9 | } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })], 14 | exports: [RouterModule] 15 | }) 16 | export class AppRoutingModule { } 17 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 |

PivotHelper

7 |

8 | PivotHelper is a utility web app that generates Pivot tables and charts from CSV files and 9 | Microsoft Excel spreadsheets. 10 |

11 |
12 |
13 |
14 |
15 |
16 |
17 | 18 |
19 |
20 | 30 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BjoernKW/PivotHelper/a61c5aedf6ce763e1212bfdf7e555a6fc424eaaf/src/app/app.component.scss -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(waitForAsync(() => { 7 | TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | })); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.debugElement.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'], 7 | standalone: false 8 | }) 9 | export class AppComponent { 10 | currentYear = new Date().getFullYear(); 11 | } 12 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | 4 | import { AppRoutingModule } from './app-routing.module'; 5 | import { AppComponent } from './app.component'; 6 | import { PivotComponent } from './pivot/pivot.component'; 7 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; 8 | 9 | import { TableModule } from 'primeng/table'; 10 | import { PivotTableComponent } from './pivot/pivot-table/pivot-table.component'; 11 | 12 | import { FormsModule } from "@angular/forms"; 13 | import { DropdownModule } from 'primeng/dropdown'; 14 | import { InputTextModule } from 'primeng/inputtext'; 15 | import { MultiSelectModule } from 'primeng/multiselect'; 16 | import { ProgressSpinnerModule } from 'primeng/progressspinner'; 17 | import { DialogModule } from 'primeng/dialog'; 18 | 19 | @NgModule({ 20 | declarations: [ 21 | AppComponent, 22 | PivotComponent, 23 | PivotTableComponent 24 | ], 25 | imports: [ 26 | BrowserModule, 27 | BrowserAnimationsModule, 28 | FormsModule, 29 | AppRoutingModule, 30 | TableModule, 31 | DropdownModule, 32 | InputTextModule, 33 | MultiSelectModule, 34 | ProgressSpinnerModule, 35 | DialogModule 36 | ], 37 | providers: [], 38 | bootstrap: [AppComponent] 39 | }) 40 | export class AppModule { } 41 | -------------------------------------------------------------------------------- /src/app/model/column.ts: -------------------------------------------------------------------------------- 1 | export class Column { 2 | field: string; 3 | header: string; 4 | filterMatchMode: string; 5 | isBoolean: boolean; 6 | isNumeric: boolean; 7 | isEmailAddress: boolean; 8 | isHttpUrl: boolean; 9 | 10 | 11 | constructor( 12 | field: string, 13 | header: string, 14 | filterMatchMode: string, 15 | isBoolean: boolean, 16 | isNumeric: boolean, 17 | isEmailAddress: boolean, 18 | isHttpUrl: boolean 19 | ) { 20 | this.field = field; 21 | this.header = header; 22 | this.filterMatchMode = filterMatchMode; 23 | this.isBoolean = isBoolean; 24 | this.isNumeric = isNumeric; 25 | this.isEmailAddress = isEmailAddress; 26 | this.isHttpUrl = isHttpUrl; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/model/matrix.ts: -------------------------------------------------------------------------------- 1 | export type Matrix = any[][]; 2 | -------------------------------------------------------------------------------- /src/app/pivot/change-notification.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { ChangeNotificationService } from './change-notification.service'; 4 | 5 | describe('ChangeNotificationService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: ChangeNotificationService = TestBed.get(ChangeNotificationService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/app/pivot/change-notification.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { BehaviorSubject } from 'rxjs'; 3 | 4 | @Injectable({ 5 | providedIn: 'root' 6 | }) 7 | export class ChangeNotificationService { 8 | 9 | private _selectionChanged = new BehaviorSubject<{}[]>([]); 10 | public selectionChanged$ = this._selectionChanged.asObservable(); 11 | 12 | constructor() { } 13 | 14 | onSelectionChanged(data: {}[] | undefined) { 15 | if (data) { 16 | this._selectionChanged.next(data); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/pivot/pivot-table/pivot-table.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Pivot Table

3 |
4 |
5 | Please drag and drop the column labels in order to define pivot rows and columns.
6 |
7 |
8 |
9 |
10 | 16 |   17 | 23 |
24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /src/app/pivot/pivot-table/pivot-table.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BjoernKW/PivotHelper/a61c5aedf6ce763e1212bfdf7e555a6fc424eaaf/src/app/pivot/pivot-table/pivot-table.component.scss -------------------------------------------------------------------------------- /src/app/pivot/pivot-table/pivot-table.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PivotTableComponent } from './pivot-table.component'; 4 | 5 | describe('PivotTableComponent', () => { 6 | let component: PivotTableComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ 12 | PivotTableComponent 13 | ] 14 | }) 15 | .compileComponents(); 16 | })); 17 | 18 | beforeEach(() => { 19 | fixture = TestBed.createComponent(PivotTableComponent); 20 | component = fixture.componentInstance; 21 | component.data = []; 22 | component.data.push([]); 23 | component.rows = []; 24 | component.columns = []; 25 | fixture.detectChanges(); 26 | }); 27 | 28 | it('should create', () => { 29 | expect(component).toBeTruthy(); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /src/app/pivot/pivot-table/pivot-table.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ElementRef, Input, OnDestroy, OnInit } from '@angular/core'; 2 | import { Column } from '../../model/column'; 3 | import { ChangeNotificationService } from '../change-notification.service'; 4 | import { Subscription } from 'rxjs'; 5 | 6 | declare const $: any; 7 | declare const saveSvgAsPng: any; 8 | 9 | @Component({ 10 | selector: 'app-pivot-table', 11 | templateUrl: './pivot-table.component.html', 12 | styleUrls: ['./pivot-table.component.scss'], 13 | standalone: false 14 | }) 15 | export class PivotTableComponent implements OnInit, OnDestroy { 16 | 17 | @Input() data: {}[] | undefined; 18 | @Input() rows: Array | undefined; 19 | @Input() columns: Array | undefined; 20 | 21 | private _selectionChangedSubscription: Subscription | undefined; 22 | 23 | private readonly _pivotUIRows = 'pivotUIRows'; 24 | private readonly _pivotUICols = 'pivotUICols'; 25 | private readonly _pivotUIVals = 'pivotUIVals'; 26 | private readonly _pivotUIRendererName = 'pivotUIRendererName'; 27 | private readonly _pivotUIAggregatorName = 'pivotUIAggregatorName'; 28 | 29 | private static serializeSVGContent(svgElement: Node): string { 30 | const serializer = new XMLSerializer(); 31 | let source = serializer.serializeToString(svgElement); 32 | 33 | if (!source.match(/^]+xmlns="http:\/\/www\.w3\.org\/2000\/svg"/)) { 34 | source = source.replace(/^]+"http:\/\/www\.w3\.org\/1999\/xlink"/)) { 37 | source = source.replace(/^ = document.getElementsByTagName('svg'); 46 | let svgElement: SVGSVGElement | null = null; 47 | 48 | if (svgElements && svgElements.length > 0) { 49 | svgElement = svgElements[0]; 50 | } 51 | return svgElement; 52 | } 53 | 54 | private static triggerDownload(dataURL: string, chartFilename: string) { 55 | const a = window.document.createElement('a'); 56 | a.href = dataURL; 57 | a.download = chartFilename; 58 | document.body.appendChild(a); 59 | a.click(); // IE: "Access is denied"; see: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access 60 | document.body.removeChild(a); 61 | } 62 | 63 | constructor( 64 | private _elementRef: ElementRef, 65 | private _changeNotificationService: ChangeNotificationService 66 | ) { 67 | } 68 | 69 | ngOnInit() { 70 | this._changeNotificationService.selectionChanged$.subscribe((data) => { 71 | if (data && data.length > 0) { 72 | this.data = data; 73 | this.buildPivotTableAndChart(); 74 | } 75 | }); 76 | 77 | this.buildPivotTableAndChart(); 78 | } 79 | 80 | ngOnDestroy(): void { 81 | if (this._selectionChangedSubscription) { 82 | this._selectionChangedSubscription.unsubscribe(); 83 | } 84 | } 85 | 86 | exportCurrentChartAsSVGFile(): void { 87 | const svgElement = PivotTableComponent.getSvgElement(); 88 | 89 | if (svgElement) { 90 | const dataURL = PivotTableComponent.serializeSVGContent(svgElement); 91 | const chartFilename = 'chart.svg'; 92 | 93 | PivotTableComponent.triggerDownload(dataURL, chartFilename); 94 | } 95 | } 96 | 97 | exportCurrentChartAsPNGFile(): void { 98 | const svgElement = PivotTableComponent.getSvgElement(); 99 | saveSvgAsPng(svgElement, 'chart.png'); 100 | } 101 | 102 | private buildPivotTableAndChart() { 103 | if (!this._elementRef || 104 | !this._elementRef.nativeElement || 105 | !this._elementRef.nativeElement.children) { 106 | return; 107 | } 108 | 109 | const container = this._elementRef.nativeElement; 110 | const targetElement = $(container).find('#pivot-table'); 111 | 112 | if (!targetElement) { 113 | return; 114 | } 115 | 116 | let rows = this.rows?.map((row) => row.field); 117 | let columns = this.columns?.map((column) => column.field); 118 | let vals: string[] = []; 119 | 120 | const renderers = $.extend( 121 | $.pivotUtilities.renderers, 122 | $.pivotUtilities.c3_renderers 123 | ); 124 | 125 | let rendererName = 'Bar Chart'; 126 | let aggregatorName = 'Sum'; 127 | 128 | const storedRows = localStorage.getItem(this._pivotUIRows); 129 | if (storedRows) { 130 | rows = JSON.parse(storedRows); 131 | } 132 | const storedColumns = localStorage.getItem(this._pivotUICols); 133 | if (storedColumns) { 134 | columns = JSON.parse(storedColumns); 135 | } 136 | const storedVals = localStorage.getItem(this._pivotUIVals); 137 | if (storedVals) { 138 | vals = JSON.parse(storedVals); 139 | } 140 | const storedRendererName = localStorage.getItem(this._pivotUIRendererName); 141 | if (storedRendererName) { 142 | rendererName = storedRendererName; 143 | } 144 | const storedAggregatorName = localStorage.getItem(this._pivotUIAggregatorName); 145 | if (storedAggregatorName) { 146 | aggregatorName = storedAggregatorName; 147 | } 148 | 149 | const pivotUIRows = this._pivotUIRows; 150 | const pivotUICols = this._pivotUICols; 151 | const pivotUIVals = this._pivotUIVals; 152 | const pivotUIRendererName = this._pivotUIRendererName; 153 | const pivotUIAggregatorName = this._pivotUIAggregatorName; 154 | 155 | let pivotUIConfig = { 156 | rows: rows, 157 | cols: columns, 158 | vals: vals, 159 | renderers: renderers, 160 | rendererName: rendererName, 161 | aggregatorName: aggregatorName, 162 | onRefresh: function(config: any) { 163 | localStorage.setItem(pivotUIRows, JSON.stringify(config.rows)); 164 | localStorage.setItem(pivotUICols, JSON.stringify(config.cols)); 165 | localStorage.setItem(pivotUIVals, JSON.stringify(config.vals)); 166 | localStorage.setItem(pivotUIRendererName, config.rendererName); 167 | localStorage.setItem(pivotUIAggregatorName, config.aggregatorName); 168 | } 169 | }; 170 | 171 | targetElement.pivotUI( 172 | this.data, 173 | pivotUIConfig 174 | ); 175 | 176 | const scrollToElement: Element | null = document.querySelector('#pivot-table-buttons'); 177 | if (scrollToElement) { 178 | scrollToElement 179 | .scrollIntoView(); 180 | } 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /src/app/pivot/pivot.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Share current pivot table configuration 4 | 5 |
6 |
7 | 10 | 18 |
19 |
20 | 21 | 25 | 26 | 27 | 28 |
29 |
30 |
31 |
32 | 33 | 34 |
35 |
36 |
37 |
38 |
39 | 40 | Sample files 41 | (files will be downloaded and afterwards can be dragged and dropped to the file input above): 42 | 43 | 51 |
52 |
53 | 54 |
55 |
56 | 62 |   63 | 69 |
70 |
71 | 72 |
73 |
74 |
75 |
76 | 82 |   83 | Go to pivot table 84 |
85 |
86 |
87 |
88 | 89 |
90 |
91 | 92 | 101 | 102 |
103 |
104 | 112 |
113 |
114 | 115 |   116 | 122 |
123 |
124 |
125 | 128 | 129 | 133 | {{ column.header }} 134 | 138 | 139 | 140 | 141 | 143 |
144 | 150 |
151 | 156 | 157 | 159 | 160 | 161 | 162 |
163 | 167 | 170 | 171 | 175 | 176 | {{ row[column.field] }} 177 | 178 | 179 | {{ row[column.field] }} 180 | 181 | 182 | {{ row[column.field] }} 183 | 184 | 185 | 186 | 187 |
188 |
189 |
190 | 191 |
193 |
194 |
195 |
196 | 202 |   203 | Go to top 204 |
205 |
206 |
207 |
208 | 209 | 210 | 211 | 215 | -------------------------------------------------------------------------------- /src/app/pivot/pivot.component.scss: -------------------------------------------------------------------------------- 1 | .custom-file-input-column { 2 | margin-left: 15px; 3 | } 4 | 5 | .caption-filter-input { 6 | text-align: right; 7 | } 8 | 9 | #limit-elements { 10 | width: 80px; 11 | } 12 | 13 | #select-columns-label { 14 | vertical-align: top; 15 | margin-top: 7px; 16 | } 17 | 18 | .filter-match-mode-dropdown { 19 | margin-bottom: 5px; 20 | } 21 | -------------------------------------------------------------------------------- /src/app/pivot/pivot.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | 3 | import { PivotComponent } from './pivot.component'; 4 | import { TableModule } from 'primeng/table'; 5 | import { PivotTableComponent } from "./pivot-table/pivot-table.component"; 6 | import { FormsModule } from "@angular/forms"; 7 | import { RouterTestingModule } from "@angular/router/testing"; 8 | import { ActivatedRoute } from "@angular/router"; 9 | import { of } from "rxjs"; 10 | import { DropdownModule } from 'primeng/dropdown'; 11 | import { InputTextModule } from 'primeng/inputtext'; 12 | import { MultiSelectModule } from 'primeng/multiselect'; 13 | import { ProgressSpinnerModule } from 'primeng/progressspinner'; 14 | import { DialogModule } from 'primeng/dialog'; 15 | 16 | describe('PivotComponent', () => { 17 | let component: PivotComponent; 18 | let fixture: ComponentFixture; 19 | 20 | beforeEach(waitForAsync(() => { 21 | TestBed.configureTestingModule({ 22 | declarations: [ 23 | PivotComponent, 24 | PivotTableComponent 25 | ], 26 | imports: [ 27 | FormsModule, 28 | TableModule, 29 | DropdownModule, 30 | InputTextModule, 31 | MultiSelectModule, 32 | ProgressSpinnerModule, 33 | RouterTestingModule, 34 | DialogModule 35 | ], 36 | providers: [ 37 | { 38 | provide: ActivatedRoute, 39 | useValue: { 40 | queryParams: of({ 41 | pivotUIRendererName: 'Stacked Bar Chart', 42 | pivotUIAggregatorName: 'Median' 43 | }) 44 | } 45 | } 46 | ] 47 | }) 48 | .compileComponents(); 49 | })); 50 | 51 | beforeEach(() => { 52 | fixture = TestBed.createComponent(PivotComponent); 53 | component = fixture.componentInstance; 54 | fixture.detectChanges(); 55 | }); 56 | 57 | it('should create', () => { 58 | expect(component).toBeTruthy(); 59 | }); 60 | 61 | it('should properly initialise column data types', () => { 62 | expect(component.selectedColumns).toEqual([ 63 | { 64 | "field": "brand", 65 | "header": "brand", 66 | "filterMatchMode": "contains", 67 | "isBoolean": false, 68 | "isNumeric": false, 69 | "isEmailAddress": false, 70 | "isHttpUrl": false 71 | }, { 72 | "field": "lastYearSale", 73 | "header": "lastYearSale", 74 | "filterMatchMode": "contains", 75 | "isBoolean": false, 76 | "isNumeric": false, 77 | "isEmailAddress": false, 78 | "isHttpUrl": false 79 | }, { 80 | "field": "thisYearSale", 81 | "header": "thisYearSale", 82 | "filterMatchMode": "contains", 83 | "isBoolean": false, 84 | "isNumeric": false, 85 | "isEmailAddress": false, 86 | "isHttpUrl": false 87 | }, { 88 | "field": "lastYearProfit", 89 | "header": "lastYearProfit", 90 | "filterMatchMode": "contains", 91 | "isBoolean": false, 92 | "isNumeric": false, 93 | "isEmailAddress": false, 94 | "isHttpUrl": false 95 | }, { 96 | "field": "thisYearProfit", 97 | "header": "thisYearProfit", 98 | "filterMatchMode": "contains", 99 | "isBoolean": false, 100 | "isNumeric": false, 101 | "isEmailAddress": false, 102 | "isHttpUrl": false 103 | }, { 104 | "field": "salesperson", 105 | "header": "salesperson", 106 | "filterMatchMode": "contains", 107 | "isBoolean": false, 108 | "isNumeric": false, 109 | "isEmailAddress": false, 110 | "isHttpUrl": false 111 | }, { 112 | "field": "eligible", 113 | "header": "eligible", 114 | "filterMatchMode": "equals", 115 | "isBoolean": true, 116 | "isNumeric": false, 117 | "isEmailAddress": false, 118 | "isHttpUrl": false 119 | }, { 120 | "field": "accountEmailAddress", 121 | "header": "accountEmailAddress", 122 | "filterMatchMode": "contains", 123 | "isBoolean": false, 124 | "isNumeric": false, 125 | "isEmailAddress": true, 126 | "isHttpUrl": false 127 | }, { 128 | "field": "accountUrl", 129 | "header": "accountUrl", 130 | "filterMatchMode": "contains", 131 | "isBoolean": false, 132 | "isNumeric": false, 133 | "isEmailAddress": false, 134 | "isHttpUrl": true 135 | }, { 136 | "field": "numberOfRetailOutlets", 137 | "header": "numberOfRetailOutlets", 138 | "filterMatchMode": "contains", 139 | "isBoolean": false, 140 | "isNumeric": true, 141 | "isEmailAddress": false, 142 | "isHttpUrl": false 143 | } 144 | ]); 145 | 146 | expect(component.selectedColumns).toEqual([ 147 | { 148 | "field": "brand", 149 | "header": "brand", 150 | "filterMatchMode": "contains", 151 | "isBoolean": false, 152 | "isNumeric": false, 153 | "isEmailAddress": false, 154 | "isHttpUrl": false 155 | }, { 156 | "field": "lastYearSale", 157 | "header": "lastYearSale", 158 | "filterMatchMode": "contains", 159 | "isBoolean": false, 160 | "isNumeric": false, 161 | "isEmailAddress": false, 162 | "isHttpUrl": false 163 | }, { 164 | "field": "thisYearSale", 165 | "header": "thisYearSale", 166 | "filterMatchMode": "contains", 167 | "isBoolean": false, 168 | "isNumeric": false, 169 | "isEmailAddress": false, 170 | "isHttpUrl": false 171 | }, { 172 | "field": "lastYearProfit", 173 | "header": "lastYearProfit", 174 | "filterMatchMode": "contains", 175 | "isBoolean": false, 176 | "isNumeric": false, 177 | "isEmailAddress": false, 178 | "isHttpUrl": false 179 | }, { 180 | "field": "thisYearProfit", 181 | "header": "thisYearProfit", 182 | "filterMatchMode": "contains", 183 | "isBoolean": false, 184 | "isNumeric": false, 185 | "isEmailAddress": false, 186 | "isHttpUrl": false 187 | }, { 188 | "field": "salesperson", 189 | "header": "salesperson", 190 | "filterMatchMode": "contains", 191 | "isBoolean": false, 192 | "isNumeric": false, 193 | "isEmailAddress": false, 194 | "isHttpUrl": false 195 | }, { 196 | "field": "eligible", 197 | "header": "eligible", 198 | "filterMatchMode": "equals", 199 | "isBoolean": true, 200 | "isNumeric": false, 201 | "isEmailAddress": false, 202 | "isHttpUrl": false 203 | }, { 204 | "field": "accountEmailAddress", 205 | "header": "accountEmailAddress", 206 | "filterMatchMode": "contains", 207 | "isBoolean": false, 208 | "isNumeric": false, 209 | "isEmailAddress": true, 210 | "isHttpUrl": false 211 | }, { 212 | "field": "accountUrl", 213 | "header": "accountUrl", 214 | "filterMatchMode": "contains", 215 | "isBoolean": false, 216 | "isNumeric": false, 217 | "isEmailAddress": false, 218 | "isHttpUrl": true 219 | }, { 220 | "field": "numberOfRetailOutlets", 221 | "header": "numberOfRetailOutlets", 222 | "filterMatchMode": "contains", 223 | "isBoolean": false, 224 | "isNumeric": true, 225 | "isEmailAddress": false, 226 | "isHttpUrl": false 227 | } 228 | ]); 229 | }); 230 | 231 | it('should have pivot table settings from URL query parameters', () => { 232 | expect(localStorage.getItem('pivotUIRendererName')).toBe('Stacked Bar Chart'); 233 | expect(localStorage.getItem('pivotUIAggregatorName')).toBe('Median'); 234 | }); 235 | }); 236 | -------------------------------------------------------------------------------- /src/app/pivot/pivot.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import * as XLSX from 'xlsx'; 4 | import { Matrix } from '../model/matrix'; 5 | import { Column } from '../model/column'; 6 | import { ChangeNotificationService } from './change-notification.service'; 7 | import { ActivatedRoute } from '@angular/router'; 8 | import { PlatformLocation } from '@angular/common'; 9 | 10 | @Component({ 11 | selector: 'app-pivot', 12 | templateUrl: './pivot.component.html', 13 | styleUrls: ['./pivot.component.scss'], 14 | standalone: false 15 | }) 16 | export class PivotComponent implements OnInit { 17 | 18 | columns: Column[] = []; 19 | selectedColumns: Column[] = []; 20 | columnsToRemoveFromData: Column[] = []; 21 | outputData: {}[] = []; 22 | originalOutputData: {}[] = []; 23 | selectedRows: [] = []; 24 | filteredRows: {}[] = []; 25 | 26 | filterMatchModes = [ 27 | { label: 'contains', value: 'contains' }, 28 | { label: 'starts with', value: 'startsWith' }, 29 | { label: 'ends with', value: 'endsWith' }, 30 | { label: 'equals', value: 'equals' }, 31 | { label: 'doesn\'t equal', value: 'notEquals' }, 32 | { label: 'less than', value: 'lt' }, 33 | { label: 'greater than', value: 'gt' } 34 | ]; 35 | 36 | booleanDropdownValues = [ 37 | { label: 'all', value: undefined }, 38 | { label: 'true', value: true }, 39 | { label: 'false', value: false } 40 | ]; 41 | 42 | limitElements: number | undefined; 43 | 44 | displayShareDialog = false; 45 | urlForSharing: string | undefined; 46 | 47 | private _emailPattern = /^(([^<>()\[\].,;:\s@"]+(\.[^<>()\[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i; 48 | private _httpUrlPattern = /^http[s]{0,1}:/; 49 | 50 | private readonly _pivotUIRows = 'pivotUIRows'; 51 | private readonly _pivotUICols = 'pivotUICols'; 52 | private readonly _pivotUIVals = 'pivotUIVals'; 53 | private readonly _pivotUIRendererName = 'pivotUIRendererName'; 54 | private readonly _pivotUIAggregatorName = 'pivotUIAggregatorName'; 55 | 56 | constructor( 57 | private _changeNotificationService: ChangeNotificationService, 58 | private _activatedRoute: ActivatedRoute, 59 | private _platformLocation: PlatformLocation 60 | ) { } 61 | 62 | ngOnInit() { 63 | this._activatedRoute.queryParams.subscribe((queryParams) => { 64 | if (queryParams[this._pivotUIRows]) { 65 | localStorage.setItem(this._pivotUIRows, JSON.stringify(JSON.parse(queryParams[this._pivotUIRows]))); 66 | } 67 | if (queryParams[this._pivotUICols]) { 68 | localStorage.setItem(this._pivotUICols, JSON.stringify(JSON.parse(queryParams[this._pivotUICols]))); 69 | } 70 | if (queryParams[this._pivotUIVals]) { 71 | localStorage.setItem(this._pivotUIVals, JSON.stringify(JSON.parse(queryParams[this._pivotUIVals]))); 72 | } 73 | if (queryParams[this._pivotUIRendererName]) { 74 | localStorage.setItem(this._pivotUIRendererName, queryParams[this._pivotUIRendererName]); 75 | } 76 | if (queryParams[this._pivotUIAggregatorName]) { 77 | localStorage.setItem(this._pivotUIAggregatorName, queryParams[this._pivotUIAggregatorName]); 78 | } 79 | }); 80 | 81 | const columnHeaders = [ 82 | 'brand', 83 | 'lastYearSale', 84 | 'thisYearSale', 85 | 'lastYearProfit', 86 | 'thisYearProfit', 87 | 'salesperson', 88 | 'eligible', 89 | 'accountEmailAddress', 90 | 'accountUrl', 91 | 'numberOfRetailOutlets' 92 | ]; 93 | for (const column of columnHeaders) { 94 | this.columns.push( 95 | { 96 | field: column, 97 | header: column, 98 | filterMatchMode: 'contains', 99 | isBoolean: true, 100 | isNumeric: true, 101 | isEmailAddress: true, 102 | isHttpUrl: true 103 | } 104 | ); 105 | } 106 | this.selectedColumns = this.columns; 107 | 108 | this.outputData = [ 109 | { 110 | brand: 'Apple', 111 | lastYearSale: '51%', 112 | thisYearSale: '40%', 113 | lastYearProfit: '$54,406.00', 114 | thisYearProfit: '$43,342', 115 | salesperson: 'Smith', 116 | eligible: true, 117 | accountEmailAddress: 'someone@apple.com', 118 | accountUrl: 'https://apple.com', 119 | numberOfRetailOutlets: 10 120 | }, 121 | { 122 | brand: 'Samsung', 123 | lastYearSale: '83%', 124 | thisYearSale: '96%', 125 | lastYearProfit: '$423,132', 126 | thisYearProfit: '$312,122', 127 | salesperson: 'Johnson', 128 | eligible: false, 129 | accountEmailAddress: 'someone@samsung.com', 130 | accountUrl: 'https://apple.com', 131 | numberOfRetailOutlets: 8 132 | }, 133 | { 134 | brand: 'Microsoft', 135 | lastYearSale: '38%', 136 | thisYearSale: '5%', 137 | lastYearProfit: '$12,321', 138 | thisYearProfit: '$8,500', 139 | salesperson: 'Smith', 140 | eligible: 'true', 141 | accountEmailAddress: 'someone@microsoft.com', 142 | accountUrl: 'https://apple.com', 143 | numberOfRetailOutlets: 20 144 | }, 145 | { 146 | brand: 'Philips', 147 | lastYearSale: '49%', 148 | thisYearSale: '22%', 149 | lastYearProfit: '$745,232', 150 | thisYearProfit: '$650,323', 151 | salesperson: 'Johnson', 152 | eligible: 'false', 153 | accountEmailAddress: 'someone@philips.com', 154 | accountUrl: 'https://philips.com', 155 | numberOfRetailOutlets: 10 156 | }, 157 | { 158 | brand: 'Song', 159 | lastYearSale: '17%', 160 | thisYearSale: '79%', 161 | lastYearProfit: '$643,242', 162 | thisYearProfit: '500,332', 163 | salesperson: 'Smith', 164 | eligible: true, 165 | accountEmailAddress: 'someone@song.com', 166 | accountUrl: 'https://song.com', 167 | numberOfRetailOutlets: 10 168 | }, 169 | { 170 | brand: 'LG', 171 | lastYearSale: '52%', 172 | thisYearSale: ' 65%', 173 | lastYearProfit: '$421,132', 174 | thisYearProfit: '$150,005', 175 | salesperson: 'Jones', 176 | eligible: true, 177 | accountEmailAddress: 'someone@lg.com', 178 | accountUrl: 'https://lg.com', 179 | numberOfRetailOutlets: 10 180 | }, 181 | { 182 | brand: 'Sharp', 183 | lastYearSale: '82%', 184 | thisYearSale: '12%', 185 | lastYearProfit: '$131,211', 186 | thisYearProfit: '$100,214', 187 | salesperson: 'Jones', 188 | eligible: 0, 189 | accountEmailAddress: 'someone@sharp.com', 190 | accountUrl: 'http://sharp.com', 191 | numberOfRetailOutlets: 5 192 | }, 193 | { 194 | brand: 'Panasonic', 195 | lastYearSale: '44%', 196 | thisYearSale: '45%', 197 | lastYearProfit: '$66,442', 198 | thisYearProfit: '$53,322', 199 | salesperson: 'Williams', 200 | eligible: 1, 201 | accountEmailAddress: 'someone@panasonic.com', 202 | accountUrl: 'https://panasonic.com', 203 | numberOfRetailOutlets: 10 204 | }, 205 | { 206 | brand: 'HTC', 207 | lastYearSale: '90%', 208 | thisYearSale: '56%', 209 | lastYearProfit: '$765,442', 210 | thisYearProfit: '$296,232', 211 | salesperson: 'Davis', 212 | eligible: false, 213 | accountEmailAddress: 'someone@htc.com', 214 | accountUrl: 'https://htc.com', 215 | numberOfRetailOutlets: 20 216 | }, 217 | { 218 | brand: 'Toshiba', 219 | lastYearSale: '75%', 220 | thisYearSale: '54%', 221 | lastYearProfit: '$21,212', 222 | thisYearProfit: '$12,533', 223 | salesperson: 'Davis', 224 | eligible: true, 225 | accountEmailAddress: 'someone@toshiba.com', 226 | accountUrl: 'http://toshiba.com', 227 | numberOfRetailOutlets: 2 228 | } 229 | ]; 230 | 231 | for (const row of this.outputData) { 232 | for (const column of this.columns) { 233 | // @ts-ignore 234 | this.getColumnWithDataType(row[column.field], column, row); 235 | } 236 | } 237 | 238 | this.limitElements = this.outputData.length; 239 | 240 | this.preselectFilterMatchModes(); 241 | } 242 | 243 | onFileChange(fileChangeEvent: any): void { 244 | this.outputData = []; 245 | this.selectedRows = []; 246 | 247 | const target: DataTransfer = (fileChangeEvent.target); 248 | 249 | if (target.files.length !== 1) { 250 | throw new Error('Cannot use multiple files'); 251 | } 252 | 253 | const reader: FileReader = new FileReader(); 254 | 255 | reader.onload = (onLoadEvent: any) => { 256 | const inputData: string = onLoadEvent.target.result; 257 | const workBook: XLSX.WorkBook = XLSX.read(inputData, { type: 'binary' }); 258 | 259 | const workSheetName: string = workBook.SheetNames[0]; 260 | const workSheet: XLSX.WorkSheet = workBook.Sheets[workSheetName]; 261 | 262 | let data: Matrix = (XLSX.utils.sheet_to_json(workSheet, { header: 1 })); 263 | 264 | this.columns = []; 265 | for (const column of data[0]) { 266 | this.columns.push( 267 | { 268 | field: column, 269 | header: column, 270 | filterMatchMode: 'contains', 271 | isBoolean: true, 272 | isNumeric: true, 273 | isEmailAddress: true, 274 | isHttpUrl: true 275 | } 276 | ); 277 | } 278 | this.selectedColumns = this.columns; 279 | 280 | data = data.slice(1, data.length); 281 | 282 | for (const row of data) { 283 | const outputRow = {}; 284 | 285 | let i = 0; 286 | for (const column of this.columns) { 287 | // @ts-ignore 288 | outputRow[column.field] = row[i]; 289 | this.getColumnWithDataType(row[i], column, outputRow); 290 | 291 | i++; 292 | } 293 | 294 | this.outputData.push(outputRow); 295 | } 296 | 297 | this.limitElements = this.outputData.length; 298 | 299 | this.preselectFilterMatchModes(); 300 | }; 301 | 302 | reader.readAsBinaryString(target.files[0]); 303 | } 304 | 305 | export(): void { 306 | const targetRows = this.getRowsWithDeselectedColumnsRemoved(); 307 | const outputRows = this.convertSelectedRows(targetRows); 308 | 309 | const workSheet: XLSX.WorkSheet = XLSX.utils.aoa_to_sheet(outputRows); 310 | const workBook: XLSX.WorkBook = XLSX.utils.book_new(); 311 | XLSX.utils.book_append_sheet(workBook, workSheet, 'Sheet1'); 312 | 313 | XLSX.writeFile(workBook, 'export.xlsx'); 314 | } 315 | 316 | onRowSelectionChanged(): void { 317 | this._changeNotificationService.onSelectionChanged(this.selectedRows); 318 | } 319 | 320 | onFilterChanged($event: { filters: {}, filteredValue: {}[] }): void { 321 | if (Object.keys($event.filters).length > 0) { 322 | this.filteredRows = $event.filteredValue; 323 | } else { 324 | this.filteredRows = []; 325 | } 326 | 327 | this._changeNotificationService.onSelectionChanged($event.filteredValue); 328 | } 329 | 330 | onColumnSelectionChanged(): void { 331 | this.columnsToRemoveFromData = []; 332 | for (const column of this.columns) { 333 | if (!this.selectedColumns?.includes(column)) { 334 | this.columnsToRemoveFromData.push(column); 335 | } 336 | } 337 | 338 | const targetRows = this.getRowsWithDeselectedColumnsRemoved(); 339 | 340 | this._changeNotificationService.onSelectionChanged(targetRows); 341 | } 342 | 343 | showTopElements(value: number): void { 344 | if (!this.originalOutputData) { 345 | this.originalOutputData = this.outputData; 346 | } 347 | if (this.outputData.length < this.originalOutputData.length) { 348 | this.outputData = this.originalOutputData; 349 | } 350 | 351 | const limit = value ? value : this.outputData.length; 352 | 353 | this.outputData = this.outputData.slice(0, limit); 354 | 355 | this._changeNotificationService.onSelectionChanged(this.outputData); 356 | } 357 | 358 | displayShareCurrentPivotTableConfigurationDialog(): void { 359 | this.urlForSharing = `${location.protocol}//${location.host}${this._platformLocation.getBaseHrefFromDOM()}` // @ts-ignore 360 | + `?${this._pivotUIRows}=${encodeURIComponent(localStorage.getItem(this._pivotUIRows))}` // @ts-ignore 361 | + `&${this._pivotUICols}=${encodeURIComponent(localStorage.getItem(this._pivotUICols))}` // @ts-ignore 362 | + `&${this._pivotUIVals}=${encodeURIComponent(localStorage.getItem(this._pivotUIVals))}` // @ts-ignore 363 | + `&${this._pivotUIRendererName}=${encodeURIComponent(localStorage.getItem(this._pivotUIRendererName))}` // @ts-ignore 364 | + `&${this._pivotUIAggregatorName}=${encodeURIComponent(localStorage.getItem(this._pivotUIAggregatorName))}`; 365 | 366 | this.displayShareDialog = true; 367 | } 368 | 369 | copyURLToClipboard(inputElementWithURL: HTMLInputElement): void { 370 | inputElementWithURL.select(); 371 | document.execCommand('copy'); 372 | inputElementWithURL.setSelectionRange(0, inputElementWithURL.value.length); 373 | } 374 | 375 | resetPivotTableConfiguration(): void { 376 | localStorage.clear(); 377 | location.reload(); 378 | } 379 | 380 | getInputFieldTypeForColumn(column: Column): string { 381 | if (column.isNumeric) { 382 | return 'number'; 383 | } 384 | 385 | if (column.isEmailAddress) { 386 | return 'email' 387 | } 388 | 389 | if (column.isHttpUrl) { 390 | return 'url' 391 | } 392 | 393 | return 'text'; 394 | } 395 | 396 | private convertSelectedRows(rows: {}[]): any[][] { 397 | const outputRows = []; 398 | 399 | let outputRow = []; 400 | // @ts-ignore 401 | for (const column of this.selectedColumns) { 402 | outputRow.push(column.field); 403 | } 404 | outputRows.push(outputRow); 405 | 406 | for (const row of rows) { 407 | outputRow = []; 408 | for (const column in row) { 409 | // @ts-ignore 410 | outputRow.push(row[column]); 411 | } 412 | outputRows.push(outputRow); 413 | } 414 | 415 | return outputRows; 416 | } 417 | 418 | private getRowsWithDeselectedColumnsRemoved(): {}[] { 419 | let sourceRows = this.outputData; 420 | if (this.selectedRows && this.selectedRows.length > 0) { 421 | sourceRows = this.selectedRows; 422 | } 423 | if (this.filteredRows && this.filteredRows.length > 0) { 424 | sourceRows = this.filteredRows; 425 | } 426 | 427 | let targetRows: {}[] = JSON.parse(JSON.stringify(sourceRows)); 428 | 429 | for (const row of targetRows) { 430 | for (const column of this.columnsToRemoveFromData) { 431 | if (row.hasOwnProperty(column.field)) { 432 | // @ts-ignore 433 | delete row[column.field]; 434 | } 435 | } 436 | } 437 | 438 | return targetRows; 439 | } 440 | 441 | private getColumnWithDataType(value: any, column: Column, outputRow: {}): void { 442 | let interpretedValue = value; 443 | 444 | if (column.isBoolean || column.isNumeric) { 445 | try { 446 | interpretedValue = JSON.parse(value); 447 | 448 | column.isBoolean = column.isBoolean && !!interpretedValue == interpretedValue; 449 | column.isNumeric = !column.isBoolean && column.isNumeric && !isNaN(interpretedValue); 450 | } catch (error) { 451 | column.isBoolean = false; 452 | column.isNumeric = false; 453 | } 454 | } 455 | 456 | column.isEmailAddress = column.isEmailAddress && this._emailPattern.test(interpretedValue); 457 | column.isHttpUrl = column.isHttpUrl && this._httpUrlPattern.test(interpretedValue); 458 | 459 | if (column.isBoolean || column.isNumeric || column.isEmailAddress) { 460 | // @ts-ignore 461 | outputRow[column.field] = interpretedValue; 462 | } 463 | } 464 | 465 | private preselectFilterMatchModes(): void { 466 | for (const column of this.columns) { 467 | if (column.isBoolean) { 468 | column.filterMatchMode = 'equals' 469 | } 470 | } 471 | } 472 | } 473 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BjoernKW/PivotHelper/a61c5aedf6ce763e1212bfdf7e555a6fc424eaaf/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BjoernKW/PivotHelper/a61c5aedf6ce763e1212bfdf7e555a6fc424eaaf/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PivotHelper 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** 22 | * By default, zone.js will patch all possible macroTask and DomEvents 23 | * user can disable parts of macroTask/DomEvents patch by setting following flags 24 | * because those flags need to be set before `zone.js` being loaded, and webpack 25 | * will put import in the top of bundle, so user need to create a separate file 26 | * in this directory (for example: zone-flags.ts), and put the following flags 27 | * into that file, and then add the following code before importing zone.js. 28 | * import './zone-flags.ts'; 29 | * 30 | * The flags allowed in zone-flags.ts are listed here. 31 | * 32 | * The following flags will work for all browsers. 33 | * 34 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 35 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 36 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 37 | * 38 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 39 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 40 | * 41 | * (window as any).__Zone_enable_cross_context_check = true; 42 | * 43 | */ 44 | 45 | /*************************************************************************************************** 46 | * Zone JS is required by default for Angular itself. 47 | */ 48 | import 'zone.js'; // Included with Angular CLI. 49 | 50 | 51 | /*************************************************************************************************** 52 | * APPLICATION IMPORTS 53 | */ 54 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | 3 | a { 4 | color: #bc0404; 5 | } 6 | 7 | .pvtUiCell { 8 | background-color: #f4f4f4; 9 | color: #333333; 10 | border: 1px solid #c8c8c8; 11 | padding: 0.571em 1em; 12 | } 13 | 14 | select.pvtRenderer, select.pvtAggregator, select.pvtAttrDropdown { 15 | display: inline-block; 16 | height: calc(1.5em + .75rem + 2px); 17 | padding: .375rem .75rem; 18 | font-size: 1rem; 19 | font-weight: 400; 20 | line-height: 1.5; 21 | color: #495057; 22 | background-color: #fff; 23 | background-clip: padding-box; 24 | border: 1px solid #ced4da; 25 | border-radius: .25rem; 26 | transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out; 27 | } 28 | 29 | .pvtFilterBox button { 30 | display: inline-block; 31 | font-weight: 400; 32 | color: #fff; 33 | text-align: center; 34 | vertical-align: middle; 35 | -webkit-user-select: none; 36 | -moz-user-select: none; 37 | -ms-user-select: none; 38 | user-select: none; 39 | background-color: #6c757d; 40 | border-color: #6c757d; 41 | padding: .375rem .75rem; 42 | margin: .375rem .75rem; 43 | font-size: 1rem; 44 | line-height: 1.5; 45 | border-radius: .25rem; 46 | transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; 47 | } 48 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | // First, initialize the Angular testing environment. 11 | getTestBed().initTestEnvironment( 12 | BrowserDynamicTestingModule, 13 | platformBrowserDynamicTesting(), { 14 | teardown: { destroyAfterEach: false } 15 | } 16 | ); 17 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "main.ts", 9 | "polyfills.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "forceConsistentCasingInFileNames": true, 7 | "strict": true, 8 | "noImplicitOverride": true, 9 | "noPropertyAccessFromIndexSignature": true, 10 | "noImplicitReturns": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "sourceMap": true, 13 | "declaration": false, 14 | "downlevelIteration": true, 15 | "experimentalDecorators": true, 16 | "moduleResolution": "node", 17 | "importHelpers": true, 18 | "target": "ES2022", 19 | "module": "es2020", 20 | "lib": [ 21 | "es2020", 22 | "dom" 23 | ], 24 | "useDefineForClassFields": false 25 | }, 26 | "angularCompilerOptions": { 27 | "enableI18nLegacyMessageIdFormat": false, 28 | "strictInjectionParameters": true, 29 | "strictInputAccessModifiers": true, 30 | "strictTemplates": true 31 | } 32 | } 33 | --------------------------------------------------------------------------------