tabulator-tables 6.0.0 → 6.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabulator-tables",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Interactive table generation JavaScript library",
5
5
  "style": "dist/css/tabulator.css",
6
6
  "main": "dist/js/tabulator.js",
@@ -160,11 +160,11 @@ class Tabulator extends ModuleBinder{
160
160
  this._buildElement();
161
161
 
162
162
  this._initializeTable();
163
+
164
+ this.initialized = true;
163
165
 
164
166
  this._loadInitialData()
165
167
  .finally(() => {
166
- this.initialized = true;
167
-
168
168
  this.eventBus.dispatch("table-initialized");
169
169
  this.externalEvents.dispatch("tableBuilt");
170
170
  });
@@ -58,11 +58,11 @@ export default class Import extends Module{
58
58
  return importer;
59
59
  }
60
60
 
61
- importFromFile(importFormat, extension){
61
+ importFromFile(importFormat, extension, importReader){
62
62
  var importer = this.lookupImporter(importFormat);
63
63
 
64
64
  if(importer){
65
- return this.pickFile(extension)
65
+ return this.pickFile(extension, importReader)
66
66
  .then(this.importData.bind(this, importer))
67
67
  .then(this.structureData.bind(this))
68
68
  .then(this.setData.bind(this))
@@ -73,7 +73,7 @@ export default class Import extends Module{
73
73
  }
74
74
  }
75
75
 
76
- pickFile(extensions){
76
+ pickFile(extensions, importReader){
77
77
  return new Promise((resolve, reject) => {
78
78
  var input = document.createElement("input");
79
79
  input.type = "file";
@@ -83,7 +83,7 @@ export default class Import extends Module{
83
83
  var file = input.files[0],
84
84
  reader = new FileReader();
85
85
 
86
- switch(this.table.options.importReader){
86
+ switch(importReader || this.table.options.importReader){
87
87
  case "buffer":
88
88
  reader.readAsArrayBuffer(file);
89
89
  break;
@@ -0,0 +1,6 @@
1
+ export default function(input, floop){
2
+ var workbook2 = XLSX.read(input);
3
+ var sheet = workbook2.Sheets[workbook2.SheetNames[0]];
4
+
5
+ return XLSX.utils.sheet_to_json(sheet, {});
6
+ }
@@ -1,9 +1,11 @@
1
1
  import csv from './importers/csv.js';
2
2
  import json from './importers/json.js';
3
3
  import array from './importers/array.js';
4
+ import xlsx from './importers/xlsx.js';
4
5
 
5
6
  export default {
6
7
  csv:csv,
7
8
  json:json,
8
9
  array:array,
10
+ xlsx:xlsx,
9
11
  };
@@ -0,0 +1,450 @@
1
+
2
+ //Main Theme Variables
3
+ $backgroundColor: #fff !default; //background color of tabulator
4
+ $themeColor:#3FB449;
5
+ $borderColor:#222 !default; //border to tabulator
6
+ $textSize:14px !default; //table text size
7
+
8
+ //header theming
9
+ $headerBackgroundColor:#222 !default; //border to tabulator
10
+ $headerTextColor:#fff !default; //header text color
11
+ $headerBorderColor:#aaa !default; //header border color
12
+ $headerSeparatorColor:$themeColor !default; //header bottom separator color
13
+ $headerMargin:4px !default; //padding round header
14
+
15
+ //column header arrows
16
+ $sortArrowActive: $themeColor !default;
17
+ $sortArrowInactive: #bbb !default;
18
+
19
+ //row theming
20
+ $rowBackgroundColor:#fff !default; //table row background color
21
+ $rowAltBackgroundColor:#EFEFEF !default; //table row background color
22
+ $rowBorderColor:#aaa !default; //table border color
23
+ $rowTextColor:#333 !default; //table text color
24
+ $rowHoverBackground:#bbb !default; //row background color on hover
25
+
26
+ $rowSelectedBackground: #70c28e !default; //row background color when selected
27
+ $rowSelectedBackgroundHover: #269b51 !default;//row background color when selected and hovered
28
+
29
+
30
+ $editBoxColor:#1D68CD !default; //border color for edit boxes
31
+ $errorColor:#dd0000 !default; //error indication
32
+
33
+ //footer theming
34
+ $footerBackgroundColor:#222 !default; //border to tabulator
35
+ $footerTextColor:#222 !default; //footer text color
36
+ $footerBorderColor:#aaa !default; //footer border color
37
+ $footerSeparatorColor:$themeColor !default; //footer bottom separator color
38
+ $footerActiveColor:$footerSeparatorColor !default; //footer bottom active text color
39
+
40
+ //range selection
41
+ $rangeBorderColor: $rowSelectedBackgroundHover !default; //range border color
42
+ $rangeHandleColor: $rangeBorderColor !default; //range handle color
43
+ $rangeHeaderSelectedBackground: $rangeBorderColor !default; //header background color when selected
44
+ $rangeHeaderSelectedTextColor: #FFFFFF !default; //header text color when selected
45
+ $rangeHeaderHighlightBackground: $rowSelectedBackground !default; //header background color when highlighted
46
+ $rangeHeaderTextHighlightBackground: #000000 !default; //header text color when highlighted
47
+
48
+ @import "../tabulator.scss";
49
+
50
+ .tabulator{
51
+ border:1px solid #282828;
52
+ background-color: #111111;
53
+
54
+ &[tabulator-layout="fitColumns"]{
55
+ .tabulator-row{
56
+ .tabulator-cell{
57
+ &:last-of-type{
58
+ border-right: none;
59
+ }
60
+ }
61
+ }
62
+
63
+ .tabulator-header {
64
+ .tabulator-col {
65
+ &:last-child {
66
+ border-right: none;
67
+ }
68
+ }
69
+ }
70
+ }
71
+
72
+ input, select {
73
+ line-height: normal;
74
+ color: #222;
75
+ }
76
+
77
+ .tabulator-header{
78
+ background-color: #080808;
79
+ border-bottom:3px solid $headerSeparatorColor;
80
+
81
+ .tabulator-col{
82
+ border-right-color:#393838;
83
+ background-color: #101010;
84
+
85
+ &.range-header-col {
86
+ border-right:2px solid #3FB449;
87
+ }
88
+
89
+ &.tabulator-col-group {
90
+ .tabulator-col-group-cols{
91
+ border-top-color:#393838;
92
+ border-bottom-color:#393838;
93
+ }
94
+ }
95
+
96
+ &.tabulator-range-highlight{
97
+ background-color: #163220;
98
+ color: #fff;
99
+ }
100
+
101
+ &.tabulator-range-selected{
102
+ background-color: #3FB449;
103
+ color: #fff;
104
+ }
105
+
106
+ &.tabulator-row-header{
107
+ border-right:1px solid $borderColor !important;
108
+ }
109
+
110
+ input,
111
+ select {
112
+ box-sizing: border-box;
113
+
114
+ padding: 4px 10px;
115
+
116
+ border: 1px solid #4b4b4b;
117
+ border-radius: 2px;
118
+
119
+ background: #1f1f1f;
120
+ color: #fff;
121
+
122
+ outline: none;
123
+
124
+ &:focus {
125
+ border-color: $themeColor;
126
+ }
127
+ }
128
+
129
+ input + input{
130
+ margin-left:5px;
131
+ }
132
+
133
+ .tabulator-col-content{
134
+ padding:8px;
135
+ }
136
+ }
137
+
138
+ .tabulator-calcs-holder{
139
+ background:lighten($headerBackgroundColor, 10%) !important;
140
+ border-top: 1px solid #393838;
141
+
142
+ .tabulator-row{
143
+ background-color: #292929 !important;
144
+ }
145
+
146
+ border-top:1px solid $rowBorderColor;
147
+ border-bottom:none;
148
+ }
149
+
150
+ .tabulator-cell{
151
+ color:#ccc !important;
152
+ }
153
+ }
154
+
155
+ .tabulator-tableholder{
156
+
157
+ &::-webkit-scrollbar {
158
+ width: 12px;
159
+ /* width of the entire scrollbar */
160
+ }
161
+
162
+ &::-webkit-scrollbar-track {
163
+ background: #333;
164
+ /* color of the tracking area */
165
+ }
166
+
167
+ &::-webkit-scrollbar-thumb {
168
+ background-color: #666;
169
+ /* color of the scroll thumb */
170
+ border-radius: 20px;
171
+ /* roundness of the scroll thumb */
172
+ border: 3px solid #333;
173
+ /* creates padding around scroll thumb */
174
+ }
175
+
176
+ &::-webkit-scrollbar-corner {
177
+ background: #222;
178
+ }
179
+
180
+ .tabulator-placeholder{
181
+ span{
182
+ color:$headerSeparatorColor;
183
+ }
184
+ }
185
+
186
+ .tabulator-table{
187
+ color:#fff;
188
+ background-color: #111111;
189
+
190
+ .tabulator-row{
191
+ &.tabulator-calcs{
192
+ font-weight: bold;
193
+ background:lighten($headerBackgroundColor, 15%) !important;
194
+ color:$headerTextColor;
195
+ }
196
+
197
+ &.tabulator-calcs-top{
198
+ border-bottom:none;
199
+ }
200
+
201
+ &.tabulator-calcs-bottom{
202
+ border-top:none;
203
+ }
204
+ }
205
+ }
206
+ }
207
+
208
+ .tabulator-footer{
209
+ padding:5px 10px;
210
+ padding-top:8px;
211
+ border-top:3px solid $footerSeparatorColor;
212
+ background-color: #101010;
213
+
214
+ .tabulator-calcs-holder{
215
+ margin:-8px -10px 8px -10px;
216
+
217
+ background:lighten($footerBackgroundColor, 10%) !important;
218
+ border-bottom: 1px solid #393838;
219
+
220
+ .tabulator-row{
221
+ background-color: #292929 !important;
222
+ color:$headerTextColor !important;
223
+ }
224
+
225
+ border-top:none;
226
+ border-bottom:1px solid $rowBorderColor;
227
+ }
228
+
229
+ .tabulator-spreadsheet-tabs{
230
+ margin-top: -13px;
231
+ margin-bottom:-4px;
232
+
233
+ .tabulator-spreadsheet-tab{
234
+ padding: 4px 10px;
235
+ margin: 0 2px;
236
+
237
+ border-color: $footerActiveColor;
238
+ background-color: #000;
239
+ border-width:0 1px 1px 1px;
240
+
241
+ color:#ececec;
242
+ font-weight: normal;
243
+
244
+ &.tabulator-spreadsheet-tab-active{
245
+ background-color:$footerActiveColor;
246
+ color: #000;
247
+ font-weight: bold;
248
+ }
249
+ }
250
+ }
251
+
252
+ .tabulator-paginator{
253
+ label{
254
+ color:#fff;
255
+ }
256
+ }
257
+
258
+ .tabulator-page-counter{
259
+ color:#fff;
260
+ }
261
+
262
+ .tabulator-page{
263
+ background-color:#fff;
264
+
265
+ color: $footerTextColor;
266
+ font-family:inherit;
267
+ font-weight:inherit;
268
+ font-size:inherit;
269
+ }
270
+
271
+ .tabulator-page, .tabulator-page-size {
272
+ background:#ebebeb;
273
+ }
274
+ }
275
+ }
276
+
277
+ .tabulator-row{
278
+
279
+ background-color: #151515;
280
+
281
+ &.tabulator-row-even{
282
+ background-color: #202020;
283
+ }
284
+
285
+ &.tabulator-selectable:hover{
286
+ background-color:#000;
287
+ }
288
+
289
+ &.tabulator-selected{
290
+ background-color: #009136;
291
+ &:hover{
292
+ background-color:#00531f;
293
+ }
294
+ }
295
+
296
+ &.tabulator-group{
297
+ border-right-color:#393838;
298
+ border-top:1px solid #000;
299
+ border-bottom:2px solid $headerSeparatorColor;
300
+ background:$headerBackgroundColor;
301
+ color:$headerTextColor;
302
+
303
+ @media (hover:hover) and (pointer:fine){
304
+ &:hover{
305
+ background-color:darken($headerBackgroundColor, 10%);
306
+ }
307
+ }
308
+
309
+ span{
310
+ color:$headerSeparatorColor;
311
+ }
312
+ }
313
+
314
+ &.tabulator-range-highlight{
315
+ .tabulator-cell.tabulator-range-row-header{
316
+ background-color: #3FB449;
317
+ color: #fff;
318
+
319
+ &.tabulator-range-selected{
320
+ background-color: #163220;
321
+ color: #fff;
322
+ }
323
+ }
324
+
325
+ &.tabulator-range-selected{
326
+ .tabulator-cell.tabulator-range-row-header{
327
+ background-color: #3FB449;
328
+ color: #fff;
329
+ }
330
+ }
331
+ }
332
+
333
+ .tabulator-cell{
334
+ border-right-color:#393838;
335
+ color: #fff;
336
+ padding:6px;
337
+
338
+ &.tabulator-range-row-header{
339
+ border-right:2px solid #3FB449;
340
+ }
341
+
342
+ &.tabulator-editing{
343
+ border: 1px solid $themeColor;
344
+ }
345
+
346
+ &.tabulator-range-selected:not(.tabulator-range-only-cell-selected):not(.tabulator-range-row-header) {
347
+ background-color: #163220;
348
+ color: #fff;
349
+ }
350
+
351
+ &.tabulator-row-handle{
352
+ .tabulator-row-handle-box{
353
+ .tabulator-row-handle-bar{
354
+ background:$sortArrowActive;
355
+ }
356
+ }
357
+ }
358
+
359
+ &.tabulator-row-header{
360
+ border-right:1px solid $borderColor !important;
361
+ border-bottom:1px solid #2b2b2b;
362
+ background:#101010;
363
+ color: #fff;
364
+ font-weight: bold;
365
+ }
366
+
367
+ input, select, textarea{
368
+ background-color: #121212;
369
+ color: #ccc;
370
+ }
371
+
372
+ .tabulator-data-tree-control{
373
+ height:14px;
374
+ width:14px;
375
+
376
+ border: 2px solid $themeColor !important;
377
+
378
+
379
+ .tabulator-data-tree-control-collapse{
380
+ &:after{
381
+ position: absolute;
382
+ content: "";
383
+ left: -3px;
384
+ top: 2px;
385
+ height: 2px;
386
+ width: 6px;
387
+ background: $themeColor;
388
+ }
389
+ }
390
+
391
+ .tabulator-data-tree-control-expand {
392
+
393
+ height: 8px;
394
+ width: 2px;
395
+ background: $themeColor;
396
+
397
+ &:after {
398
+ position: absolute;
399
+ content: "";
400
+ left: -3px;
401
+ top: 3px;
402
+ height: 2px;
403
+ width: 8px;
404
+ background: $themeColor;
405
+ }
406
+ }
407
+ }
408
+
409
+ .tabulator-data-tree-branch{
410
+ border-left: 2px solid $themeColor;
411
+ border-bottom: 2px solid $themeColor;
412
+ }
413
+ }
414
+
415
+ .tabulator-responsive-collapse{
416
+ border-top:1px solid #393838;
417
+ border-bottom:1px solid #393838;
418
+ }
419
+
420
+ }
421
+
422
+ .tabulator-print-table{
423
+ border-collapse: collapse;
424
+
425
+ .tabulator-print-table-group{
426
+ border-bottom:2px solid $headerSeparatorColor;
427
+ background:$headerBackgroundColor;
428
+ color:$headerTextColor;
429
+
430
+ @media (hover:hover) and (pointer:fine){
431
+ &:hover{
432
+ background-color:darken($headerBackgroundColor, 10%);
433
+ }
434
+ }
435
+
436
+ span{
437
+ color:$headerSeparatorColor;
438
+ }
439
+ }
440
+ }
441
+
442
+ .tabulator-menu{
443
+ .tabulator-menu-item{
444
+ color:$themeColor;
445
+ }
446
+ }
447
+
448
+ .tabulator-popup, .tabulator-tooltip {
449
+ color: #000;
450
+ }