├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .gitignore ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── data ├── AdventureWorks Sales.xlsx ├── Bestsellers.csv ├── Demographics.xlsx ├── ElectricityGeneration.xlsx ├── Endowments.xlsx ├── Financial Sample.xlsx ├── GlobalSales.xlsx ├── Multiline.csv ├── Multiline.xlsx ├── Periodic Table of Elements Semicolon.csv ├── Periodic Table of Elements.csv ├── Periodic Table of Elements.tsv ├── StateCapitals.xlsx └── University Rankings.csv ├── img ├── Preview.svg ├── Preview_inverse.svg ├── csv-preview-4.gif ├── excel-preview-4.gif ├── excel-themes-4.gif ├── gc-excelviewer.png └── separator.png ├── out ├── controls │ ├── wijmo.barcode.common.min.js │ ├── wijmo.barcode.composite.min.js │ ├── wijmo.barcode.min.js │ ├── wijmo.barcode.specialized.min.js │ ├── wijmo.chart.analytics.min.js │ ├── wijmo.chart.animation.min.js │ ├── wijmo.chart.annotation.min.js │ ├── wijmo.chart.finance.analytics.min.js │ ├── wijmo.chart.finance.min.js │ ├── wijmo.chart.hierarchical.min.js │ ├── wijmo.chart.interaction.min.js │ ├── wijmo.chart.map.min.js │ ├── wijmo.chart.min.js │ ├── wijmo.chart.radar.min.js │ ├── wijmo.chart.render.min.js │ ├── wijmo.chart.webgl.min.js │ ├── wijmo.cloud.min.js │ ├── wijmo.gauge.min.js │ ├── wijmo.grid.cellmaker.min.js │ ├── wijmo.grid.detail.min.js │ ├── wijmo.grid.filter.min.js │ ├── wijmo.grid.grouppanel.min.js │ ├── wijmo.grid.immutable.min.js │ ├── wijmo.grid.min.js │ ├── wijmo.grid.multirow.min.js │ ├── wijmo.grid.pdf.min.js │ ├── wijmo.grid.search.min.js │ ├── wijmo.grid.selector.min.js │ ├── wijmo.grid.sheet.min.js │ ├── wijmo.grid.transposed.min.js │ ├── wijmo.grid.transposedmultirow.min.js │ ├── wijmo.grid.xlsx.min.js │ ├── wijmo.input.min.js │ ├── wijmo.min.js │ ├── wijmo.nav.min.js │ ├── wijmo.odata.min.js │ ├── wijmo.olap.min.js │ ├── wijmo.pdf.min.js │ ├── wijmo.pdf.security.min.js │ ├── wijmo.rest.min.js │ ├── wijmo.touch.min.js │ ├── wijmo.undo.min.js │ ├── wijmo.viewer.min.js │ └── wijmo.xlsx.min.js ├── csv.js ├── excel.js ├── jszip.min.js └── styles │ ├── vscode.css │ ├── wijmo-core.min.css │ └── wijmo.min.css ├── package-lock.json ├── package.json ├── src ├── baseDocumentView.ts ├── csvDocumentView.ts ├── csvEditor.ts ├── dispose.ts ├── documentViewManager.ts ├── excelDocumentView.ts ├── excelEditor.ts ├── extension.ts ├── legacyDocumentView.ts ├── license.ts └── serializer.ts ├── tsconfig.json └── webpack.config.js /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------------------------------------- 2 | # Copyright (c) Microsoft Corporation. All rights reserved. 3 | # Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. 4 | #------------------------------------------------------------------------------------------------------------- 5 | 6 | FROM node:8 7 | 8 | # Configure apt 9 | ENV DEBIAN_FRONTEND=noninteractive 10 | RUN apt-get update \ 11 | && apt-get -y install --no-install-recommends apt-utils 2>&1 12 | 13 | # Verify git and needed tools are installed 14 | RUN apt-get install -y git procps 15 | 16 | # Remove outdated yarn from /opt and install via package 17 | # so it can be easily updated via apt-get upgrade yarn 18 | RUN rm -rf /opt/yarn-* \ 19 | rm -f /usr/local/bin/yarn \ 20 | rm -f /usr/local/bin/yarnpkg \ 21 | && apt-get install -y curl apt-transport-https lsb-release \ 22 | && curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \ 23 | && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ 24 | && apt-get update \ 25 | && apt-get -y install --no-install-recommends yarn 26 | 27 | # Install tslint and typescript 28 | RUN npm install -g tslint typescript 29 | 30 | # Clean up 31 | RUN apt-get autoremove -y \ 32 | && apt-get clean -y \ 33 | && rm -rf /var/lib/apt/lists/* 34 | ENV DEBIAN_FRONTEND=dialog 35 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // See https://aka.ms/vscode-remote/containers for the 2 | // documentation about the devcontainer.json format 3 | { 4 | "name": "Extension Development", 5 | "dockerFile": "Dockerfile", 6 | "extensions": [ 7 | "ms-vscode.vscode-typescript-tslint-plugin" 8 | ] 9 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .DS_Store 4 | *.vsix 5 | team-extension.log 6 | .vscode-test-web -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | { 3 | "version": "0.2.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": [ 11 | "--extensionDevelopmentPath=${workspaceRoot}", 12 | "${workspaceRoot}/data" 13 | ], 14 | "stopOnEntry": false, 15 | "sourceMaps": true, 16 | "outFiles": [ 17 | "${workspaceRoot}/dist/**/*.js" 18 | ], 19 | "preLaunchTask": "npm" 20 | }, 21 | { 22 | "name": "Run Web Extension in VS Code", 23 | "type": "pwa-extensionHost", 24 | "debugWebWorkerHost": true, 25 | "request": "launch", 26 | "args": [ 27 | "--extensionDevelopmentPath=${workspaceFolder}", 28 | "--extensionDevelopmentKind=web" 29 | ], 30 | "outFiles": [ 31 | "${workspaceFolder}/dist/web/**/*.js" 32 | ], 33 | "preLaunchTask": "npm: watch-web" 34 | } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true // set this to false to include "out" folder in search results 8 | }, 9 | "typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version 10 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // Available variables which can be used inside of strings. 2 | // ${workspaceRoot}: the root folder of the team 3 | // ${file}: the current opened file 4 | // ${fileBasename}: the current opened file's basename 5 | // ${fileDirname}: the current opened file's dirname 6 | // ${fileExtname}: the current opened file's extension 7 | // ${cwd}: the current working directory of the spawned process 8 | 9 | // A task runner that calls a custom npm script that compiles the extension. 10 | { 11 | "version": "2.0.0", 12 | 13 | "tasks": [ 14 | { 15 | "type": "npm", 16 | "script": "compile-web", 17 | "group": { 18 | "kind": "build", 19 | "isDefault": true 20 | }, 21 | "problemMatcher": [ 22 | "$ts-webpack" 23 | ] 24 | }, 25 | { 26 | "type": "npm", 27 | "script": "watch-web", 28 | "group": "build", 29 | "isBackground": true, 30 | "problemMatcher": [ 31 | "$ts-webpack-watch" 32 | ] 33 | }, 34 | { 35 | "label": "npm", 36 | "command": "npm", 37 | "type": "shell", 38 | "presentation": { 39 | "echo": true, 40 | "reveal": "silent", 41 | "focus": false, 42 | "panel": "shared", 43 | "showReuseMessage": true, 44 | "clear": false 45 | }, 46 | "args": [ 47 | "run", 48 | "compile", 49 | "--loglevel", 50 | "silent" 51 | ], 52 | "isBackground": true, 53 | "problemMatcher": "$tsc-watch" 54 | } 55 | ] 56 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | typings/** 3 | src/** 4 | **/*.map 5 | .gitignore 6 | tsconfig.json 7 | data/** 8 | webpack.config.json 9 | node_modules 10 | team-extension.log 11 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) GrapeCity, Inc. 2 | 3 | All rights reserved. 4 | 5 | MIT License 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Excel Viewer 2 | Powered by [Wijmo](http://www.grapecity.com/wijmo), this extension provides custom editors and previews for CSV files and Excel spreadsheets in Visual Studio Code and [Visual Studio Code for the Web](https://code.visualstudio.com/docs/editor/vscode-web). 3 | 4 | > **Version 4.2.58 fixes many CSV editing issues that occurred in files containing multiline cells.** 5 | 6 | Version 4.2 now supports first-class **custom editors** that implement operations such as save, undo, redo, and hot exit. For Excel files, this is the default, and clicking the name of an Excel file in explorer view opens the custom editor directly. For CSV files, this is optional, and executing the `Open With` command on the context menu prompts for the built-in or custom editor to be opened. The `Open Preview` command is still supported for both file types. 7 | 8 | Version 4.2 also supports **Visual Studio Code for the Web**. To get started, visit [https://vscode.dev](https://vscode.dev) in your browser. 9 | 10 | > This extension requires Visual Studio Code 1.63.0 or greater. 11 | 12 | ## CSV Usage 13 | For files with a .csv, .tsv, or .tab extension, use the explorer context menu or editor title menu to invoke the `Open Preview` command. The contents of the file will be displayed in a [FlexGrid](http://demos.wijmo.com/5/Angular/Explorer/Explorer/#/grid/intro) control, which supports sorting and filtering via its column headers. You can also use the `Open With` command on the explorer context menu to open a custom editor, as shown here: 14 | 15 | ![Image](./img/csv-preview-4.gif) 16 | 17 | For .tsv and .tab files, a tab delimiter is assumed. For plain text files with different extensions, open the file in an editor and execute the `CSV: Open Preview` command from the command palette. For any text file that is open in the built-in editor, regardless of extension, you can right-click its tab and execute the `Reopen Editor With` command, then select the `CSV Viewer` option when prompted. 18 | 19 | > Please read [this section](#regex), which describes common customizations to the default configuration for column separators and other settings that affect CSV files. 20 | 21 | To sort a column in ascending order, click its column header. To reverse the sort order, click its column header again. To specify a secondary sort column, hold the `Shift` key while clicking its column header. To undo sorting for a column, hold the `Ctrl` key while clicking its column header. Alternatively, you can use the `CSV: Clear Preview State` command to remove all sort/filter criteria for the current file. 22 | 23 | ## Excel Usage 24 | For files with an .xlsx or .xlsm extension, just click (or double-click) the filename in explorer view. The contents of the file will be displayed in a [FlexSheet](http://demos.wijmo.com/5/Angular/FlexSheetExplorer/FlexSheetExplorer/#/intro) control. If multiple sheets are present, use the controls at the bottom of the view for navigation. 25 | 26 | ![Image](./img/excel-preview-4.gif) 27 | 28 | As in earlier versions, you can use the explorer context menu or editor title menu to invoke the `Open Preview` command. 29 | 30 | ## Theme Support 31 | The extension adapts its display to the current Visual Studio Code theme. For best results, choose a theme with opaque selection background colors. 32 | 33 | ![Image](./img/excel-themes-4.gif) 34 | 35 | ## Persistent Data 36 | The extension automatically stores user customizations on a per-file, per-workspace basis. For CSV files, this includes column widths, sort/filter criteria, data types, format strings, and scroll bar positions. For Excel files, this includes the selected sheet index, sort/filter criteria, and scroll bar positions associated with that sheet only. If the column structure of a CSV file changes, any persistent data is ignored for that file. 37 | 38 | > To discard persistent data for a CSV or Excel file, execute the command `CSV: Clear Preview State`. The preview will be refreshed automatically. 39 | 40 | ## Numeric Formatting 41 | By default, numeric formatting is always enabled for CSV files, and the extension will examine the first row of data to determine which columns are numeric. The setting `csv-preview.numberFormat` specifies a [.NET-style format string](https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings) that controls the display type and significant digits for all numeric columns. This setting defaults to `g2`, which specifies two significant digits and does not display a thousands separator. 42 | 43 | The setting `csv-preview.formatValues` controls how numeric formatting is applied: 44 | 45 | Value | Description 46 | ----- | ----------- 47 | `always` | All numeric values are formatted according to the `csv-preview.numberFormat` setting. This is the default. 48 | `never` | All values are treated as strings, and no numeric formatting occurs. 49 | `unquoted` | Numeric values are formatted, but only if they are not enclosed in quotes. If a column contains a mixture of quoted and unquoted values, the value in the first data row takes precedence. 50 | 51 | > Since data types and format strings are persisted along with other column properties, you may need to run the `CSV: Clear Preview State` command to see the effects of changing the `csv-preview.formatValues` and `csv-preview.numberFormat` options. 52 | 53 | ## Configuration 54 | To change the default configuration settings for the Excel Viewer extension, edit the user or workspace settings as described [here](http://code.visualstudio.com/docs/customization/userandworkspace#_creating-user-and-workspace-settings). The available settings, which govern CSV files only, are as follows: 55 | 56 | Setting | Type | Default Value | Description 57 | ------- | ---- | ------------- | ----------- 58 | csv-preview.separator | string | , (comma) | Specifies the separator used in a CSV file. 59 | csv-preview.quoteMark | string | " (double‑quote) | Specifies the optional character used to surround individual values in a CSV file. 60 | csv-preview.hasHeaders | boolean | true | Specifies whether the first row in a CSV file represents column headers. 61 | csv-preview.capitalizeHeaders | boolean | true | Specifies whether column headers in CSV files are capitalized. 62 | csv-preview.resizeColumns | string | none | Specifies whether columns are automatically resized to fit the data for CSV files. 63 | csv-preview.lineNumbers | string | none | Specifies whether to display line numbers for CSV files. 64 | csv-preview.commentCharacter | string | # | Specifies the character used to mark comment lines in CSV files. 65 | csv-preview.skipComments | boolean | false | Specifies whether lines that begin with the comment character should be omitted from the CSV preview. 66 | csv-preview.formatValues | string | always | Specifies whether to format numeric values in CSV files, or to treat them as strings. 67 | csv-preview.numberFormat | string | g2 | Specifies a .NET-style format string used to format numeric columns in CSV files. 68 | csv-preview.openStdin | boolean | false | Specifies whether text piped to stdin is automatically opened as a CSV preview. 69 | 70 | > Any open CSV previews or custom editors will automatically update to reflect the modified settings, except where noted in the previous section. 71 | 72 | ### Regular Expression Settings 73 | The following configuration settings are used within regular expressions when processing CSV files. Therefore, you need to escape any special regular expression characters with a backslash in order to achieve the desired result. 74 | 75 | * `csv-preview.separator` 76 | * `csv-preview.quoteMark` 77 | * `csv-preview.commentCharacter` 78 | 79 | For example, to override the default separator character (comma) with a dollar sign, you would enter the following in the settings editor: 80 | 81 | ![image](./img/separator.png) 82 | 83 | However, if you are editing the `settings.json` file directly, an extra backslash is required: 84 | 85 | `"csv-preview.separator": "\\$"` 86 | 87 | Likewise, to use a vertical bar as the separator character: 88 | 89 | `"csv-preview.separator": "\\|"` 90 | 91 | However, if you want to use the tab character as a separator, only one backslash is needed: 92 | 93 | `"csv-preview.separator": "\t"` 94 | 95 | You can also specify multiple separator characters by using a regular expression character set. For example, to recognize a comma OR a semicolon as a separator, enclose both characters in square brackets: 96 | 97 | `"csv-preview.separator": "[,;]"` 98 | 99 | Likewise, to use both % and @ as comment symbols (instead of #), do this: 100 | 101 | `"csv-preview.commentCharacter": "[%@]"` 102 | 103 | Alternatively, to use C# or JavaScript style comments (//), do this: 104 | 105 | `"csv-preview.commentCharacter": "/{2}"` 106 | 107 | ## References 108 | * [About Wijmo](http://www.grapecity.com/wijmo) 109 | * [FlexGrid API](http://www.grapecity.com/wijmo/api/classes/wijmo_grid.flexgrid.html) 110 | * [FlexSheet API](http://www.grapecity.com/wijmo/api/classes/wijmo_grid_sheet.flexsheet.html) 111 | -------------------------------------------------------------------------------- /data/AdventureWorks Sales.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/data/AdventureWorks Sales.xlsx -------------------------------------------------------------------------------- /data/Demographics.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/data/Demographics.xlsx -------------------------------------------------------------------------------- /data/ElectricityGeneration.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/data/ElectricityGeneration.xlsx -------------------------------------------------------------------------------- /data/Endowments.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/data/Endowments.xlsx -------------------------------------------------------------------------------- /data/Financial Sample.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/data/Financial Sample.xlsx -------------------------------------------------------------------------------- /data/GlobalSales.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/data/GlobalSales.xlsx -------------------------------------------------------------------------------- /data/Multiline.csv: -------------------------------------------------------------------------------- 1 | "A","B","C" 2 | "One","Two","Three" 3 | "XYZ","Row 1 4 | Row 2 5 | Row 3 6 | Row 4","ABC" 7 | "Uno","Dos","Tres" -------------------------------------------------------------------------------- /data/Multiline.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/data/Multiline.xlsx -------------------------------------------------------------------------------- /data/Periodic Table of Elements Semicolon.csv: -------------------------------------------------------------------------------- 1 | sep=; 2 | Atomic Number;Element;Symbol;Atomic Weight;Period;Group;Phase;Most Stable Crystal;Type;Ionic Radius;Atomic Radius;Electronegativity;First Ionization Potential;Density;Melting Point (K);Boiling Point (K);Isotopes;Discoverer;Year of Discovery;Specific Heat Capacity;Electron Configuration;Display Row;Display Column 3 | 1;Hydrogen;H;1.00794;1;1;gas;;Nonmetal;0.012;0.79;2.2;13.5984;0.00008988;14.175;20.28;3;Cavendish;1766;14.304;1s1;1;1 4 | 2;Helium;He;4.002602;1;18;gas;;Noble Gas;;0.49;;24.5874;0.0001785;;4.22;5;Janssen;1868;5.193;1s2;1;18 5 | 3;Lithium;Li;6.941;2;1;solid;bcc;Alkali Metal;0.76;2.1;0.98;5.3917;0.534;453.85;1615;5;Arfvedson;1817;3.582;[He] 2s1;2;1 6 | 4;Beryllium;Be;9.012182;2;2;solid;hex;Alkaline Earth Metal;0.35;1.4;1.57;9.3227;1.85;1560.15;2742;6;Vaulquelin;1798;1.825;[He] 2s2;2;2 7 | 5;Boron;B;10.811;2;13;solid;rho;Metalloid;0.23;1.2;2.04;8.298;2.34;2573.15;4200;6;Gay-Lussac;1808;1.026;[He] 2s2 2p1;2;13 8 | 6;Carbon;C;12.0107;2;14;solid;hex;Nonmetal;;0.91;2.55;11.2603;2.267;3948.15;4300;7;Prehistoric;;0.709;[He] 2s2 2p2;2;14 9 | 7;Nitrogen;N;14.0067;2;15;gas;;Nonmetal;0.13;0.75;3.04;14.5341;0.0012506;63.29;77.36;8;Rutherford;1772;1.04;[He] 2s2 2p3;2;15 10 | 8;Oxygen;O;15.9994;2;16;gas;;Nonmetal;1.4;0.65;3.44;13.6181;0.001429;50.5;90.2;8;Priestley/Scheele;1774;0.918;[He] 2s2 2p4;2;16 11 | 9;Fluorine;F;18.9984032;2;17;gas;;Halogen;1.3;0.57;3.98;17.4228;0.001696;53.63;85.03;6;Moissan;1886;0.824;[He] 2s2 2p5;2;17 12 | 10;Neon;Ne;20.1797;2;18;gas;;Noble Gas;;0.51;;21.5645;0.0008999;24.703;27.07;8;Ramsay and Travers;1898;1.03;[He] 2s2 2p6;2;18 13 | 11;Sodium;Na;22.98976928;3;1;solid;bcc;Alkali Metal;1;2.2;0.93;5.1391;0.971;371.15;1156;7;Davy;1807;1.228;[Ne] 3s1;3;1 14 | 12;Magnesium;Mg;24.305;3;2;solid;hex;Alkaline Earth Metal;0.72;1.7;1.31;7.6462;1.738;923.15;1363;8;Black;1755;1.023;[Ne] 3s2;3;2 15 | 13;Aluminum;Al;26.9815386;3;13;solid;fcc;Metal;0.54;1.8;1.61;5.9858;2.698;933.4;2792;8;Wöhler;1827;0.897;[Ne] 3s2 3p1;3;13 16 | 14;Silicon;Si;28.0855;3;14;solid;fcc;Metalloid;0.4;1.5;1.9;8.1517;2.3296;1683.15;3538;8;Berzelius;1824;0.705;[Ne] 3s2 3p2;3;14 17 | 15;Phosphorus;P;30.973762;3;15;solid;cub;Nonmetal;0.38;1.2;2.19;10.4867;1.82;317.25;553;7;BranBrand;1669;0.769;[Ne] 3s2 3p3;3;15 18 | 16;Sulfur;S;32.065;3;16;solid;orth;Nonmetal;0.37;1.1;2.58;10.36;2.067;388.51;717.8;10;Prehistoric;;0.71;[Ne] 3s2 3p4;3;16 19 | 17;Chlorine;Cl;35.453;3;17;gas;;Halogen;1.8;0.97;3.16;12.9676;0.003214;172.31;239.11;11;Scheele;1774;0.479;[Ne] 3s2 3p5;3;17 20 | 18;Argon;Ar;39.948;3;18;gas;;Noble Gas;;0.88;;15.7596;0.0017837;83.96;87.3;8;Rayleigh and Ramsay;1894;0.52;[Ne] 3s2 3p6;3;18 21 | 19;Potassium;K;39.0983;4;1;solid;bcc;Alkali Metal;1.4;2.8;0.82;4.3407;0.862;336.5;1032;10;Davy;1807;0.757;[Ar] 4s1;4;1 22 | 20;Calcium;Ca;40.078;4;2;solid;fcc;Alkaline Earth Metal;0.99;2.2;1;6.1132;1.54;1112.15;1757;14;Davy;1808;0.647;[Ar] 4s2;4;2 23 | 21;Scandium;Sc;44.955912;4;3;solid;hex;Transition Metal;0.75;2.1;1.36;6.5615;2.989;1812.15;3109;15;Nilson;1878;0.568;[Ar] 3d1 4s2;4;3 24 | 22;Titanium;Ti;47.867;4;4;solid;hex;Transition Metal;0.61;2;1.54;6.8281;4.54;1933.15;3560;9;Gregor;1791;0.523;[Ar] 3d2 4s2;4;4 25 | 23;Vanadium;V;50.9415;4;5;solid;bcc;Transition Metal;0.59;1.9;1.63;6.7462;6.11;2175.15;3680;9;del Rio;1801;0.489;[Ar] 3d3 4s2;4;5 26 | 24;Chromium;Cr;51.9961;4;6;solid;bcc;Transition Metal;0.52;1.9;1.66;6.7665;7.15;2130.15;2944;9;Vauquelin;1797;0.449;[Ar] 3d5 4s1;4;6 27 | 25;Manganese;Mn;54.938045;4;7;solid;bcc;Transition Metal;0.46;1.8;1.55;7.434;7.44;1519.15;2334;11;Gahn and Scheele;1774;0.479;[Ar] 3d5 4s2;4;7 28 | 26;Iron;Fe;55.845;4;8;solid;bcc;Transition Metal;0.65;1.7;1.83;7.9024;7.874;1808.15;3134;10;Prehistoric;;0.449;[Ar] 3d6 4s2;4;8 29 | 27;Cobalt;Co;58.933195;4;9;solid;hex;Transition Metal;0.75;1.7;1.88;7.881;8.86;1768.15;3200;14;Brandt;1735;0.421;[Ar] 3d7 4s2;4;9 30 | 28;Nickel;Ni;58.6934;4;10;solid;fcc;Transition Metal;0.69;1.6;1.91;7.6398;8.912;1726.15;3186;11;Cronstedt;1751;0.444;[Ar] 3d8 4s2;4;10 31 | 29;Copper;Cu;63.546;4;11;solid;fcc;Transition Metal;0.73;1.6;1.9;7.7264;8.96;1357.75;2835;11;Prehistoric;;0.385;[Ar] 3d10 4s1;4;11 32 | 30;Zinc;Zn;65.38;4;12;solid;hex;Transition Metal;0.74;1.5;1.65;9.3942;7.134;692.88;1180;15;Prehistoric;;0.388;[Ar] 3d10 4s2;4;12 33 | 31;Gallium;Ga;69.723;4;13;solid;orth;Metal;0.62;1.8;1.81;5.9993;5.907;302.91;2477;14;de Boisbaudran;1875;0.371;[Ar] 3d10 4s2 4p1;4;13 34 | 32;Germanium;Ge;72.64;4;14;solid;fcc;Metalloid;0.53;1.5;2.01;7.8994;5.323;1211.45;3106;17;Winkler;1886;0.32;[Ar] 3d10 4s2 4p2;4;14 35 | 33;Arsenic;As;74.9216;4;15;solid;rho;Metalloid;0.58;1.3;2.18;9.7886;5.776;1090.15;887;14;Albertus Magnus;1250;0.329;[Ar] 3d10 4s2 4p3;4;15 36 | 34;Selenium;Se;78.96;4;16;solid;hex;Nonmetal;0.5;1.2;2.55;9.7524;4.809;494.15;958;20;Berzelius;1817;0.321;[Ar] 3d10 4s2 4p4;4;16 37 | 35;Bromine;Br;79.904;4;17;liq;;Halogen;2;1.1;2.96;11.8138;3.122;266.05;332;19;Balard;1826;0.474;[Ar] 3d10 4s2 4p5;4;17 38 | 36;Krypton;Kr;83.798;4;18;gas;;Noble Gas;;1;;13.9996;0.003733;115.93;119.93;23;Ramsay and Travers;1898;0.248;[Ar] 3d10 4s2 4p6;4;18 39 | 37;Rubidium;Rb;85.4678;5;1;solid;bcc;Alkali Metal;1.5;3;0.82;4.1771;1.532;312.79;961;20;Bunsen and Kirchoff;1861;0.363;[Kr] 5s1;5;1 40 | 38;Strontium;Sr;87.62;5;2;solid;fcc;Alkaline Earth Metal;1.1;2.5;0.95;5.6949;2.64;1042.15;1655;18;Davy;1808;0.301;[Kr] 5s2;5;2 41 | 39;Yttrium;Y;88.90585;5;3;solid;hex;Transition Metal;0.9;2.3;1.22;6.2173;4.469;1799.15;3609;21;Gadolin;1794;0.298;[Kr] 4d1 5s2;5;3 42 | 40;Zirconium;Zr;91.224;5;4;solid;hex;Transition Metal;0.72;2.2;1.33;6.6339;6.506;2125.15;4682;20;Klaproth;1789;0.278;[Kr] 4d2 5s2;5;4 43 | 41;Niobium;Nb;92.90638;5;5;solid;bcc;Transition Metal;0.69;2.1;1.6;6.7589;8.57;2741.15;5017;24;Hatchett;1801;0.265;[Kr] 4d4 5s1;5;5 44 | 42;Molybdenum;Mo;95.96;5;6;solid;bcc;Transition Metal;0.65;2;2.16;7.0924;10.22;2890.15;4912;20;Scheele;1778;0.251;[Kr] 4d5 5s1;5;6 45 | 43;Technetium;Tc;98;5;7;artificial;hex;Transition Metal;0.56;2;1.9;7.28;11.5;2473.15;5150;23;Perrier and SegrŽ;1937;;[Kr] 4d5 5s2;5;7 46 | 44;Ruthenium;Ru;101.07;5;8;solid;hex;Transition Metal;0.68;1.9;2.2;7.3605;12.37;2523.15;4423;16;Klaus;1844;0.238;[Kr] 4d7 5s1;5;8 47 | 45;Rhodium;Rh;102.9055;5;9;solid;fcc;Transition Metal;0.68;1.8;2.28;7.4589;12.41;2239.15;3968;20;Wollaston;1803;0.243;[Kr] 4d8 5s1;5;9 48 | 46;Palladium;Pd;106.42;5;10;solid;fcc;Transition Metal;0.86;1.8;2.2;8.3369;12.02;1825.15;3236;21;Wollaston;1803;0.244;[Kr] 4d10;5;10 49 | 47;Silver;Ag;107.8682;5;11;solid;fcc;Transition Metal;1.3;1.8;1.93;7.5762;10.501;1234.15;2435;27;Prehistoric;;0.235;[Kr] 4d10 5s1;5;11 50 | 48;Cadmium;Cd;112.411;5;12;solid;hex;Transition Metal;0.97;1.7;1.69;8.9938;8.69;594.33;1040;22;Stromeyer;1817;0.232;[Kr] 4d10 5s2;5;12 51 | 49;Indium;In;114.818;5;13;solid;tet;Metal;0.8;2;1.78;5.7864;7.31;429.91;2345;34;Reich and Richter;1863;0.233;[Kr] 4d10 5s2 5p1;5;13 52 | 50;Tin;Sn;118.71;5;14;solid;tet;Metal;0.69;1.7;1.96;7.3439;7.287;505.21;2875;28;Prehistoric;;0.228;[Kr] 4d10 5s2 5p2;5;14 53 | 51;Antimony;Sb;121.76;5;15;solid;rho;Metalloid;0.76;1.5;2.05;8.6084;6.685;904.05;1860;29;Early historic times;;0.207;[Kr] 4d10 5s2 5p3;5;15 54 | 52;Tellurium;Te;127.6;5;16;solid;hex;Metalloid;0.97;1.4;2.1;9.0096;6.232;722.8;1261;29;von Reichenstein;1782;0.202;[Kr] 4d10 5s2 5p4;5;16 55 | 53;Iodine;I;126.90447;5;17;solid;orth;Halogen;2.2;1.3;2.66;10.4513;4.93;386.65;457.4;24;Courtois;1811;0.214;[Kr] 4d10 5s2 5p5;5;17 56 | 54;Xenon;Xe;131.293;5;18;gas;gas;Noble Gas;;1.2;;12.1298;0.005887;161.45;165.03;31;Ramsay and Travers;1898;0.158;[Kr] 4d10 5s2 5p6;5;18 57 | 55;Cesium;Cs;132.9054519;6;1;solid;;Alkali Metal;1.7;3.3;0.79;3.8939;1.873;301.7;944;22;Bunsen and Kirchoff;1860;0.242;[Xe] 6s1;6;1 58 | 56;Barium;Ba;137.327;6;2;solid;bcc;Alkaline Earth Metal;1.4;2.8;0.89;5.2117;3.594;1002.15;2170;25;Davy;1808;0.204;[Xe] 6s2;6;2 59 | 57;Lanthanum;La;138.90547;6;3;solid;hex;Lanthanide;1.1;2.7;1.1;5.5769;6.145;1193.15;3737;19;Mosander;1839;0.195;[Xe] 5d1 6s2;8;3 60 | 58;Cerium;Ce;140.116;6;19;solid;fcc;Lanthanide;1;2.7;1.12;5.5387;6.77;1071.15;3716;19;Berzelius;1803;0.192;[Xe] 4f1 5d1 6s2;8;4 61 | 59;Praseodymium;Pr;140.90765;6;20;solid;hex;Lanthanide;1;2.7;1.13;5.473;6.773;1204.15;3793;15;von Welsbach;1885;0.193;[Xe] 4f3 6s2;8;5 62 | 60;Neodymium;Nd;144.242;6;21;solid;hex;Lanthanide;1;2.6;1.14;5.525;7.007;1289.15;3347;16;von Welsbach;1885;0.19;[Xe] 4f4 6s2;8;6 63 | 61;Promethium;Pm;145;6;22;artificial;hex;Lanthanide;0.98;2.6;1.13;5.582;7.26;1204.15;3273;14;Marinsky et al.;1945;;[Xe] 4f5 6s2;8;7 64 | 62;Samarium;Sm;150.36;6;23;solid;hex;Lanthanide;0.96;2.6;1.17;5.6437;7.52;1345.15;2067;17;Boisbaudran;1879;0.197;[Xe] 4f6 6s2;8;8 65 | 63;Europium;Eu;151.964;6;24;solid;bcc;Lanthanide;0.95;2.6;1.2;5.6704;5.243;1095.15;1802;21;Demarcay;1901;0.182;[Xe] 4f7 6s2;8;9 66 | 64;Gadolinium;Gd;157.25;6;25;solid;hex;Lanthanide;0.94;2.5;1.2;6.1501;7.895;1585.15;3546;17;de Marignac;1880;0.236;[Xe] 4f7 5d1 6s2;8;10 67 | 65;Terbium;Tb;158.92535;6;26;solid;hex;Lanthanide;0.92;2.5;1.2;5.8638;8.229;1630.15;3503;24;Mosander;1843;0.182;[Xe] 4f9 6s2;8;11 68 | 66;Dysprosium;Dy;162.5;6;27;solid;hex;Lanthanide;0.91;2.5;1.22;5.9389;8.55;1680.15;2840;21;de Boisbaudran;1886;0.17;[Xe] 4f10 6s2;8;12 69 | 67;Holmium;Ho;164.93032;6;28;solid;hex;Lanthanide;0.9;2.5;1.23;6.0215;8.795;1743.15;2993;29;Delafontaine and Soret;1878;0.165;[Xe] 4f11 6s2;8;13 70 | 68;Erbium;Er;167.259;6;29;solid;hex;Lanthanide;0.88;2.5;1.24;6.1077;9.066;1795.15;3503;16;Mosander;1843;0.168;[Xe] 4f12 6s2;8;14 71 | 69;Thulium;Tm;168.93421;6;30;solid;hex;Lanthanide;0.87;2.4;1.25;6.1843;9.321;1818.15;2223;18;Cleve;1879;0.16;[Xe] 4f13 6s2;8;15 72 | 70;Ytterbium;Yb;173.054;6;31;solid;fcc;Lanthanide;0.86;2.4;1.1;6.2542;6.965;1097.15;1469;16;Marignac;1878;0.155;[Xe] 4f14 6s2;8;16 73 | 71;Lutetium;Lu;174.9668;6;32;solid;hex;Lanthanide;0.85;2.3;1.27;5.4259;9.84;1936.15;3675;22;Urbain/ von Welsbach;1907;0.154;[Xe] 4f14 5d1 6s2;8;17 74 | 72;Hafnium;Hf;178.49;6;4;solid;hex;Transition Metal;0.71;2.2;1.3;6.8251;13.31;2500.15;4876;17;Coster and von Hevesy;1923;0.144;[Xe] 4f14 5d2 6s2;6;4 75 | 73;Tantalum;Ta;180.94788;6;5;solid;bcc;Transition Metal;0.64;2.1;1.5;7.5496;16.654;3269.15;5731;19;Ekeberg;1801;0.14;[Xe] 4f14 5d3 6s2;6;5 76 | 74;Wolfram;W;183.84;6;6;solid;bcc;Transition Metal;0.62;2;2.36;7.864;19.25;3680.15;5828;22;J. and F. d'Elhuyar;1783;0.132;[Xe] 4f14 5d4 6s2;6;6 77 | 75;Rhenium;Re;186.207;6;7;solid;hex;Transition Metal;0.56;2;1.9;7.8335;21.02;3453.15;5869;21;Noddack/Berg/Tacke;1925;0.137;[Xe] 4f14 5d5 6s2;6;7 78 | 76;Osmium;Os;190.23;6;8;solid;hex;Transition Metal;0.63;1.9;2.2;8.4382;22.61;3300.15;5285;19;Tennant;1803;0.13;[Xe] 4f14 5d6 6s2;6;8 79 | 77;Iridium;Ir;192.217;6;9;solid;fcc;Transition Metal;0.63;1.9;2.2;8.967;22.56;2716.15;4701;25;Tennant;1804;0.131;[Xe] 4f14 5d7 6s2;6;9 80 | 78;Platinum;Pt;195.084;6;10;solid;fcc;Transition Metal;0.63;1.8;2.28;8.9587;21.46;2045.15;4098;32;Ulloa/Wood;1735;0.133;[Xe] 4f14 5d9 6s1;6;10 81 | 79;Gold;Au;196.966569;6;11;solid;fcc;Transition Metal;0.85;1.8;2.54;9.2255;19.282;1337.73;3129;21;Prehistoric;;0.129;[Xe] 4f14 5d10 6s1;6;11 82 | 80;Mercury;Hg;200.59;6;12;liq;;Transition Metal;1;1.8;2;10.4375;13.5336;234.43;630;26;Prehistoric;;0.14;[Xe] 4f14 5d10 6s2;6;12 83 | 81;Thallium;Tl;204.3833;6;13;solid;hex;Metal;1.5;2.1;2.04;6.1082;11.85;577.15;1746;28;Crookes;1861;0.129;[Xe] 4f14 5d10 6s2 6p1;6;13 84 | 82;Lead;Pb;207.2;6;14;solid;fcc;Metal;1.2;1.8;2.33;7.4167;11.342;600.75;2022;29;Prehistoric;;0.129;[Xe] 4f14 5d10 6s2 6p2;6;14 85 | 83;Bismuth;Bi;208.9804;6;15;solid;rho;Metal;1;1.6;2.02;7.2856;9.807;544.67;1837;19;Geoffroy the Younger;1753;0.122;[Xe] 4f14 5d10 6s2 6p3;6;15 86 | 84;Polonium;Po;210;6;16;solid;cub;Metalloid;2.3;1.5;2;8.417;9.32;527.15;1235;34;Curie;1898;;[Xe] 4f14 5d10 6s2 6p4;6;16 87 | 85;Astatine;At;210;6;17;solid;;Noble Gas;;1.4;2.2;9.3;7;575.15;610;21;Corson et al.;1940;;[Xe] 4f14 5d10 6s2 6p5;6;17 88 | 86;Radon;Rn;222;6;18;gas;;Alkali Metal;;1.3;;10.7485;0.00973;202.15;211.3;20;Dorn;1900;0.094;[Xe] 4f14 5d10 6s2 6p6;6;18 89 | 87;Francium;Fr;223;7;1;solid;bcc;Alkaline Earth Metal;1.8;;0.7;4.0727;1.87;300.15;950;21;Perey;1939;;[Rn] 7s1;7;1 90 | 88;Radium;Ra;226;7;2;solid;bcc;Actinide;1.4;;0.9;5.2784;5.5;973.15;2010;15;Pierre and Marie Curie;1898;;[Rn] 7s2;7;2 91 | 89;Actinium;Ac;227;7;3;solid;fcc;Actinide;1.1;;1.1;5.17;10.07;1323.15;3471;11;Debierne/Giesel;1899;0.12;[Rn] 6d1 7s2;9;3 92 | 90;Thorium;Th;232.03806;7;19;solid;fcc;Actinide;0.97;;1.3;6.3067;11.72;2028.15;5061;12;Berzelius;1828;0.113;[Rn] 6d2 7s2;9;4 93 | 91;Protactinium;Pa;231.03588;7;20;solid;orth;Actinide;0.78;;1.5;5.89;15.37;1873.15;4300;14;Hahn and Meitner;1917;;[Rn] 5f2 6d1 7s2;9;5 94 | 92;Uranium;U;238.02891;7;21;solid;orth;Actinide;0.52;;1.38;6.1941;18.95;1405.15;4404;15;Peligot;1841;0.116;[Rn] 5f3 6d1 7s2;9;6 95 | 93;Neptunium;Np;237;7;22;artificial;orth;Actinide;0.75;;1.36;6.2657;20.45;913.15;4273;153;McMillan and Abelson;1940;;[Rn] 5f4 6d1 7s2;9;7 96 | 94;Plutonium;Pu;244;7;23;artificial;mno;Actinide;0.89;;1.28;6.0262;19.84;913.15;3501;163;Seaborg et al.;1940;;[Rn] 5f6 7s2;9;8 97 | 95;Americium;Am;243;7;24;artificial;hex;Actinide;0.98;;1.3;5.9738;13.69;1267.15;2880;133;Seaborg et al.;1944;;[Rn] 5f7 7s2;9;9 98 | 96;Curium;Cm;247;7;25;artificial;hex;Actinide;0.97;;1.3;5.9915;13.51;1340.15;3383;133;Seaborg et al.;1944;;;9;10 99 | 97;Berkelium;Bk;247;7;26;artificial;hex;Actinide;0.95;;1.3;6.1979;14.79;1259.15;983;83;Seaborg et al.;1949;;;9;11 100 | 98;Californium;Cf;251;7;27;artificial;hex;Actinide;0.93;;1.3;6.2817;15.1;1925.15;1173;123;Seaborg et al.;1950;;;9;12 101 | 99;Einsteinium;Es;252;7;28;artificial;hex;Actinide;;;1.3;6.42;13.5;1133.15;;123;Ghiorso et al.;1952;;;9;13 102 | 100;Fermium;Fm;257;7;29;artificial;;Actinide;;;1.3;6.5;;;;103;Ghiorso et al.;1953;;;9;14 103 | 101;Mendelevium;Md;258;7;30;artificial;;Actinide;;;1.3;6.58;;;;33;Ghiorso et al.;1955;;;9;15 104 | 102;Nobelium;No;259;7;31;artificial;;Actinide;;;1.3;6.65;;;;73;Ghiorso et al.;1958;;;9;16 105 | 103;Lawrencium;Lr;262;7;32;artificial;;Actinide;;;;;;;;203;Ghiorso et al.;1961;;;9;17 106 | 104;Rutherfordium;Rf;261;7;4;artificial;;Transactinide;;;;;18.1;;;;Ghiorso et al.;1969;;;7;4 107 | 105;Dubnium;Db;262;7;5;artificial;;Transactinide;;;;;39;;;;Ghiorso et al.;1970;;;7;5 108 | 106;Seaborgium;Sg;266;7;6;artificial;;Transactinide;;;;;35;;;;Ghiorso et al.;1974;;;7;6 109 | 107;Bohrium;Bh;264;7;7;artificial;;Transactinide;;;;;37;;;;Armbruster and Münzenberg;1981;;;7;7 110 | 108;Hassium;Hs;267;7;8;artificial;;Transactinide;;;;;41;;;;Armbruster and Münzenberg;1983;;;7;8 111 | 109;Meitnerium;Mt;268;7;9;artificial;;Transactinide;;;;;35;;;;GSI (Darmstadt - West Germany);1982;;;7;9 112 | 110;Darmstadtium ;Ds ;271;7;10;artificial;;Transactinide;;;;;;;;;;;;;7;10 113 | 111;Roentgenium ;Rg ;272;7;11;artificial;;Transactinide;;;;;;;;;;;;;7;11 114 | 112;Copernicium ;Cn ;285;7;12;artificial;;Transactinide;;;;;;;;;;;;;7;12 115 | 113;Ununtrium ;Uut ;284;7;13;artificial;;;;;;;;;;;;;;;7;13 116 | 114;Ununquadium ;Uuq ;289;7;14;artificial;;Transactinide;;;;;;;;;;;;;7;14 117 | 115;Ununpentium ;Uup ;288;7;15;artificial;;;;;;;;;;;;;;;7;15 118 | 116;Ununhexium ;Uuh ;292;7;16;artificial;;Transactinide;;;;;;;;;;;;;7;16 119 | 117;Ununseptium ;Uus ;295;7;17;artificial;;;;;;;;;;;;;;;7;17 120 | 118;Ununoctium ;Uuo ;294;7;18;artificial;;Noble Gas;;;;;;;;;;;;;7;18 121 | -------------------------------------------------------------------------------- /data/Periodic Table of Elements.csv: -------------------------------------------------------------------------------- 1 | Atomic Number,Element,Symbol,Atomic Weight,Period,Group,Phase,Most Stable Crystal,Type,Ionic Radius,Atomic Radius,Electronegativity,First Ionization Potential,Density,Melting Point (K),Boiling Point (K),Isotopes,Discoverer,Year of Discovery,Specific Heat Capacity,Electron Configuration,Display Row,Display Column 2 | 1,Hydrogen,H,1.00794,1,1,gas,,Nonmetal,0.012,0.79,2.2,13.5984,0.00008988,14.175,20.28,3,Cavendish,1766,14.304,1s1,1,1 3 | 2,Helium,He,4.002602,1,18,gas,,Noble Gas,,0.49,,24.5874,0.0001785,,4.22,5,Janssen,1868,5.193,1s2,1,18 4 | 3,Lithium,Li,6.941,2,1,solid,bcc,Alkali Metal,0.76,2.1,0.98,5.3917,0.534,453.85,1615,5,Arfvedson,1817,3.582,[He] 2s1,2,1 5 | 4,Beryllium,Be,9.012182,2,2,solid,hex,Alkaline Earth Metal,0.35,1.4,1.57,9.3227,1.85,1560.15,2742,6,Vaulquelin,1798,1.825,[He] 2s2,2,2 6 | 5,Boron,B,10.811,2,13,solid,rho,Metalloid,0.23,1.2,2.04,8.298,2.34,2573.15,4200,6,Gay-Lussac,1808,1.026,[He] 2s2 2p1,2,13 7 | 6,Carbon,C,12.0107,2,14,solid,hex,Nonmetal,,0.91,2.55,11.2603,2.267,3948.15,4300,7,Prehistoric,,0.709,[He] 2s2 2p2,2,14 8 | 7,Nitrogen,N,14.0067,2,15,gas,,Nonmetal,0.13,0.75,3.04,14.5341,0.0012506,63.29,77.36,8,Rutherford,1772,1.04,[He] 2s2 2p3,2,15 9 | 8,Oxygen,O,15.9994,2,16,gas,,Nonmetal,1.4,0.65,3.44,13.6181,0.001429,50.5,90.2,8,Priestley/Scheele,1774,0.918,[He] 2s2 2p4,2,16 10 | 9,Fluorine,F,18.9984032,2,17,gas,,Halogen,1.3,0.57,3.98,17.4228,0.001696,53.63,85.03,6,Moissan,1886,0.824,[He] 2s2 2p5,2,17 11 | 10,Neon,Ne,20.1797,2,18,gas,,Noble Gas,,0.51,,21.5645,0.0008999,24.703,27.07,8,Ramsay and Travers,1898,1.03,[He] 2s2 2p6,2,18 12 | 11,Sodium,Na,22.98976928,3,1,solid,bcc,Alkali Metal,1,2.2,0.93,5.1391,0.971,371.15,1156,7,Davy,1807,1.228,[Ne] 3s1,3,1 13 | 12,Magnesium,Mg,24.305,3,2,solid,hex,Alkaline Earth Metal,0.72,1.7,1.31,7.6462,1.738,923.15,1363,8,Black,1755,1.023,[Ne] 3s2,3,2 14 | 13,Aluminum,Al,26.9815386,3,13,solid,fcc,Metal,0.54,1.8,1.61,5.9858,2.698,933.4,2792,8,Wöhler,1827,0.897,[Ne] 3s2 3p1,3,13 15 | 14,Silicon,Si,28.0855,3,14,solid,fcc,Metalloid,0.4,1.5,1.9,8.1517,2.3296,1683.15,3538,8,Berzelius,1824,0.705,[Ne] 3s2 3p2,3,14 16 | 15,Phosphorus,P,30.973762,3,15,solid,cub,Nonmetal,0.38,1.2,2.19,10.4867,1.82,317.25,553,7,BranBrand,1669,0.769,[Ne] 3s2 3p3,3,15 17 | 16,Sulfur,S,32.065,3,16,solid,orth,Nonmetal,0.37,1.1,2.58,10.36,2.067,388.51,717.8,10,Prehistoric,,0.71,[Ne] 3s2 3p4,3,16 18 | 17,Chlorine,Cl,35.453,3,17,gas,,Halogen,1.8,0.97,3.16,12.9676,0.003214,172.31,239.11,11,Scheele,1774,0.479,[Ne] 3s2 3p5,3,17 19 | 18,Argon,Ar,39.948,3,18,gas,,Noble Gas,,0.88,,15.7596,0.0017837,83.96,87.3,8,Rayleigh and Ramsay,1894,0.52,[Ne] 3s2 3p6,3,18 20 | 19,Potassium,K,39.0983,4,1,solid,bcc,Alkali Metal,1.4,2.8,0.82,4.3407,0.862,336.5,1032,10,Davy,1807,0.757,[Ar] 4s1,4,1 21 | 20,Calcium,Ca,40.078,4,2,solid,fcc,Alkaline Earth Metal,0.99,2.2,1,6.1132,1.54,1112.15,1757,14,Davy,1808,0.647,[Ar] 4s2,4,2 22 | 21,Scandium,Sc,44.955912,4,3,solid,hex,Transition Metal,0.75,2.1,1.36,6.5615,2.989,1812.15,3109,15,Nilson,1878,0.568,[Ar] 3d1 4s2,4,3 23 | 22,Titanium,Ti,47.867,4,4,solid,hex,Transition Metal,0.61,2,1.54,6.8281,4.54,1933.15,3560,9,Gregor,1791,0.523,[Ar] 3d2 4s2,4,4 24 | 23,Vanadium,V,50.9415,4,5,solid,bcc,Transition Metal,0.59,1.9,1.63,6.7462,6.11,2175.15,3680,9,del Rio,1801,0.489,[Ar] 3d3 4s2,4,5 25 | 24,Chromium,Cr,51.9961,4,6,solid,bcc,Transition Metal,0.52,1.9,1.66,6.7665,7.15,2130.15,2944,9,Vauquelin,1797,0.449,[Ar] 3d5 4s1,4,6 26 | 25,Manganese,Mn,54.938045,4,7,solid,bcc,Transition Metal,0.46,1.8,1.55,7.434,7.44,1519.15,2334,11,Gahn and Scheele,1774,0.479,[Ar] 3d5 4s2,4,7 27 | 26,Iron,Fe,55.845,4,8,solid,bcc,Transition Metal,0.65,1.7,1.83,7.9024,7.874,1808.15,3134,10,Prehistoric,,0.449,[Ar] 3d6 4s2,4,8 28 | 27,Cobalt,Co,58.933195,4,9,solid,hex,Transition Metal,0.75,1.7,1.88,7.881,8.86,1768.15,3200,14,Brandt,1735,0.421,[Ar] 3d7 4s2,4,9 29 | 28,Nickel,Ni,58.6934,4,10,solid,fcc,Transition Metal,0.69,1.6,1.91,7.6398,8.912,1726.15,3186,11,Cronstedt,1751,0.444,[Ar] 3d8 4s2,4,10 30 | 29,Copper,Cu,63.546,4,11,solid,fcc,Transition Metal,0.73,1.6,1.9,7.7264,8.96,1357.75,2835,11,Prehistoric,,0.385,[Ar] 3d10 4s1,4,11 31 | 30,Zinc,Zn,65.38,4,12,solid,hex,Transition Metal,0.74,1.5,1.65,9.3942,7.134,692.88,1180,15,Prehistoric,,0.388,[Ar] 3d10 4s2,4,12 32 | 31,Gallium,Ga,69.723,4,13,solid,orth,Metal,0.62,1.8,1.81,5.9993,5.907,302.91,2477,14,de Boisbaudran,1875,0.371,[Ar] 3d10 4s2 4p1,4,13 33 | 32,Germanium,Ge,72.64,4,14,solid,fcc,Metalloid,0.53,1.5,2.01,7.8994,5.323,1211.45,3106,17,Winkler,1886,0.32,[Ar] 3d10 4s2 4p2,4,14 34 | 33,Arsenic,As,74.9216,4,15,solid,rho,Metalloid,0.58,1.3,2.18,9.7886,5.776,1090.15,887,14,Albertus Magnus,1250,0.329,[Ar] 3d10 4s2 4p3,4,15 35 | 34,Selenium,Se,78.96,4,16,solid,hex,Nonmetal,0.5,1.2,2.55,9.7524,4.809,494.15,958,20,Berzelius,1817,0.321,[Ar] 3d10 4s2 4p4,4,16 36 | 35,Bromine,Br,79.904,4,17,liq,,Halogen,2,1.1,2.96,11.8138,3.122,266.05,332,19,Balard,1826,0.474,[Ar] 3d10 4s2 4p5,4,17 37 | 36,Krypton,Kr,83.798,4,18,gas,,Noble Gas,,1,,13.9996,0.003733,115.93,119.93,23,Ramsay and Travers,1898,0.248,[Ar] 3d10 4s2 4p6,4,18 38 | 37,Rubidium,Rb,85.4678,5,1,solid,bcc,Alkali Metal,1.5,3,0.82,4.1771,1.532,312.79,961,20,Bunsen and Kirchoff,1861,0.363,[Kr] 5s1,5,1 39 | 38,Strontium,Sr,87.62,5,2,solid,fcc,Alkaline Earth Metal,1.1,2.5,0.95,5.6949,2.64,1042.15,1655,18,Davy,1808,0.301,[Kr] 5s2,5,2 40 | 39,Yttrium,Y,88.90585,5,3,solid,hex,Transition Metal,0.9,2.3,1.22,6.2173,4.469,1799.15,3609,21,Gadolin,1794,0.298,[Kr] 4d1 5s2,5,3 41 | 40,Zirconium,Zr,91.224,5,4,solid,hex,Transition Metal,0.72,2.2,1.33,6.6339,6.506,2125.15,4682,20,Klaproth,1789,0.278,[Kr] 4d2 5s2,5,4 42 | 41,Niobium,Nb,92.90638,5,5,solid,bcc,Transition Metal,0.69,2.1,1.6,6.7589,8.57,2741.15,5017,24,Hatchett,1801,0.265,[Kr] 4d4 5s1,5,5 43 | 42,Molybdenum,Mo,95.96,5,6,solid,bcc,Transition Metal,0.65,2,2.16,7.0924,10.22,2890.15,4912,20,Scheele,1778,0.251,[Kr] 4d5 5s1,5,6 44 | 43,Technetium,Tc,98,5,7,artificial,hex,Transition Metal,0.56,2,1.9,7.28,11.5,2473.15,5150,23,Perrier and SegrŽ,1937,,[Kr] 4d5 5s2,5,7 45 | 44,Ruthenium,Ru,101.07,5,8,solid,hex,Transition Metal,0.68,1.9,2.2,7.3605,12.37,2523.15,4423,16,Klaus,1844,0.238,[Kr] 4d7 5s1,5,8 46 | 45,Rhodium,Rh,102.9055,5,9,solid,fcc,Transition Metal,0.68,1.8,2.28,7.4589,12.41,2239.15,3968,20,Wollaston,1803,0.243,[Kr] 4d8 5s1,5,9 47 | 46,Palladium,Pd,106.42,5,10,solid,fcc,Transition Metal,0.86,1.8,2.2,8.3369,12.02,1825.15,3236,21,Wollaston,1803,0.244,[Kr] 4d10,5,10 48 | 47,Silver,Ag,107.8682,5,11,solid,fcc,Transition Metal,1.3,1.8,1.93,7.5762,10.501,1234.15,2435,27,Prehistoric,,0.235,[Kr] 4d10 5s1,5,11 49 | 48,Cadmium,Cd,112.411,5,12,solid,hex,Transition Metal,0.97,1.7,1.69,8.9938,8.69,594.33,1040,22,Stromeyer,1817,0.232,[Kr] 4d10 5s2,5,12 50 | 49,Indium,In,114.818,5,13,solid,tet,Metal,0.8,2,1.78,5.7864,7.31,429.91,2345,34,Reich and Richter,1863,0.233,[Kr] 4d10 5s2 5p1,5,13 51 | 50,Tin,Sn,118.71,5,14,solid,tet,Metal,0.69,1.7,1.96,7.3439,7.287,505.21,2875,28,Prehistoric,,0.228,[Kr] 4d10 5s2 5p2,5,14 52 | 51,Antimony,Sb,121.76,5,15,solid,rho,Metalloid,0.76,1.5,2.05,8.6084,6.685,904.05,1860,29,Early historic times,,0.207,[Kr] 4d10 5s2 5p3,5,15 53 | 52,Tellurium,Te,127.6,5,16,solid,hex,Metalloid,0.97,1.4,2.1,9.0096,6.232,722.8,1261,29,von Reichenstein,1782,0.202,[Kr] 4d10 5s2 5p4,5,16 54 | 53,Iodine,I,126.90447,5,17,solid,orth,Halogen,2.2,1.3,2.66,10.4513,4.93,386.65,457.4,24,Courtois,1811,0.214,[Kr] 4d10 5s2 5p5,5,17 55 | 54,Xenon,Xe,131.293,5,18,gas,gas,Noble Gas,,1.2,,12.1298,0.005887,161.45,165.03,31,Ramsay and Travers,1898,0.158,[Kr] 4d10 5s2 5p6,5,18 56 | 55,Cesium,Cs,132.9054519,6,1,solid,,Alkali Metal,1.7,3.3,0.79,3.8939,1.873,301.7,944,22,Bunsen and Kirchoff,1860,0.242,[Xe] 6s1,6,1 57 | 56,Barium,Ba,137.327,6,2,solid,bcc,Alkaline Earth Metal,1.4,2.8,0.89,5.2117,3.594,1002.15,2170,25,Davy,1808,0.204,[Xe] 6s2,6,2 58 | 57,Lanthanum,La,138.90547,6,3,solid,hex,Lanthanide,1.1,2.7,1.1,5.5769,6.145,1193.15,3737,19,Mosander,1839,0.195,[Xe] 5d1 6s2,8,3 59 | 58,Cerium,Ce,140.116,6,19,solid,fcc,Lanthanide,1,2.7,1.12,5.5387,6.77,1071.15,3716,19,Berzelius,1803,0.192,[Xe] 4f1 5d1 6s2,8,4 60 | 59,Praseodymium,Pr,140.90765,6,20,solid,hex,Lanthanide,1,2.7,1.13,5.473,6.773,1204.15,3793,15,von Welsbach,1885,0.193,[Xe] 4f3 6s2,8,5 61 | 60,Neodymium,Nd,144.242,6,21,solid,hex,Lanthanide,1,2.6,1.14,5.525,7.007,1289.15,3347,16,von Welsbach,1885,0.19,[Xe] 4f4 6s2,8,6 62 | 61,Promethium,Pm,145,6,22,artificial,hex,Lanthanide,0.98,2.6,1.13,5.582,7.26,1204.15,3273,14,Marinsky et al.,1945,,[Xe] 4f5 6s2,8,7 63 | 62,Samarium,Sm,150.36,6,23,solid,hex,Lanthanide,0.96,2.6,1.17,5.6437,7.52,1345.15,2067,17,Boisbaudran,1879,0.197,[Xe] 4f6 6s2,8,8 64 | 63,Europium,Eu,151.964,6,24,solid,bcc,Lanthanide,0.95,2.6,1.2,5.6704,5.243,1095.15,1802,21,Demarcay,1901,0.182,[Xe] 4f7 6s2,8,9 65 | 64,Gadolinium,Gd,157.25,6,25,solid,hex,Lanthanide,0.94,2.5,1.2,6.1501,7.895,1585.15,3546,17,de Marignac,1880,0.236,[Xe] 4f7 5d1 6s2,8,10 66 | 65,Terbium,Tb,158.92535,6,26,solid,hex,Lanthanide,0.92,2.5,1.2,5.8638,8.229,1630.15,3503,24,Mosander,1843,0.182,[Xe] 4f9 6s2,8,11 67 | 66,Dysprosium,Dy,162.5,6,27,solid,hex,Lanthanide,0.91,2.5,1.22,5.9389,8.55,1680.15,2840,21,de Boisbaudran,1886,0.17,[Xe] 4f10 6s2,8,12 68 | 67,Holmium,Ho,164.93032,6,28,solid,hex,Lanthanide,0.9,2.5,1.23,6.0215,8.795,1743.15,2993,29,Delafontaine and Soret,1878,0.165,[Xe] 4f11 6s2,8,13 69 | 68,Erbium,Er,167.259,6,29,solid,hex,Lanthanide,0.88,2.5,1.24,6.1077,9.066,1795.15,3503,16,Mosander,1843,0.168,[Xe] 4f12 6s2,8,14 70 | 69,Thulium,Tm,168.93421,6,30,solid,hex,Lanthanide,0.87,2.4,1.25,6.1843,9.321,1818.15,2223,18,Cleve,1879,0.16,[Xe] 4f13 6s2,8,15 71 | 70,Ytterbium,Yb,173.054,6,31,solid,fcc,Lanthanide,0.86,2.4,1.1,6.2542,6.965,1097.15,1469,16,Marignac,1878,0.155,[Xe] 4f14 6s2,8,16 72 | 71,Lutetium,Lu,174.9668,6,32,solid,hex,Lanthanide,0.85,2.3,1.27,5.4259,9.84,1936.15,3675,22,Urbain/ von Welsbach,1907,0.154,[Xe] 4f14 5d1 6s2,8,17 73 | 72,Hafnium,Hf,178.49,6,4,solid,hex,Transition Metal,0.71,2.2,1.3,6.8251,13.31,2500.15,4876,17,Coster and von Hevesy,1923,0.144,[Xe] 4f14 5d2 6s2,6,4 74 | 73,Tantalum,Ta,180.94788,6,5,solid,bcc,Transition Metal,0.64,2.1,1.5,7.5496,16.654,3269.15,5731,19,Ekeberg,1801,0.14,[Xe] 4f14 5d3 6s2,6,5 75 | 74,Wolfram,W,183.84,6,6,solid,bcc,Transition Metal,0.62,2,2.36,7.864,19.25,3680.15,5828,22,J. and F. d'Elhuyar,1783,0.132,[Xe] 4f14 5d4 6s2,6,6 76 | 75,Rhenium,Re,186.207,6,7,solid,hex,Transition Metal,0.56,2,1.9,7.8335,21.02,3453.15,5869,21,Noddack/Berg/Tacke,1925,0.137,[Xe] 4f14 5d5 6s2,6,7 77 | 76,Osmium,Os,190.23,6,8,solid,hex,Transition Metal,0.63,1.9,2.2,8.4382,22.61,3300.15,5285,19,Tennant,1803,0.13,[Xe] 4f14 5d6 6s2,6,8 78 | 77,Iridium,Ir,192.217,6,9,solid,fcc,Transition Metal,0.63,1.9,2.2,8.967,22.56,2716.15,4701,25,Tennant,1804,0.131,[Xe] 4f14 5d7 6s2,6,9 79 | 78,Platinum,Pt,195.084,6,10,solid,fcc,Transition Metal,0.63,1.8,2.28,8.9587,21.46,2045.15,4098,32,Ulloa/Wood,1735,0.133,[Xe] 4f14 5d9 6s1,6,10 80 | 79,Gold,Au,196.966569,6,11,solid,fcc,Transition Metal,0.85,1.8,2.54,9.2255,19.282,1337.73,3129,21,Prehistoric,,0.129,[Xe] 4f14 5d10 6s1,6,11 81 | 80,Mercury,Hg,200.59,6,12,liq,,Transition Metal,1,1.8,2,10.4375,13.5336,234.43,630,26,Prehistoric,,0.14,[Xe] 4f14 5d10 6s2,6,12 82 | 81,Thallium,Tl,204.3833,6,13,solid,hex,Metal,1.5,2.1,2.04,6.1082,11.85,577.15,1746,28,Crookes,1861,0.129,[Xe] 4f14 5d10 6s2 6p1,6,13 83 | 82,Lead,Pb,207.2,6,14,solid,fcc,Metal,1.2,1.8,2.33,7.4167,11.342,600.75,2022,29,Prehistoric,,0.129,[Xe] 4f14 5d10 6s2 6p2,6,14 84 | 83,Bismuth,Bi,208.9804,6,15,solid,rho,Metal,1,1.6,2.02,7.2856,9.807,544.67,1837,19,Geoffroy the Younger,1753,0.122,[Xe] 4f14 5d10 6s2 6p3,6,15 85 | 84,Polonium,Po,210,6,16,solid,cub,Metalloid,2.3,1.5,2,8.417,9.32,527.15,1235,34,Curie,1898,,[Xe] 4f14 5d10 6s2 6p4,6,16 86 | 85,Astatine,At,210,6,17,solid,,Noble Gas,,1.4,2.2,9.3,7,575.15,610,21,Corson et al.,1940,,[Xe] 4f14 5d10 6s2 6p5,6,17 87 | 86,Radon,Rn,222,6,18,gas,,Alkali Metal,,1.3,,10.7485,0.00973,202.15,211.3,20,Dorn,1900,0.094,[Xe] 4f14 5d10 6s2 6p6,6,18 88 | 87,Francium,Fr,223,7,1,solid,bcc,Alkaline Earth Metal,1.8,,0.7,4.0727,1.87,300.15,950,21,Perey,1939,,[Rn] 7s1,7,1 89 | 88,Radium,Ra,226,7,2,solid,bcc,Actinide,1.4,,0.9,5.2784,5.5,973.15,2010,15,Pierre and Marie Curie,1898,,[Rn] 7s2,7,2 90 | 89,Actinium,Ac,227,7,3,solid,fcc,Actinide,1.1,,1.1,5.17,10.07,1323.15,3471,11,Debierne/Giesel,1899,0.12,[Rn] 6d1 7s2,9,3 91 | 90,Thorium,Th,232.03806,7,19,solid,fcc,Actinide,0.97,,1.3,6.3067,11.72,2028.15,5061,12,Berzelius,1828,0.113,[Rn] 6d2 7s2,9,4 92 | 91,Protactinium,Pa,231.03588,7,20,solid,orth,Actinide,0.78,,1.5,5.89,15.37,1873.15,4300,14,Hahn and Meitner,1917,,[Rn] 5f2 6d1 7s2,9,5 93 | 92,Uranium,U,238.02891,7,21,solid,orth,Actinide,0.52,,1.38,6.1941,18.95,1405.15,4404,15,Peligot,1841,0.116,[Rn] 5f3 6d1 7s2,9,6 94 | 93,Neptunium,Np,237,7,22,artificial,orth,Actinide,0.75,,1.36,6.2657,20.45,913.15,4273,153,McMillan and Abelson,1940,,[Rn] 5f4 6d1 7s2,9,7 95 | 94,Plutonium,Pu,244,7,23,artificial,mno,Actinide,0.89,,1.28,6.0262,19.84,913.15,3501,163,Seaborg et al.,1940,,[Rn] 5f6 7s2,9,8 96 | 95,Americium,Am,243,7,24,artificial,hex,Actinide,0.98,,1.3,5.9738,13.69,1267.15,2880,133,Seaborg et al.,1944,,[Rn] 5f7 7s2,9,9 97 | 96,Curium,Cm,247,7,25,artificial,hex,Actinide,0.97,,1.3,5.9915,13.51,1340.15,3383,133,Seaborg et al.,1944,,,9,10 98 | 97,Berkelium,Bk,247,7,26,artificial,hex,Actinide,0.95,,1.3,6.1979,14.79,1259.15,983,83,Seaborg et al.,1949,,,9,11 99 | 98,Californium,Cf,251,7,27,artificial,hex,Actinide,0.93,,1.3,6.2817,15.1,1925.15,1173,123,Seaborg et al.,1950,,,9,12 100 | 99,Einsteinium,Es,252,7,28,artificial,hex,Actinide,,,1.3,6.42,13.5,1133.15,,123,Ghiorso et al.,1952,,,9,13 101 | 100,Fermium,Fm,257,7,29,artificial,,Actinide,,,1.3,6.5,,,,103,Ghiorso et al.,1953,,,9,14 102 | 101,Mendelevium,Md,258,7,30,artificial,,Actinide,,,1.3,6.58,,,,33,Ghiorso et al.,1955,,,9,15 103 | 102,Nobelium,No,259,7,31,artificial,,Actinide,,,1.3,6.65,,,,73,Ghiorso et al.,1958,,,9,16 104 | 103,Lawrencium,Lr,262,7,32,artificial,,Actinide,,,,,,,,203,Ghiorso et al.,1961,,,9,17 105 | 104,Rutherfordium,Rf,261,7,4,artificial,,Transactinide,,,,,18.1,,,,Ghiorso et al.,1969,,,7,4 106 | 105,Dubnium,Db,262,7,5,artificial,,Transactinide,,,,,39,,,,Ghiorso et al.,1970,,,7,5 107 | 106,Seaborgium,Sg,266,7,6,artificial,,Transactinide,,,,,35,,,,Ghiorso et al.,1974,,,7,6 108 | 107,Bohrium,Bh,264,7,7,artificial,,Transactinide,,,,,37,,,,Armbruster and Münzenberg,1981,,,7,7 109 | 108,Hassium,Hs,267,7,8,artificial,,Transactinide,,,,,41,,,,Armbruster and Münzenberg,1983,,,7,8 110 | 109,Meitnerium,Mt,268,7,9,artificial,,Transactinide,,,,,35,,,,GSI (Darmstadt - West Germany),1982,,,7,9 111 | 110,Darmstadtium ,Ds ,271,7,10,artificial,,Transactinide,,,,,,,,,,,,,7,10 112 | 111,Roentgenium ,Rg ,272,7,11,artificial,,Transactinide,,,,,,,,,,,,,7,11 113 | 112,Copernicium ,Cn ,285,7,12,artificial,,Transactinide,,,,,,,,,,,,,7,12 114 | 113,Ununtrium ,Uut ,284,7,13,artificial,,,,,,,,,,,,,,,7,13 115 | 114,Ununquadium ,Uuq ,289,7,14,artificial,,Transactinide,,,,,,,,,,,,,7,14 116 | 115,Ununpentium ,Uup ,288,7,15,artificial,,,,,,,,,,,,,,,7,15 117 | 116,Ununhexium ,Uuh ,292,7,16,artificial,,Transactinide,,,,,,,,,,,,,7,16 118 | 117,Ununseptium ,Uus ,295,7,17,artificial,,,,,,,,,,,,,,,7,17 119 | 118,Ununoctium ,Uuo ,294,7,18,artificial,,Noble Gas,,,,,,,,,,,,,7,18 120 | -------------------------------------------------------------------------------- /data/Periodic Table of Elements.tsv: -------------------------------------------------------------------------------- 1 | Atomic Number Element Symbol Atomic Weight Period Group Phase Most Stable Crystal Type Ionic Radius Atomic Radius Electronegativity First Ionization Potential Density Melting Point (K) Boiling Point (K) Isotopes Discoverer Year of Discovery Specific Heat Capacity Electron Configuration Display Row Display Column 2 | 1 Hydrogen H 1.00794 1 1 gas Nonmetal 0.012 0.79 2.2 13.5984 0.00008988 14.175 20.28 3 Cavendish 1766 14.304 1s1 1 1 3 | 2 Helium He 4.002602 1 18 gas Noble Gas 0.49 24.5874 0.0001785 4.22 5 Janssen 1868 5.193 1s2 1 18 4 | 3 Lithium Li 6.941 2 1 solid bcc Alkali Metal 0.76 2.1 0.98 5.3917 0.534 453.85 1615 5 Arfvedson 1817 3.582 [He] 2s1 2 1 5 | 4 Beryllium Be 9.012182 2 2 solid hex Alkaline Earth Metal 0.35 1.4 1.57 9.3227 1.85 1560.15 2742 6 Vaulquelin 1798 1.825 [He] 2s2 2 2 6 | 5 Boron B 10.811 2 13 solid rho Metalloid 0.23 1.2 2.04 8.298 2.34 2573.15 4200 6 Gay-Lussac 1808 1.026 [He] 2s2 2p1 2 13 7 | 6 Carbon C 12.0107 2 14 solid hex Nonmetal 0.91 2.55 11.2603 2.267 3948.15 4300 7 Prehistoric 0.709 [He] 2s2 2p2 2 14 8 | 7 Nitrogen N 14.0067 2 15 gas Nonmetal 0.13 0.75 3.04 14.5341 0.0012506 63.29 77.36 8 Rutherford 1772 1.04 [He] 2s2 2p3 2 15 9 | 8 Oxygen O 15.9994 2 16 gas Nonmetal 1.4 0.65 3.44 13.6181 0.001429 50.5 90.2 8 Priestley/Scheele 1774 0.918 [He] 2s2 2p4 2 16 10 | 9 Fluorine F 18.9984032 2 17 gas Halogen 1.3 0.57 3.98 17.4228 0.001696 53.63 85.03 6 Moissan 1886 0.824 [He] 2s2 2p5 2 17 11 | 10 Neon Ne 20.1797 2 18 gas Noble Gas 0.51 21.5645 0.0008999 24.703 27.07 8 Ramsay and Travers 1898 1.03 [He] 2s2 2p6 2 18 12 | 11 Sodium Na 22.98976928 3 1 solid bcc Alkali Metal 1 2.2 0.93 5.1391 0.971 371.15 1156 7 Davy 1807 1.228 [Ne] 3s1 3 1 13 | 12 Magnesium Mg 24.305 3 2 solid hex Alkaline Earth Metal 0.72 1.7 1.31 7.6462 1.738 923.15 1363 8 Black 1755 1.023 [Ne] 3s2 3 2 14 | 13 Aluminum Al 26.9815386 3 13 solid fcc Metal 0.54 1.8 1.61 5.9858 2.698 933.4 2792 8 Wöhler 1827 0.897 [Ne] 3s2 3p1 3 13 15 | 14 Silicon Si 28.0855 3 14 solid fcc Metalloid 0.4 1.5 1.9 8.1517 2.3296 1683.15 3538 8 Berzelius 1824 0.705 [Ne] 3s2 3p2 3 14 16 | 15 Phosphorus P 30.973762 3 15 solid cub Nonmetal 0.38 1.2 2.19 10.4867 1.82 317.25 553 7 BranBrand 1669 0.769 [Ne] 3s2 3p3 3 15 17 | 16 Sulfur S 32.065 3 16 solid orth Nonmetal 0.37 1.1 2.58 10.36 2.067 388.51 717.8 10 Prehistoric 0.71 [Ne] 3s2 3p4 3 16 18 | 17 Chlorine Cl 35.453 3 17 gas Halogen 1.8 0.97 3.16 12.9676 0.003214 172.31 239.11 11 Scheele 1774 0.479 [Ne] 3s2 3p5 3 17 19 | 18 Argon Ar 39.948 3 18 gas Noble Gas 0.88 15.7596 0.0017837 83.96 87.3 8 Rayleigh and Ramsay 1894 0.52 [Ne] 3s2 3p6 3 18 20 | 19 Potassium K 39.0983 4 1 solid bcc Alkali Metal 1.4 2.8 0.82 4.3407 0.862 336.5 1032 10 Davy 1807 0.757 [Ar] 4s1 4 1 21 | 20 Calcium Ca 40.078 4 2 solid fcc Alkaline Earth Metal 0.99 2.2 1 6.1132 1.54 1112.15 1757 14 Davy 1808 0.647 [Ar] 4s2 4 2 22 | 21 Scandium Sc 44.955912 4 3 solid hex Transition Metal 0.75 2.1 1.36 6.5615 2.989 1812.15 3109 15 Nilson 1878 0.568 [Ar] 3d1 4s2 4 3 23 | 22 Titanium Ti 47.867 4 4 solid hex Transition Metal 0.61 2 1.54 6.8281 4.54 1933.15 3560 9 Gregor 1791 0.523 [Ar] 3d2 4s2 4 4 24 | 23 Vanadium V 50.9415 4 5 solid bcc Transition Metal 0.59 1.9 1.63 6.7462 6.11 2175.15 3680 9 del Rio 1801 0.489 [Ar] 3d3 4s2 4 5 25 | 24 Chromium Cr 51.9961 4 6 solid bcc Transition Metal 0.52 1.9 1.66 6.7665 7.15 2130.15 2944 9 Vauquelin 1797 0.449 [Ar] 3d5 4s1 4 6 26 | 25 Manganese Mn 54.938045 4 7 solid bcc Transition Metal 0.46 1.8 1.55 7.434 7.44 1519.15 2334 11 Gahn and Scheele 1774 0.479 [Ar] 3d5 4s2 4 7 27 | 26 Iron Fe 55.845 4 8 solid bcc Transition Metal 0.65 1.7 1.83 7.9024 7.874 1808.15 3134 10 Prehistoric 0.449 [Ar] 3d6 4s2 4 8 28 | 27 Cobalt Co 58.933195 4 9 solid hex Transition Metal 0.75 1.7 1.88 7.881 8.86 1768.15 3200 14 Brandt 1735 0.421 [Ar] 3d7 4s2 4 9 29 | 28 Nickel Ni 58.6934 4 10 solid fcc Transition Metal 0.69 1.6 1.91 7.6398 8.912 1726.15 3186 11 Cronstedt 1751 0.444 [Ar] 3d8 4s2 4 10 30 | 29 Copper Cu 63.546 4 11 solid fcc Transition Metal 0.73 1.6 1.9 7.7264 8.96 1357.75 2835 11 Prehistoric 0.385 [Ar] 3d10 4s1 4 11 31 | 30 Zinc Zn 65.38 4 12 solid hex Transition Metal 0.74 1.5 1.65 9.3942 7.134 692.88 1180 15 Prehistoric 0.388 [Ar] 3d10 4s2 4 12 32 | 31 Gallium Ga 69.723 4 13 solid orth Metal 0.62 1.8 1.81 5.9993 5.907 302.91 2477 14 de Boisbaudran 1875 0.371 [Ar] 3d10 4s2 4p1 4 13 33 | 32 Germanium Ge 72.64 4 14 solid fcc Metalloid 0.53 1.5 2.01 7.8994 5.323 1211.45 3106 17 Winkler 1886 0.32 [Ar] 3d10 4s2 4p2 4 14 34 | 33 Arsenic As 74.9216 4 15 solid rho Metalloid 0.58 1.3 2.18 9.7886 5.776 1090.15 887 14 Albertus Magnus 1250 0.329 [Ar] 3d10 4s2 4p3 4 15 35 | 34 Selenium Se 78.96 4 16 solid hex Nonmetal 0.5 1.2 2.55 9.7524 4.809 494.15 958 20 Berzelius 1817 0.321 [Ar] 3d10 4s2 4p4 4 16 36 | 35 Bromine Br 79.904 4 17 liq Halogen 2 1.1 2.96 11.8138 3.122 266.05 332 19 Balard 1826 0.474 [Ar] 3d10 4s2 4p5 4 17 37 | 36 Krypton Kr 83.798 4 18 gas Noble Gas 1 13.9996 0.003733 115.93 119.93 23 Ramsay and Travers 1898 0.248 [Ar] 3d10 4s2 4p6 4 18 38 | 37 Rubidium Rb 85.4678 5 1 solid bcc Alkali Metal 1.5 3 0.82 4.1771 1.532 312.79 961 20 Bunsen and Kirchoff 1861 0.363 [Kr] 5s1 5 1 39 | 38 Strontium Sr 87.62 5 2 solid fcc Alkaline Earth Metal 1.1 2.5 0.95 5.6949 2.64 1042.15 1655 18 Davy 1808 0.301 [Kr] 5s2 5 2 40 | 39 Yttrium Y 88.90585 5 3 solid hex Transition Metal 0.9 2.3 1.22 6.2173 4.469 1799.15 3609 21 Gadolin 1794 0.298 [Kr] 4d1 5s2 5 3 41 | 40 Zirconium Zr 91.224 5 4 solid hex Transition Metal 0.72 2.2 1.33 6.6339 6.506 2125.15 4682 20 Klaproth 1789 0.278 [Kr] 4d2 5s2 5 4 42 | 41 Niobium Nb 92.90638 5 5 solid bcc Transition Metal 0.69 2.1 1.6 6.7589 8.57 2741.15 5017 24 Hatchett 1801 0.265 [Kr] 4d4 5s1 5 5 43 | 42 Molybdenum Mo 95.96 5 6 solid bcc Transition Metal 0.65 2 2.16 7.0924 10.22 2890.15 4912 20 Scheele 1778 0.251 [Kr] 4d5 5s1 5 6 44 | 43 Technetium Tc 98 5 7 artificial hex Transition Metal 0.56 2 1.9 7.28 11.5 2473.15 5150 23 Perrier and SegrŽ 1937 [Kr] 4d5 5s2 5 7 45 | 44 Ruthenium Ru 101.07 5 8 solid hex Transition Metal 0.68 1.9 2.2 7.3605 12.37 2523.15 4423 16 Klaus 1844 0.238 [Kr] 4d7 5s1 5 8 46 | 45 Rhodium Rh 102.9055 5 9 solid fcc Transition Metal 0.68 1.8 2.28 7.4589 12.41 2239.15 3968 20 Wollaston 1803 0.243 [Kr] 4d8 5s1 5 9 47 | 46 Palladium Pd 106.42 5 10 solid fcc Transition Metal 0.86 1.8 2.2 8.3369 12.02 1825.15 3236 21 Wollaston 1803 0.244 [Kr] 4d10 5 10 48 | 47 Silver Ag 107.8682 5 11 solid fcc Transition Metal 1.3 1.8 1.93 7.5762 10.501 1234.15 2435 27 Prehistoric 0.235 [Kr] 4d10 5s1 5 11 49 | 48 Cadmium Cd 112.411 5 12 solid hex Transition Metal 0.97 1.7 1.69 8.9938 8.69 594.33 1040 22 Stromeyer 1817 0.232 [Kr] 4d10 5s2 5 12 50 | 49 Indium In 114.818 5 13 solid tet Metal 0.8 2 1.78 5.7864 7.31 429.91 2345 34 Reich and Richter 1863 0.233 [Kr] 4d10 5s2 5p1 5 13 51 | 50 Tin Sn 118.71 5 14 solid tet Metal 0.69 1.7 1.96 7.3439 7.287 505.21 2875 28 Prehistoric 0.228 [Kr] 4d10 5s2 5p2 5 14 52 | 51 Antimony Sb 121.76 5 15 solid rho Metalloid 0.76 1.5 2.05 8.6084 6.685 904.05 1860 29 Early historic times 0.207 [Kr] 4d10 5s2 5p3 5 15 53 | 52 Tellurium Te 127.6 5 16 solid hex Metalloid 0.97 1.4 2.1 9.0096 6.232 722.8 1261 29 von Reichenstein 1782 0.202 [Kr] 4d10 5s2 5p4 5 16 54 | 53 Iodine I 126.90447 5 17 solid orth Halogen 2.2 1.3 2.66 10.4513 4.93 386.65 457.4 24 Courtois 1811 0.214 [Kr] 4d10 5s2 5p5 5 17 55 | 54 Xenon Xe 131.293 5 18 gas gas Noble Gas 1.2 12.1298 0.005887 161.45 165.03 31 Ramsay and Travers 1898 0.158 [Kr] 4d10 5s2 5p6 5 18 56 | 55 Cesium Cs 132.9054519 6 1 solid Alkali Metal 1.7 3.3 0.79 3.8939 1.873 301.7 944 22 Bunsen and Kirchoff 1860 0.242 [Xe] 6s1 6 1 57 | 56 Barium Ba 137.327 6 2 solid bcc Alkaline Earth Metal 1.4 2.8 0.89 5.2117 3.594 1002.15 2170 25 Davy 1808 0.204 [Xe] 6s2 6 2 58 | 57 Lanthanum La 138.90547 6 3 solid hex Lanthanide 1.1 2.7 1.1 5.5769 6.145 1193.15 3737 19 Mosander 1839 0.195 [Xe] 5d1 6s2 8 3 59 | 58 Cerium Ce 140.116 6 19 solid fcc Lanthanide 1 2.7 1.12 5.5387 6.77 1071.15 3716 19 Berzelius 1803 0.192 [Xe] 4f1 5d1 6s2 8 4 60 | 59 Praseodymium Pr 140.90765 6 20 solid hex Lanthanide 1 2.7 1.13 5.473 6.773 1204.15 3793 15 von Welsbach 1885 0.193 [Xe] 4f3 6s2 8 5 61 | 60 Neodymium Nd 144.242 6 21 solid hex Lanthanide 1 2.6 1.14 5.525 7.007 1289.15 3347 16 von Welsbach 1885 0.19 [Xe] 4f4 6s2 8 6 62 | 61 Promethium Pm 145 6 22 artificial hex Lanthanide 0.98 2.6 1.13 5.582 7.26 1204.15 3273 14 Marinsky et al. 1945 [Xe] 4f5 6s2 8 7 63 | 62 Samarium Sm 150.36 6 23 solid hex Lanthanide 0.96 2.6 1.17 5.6437 7.52 1345.15 2067 17 Boisbaudran 1879 0.197 [Xe] 4f6 6s2 8 8 64 | 63 Europium Eu 151.964 6 24 solid bcc Lanthanide 0.95 2.6 1.2 5.6704 5.243 1095.15 1802 21 Demarcay 1901 0.182 [Xe] 4f7 6s2 8 9 65 | 64 Gadolinium Gd 157.25 6 25 solid hex Lanthanide 0.94 2.5 1.2 6.1501 7.895 1585.15 3546 17 de Marignac 1880 0.236 [Xe] 4f7 5d1 6s2 8 10 66 | 65 Terbium Tb 158.92535 6 26 solid hex Lanthanide 0.92 2.5 1.2 5.8638 8.229 1630.15 3503 24 Mosander 1843 0.182 [Xe] 4f9 6s2 8 11 67 | 66 Dysprosium Dy 162.5 6 27 solid hex Lanthanide 0.91 2.5 1.22 5.9389 8.55 1680.15 2840 21 de Boisbaudran 1886 0.17 [Xe] 4f10 6s2 8 12 68 | 67 Holmium Ho 164.93032 6 28 solid hex Lanthanide 0.9 2.5 1.23 6.0215 8.795 1743.15 2993 29 Delafontaine and Soret 1878 0.165 [Xe] 4f11 6s2 8 13 69 | 68 Erbium Er 167.259 6 29 solid hex Lanthanide 0.88 2.5 1.24 6.1077 9.066 1795.15 3503 16 Mosander 1843 0.168 [Xe] 4f12 6s2 8 14 70 | 69 Thulium Tm 168.93421 6 30 solid hex Lanthanide 0.87 2.4 1.25 6.1843 9.321 1818.15 2223 18 Cleve 1879 0.16 [Xe] 4f13 6s2 8 15 71 | 70 Ytterbium Yb 173.054 6 31 solid fcc Lanthanide 0.86 2.4 1.1 6.2542 6.965 1097.15 1469 16 Marignac 1878 0.155 [Xe] 4f14 6s2 8 16 72 | 71 Lutetium Lu 174.9668 6 32 solid hex Lanthanide 0.85 2.3 1.27 5.4259 9.84 1936.15 3675 22 Urbain/ von Welsbach 1907 0.154 [Xe] 4f14 5d1 6s2 8 17 73 | 72 Hafnium Hf 178.49 6 4 solid hex Transition Metal 0.71 2.2 1.3 6.8251 13.31 2500.15 4876 17 Coster and von Hevesy 1923 0.144 [Xe] 4f14 5d2 6s2 6 4 74 | 73 Tantalum Ta 180.94788 6 5 solid bcc Transition Metal 0.64 2.1 1.5 7.5496 16.654 3269.15 5731 19 Ekeberg 1801 0.14 [Xe] 4f14 5d3 6s2 6 5 75 | 74 Wolfram W 183.84 6 6 solid bcc Transition Metal 0.62 2 2.36 7.864 19.25 3680.15 5828 22 J. and F. d'Elhuyar 1783 0.132 [Xe] 4f14 5d4 6s2 6 6 76 | 75 Rhenium Re 186.207 6 7 solid hex Transition Metal 0.56 2 1.9 7.8335 21.02 3453.15 5869 21 Noddack/Berg/Tacke 1925 0.137 [Xe] 4f14 5d5 6s2 6 7 77 | 76 Osmium Os 190.23 6 8 solid hex Transition Metal 0.63 1.9 2.2 8.4382 22.61 3300.15 5285 19 Tennant 1803 0.13 [Xe] 4f14 5d6 6s2 6 8 78 | 77 Iridium Ir 192.217 6 9 solid fcc Transition Metal 0.63 1.9 2.2 8.967 22.56 2716.15 4701 25 Tennant 1804 0.131 [Xe] 4f14 5d7 6s2 6 9 79 | 78 Platinum Pt 195.084 6 10 solid fcc Transition Metal 0.63 1.8 2.28 8.9587 21.46 2045.15 4098 32 Ulloa/Wood 1735 0.133 [Xe] 4f14 5d9 6s1 6 10 80 | 79 Gold Au 196.966569 6 11 solid fcc Transition Metal 0.85 1.8 2.54 9.2255 19.282 1337.73 3129 21 Prehistoric 0.129 [Xe] 4f14 5d10 6s1 6 11 81 | 80 Mercury Hg 200.59 6 12 liq Transition Metal 1 1.8 2 10.4375 13.5336 234.43 630 26 Prehistoric 0.14 [Xe] 4f14 5d10 6s2 6 12 82 | 81 Thallium Tl 204.3833 6 13 solid hex Metal 1.5 2.1 2.04 6.1082 11.85 577.15 1746 28 Crookes 1861 0.129 [Xe] 4f14 5d10 6s2 6p1 6 13 83 | 82 Lead Pb 207.2 6 14 solid fcc Metal 1.2 1.8 2.33 7.4167 11.342 600.75 2022 29 Prehistoric 0.129 [Xe] 4f14 5d10 6s2 6p2 6 14 84 | 83 Bismuth Bi 208.9804 6 15 solid rho Metal 1 1.6 2.02 7.2856 9.807 544.67 1837 19 Geoffroy the Younger 1753 0.122 [Xe] 4f14 5d10 6s2 6p3 6 15 85 | 84 Polonium Po 210 6 16 solid cub Metalloid 2.3 1.5 2 8.417 9.32 527.15 1235 34 Curie 1898 [Xe] 4f14 5d10 6s2 6p4 6 16 86 | 85 Astatine At 210 6 17 solid Noble Gas 1.4 2.2 9.3 7 575.15 610 21 Corson et al. 1940 [Xe] 4f14 5d10 6s2 6p5 6 17 87 | 86 Radon Rn 222 6 18 gas Alkali Metal 1.3 10.7485 0.00973 202.15 211.3 20 Dorn 1900 0.094 [Xe] 4f14 5d10 6s2 6p6 6 18 88 | 87 Francium Fr 223 7 1 solid bcc Alkaline Earth Metal 1.8 0.7 4.0727 1.87 300.15 950 21 Perey 1939 [Rn] 7s1 7 1 89 | 88 Radium Ra 226 7 2 solid bcc Actinide 1.4 0.9 5.2784 5.5 973.15 2010 15 Pierre and Marie Curie 1898 [Rn] 7s2 7 2 90 | 89 Actinium Ac 227 7 3 solid fcc Actinide 1.1 1.1 5.17 10.07 1323.15 3471 11 Debierne/Giesel 1899 0.12 [Rn] 6d1 7s2 9 3 91 | 90 Thorium Th 232.03806 7 19 solid fcc Actinide 0.97 1.3 6.3067 11.72 2028.15 5061 12 Berzelius 1828 0.113 [Rn] 6d2 7s2 9 4 92 | 91 Protactinium Pa 231.03588 7 20 solid orth Actinide 0.78 1.5 5.89 15.37 1873.15 4300 14 Hahn and Meitner 1917 [Rn] 5f2 6d1 7s2 9 5 93 | 92 Uranium U 238.02891 7 21 solid orth Actinide 0.52 1.38 6.1941 18.95 1405.15 4404 15 Peligot 1841 0.116 [Rn] 5f3 6d1 7s2 9 6 94 | 93 Neptunium Np 237 7 22 artificial orth Actinide 0.75 1.36 6.2657 20.45 913.15 4273 153 McMillan and Abelson 1940 [Rn] 5f4 6d1 7s2 9 7 95 | 94 Plutonium Pu 244 7 23 artificial mno Actinide 0.89 1.28 6.0262 19.84 913.15 3501 163 Seaborg et al. 1940 [Rn] 5f6 7s2 9 8 96 | 95 Americium Am 243 7 24 artificial hex Actinide 0.98 1.3 5.9738 13.69 1267.15 2880 133 Seaborg et al. 1944 [Rn] 5f7 7s2 9 9 97 | 96 Curium Cm 247 7 25 artificial hex Actinide 0.97 1.3 5.9915 13.51 1340.15 3383 133 Seaborg et al. 1944 9 10 98 | 97 Berkelium Bk 247 7 26 artificial hex Actinide 0.95 1.3 6.1979 14.79 1259.15 983 83 Seaborg et al. 1949 9 11 99 | 98 Californium Cf 251 7 27 artificial hex Actinide 0.93 1.3 6.2817 15.1 1925.15 1173 123 Seaborg et al. 1950 9 12 100 | 99 Einsteinium Es 252 7 28 artificial hex Actinide 1.3 6.42 13.5 1133.15 123 Ghiorso et al. 1952 9 13 101 | 100 Fermium Fm 257 7 29 artificial Actinide 1.3 6.5 103 Ghiorso et al. 1953 9 14 102 | 101 Mendelevium Md 258 7 30 artificial Actinide 1.3 6.58 33 Ghiorso et al. 1955 9 15 103 | 102 Nobelium No 259 7 31 artificial Actinide 1.3 6.65 73 Ghiorso et al. 1958 9 16 104 | 103 Lawrencium Lr 262 7 32 artificial Actinide 203 Ghiorso et al. 1961 9 17 105 | 104 Rutherfordium Rf 261 7 4 artificial Transactinide 18.1 Ghiorso et al. 1969 7 4 106 | 105 Dubnium Db 262 7 5 artificial Transactinide 39 Ghiorso et al. 1970 7 5 107 | 106 Seaborgium Sg 266 7 6 artificial Transactinide 35 Ghiorso et al. 1974 7 6 108 | 107 Bohrium Bh 264 7 7 artificial Transactinide 37 Armbruster and Münzenberg 1981 7 7 109 | 108 Hassium Hs 267 7 8 artificial Transactinide 41 Armbruster and Münzenberg 1983 7 8 110 | 109 Meitnerium Mt 268 7 9 artificial Transactinide 35 GSI (Darmstadt - West Germany) 1982 7 9 111 | 110 Darmstadtium Ds 271 7 10 artificial Transactinide 7 10 112 | 111 Roentgenium Rg 272 7 11 artificial Transactinide 7 11 113 | 112 Copernicium Cn 285 7 12 artificial Transactinide 7 12 114 | 113 Ununtrium Uut 284 7 13 artificial 7 13 115 | 114 Ununquadium Uuq 289 7 14 artificial Transactinide 7 14 116 | 115 Ununpentium Uup 288 7 15 artificial 7 15 117 | 116 Ununhexium Uuh 292 7 16 artificial Transactinide 7 16 118 | 117 Ununseptium Uus 295 7 17 artificial 7 17 119 | 118 Ununoctium Uuo 294 7 18 artificial Noble Gas 7 18 120 | -------------------------------------------------------------------------------- /data/StateCapitals.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/data/StateCapitals.xlsx -------------------------------------------------------------------------------- /img/Preview.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /img/Preview_inverse.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /img/csv-preview-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/img/csv-preview-4.gif -------------------------------------------------------------------------------- /img/excel-preview-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/img/excel-preview-4.gif -------------------------------------------------------------------------------- /img/excel-themes-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/img/excel-themes-4.gif -------------------------------------------------------------------------------- /img/gc-excelviewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/img/gc-excelviewer.png -------------------------------------------------------------------------------- /img/separator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjuback/gc-excelviewer/582ae40fce382b7698228fbc8d7ee2fe74ecdebb/img/separator.png -------------------------------------------------------------------------------- /out/controls/wijmo.chart.render.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Wijmo Library 5.20213.824 4 | * http://wijmo.com/ 5 | * 6 | * Copyright(c) GrapeCity, Inc. All rights reserved. 7 | * 8 | * Licensed under the GrapeCity Commercial License. 9 | * sales@wijmo.com 10 | * wijmo.com/products/wijmo-5/license/ 11 | * 12 | */ 13 | 14 | var wijmo;!function(e){!function(t){!function(t){"use strict";var n=function(){function _CanvasRenderEngine(t,n){void 0===n&&(n=!1);this._strokeWidth=1;this._fontSize=null;this._fontFamily=null;this._cssPriority=!0;this._readOnly=!1;this._applyCanvasClip=function(e,t){var n=this._canvasRect[t];if(n){e.beginPath();e.rect(n.left,n.top,n.width,n.height);e.clip();e.closePath()}};this._applyCanvasStyles=function(e,t,n,i,a){var r,s,l,o=this._canvas.getContext("2d"),h=this.stroke,p=this.fill,f=this.strokeWidth;t&&void 0!==t.stroke&&(h=t.stroke);t&&void 0!==t.fill&&(p=this._getOpacityColor(t.fill,t["fill-opacity"]));if(e){s=window.getComputedStyle(e);l=e.getBBox()}if(a){if(s){o.fillStyle=s.fill;r=s.fontStyle+" "+s.fontWeight+" "+s.fontSize+" "+s.fontFamily;o.font=r}else if(this.fontSize){o.fillStyle=this.textFill;o.font=this.fontSize+" "+(this.fontFamily||"sans-serif")}else if(this._canvasDefaultFont){o.fillStyle=this._canvasDefaultFont.textFill;r=this._canvasDefaultFont.fontSize+" "+this._canvasDefaultFont.fontFamily;o.font=r;if(o.font.replace(/\"/g,"'")!==r.replace(/\"/g,"'")){r=this._canvasDefaultFont.fontSize+" "+(o.font.split(" ")[1]||"sans-serif");o.font=r}}}else{if(s){h=s.stroke&&"none"!==s.stroke?s.stroke:h;p=s.fill&&"none"!==s.fill?this._getOpacityColor(s.fill,s["fill-opacity"]):p;f=s.strokeWidth?s.strokeWidth:f}if("none"!==h&&null!=h){this._applyColor("strokeStyle",h,l);o.lineWidth=+f.replace(/px/g,"");o.stroke()}if(i&&null!=p&&"transparent"!==p&&"none"!==p){this._applyColor("fillStyle",p,l);o.fill()}}};this._element=t;this._canvas=document.createElement("canvas");this._svgEngine=new e.chart._SvgRenderEngine(t);this._element.appendChild(this._canvas);this._applyCSSStyles=n}_CanvasRenderEngine.prototype.beginRender=function(){var e,t=this._svgEngine.element,n=this._element;if(this._applyCSSStyles){this._svgEngine.beginRender();n=t}this._element.appendChild(t);this._canvasRect={};e=window.getComputedStyle(n);this._canvasDefaultFont={fontSize:e.fontSize,fontFamily:e.fontFamily,textFill:e.color}};_CanvasRenderEngine.prototype.endRender=function(){this._applyCSSStyles&&this._svgEngine.endRender();this._svgEngine.element.parentNode.removeChild(this._svgEngine.element)};_CanvasRenderEngine.prototype.setViewportSize=function(e,t){var n=this._canvas;n.getContext("2d"),this.fill;this._applyCSSStyles&&this._svgEngine.setViewportSize(e,t);n.width=e;n.height=t};Object.defineProperty(_CanvasRenderEngine.prototype,"element",{get:function(){return this._canvas},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fill",{get:function(){return this._fill},set:function(e){this._svgEngine.fill=e;this._fill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._svgEngine.fontSize=e;var t=null==e||isNaN(e)?e:e+"px";this._fontSize=t},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this._svgEngine.fontFamily=e;this._fontFamily=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"stroke",{get:function(){return this._stroke},set:function(e){this._svgEngine.stroke=e;this._stroke=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"strokeWidth",{get:function(){return this._strokeWidth},set:function(e){this._svgEngine.strokeWidth=e;this._strokeWidth=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"textFill",{get:function(){return this._textFill},set:function(e){this._svgEngine.textFill=e;this._textFill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"cssPriority",{get:function(){return this._cssPriority},set:function(e){this._svgEngine.cssPriority=e;this._cssPriority=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"readOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=e},enumerable:!0,configurable:!0});_CanvasRenderEngine.prototype.addClipRect=function(e,t){if(e&&t){this._applyCSSStyles&&this._svgEngine.addClipRect(e,t);this._canvasRect[t]=e.clone()}};_CanvasRenderEngine.prototype.drawEllipse=function(e,t,n,i,a,r){if(!this.readOnly){var s,l=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawEllipse(e,t,n,i,a,r));l.save();l.beginPath();if(l.ellipse)l.ellipse(e,t,n,i,0,0,2*Math.PI);else{l.translate(e,t);l.scale(1,i/n);l.translate(-e,-t);l.arc(e,t,n,0,2*Math.PI);l.scale(1,1)}this._applyCanvasStyles(s,r,a,!0);l.restore();return s}};_CanvasRenderEngine.prototype.drawRect=function(e,t,n,i,a,r,s){if(!this.readOnly){var l,o=this._canvas.getContext("2d");this._applyCSSStyles&&(l=this._svgEngine.drawRect(e,t,n,i,a,r,s));o.save();this._applyCanvasClip(o,s);o.beginPath();o.rect(e,t,n,i);this._applyCanvasStyles(l,r,a,!0);o.restore();return l}};_CanvasRenderEngine.prototype.drawLine=function(e,t,n,i,a,r){if(!this.readOnly){var s,l=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawLine(e,t,n,i,a,r));l.save();l.beginPath();l.moveTo(e,t);l.lineTo(n,i);this._applyCanvasStyles(s,r,a);l.restore();return s}};_CanvasRenderEngine.prototype.drawLines=function(e,t,n,i,a,r){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var s,l,o=this._canvas.getContext("2d"),h=r||Math.min(e.length,t.length);this._applyCSSStyles&&(s=this._svgEngine.drawLines([0,1],[1,0],n,i,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.moveTo(e[0],t[0]);for(l=1;l-1)return this.fill;if(t.indexOf("-")>-1){this.fill=t;return t}null!=n&&1===i.a&&(i.a=isNaN(n)?1:Number(n));return i.toString()};_CanvasRenderEngine.prototype._applyColor=function(t,n,a){var r=i.tryParse(n),s=this._canvas.getContext("2d");if(null!=r)if(e.isString(r)||null==a)s[t]=r;else{var l;if(null!=r.x1)l=r.relative?s.createLinearGradient(a.x+r.x1*a.width,a.y+r.y1*a.height,a.x+r.x2*a.width,a.y+r.y2*a.height):s.createLinearGradient(r.x1,r.y1,r.x2,r.y2);else if(null!=r.r)if(r.relative){var o=a.x+r.cx*a.width,h=a.y+r.cy*a.height,p=r.r*a.width,f=r.r*a.height/p,g=a.x+(null==r.fx?r.cx:r.fx)*a.width,c=a.y+(null==r.fy?r.cy:r.fy)*a.height,y=(null==r.fr?0:r.fr)*a.width,d=(null==r.fr?0:r.fr)*a.height,_=Math.min(y,d);l=s.createRadialGradient(g,c/f,_,o,h/f,p);s.setTransform(1,0,0,f,0,0)}else l=s.createRadialGradient(null==r.fx?r.cx:r.fx,null==r.fy?r.cy:r.fy,r.fr||0,r.cx,r.cy,r.r);r.colors&&r.colors.length>0&&null!=l&&r.colors.forEach((function(t){var n=new e.Color("#000000");null!=t.color&&(n=t.color);null!=t.opacity&&(n.a=t.opacity);l.addColorStop(t.offset,n.toString())}));s[t]=l}};return _CanvasRenderEngine}();t._CanvasRenderEngine=n;var i=function(){function _GradientColorUtil(){}_GradientColorUtil.tryParse=function(t){if(_GradientColorUtil.parsedColor[t])return _GradientColorUtil.parsedColor[t];if(null==t||-1===t.indexOf("-"))return t;var n,i=t.replace(/\s+/g,"").split(/\-/g),a=i[0][0],r=!1,s=i[0].match(/\(\S+\)/)[0].replace(/[\(\\)]/g,"").split(/\,/g);if("l"===a||"L"===a){n={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]};"l"===a&&(r=!0);["x1","y1","x2","y2"].forEach((function(e,t){null!=s[t]&&(n[e]=+s[t])}))}else if("r"===a||"R"===a){n={cx:"0",cy:"0",r:"0",colors:[]};"r"===a&&(r=!0);["cx","cy","r","fx","fy","fr"].forEach((function(e,t){null!=s[t]&&""!==s[t]&&(n[e]=+s[t])}))}n.relative=r;_GradientColorUtil.parsedColor[t]=n;var l=i.length-1;i.forEach((function(t,i){t.indexOf(")")>-1&&(t=t.match(/\)\S+/)[0].replace(")",""));var a=t.split(":"),r={color:new e.Color("#000000")};null!=a[0]&&(r.color=e.Color.fromString(a[0]));null!=a[1]?r.offset=+a[1]:r.offset=i/l;null!=a[2]&&(r.opacity=+a[2]);n.colors.push(r)}));return n};_GradientColorUtil.parsedColor={};return _GradientColorUtil}();if(e.chart.FlexChartBase&&e.chart.FlexChartBase.prototype&&e.chart.FlexChartBase.prototype._exportToImage){var a=e.chart.FlexChartBase.prototype._exportToImage;e.chart.FlexChartBase.prototype._exportToImage=function(e,t){if("svg"!==e){var i=this._bgColor(this.hostElement);this._isTransparent(i)&&(i="#ffffff");var r,s,l=new n(this.hostElement,!0);this._render(l,!1,i);r=(s=l.element).toDataURL("image/"+e);s.parentNode.removeChild(s);t.call(null,r);s=null;l=null}else a.call(this,e,t)}}}(t.render||(t.render={}))}(e.chart||(e.chart={}))}(wijmo||(wijmo={}));!function(e){!function(t){t.render||(t.render={}),e._registerModule("wijmo.chart.render",e.chart.render)}(e.chart||(e.chart={}))}(wijmo||(wijmo={})); -------------------------------------------------------------------------------- /out/controls/wijmo.grid.cellmaker.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Wijmo Library 5.20213.824 4 | * http://wijmo.com/ 5 | * 6 | * Copyright(c) GrapeCity, Inc. All rights reserved. 7 | * 8 | * Licensed under the GrapeCity Commercial License. 9 | * sales@wijmo.com 10 | * wijmo.com/products/wijmo-5/license/ 11 | * 12 | */ 13 | 14 | var wijmo;!function(e){!function(t){!function(t){var r,a;!function(e){e[e.Line=0]="Line";e[e.Column=1]="Column";e[e.WinLoss=2]="WinLoss"}(r=t.SparklineType||(t.SparklineType={}));!function(e){e[e.None=0]="None";e[e.First=1]="First";e[e.Last=2]="Last";e[e.High=4]="High";e[e.Low=8]="Low";e[e.Negative=16]="Negative"}(a=t.SparklineMarkers||(t.SparklineMarkers={}));var l=function(){function CellMaker(){}CellMaker.makeButton=function(t){return function(r,a){r.col.isReadOnly=!0;a.innerHTML="";var l=e.format('',{txt:CellMaker._getOptionText(t,"text",r,r.text)});CellMaker._createElement(a,l,t,r);return null}};CellMaker.makeLink=function(t){return function(r,a){r.col.isReadOnly=!0;a.innerHTML="";var l=e.format('{txt}',{txt:CellMaker._getOptionText(t,"text",r,r.text),href:CellMaker._getOptionText(t,"href",r,"#")});CellMaker._createElement(a,l,t,r);return null}};CellMaker.makeSparkline=function(t){return function(r,a){r.col.isReadOnly=!0;a.innerHTML="";var l=e.format("
{spark}
",{spark:CellMaker._getSparkline(r.value,t)});CellMaker._createElement(a,l,t,r);return null}};CellMaker.makeImage=function(t){return function(r,a){r.col.isReadOnly=!0;a.innerHTML="";var l=e.format('',{src:CellMaker._getOptionText(t,"src",r,r.text)});CellMaker._createElement(a,l,t,r);return null}};CellMaker.makeRating=function(t){return function(r,a){var l=r.col,n=e.grid.DataMapEditor,i=l.cssClass||"",s=CellMaker._WJC_CellMaker;if(!l.dataMap||l.dataMapEditor!=n.RadioButtons||i.indexOf(s)<0){for(var o=t?t.range:null,u=[],c=(o=o&&e.isArray(o)&&o.length>1&&o[1]>o[0]?o:[0,5])[0];c<=o[1];c++)u.push(c);l.dataMap=new e.grid.DataMap(u);l.dataMapEditor=n.RadioButtons;i.indexOf(s)<0&&(l.cssClass=(i+" "+s).trim())}if(t&&t.label){var k=CellMaker._getOptionText(t,"label",r);a.setAttribute("aria-label",k.trim())}var m=a.querySelectorAll("label"),f=!!t&&t.showZeros,M=null==a.querySelector("input:checked");for(c=0;c1){o==i.WinLoss&&(t=t.map((function(t){return e.isBoolean(t)?t?1:-1:e.isNumber(t)?t>0?1:t<0?-1:null:null})));var m=CellMaker._scaleValues(t,c,k),f=m.points,M=m.base,g=100/(f.length-(o==i.Line?1:0)),C=g>4?g-2:g,x=g-C;switch(o){case i.Column:case i.WinLoss:for(var d=0;d",{x:(d*g+x).toFixed(2),y:Math.min(M,h),w:C.toFixed(2),h:Math.abs(M-h),cls:CellMaker._getMarkers(u,m,d)}))}break;case i.Line:for(d=0;d",{x1:Math.round(g*d),y1:v,x2:Math.round(g*(d+1)),y2:b}));var p=CellMaker._getMarkers(u,m,d),_='';p&&(n+=e.format(_,{x:Math.round(g*d),y:v,cls:p}));d==f.length-2&&(p=CellMaker._getMarkers(u,m,d+1))&&(n+=e.format(_,{x:Math.round(g*(d+1)),y:b,cls:p}))}}null!=c&&o!=i.WinLoss&&(n+=e.format('',{base:m.base}))}return n};CellMaker._scaleValues=function(t,r,a){var l,n,i=[];a&&a>1&&t.length>a&&(t=t.slice(0,a));t.forEach((function(t){if(e.isNumber(t)){l=!e.isNumber(l)||tn?t:n}}));if(e.isNumber(l)&&e.isNumber(n)){if(null!=r){l=Math.min(l,r);n=Math.max(n,r)}else r=l>0?l:n<0?n:0;if(l==n){l--;n++}var s=n-l;t.forEach((function(t){i.push(e.isNumber(t)?100-Math.round((t-l)/s*100):null)}));r=100-Math.round((r-l)/s*100)}return{min:l,max:n,base:r,points:i,data:t}};CellMaker._getMarkers=function(e,t,r){var l="",n=a;if(e){var i=t.data,s="wj-marker-";0!=(e&n.First)&&0==r&&(l+=s+"first ");0!=(e&n.Last)&&r==i.length-1&&(l+=s+"last ");0!=(e&n.High)&&i[r]==t.max&&(l+=s+"high ");0!=(e&n.Low)&&i[r]==t.min&&(l+=s+"low ");0!=(e&n.Negative)&&i[r]<0&&(l+=s+"negative ")}return l?'class="wj-marker '+l.trim()+'"':""};CellMaker._WJC_CellMaker="wj-cell-maker";return CellMaker}();t.CellMaker=l}(t.cellmaker||(t.cellmaker={}))}(e.grid||(e.grid={}))}(wijmo||(wijmo={}));!function(e){!function(t){t.cellmaker||(t.cellmaker={}),e._registerModule("wijmo.grid.cellmaker",e.grid.cellmaker)}(e.grid||(e.grid={}))}(wijmo||(wijmo={})); -------------------------------------------------------------------------------- /out/controls/wijmo.grid.detail.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Wijmo Library 5.20213.824 4 | * http://wijmo.com/ 5 | * 6 | * Copyright(c) GrapeCity, Inc. All rights reserved. 7 | * 8 | * Licensed under the GrapeCity Commercial License. 9 | * sales@wijmo.com 10 | * wijmo.com/products/wijmo-5/license/ 11 | * 12 | */ 13 | 14 | var wijmo,__extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();!function(e){!function(t){!function(t){"use strict";var i=function(e){__extends(DetailRow,e);function DetailRow(t){var i=e.call(this)||this;i.isReadOnly=!0;return i}Object.defineProperty(DetailRow.prototype,"detail",{get:function(){return this._detail},set:function(e){this._detail=e},enumerable:!0,configurable:!0});return DetailRow}(e.grid.Row);t.DetailRow=i}(t.detail||(t.detail={}))}(e.grid||(e.grid={}))}(wijmo||(wijmo={}));!function(e){var t;(function(t){"use strict";var i=function(i){__extends(DetailMergeManager,i);function DetailMergeManager(e){var t=i.call(this)||this;t._originalMergeManager=e.mergeManager;return t}DetailMergeManager.prototype.getMergedRange=function(i,r,n,o){void 0===o&&(o=!0);switch(i.cellType){case e.grid.CellType.Cell:if(i.rows[r]instanceof t.DetailRow){i.columns.frozen>0&&i.grid&&(i.grid.cloneFrozenCells=!1);return new e.grid.CellRange(r,0,r,i.columns.length-1)}break;case e.grid.CellType.RowHeader:var l=_isFrozen(i,r),a=_isNew(i,r),s=i.rows[r].dataItem;!s&&r>0&&i.rows[r]instanceof t.DetailRow&&(s=i.rows[r-1].dataItem);for(var d=r;d>0&&i.rows[d-1].dataItem==s&&_isFrozen(i,d-1)==l&&_isNew(i,d-1)==a;)d--;for(var c=r;c0&&o[l]instanceof t.DetailRow&&l--;for(var a=o[l].dataItem;l0&&n>o&&(n=o);t.height=n;r.style.height||(r.style.height="100%");var l=r.querySelector(".wj-flexgrid");l&&!l.style.height&&(l.style.height="100%")};FlexGridDetailProvider.prototype._handleFrozenCells=function(){var t=this._g,i=t.hostElement,r=e.Control.getControl(i.querySelector(".wj-flexgrid"));if(r instanceof e.grid.FlexGrid&&(r.frozenRows||r.frozenColumns)){e.setCss([t._eTL,t._eBL,t._eCHdr,t._eCFtr,t._eRHdr,t._eMarquee],{zIndex:"13"});for(var n=i.querySelectorAll(".wj-frozen"),o=0;o-1){if(this.isDetailVisible(t)){this.hideDetail(t);return!0}if(this._hasDetail(t)){var i=this._g;i.select(new e.grid.CellRange(t,0,t,i.columns.length-1));this.showDetail(t,this._mode==r.ExpandSingle);return!0}}return!1};FlexGridDetailProvider.prototype._selectionChanged=function(e,t){var i=this;if(this._mode==r.Selection){this._toSel&&clearTimeout(this._toSel);this._toSel=setTimeout((function(){var t=e._selHdl.selection.row;t>-1?i.showDetail(t,!0):i.hideDetail()}),300)}};FlexGridDetailProvider.prototype._formatItem=function(i,n){var o=this._g,l=n.cell,a=n.getRow(),s=r;if(n.panel==o.cells&&a instanceof t.DetailRow&&null!=a.detail&&!e.hasClass(l,"wj-detail")){e.addClass(l,"wj-detail");l.textContent="";l.style.textAlign=l.style.zIndex="";l.className=l.className.replace(/wj\-align\-[\S]+/g,"");l.appendChild(a.detail);null==a.height?this._sizeDetailRow(a):e.Control.refreshAll(a.detail)}if(n.panel==o.rowHeaders&&0==n.col&&this._hasDetail(n.row)){l.style.cursor="";switch(this._mode){case s.ExpandMulti:case s.ExpandSingle:var d=this.isDetailVisible(n.row),c=d?"minus":"plus",u=FlexGridDetailProvider._WJC_DETAIL;l.innerHTML='
';var h=l.children[0],f=e.culture.FlexGridDetailProvider.ariaLabels.toggleDetail;e.setAriaLabel(h,f);e.setAttribute(h,"aria-expanded",d)}}};FlexGridDetailProvider.prototype._resizedRow=function(i,r){var n=r.getRow();n instanceof t.DetailRow&&n.detail&&e.Control.refreshAll(n.detail)};FlexGridDetailProvider.prototype._hasDetail=function(t){var i=this._g.rows[t];return e.isFunction(this._rowHasDetailFn)?this._rowHasDetailFn(i):this._isRegularRow(i)};FlexGridDetailProvider.prototype._isRegularRow=function(i){return!(i instanceof e.grid._NewRowTemplate||i instanceof t.DetailRow||i instanceof e.grid.GroupRow&&!this._g.childItemsPath)};FlexGridDetailProvider.prototype._createDetailCell=function(e){return this.createDetailCell?this.createDetailCell(e):null};FlexGridDetailProvider._WJC_DETAIL="wj-elem-detail";return FlexGridDetailProvider}();t.FlexGridDetailProvider=n})((t=e.grid||(e.grid={})).detail||(t.detail={}))}(wijmo||(wijmo={}));!function(e){!function(t){t.detail||(t.detail={}),e._registerModule("wijmo.grid.detail",e.grid.detail)}(e.grid||(e.grid={}))}(wijmo||(wijmo={})); -------------------------------------------------------------------------------- /out/controls/wijmo.grid.grouppanel.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Wijmo Library 5.20213.824 4 | * http://wijmo.com/ 5 | * 6 | * Copyright(c) GrapeCity, Inc. All rights reserved. 7 | * 8 | * Licensed under the GrapeCity Commercial License. 9 | * sales@wijmo.com 10 | * wijmo.com/products/wijmo-5/license/ 11 | * 12 | */ 13 | 14 | var wijmo,__extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();!function(e){!function(t){!function(t){"use strict";t.softGridFilter=function softGridFilter(){return e._getModule("wijmo.grid.filter")}}(t.grouppanel||(t.grouppanel={}))}(e.grid||(e.grid={}))}(wijmo||(wijmo={}));!function(e){!function(t){!function(t){"use strict";e._addCultureInfo("GroupPanel",{dragDrop:"Drag and Drop columns here to create Groups."});var r=function(r){__extends(GroupPanel,r);function GroupPanel(t,i){var n=r.call(this,t)||this;n._hideGroupedCols=!0;n._showDragGlyphs=!0;n._maxGroups=6;n._hiddenCols=[];n._placeholder=null;n._dragEndBnd=n._dragEnd.bind(n);var o=n.getTemplate();n.applyTemplate("wj-grouppanel wj-control",o,{_divMarkers:"div-markers",_divPH:"div-ph"});e.setCss(n._divMarkers.parentElement,{width:"100%",height:"100%",minHeight:"1em",overflow:"hidden",cursor:"default"});var l=n.hostElement,s=n.addEventListener.bind(n);s(l,"dragstart",n._dragStart.bind(n));s(l,"dragover",n._dragOver.bind(n));s(l,"drop",n._drop.bind(n));s(l,"dragend",n._dragEndBnd);s(l,"click",n._click.bind(n));n.initialize(i);return n}Object.defineProperty(GroupPanel.prototype,"hideGroupedColumns",{get:function(){return this._hideGroupedCols},set:function(t){t!=this._hideGroupedCols&&(this._hideGroupedCols=e.asBoolean(t))},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"showDragGlyphs",{get:function(){return this._showDragGlyphs},set:function(t){if(t!=this._showDragGlyphs){this._showDragGlyphs=e.asBoolean(t);this.refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(GroupPanel.prototype,"maxGroups",{get:function(){return this._maxGroups},set:function(t){if(t!=this._maxGroups){this._maxGroups=e.asNumber(t);var r=this._gds,i=this._maxGroups;r&&i>-1&&i=0&&s<0;a--)for(var d=0;d-1&&l>-1){var u=document.createElement("div");t.cellFactory.updateCell(this._g.columnHeaders,l,s,u);u.setAttribute("class","wj-cell wj-header wj-groupmarker");e.setCss(u,{position:"static",display:"inline-block",verticalAlign:"top",left:"",right:"",top:"",width:"",height:"",paddingLeft:"",paddingRight:""});e.removeChild(u.querySelector(".wj-elem-filter"));e.removeChild(u.querySelector(".wj-column-selector"));if(this.showDragGlyphs){var h=e.createElement('');u.insertBefore(h,u.firstChild)}var p=t._getBindingColumn(i,l,i.columns[s]),g=this._getColumnFilter(p);if(g){var c=e.createElement('',u);e.toggleClass(c,"wj-filter-on",g.isActive);e.toggleClass(c,"wj-filter-off",!g.isActive)}e.createElement('×',u);this._divMarkers.appendChild(u)}}this._divPH.textContent=null!=this._placeholder?this._placeholder:e.culture.GroupPanel.dragDrop;var f=this._divMarkers.children.length>0;this._divPH.style.display=f?"none":"";this._divMarkers.style.display=f?"":"none"}};GroupPanel.prototype.hitTest=function(t){var r=t instanceof HTMLElement?t:t instanceof MouseEvent?t.target:null;e.assert(null!=r,"MouseEvent or Element expected");var i=e.closest(r,".wj-cell");if(e.hasClass(i,"wj-cell")){var n=this._getElementIndex(i);return this._gds&&n>-1?this._gds[n]:null}return null};GroupPanel.prototype._filterChanged=function(){this._filterMarker=null};GroupPanel.prototype._getColumnFilter=function(e){var t=this._filter,r=null;t&&(r=t.filterColumns&&t.filterColumns.indexOf(e.binding)<0?null:t.getColumnFilter(e));return r};GroupPanel.prototype._editFilter=function(t){var r=this._gds,i=this._getElementIndex(t),n=r&&i>-1?r[i]:null,o=n instanceof e.collections.PropertyGroupDescription?n.propertyName:null,l=o?this._g.getColumn(o):null;l&&this._filter.editColumnFilter(l,null,t)};GroupPanel.prototype._addGroup=function(t,r){for(var i=this._getIndex(r),n=this._gds,o=this._maxGroups,l=0;l-1)for(l=o-1;li&&n--;n>=this._gds.length&&(n=this._gds.length);i!=n&&r.deferUpdate((function(){var e=r[i];r.removeAt(i);r.insert(n,e)}))};GroupPanel.prototype._removeGroup=function(t,r){void 0===r&&(r=this._gds);var i=r&&t>-1?r[t]:null,n=i instanceof e.collections.PropertyGroupDescription?i.propertyName:null,o=n?this._g.columns.getColumn(n):null;if(o){o.visible=!0;var l=this._hiddenCols,s=l.indexOf(o);s>-1&&l.splice(s,1)}i&&r.removeAt(t)};GroupPanel.prototype._getIndex=function(e){for(var t=e.clientX,r=this._divMarkers.children,i=0;i-1&&(this._iChg={oldItem:n,index:r})}};ImmutabilityProvider.prototype._gridDeletedRow=function(t,e){var r=this._iChg,o=this._isAddNew;if(r){this._clearChg();o||this.onDataChanged(new n(i.Remove,r.oldItem,null,r.index))}};ImmutabilityProvider.prototype._gridBeginningEdit=function(t,e){if(!this._isAddNew){var i=e.getRow(),n=i.dataItem,r=this._cv.sourceCollection.indexOf(n),o=this._chg;if(o){if(o.changedItems[r])return}else o=this._chg={changedItems:{}};this._addItemChange(i.index,r)}};ImmutabilityProvider.prototype._gridRowEditEnded=function(t,e){this._isPasting||this._doRowEditEnded(t,e)};ImmutabilityProvider.prototype._doRowEditEnded=function(t,e){var r=this._isAddNew,o=this._chg;this._clearChg();if(r){if(!e.cancel){var a=this._cv.sourceCollection,s=a[a.length-1];this.onDataChanged(new n(i.Add,null,s,a.length-1))}}else if(o)if(e.cancel){var d=e.getRow();this._swapBatchedItems(d,o.changedItems)>1&&this._cv.refresh()}else{var c=o.changedItems;for(var l in c){var h=c[l];this.onDataChanged(new n(i.Change,h.oldItem,h.newItem,h.index))}}};ImmutabilityProvider.prototype._gridPasting=function(e,i){this._isPasting=!0;var n=i.range.rowSpan;if(this._chg&&1!==n)i.cancel=!0;else if(1!==n){var r=this._grid.rows,o=i.range.topRow,a=i.range.bottomRow,s=Math.min(r.length-1,a),d=this._cv.sourceCollection;this._chg={changedItems:{},cvLength:d.length};for(var c=o;c<=s;c++){var l=this._dataIndex(r[c]);l>-1&&this._addItemChange(c,l)}}else{this._isPasting=!1;i.getRow()instanceof t.grid._NewRowTemplate||this._gridBeginningEdit(e,i)}};ImmutabilityProvider.prototype._gridPasted=function(t,e){var r=this._chg;if(r&&1!==e.range.rowSpan){var o=this._cv.sourceCollection,a=r.cvLength,s=o.slice(a,o.length);this._doRowEditEnded(t,e);for(var d=0;d1&&(t=null);for(var r=0,o=i;r1)for(var s=a.length-2,d=i,c=0;c<=s;c++){var l=a[c];d[l]||(d[l]={});d=d[l]}}this._cloneProps(e,i);return e};ImmutabilityProvider.prototype._cloneProps=function(e,i){for(var n in i){var r=e[n];if(null!=r)if(t.isArray(r)){var o=e[n]=[].concat(r);this._cloneProps(o,i[n])}else if(t.isObject(r)){o=e[n]=copyObject({},r);this._cloneProps(o,i[n])}}};return ImmutabilityProvider}();e.ImmutabilityProvider=o;function copyObject(t){for(var e=[],i=1;i$1'))}};FlexGridSearch.prototype._itemsSourceChanged=function(){this._cv&&this._cv.filters.remove(this._filterBnd);var e=this._g?this._g.collectionView:null;this._cv=e instanceof t.collections.CollectionView?e:null;this._cv&&this._cv.filters.push(this._filterBnd)};FlexGridSearch.prototype._applySearch=function(){var e=this._g;this._rxSrch=this._rxHilite=null;var r=t.escapeRegExp(this.text).split(" ").filter((function(t){return t}));if(r.length){var n=e&&e.caseSensitiveSearch?"g":"gi";this._rxSrch=new RegExp("(?=.*"+r.join(")(?=.*")+")",n);r=r.map((function(e){return function _escapeHtml(e){e&&t.isString(e)&&(e=e.replace(/[&<>]/g,(function(t){return i[t]})));return null!=e?e.toString():""}(e)}));this._rxHilite=new RegExp("("+r.join("|")+")(?![^<]*>)",n)}var o=e?e.collectionView:null;o instanceof t.collections.CollectionView&&o.refresh()};FlexGridSearch.prototype._filter=function(t){if(this._rxSrch&&this._g){var e=this._getItemText(t);return this._rxSrch.test(e)}return!0};FlexGridSearch.prototype._getItemText=function(e){for(var r=[],i=this._g._getBindingColumns(),n=0;n":">"}}(e.search||(e.search={}))}(t.grid||(t.grid={}))}(wijmo||(wijmo={}));!function(t){!function(e){e.search||(e.search={}),t._registerModule("wijmo.grid.search",t.grid.search)}(t.grid||(t.grid={}))}(wijmo||(wijmo={})); -------------------------------------------------------------------------------- /out/controls/wijmo.grid.selector.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Wijmo Library 5.20213.824 4 | * http://wijmo.com/ 5 | * 6 | * Copyright(c) GrapeCity, Inc. All rights reserved. 7 | * 8 | * Licensed under the GrapeCity Commercial License. 9 | * sales@wijmo.com 10 | * wijmo.com/products/wijmo-5/license/ 11 | * 12 | */ 13 | 14 | var wijmo,__extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}();!function(e){var t;(function(t){var i="wj-column-selector",o=function(){function Selector(t,i){this._col=null;this._grid=null;this._isFixedCol=!1;this._isBound=!1;this._showCheckAll=!0;this._clickBnd=this._click.bind(this);this._mousedownBnd=this._mousedown.bind(this);this.columnChanging=new e.Event;this.columnChanged=new e.Event;this.itemChecked=new e.Event;this._initialize();this.column=this._getColumn(t);e.copy(this,i)}Object.defineProperty(Selector.prototype,"column",{get:function(){return this._col},set:function(t){if((t=this._getColumn(t))!=this._col&&this.onColumnChanging(new e.CancelEventArgs)){var i=this._grid;if(i){var o=i.hostElement;i.formatItem.removeHandler(this._formatItem,this);i.removeEventListener(o,"click",this._clickBnd);i.removeEventListener(o,"mousedown",this._mousedownBnd)}var n=this._col=e.asType(t,e.grid.Column,!0);this._grid=i=n?n.grid:null;this._isFixedCol=!!i&&i.columns.indexOf(n)<0;n&&!this._isBound&&(n.allowMerging=!1);i&&!this._isBound&&(i.selectionMode=e.grid.SelectionMode.Cell);if(i){o=i.hostElement;i.formatItem.addHandler(this._formatItem,this);i.addEventListener(o,"click",this._clickBnd,!0);i.addEventListener(o,"mousedown",this._mousedownBnd,!0)}this.onColumnChanged()}},enumerable:!0,configurable:!0});Object.defineProperty(Selector.prototype,"showCheckAll",{get:function(){return this._showCheckAll},set:function(t){if(t!=this._showCheckAll){this._showCheckAll=e.asBoolean(t);this._grid&&this._grid.invalidate()}},enumerable:!0,configurable:!0});Selector.prototype.onColumnChanging=function(e){this.columnChanging.raise(this,e);return!e.cancel};Selector.prototype.onColumnChanged=function(e){this.columnChanged.raise(this,e)};Selector.prototype.onItemChecked=function(e){this.itemChecked.raise(this,e)};Selector.prototype._initialize=function(){};Selector.prototype._click=function(t){if(!t.defaultPrevented&&t.target instanceof HTMLElement){var o=this._grid,n=this._col,s=t.target,r=o.hitTest(s);if(n&&r&&r.getColumn()==n){if(s instanceof HTMLInputElement&&e.hasClass(s,i)){var l=void 0,c=r.panel.rows,a=c[r.range.topRow];if(c==o.columnHeaders.rows){l=new e.grid.CellRange(0,0,o.rows.length-1,0);if(this._isBound){var d=o.selection;d.col=d.col2=n.index;o.select(d)}}else l=this._isGroupRow(a)?a.getCellRange():r.range;if(l.isValid){this._setRangeChecked(s.checked,l);this.onItemChecked()}o.invalidate();t.preventDefault();return}if(e.hasClass(s,"wj-cell")&&o.bigCheckboxes&&this._isBound&&(this._isFixedCol||this._isGroupRow(r.getRow()))){var h=s.querySelector("input."+i);if(h instanceof HTMLInputElement){h.click();t.preventDefault()}}}}};Selector.prototype._mousedown=function(t){var i=this._grid,o=this._col,n=i.editableCollectionView;if(this._isBound&&o&&n&&n.currentEditItem){var s=i.hitTest(t);if(s.getColumn()==o&&this._isGroupRow(s.getRow())){var r=e.closestClass(t.target,"wj-column-selector-group");r instanceof HTMLInputElement&&r.click()}}};Selector.prototype._isGroupRow=function(t){return t instanceof e.grid.GroupRow&&(!this._grid.childItemsPath||t.getCellRange().rowSpan>1)};Selector.prototype._getRowChecked=function(e,t){void 0===t&&(t=e);for(var i=0,o=0,n=this._col._binding,s=e;s<=t&&(!i||!o);s++){var r=this._grid.rows[s],l=r.dataItem;l&&!this._isGroupRow(r)&&((this._isBound?n.getValue(l):r.isSelected)?i++:o++)}return!(!i||o)||!(o&&!i)&&null};Selector.prototype._setRangeChecked=function(t,i){var o=this,n=this._grid,s=n.rows,r=this._col,l=r?r._binding:null,c=n.selection,a=this._isBound?n.editableCollectionView:null;if(!this._isBound||!n.isReadOnly&&a&&l){var d=!1;if(a){var h=!0;a instanceof e.collections.CollectionView&&!a.refreshOnEdit&&(h=!1);if(h){d=!0;a.beginUpdate()}}n.deferUpdate((function(){for(var c=i.bottomRow;c>=i.topRow;c--){var d=s[c],h=d.dataItem;if(h)if(o._isGroupRow(d))n.childItemsPath&&!o._isBound&&(d.isSelected=t);else if(o._isBound){if(h[r.binding]!=t){a&&a.editItem(h);var u=new e.grid.CellRange(c,r.index),g=new e.grid.CellEditEndingEventArgs(n.cells,u,h[r.binding]);if(n.onCellEditEnding(g)){l.setValue(h,t);n.onCellEditEnded(g)}}}else d.isSelected=t}}));if(a){a.commitEdit();d&&a.endUpdate();n.selection=c}}};Selector.prototype._formatItem=function(t,o){var n=o.getColumn(),s=t.editRange;if(n&&n==this._col&&(!s||!s.contains(o.row,o.col))&&o.panel.rows!=t.columnFooters.rows){var r=o.getRow(),l=o.cell,c="",a=void 0;if(o.panel.rows==t.columnHeaders.rows){if(this._showCheckAll&&o.range.bottomRow==o.panel.rows.length-1){a=this._getRowChecked(0,t.rows.length-1);c=i+" wj-column-selector-group"}}else if(this._isGroupRow(r)){var d=r.getCellRange();a=this._getRowChecked(d.row,d.row2);c=i+" wj-column-selector-group"}else if(r.dataItem&&!this._isBound){a=this._getRowChecked(o.row);c=i}if(c){if(this._isFixedCol||this._isBound&&this._isGroupRow(r)&&n.aggregate&&n.index>t.columns.firstVisibleIndex){var h=l.querySelector("."+e.grid.CellFactory._WJC_COLLAPSE);l.textContent="";h&&l.appendChild(h)}var u=e.createElement(''),g=u.querySelector("input");e.setChecked(g,a);if(this._isBound&&(n.isReadOnly||t.selectionMode==e.grid.SelectionMode.None)){g.disabled=!0;g.style.cursor="default"}l.insertBefore(u,l.firstChild)}}};Selector.prototype._getColumn=function(t){if(t instanceof e.grid.FlexGrid){var i=t,o=i.rowHeaders.columns;t=i.headersVisibility&e.grid.HeadersVisibility.Row&&o.length?o[0]:i.columns[0]}this._grid&&(e.isString(t)||e.isNumber(t))&&(t=this._grid.getColumn(t));return t instanceof e.grid.Column?t:null};return Selector}();t.Selector=o;var n=function(t){__extends(BooleanChecker,t);function BooleanChecker(e,i){return t.call(this,e,i)||this}BooleanChecker.prototype.onColumnChanged=function(i){var o=this.column,n=o?o.dataType:null;e.assert(!o||null==n||n==e.DataType.Boolean,"BooleanChecker should be bound to boolean columns");t.prototype.onColumnChanged.call(this,i)};BooleanChecker.prototype._initialize=function(){this._isBound=!0};return BooleanChecker}(o);t.BooleanChecker=n})((t=e.grid||(e.grid={})).selector||(t.selector={}))}(wijmo||(wijmo={}));!function(e){!function(t){t.selector||(t.selector={}),e._registerModule("wijmo.grid.selector",e.grid.selector)}(e.grid||(e.grid={}))}(wijmo||(wijmo={})); -------------------------------------------------------------------------------- /out/controls/wijmo.grid.transposed.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Wijmo Library 5.20213.824 4 | * http://wijmo.com/ 5 | * 6 | * Copyright(c) GrapeCity, Inc. All rights reserved. 7 | * 8 | * Licensed under the GrapeCity Commercial License. 9 | * sales@wijmo.com 10 | * wijmo.com/products/wijmo-5/license/ 11 | * 12 | */ 13 | 14 | var wijmo,__extends=this&&this.__extends||function(){var extendStatics=function(e,o){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var r in o)o.hasOwnProperty(r)&&(e[r]=o[r])})(e,o)};return function(e,o){extendStatics(e,o);function __(){this.constructor=e}e.prototype=null===o?Object.create(o):(__.prototype=o.prototype,new __)}}();!function(e){!function(o){!function(o){"use strict";var r=function(e){__extends(_MergeManager,e);function _MergeManager(){return null!==e&&e.apply(this,arguments)||this}_MergeManager.prototype.getMergedRange=function(o,r,n,t){void 0===t&&(t=!0);var i=o.grid;if(o==i.rowHeaders&&i._hasColumnGroups()){if(r<0||r>=o.rows.length||n<0||n>=o.columns.length)return null;var s=i._getColumnGroup(r,n);if(s){var a=s._rng,l=o.rows;if(l.isFrozen(a.row)!=l.isFrozen(a.row2)){a=a.clone();l.isFrozen(r)?a.row2=l.frozen-1:a.row=l.frozen}return a}return null}return e.prototype.getMergedRange.call(this,o,r,n,t)};return _MergeManager}(e.grid.MergeManager);o._MergeManager=r}(o.transposed||(o.transposed={}))}(e.grid||(e.grid={}))}(wijmo||(wijmo={}));!function(e){!function(o){!function(o){var r=function(r){__extends(TransposedGrid,r);function TransposedGrid(n,t){var i=r.call(this,n,null)||this;i._keyPrefix="item";i._autoGenRows=!0;e.addClass(i.hostElement,"wj-transposed-grid");i.allowSorting=e.grid.AllowSorting.None;i.headersVisibility=e.grid.HeadersVisibility.Row;i._rowInfo=new e.grid.ColumnCollection(i,i.columns.defaultSize);i._grpHdl=new o._RowGroupHandler(i);i.mergeManager=new o._MergeManager;i.initialize(t);i._rowInfo.collectionChanged.addHandler(i._rowInfoChanged,i);i.deferUpdate((function(){var e=i.rowHeaders.columns;if(e.length){e[e.length-1].width=i.columns.defaultSize}}));return i}Object.defineProperty(TransposedGrid.prototype,"autoGenerateRows",{get:function(){return this._autoGenRows},set:function(o){this._autoGenRows=e.asBoolean(o)},enumerable:!0,configurable:!0});Object.defineProperty(TransposedGrid.prototype,"rowGroups",{get:function(){return this._grpHdl.getGroupDefinitions()},set:function(o){var r=this;this._rowInfo.deferUpdate((function(){r.autoGenerateRows=!1;r._rowInfo.clear();r._grpHdl.createColumnGroups(e.asArray(o))}))},enumerable:!0,configurable:!0});TransposedGrid.prototype.refresh=function(e){var o=this._rowInfo;if(o._dirty){o._dirty=!1;this._rowInfoChanged()}else r.prototype.refresh.call(this,e)};Object.defineProperty(TransposedGrid.prototype,"allowAddNew",{get:function(){return!1},set:function(e){},enumerable:!0,configurable:!0});Object.defineProperty(TransposedGrid.prototype,"allowDelete",{get:function(){return!1},set:function(e){},enumerable:!0,configurable:!0});Object.defineProperty(TransposedGrid.prototype,"allowSorting",{get:function(){return e.grid.AllowSorting.None},set:function(o){e.assert(o===e.grid.AllowSorting.None,"TransposedGrid does not support sorting.");this._alSorting=o},enumerable:!0,configurable:!0});Object.defineProperty(TransposedGrid.prototype,"columnGroups",{get:function(){return null},set:function(e){throw"TransposedGrid does not support columnGroups, use rowGroups instead."},enumerable:!0,configurable:!0});TransposedGrid.prototype.onRowEditEnded=function(o){var n=e.tryCast(this._sourceItems,"ICollectionView");if(n){var t=new e.collections.NotifyCollectionChangedEventArgs(e.collections.NotifyCollectionChangedAction.Change);n.collectionChanged.raise(n,t)}r.prototype.onRowEditEnded.call(this,o)};TransposedGrid.prototype._getCollectionView=function(o){var n=this,t=e.tryCast(this._sourceItems,"ICollectionView");t&&t.collectionChanged.removeHandler(this._sourceViewChanged);t=e.tryCast(o,"ICollectionView");var i=o;if(e.isArray(o))i=this._transposeItemsSource(o);else if(t){t.collectionChanged.addHandler(this._sourceViewChanged,this);i=this._transposeItemsSource(t.items)}this.autoGenerateColumns=!0;var s=r.prototype._getCollectionView.call(this,i),a=null;t instanceof e.collections.CollectionView&&(a=t.getError);a&&s instanceof e.collections.CollectionView&&(this._supportsProxies()?s.getError=function(e,o){if(null==o)return null;var r=e._keys.indexOf(o);return a(e._arr[r],e._bnd.path)}:s.getError=function(e,o){if(null==o)return null;var r=parseInt(o.substr(n._keyPrefix.length));return a(e._arr[r],e._rowInfo.binding)});this._sourceItems=o;return s};TransposedGrid.prototype._getColumnTypes=function(o){var r,n=this;if(this._sourceItems)if(e.isArray(this._sourceItems))r=this._sourceItems;else{var t=e.tryCast(this._sourceItems,"ICollectionView");t&&(r=t.items)}return r?r.map((function(o,r){return{binding:n._keyPrefix+r,dataType:e.DataType.Object}})):e.getTypes(o)};TransposedGrid.prototype._copy=function(o,t){var i=this;if(/rows|columns/.test(o)){e.assert(e.isArray(t),"Array Expected.");var s=e.asArray(t);s.some((function(e){return null!=e.columns}))?this.rowGroups=s:this._rowInfo.deferUpdate((function(){i.autoGenerateRows=!1;i._rowInfo.clear();t.forEach((function(e){var o=new n(e);i._rowInfo.push(o)}))}));return!0}return r.prototype._copy.call(this,o,t)};TransposedGrid.prototype.onLoadedRows=function(o){for(var n=this,t=this.columns,i=0;i-1&&-1===t.indexOf(i)){var s=o[i];if(!e.isUndefined(s))try{r[i]=s}catch(e){}}};TransposedGrid.prototype._updateRowHeaders=function(o,r,n){var t=n.header||e.toHeaderCase(n.binding);this.rowHeaders.setCellData(o,r,t);var i=this.rowHeaders.columns,s=n.width;if(e.isNumber(s)&&s>0){var a=n._rng;if(a&&a instanceof e.grid.CellRange&&a.isValid){var l=a.columnSpan;e.assert(l>0,"Column span is negative or equal to 0");s/=l}i[r].width=Math.max(i[r].width,s)}};TransposedGrid.prototype._rowInfoChanged=function(){var o=this;this._toRowInfo&&clearTimeout(this._toRowInfo);this._toRowInfo=setTimeout((function(){var e=o.selection,r=o.itemsSource;o.itemsSource=null;o.itemsSource=r;o.selection=e}),e.Control._REFRESH_INTERVAL)};TransposedGrid.prototype._sourceViewChanged=function(e,o){this.activeEditor||this.invalidate()};TransposedGrid.prototype._transposeItemsSource=function(o){var r=this,n=new e.collections.ObservableArray,t=e.getTypes(o),i=o.map((function(e,o){return r._keyPrefix+o}));(this.autoGenerateRows?this._getRowInfo(o):this._rowInfo).forEach((function(s,a){var l=new e.Binding(s.binding);if(null==s.dataType&&o.length){var u=l.getValue(o[0]);s.dataType=null!=u?e.getType(u):t[a].dataType}if(r._supportsProxies()){var c=r._createProxy(o,s,i);n.push(c)}else{var p=r._createTransposedObject(o,s,r._keyPrefix);n.push(p)}}));o instanceof e.collections.ObservableArray&&o.collectionChanged.addHandler((function(o,t){if(t.action===e.collections.NotifyCollectionChangedAction.Change)r.activeEditor||r.invalidate();else{var i=new e.collections.NotifyCollectionChangedEventArgs(e.collections.NotifyCollectionChangedAction.Reset);n.onCollectionChanged(i);r._rowInfoChanged()}}));return n};TransposedGrid.prototype._supportsProxies=function(){return null!=window.Proxy};TransposedGrid.prototype._createProxy=function(o,r,n){var t={_arr:o,_rowInfo:r,_bnd:new e.Binding(r.binding),_keys:n};return new Proxy(t,{ownKeys:function(e){return e._keys},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!0}},get:function(e,o){var r=e._keys.indexOf(o);return r>-1?e._bnd.getValue(e._arr[r]):e[o]},set:function(o,r,n){var t=o._keys.indexOf(r);if(t>-1){var i=o._arr,s=i[t];o._bnd.setValue(s,n);if(i instanceof e.collections.ObservableArray){var a=new e.collections.NotifyCollectionChangedEventArgs(e.collections.NotifyCollectionChangedAction.Change,s,t);i.onCollectionChanged(a)}return!0}return!1}})};TransposedGrid.prototype._createTransposedObject=function(o,r,n){for(var t={_arr:o,_rowInfo:r},i=new e.Binding(r.binding),_loop_1=function(r){var s=o[r];Object.defineProperty(t,n+r,{enumerable:!0,get:function(){return i.getValue(s)},set:function(n){i.setValue(s,n);if(o instanceof e.collections.ObservableArray){var t=new e.collections.NotifyCollectionChangedEventArgs(e.collections.NotifyCollectionChangedAction.Change,s,r);o.onCollectionChanged(t)}return!0}})},s=0;s0&&(s.width=a)}n.push(s)}}));return n};return TransposedGrid}(e.grid.FlexGrid);o.TransposedGrid=r;var n=function(e){__extends(TransposedGridRow,e);function TransposedGridRow(){return null!==e&&e.apply(this,arguments)||this}Object.defineProperty(TransposedGridRow.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e},enumerable:!0,configurable:!0});return TransposedGridRow}(e.grid.Column);o.TransposedGridRow=n}(o.transposed||(o.transposed={}))}(e.grid||(e.grid={}))}(wijmo||(wijmo={}));!function(e){var o;(function(o){var r=function(){function _RowGroupHandler(e){this._grid=e}Object.defineProperty(_RowGroupHandler.prototype,"columnGroups",{get:function(){return null},enumerable:!0,configurable:!0});_RowGroupHandler.prototype.createColumnGroups=function(e){this._createRowGroups(e)};_RowGroupHandler.prototype.hasColumnGroups=function(){return null!=this._colGroups&&this._colGroups.length>0};_RowGroupHandler.prototype.getGroupDefinitions=function(){return this._groupDefs};_RowGroupHandler.prototype.getColumnGroup=function(e,o){var r=this._grid;if(o-1&&(n=t)}for(var i=o.topRow;i<=o.bottomRow;i++)e[i].visible=!r||i==n};_RowGroup.prototype._getMaxLevel=function(){var e=this._lvl;this.columns.forEach((function(o){e=Math.max(e,o._getMaxLevel())}));return e};_RowGroup.prototype._expandRange=function(e){var o=e-this._getMaxLevel();if(o>0){this._rng.col2+=o;this._cols.forEach((function(e){e._shiftRange(o)}))}for(var r=this._grid._rowInfo,n=this._rng,t=n.row;t<=n.row2;t++)r[t]._rng.col2=e};_RowGroup.prototype._shiftRange=function(e){this._rng.col+=e;this._rng.col2+=e;this._cols.forEach((function(o){o._shiftRange(e)}))};return _RowGroup}(e.grid.Column);o._RowGroup=n})((o=e.grid||(e.grid={})).transposed||(o.transposed={}))}(wijmo||(wijmo={}));!function(e){!function(o){o.transposed||(o.transposed={}),e._registerModule("wijmo.grid.transposed",e.grid.transposed)}(e.grid||(e.grid={}))}(wijmo||(wijmo={})); -------------------------------------------------------------------------------- /out/controls/wijmo.rest.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Wijmo Library 5.20213.824 4 | * http://wijmo.com/ 5 | * 6 | * Copyright(c) GrapeCity, Inc. All rights reserved. 7 | * 8 | * Licensed under the GrapeCity Commercial License. 9 | * sales@wijmo.com 10 | * wijmo.com/products/wijmo-5/license/ 11 | * 12 | */ 13 | 14 | var wijmo,__extends=this&&this.__extends||function(){var extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};return function(e,t){extendStatics(e,t);function __(){this.constructor=e}e.prototype=null===t?Object.create(t):(__.prototype=t.prototype,new __)}}(),__awaiter=this&&this.__awaiter||function(e,t,r,i){return new(r||(r=Promise))((function(o,n){function fulfilled(e){try{step(i.next(e))}catch(e){n(e)}}function rejected(e){try{step(i.throw(e))}catch(e){n(e)}}function step(e){e.done?o(e.value):new r((function(t){t(e.value)})).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,i,o,n,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return n={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function verb(n){return function(a){return function step(n){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(o=2&n[0]?i.return:n[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,n[1])).done)return o;(i=0,o)&&(n=[2&n[0],o.value]);switch(n[0]){case 0:case 1:o=n;break;case 4:s.label++;return{value:n[1],done:!1};case 5:s.label++;i=n[1];n=[0];continue;case 7:n=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]-1)try{var i=this.patchItem(r);i&&i.then&&i.then((function(){return e.refresh()}))}catch(e){this._raiseError(e,!0)}t.prototype.commitEdit.call(this)};RestCollectionView.prototype.remove=function(e){var r=this;if(e&&e!=this.currentAddItem&&this.items.indexOf(e)>-1)try{var i=this.deleteItem(e);i&&i.then&&i.then((function(){return r.refresh()}))}catch(e){this._raiseError(e,!0)}t.prototype.remove.call(this,e)};RestCollectionView.prototype._getPageView=function(){return this.pageOnServer?this._view:t.prototype._getPageView.call(this)};RestCollectionView.prototype._getData=function(){var e=this;this._toGetData&&clearTimeout(this._toGetData);this._toGetData=setTimeout((function(){return __awaiter(e,void 0,void 0,(function(){var e,t,r,i;return __generator(this,(function(o){switch(o.label){case 0:this._toGetData=null;this._loading=!0;this.onLoading();e=null;t=null;o.label=1;case 1:o.trys.push([1,3,,4]);r=this.currentPosition;return[4,this.getItems()];case 2:e=o.sent();this.sourceCollection=e;this.refresh();r>-1&&this.moveCurrentToPosition(r);this.pageIndex>0&&this.pageIndex>=this.pageCount&&this.moveToLastPage();return[3,4];case 3:i=o.sent();t=i;return[3,4];case 4:this._loading=!1;this.onLoaded();t&&this._raiseError(t,!1);return[2]}}))}))}),100)};RestCollectionView.prototype._raiseError=function(e,t){if(this.onError(new i(e))){t&&this._getData();throw"Server Error: "+e}};RestCollectionView.prototype.getItems=function(){throw"This method is virtual: it should be overridden"};RestCollectionView.prototype.addItem=function(e){throw"This method is virtual: it should be overridden"};RestCollectionView.prototype.patchItem=function(e){throw"This method is virtual: it should be overridden"};RestCollectionView.prototype.deleteItem=function(e){throw"This method is virtual: it should be overridden"};return RestCollectionView}(e.collections.CollectionView);t.RestCollectionView=r;var i=function(e){__extends(RESTErrorEventArgs,e);function RESTErrorEventArgs(t){var r=e.call(this)||this;r._error=t;return r}Object.defineProperty(RESTErrorEventArgs.prototype,"error",{get:function(){return this._error},enumerable:!0,configurable:!0});return RESTErrorEventArgs}(e.CancelEventArgs);t.RESTErrorEventArgs=i}(e.rest||(e.rest={}))}(wijmo||(wijmo={}));!function(e){e.rest||(e.rest={}),e._registerModule("wijmo.rest",e.rest)}(wijmo||(wijmo={})); -------------------------------------------------------------------------------- /out/controls/wijmo.touch.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Wijmo Library 5.20213.824 4 | * http://wijmo.com/ 5 | * 6 | * Copyright(c) GrapeCity, Inc. All rights reserved. 7 | * 8 | * Licensed under the GrapeCity Commercial License. 9 | * sales@wijmo.com 10 | * wijmo.com/products/wijmo-5/license/ 11 | * 12 | */ 13 | 14 | var wijmo;!function(t){!function(e){var o=function(){function DataTransfer(){this._dropEffect="move";this._effectAllowed="all";this._data={}}Object.defineProperty(DataTransfer.prototype,"dropEffect",{get:function(){return this._dropEffect},set:function(e){this._dropEffect=t.asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"effectAllowed",{get:function(){return this._effectAllowed},set:function(e){this._effectAllowed=t.asString(e)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"types",{get:function(){return Object.keys(this._data)},enumerable:!0,configurable:!0});DataTransfer.prototype.clearData=function(t){null!=t?delete this._data[t]:this._data=null};DataTransfer.prototype.getData=function(t){return this._data[t]||""};DataTransfer.prototype.setData=function(t,e){this._data[t]=e};DataTransfer.prototype.setDragImage=function(e,o,i){var n=r._instance;n._imgCustom=e;n._imgOffset=new t.Point(o,i)};return DataTransfer}();e.DataTransfer=o;var r=function(){function DragDropTouch(){this._lastClick=0;t.assert(!DragDropTouch._instance,"DragDropTouch instance already created.");var e=!1;document.addEventListener("test",(function(){}),{get passive(){e=!0;return!0}});var o=document,r=this._touchstart.bind(this),i=this._touchmove.bind(this),n=this._touchend.bind(this),a=!!e&&{passive:!1,capture:!1};o.addEventListener("touchstart",r,a);o.addEventListener("touchmove",i,a);o.addEventListener("touchend",n);o.addEventListener("touchcancel",n)}DragDropTouch.getInstance=function(){return DragDropTouch._instance};DragDropTouch.prototype._touchstart=function(e){if(this._shouldHandle(e)){var o=e.target;if(Date.now()-this._lastClickDragDropTouch._THRESHOLD){this._dispatchEvent(t,"dragstart",this._dragSource);this._createImage(t);this._dispatchEvent(t,"dragenter",e)}}if(this._img){t.preventDefault();if(e!=this._lastTarget){this._dispatchEvent(t,"dragleave",this._lastTarget);this._dispatchEvent(t,"dragenter",e);this._lastTarget=e}this._moveImage(t);this._dispatchEvent(t,"dragover",e)}}};DragDropTouch.prototype._touchend=function(t){if(this._shouldHandle(t)){var e=t.target,o=this._lastTouch;if(this._dispatchEvent(o,"mouseup",e)){t.preventDefault();return}this._destroyImage();if(this._dragSource){t.type.indexOf("cancel")<0&&this._dispatchEvent(o,"drop",this._lastTarget);this._dispatchEvent(o,"dragend",this._dragSource);this._reset()}}};DragDropTouch.prototype._shouldHandle=function(t){return t&&!t.defaultPrevented&&t.touches&&t.touches.length<2};DragDropTouch.prototype._reset=function(){this._destroyImage();this._dragSource=null;this._lastTouch=null;this._lastTarget=null;this._ptDown=null;this._dataTransfer=new o};DragDropTouch.prototype._getPoint=function(e,o){e&&e.touches&&(e=e.touches[0]);t.assert(e&&"clientX"in e,"invalid event?");return 1==o?new t.Point(e.pageX,e.pageY):new t.Point(e.clientX,e.clientY)};DragDropTouch.prototype._getDelta=function(t){var e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)};DragDropTouch.prototype._getTarget=function(t){for(var e=this._getPoint(t),o=document.elementFromPoint(e.x,e.y);o&&"none"==getComputedStyle(o).pointerEvents;)o=o.parentElement;return o};DragDropTouch.prototype._createImage=function(e){this._img&&this._destroyImage();var o=this._imgCustom||this._dragSource;this._img=o.cloneNode(!0);this._copyStyle(o,this._img);this._img.style.top=this._img.style.left="-9999px";if(!this._imgCustom){var r=o.getBoundingClientRect(),i=this._getPoint(e);this._imgOffset=new t.Point(i.x-r.left,i.y-r.top);this._img.style.opacity=DragDropTouch._OPACITY.toString()}this._moveImage(e);document.body.appendChild(this._img)};DragDropTouch.prototype._destroyImage=function(){this._img&&this._img.parentElement&&this._img.parentElement.removeChild(this._img);this._img=null;this._imgCustom=null};DragDropTouch.prototype._moveImage=function(e){var o=this;requestAnimationFrame((function(){if(o._img){var r=o._getPoint(e,!0);t.setCss(o._img,{position:"absolute",pointerEvents:"none",zIndex:999999,left:Math.round(r.x-o._imgOffset.x),top:Math.round(r.y-o._imgOffset.y)})}}))};DragDropTouch.prototype._copyProps=function(t,e,o){for(var r in e)o.test(r)&&(t[r]=e[r])};DragDropTouch.prototype._copyStyle=function(t,e){["id","class","style","draggable"].forEach((function(t){e.removeAttribute(t)}));if(t instanceof HTMLCanvasElement){var o=t,r=e;r.width=o.width;r.height=o.height;r.getContext("2d").drawImage(o,0,0)}for(var i=getComputedStyle(t),n=0;n { 112 | preserveState(); 113 | autoSizeVisibleRows(flex, true); 114 | }); 115 | } 116 | }); 117 | 118 | flex.sortingColumn.addHandler(function(s, e) { 119 | preserveState(); 120 | autoSizeVisibleRows(flex, true); 121 | }); 122 | 123 | var numbersOrdinal = options.lineNumbers === "ordinal"; 124 | var numbersSource = options.lineNumbers === "source"; 125 | var lineNumbers = numbersOrdinal || numbersSource; 126 | 127 | flex.formatItem.addHandler(function(s, e) { 128 | if (lineNumbers) { 129 | if (e.panel.cellType == wijmo.grid.CellType.RowHeader) { 130 | var row = flex.rows[e.row]; 131 | if (!(row instanceof wijmo.grid._NewRowTemplate)) { 132 | if (numbersSource) { 133 | var source = flex.collectionView.sourceCollection; 134 | var n = source.indexOf(row.dataItem) + 1; 135 | e.cell.textContent = n.toString(); 136 | } else if (numbersOrdinal) { 137 | e.cell.textContent = (e.row + 1).toString(); 138 | } 139 | } 140 | } 141 | } 142 | if (options.capitalizeHeaders) { 143 | if (e.panel.cellType == wijmo.grid.CellType.ColumnHeader) { 144 | var html = e.cell.innerHTML; 145 | var text = e.cell.innerText.trim(); 146 | var n = html.lastIndexOf(text); 147 | text = wijmo.toHeaderCase(text); 148 | if (n > 0) { 149 | e.cell.innerHTML = html.slice(0, n) + text + html.slice(n + text.length); 150 | } else { 151 | e.cell.innerHTML = text; 152 | } 153 | } 154 | } 155 | }); 156 | 157 | flex.resizedColumn.addHandler(() => { 158 | preserveState(); 159 | autoSizeVisibleRows(flex, true); 160 | }); 161 | 162 | flex.scrollPositionChanged.addHandler(() => { 163 | preserveState(); 164 | autoSizeVisibleRows(flex, false); 165 | }); 166 | 167 | flex.cellEditEnding.addHandler(function(s, e) { 168 | var active = s.activeEditor.value; 169 | var dataItem = s.rows[e.row].dataItem; 170 | var binding = s.columns[e.col].binding; 171 | dataItem[binding] = active; 172 | }); 173 | 174 | function countNewlines(obj) { 175 | var count = 0; 176 | Object.keys(obj).forEach(key => { 177 | var value = obj[key]; 178 | if (typeof value === 'string') { 179 | count += value.split("\n").length - 1; 180 | } 181 | }); 182 | return count; 183 | } 184 | 185 | function getRowRange(s, index) { 186 | var gridRow = s.rows[index]; 187 | var source = s.collectionView.sourceCollection; 188 | var sourceRow = source.indexOf(gridRow.dataItem); 189 | var sourceItem = source[sourceRow]; 190 | var rangeStart = sourceRow, rangeEnd; 191 | source.slice(0, sourceRow).forEach(r => rangeStart += r[NEWLINES]); 192 | rangeEnd = rangeStart + sourceItem[NEWLINES] + 1; 193 | sourceItem[NEWLINES] = countNewlines(sourceItem); 194 | return { start: rangeStart, end: rangeEnd }; 195 | } 196 | 197 | function cellEditEnded(s, e) { 198 | var oldValue = e.data; 199 | var newValue = s.getCellData(e.row, e.col); 200 | if (oldValue !== newValue) { 201 | var range = getRowRange(s, e.row); 202 | vscode.postMessage({ 203 | cellEditEnded: true, 204 | rows: range, 205 | col: e.col, 206 | value: newValue 207 | }); 208 | } 209 | } 210 | 211 | flex.cellEditEnded.addHandler(function(s, e) { 212 | cellEditEnded(s, e); 213 | }); 214 | 215 | flex.pastedCell.addHandler(function(s, e) { 216 | cellEditEnded(s, e); 217 | }); 218 | 219 | flex.rowEditEnded.addHandler(function(s, e) { 220 | vscode.postMessage({ 221 | rowEditEnded: true, 222 | cancel: e.cancel 223 | }); 224 | }); 225 | 226 | flex.deletingRow.addHandler(function(s, e) { 227 | if (e.cancel) return; 228 | e.cancel = true; 229 | var sourceRows = [], indexRows = []; 230 | var source = s.collectionView.sourceCollection; 231 | for (var n = s.selection.topRow; n <= s.selection.bottomRow; n++) { 232 | var gridRow = s.rows[n]; 233 | var sourceRow = source.indexOf(gridRow.dataItem); 234 | var rangeStart = sourceRow, rangeEnd; 235 | source.slice(0, sourceRow).forEach(r => rangeStart += r[NEWLINES]); 236 | rangeEnd = rangeStart + source[sourceRow][NEWLINES] + 1; 237 | sourceRows.push({start: rangeStart, end: rangeEnd}); 238 | indexRows.push(n); 239 | } 240 | indexRows.reverse(); 241 | indexRows.forEach((n) => { 242 | s.editableCollectionView.removeAt(n); 243 | }); 244 | vscode.postMessage({ 245 | deleteRows: true, 246 | rows: sourceRows 247 | }); 248 | }); 249 | 250 | flex.rowAdded.addHandler(function(s, e) { 251 | vscode.postMessage({ 252 | rowAdded: true, 253 | count: s.columns.length 254 | }); 255 | }); 256 | 257 | vscode.postMessage({ refresh: true }); 258 | } 259 | 260 | function parseContent(text) { 261 | const options = getOptions(); 262 | var sep = options.separator; 263 | var quote = options.quoteMark; 264 | var hasHeaders = options.hasHeaders; 265 | var comment = options.commentCharacter; 266 | var skip = options.skipComments; 267 | var formatAlways = options.formatValues === "always"; 268 | var formatUnquoted = options.formatValues === "unquoted"; 269 | var format = options.numberFormat; 270 | 271 | var regexQuote = new RegExp(`^${quote}([\\S\\s]*)${quote}$`); 272 | var regexDoubleQuote = new RegExp(`${quote}${quote}`, 'g'); 273 | var regexComment = new RegExp(String.raw`^\s*${comment}|^\s+$`); 274 | 275 | // based on https://softwareengineering.stackexchange.com/a/368124 276 | var regexLines = new RegExp(`((${quote}(?:[^${quote}]|)+${quote}|[^${quote}\n\r]+)+)`, 'g'); 277 | 278 | // http://markmintoff.com/2013/03/regex-split-by-comma-not-surrounded-by-quotes/ 279 | var regexItems = new RegExp(`${sep}(?=(?:[^${quote}]*${quote}[^${quote}]*${quote})*[^${quote}]*$)`); 280 | 281 | function unquote(cell) { 282 | if (cell.text.length > 0) { 283 | var match = regexQuote.exec(cell.text); 284 | if (match) { 285 | cell.quoted = true; 286 | return dblquote(match[1]); 287 | } 288 | } 289 | return cell.text; 290 | } 291 | 292 | function dblquote(text) { 293 | return text.length > 1 ? text.replace(regexDoubleQuote, `${quote}`) : text; 294 | } 295 | 296 | function isComment(text) { 297 | return !skip ? false : ((text.length > 0) ? regexComment.exec(text) : true); 298 | } 299 | 300 | function isSep(text) { 301 | var line = text.replace(/ /g, ""); 302 | var left = line.slice(0, 4).toLowerCase(); 303 | var result = (left === "sep="); 304 | if (result && line.length == 5) { 305 | var escapes = `+*?^$\.[]{}()|/`; 306 | var char = line.slice(4); 307 | sep = (escapes.indexOf(char) >= 0) ? "\\".concat(char) : char; 308 | regexItems = new RegExp(`${sep}(?=(?:[^${quote}]*${quote}[^${quote}]*${quote})*[^${quote}]*$)`); 309 | sendMessage({ 310 | separator: sep 311 | }); 312 | } 313 | return result; 314 | } 315 | 316 | function getBinding(n) { 317 | var h1 = Math.floor(n / 26); 318 | var h2 = n % 26; 319 | if (h1 > 0) { 320 | return String.fromCharCode(64 + h1) + String.fromCharCode(65 + h2); 321 | } else { 322 | return String.fromCharCode(65 + h2); 323 | } 324 | } 325 | 326 | var data = [], headers = [], bindings = []; 327 | var lines = text.match(regexLines); 328 | var firstLine = hasHeaders; 329 | var maxLength = 0; 330 | 331 | for (var i = 0; i < lines.length; i++) { 332 | var line = lines[i].replace("\r", ""); 333 | if (i == 0 && isSep(line)) { 334 | continue; 335 | } 336 | if (!isComment(line)) { 337 | var items = line.split(regexItems); 338 | if (items.length > maxLength) { 339 | maxLength = items.length; 340 | } 341 | if (firstLine) { 342 | for (var j = 0; j < items.length; j++) { 343 | var cell = { text: items[j] }; 344 | headers.push(unquote(cell)); 345 | } 346 | firstLine = false; 347 | } else { 348 | var obj = {}; 349 | obj["__newlines"] = line.split("\n").length - 1; 350 | for (var j = 0; j < items.length; j++) { 351 | var cell = { text: items[j], quoted: false }; 352 | var value = unquote(cell); 353 | if (formatAlways || (formatUnquoted && !cell.quoted)) { 354 | var num = value.length ? Number(value) : NaN; 355 | obj[getBinding(j)] = isNaN(num) ? value : num; 356 | } else { 357 | obj[getBinding(j)] = value; 358 | } 359 | } 360 | if (line.length > 0 || (i < lines.length - 1)) { 361 | data.push(obj); 362 | } 363 | } 364 | } 365 | } 366 | 367 | for (var i = 0; i < maxLength; i++) { 368 | var key = getBinding(i); 369 | var header = (headers.length > i) ? headers[i] : hasHeaders ? "" : key; 370 | bindings.push({ 371 | binding: key, 372 | header: header.length > 0 ? header : " ", 373 | format: format, 374 | multiLine: true 375 | }); 376 | } 377 | 378 | return { 379 | data: data, 380 | bindings: bindings 381 | } 382 | } 383 | 384 | function resizeGrid() { 385 | var div = wijmo.getElement("#flex"); 386 | div.style.height = window.innerHeight.toString() + "px"; 387 | } 388 | 389 | function handleEvents() { 390 | window.addEventListener("message", event => { 391 | if (event.data.refresh) { 392 | var flex = wijmo.Control.getControl("#flex"); 393 | var content = parseContent(event.data.content); 394 | flex.beginUpdate(); 395 | flex.columns.clear(); 396 | content.bindings.forEach((b) => { 397 | flex.columns.push(new wijmo.grid.Column(b)); 398 | }); 399 | flex.itemsSource = content.data; 400 | flex.endUpdate(); 401 | } 402 | }); 403 | } 404 | -------------------------------------------------------------------------------- /out/excel.js: -------------------------------------------------------------------------------- 1 | var sendMessage; 2 | 3 | function initPage() { 4 | const vscode = acquireVsCodeApi(); 5 | const options = getOptions(); 6 | sendMessage = vscode.postMessage; 7 | 8 | var sheet = new wijmo.grid.sheet.FlexSheet("#sheet"); 9 | wijmo.setCss(sheet.hostElement, { "font-family": "" }); 10 | 11 | function getState() { 12 | var sorts = []; 13 | var items = sheet.sortManager.sortDescriptions.items; 14 | for (var i = 0; i < items.length; i++) { 15 | var desc = items[i]; 16 | sorts.push({ 17 | columnIndexvar: desc.columnIndex, 18 | ascending: desc.ascending 19 | }); 20 | } 21 | var state = { 22 | uri: options.uri, 23 | previewUri: options.previewUri, 24 | selectedSheetIndex: sheet.selectedSheetIndex, 25 | filterDefinition: sheet.filter.filterDefinition, 26 | sortDescriptions: JSON.stringify(sorts), 27 | scrollPosition: sheet.scrollPosition, 28 | version: "4.0.45" 29 | }; 30 | return state; 31 | } 32 | 33 | function preserveState() { 34 | var state = getState(); 35 | vscode.setState(state); 36 | vscode.postMessage({ save: true, state: state }); 37 | } 38 | 39 | function applyState() { 40 | if (ignoreState()) return; 41 | var json = vscode.getState() || options.state; 42 | if (json && json.version && json.version >= "4.0.45") { 43 | if (json.selectedSheetIndex >= 0) { 44 | sheet.selectedSheetIndex = json.selectedSheetIndex; 45 | } 46 | sheet.filter.filterDefinition = json.filterDefinition; 47 | if (json.sortDescriptions) { 48 | var sorts = JSON.parse(json.sortDescriptions); 49 | sorts = sorts.map((s) => { 50 | return new wijmo.grid.sheet.ColumnSortDescription(s.columnIndex, s.ascending); 51 | }); 52 | sheet.sortManager.sortDescriptions = new wijmo.collections.CollectionView(sorts); 53 | } 54 | if (json.scrollPosition) { 55 | sheet.scrollPosition = json.scrollPosition; 56 | } 57 | } 58 | } 59 | 60 | // http://jsfiddle.net/Wijmo5/2a20kqvr/ 61 | function autoSizeVisibleRows(flex, force) { 62 | var rng = flex.viewRange; 63 | for (var r = rng.row; r <= rng.row2; r++) { 64 | if (force || flex.rows[r].height == null) { 65 | flex.autoSizeRow(r, false); 66 | } 67 | } 68 | } 69 | 70 | var news = wijmo.getElement("[wj-part='new-sheet']"); 71 | news.parentElement.removeChild(news); 72 | 73 | sheet.hostElement.addEventListener("contextmenu", e => { 74 | if (!options.customEditor || e.target.tagName.toLowerCase() === "li") { 75 | e.preventDefault(); 76 | e.stopPropagation(); 77 | } 78 | }, true); 79 | 80 | sheet.loaded.addHandler(() => { 81 | sheet.columns.forEach(c => c.isContentHtml = c.multiLine = true); 82 | var style = getSheetStyle(sheet); 83 | sheet.sheets.forEach(s => { 84 | s.tables.forEach(t => { 85 | t.style = style; 86 | }); 87 | }); 88 | sheet.isReadOnly = !options.customEditor; 89 | sheet.showMarquee = false; 90 | applyState(); 91 | preserveState(); 92 | 93 | setTimeout(() => { 94 | sheet.autoSizeColumn(0, true); 95 | autoSizeVisibleRows(sheet, true); 96 | }, 0); 97 | 98 | sheet.filter.filterApplied.addHandler(() => { 99 | preserveState(); 100 | }); 101 | 102 | sheet.selectedSheetChanged.addHandler(() => { 103 | preserveState(); 104 | sheet.autoSizeColumn(0, true); 105 | }); 106 | 107 | sheet.sortManager.sortDescriptions.collectionChanged.addHandler(() => { 108 | preserveState(); 109 | }); 110 | 111 | sheet.scrollPositionChanged.addHandler(() => { 112 | preserveState(); 113 | }); 114 | 115 | sheet.sheets.collectionChanged.addHandler((s, e) => { 116 | vscode.postMessage({ 117 | changed: true, 118 | reason: "Collection Changed" 119 | }); 120 | }); 121 | 122 | sheet.rowChanged.addHandler((s, e) => { 123 | vscode.postMessage({ 124 | changed: true, 125 | reason: "Row Changed" 126 | }); 127 | }); 128 | 129 | sheet.columnChanged.addHandler((s, e) => { 130 | vscode.postMessage({ 131 | changed: true, 132 | reason: "Column Changed" 133 | }); 134 | }); 135 | 136 | sheet.cellEditEnded.addHandler(function(s, e) { 137 | vscode.postMessage({ 138 | changed: true, 139 | reason: "Cell Edited" 140 | }); 141 | }); 142 | }); 143 | 144 | vscode.postMessage({ refresh: true }); 145 | } 146 | 147 | function resizeSheet() { 148 | var div = wijmo.getElement("#sheet"); 149 | div.style.height = window.innerHeight.toString() + "px"; 150 | } 151 | 152 | function cssVar(name, value) { 153 | if (name.substr(0, 2) !== "--") { 154 | name = "--" + name; 155 | } 156 | if (value) { 157 | document.documentElement.style.setProperty(name, value) 158 | } 159 | return getComputedStyle(document.documentElement).getPropertyValue(name); 160 | } 161 | 162 | function getSheetStyle(sheet) { 163 | var style = sheet.getBuiltInTableStyle("TableStyleLight1"); 164 | style.wholeTableStyle.borderTopColor = cssVar("vscode-editor-foreground"); 165 | style.wholeTableStyle.borderBottomColor = cssVar("vscode-editor-foreground"); 166 | style.wholeTableStyle.color = cssVar("vscode-editor-foreground"); 167 | style.wholeTableStyle.backgroundColor = cssVar("vscode-editor-background"); 168 | style.firstBandedRowStyle.color = cssVar("vscode-sideBar-foreground"); 169 | style.firstBandedRowStyle.backgroundColor = cssVar("vscode-sideBar-background"); 170 | style.firstBandedColumnStyle.color = cssVar("vscode-sideBar-foreground"); 171 | style.firstBandedColumnStyle.backgroundColor = cssVar("vscode-sideBar-background"); 172 | style.headerRowStyle.color = cssVar("vscode-titleBar-activeForeground"); 173 | style.headerRowStyle.backgroundColor = cssVar("vscode-titleBar-activeBackground"); 174 | style.headerRowStyle.borderBottomColor = cssVar("vscode-tree-indentGuidesStroke"); 175 | return style; 176 | } 177 | 178 | function handleEvents() { 179 | window.addEventListener("message", event => { 180 | var sheet = wijmo.Control.getControl("#sheet"); 181 | if (event.data.refresh) { 182 | var data = event.data.content.data ?? event.data.content; 183 | var blob = new Blob([new Uint8Array(data)]); 184 | sheet.load(blob); 185 | } 186 | else if (event.data.type == "getData") { 187 | var workbook = sheet.save(); 188 | var base64 = workbook.save(); 189 | var binary = window.atob(base64); 190 | var len = binary.length; 191 | var bytes = new Uint8Array(len); 192 | for (var i = 0; i < len; i++) { 193 | bytes[i] = binary.charCodeAt(i); 194 | } 195 | sendMessage({ 196 | response: true, 197 | requestId: event.data.requestId, 198 | body: bytes 199 | }) 200 | } 201 | else if (event.data.undo) { 202 | sheet.undo(); 203 | } 204 | else if (event.data.redo) { 205 | sheet.redo(); 206 | } 207 | }); 208 | } 209 | -------------------------------------------------------------------------------- /out/styles/vscode.css: -------------------------------------------------------------------------------- 1 | /* grid cells */ 2 | div[role=gridcell] { 3 | border-top-color: transparent !important; 4 | border-left-color: transparent !important; 5 | } 6 | .wj-content { 7 | background-color: var(--vscode-editor-background); 8 | color: var(--vscode-editor-foreground); 9 | border-radius: 0px; 10 | border-color: var(--vscode-tree-indentGuidesStroke); 11 | } 12 | .wj-flexgrid:focus-within { 13 | border-color: var(--vscode-focusBorder); 14 | } 15 | .wj-cell { 16 | border-right-color: var(--vscode-tree-indentGuidesStroke); 17 | border-bottom-color: var(--vscode-tree-indentGuidesStroke); 18 | } 19 | 20 | /* header cells */ 21 | .wj-cell.wj-header { 22 | background-color: var(--vscode-titleBar-activeBackground) !important; 23 | color: var(--vscode-titleBar-activeForeground) !important; 24 | } 25 | .wj-cell.wj-header .wj-state-multi-selected { 26 | background-color: var(--vscode-list-inactiveSelectionBackground) !important; 27 | color: var(--vscode-list-inactiveSelectionForeground) !important; 28 | } 29 | 30 | /* selection states */ 31 | .wj-state-selected { 32 | background-color: var(--vscode-list-activeSelectionBackground) !important; 33 | color: var(--vscode-list-activeSelectionForeground) !important; 34 | } 35 | .wj-state-multi-selected { 36 | background-color: var(--vscode-list-inactiveSelectionBackground) !important; 37 | color: var(--vscode-list-inactiveSelectionForeground) !important; 38 | } 39 | .wj-cell.wj-state-active { 40 | background-color: var(--vscode-list-activeSelectionBackground) !important; 41 | color: var(--vscode-list-activeSelectionForeground) !important; 42 | } 43 | .wj-flexsheet .wj-cell.wj-state-active { 44 | background-color: var(--vscode-list-activeSelectionBackground) !important; 45 | color: var(--vscode-list-activeSelectionForeground) !important; 46 | } 47 | .wj-flexsheet .wj-cell.wj-state-multi-selected { 48 | background-color: var(--vscode-list-inactiveSelectionBackground) !important; 49 | color: var(--vscode-list-inactiveSelectionForeground) !important; 50 | border-right-color: var(--vscode-tree-indentGuidesStroke) !important; 51 | border-bottom-color: var(--vscode-tree-indentGuidesStroke) !important; 52 | } 53 | .wj-flexsheet .wj-cell.wj-header .wj-state-multi-selected { 54 | background-color: var(--vscode-list-inactiveSelectionBackground) !important; 55 | color: var(--vscode-list-inactiveSelectionForeground) !important; 56 | } 57 | 58 | /* row and column headers */ 59 | .wj-flexgrid .wj-rowheaders .wj-header.wj-state-multi-selected { 60 | border-right-color: var(--vscode-list-activeSelectionBackground) !important; 61 | border-bottom-color: var(--vscode-tree-indentGuidesStroke) !important; 62 | } 63 | .wj-flexgrid .wj-colheaders .wj-header.wj-state-multi-selected { 64 | border-bottom-color: var(--vscode-list-activeSelectionBackground) !important; 65 | border-right-color: var(--vscode-tree-indentGuidesStroke) !important; 66 | } 67 | 68 | /* marquee */ 69 | .wj-flexgrid .wj-marquee { 70 | box-shadow: none; 71 | } 72 | 73 | /* alternating rows */ 74 | .wj-cell:not(.wj-header):not(.wj-group):not(.wj-alt):not(.wj-state-selected):not(.wj-state-multi-selected) { 75 | background-color: var(--vscode-editor-background) !important; 76 | color: var(--vscode-editor-foreground) !important; 77 | } 78 | .wj-alt:not(.wj-header):not(.wj-group):not(.wj-state-selected):not(.wj-state-multi-selected) { 79 | background-color: var(--vscode-sideBar-background) !important; 80 | color: var(--vscode-sideBar-foreground) !important; 81 | } 82 | 83 | /* dropdowns and buttons */ 84 | .wj-columnfiltereditor .wj-control { 85 | background-color: var(--vscode-input-background); 86 | color: var(--vscode-input-foreground); 87 | } 88 | .wj-columnfiltereditor .wj-btn { 89 | background-color: var(--vscode-button-background) !important; 90 | color: var(--vscode-button-foreground) !important; 91 | border-radius: 0px !important; 92 | } 93 | 94 | /* editor */ 95 | .wj-grid-editor { 96 | font-family: var(--vscode-font-family); 97 | font-weight: var(--vscode-font-weight); 98 | font-size: var(--vscode-font-size); 99 | } 100 | 101 | /* FlexSheet */ 102 | .wj-sheet-page { 103 | height: 100%; 104 | } 105 | .wj-flexsheet .wj-tabholder { 106 | background-color: var(--vscode-sideBar-background); 107 | } 108 | .wj-flexsheet .wj-tabholder div.wj-sheet-page.wj-btn-group > button { 109 | background-color: var(--vscode-sideBar-background); 110 | color: var(--vscode-sideBar-foreground); 111 | } 112 | .wj-flexsheet .wj-tabholder div.wj-sheet-page.wj-btn-group > button:hover { 113 | background-color: var(--vscode-list-hoverBackground); 114 | color: var(--vscode-list-hoverForeground); 115 | } 116 | .wj-flexsheet .wj-tabholder .wj-sheet-tab ul li { 117 | background-color: var(--vscode-list-inactiveSelectionBackground); 118 | color: var(--vscode-list-inactiveSelectionForeground); 119 | border-left: 1px solid transparent; 120 | } 121 | .wj-flexsheet .wj-tabholder .wj-sheet-tab ul li.active { 122 | background-color: var(--vscode-list-activeSelectionBackground); 123 | color: var(--vscode-list-activeSelectionForeground); 124 | border-left: 1px solid transparent; 125 | } 126 | .wj-flexsheet .wj-tabholder .wj-sheet-tab ul li:not(.active):hover { 127 | background-color: var(--vscode-button-background); 128 | color: var(--vscode-button-foreground); 129 | } 130 | .wj-flexsheet-context-menu { 131 | background-color: var(--vscode-sideBar-background); 132 | color: var(--vscode-sideBar-foreground); 133 | border: 1px solid var(--vscode-dropdown-border); 134 | } 135 | .wj-flexsheet-context-menu .wj-context-menu-item:not(.wj-context-menu-item-selected):hover { 136 | background-color: var(--vscode-list-activeSelectionBackground); 137 | color: var(--vscode-list-activeSelectionForeground); 138 | } 139 | -------------------------------------------------------------------------------- /src/baseDocumentView.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { window, ExtensionContext, Disposable, ViewColumn, Webview, WebviewPanel, Memento, workspace } from 'vscode'; 3 | import { URI, Utils } from 'vscode-uri'; 4 | import { documentViewManager } from './documentViewManager'; 5 | 6 | export default abstract class BaseDocumentView { 7 | 8 | private _uri: URI; 9 | private _previewUri: URI; 10 | private _scriptUri: URI; 11 | private _storage: Memento; 12 | private _panel: WebviewPanel; 13 | private _customEditor: boolean = true; 14 | protected _disposed: boolean = false; 15 | protected _disposables: Disposable[] = []; 16 | 17 | constructor(context: ExtensionContext, uri: URI) { 18 | this._uri = uri; 19 | this._scriptUri = Utils.joinPath(context.extensionUri, 'out'); 20 | this._storage = context.workspaceState; 21 | documentViewManager.add(this); 22 | } 23 | 24 | protected initWebviewPanel(viewColumn: ViewColumn): BaseDocumentView { 25 | let title = `Preview '${Utils.basename(this._uri)}'`; 26 | let panel = window.createWebviewPanel(this.viewType, title, viewColumn, { 27 | enableScripts: true, 28 | enableCommandUris: true, 29 | enableFindWidget: true, 30 | retainContextWhenHidden: true 31 | }); 32 | return this.attachWebviewPanel(panel); 33 | } 34 | 35 | protected attachWebviewPanel(webviewPanel: WebviewPanel): BaseDocumentView { 36 | this._customEditor = false; 37 | this._panel = webviewPanel; 38 | this._previewUri = webviewPanel.webview.asWebviewUri(this._uri); 39 | this._scriptUri = webviewPanel.webview.asWebviewUri(this._scriptUri); 40 | this._panel.onDidDispose(() => { 41 | this.dispose(); 42 | }, this, this._disposables); 43 | return this; 44 | } 45 | 46 | public initialize() { 47 | this.webview.onDidReceiveMessage((e) => { 48 | if (e.save) { 49 | this.state = e.state; 50 | } 51 | else if (e.refresh) { 52 | this.refresh(); 53 | } 54 | else if (e.error) { 55 | window.showErrorMessage(e.error); 56 | } 57 | }, this, this._disposables); 58 | 59 | workspace.onDidChangeTextDocument((e) => { 60 | if (!this._disposed && e.document.uri.toString() === this.uri.toString()) { 61 | this.refresh(); 62 | } 63 | }, this, this._disposables); 64 | 65 | this.webview.html = this.getHtml(); 66 | } 67 | 68 | public dispose() { 69 | documentViewManager.remove(this); 70 | this._disposed = true; 71 | while (this._disposables.length) { 72 | const item = this._disposables.pop(); 73 | if (item) { 74 | item.dispose(); 75 | } 76 | } 77 | } 78 | 79 | public configure() { 80 | if (this.configurable) { 81 | this.webview.html = this.getHtml(); 82 | this.refresh(); 83 | } 84 | } 85 | 86 | public reload() { 87 | this.webview.html = this.getHtml(true); 88 | } 89 | 90 | public reveal() { 91 | this._panel.reveal(); 92 | } 93 | 94 | get hasCustomEditor(): boolean { 95 | return this._customEditor; 96 | } 97 | 98 | get visible(): boolean { 99 | return this._panel.visible; 100 | } 101 | 102 | get webview(): Webview { 103 | return this._panel.webview; 104 | } 105 | 106 | get panel(): WebviewPanel { 107 | return this._panel; 108 | } 109 | 110 | set panel(value: WebviewPanel) { 111 | this._previewUri = value.webview.asWebviewUri(this._uri); 112 | this._scriptUri = value.webview.asWebviewUri(this._scriptUri); 113 | this._panel = value; 114 | value.webview.options = { 115 | enableScripts: true, 116 | enableCommandUris: true 117 | }; 118 | this._panel.onDidDispose(() => { 119 | this.dispose(); 120 | }, this, this._disposables); 121 | } 122 | 123 | set scheme(value: string) { 124 | this._previewUri = this._uri.with({ 125 | scheme: value 126 | }); 127 | } 128 | 129 | get uri(): URI { 130 | return this._uri; 131 | } 132 | 133 | get previewUri(): URI { 134 | return this._previewUri; 135 | } 136 | 137 | get scriptUri(): URI { 138 | return this._scriptUri; 139 | } 140 | 141 | get state(): any { 142 | let key = this.previewUri.toString(); 143 | return this._storage.get(key, null); 144 | } 145 | set state(value: any) { 146 | let key = this.previewUri.toString(); 147 | this._storage.update(key, value); 148 | } 149 | 150 | public clearState() { 151 | this.state = null; 152 | this.reload(); 153 | this.refresh(); 154 | } 155 | 156 | abstract get viewType(): string; 157 | abstract getHtml(ignoreState?: boolean): string; 158 | abstract refresh(): void; 159 | abstract get configurable(): boolean; 160 | } 161 | -------------------------------------------------------------------------------- /src/csvDocumentView.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { window, workspace, WebviewPanel, ExtensionContext, ViewColumn, WorkspaceEdit, Range, TextDocument, Position, EndOfLine } from 'vscode'; 3 | import { URI } from 'vscode-uri'; 4 | import BaseDocumentView from './baseDocumentView'; 5 | import { documentViewManager } from './documentViewManager'; 6 | import { getLicenseKey } from './license'; 7 | 8 | class RowRange { 9 | public start: number; 10 | public end: number; 11 | } 12 | 13 | export default class CsvDocumentView extends BaseDocumentView { 14 | 15 | static create(context: ExtensionContext, uri: URI, viewColumn: ViewColumn): CsvDocumentView { 16 | let preview = new CsvDocumentView(context, uri); 17 | preview.scheme = "csv-preview"; 18 | preview.initWebviewPanel(viewColumn); 19 | preview.initialize(); 20 | return preview; 21 | } 22 | 23 | static revive(context: ExtensionContext, uri: URI, webviewPanel: WebviewPanel): CsvDocumentView { 24 | let preview = new CsvDocumentView(context, uri); 25 | preview.scheme = "csv-preview"; 26 | preview.attachWebviewPanel(webviewPanel); 27 | preview.initialize(); 28 | return preview; 29 | } 30 | 31 | public languageId: string; 32 | private separator: string; 33 | 34 | public getOptions(): any { 35 | let self = this; 36 | let config = workspace.getConfiguration('csv-preview'); 37 | let sep = config.get("separator"); 38 | let lang = this.languageId; 39 | if (!lang) { 40 | let editor = window.activeTextEditor; 41 | if (editor && editor.document) { 42 | lang = editor.document.languageId; 43 | this.languageId = lang; 44 | } 45 | } 46 | if (!lang) { 47 | let document = workspace.textDocuments.find(document => { 48 | return document.uri.toString() === self.uri.toString(); 49 | }); 50 | if (document) { 51 | lang = document.languageId; 52 | this.languageId = lang; 53 | } 54 | } 55 | if (lang === 'tsv') { 56 | sep = "\t"; 57 | } else if (lang === 'csv (semicolon)') { 58 | sep = ";"; 59 | } else if (lang === 'csv (pipe)') { 60 | sep = "\\|"; 61 | } 62 | if (this.separator) { 63 | sep = this.separator; 64 | } 65 | return { 66 | separator: sep, 67 | languageId: lang, 68 | quoteMark: config.get("quoteMark"), 69 | hasHeaders: config.get("hasHeaders"), 70 | capitalizeHeaders: config.get("capitalizeHeaders"), 71 | resizeColumns: config.get("resizeColumns"), 72 | lineNumbers: config.get("lineNumbers"), 73 | commentCharacter: config.get("commentCharacter"), 74 | skipComments: config.get("skipComments"), 75 | formatValues: config.get("formatValues"), 76 | numberFormat: config.get("numberFormat"), 77 | customEditor: this.hasCustomEditor, 78 | uri: this.uri.toString(), 79 | previewUri: this.previewUri.toString(), 80 | state: this.state 81 | }; 82 | } 83 | 84 | private _wsEdit: WorkspaceEdit; 85 | private _document: TextDocument; 86 | private _currentRange: Range; 87 | private _currentRow: string[]; 88 | 89 | private editRow(row: RowRange) { 90 | let options = this.getOptions(); 91 | let sep = options.separator; 92 | let quote = options.quoteMark; 93 | let offset = options.hasHeaders ? 1 : 0; 94 | if (this.separator) offset++; 95 | 96 | this._currentRange = new Range(row.start + offset, 0, row.end + offset, 0); 97 | let line = this._document.getText(this._currentRange); 98 | let eol = this.endOfLine(); 99 | 100 | if (line.endsWith(eol)) { 101 | line = line.substring(0, line.length - eol.length); 102 | } 103 | 104 | // http://markmintoff.com/2013/03/regex-split-by-comma-not-surrounded-by-quotes/ 105 | let regexItems = new RegExp(`${sep}(?=(?:[^${quote}]*${quote}[^${quote}]*${quote})*[^${quote}]*$)`); 106 | this._currentRow = line.split(new RegExp(regexItems)); 107 | } 108 | 109 | private setCellValue(row: RowRange, col: number, value: string) { 110 | let options = this.getOptions(); 111 | let sep = options.separator; 112 | let quote = options.quoteMark; 113 | 114 | if (!this._currentRow) { 115 | this.editRow(row); 116 | } 117 | 118 | let regexSeparator = new RegExp(sep); 119 | let mustQuote = regexSeparator.exec(value) || value.includes("\n"); 120 | 121 | if (!mustQuote) { 122 | let regexQuote = new RegExp(`^${quote}([\\S\\s]*)${quote}$`); 123 | let oldValue = this._currentRow[col]; 124 | mustQuote = regexQuote.exec(oldValue); 125 | } 126 | 127 | this._currentRow[col] = mustQuote ? `${quote}${value}${quote}` : value; 128 | } 129 | 130 | private deleteRows(rows: RowRange[]) { 131 | let options = this.getOptions(); 132 | let offset = options.hasHeaders ? 1 : 0; 133 | if (this.separator) offset++; 134 | 135 | rows.forEach((row: RowRange) => { 136 | let lineRange = new Range(row.start + offset, 0, row.end + offset, 0); 137 | this._wsEdit.delete(this.uri, lineRange); 138 | }, this); 139 | } 140 | 141 | private singleSeparator(sep: string) { 142 | let skipFirst = sep.startsWith("[") || sep.startsWith(`\\`); 143 | return skipFirst ? sep.slice(1, 2) : sep; 144 | } 145 | 146 | private endOfLine() { 147 | return this._document.eol === EndOfLine.CRLF ? "\r\n" : "\n" 148 | } 149 | 150 | private appendRow(columns: number) { 151 | let options = this.getOptions(); 152 | let sep = options.separator; 153 | let empty = this.singleSeparator(sep).repeat(columns - 1); 154 | let row = this._document.lineCount - 1; 155 | let line = this._document.lineAt(row); 156 | 157 | if (!line.isEmptyOrWhitespace) { 158 | this.beginEdit(); 159 | this._wsEdit.insert(this.uri, line.range.end, this.endOfLine()); 160 | row++; 161 | } 162 | 163 | this._currentRange = new Range(row, 0, row, 0); 164 | this._currentRow = empty.split(new RegExp(sep)); 165 | } 166 | 167 | private beginEdit() { 168 | if (!this._wsEdit) { 169 | this._wsEdit = new WorkspaceEdit(); 170 | } 171 | } 172 | 173 | private async endEdit(refresh?: boolean) { 174 | if (this._wsEdit) { 175 | if (this._currentRow) { 176 | let sep = this.singleSeparator(this.getOptions().separator); 177 | this._wsEdit.replace(this.uri, this._currentRange, this._currentRow.join(sep) + this.endOfLine()); 178 | } 179 | await workspace.applyEdit(this._wsEdit); 180 | this._wsEdit = undefined; 181 | this._currentRange = undefined; 182 | this._currentRow = undefined; 183 | if (refresh) { 184 | this.refresh(); 185 | } 186 | } 187 | } 188 | 189 | public enableEditing(document: TextDocument) { 190 | this._document = document; 191 | this.webview.onDidReceiveMessage((e) => { 192 | if (e.cellEditEnded) { 193 | this.beginEdit(); 194 | this.setCellValue(e.rows, e.col, e.value); 195 | } 196 | else if (e.rowEditEnded) { 197 | this.endEdit(); 198 | } 199 | else if (e.deleteRows) { 200 | this.beginEdit(); 201 | this.deleteRows(e.rows); 202 | this.endEdit(); 203 | } 204 | else if (e.separator) { 205 | this.separator = e.separator; 206 | } 207 | else if (e.rowAdded) { 208 | this.appendRow(e.count); 209 | } 210 | }, this, this._disposables); 211 | } 212 | 213 | refresh(): void { 214 | if (this._wsEdit) 215 | return; 216 | let self = this; 217 | workspace.openTextDocument(this.uri).then(document => { 218 | if (!self._disposed) { 219 | self.webview.postMessage({ 220 | refresh: true, 221 | content: document.getText() 222 | }); 223 | } 224 | }, reason => { 225 | window.showInformationMessage(reason.message); 226 | }); 227 | } 228 | 229 | getHtml(ignoreState: boolean = false): string { 230 | return ` 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 |
245 | 246 | 257 | `; 258 | } 259 | 260 | get viewType(): string { 261 | return "gc-excelviewer-csv-preview"; 262 | } 263 | 264 | get configurable(): boolean { 265 | return true; 266 | } 267 | } 268 | -------------------------------------------------------------------------------- /src/csvEditor.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import CsvDocumentView from './csvDocumentView'; 3 | 4 | export class CsvEditorProvider implements vscode.CustomTextEditorProvider { 5 | 6 | public static register(context: vscode.ExtensionContext): vscode.Disposable { 7 | const provider = new CsvEditorProvider(context); 8 | const providerRegistration = vscode.window.registerCustomEditorProvider(CsvEditorProvider.viewType, provider, { 9 | webviewOptions: { 10 | enableFindWidget: true, 11 | retainContextWhenHidden: true 12 | } 13 | }); 14 | return providerRegistration; 15 | } 16 | 17 | private static readonly viewType = 'gc-excelviewer-csv-editor'; 18 | 19 | constructor(private readonly context: vscode.ExtensionContext) { 20 | } 21 | 22 | public async resolveCustomTextEditor( 23 | document: vscode.TextDocument, 24 | webviewPanel: vscode.WebviewPanel, 25 | _token: vscode.CancellationToken 26 | ): Promise { 27 | let editor = new CsvDocumentView(this.context, document.uri); 28 | editor.languageId = document.languageId; 29 | editor.panel = webviewPanel; 30 | editor.initialize(); 31 | editor.enableEditing(document); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/dispose.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | 3 | export function disposeAll(disposables: vscode.Disposable[]): void { 4 | while (disposables.length) { 5 | const item = disposables.pop(); 6 | if (item) { 7 | item.dispose(); 8 | } 9 | } 10 | } 11 | 12 | export abstract class Disposable { 13 | private _isDisposed = false; 14 | 15 | protected _disposables: vscode.Disposable[] = []; 16 | 17 | public dispose(): any { 18 | if (this._isDisposed) { 19 | return; 20 | } 21 | this._isDisposed = true; 22 | disposeAll(this._disposables); 23 | } 24 | 25 | protected _register(value: T): T { 26 | if (this._isDisposed) { 27 | value.dispose(); 28 | } else { 29 | this._disposables.push(value); 30 | } 31 | return value; 32 | } 33 | 34 | protected get isDisposed(): boolean { 35 | return this._isDisposed; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/documentViewManager.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { Uri } from 'vscode'; 3 | import BaseDocumentView from './baseDocumentView'; 4 | 5 | export class DocumentViewManager { 6 | 7 | private static _instance: DocumentViewManager; 8 | private _views: BaseDocumentView[] = []; 9 | 10 | private constructor() { 11 | } 12 | 13 | public static get Instance() { 14 | return this._instance || (this._instance = new this()); 15 | } 16 | 17 | public add(view: BaseDocumentView): void { 18 | this._views.push(view!); 19 | } 20 | 21 | public remove(view: BaseDocumentView): void { 22 | let found = this._views.indexOf(view!); 23 | if (found >= 0) { 24 | this._views.splice(found, 1); 25 | } 26 | } 27 | 28 | public find(uri: Uri): BaseDocumentView { 29 | return this._views.find(p => p.previewUri.toString() === p.webview.asWebviewUri(uri).toString()); 30 | } 31 | 32 | public filter(uri: Uri): BaseDocumentView[] { 33 | return this._views.filter(p => p.previewUri.toString() === p.webview.asWebviewUri(uri).toString()); 34 | } 35 | 36 | public active(): BaseDocumentView { 37 | return this._views.find(p => p.visible); 38 | } 39 | 40 | public configure(): void { 41 | this._views.forEach(p => p.configure()); 42 | } 43 | } 44 | 45 | export const documentViewManager = DocumentViewManager.Instance; 46 | -------------------------------------------------------------------------------- /src/excelDocumentView.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { window, workspace, WebviewPanel, ExtensionContext, ViewColumn } from 'vscode'; 3 | import { URI } from 'vscode-uri'; 4 | import BaseDocumentView from './baseDocumentView'; 5 | import { ExcelDocument } from './excelEditor'; 6 | import { getLicenseKey } from './license'; 7 | 8 | export default class ExcelDocumentView extends BaseDocumentView { 9 | 10 | static create(context: ExtensionContext, uri: URI, viewColumn: ViewColumn): ExcelDocumentView { 11 | let preview = new ExcelDocumentView(context, uri); 12 | preview.scheme = "excel-preview"; 13 | preview.initWebviewPanel(viewColumn); 14 | preview.initialize(); 15 | return preview; 16 | } 17 | 18 | static revive(context: ExtensionContext, uri: URI, webviewPanel: WebviewPanel): ExcelDocumentView { 19 | let preview = new ExcelDocumentView(context, uri); 20 | preview.scheme = "excel-preview"; 21 | preview.attachWebviewPanel(webviewPanel); 22 | preview.initialize(); 23 | return preview; 24 | } 25 | 26 | public getOptions(): any { 27 | return { 28 | customEditor: this.hasCustomEditor, 29 | uri: this.uri.toString(), 30 | previewUri: this.previewUri.toString(), 31 | state: this.state 32 | }; 33 | } 34 | 35 | private _document: ExcelDocument; 36 | 37 | public enableEditing(document: ExcelDocument) { 38 | this._document = document; 39 | this.webview.onDidReceiveMessage((e) => { 40 | if (e.changed) { 41 | this._document.change(e.reason); 42 | } 43 | }, this, this._disposables); 44 | } 45 | 46 | refresh(): void { 47 | let self = this; 48 | workspace.fs.readFile(this.uri).then(buffer => { 49 | self.webview.postMessage({ 50 | refresh: true, 51 | content: buffer 52 | }) 53 | }, reason => { 54 | window.showInformationMessage(reason); 55 | }); 56 | } 57 | 58 | undo(): void { 59 | this.webview.postMessage({ 60 | undo: true 61 | }); 62 | } 63 | 64 | redo(): void { 65 | this.webview.postMessage({ 66 | redo: true 67 | }); 68 | } 69 | 70 | getHtml(ignoreState: boolean = false): string { 71 | return ` 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 |
90 | 91 | 102 | `; 103 | } 104 | 105 | get viewType(): string { 106 | return "gc-excelviewer-excel-preview"; 107 | } 108 | 109 | get configurable(): boolean { 110 | return false; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/excelEditor.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { Disposable, disposeAll } from './dispose'; 3 | import ExcelDocumentView from './excelDocumentView'; 4 | import { documentViewManager } from './documentViewManager'; 5 | 6 | export class ExcelEditorProvider implements vscode.CustomEditorProvider { 7 | 8 | public static register(context: vscode.ExtensionContext): vscode.Disposable { 9 | const provider = new ExcelEditorProvider(context); 10 | const providerRegistration = vscode.window.registerCustomEditorProvider(ExcelEditorProvider.viewType, provider, { 11 | webviewOptions: { 12 | enableFindWidget: true, 13 | retainContextWhenHidden: true 14 | } 15 | }); 16 | return providerRegistration; 17 | } 18 | 19 | private static readonly viewType = 'gc-excelviewer-excel-editor'; 20 | 21 | constructor(private readonly context: vscode.ExtensionContext) { 22 | } 23 | 24 | private readonly _onDidChangeCustomDocument = new vscode.EventEmitter>(); // CustomDocumentEditEvent 25 | public readonly onDidChangeCustomDocument = this._onDidChangeCustomDocument.event; 26 | 27 | saveCustomDocument(document: ExcelDocument, cancellation: vscode.CancellationToken): Thenable { 28 | return document.save(cancellation); 29 | } 30 | 31 | saveCustomDocumentAs(document: ExcelDocument, destination: vscode.Uri, cancellation: vscode.CancellationToken): Thenable { 32 | return document.saveAs(destination, cancellation); 33 | } 34 | 35 | revertCustomDocument(document: ExcelDocument, cancellation: vscode.CancellationToken): Thenable { 36 | return document.revert(cancellation); 37 | } 38 | 39 | backupCustomDocument(document: ExcelDocument, context: vscode.CustomDocumentBackupContext, cancellation: vscode.CancellationToken): Thenable { 40 | return document.backup(context.destination, cancellation); 41 | } 42 | 43 | async openCustomDocument( 44 | uri: vscode.Uri, 45 | openContext: { backupId?: string }, 46 | _token: vscode.CancellationToken 47 | ): Promise { 48 | const document: ExcelDocument = await ExcelDocument.create(uri, openContext.backupId, { 49 | getFileData: async () => { 50 | let view = documentViewManager.find(document.uri); 51 | let panel = view.panel; 52 | const response = await this.postMessageWithResponse(panel, 'getData', {}); 53 | return new Uint8Array(response); 54 | } 55 | }); 56 | 57 | const listeners: vscode.Disposable[] = []; 58 | 59 | listeners.push(document.onDidChange(e => { 60 | // Tell VS Code that the document has been edited by the use. 61 | this._onDidChangeCustomDocument.fire({ 62 | document, 63 | ...e, 64 | }); 65 | })); 66 | 67 | listeners.push(document.onDidChangeDocument(e => { 68 | // Update all webviews when the document changes 69 | for (const view of documentViewManager.filter(document.uri)) { 70 | view.panel.webview.postMessage({ 71 | content: e.content, 72 | }); 73 | } 74 | })); 75 | 76 | document.onDidDispose(() => disposeAll(listeners)); 77 | return document; 78 | } 79 | 80 | private _requestId = 1; 81 | private readonly _callbacks = new Map void>(); 82 | 83 | private postMessageWithResponse(panel: vscode.WebviewPanel, type: string, body: any): Promise { 84 | const requestId = this._requestId++; 85 | const p = new Promise(resolve => this._callbacks.set(requestId, resolve)); 86 | panel.webview.postMessage({ type, requestId, body }); 87 | return p; 88 | } 89 | 90 | public async resolveCustomEditor( 91 | document: ExcelDocument, 92 | webviewPanel: vscode.WebviewPanel, 93 | _token: vscode.CancellationToken 94 | ): Promise { 95 | let editor = new ExcelDocumentView(this.context, document.uri); 96 | editor.panel = webviewPanel; 97 | editor.initialize(); 98 | editor.enableEditing(document); 99 | webviewPanel.webview.onDidReceiveMessage((e) => { 100 | if (e.response) { 101 | const callback = this._callbacks.get(e.requestId); 102 | callback?.(e.body); 103 | } 104 | }); 105 | } 106 | } 107 | 108 | interface ExcelDocumentDelegate { 109 | getFileData(): Promise; 110 | } 111 | 112 | export class ExcelDocument extends Disposable implements vscode.CustomDocument { 113 | 114 | static async create( 115 | uri: vscode.Uri, 116 | backupId: string | undefined, 117 | delegate: ExcelDocumentDelegate, 118 | ): Promise> { 119 | const dataFile = typeof backupId === 'string' ? vscode.Uri.parse(backupId) : uri; 120 | const fileData = await ExcelDocument.readFile(dataFile); 121 | return new ExcelDocument(uri, fileData, delegate); 122 | } 123 | 124 | private static async readFile(uri: vscode.Uri): Promise { 125 | if (uri.scheme === 'untitled') { 126 | return new Uint8Array(); 127 | } 128 | return vscode.workspace.fs.readFile(uri); 129 | } 130 | 131 | private readonly _uri: vscode.Uri; 132 | public get uri() { return this._uri; } 133 | 134 | private _documentData: Uint8Array; 135 | public get documentData(): Uint8Array { return this._documentData; } 136 | 137 | private readonly _delegate: ExcelDocumentDelegate; 138 | 139 | private constructor( 140 | uri: vscode.Uri, 141 | initialContent: Uint8Array, 142 | delegate: ExcelDocumentDelegate 143 | ) { 144 | super(); 145 | this._uri = uri; 146 | this._documentData = initialContent; 147 | this._delegate = delegate; 148 | } 149 | 150 | private readonly _onDidDispose = this._register(new vscode.EventEmitter()); 151 | public readonly onDidDispose = this._onDidDispose.event; 152 | 153 | private readonly _onDidChangeDocument = this._register(new vscode.EventEmitter<{ 154 | readonly content?: Uint8Array; 155 | }>()); 156 | 157 | public readonly onDidChangeDocument = this._onDidChangeDocument.event; 158 | 159 | private readonly _onDidChange = this._register(new vscode.EventEmitter<{ 160 | readonly label: string, 161 | undo(): void, 162 | redo(): void, 163 | }>()); 164 | 165 | public readonly onDidChange = this._onDidChange.event; 166 | 167 | change(label: string) { 168 | let view = documentViewManager.find(this.uri); 169 | this._onDidChange.fire({ 170 | label: label, 171 | undo: async() => view.undo(), 172 | redo: async() => view.redo() 173 | }); 174 | } 175 | 176 | async save(cancellation: vscode.CancellationToken): Promise { 177 | await this.saveAs(this.uri, cancellation); 178 | } 179 | 180 | async saveAs(targetResource: vscode.Uri, cancellation: vscode.CancellationToken): Promise { 181 | const fileData = await this._delegate.getFileData(); 182 | if (cancellation.isCancellationRequested) { 183 | return; 184 | } 185 | await vscode.workspace.fs.writeFile(targetResource, fileData); 186 | } 187 | 188 | async revert(_cancellation: vscode.CancellationToken): Promise { 189 | const diskContent = await ExcelDocument.readFile(this.uri); 190 | this._documentData = diskContent; 191 | this._onDidChangeDocument.fire({ 192 | content: diskContent 193 | }); 194 | } 195 | 196 | async backup(destination: vscode.Uri, cancellation: vscode.CancellationToken): Promise { 197 | await this.saveAs(destination, cancellation); 198 | 199 | return { 200 | id: destination.toString(), 201 | delete: async () => { 202 | try { 203 | await vscode.workspace.fs.delete(destination); 204 | } catch { 205 | // noop 206 | } 207 | } 208 | }; 209 | } 210 | 211 | dispose(): void { 212 | this._onDidDispose.fire(); 213 | super.dispose(); 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { window, workspace, commands, ExtensionContext, Uri, ViewColumn, TextDocument } from 'vscode'; 3 | import CsvDocumentView from './csvDocumentView'; 4 | import ExcelDocumentView from './excelDocumentView'; 5 | import { documentViewManager } from './documentViewManager'; 6 | import { Utils } from 'vscode-uri'; 7 | import { CsvSerializer, ExcelSerializer, LegacySerializer } from './serializer'; 8 | import { CsvEditorProvider } from './csvEditor'; 9 | import { ExcelEditorProvider } from './excelEditor'; 10 | 11 | export function activate(context: ExtensionContext) { 12 | 13 | // CSV: Open Preview 14 | let csvCommand = commands.registerCommand('csv.preview', (uri) => { 15 | let resource = uri; 16 | let viewColumn = getViewColumn(); 17 | if (!(resource instanceof Uri)) { 18 | if (window.activeTextEditor) { 19 | resource = window.activeTextEditor.document.uri; 20 | viewColumn = window.activeTextEditor.viewColumn; 21 | } else { 22 | window.showInformationMessage("Open a CSV file first to show a preview."); 23 | return; 24 | } 25 | } 26 | const csv = resource.with({ 27 | scheme: 'csv-preview' 28 | }); 29 | let preview = documentViewManager.find(csv); 30 | if (preview) { 31 | preview.reveal(); 32 | return; 33 | } 34 | preview = CsvDocumentView.create(context, resource, viewColumn); 35 | return preview.webview; 36 | }); 37 | 38 | // Excel: Open Preview 39 | let excelCommand = commands.registerCommand('excel.preview', (uri) => { 40 | let resource = uri; 41 | let viewColumn = getViewColumn(); 42 | if (!(resource instanceof Uri)) { 43 | window.showInformationMessage("Use the explorer context menu or editor title menu to preview Excel files."); 44 | return; 45 | } 46 | const excel = resource.with({ 47 | scheme: 'excel-preview' 48 | }); 49 | let preview = documentViewManager.find(excel); 50 | if (preview) { 51 | preview.reveal(); 52 | return; 53 | } 54 | preview = ExcelDocumentView.create(context, resource, viewColumn); 55 | return preview.webview; 56 | }); 57 | 58 | // CSV: Clear Preview State 59 | let clearCommand = commands.registerCommand('csv.clearState', () => { 60 | let preview = documentViewManager.active(); 61 | if (preview) { 62 | preview.clearState(); 63 | } 64 | }); 65 | 66 | // CSV: Refresh 67 | let refreshCommand = commands.registerCommand('csv.refresh', () => { 68 | let preview = documentViewManager.active(); 69 | if (preview) { 70 | preview.refresh(); 71 | } 72 | }); 73 | 74 | // Add disposables to subscriptions array 75 | context.subscriptions.push(csvCommand); 76 | context.subscriptions.push(excelCommand); 77 | context.subscriptions.push(clearCommand); 78 | context.subscriptions.push(refreshCommand); 79 | context.subscriptions.push(CsvEditorProvider.register(context)); 80 | context.subscriptions.push(ExcelEditorProvider.register(context)); 81 | 82 | // Register serializers for persistent settings 83 | window.registerWebviewPanelSerializer("gc-excelviewer-csv", new LegacySerializer(context)); 84 | window.registerWebviewPanelSerializer("gc-excelviewer-excel", new LegacySerializer(context)); 85 | window.registerWebviewPanelSerializer("gc-excelviewer-csv-preview", new CsvSerializer(context)); 86 | window.registerWebviewPanelSerializer("gc-excelviewer-excel-preview", new ExcelSerializer(context)); 87 | 88 | // Reset all previews when the configuration changes 89 | workspace.onDidChangeConfiguration(() => { 90 | documentViewManager.configure(); 91 | }); 92 | 93 | // Automatically preview content piped from stdin (when VSCode is already open) 94 | workspace.onDidOpenTextDocument(document => { 95 | if (isStdinFile(document)) { 96 | commands.executeCommand('csv.preview', document.uri); 97 | } 98 | }); 99 | 100 | // Automatically preview content piped from stdin (when VSCode first starts up) 101 | if (window.activeTextEditor) { 102 | let document = window.activeTextEditor.document; 103 | if (isStdinFile(document)) { 104 | commands.executeCommand('csv.preview', document.uri); 105 | } 106 | } 107 | } 108 | 109 | export function deactivate() { 110 | } 111 | 112 | function isCsvFile(document: TextDocument) { 113 | if (document) { 114 | let lang = document.languageId.toLowerCase(); 115 | let allowed = ['csv', 'csv (semicolon)', 'csv (pipe)', 'tsv', 'plaintext']; 116 | return allowed.find(a => a === lang) && document.uri.scheme !== 'csv-preview'; 117 | } 118 | return false; 119 | } 120 | 121 | function isStdinFile(document: TextDocument) { 122 | let allowed = workspace.getConfiguration('csv-preview').get("openStdin"); 123 | return (allowed && document) ? Utils.basename(document.uri).match("code-stdin-[^.]+.txt") : false; 124 | } 125 | 126 | function getViewColumn(): ViewColumn { 127 | const active = window.activeTextEditor; 128 | return active ? active.viewColumn : ViewColumn.One; 129 | } 130 | -------------------------------------------------------------------------------- /src/legacyDocumentView.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { window, workspace, WebviewPanel, ExtensionContext, ViewColumn } from 'vscode'; 3 | import { URI } from 'vscode-uri'; 4 | import BaseDocumentView from './baseDocumentView'; 5 | import { getLicenseKey } from './license'; 6 | 7 | export default class LegacyDocumentView extends BaseDocumentView { 8 | 9 | static revive(context: ExtensionContext, uri: URI, webviewPanel: WebviewPanel): LegacyDocumentView { 10 | let preview = new LegacyDocumentView(context, uri); 11 | preview.scheme = "csv-preview"; 12 | preview.attachWebviewPanel(webviewPanel); 13 | preview.initialize(); 14 | return preview; 15 | } 16 | 17 | refresh(): void { 18 | } 19 | 20 | getHtml(ignoreState: boolean = false): string { 21 | return ` 22 | 23 | 24 | 25 |

This preview was created with an earlier version of Excel Viewer, and cannot be restored.

26 |

Please close this tab and reopen the preview as you normally would.

27 |

Alternatively, you can open a custom editor as follows:

28 |
    29 |
  • For CSV files, right-click the filename and select Open With, then choose CSV Viewer when prompted.
  • 30 |
  • For Excel files, double-click the filename to open the custom editor directly.
  • 31 |
32 |

Excel Viewer now supports Visual Studio Code for the Web. To get started, go to https://vscode.dev.

33 | 34 | `; 35 | } 36 | 37 | get viewType(): string { 38 | return "gc-excelviewer-csv"; 39 | } 40 | 41 | get configurable(): boolean { 42 | return false; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/license.ts: -------------------------------------------------------------------------------- 1 | export function getLicenseKey() { 2 | return "Wijmo-license-key"; 3 | } -------------------------------------------------------------------------------- /src/serializer.ts: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | import { WebviewPanel, WebviewPanelSerializer, ExtensionContext, Uri } from 'vscode'; 3 | import CsvDocumentView from './csvDocumentView'; 4 | import ExcelDocumentView from './excelDocumentView'; 5 | import LegacyDocumentView from './legacyDocumentView'; 6 | 7 | export class CsvSerializer implements WebviewPanelSerializer { 8 | 9 | private _context: ExtensionContext; 10 | 11 | constructor(context: ExtensionContext) { 12 | this._context = context; 13 | } 14 | 15 | public async deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any) { 16 | CsvDocumentView.revive(this._context, Uri.parse(state.uri), webviewPanel); 17 | } 18 | } 19 | 20 | export class ExcelSerializer implements WebviewPanelSerializer { 21 | 22 | private _context: ExtensionContext; 23 | 24 | constructor(context: ExtensionContext) { 25 | this._context = context; 26 | } 27 | 28 | public async deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any) { 29 | ExcelDocumentView.revive(this._context, Uri.parse(state.uri), webviewPanel); 30 | } 31 | } 32 | 33 | export class LegacySerializer implements WebviewPanelSerializer { 34 | 35 | private _context: ExtensionContext; 36 | 37 | constructor(context: ExtensionContext) { 38 | this._context = context; 39 | } 40 | 41 | public async deserializeWebviewPanel(webviewPanel: WebviewPanel, state: any) { 42 | LegacyDocumentView.revive(this._context, Uri.parse(state.uri), webviewPanel); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6", 5 | "outDir": "out", 6 | "lib": [ 7 | "es6", 8 | "dom" 9 | ], 10 | "sourceMap": true, 11 | "rootDir": "src" 12 | }, 13 | "include": [ 14 | "src/*.ts", 15 | "./node_modules/vscode/vscode.d.ts", 16 | "./node_modules/vscode/lib/*" 17 | ], 18 | "exclude": [ 19 | "node_modules" 20 | ] 21 | } -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------------------------- 2 | * Copyright (c) Microsoft Corporation. All rights reserved. 3 | * Licensed under the MIT License. See License.txt in the project root for license information. 4 | *--------------------------------------------------------------------------------------------*/ 5 | 6 | //@ts-check 7 | 'use strict'; 8 | 9 | const path = require('path'); 10 | const webpack = require('webpack'); 11 | 12 | /**@type {import('webpack').Configuration}*/ 13 | const nodeConfig = { 14 | target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/ 15 | mode: 'none', 16 | entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/ 17 | output: { // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ 18 | path: path.resolve(__dirname, 'dist'), 19 | filename: 'extension.js', 20 | libraryTarget: "commonjs2", 21 | devtoolModuleFilenameTemplate: "../[resource-path]", 22 | }, 23 | devtool: 'source-map', 24 | externals: { 25 | vscode: "commonjs vscode" // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/ 26 | }, 27 | resolve: { // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader 28 | extensions: ['.ts', '.js'] 29 | }, 30 | stats: { 31 | warningsFilter: warning => RegExp("node_modules/express/lib/view.js").test(warning.message) 32 | }, 33 | module: { 34 | rules: [{ 35 | test: /\.ts$/, 36 | exclude: /node_modules/, 37 | use: [{ 38 | loader: 'ts-loader' 39 | }] 40 | }] 41 | }, 42 | } 43 | 44 | /**@type {import('webpack').Configuration}*/ 45 | const webConfig = { 46 | target: 'webworker', // web extensions run in a webworker context 47 | mode: 'none', 48 | entry: { 49 | 'extension': './src/extension.ts' // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/ 50 | }, 51 | output: { // the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/ 52 | path: path.resolve(__dirname, 'dist'), 53 | filename: 'extension.js', 54 | libraryTarget: "commonjs2", 55 | devtoolModuleFilenameTemplate: "../[resource-path]", 56 | }, 57 | devtool: 'source-map', 58 | externals: { 59 | vscode: "commonjs vscode" // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/ 60 | }, 61 | resolve: { // support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader 62 | mainFields: ['browser', 'module', 'main'], 63 | extensions: ['.ts', '.js'], 64 | alias: { 65 | // provides alternate implementation for node module and source files 66 | }, 67 | fallback: { 68 | // Webpack 5 no longer polyfills Node.js core modules automatically. 69 | // see https://webpack.js.org/configuration/resolve/#resolvefallback 70 | // for the list of Node.js core module polyfills. 71 | assert: require.resolve('assert'), 72 | path: require.resolve('path-browserify'), 73 | } 74 | }, 75 | stats: { 76 | warningsFilter: warning => RegExp("node_modules/express/lib/view.js").test(warning.message) 77 | }, 78 | plugins: [ 79 | new webpack.ProvidePlugin({ 80 | process: 'process/browser', // provide a shim for the global `process` variable 81 | }), 82 | ], 83 | module: { 84 | rules: [{ 85 | test: /\.ts$/, 86 | exclude: /node_modules/, 87 | use: [{ 88 | loader: 'ts-loader' 89 | }] 90 | }] 91 | }, 92 | } 93 | 94 | module.exports = [nodeConfig, webConfig]; 95 | --------------------------------------------------------------------------------