UNPKG

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