-
-
Notifications
You must be signed in to change notification settings - Fork 72
Default Styles #196
Default Styles #196
Changes from all commits
c9ffc01
27d5d06
1c9bf0d
795f671
92db36e
d28023a
d3e9d2c
08ed960
3fe2d9d
3f190f4
5a7b64e
899461e
e8b6832
4525cb6
a574bbf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,7 +65,6 @@ export default class CellFactory { | |
| active_cell, | ||
| columns, | ||
| viewport.data, | ||
| editable, | ||
| selected_cells | ||
| ); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,6 @@ interface IColumnFilterProps { | |
| classes: string; | ||
| columnId: ColumnId; | ||
| isValid: boolean; | ||
| property: ColumnId; | ||
| setFilter: SetFilter; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. property was redundant with columnId and unused |
||
| value?: string; | ||
| } | ||
|
|
@@ -60,6 +59,7 @@ export default class ColumnFilter extends PureComponent<IColumnFilterProps, ICol | |
| > | ||
| <IsolatedInput | ||
| value={value} | ||
| placeholder={`filter data...`} | ||
| stopPropagation={true} | ||
| submit={this.submit} | ||
| /> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,13 +128,29 @@ | |
| } | ||
| } | ||
|
|
||
| .dash-filter.invalid { | ||
| & when (@isListView = True) { | ||
| .inset-shadow(red, 0px, 0px, 0px, -1px); | ||
| .dash-filter { | ||
| input::placeholder { | ||
| color: inherit; | ||
| font-size: 0.8em; | ||
| padding-right: 5px; | ||
| } | ||
|
|
||
| & + .dash-filter { | ||
| &:not(:hover):not(:focus-within) { | ||
| input::placeholder { | ||
| color: transparent; | ||
| } | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only display the placeholder if (1) the filter is the first (not selected by & + .dash-filter), otherwise only show if hovered or focused |
||
| } | ||
|
|
||
| & when (@isListView = False) { | ||
| .inset-shadow(red, 1px, 1px, -1px, -1px); | ||
| &.invalid { | ||
| & when (@isListView = True) { | ||
| .inset-shadow(red, 0px, 0px, 0px, -1px); | ||
| } | ||
|
|
||
| & when (@isListView = False) { | ||
| .inset-shadow(red, 1px, 1px, -1px, -1px); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -384,7 +400,7 @@ | |
| .dash-spreadsheet-inner table { | ||
| border-collapse: collapse; | ||
|
|
||
| font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace; | ||
| font-family: monospace; | ||
| --accent: hotpink; | ||
| --border: lightgrey; | ||
| --text-color: rgb(60, 60, 60); | ||
|
|
@@ -512,11 +528,6 @@ | |
| color: var(--accent); | ||
| } | ||
|
|
||
| .cell--uneditable, | ||
| .cell--uneditable input { | ||
| cursor: not-allowed; | ||
| } | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the cursor style on readonly cells |
||
| .expanded-row { | ||
| box-shadow: inset 2px 0px 0px 0px var(--accent), | ||
| inset -1px 0px 0px 0px var(--border); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,6 @@ import Cell from 'dash-table/components/Cell'; | |
| import isActiveCell from 'dash-table/derived/cell/isActive'; | ||
| import isSelectedCell from 'dash-table/derived/cell/isSelected'; | ||
| import memoizerCache from 'core/memoizerCache'; | ||
| import isEditable from './isEditable'; | ||
|
|
||
| type Key = [number, number]; | ||
| type ElementCacheFn = ( | ||
|
|
@@ -23,7 +22,6 @@ function getter( | |
| activeCell: ActiveCell, | ||
| columns: VisibleColumns, | ||
| data: Data, | ||
| editable: boolean, | ||
| selectedCells: SelectedCells | ||
| ): JSX.Element[][] { | ||
| return R.addIndex<Datum, JSX.Element[]>(R.map)( | ||
|
|
@@ -36,7 +34,6 @@ function getter( | |
| 'dash-cell' + | ||
| ` column-${columnIndex}` + | ||
| (active ? ' focused' : '') + | ||
| (!isEditable(editable, column.editable) ? ' cell--uneditable' : '') + | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cell-uneditable is now useless -- removing it.. the cell can be customized through the style_cell prop, there's no need for this css selector |
||
| (selected ? ' cell--selected' : '') + | ||
| (column.type === ColumnType.Dropdown ? ' dropdown' : ''); | ||
|
|
||
|
|
@@ -51,9 +48,8 @@ function getter( | |
| function decorator(_id: string): (( | ||
| activeCell: ActiveCell, | ||
| columns: VisibleColumns, | ||
| columnConditionalStyle: any, | ||
| columnStaticStyle: any, | ||
| data: Data | ||
| data: Data, | ||
| selectedCells: SelectedCells | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typing error here that went unnoticed because of the 'any' |
||
| ) => JSX.Element[][]) { | ||
| const elementCache = memoizerCache<Key, [boolean, string, number, ColumnId], JSX.Element>( | ||
| (active: boolean, classes: string, columnIndex: number, columnId: ColumnId) => (<Cell | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import * as R from 'ramda'; | ||
| import React from 'react'; | ||
| import { storiesOf } from '@storybook/react'; | ||
| import random from 'core/math/random'; | ||
| import DataTable from 'dash-table/DataTable'; | ||
|
|
||
| const setProps = () => { }; | ||
|
|
||
| const data = (() => { | ||
| const r = random(1); | ||
|
|
||
| return R.range(0, 5).map(() => ( | ||
| ['a', 'b', 'c'].reduce((obj: any, key) => { | ||
| obj[key] = Math.floor(r() * 1000); | ||
| return obj; | ||
| }, {}) | ||
| )); | ||
| })(); | ||
|
|
||
| let props = { | ||
| setProps, | ||
| id: 'table', | ||
| data: data, | ||
| filtering: true, | ||
| style_cell: { | ||
| width: 100, | ||
| min_width: 100, | ||
| max_width: 100 | ||
| } | ||
| }; | ||
|
|
||
| storiesOf('DashTable/Filtering', module) | ||
| .add('with a single column', () => (<DataTable | ||
| {...props} | ||
| columns={['a'].map(id => ({ id: id, name: id.toUpperCase() }))} | ||
| />)) | ||
| .add('with multiple columns', () => (<DataTable | ||
| {...props} | ||
| columns={['a', 'b', 'c'].map(id => ({ id: id, name: id.toUpperCase() }))} | ||
| />)); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two basic visual tests that make sure the first filter displays the placeholder and that the others do not. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding placeholder prop... wondering if we couldn't just compose off the dash-core-components input to get all the base prop types since the component works standalone. Might be an overkill, just thinking out loud here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that's not a bad idea. How would that work though? Maybe if we were to redo core-components so that it's built more as a JS library, that both dash-renderer and other repo's like dash-table could use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't really do that because components can't be properties right now in Dash. In the future, they could be. Otherwise, we'll need to copy over the properties one-by-one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is purely internal, I was thinking that just importing the component would work