-
-
Notifications
You must be signed in to change notification settings - Fork 72
3.0 fixed columns and rows #56
Changes from all commits
939e035
6b38f3a
24f8be7
9b403c5
81ee2c8
b40dc70
3364c09
8367945
81ad7b2
1c0ff08
1147ba6
e2439aa
ba37ad8
56e59fe
6b3e1f6
9651bcf
f123fee
0dfbd90
cc6bb94
c0994c9
ee98b20
79747bd
35da207
6ba6193
ffd0752
98d1a96
0b4481d
55c6228
46e5f36
1f48808
d0a18a2
4447d54
f81b6e8
e84918b
1309173
08b1607
0a4accb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| declare module 'sheetclip' { | ||
| const value: any; | ||
| export default value; | ||
| } |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "dash-table", | ||
| "version": "3.0.0rc5", | ||
| "version": "3.0.0rc6", | ||
| "description": "Dash table", | ||
| "main": "build/index.js", | ||
| "scripts": { | ||
|
|
@@ -16,14 +16,15 @@ | |
| "private::lint.js": "eslint src", | ||
| "private::lint.ts": "tslint --project . src/**/*.ts", | ||
| "private::opentests": "cypress open", | ||
| "private::runtests": "cypress run", | ||
| "private::snapshots": "build-storybook && percy-storybook", | ||
| "private::runtests": "cypress run --browser chrome", | ||
| "private::test-e2e": "run-p --race private::host* private::runtests", | ||
| "private::test-visual": "build-storybook && percy-storybook", | ||
| "build.watch": "webpack-dev-server --content-base dash_table --mode development", | ||
| "build:js-dev": "run-s \"private::build -- --mode development\"", | ||
| "build:js": "run-s \"private::build -- --mode production\"", | ||
| "build:py": "./extract-meta src/dash-table/components/Table.js > dash_table/metadata.json && cp package.json dash_table", | ||
| "build:py": "./extract-meta src/dash-table/Table.js > dash_table/metadata.json && cp package.json dash_table", | ||
| "lint": "run-s private::lint.js private::lint.ts", | ||
| "test": "run-p --race private::host* private::runtests private::snapshots", | ||
| "test": "run-s private::test-*", | ||
|
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. Turns out the e2e tests and visual tests were racing one another -- visual tests are very short, so e2e tests were never run in CircleCI 😞 |
||
| "test.watch": "run-p --race \"private::build -- --mode development --watch\" --race private::host* private::opentests" | ||
| }, | ||
| "author": "Chris P <chris@plot.ly", | ||
|
|
@@ -42,13 +43,14 @@ | |
| "@storybook/cli": "^4.0.0-alpha.16", | ||
| "@storybook/react": "^4.0.0-alpha.16", | ||
| "@types/ramda": "^0.25.36", | ||
| "@types/react-select": "^1.2.1", | ||
| "babel-core": "^6.26.3", | ||
| "babel-eslint": "^8.2.3", | ||
| "babel-loader": "^7.1.4", | ||
| "babel-preset-env": "^1.7.0", | ||
| "babel-preset-react": "^6.24.1", | ||
| "css-loader": "^0.28.11", | ||
| "cypress": "^3.0.3", | ||
| "cypress": "^3.1.0", | ||
| "eslint": "^4.19.1", | ||
| "eslint-config-prettier": "^2.9.0", | ||
| "eslint-plugin-import": "^2.12.0", | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| export default class Clipboard { | ||
| public static set(value: string): void { | ||
| const el = document.createElement('textarea'); | ||
| el.value = value; | ||
|
|
||
| // (Adapted from https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f) | ||
| // Make it readonly to be tamper-proof | ||
| el.setAttribute('readonly', ''); | ||
| // el.style.position = 'absolute'; | ||
| // Move outside the screen to make it invisible | ||
| // el.style.left = '-9999px'; | ||
| // Append the <textarea> element to the HTML document | ||
| document.body.appendChild(el); | ||
|
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. Copying this over / refactoring, leaving comments as is. |
||
|
|
||
| // Check if there is any content selected previously | ||
| let selected; | ||
| if (document.getSelection().rangeCount > 0) { | ||
| // Store selection if found | ||
| selected = document.getSelection().getRangeAt(0); | ||
| } | ||
|
|
||
| // Select the <textarea> content | ||
| el.select(); | ||
| // Copy - only works as a result of a user action (e.g. click events) | ||
| document.execCommand('copy'); | ||
| // Remove the <textarea> element | ||
| document.body.removeChild(el); | ||
| // If a selection existed before copying | ||
| if (selected) { | ||
| // Unselect everything on the HTML document | ||
| document.getSelection().removeAllRanges(); | ||
| // Restore the original selection | ||
| document.getSelection().addRange(selected); | ||
| } | ||
| } | ||
|
|
||
| public static get(ev: ClipboardEvent) { | ||
| return ev.clipboardData ? | ||
| ev.clipboardData.getData('text/plain') : | ||
| undefined; | ||
| } | ||
| } | ||
|
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. Wrapper around the clipboard implementation details (especially the copy portion) -- nothing here is dash or dash table specific |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { DebugLevel, LogLevel } from 'core/Logger'; | ||
| import CookieStorage from 'core/storage/Cookie'; | ||
|
|
||
| const DASH_DEBUG = 'dash_debug'; | ||
| const DASH_LOG = 'dash_log'; | ||
|
|
||
| export default class Environment { | ||
| private static get searchParams() { | ||
| return new URL(window.location.href).searchParams; | ||
| } | ||
|
|
||
| public static get debugLevel(): DebugLevel { | ||
| const debug = this.searchParams.get(DASH_DEBUG) || CookieStorage.get(DASH_DEBUG); | ||
|
|
||
| return debug ? | ||
| (DebugLevel as any)[debug] || DebugLevel.NONE : | ||
| DebugLevel.NONE; | ||
| } | ||
|
|
||
| public static get logLevel(): LogLevel { | ||
| const log = this.searchParams.get(DASH_LOG) || CookieStorage.get(DASH_LOG); | ||
|
|
||
| return log ? | ||
| (LogLevel as any)[log] || LogLevel.ERROR : | ||
| LogLevel.ERROR; | ||
| } | ||
|
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. Making it possible to use cookies or additional params to override dash component behavior. In this case, toggling debug & log levels. Useful when testing against deployed component. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| export default (seed: number | undefined = undefined) => { | ||
| let lcg = (a: number) => a * 48271 % 2147483647; | ||
|
|
||
| let safeSeed = seed !== undefined ? lcg(seed) : lcg(Math.random()); | ||
|
|
||
| return () => (safeSeed = lcg(safeSeed)) / 2147483648; | ||
| }; | ||
|
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. There's no seed in Math.random.. useful for testing purposes |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| const __1day = 86400 * 1000; | ||
| const __20years = 86400 * 1000 * 365 * 20; | ||
|
|
||
| export default class CookieStorage { | ||
| public static delete(id: string, domain: string = '', path: string = '/') { | ||
| let expires = new Date((new Date().getTime() - __1day)).toUTCString(); | ||
|
|
||
| document.cookie = `${id}=;expires=${expires};domain=${domain};path=${path}`; | ||
| } | ||
|
|
||
| public static get(id: string) { | ||
| if (!id.length) { | ||
| return; | ||
| } | ||
|
|
||
| id = id.toLowerCase(); | ||
|
|
||
| let cookies = document.cookie.split(';').map(cookie => { | ||
| let fragments = cookie.split('='); | ||
|
|
||
| return { | ||
| id: fragments[0].trim(), | ||
| value: fragments[1] | ||
| }; | ||
| }); | ||
|
|
||
| return (cookies.find(cookie => id === cookie.id.toLocaleLowerCase()) || {} as any).value; | ||
| } | ||
|
|
||
| public static set(id: string, value: string, domain: string = '', path: string = '/') { | ||
| let expires = new Date((new Date().getTime() + __20years)).toUTCString(); | ||
|
|
||
| let entry = `${id}=${value};expires=${expires};domain=${domain};path=${path}`; | ||
|
|
||
| if (CookieStorage.get(id)) { | ||
| CookieStorage.delete(id, domain, path); | ||
| } | ||
|
|
||
| document.cookie = entry; | ||
| } | ||
| } |
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.
Bumping the version