Skip to content

Commit af10cdb

Browse files
christian-pernillo-telusChristian Pernillo
and
Christian Pernillo
authoredOct 13, 2020
feat/enable pop over on actions (#2)
* feat(actions): Adding actions renderer * feat(actions): Adding actions renderer * feat(actions): Render prop to able of render elements inside the actions * feat(general): Disabling travis and GH workflows Co-authored-by: Christian Pernillo <christian.pernillo@telusinternational.com>
1 parent 2701aa2 commit af10cdb

File tree

11 files changed

+137
-116
lines changed

11 files changed

+137
-116
lines changed
 

‎.github/workflows/ci.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
name: CI
1+
# name: CI
22

3-
on:
4-
push:
5-
branches: [develop, master]
6-
pull_request:
7-
branches: [develop]
3+
# on:
4+
# push:
5+
# branches: [develop, master]
6+
# pull_request:
7+
# branches: [develop]
88

9-
jobs:
10-
build:
11-
runs-on: ubuntu-latest
9+
# jobs:
10+
# build:
11+
# runs-on: ubuntu-latest
1212

13-
steps:
14-
- uses: actions/checkout@v2
15-
- name: Setup Node JS
16-
uses: actions/setup-node@v1
17-
with:
18-
node-version: 12.x
19-
- run: yarn install --ignore-engines
20-
- run: yarn lint:nofix
21-
- run: yarn test
13+
# steps:
14+
# - uses: actions/checkout@v2
15+
# - name: Setup Node JS
16+
# uses: actions/setup-node@v1
17+
# with:
18+
# node-version: 12.x
19+
# - run: yarn install --ignore-engines
20+
# - run: yarn lint:nofix
21+
# - run: yarn test
2222
# 💀💀💀💀cannot run coveralls since GH won't pass COVERALLS_REPO_TOKEN to forks; so any PRs from external contributors would fail
2323
# - run: yarn coveralls
2424
# env:

‎.github/workflows/docs.yml

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
name: Docs
1+
# name: Docs
22

3-
on:
4-
push:
5-
branches: [develop]
6-
paths:
7-
- 'docs/**'
8-
- package.json
9-
- README.md
3+
# on:
4+
# push:
5+
# branches: [develop]
6+
# paths:
7+
# - 'docs/**'
8+
# - package.json
9+
# - README.md
1010

11-
jobs:
12-
build-docs:
13-
runs-on: ubuntu-latest
11+
# jobs:
12+
# build-docs:
13+
# runs-on: ubuntu-latest
1414

15-
steps:
16-
- uses: actions/checkout@v2
17-
with:
18-
persist-credentials: false
19-
- name: Setup Node JS
20-
uses: actions/setup-node@v1
21-
with:
22-
node-version: 12.x
23-
- name: Build Docs 📚
24-
run: |
25-
# un-ignore bundle.js
26-
mv docs/.gitignore .gitignore
27-
yarn install --ignore-engines
28-
yarn build:docs
29-
- name: Deploy Pages 🚀
30-
uses: JamesIves/github-pages-deploy-action@releases/v3
31-
with:
32-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
33-
BRANCH: gh-pages
34-
FOLDER: docs
15+
# steps:
16+
# - uses: actions/checkout@v2
17+
# with:
18+
# persist-credentials: false
19+
# - name: Setup Node JS
20+
# uses: actions/setup-node@v1
21+
# with:
22+
# node-version: 12.x
23+
# - name: Build Docs 📚
24+
# run: |
25+
# # un-ignore bundle.js
26+
# mv docs/.gitignore .gitignore
27+
# yarn install --ignore-engines
28+
# yarn build:docs
29+
# - name: Deploy Pages 🚀
30+
# uses: JamesIves/github-pages-deploy-action@releases/v3
31+
# with:
32+
# ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
33+
# BRANCH: gh-pages
34+
# FOLDER: docs

‎.github/workflows/release.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
name: Release
1+
# name: Release
22

3-
on:
4-
push:
5-
branches: [master]
3+
# on:
4+
# push:
5+
# branches: [master]
66

7-
jobs:
8-
build-release:
9-
runs-on: ubuntu-latest
7+
# jobs:
8+
# build-release:
9+
# runs-on: ubuntu-latest
1010

11-
steps:
12-
- uses: actions/checkout@v2
13-
- name: Setup Node JS
14-
uses: actions/setup-node@v1
15-
with:
16-
node-version: 12.x
17-
- run: yarn install --ignore-engines
18-
- run: yarn lint:nofix
19-
- run: yarn test
20-
- name: Release to npm 🚀
21-
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
24-
run: npx semantic-release
11+
# steps:
12+
# - uses: actions/checkout@v2
13+
# - name: Setup Node JS
14+
# uses: actions/setup-node@v1
15+
# with:
16+
# node-version: 12.x
17+
# - run: yarn install --ignore-engines
18+
# - run: yarn lint:nofix
19+
# - run: yarn test
20+
# - name: Release to npm 🚀
21+
# env:
22+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
24+
# run: npx semantic-release

‎.github/workflows/semantic-pr.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
name: Semantic Pull Request
1+
# name: Semantic Pull Request
22

3-
on:
4-
pull_request_target:
5-
types:
6-
- opened
7-
- edited
8-
- synchronize
3+
# on:
4+
# pull_request_target:
5+
# types:
6+
# - opened
7+
# - edited
8+
# - synchronize
99

10-
jobs:
11-
prlint:
12-
runs-on: ubuntu-latest
10+
# jobs:
11+
# prlint:
12+
# runs-on: ubuntu-latest
1313

14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v2
14+
# steps:
15+
# - name: Checkout
16+
# uses: actions/checkout@v2
1717

18-
- name: semantic-pull-request
19-
uses: amannn/action-semantic-pull-request@v1.2.0
20-
env:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
# - name: semantic-pull-request
19+
# uses: amannn/action-semantic-pull-request@v1.2.0
20+
# env:
21+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.travis.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
language: node_js
2-
cache:
3-
yarn: true
4-
directories:
5-
- node_modules
6-
git:
7-
depth: 3
8-
jobs:
9-
include:
10-
- stage: test
11-
node_js: '10'
12-
install:
13-
- yarn install --ignore-engines
14-
script:
15-
- yarn coveralls
16-
branches:
17-
except:
18-
- /^v\d+\.\d+\.\d+$/
1+
# language: node_js
2+
# cache:
3+
# yarn: true
4+
# directories:
5+
# - node_modules
6+
# git:
7+
# depth: 3
8+
# jobs:
9+
# include:
10+
# - stage: test
11+
# node_js: '10'
12+
# install:
13+
# - yarn install --ignore-engines
14+
# script:
15+
# - yarn coveralls
16+
# branches:
17+
# except:
18+
# - /^v\d+\.\d+\.\d+$/

‎package.json

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "react-dropdown-tree-select",
3-
"version": "0.0.0-semantic-release",
2+
"name": "@telus/telus-react-dropdown-tree-select",
3+
"version": "1.0.0",
44
"description": "Lightweight, customizable and fast Dropdown Tree Select component for React",
55
"keywords": [
66
"react",
@@ -20,7 +20,10 @@
2020
],
2121
"main": "dist/react-dropdown-tree-select.js",
2222
"types": "dist/react-dropdown-tree-select.d.ts",
23-
"repository": "https://github.com/dowjones/react-dropdown-tree-select.git",
23+
"repository": {
24+
"type": "git",
25+
"url": "git+https://github.com/telus/react-dropdown-tree-select.git"
26+
},
2427
"author": "Hrusikesh Panda <hrusikesh.panda@dowjones.com>",
2528
"license": "MIT",
2629
"scripts": {
@@ -193,5 +196,12 @@
193196
"pre-commit": "lint-staged",
194197
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
195198
}
199+
},
200+
"bugs": {
201+
"url": "https://github.com/telus/react-dropdown-tree-select/issues"
202+
},
203+
"homepage": "https://github.com/telus/react-dropdown-tree-select#readme",
204+
"directories": {
205+
"doc": "docs"
196206
}
197207
}

‎src/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class DropdownTreeSelect extends Component {
3838
className: PropTypes.string,
3939
onChange: PropTypes.func,
4040
onAction: PropTypes.func,
41+
actionRenderer: PropTypes.func,
4142
onNodeToggle: PropTypes.func,
4243
onFocus: PropTypes.func,
4344
onBlur: PropTypes.func,
@@ -342,6 +343,7 @@ class DropdownTreeSelect extends Component {
342343
keepChildrenOnSearch={this.props.keepChildrenOnSearch}
343344
searchModeOn={this.state.searchModeOn}
344345
onAction={this.onAction}
346+
actionRenderer={this.props.actionRenderer}
345347
onCheckboxChange={this.onCheckboxChange}
346348
onNodeToggle={this.onNodeToggle}
347349
mode={mode}

‎src/tree-node/action.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ class Action extends PureComponent {
88
className: PropTypes.string,
99
actionData: PropTypes.object,
1010
onAction: PropTypes.func,
11+
actionRenderer: PropTypes.func,
1112
readOnly: PropTypes.bool,
1213
}
1314

1415
static defaultProps = {
1516
onAction: () => {},
17+
actionRenderer: (title, className, text, readOnly, handleClick) => {
18+
return (
19+
<i title={title} className={className} onClick={!readOnly ? handleClick : undefined}>
20+
{text}
21+
</i>
22+
)
23+
},
1624
}
1725

1826
handleClick = () => {
@@ -23,13 +31,8 @@ class Action extends PureComponent {
2331
}
2432

2533
render() {
26-
const { title, className, text, readOnly } = this.props
27-
28-
return (
29-
<i title={title} className={className} onClick={!readOnly ? this.handleClick : undefined}>
30-
{text}
31-
</i>
32-
)
34+
const { title, className, text, readOnly, actionRenderer } = this.props
35+
return <div className="action-wrapper">{actionRenderer(title, className, text, readOnly)}</div>
3336
}
3437
}
3538

‎src/tree-node/actions.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class Actions extends PureComponent {
88
static propTypes = {
99
id: PropTypes.string.isRequired,
1010
actions: PropTypes.array,
11+
actionRenderer: PropTypes.func,
1112
}
1213

1314
render() {

‎src/tree-node/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class TreeNode extends PureComponent {
6565
searchModeOn: PropTypes.bool,
6666
onNodeToggle: PropTypes.func,
6767
onAction: PropTypes.func,
68+
actionRenderer: PropTypes.func,
6869
onCheckboxChange: PropTypes.func,
6970
mode: PropTypes.oneOf(['multiSelect', 'simpleSelect', 'radioSelect', 'hierarchical']),
7071
showPartiallySelected: PropTypes.bool,
@@ -103,6 +104,7 @@ class TreeNode extends PureComponent {
103104
value,
104105
disabled,
105106
actions,
107+
actionRenderer,
106108
onAction,
107109
searchModeOn,
108110
onNodeToggle,
@@ -133,7 +135,7 @@ class TreeNode extends PureComponent {
133135
readOnly={readOnly}
134136
clientId={clientId}
135137
/>
136-
<Actions actions={actions} onAction={onAction} id={_id} readOnly={readOnly} />
138+
<Actions actions={actions} actionRenderer={actionRenderer} onAction={onAction} id={_id} readOnly={readOnly} />
137139
</li>
138140
)
139141
}

‎src/tree/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Tree extends Component {
2323
onChange: PropTypes.func,
2424
onNodeToggle: PropTypes.func,
2525
onAction: PropTypes.func,
26+
actionRenderer: PropTypes.func,
2627
onCheckboxChange: PropTypes.func,
2728
mode: PropTypes.oneOf(['multiSelect', 'simpleSelect', 'radioSelect', 'hierarchical']),
2829
showPartiallySelected: PropTypes.bool,
@@ -78,6 +79,7 @@ class Tree extends Component {
7879
showPartiallySelected,
7980
readOnly,
8081
onAction,
82+
actionRenderer,
8183
onChange,
8284
onCheckboxChange,
8385
onNodeToggle,
@@ -98,6 +100,7 @@ class Tree extends Component {
98100
onCheckboxChange={onCheckboxChange}
99101
onNodeToggle={onNodeToggle}
100102
onAction={onAction}
103+
actionRenderer={actionRenderer}
101104
mode={mode}
102105
showPartiallySelected={showPartiallySelected}
103106
readOnly={readOnly}

0 commit comments

Comments
 (0)
Please sign in to comment.