Skip to content

Commit 2b92981

Browse files
committed
Merge remote-tracking branch 'origin/release-2.2.9' into main
2 parents b0896a0 + d2d9964 commit 2b92981

17 files changed

+779
-211
lines changed

CHANGELOG.MD

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
### 2.2.9
2+
3+
- Added:
4+
- New record button at the top of the table
5+
- Yalc instructions to README as an alternative to yarn link(buggy) for development
6+
- Fix:
7+
- Archive functionality
8+
- Archive icon style
9+
10+
### 2.2.7 / 2.2.8
11+
- No change - We weren't sure if yarn link was broken or the library was broken
12+
13+
### 2.2.6
14+
15+
- Added:
16+
- Edit and archive buttons to table rows
17+
- Archived styling for rows that are archived
18+
- Configure whether edit and archive columns are shown via keys in the options prop of the FilterableTable. See README.md for more details about table props.
19+
120
### 2.2.5
221

322
- Fix: add .node-version and .tool-version files
@@ -65,7 +84,7 @@
6584
- Enforce newline between computed properties, methods and props
6685
- Enforce newline between sibling elements in markdown
6786
- Enforce whitespace between `if` and `()`
68-
- Refactoring:
87+
- Refactoring:
6988
- Use `mapGetters`, `mapState` & `mapActions` and `createNamespacedHelpers` instead of `this.$store.getters[]`
7089
- Use `const` for mutable object assignments
7190
- Use `v-text` instead of `{{}}` wherever possible
@@ -95,8 +114,8 @@
95114
- Fix the CSV Download
96115
### 1.0.1
97116

98-
-
117+
-
99118

100119
### 1.0.0
101120

102-
Initial version of the component library to test it works with npm.
121+
Initial version of the component library to test it works with npm.

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,22 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
3333
### Install local package
3434
- Clone this repo
3535
- Run `yarn build-lib` to create the library files in the dist folder
36-
- Run `yarn link` to enable you to sync this repo to another
36+
- Run either `yarn link` (not working well) to enable you to sync this repo to another OR `yalc push` (working well) to publish your library files to the local yalc repository
37+
- **in order to use `yalc push` you need to first install yalc, run `yarn global add yalc` or `npm install -g yalc` in the terminal**
38+
- if using `yalc` whenever you change something in the code and want to try it, you have to run `yarn build-lib` and `yalc push`
3739

3840
In your **new project** do the following:
39-
- Add the following the the package.json `"@unep-wcmc/wcmc-components": "../wcmc-components",`
40-
- Run `yarn link "@unep-wcmc/wcmc-components"`
41+
- if using `yarn link`
42+
- Add the following the the package.json `"@unep-wcmc/wcmc-components": "../wcmc-components",`
43+
- Run `yarn link "@unep-wcmc/wcmc-components"`
44+
- if using `yalc push`
45+
- Run `yalc add @unep-wcmc/wcmc-components && yalc link @unep-wcmc/wcmc-components && yarn install`
46+
- Add the following to the .gitignore file
47+
```
48+
# Yalc
49+
/.yalc
50+
yalc.lock
51+
````
4152
- In your js file add `import FilterableTable from "@unep-wcmc/wcmc-components"`
4253
- In your js file add `Vue.use(FilterableTable, { store })`
4354

docs/components/filterable-table.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ sidebar: auto
1414
| `filter-array` | `Array` | |
1515
| `options` | `Object` |   |
1616

17+
### Options
18+
19+
| Name | Type | Description |
20+
| ----------------------- | --------- | ----------- |
21+
| `columns` | `Array` | Array of column widths passed to css. Must equal the number of displayed columns. |
22+
| `showArchived` | `Boolean` | Configures whether the archive button is displayed. Default is false. |
23+
| `showEdit` | `Boolean` | Configures whether the edit button is displayed. Default is false. |
24+
| `hideMoreContentColumn` | `Boolean` | Configures whether the more content column/button is displayed. Default is false. |
25+
| `more...` | `type` | Continue to add to this... |
26+
1727
## Data
1828

1929
| Name | Type | Description | Initial value |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@unep-wcmc/wcmc-components",
3-
"version": "2.2.5",
3+
"version": "2.2.9",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/unepwcmc/wcmc-components.git"
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<template>
2+
<div @click="archive" :class="`button button__svg-wrapper button--${archiveClass}`" >
3+
<component
4+
:is="`svg-${archiveClass}`"
5+
class="button__svg"
6+
/>
7+
</div>
8+
</template>
9+
10+
<script>
11+
import axios from 'axios'
12+
import { setAxiosHeaders } from '../../helpers/helpers-axios.js'
13+
import SvgArchive from './svgs/SvgArchive.vue'
14+
import SvgRestore from './svgs/SvgRestore.vue'
15+
16+
export default {
17+
name: 'ArchiveButton',
18+
19+
components: {
20+
SvgArchive,
21+
SvgRestore
22+
},
23+
24+
props: {
25+
archiveUrl: {
26+
type: String,
27+
required: true
28+
},
29+
30+
archived: {
31+
type: Boolean,
32+
required: true
33+
},
34+
35+
recordId: {
36+
type: Number,
37+
required: true
38+
},
39+
},
40+
41+
computed: {
42+
archiveClass () {
43+
return this.archived ? 'restore' : 'archive'
44+
}
45+
},
46+
47+
methods:{
48+
archive () {
49+
const data = {
50+
id: this.recordId,
51+
archived: this.archived ? 0 : 1
52+
}
53+
54+
setAxiosHeaders(axios)
55+
56+
axios.post(this.archiveUrl, data)
57+
.then(response => {
58+
this.$emit('clicked', response.data.archived)
59+
})
60+
.catch(function (error) {
61+
console.log(error)
62+
})
63+
}
64+
}
65+
}
66+
67+
</script>
68+
69+
<style lang="scss" scoped>
70+
.button.button--archive {
71+
background: transparent;
72+
border: none;
73+
padding: 0;
74+
width: 100%; height: 80px;
75+
max-width: 80px; max-height: 80px;
76+
77+
&:hover {
78+
cursor: pointer;
79+
80+
::v-deep .svg-arrow .svg__circle {
81+
fill: #009fe3; // IE11
82+
fill: var(--button-hover-color);
83+
}
84+
85+
::v-deep .svg-arrow .svg__arrow {
86+
fill: #fff; // IE11
87+
fill: var(--button-hover-color-arrow);
88+
}
89+
}
90+
91+
&--restore {
92+
position: relative;
93+
z-index: 1;
94+
95+
&::before {
96+
background-color: #fff;
97+
border-radius: 100%;
98+
content: '';
99+
width: 100%; padding-top: 100%;
100+
101+
display: block;
102+
position: absolute;
103+
top: 50%;
104+
left: 50%;
105+
z-index: -1;
106+
107+
transform: translate(-50%, -50%);
108+
}
109+
}
110+
111+
&__svg-wrapper {
112+
width: 100%;
113+
}
114+
115+
&__svg {
116+
width: 56%; height: 56%;
117+
}
118+
}
119+
</style>

0 commit comments

Comments
 (0)