UNPKG

9.7 kBMarkdownView Raw
1# HugeTable
2
3Table component to handle huge sets of data, based on Facebook's FixedDataTable and Schrodinger's Fixed Data Table 2
4
5## How to use it
6
7Include the `HugeTable.css` file from the `dist` folder.
8
9**Important** For those using LESS in your projects: import the CSS file then the LESS file after it. This is a workaround to avoid a LESS bug caused when LESS compiles `calc()` from a CSS file. Example below:
10
11```
12@import (less) "../../node_modules/huge-table/dist/HugeTable.css";
13@import "../../node_modules/huge-table/dist/HugeTableLess.less";
14
15```
16
17
18```javascript
19// data and schema examples can be found inside the examples directory.
20
21var mountNode = document.getElementById('table-results');
22
23var options = {
24 height: 400,
25 width: 600
26};
27
28React.render(<HugeTable data={data} schema={schema} options={options} />, mountNode);
29```
30
31More comprehensive example can be found inside the [examples](examples) directory.
32
33## Table API
34
35- **data** - Takes an array of data that should be displayed inside the table,
36- **schema** - Takes an array of objects defining the name of particular fields to look for inside the `data` array, and their type of data, which will tell the table which Cell type to use for displaying a particular column of data. Check `examples` directory for exemplary set of data and schema files.
37- **renderers** - A map of cell renderers. This object can be used to define a custom cell renderer for column headers or cells of particular data type. Check the example to see how this can be used. Available renderer types are `{HEADER, DOUBLE, URL, STRING, IMAGE}`.
38- **options.height** - Height of the table component,
39- **options.width** - Width of the table component,
40- **options.mixedContentImage** - Function that can handle mixed content warnings for images being loaded inside the table. Function will be invoked with image URL, and allows developers to decide what do do when page is loaded for example with `https`, and image url has `http` protocol. Check `examples` directory for an example on how to use this.
41- **options.tableScrolled** - Function that will be called whenever the table has been scrolled. It can be used to hook to the scrolling of the table on mobile devices, and use it to adjust the view around the table according to the table scrolling.
42- **options.rowNumberColumnWidth** - width of the row number column.
43- **hideRowNumbers** Boolean prop that when present will hide the row number column.
44- **onSchemaChange** Function that fires anytime the inserted schema changes. Useful when tapping into column reordering. Returns `currentSchema`
45- **rowHeight**
46- **headerHeight**
47- **lineHeight**
48- **cellPadding**
49
50## Commands
51
52### Production build
53```
54npm run prepublish
55```
56
57Build the project in a production ready way.
58
59## Releasing
60
61- Commit changes to the repository on a separate branch,
62- Bump version in package.json file, after you are done with your changes (remember about SemVer!),
63- After you are done with your functionality, or if you think it is large enough, create a pull request with master branch to be peer reviewed,
64- After changes are merged into master branch, checkout master branch, run tests one more time, and publish this package to npm repository.
65
66## Changelog
67
68### 7.2.0
69
70**API Additions**
71- `resizableColumns` ability to override resizable columns, default is `true`
72- `reorderableColumns` ability to override reorderable columns, default is `true`
73- `disableClickEvents` disables clickable links on table
74
75### 7.1.0
76- Add ability to resize headers based off of text length.
77
78### 7.0.6
79- Fixed case where TextCell would improperly identify empty strings as falsey and pass an object to OverflowExpander causing it to break.
80
81### 7.0.5
82- Fixes for FE-769- where Column popovers go offscreen when many items in cell.
83
84### 7.0.3
85- fixed case in which cellData where text data was passed under main.text rather than in .text works correctly now
86
87### 7.0.2
88- fixed case in which TextCell would improperly stringify text when given cellData.type of 'AUTO'
89
90### 6.14.1
91- removed console logging accidentally left in
92
93### 6.14.0
94- introduced code in CellUtils.getComponentContent to account for a schemaItem type of "AUTO". A schemaItem type of AUTO will first look for a cellData.item.src value, and if this exists, will use the ImageCell cellRenderer; if it doesn't exist, will use the default TextCell cellRenderer
95
96### 6.13.11
97- patch to fix edge case for OverflowExpander max-width
98
99### 6.13.10
100- patch to fix availableWidth calculation from sizing for OverflowExpander
101
102**API Additions**
103- added `scrollToColumn` (number) prop which is the index of column to scroll to.
104
105### 6.13
106
107**API Additions**
108- added `scrollToColumn` (number) prop which is the index of column to scroll to.
109
110### 6.11
111
112**API Additions**
113- added `activeColumnIndex` and `onActiveColumnChange` props
114
115
116### 6.10
117
118- Moved scrolling arrows to right side
119
120### 6.9
121
122**API Additions**
123
124- Changed `cellPadding` prop to be an object with 4 members: cellPaddingTop, cellPaddingBottom, cellPaddingLeft, cellPaddingRight
125- Included aphrodite library (https://github.com/Khan/aphrodite) for injecting inline styling into components
126- Reworked the way CellExpander element is displayed and interacts with ImageCell/URLCell/TextCell; it's now right-justified within field context and on the same line
127 - note: backwards-compatible; set CELL_EXPANDER_SAMELINE = true for new behavior, false for previous version behavior
128- Added code/behavior supplying a default image for ImageCell images that are broken/404
129- Added more styling flexibility when dealing with cells/content, although not all is being used at present
130
131### 6.8
132
133**API Additions**
134
135- Added `rowHeight`, `headerHeight`, `lineHeight`, and `cellPadding` as new props
136
137### 6.7
138
139**API Additions**
140
141- Added `scrollToNewColumn` (boolean) prop, which will scroll to a newly added column
142
143### 6.6.2
144
145- Reference column widths by cell content rather than width in state when resizeByContent prop is set and data is present
146
147### 6.6
148
149- Created separate less file to support users that are using less in their projects
150
151### 6.5
152
153**API Additions**
154
155- Added `showScrollingArrows` (boolean) prop, which will show horizontal arrows if horizontal scrolling is available
156
157### 6.4
158
159**API Additions**
160
161- Added `hideRowNumbers` (boolean) prop, which hides the row number column.
162- Added `rowNumberColumnWidth` to options prop, which allows an override of the width of the row number column.
163
164### 6.3.3
165
166- Add ability to pass in default min column width and move font details to options
167
168### 6.3.2
169
170- Allow for column keys to be unique id or name. Add props for maxContentWidth and maxTitleWidth
171
172### 6.2.2
173
174- Return stringified object instead of string length
175
176### 6.2.1
177
178**Style changes**
179
180- Determine auto column width with canvas
181- Make auto resize column and onSchemaChange callback optional
182
183### 6.2.0
184
185**Style changes**
186
187- Added default columnn sized to be based off of character count
188
189### 6.1.4
190- Styling changes, moving ellipsis to top
191- Added extra checks for schema and column changes so `onSchemaChange` fires less often
192
193### 6.1.0
194
195**API Additions**
196
197- Added `onSchemaChange` prop, which is a function that returns the updated schema after reordering columns.
198
199### 6.0.0
200
201- Added column reordering support and upgraded to [Fixed Data Table 2](https://github.com/schrodinger/fixed-data-table-2)
202
203### 5.2.0
204
205- Added id (string) to options so we can save in localStorage by id. Default to not saving if there is no id.
206
207### 5.1.2
208
209- Reading columnWidths from localStorage to keep track of user changed columns.
210
211### 5.1.0
212
213**API Addition**
214
215- Updating mixedContentImageHelper to use the new API, supporting both referer and url.
216
217### 5.0.2
218
219**Style changes**
220
221- Changing the default position of cell expander.
222
223### 5.0.1
224
225**Style changes**
226
227- Fixing the display of more values label.
228
229### 5.0.0
230
231**Style changes**
232
233- Modifying styles of the elements.
234
235### 4.3.0
236
237**API Additions**
238
239- Adding `renderers` prop, which allow to specify custom renderers.
240
241### 4.2.3
242
243**Bug/Patch fixes**
244
245- Fixing the support for JSON object fields.
246
247### 4.2.2
248
249**Bug/Patch fixes**
250
251- Fixing the display of the ListCells to correctly include CellExpanders,
252- Adding "#" to the first column header.
253
254### 4.2.1
255
256**Bug/Patch fixes**
257
258- Fixing column resizing issues.
259
260### 4.2.0
261
262**API Additions**
263
264- Moving to `fixed-data-table` v0.6.0 and supporting new cell renderers.
265
266### 4.1.0
267
268**API Additions**
269
270- Adding a, `options.tableScrolled` prop that can an event handler for scrolling inside the table.
271
272**Bug/Patch fixes**
273
274- Fixing the scrolls on desktop/mobile.
275
276### 4.0.7
277
278**Bug/Patch fixes**
279
280- Adding support for scrolling on mobile, with dynamic data. Now when the data inside the table is updated, mobile scroll handle this case.
281
282### 4.0.6
283
284**Bug/Patch fixes**
285
286- Updating to react 0.14.x.
287
288### 4.0.5
289
290**Bug/Patch fixes**
291
292- Fixing the badge for displaying multiple values, when cell has an array of values.
293
294### 4.0.4
295
296**Bug/Patch fixes**
297
298- Fixing the `main` property in package.json.
299
300### 4.0.3
301
302**Bug/Patch fixes**
303
304- Updating the repository link in the package.json.
305
306### 4.0.2
307
308**Bug/Patch fixes**
309
310- Open sourcing the project.
311
312### 4.0.1
313
314**Bug/Patch fixes**
315
316- Changing the property `esnext:main` in package.json to point to ES6 sources, instead of compiled files.
317
318### 4.0.0
319
320**Breaking change**
321
322- Adding new option to the main table called "mixedContentImage".
323
324## Todo
325
326- Add tests for `CellUtils`, `ListCell` and `HugeTable`
327- Add JS doc
328- Try custom validation function to test `data` attribute based on the given schema
329- Use `shape` validation on cellData
330- Create an `EmptyCell` for empty cells