excellentexport 3.7.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- github: jmaister
1
+ github: jmaister
@@ -0,0 +1,7 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 0
@@ -0,0 +1,28 @@
1
+ name: Node CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ build:
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ node-version: [14.x, 16.x]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+
21
+ - name: Use Node.js ${{ matrix.node-version }}
22
+ uses: actions/setup-node@v1
23
+ with:
24
+ node-version: ${{ matrix.node-version }}
25
+
26
+ - run: yarn install
27
+
28
+ - run: yarn jest
package/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2016-2019 Jordi Burgos
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2016-2019 Jordi Burgos
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,266 +1,286 @@
1
-
2
- [![Build Status](https://travis-ci.com/jmaister/excellentexport.svg?branch=master)](https://travis-ci.com/jmaister/excellentexport)
3
- [![](https://data.jsdelivr.com/v1/package/npm/excellentexport/badge)](https://www.jsdelivr.com/package/npm/excellentexport)
4
- [![Rate on Openbase](https://badges.openbase.io/js/rating/excellentexport.svg)](https://openbase.io/js/excellentexport?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
5
- [![Coverage Status](https://coveralls.io/repos/github/jmaister/excellentexport/badge.svg?branch=master)](https://coveralls.io/github/jmaister/excellentexport?branch=master)
6
-
7
- # ExcellentExport.js
8
-
9
- - [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
10
-
11
- - JavaScript export to Excel or CSV.
12
-
13
- - A quick JavaScript library to create export to Excel/CSV from HTML tables in the browser. No server required.
14
-
15
- - As part of the new version 3.0.0+, there is support for _XLSX_. The drawback is that the library is 600+ KB.
16
-
17
- - If you only need _XLS_ or _CSV_, use _2.X.X_ versions.
18
-
19
- - Check My Blog Page for Testing :
20
- [JavaScript export to Excel](http://jordiburgos.com/post/2013/javascript-export-to-excel.html)
21
-
22
- [ExcellentExport.js update: JavaScript export to Excel and CSV](http://jordiburgos.com/post/2017/excellentexport-javascript-export-to-excel-csv.html)
23
-
24
- # Revision history:
25
-
26
- ### 3.7.0
27
-
28
- * Added option `openAsDownload: boolean`. Use this option to download as a file without using an anchor tag. So download can be triggered from a button.
29
- * _Update npm dependencies to fix vulnerabilities_
30
-
31
- ### 3.6.0
32
-
33
- * Added sponsor link to the project [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
34
- * Transform the project from JavaScript to TypeScript
35
- * Configure Jest as test runner
36
- * _Update npm dependencies to fix vulnerabilities_
37
-
38
- ### 3.5.0
39
-
40
- * Add fixValue and fixArray functions to configuration: these configuration functions can be used to manipulate the values of the cells.
41
- * _Update npm dependencies to fix vulnerabilities_
42
-
43
- ### 3.4.3
44
-
45
- * _Update npm dependencies to fix vulnerabilities_
46
-
47
- ### 3.4.2
48
-
49
- * Remove ES6 function syntax to support IE11
50
- * _Update npm dependencies to fix vulnerabilities_
51
-
52
- ### 3.4.0
53
-
54
- * Configure TravisCI on GitHub
55
- * Update npm dependencies to fix vulnerabilities
56
-
57
- ### 3.3.0
58
-
59
- * Remove columns by index
60
- * Filter rows by value
61
- * _Updated build to Webpack 4.x.x_
62
-
63
- ### 3.2.1
64
-
65
- * _Update npm dependencies to fix vulnerabilities_
66
-
67
- ### 3.2.0
68
-
69
- * _Update npm dependencies to fix vulnerabilities_
70
-
71
- ### 3.1.0
72
-
73
- * Fix old API for base64 and escaping problem.
74
-
75
- ### 3.0.0
76
-
77
- * XLSX support. This bumps the build size to 640 KB.
78
- * New API : ExcellentExport.convert(...)
79
- * Autogenerate download filename.
80
- * Data input from arrays or HTML Tables.
81
- * Multiple sheets for XLS or XLSX formats.
82
-
83
- ### 2.1.0
84
-
85
- * Add Webpack build.
86
- * Create UMD JavaScript module. Library can be loaded as a module (import, RequireJS, AMD, etc...) or standalone as window.ExcelentExport.
87
-
88
- ### 2.0.3
89
-
90
- * Fix export as a module.
91
- * Changed minifier to UglifyJS.
92
-
93
- ### 2.0.2
94
-
95
- * Fix CSV Chinese characters and other special characters display error in Windows Excel.
96
- * Fix URL.createObjectURL(...) on Firefox.
97
-
98
-
99
- ### 2.0.0
100
-
101
- * Now it can export to big files +2MB.
102
- * Minimum IE 11.
103
- * Links open with URL.createObjectURL(...).
104
- * NPM package available.
105
- * Using Semantic versioning (2.0.0 instead of 2.0).
106
- * Module can be loaded standalone or with RequireJS.
107
- * Change license to MIT.
108
-
109
- ### 1.5
110
-
111
- * Possibility to select a CSV delimiter.
112
- * Bower package available.
113
- * Compose package available.
114
-
115
- ### 1.4
116
-
117
- * _Add LICENSE.txt with GPL v3_
118
- * UTF-8 characters fixed.
119
-
120
- ### 1.3
121
-
122
- * _Added minified version_
123
-
124
- ### 1.1
125
-
126
- * _Added CSV data export_
127
-
128
- ### 1.0
129
-
130
- * _Added Excel data export_
131
-
132
- ## Compatibility
133
-
134
- - Firefox
135
- - Chrome
136
- - Internet Explorer 11+
137
-
138
- # Install
139
-
140
- ## npm
141
-
142
- npm install excellentexport --save
143
-
144
- ## yarn
145
-
146
- yarn add excellentexport
147
-
148
- ## bower
149
-
150
- bower install excellentexport
151
-
152
- # Load
153
-
154
-
155
- **Include script in your HTML:**
156
-
157
- <script type="text/javascript" src="dist/excellentexport.js"></script>
158
-
159
- **Include script in your HTML using CDN:**
160
-
161
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/excellentexport@3.4.3/dist/excellentexport.min.js"></script>
162
-
163
-
164
- **Require.js**
165
-
166
- <script src="http://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
167
- <script>
168
- require(['dist/excellentexport'], function(ee) {
169
- window.ExcellentExport = ee;
170
- });
171
- </script>
172
-
173
- **ES6 import**
174
-
175
- import ExcellentExport from 'excellentexport';
176
-
177
-
178
- # Usage
179
-
180
- <table id="datatable">
181
- <tr>
182
- <td>100</td> <td>200</td> <td>300</td>
183
- </tr>
184
- <tr>
185
- <td>400</td> <td>500</td> <td>600</td>
186
- </tr>
187
- </table>
188
-
189
- <a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
190
- <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</a>
191
- <!-- new API, xlsx -->
192
- <a download="somedata.xlsx" href="#" onclick="return ExcellentExport.convert({ anchor: this, filename: 'data_123.array', format: 'xlsx'},[{name: 'Sheet Name Here 1', from: {table: 'datatable'}}]);">Export to CSV</a>
193
-
194
- # API
195
-
196
- ExcellentExport.convert(options, sheets);
197
-
198
- Options:
199
- {
200
- anchor: String or HTML Element,
201
- format: 'xlsx' or 'xls' or 'csv',
202
- filename: String
203
- }
204
-
205
- Sheets must be an array of sheet configuration objects. Sheet description:
206
- [
207
- {
208
- name: 'Sheet 1', // Sheet name
209
- from: {
210
- table: String/Element, // Table ID or table element
211
- array: [...] // Array with the data. Array where each element is a row. Every row is an array of the cells.
212
- },
213
- removeColumns: [...], // Array of column indexes (from 0)
214
- filterRowFn: function(row) {return true}, // Function to decide which rows are returned
215
- fixValue: function(value, row, column) {return fixedValue} // Function to fix values, receiving value, row num, column num
216
- fixArray: function(array) {return array} // Function to manipulate the whole data array
217
- ...
218
- },
219
- {
220
- ...
221
- }, ...
222
- ]
223
-
224
- ## fixValue example
225
-
226
- This is an example for the _fixValue function_ to handle HTML tags inside a table cell.
227
- It transforms BR to line breaks and then strips all the HTML tags.
228
-
229
- fixValue: (value, row, col) => {
230
- let v = value.replace(/<br>/gi, "\n");
231
- let strippedString = v.replace(/(<([^>]+)>)/gi, "");
232
- return strippedString;
233
- }
234
-
235
-
236
- # Notes
237
-
238
- - IE8 or lower do not support *data:* url schema.
239
- - IE9 does not support *data:* url schema on links.
240
- - IE10 and above and Edge are supported via the Microsoft-specific `msOpenOrSaveBlob` method.
241
-
242
- # Test
243
-
244
- python 2.x:
245
- python -m SimpleHTTPServer 8000
246
-
247
- python 3.x:
248
- python -m http.server 8000
249
-
250
- # Build
251
-
252
- **Install dependencies:**
253
-
254
- npm install
255
-
256
- **Build development version dist/excellentexport.js**
257
-
258
- npm run build
259
-
260
- **Build publish version of dist/excellentexport.js**
261
-
262
- npm run prod
263
-
264
- **Publish**
265
-
266
- npm publish
1
+
2
+ [![Node CI](https://github.com/jmaister/excellentexport/actions/workflows/webpack.yml/badge.svg?branch=master)](https://github.com/jmaister/excellentexport/actions/workflows/webpack.yml)
3
+ [![](https://data.jsdelivr.com/v1/package/npm/excellentexport/badge)](https://www.jsdelivr.com/package/npm/excellentexport)
4
+ [![Rate on Openbase](https://badges.openbase.io/js/rating/excellentexport.svg)](https://openbase.io/js/excellentexport?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge)
5
+ [![Coverage Status](https://coveralls.io/repos/github/jmaister/excellentexport/badge.svg?branch=master)](https://coveralls.io/github/jmaister/excellentexport?branch=master)
6
+
7
+ # ExcellentExport.js
8
+
9
+ - [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
10
+
11
+ - JavaScript export to Excel or CSV.
12
+
13
+ - A quick JavaScript library to create export to Excel/CSV from HTML tables in the browser. No server required.
14
+
15
+ - As part of the new version 3.0.0+, there is support for _XLSX_. The drawback is that the library is 600+ KB.
16
+
17
+ - If you only need _XLS_ or _CSV_, use _2.X.X_ versions.
18
+
19
+ - Check My Blog Page for Testing :
20
+ [JavaScript export to Excel](http://jordiburgos.com/post/2013/javascript-export-to-excel.html)
21
+
22
+ [ExcellentExport.js update: JavaScript export to Excel and CSV](http://jordiburgos.com/post/2017/excellentexport-javascript-export-to-excel-csv.html)
23
+
24
+ # Revision history:
25
+
26
+ ### 3.8.0
27
+
28
+ * Allow RTL options on the whole file or sheet.
29
+ * _Update npm dependencies to fix vulnerabilities_
30
+
31
+ ### 3.7.3
32
+
33
+ * Fix (#591) remove columns parameter. Now it is not affected by repeated column numbers nor its order.
34
+
35
+ ### 3.7.2
36
+
37
+ * _Update npm dependencies to fix vulnerabilities_
38
+
39
+ ### 3.7.1
40
+
41
+ * _Update npm dependencies to fix vulnerabilities_
42
+ * Start using Dependabot and get rid of Dependabot-preview
43
+
44
+ ### 3.7.0
45
+
46
+ * Added option `openAsDownload: boolean`. Use this option to download as a file without using an anchor tag. So download can be triggered from a button.
47
+ * _Update npm dependencies to fix vulnerabilities_
48
+
49
+ ### 3.6.0
50
+
51
+ * Added sponsor link to the project [:heart: Sponsor ExcellentExport.js project:heart:](https://github.com/sponsors/jmaister)
52
+ * Transform the project from JavaScript to TypeScript
53
+ * Configure Jest as test runner
54
+ * _Update npm dependencies to fix vulnerabilities_
55
+
56
+ ### 3.5.0
57
+
58
+ * Add fixValue and fixArray functions to configuration: these configuration functions can be used to manipulate the values of the cells.
59
+ * _Update npm dependencies to fix vulnerabilities_
60
+
61
+ ### 3.4.3
62
+
63
+ * _Update npm dependencies to fix vulnerabilities_
64
+
65
+ ### 3.4.2
66
+
67
+ * Remove ES6 function syntax to support IE11
68
+ * _Update npm dependencies to fix vulnerabilities_
69
+
70
+ ### 3.4.0
71
+
72
+ * Configure TravisCI on GitHub
73
+ * Update npm dependencies to fix vulnerabilities
74
+
75
+ ### 3.3.0
76
+
77
+ * Remove columns by index
78
+ * Filter rows by value
79
+ * _Updated build to Webpack 4.x.x_
80
+
81
+ ### 3.2.1
82
+
83
+ * _Update npm dependencies to fix vulnerabilities_
84
+
85
+ ### 3.2.0
86
+
87
+ * _Update npm dependencies to fix vulnerabilities_
88
+
89
+ ### 3.1.0
90
+
91
+ * Fix old API for base64 and escaping problem.
92
+
93
+ ### 3.0.0
94
+
95
+ * XLSX support. This bumps the build size to 640 KB.
96
+ * New API : ExcellentExport.convert(...)
97
+ * Autogenerate download filename.
98
+ * Data input from arrays or HTML Tables.
99
+ * Multiple sheets for XLS or XLSX formats.
100
+
101
+ ### 2.1.0
102
+
103
+ * Add Webpack build.
104
+ * Create UMD JavaScript module. Library can be loaded as a module (import, RequireJS, AMD, etc...) or standalone as window.ExcelentExport.
105
+
106
+ ### 2.0.3
107
+
108
+ * Fix export as a module.
109
+ * Changed minifier to UglifyJS.
110
+
111
+ ### 2.0.2
112
+
113
+ * Fix CSV Chinese characters and other special characters display error in Windows Excel.
114
+ * Fix URL.createObjectURL(...) on Firefox.
115
+
116
+
117
+ ### 2.0.0
118
+
119
+ * Now it can export to big files +2MB.
120
+ * Minimum IE 11.
121
+ * Links open with URL.createObjectURL(...).
122
+ * NPM package available.
123
+ * Using Semantic versioning (2.0.0 instead of 2.0).
124
+ * Module can be loaded standalone or with RequireJS.
125
+ * Change license to MIT.
126
+
127
+ ### 1.5
128
+
129
+ * Possibility to select a CSV delimiter.
130
+ * Bower package available.
131
+ * Compose package available.
132
+
133
+ ### 1.4
134
+
135
+ * _Add LICENSE.txt with GPL v3_
136
+ * UTF-8 characters fixed.
137
+
138
+ ### 1.3
139
+
140
+ * _Added minified version_
141
+
142
+ ### 1.1
143
+
144
+ * _Added CSV data export_
145
+
146
+ ### 1.0
147
+
148
+ * _Added Excel data export_
149
+
150
+ ## Compatibility
151
+
152
+ - Firefox
153
+ - Chrome
154
+ - Internet Explorer 11+
155
+
156
+ # Install
157
+
158
+ ## npm
159
+
160
+ npm install excellentexport --save
161
+
162
+ ## yarn
163
+
164
+ yarn add excellentexport
165
+
166
+ ## bower
167
+
168
+ bower install excellentexport
169
+
170
+ # Load
171
+
172
+
173
+ **Include script in your HTML:**
174
+
175
+ <script type="text/javascript" src="dist/excellentexport.js"></script>
176
+
177
+ **Include script in your HTML using CDN:**
178
+
179
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/excellentexport@3.4.3/dist/excellentexport.min.js"></script>
180
+
181
+
182
+ **Require.js**
183
+
184
+ <script src="http://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
185
+ <script>
186
+ require(['dist/excellentexport'], function(ee) {
187
+ window.ExcellentExport = ee;
188
+ });
189
+ </script>
190
+
191
+ **ES6 import**
192
+
193
+ import ExcellentExport from 'excellentexport';
194
+
195
+
196
+ # Usage
197
+
198
+ <table id="datatable">
199
+ <tr>
200
+ <td>100</td> <td>200</td> <td>300</td>
201
+ </tr>
202
+ <tr>
203
+ <td>400</td> <td>500</td> <td>600</td>
204
+ </tr>
205
+ </table>
206
+
207
+ <a download="somedata.xls" href="#" onclick="return ExcellentExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
208
+ <a download="somedata.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</a>
209
+ <!-- new API, xlsx -->
210
+ <a download="somedata.xlsx" href="#" onclick="return ExcellentExport.convert({ anchor: this, filename: 'data_123.array', format: 'xlsx'},[{name: 'Sheet Name Here 1', from: {table: 'datatable'}}]);">Export to CSV</a>
211
+
212
+ # API
213
+
214
+ ExcellentExport.convert(options, sheets);
215
+
216
+ Options:
217
+ {
218
+ anchor: String or HTML Element,
219
+ format: 'xlsx' or 'xls' or 'csv',
220
+ filename: String,
221
+ rtl: Use Right-to-left characters, boolean (optional)
222
+ }
223
+
224
+ Sheets must be an array of sheet configuration objects. Sheet description:
225
+ [
226
+ {
227
+ name: 'Sheet 1', // Sheet name
228
+ from: {
229
+ table: String/Element, // Table ID or table element
230
+ array: [...] // Array with the data. Array where each element is a row. Every row is an array of the cells.
231
+ },
232
+ removeColumns: [...], // Array of column indexes (from 0)
233
+ filterRowFn: function(row) {return true}, // Function to decide which rows are returned
234
+ fixValue: function(value, row, column) {return fixedValue} // Function to fix values, receiving value, row num, column num
235
+ fixArray: function(array) {return array} // Function to manipulate the whole data array
236
+ rtl: Use Right-to-left characters, boolean (optional)
237
+ ...
238
+ },
239
+ {
240
+ ...
241
+ }, ...
242
+ ]
243
+
244
+ ## fixValue example
245
+
246
+ This is an example for the _fixValue function_ to handle HTML tags inside a table cell.
247
+ It transforms BR to line breaks and then strips all the HTML tags.
248
+
249
+ fixValue: (value, row, col) => {
250
+ let v = value.replace(/<br>/gi, "\n");
251
+ let strippedString = v.replace(/(<([^>]+)>)/gi, "");
252
+ return strippedString;
253
+ }
254
+
255
+
256
+ # Notes
257
+
258
+ - IE8 or lower do not support *data:* url schema.
259
+ - IE9 does not support *data:* url schema on links.
260
+ - IE10 and above and Edge are supported via the Microsoft-specific `msOpenOrSaveBlob` method.
261
+
262
+ # Test
263
+
264
+ python 2.x:
265
+ python -m SimpleHTTPServer 8000
266
+
267
+ python 3.x:
268
+ python -m http.server 8000
269
+
270
+ # Build
271
+
272
+ **Install dependencies:**
273
+
274
+ npm install
275
+
276
+ **Build development version dist/excellentexport.js**
277
+
278
+ npm run build
279
+
280
+ **Build publish version of dist/excellentexport.js**
281
+
282
+ npm run prod
283
+
284
+ **Publish**
285
+
286
+ npm publish