From 6617f785fd9204a0c849fae319175c2037b17a00 Mon Sep 17 00:00:00 2001 From: zombiej Date: Mon, 30 Jul 2018 13:56:49 +0800 Subject: [PATCH 1/5] fix #11458. Adjust treeNode draggable css --- components/tree/style/index.less | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/tree/style/index.less b/components/tree/style/index.less index dfe9ece962..407c5a6373 100644 --- a/components/tree/style/index.less +++ b/components/tree/style/index.less @@ -31,10 +31,11 @@ user-select: none; border-top: 2px transparent solid; border-bottom: 2px transparent solid; - margin-top: -2px; /* Required to make elements draggable in old WebKit */ -khtml-user-drag: element; -webkit-user-drag: element; + + line-height: @tree-title-height - 4px; } &.drag-over { > span[draggable] { From 1aa368d3e2042f09dca3d89726c9e868be482668 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 30 Jul 2018 16:21:59 +0800 Subject: [PATCH 2/5] docs: Add zhihu article link --- docs/spec/colors.zh-CN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/spec/colors.zh-CN.md b/docs/spec/colors.zh-CN.md index 2b9019d693..675d641d26 100644 --- a/docs/spec/colors.zh-CN.md +++ b/docs/spec/colors.zh-CN.md @@ -30,6 +30,8 @@ ReactDOM.render(, mountNode); Ant Design 的色板还具备进一步拓展的能力。经过设计师和程序员的精心调制,结合了色彩自然变化的规律,我们得出了一套色彩生成工具,当有进一步色彩设计需求时,设计者只需按照一定规则定义完毕主色,便可以自动获得一系列完整的衍生色。 +> Ant Design 三代色板的历史可以参看社区文章:[Ant Design 色板生成算法演进之路](https://zhuanlan.zhihu.com/p/32422584)。 + ### 中性色板 中性色包含了黑、白、灰。在蚂蚁中后台的网页设计中被大量使用到,合理的选择中性色能够令页面信息具备良好的主次关系,助力阅读体验。Ant Design 的中性色板一共包含了从白到黑的 10 个颜色。 From a5ee1c489916ec1959f32ab9a24681078ceaaa63 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Mon, 30 Jul 2018 16:31:31 +0800 Subject: [PATCH 3/5] chore: add nightly build and ignore gh-pages --- .circleci/config.yml | 99 +++++++++++++++++++++++++------------------- package.json | 2 +- 2 files changed, 58 insertions(+), 43 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b7336e952c..23442907d0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,6 +21,52 @@ references: environment: REACT: 16 + workflow: &workflow + jobs: + - setup: + filters: + branches: + ignore: gh-pages + - dist: + requires: + - setup + - compile: + requires: + - setup + - lint: + requires: + - setup + - test_dist: + requires: + - dist + - test_lib: + requires: + - compile + - test_es: + requires: + - compile + - test_dom: + requires: + - setup + - test_node: + requires: + - setup + - test_dist_15: + requires: + - dist + - test_lib_15: + requires: + - compile + - test_es_15: + requires: + - compile + - test_dom_15: + requires: + - setup + - test_node_15: + requires: + - setup + jobs: setup: <<: *container_config @@ -177,45 +223,14 @@ jobs: workflows: version: 2 - build-test: - jobs: - - setup - - dist: - requires: - - setup - - compile: - requires: - - setup - - lint: - requires: - - setup - - test_dist: - requires: - - dist - - test_lib: - requires: - - compile - - test_es: - requires: - - compile - - test_dom: - requires: - - setup - - test_node: - requires: - - setup - - test_dist_15: - requires: - - dist - - test_lib_15: - requires: - - compile - - test_es_15: - requires: - - compile - - test_dom_15: - requires: - - setup - - test_node_15: - requires: - - setup + build_test: + <<: *workflow + nightly: + <<: *workflow + triggers: + - schedule: + cron: "0 0 * * *" + filters: + branches: + only: + - master diff --git a/package.json b/package.json index 889013d1b6..f4a2e62970 100644 --- a/package.json +++ b/package.json @@ -196,7 +196,7 @@ "start": "rimraf _site && mkdir _site && node ./scripts/generateColorLess.js && cross-env NODE_ENV=development bisheng start -c ./site/bisheng.config.js", "start:preact": "node ./scripts/generateColorLess.js && cross-env NODE_ENV=development REACT_ENV=preact bisheng start -c ./site/bisheng.config.js", "site": "cross-env NODE_ENV=production bisheng build --ssr -c ./site/bisheng.config.js && node ./scripts/generateColorLess.js", - "predeploy": "antd-tools run clean && npm run site && cp netlify.toml _site", + "predeploy": "antd-tools run clean && npm run site && cp netlify.toml _site && cp -p .circleci _site", "deploy": "bisheng gh-pages --push-only", "pub": "antd-tools run pub", "prepublish": "antd-tools run guard", From 05ca7a559a604a7a47f599a9ccaa21c94b00e1db Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Mon, 30 Jul 2018 16:39:30 +0800 Subject: [PATCH 4/5] chore: fix dir copy --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f4a2e62970..1fec7521b9 100644 --- a/package.json +++ b/package.json @@ -196,7 +196,7 @@ "start": "rimraf _site && mkdir _site && node ./scripts/generateColorLess.js && cross-env NODE_ENV=development bisheng start -c ./site/bisheng.config.js", "start:preact": "node ./scripts/generateColorLess.js && cross-env NODE_ENV=development REACT_ENV=preact bisheng start -c ./site/bisheng.config.js", "site": "cross-env NODE_ENV=production bisheng build --ssr -c ./site/bisheng.config.js && node ./scripts/generateColorLess.js", - "predeploy": "antd-tools run clean && npm run site && cp netlify.toml _site && cp -p .circleci _site", + "predeploy": "antd-tools run clean && npm run site && cp netlify.toml _site && cp -r .circleci _site", "deploy": "bisheng gh-pages --push-only", "pub": "antd-tools run pub", "prepublish": "antd-tools run guard", From d7ca64b95cd996fcf0460334f6cdab3973f19a95 Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Tue, 24 Jul 2018 17:41:01 +0800 Subject: [PATCH 5/5] docs: add resizable column table demo --- .../__tests__/__snapshots__/demo.test.js.snap | 253 ++++++++++++++++++ components/table/demo/dynamic-settings.md | 2 +- components/table/demo/resizable-column.md | 135 ++++++++++ package.json | 1 + 4 files changed, 390 insertions(+), 1 deletion(-) create mode 100644 components/table/demo/resizable-column.md diff --git a/components/table/__tests__/__snapshots__/demo.test.js.snap b/components/table/__tests__/__snapshots__/demo.test.js.snap index 8ad6f7a6fb..503d5c4571 100755 --- a/components/table/__tests__/__snapshots__/demo.test.js.snap +++ b/components/table/__tests__/__snapshots__/demo.test.js.snap @@ -9283,6 +9283,259 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` `; +exports[`renders ./components/table/demo/resizable-column.md correctly 1`] = ` +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Date + + + + + Amount + + + + + Type + + + + + Note + + + + + Action + +
+ + 2018-02-11 + + 120 + + income + + transfer + + + Delete + +
+ + 2018-03-11 + + 243 + + income + + transfer + + + Delete + +
+ + 2018-04-11 + + 98 + + income + + transfer + + + Delete + +
+
+
+
+ +
+
+
+`; + exports[`renders ./components/table/demo/row-selection.md correctly 1`] = `
{ + const { onResize, width, ...restProps } = props; + + if (!width) { + return ; + } + + return ( + + + + ); +}; + +class Demo extends React.Component { + state = { + columns: [{ + title: 'Date', + dataIndex: 'date', + width: 200, + }, { + title: 'Amount', + dataIndex: 'amount', + width: 100, + }, { + title: 'Type', + dataIndex: 'type', + width: 100, + }, { + title: 'Note', + dataIndex: 'note', + width: 100, + }, { + title: 'Action', + key: 'action', + render: () => ( + Delete + ), + }], + }; + + components = { + header: { + cell: ResizeableTitle, + }, + }; + + data = [{ + key: 0, + date: '2018-02-11', + amount: 120, + type: 'income', + note: 'transfer', + }, { + key: 1, + date: '2018-03-11', + amount: 243, + type: 'income', + note: 'transfer', + }, { + key: 2, + date: '2018-04-11', + amount: 98, + type: 'income', + note: 'transfer', + }]; + + handleResize = index => (e, { size }) => { + this.setState(({ columns }) => { + const nextColumns = [...columns]; + nextColumns[index] = { + ...nextColumns[index], + width: size.width, + }; + return { columns: nextColumns }; + }); + }; + + render() { + const columns = this.state.columns.map((col, index) => ({ + ...col, + onHeaderCell: column => ({ + width: column.width, + onResize: this.handleResize(index), + }), + })); + + return ( + + ); + } +} + + +ReactDOM.render(, mountNode); +```` + +````css +#components-table-demo-resizable-column .react-resizable { + position: relative; +} + +#components-table-demo-resizable-column .react-resizable-handle { + position: absolute; + width: 10px; + height: 100%; + bottom: 0; + right: -5px; + cursor: col-resize; +} +```` diff --git a/package.json b/package.json index 1fec7521b9..44e2cf9305 100644 --- a/package.json +++ b/package.json @@ -158,6 +158,7 @@ "react-github-button": "^0.1.1", "react-infinite-scroller": "^1.0.15", "react-intl": "^2.0.1", + "react-resizable": "^1.7.5", "react-router-dom": "^4.2.2", "react-sublime-video": "^0.2.0", "react-virtualized": "~9.20.0",