UNPKG

8.91 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### 6.14.1
69- removed console logging accidentally left in
70
71### 6.14.0
72- 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
73
74### 6.13.11
75- patch to fix edge case for OverflowExpander max-width
76
77### 6.13.10
78- patch to fix availableWidth calculation from sizing for OverflowExpander
79
80**API Additions**
81- added `scrollToColumn` (number) prop which is the index of column to scroll to.
82
83### 6.13
84
85**API Additions**
86- added `scrollToColumn` (number) prop which is the index of column to scroll to.
87
88### 6.11
89
90**API Additions**
91- added `activeColumnIndex` and `onActiveColumnChange` props
92
93
94### 6.10
95
96- Moved scrolling arrows to right side
97
98### 6.9
99
100**API Additions**
101
102- Changed `cellPadding` prop to be an object with 4 members: cellPaddingTop, cellPaddingBottom, cellPaddingLeft, cellPaddingRight
103- Included aphrodite library (https://github.com/Khan/aphrodite) for injecting inline styling into components
104- 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
105 - note: backwards-compatible; set CELL_EXPANDER_SAMELINE = true for new behavior, false for previous version behavior
106- Added code/behavior supplying a default image for ImageCell images that are broken/404
107- Added more styling flexibility when dealing with cells/content, although not all is being used at present
108
109### 6.8
110
111**API Additions**
112
113- Added `rowHeight`, `headerHeight`, `lineHeight`, and `cellPadding` as new props
114
115### 6.7
116
117**API Additions**
118
119- Added `scrollToNewColumn` (boolean) prop, which will scroll to a newly added column
120
121### 6.6.2
122
123- Reference column widths by cell content rather than width in state when resizeByContent prop is set and data is present
124
125### 6.6
126
127- Created separate less file to support users that are using less in their projects
128
129### 6.5
130
131**API Additions**
132
133- Added `showScrollingArrows` (boolean) prop, which will show horizontal arrows if horizontal scrolling is available
134
135### 6.4
136
137**API Additions**
138
139- Added `hideRowNumbers` (boolean) prop, which hides the row number column.
140- Added `rowNumberColumnWidth` to options prop, which allows an override of the width of the row number column.
141
142### 6.3.3
143
144- Add ability to pass in default min column width and move font details to options
145
146### 6.3.2
147
148- Allow for column keys to be unique id or name. Add props for maxContentWidth and maxTitleWidth
149
150### 6.2.2
151
152- Return stringified object instead of string length
153
154### 6.2.1
155
156**Style changes**
157
158- Determine auto column width with canvas
159- Make auto resize column and onSchemaChange callback optional
160
161### 6.2.0
162
163**Style changes**
164
165- Added default columnn sized to be based off of character count
166
167### 6.1.4
168- Styling changes, moving ellipsis to top
169- Added extra checks for schema and column changes so `onSchemaChange` fires less often
170
171### 6.1.0
172
173**API Additions**
174
175- Added `onSchemaChange` prop, which is a function that returns the updated schema after reordering columns.
176
177### 6.0.0
178
179- Added column reordering support and upgraded to [Fixed Data Table 2](https://github.com/schrodinger/fixed-data-table-2)
180
181### 5.2.0
182
183- Added id (string) to options so we can save in localStorage by id. Default to not saving if there is no id.
184
185### 5.1.2
186
187- Reading columnWidths from localStorage to keep track of user changed columns.
188
189### 5.1.0
190
191**API Addition**
192
193- Updating mixedContentImageHelper to use the new API, supporting both referer and url.
194
195### 5.0.2
196
197**Style changes**
198
199- Changing the default position of cell expander.
200
201### 5.0.1
202
203**Style changes**
204
205- Fixing the display of more values label.
206
207### 5.0.0
208
209**Style changes**
210
211- Modifying styles of the elements.
212
213### 4.3.0
214
215**API Additions**
216
217- Adding `renderers` prop, which allow to specify custom renderers.
218
219### 4.2.3
220
221**Bug/Patch fixes**
222
223- Fixing the support for JSON object fields.
224
225### 4.2.2
226
227**Bug/Patch fixes**
228
229- Fixing the display of the ListCells to correctly include CellExpanders,
230- Adding "#" to the first column header.
231
232### 4.2.1
233
234**Bug/Patch fixes**
235
236- Fixing column resizing issues.
237
238### 4.2.0
239
240**API Additions**
241
242- Moving to `fixed-data-table` v0.6.0 and supporting new cell renderers.
243
244### 4.1.0
245
246**API Additions**
247
248- Adding a, `options.tableScrolled` prop that can an event handler for scrolling inside the table.
249
250**Bug/Patch fixes**
251
252- Fixing the scrolls on desktop/mobile.
253
254### 4.0.7
255
256**Bug/Patch fixes**
257
258- Adding support for scrolling on mobile, with dynamic data. Now when the data inside the table is updated, mobile scroll handle this case.
259
260### 4.0.6
261
262**Bug/Patch fixes**
263
264- Updating to react 0.14.x.
265
266### 4.0.5
267
268**Bug/Patch fixes**
269
270- Fixing the badge for displaying multiple values, when cell has an array of values.
271
272### 4.0.4
273
274**Bug/Patch fixes**
275
276- Fixing the `main` property in package.json.
277
278### 4.0.3
279
280**Bug/Patch fixes**
281
282- Updating the repository link in the package.json.
283
284### 4.0.2
285
286**Bug/Patch fixes**
287
288- Open sourcing the project.
289
290### 4.0.1
291
292**Bug/Patch fixes**
293
294- Changing the property `esnext:main` in package.json to point to ES6 sources, instead of compiled files.
295
296### 4.0.0
297
298**Breaking change**
299
300- Adding new option to the main table called "mixedContentImage".
301
302## Todo
303
304- Add tests for `CellUtils`, `ListCell` and `HugeTable`
305- Add JS doc
306- Try custom validation function to test `data` attribute based on the given schema
307- Use `shape` validation on cellData
308- Create an `EmptyCell` for empty cells