@iamproperty/components 3.4.5 → 3.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/components/accordion.css +1 -0
- package/assets/css/components/accordion.css.map +1 -0
- package/assets/css/components/alert.css +1 -0
- package/assets/css/components/alert.css.map +1 -0
- package/assets/css/components/applied-filters.css +1 -0
- package/assets/css/components/applied-filters.css.map +1 -0
- package/assets/css/components/buttons.css +1 -0
- package/assets/css/components/buttons.css.map +1 -0
- package/assets/css/components/card.css +1 -0
- package/assets/css/components/card.css.map +1 -0
- package/assets/css/components/carousel.css +1 -0
- package/assets/css/components/carousel.css.map +1 -0
- package/assets/css/components/charts.css +1 -0
- package/assets/css/components/charts.css.map +1 -0
- package/assets/css/components/container.css +1 -0
- package/assets/css/components/container.css.map +1 -0
- package/assets/css/components/dialog.css +1 -0
- package/assets/css/components/dialog.css.map +1 -0
- package/assets/css/components/forms.css +1 -0
- package/assets/css/components/forms.css.map +1 -0
- package/assets/css/components/header.css +1 -0
- package/assets/css/components/header.css.map +1 -0
- package/assets/css/components/lists.css +1 -0
- package/assets/css/components/lists.css.map +1 -0
- package/assets/css/components/nav.css +1 -0
- package/assets/css/components/nav.css.map +1 -0
- package/assets/css/components/pagination.css +1 -0
- package/assets/css/components/pagination.css.map +1 -0
- package/assets/css/components/panel.css +1 -0
- package/assets/css/components/panel.css.map +1 -0
- package/assets/css/components/property-searchbar.css +1 -0
- package/assets/css/components/property-searchbar.css.map +1 -0
- package/assets/css/components/snapshot.css +1 -0
- package/assets/css/components/snapshot.css.map +1 -0
- package/assets/css/components/stepper.css +1 -0
- package/assets/css/components/stepper.css.map +1 -0
- package/assets/css/components/table.css +1 -0
- package/assets/css/components/table.css.map +1 -0
- package/assets/css/components/tabs.css +1 -0
- package/assets/css/components/tabs.css.map +1 -0
- package/assets/css/components/testimonial.css +1 -0
- package/assets/css/components/testimonial.css.map +1 -0
- package/assets/css/components/timeline.css +1 -0
- package/assets/css/components/timeline.css.map +1 -0
- package/assets/css/components/tooltips.css +1 -0
- package/assets/css/components/tooltips.css.map +1 -0
- package/assets/css/core.min.css +1 -1
- package/assets/css/core.min.css.map +1 -1
- package/assets/css/style.min.css +1 -1
- package/assets/css/style.min.css.map +1 -1
- package/assets/fonts/qanelas-bold-webfont.woff +0 -0
- package/assets/fonts/qanelas-bold-webfont.woff2 +0 -0
- package/assets/js/bundle.js +68 -0
- package/assets/js/components/accordion/accordion.component.js +33 -0
- package/assets/js/components/accordion/accordion.component.min.js +14 -0
- package/assets/js/components/accordion/accordion.component.min.js.map +1 -0
- package/assets/js/components/applied-filters/applied-filters.component.js +26 -0
- package/assets/js/components/card/card.component.js +91 -0
- package/assets/js/components/card/card.component.min.js +21 -0
- package/assets/js/components/card/card.component.min.js.map +1 -0
- package/assets/js/components/filterlist/filterlist.component.js +49 -0
- package/assets/js/components/filterlist/filterlist.component.min.js +23 -0
- package/assets/js/components/filterlist/filterlist.component.min.js.map +1 -0
- package/assets/js/components/header/header.component.js +51 -0
- package/assets/js/components/header/header.component.min.js +30 -0
- package/assets/js/components/header/header.component.min.js.map +1 -0
- package/assets/js/components/pagination/pagination.component.js +34 -0
- package/assets/js/components/table/table.component.js +104 -0
- package/assets/js/components/table/table.component.min.js +24 -0
- package/assets/js/components/table/table.component.min.js.map +1 -0
- package/assets/js/components/tabs/tabs.component.js +34 -0
- package/assets/js/components/tabs/tabs.component.min.js +17 -0
- package/assets/js/components/tabs/tabs.component.min.js.map +1 -0
- package/assets/js/dynamic.js +74 -0
- package/assets/js/dynamic.min.js +5 -0
- package/assets/js/dynamic.min.js.map +1 -0
- package/assets/js/flat-components.js +79 -0
- package/assets/js/modules/accordion.js +11 -14
- package/assets/js/modules/applied-filters.js +100 -0
- package/assets/js/modules/data-layer.js +45 -0
- package/assets/js/modules/filterlist.js +32 -0
- package/assets/js/modules/helpers.js +80 -47
- package/assets/js/modules/pagination.js +33 -0
- package/assets/js/modules/table.js +507 -420
- package/assets/js/modules/tabs.js +97 -0
- package/assets/js/modules/youtubevideo.js +53 -61
- package/assets/js/scripts.bundle.js +111 -984
- package/assets/js/scripts.bundle.js.map +1 -1
- package/assets/js/scripts.bundle.min.js +3 -4
- package/assets/js/scripts.bundle.min.js.map +1 -1
- package/assets/js/tests/filterlist.spec.js +22 -0
- package/assets/js/tests/pagination.spec.js +15 -0
- package/assets/js/tests/table.spec.js +147 -0
- package/assets/sass/_components.scss +1 -2
- package/assets/sass/_corefiles.scss +5 -4
- package/assets/sass/_fonts.scss +4 -4
- package/assets/sass/_func.scss +1 -0
- package/assets/sass/_functions/functions.scss +6 -0
- package/assets/sass/_functions/mixins.scss +9 -9
- package/assets/sass/_functions/utilities.scss +16 -0
- package/assets/sass/_functions/variables.scss +128 -86
- package/assets/sass/_tests/colours.spec.scss +1 -1
- package/assets/sass/_tests/mixins.spec.scss +1 -1
- package/assets/sass/_tests/typography.spec.scss +2 -2
- package/assets/sass/components/accordion.scss +9 -6
- package/assets/sass/components/applied-filters.scss +65 -0
- package/assets/sass/components/card.scss +178 -227
- package/assets/sass/components/charts.scss +4 -0
- package/assets/sass/components/container.scss +13 -8
- package/assets/sass/components/dialog.scss +202 -0
- package/assets/sass/components/forms.scss +39 -5
- package/assets/sass/components/header.scss +34 -11
- package/assets/sass/components/lists.scss +15 -0
- package/assets/sass/components/nav.scss +5 -1
- package/assets/sass/components/pagination.scss +140 -0
- package/assets/sass/components/panel.scss +3 -4
- package/assets/sass/components/snapshot.scss +1 -1
- package/assets/sass/components/table.scss +419 -0
- package/assets/sass/components/tabs.scss +52 -36
- package/assets/sass/components/timeline.scss +2 -2
- package/assets/sass/foundations/icons.scss +1 -1
- package/assets/sass/{components → foundations}/links.scss +29 -2
- package/assets/sass/foundations/reboot.scss +21 -15
- package/assets/sass/foundations/root.scss +12 -5
- package/assets/sass/foundations/type.scss +90 -66
- package/assets/svg/illustrations/table.svg +165 -0
- package/assets/ts/README.md +12 -0
- package/assets/ts/bundle.ts +87 -0
- package/assets/ts/components/accordion/README.md +17 -0
- package/assets/ts/components/accordion/accordion.component.ts +43 -0
- package/assets/ts/components/applied-filters/README.md +5 -0
- package/assets/ts/components/applied-filters/applied-filters.component.ts +33 -0
- package/assets/ts/components/card/README.md +22 -0
- package/assets/ts/components/card/card.component.ts +117 -0
- package/assets/ts/components/filterlist/README.md +17 -0
- package/assets/ts/components/filterlist/filterlist.component.ts +60 -0
- package/assets/ts/components/header/README.md +26 -0
- package/assets/ts/components/header/header.component.ts +61 -0
- package/assets/ts/components/pagination/README.md +11 -0
- package/assets/ts/components/pagination/pagination.component.ts +45 -0
- package/assets/ts/components/table/README.md +23 -0
- package/assets/ts/components/table/table.component.ts +128 -0
- package/assets/ts/components/tabs/README.md +18 -0
- package/assets/ts/components/tabs/tabs.component.ts +41 -0
- package/assets/ts/dynamic.ts +98 -0
- package/assets/ts/flat-components.ts +100 -0
- package/assets/ts/html.d.ts +4 -0
- package/assets/ts/modules/accordion.ts +15 -21
- package/assets/ts/modules/applied-filters.ts +146 -0
- package/assets/ts/modules/data-layer.ts +58 -0
- package/assets/ts/modules/filterlist.ts +46 -0
- package/assets/ts/modules/helpers.ts +93 -55
- package/assets/ts/modules/pagination.ts +44 -0
- package/assets/ts/modules/table.ts +598 -433
- package/assets/ts/modules/tabs.ts +136 -0
- package/assets/ts/modules/youtubevideo.ts +58 -63
- package/assets/ts/tests/filterlist.spec.ts +29 -0
- package/assets/ts/tests/pagination.spec.ts +21 -0
- package/assets/ts/tests/table.spec.ts +191 -0
- package/dist/components.es.js +1359 -1356
- package/dist/components.umd.js +103 -54
- package/dist/style.css +1 -1
- package/package.json +20 -12
- package/src/components/Accordion/Accordion.spec.js +1 -1
- package/src/components/Accordion/Accordion.vue +7 -5
- package/src/components/Accordion/AccordionItem.vue +3 -6
- package/src/components/Accordion/README.md +0 -2
- package/src/components/AppliedFilters/AppliedFilters.vue +20 -0
- package/src/components/AppliedFilters/README.md +5 -0
- package/src/components/Card/Card.vue +11 -112
- package/src/components/Card/README.md +16 -18
- package/src/components/Carousel/Carousel.vue +49 -10
- package/src/components/Chart/Chart.vue +46 -4
- package/src/components/Filterlist/Filterlist.vue +20 -0
- package/src/components/Filterlist/README.md +17 -0
- package/src/components/Header/Header.spec.js +5 -4
- package/src/components/Header/Header.vue +14 -20
- package/src/components/Pagination/Pagination.vue +30 -0
- package/src/components/Pagination/README.md +11 -0
- package/src/components/Snapshot/Snapshot.vue +1 -1
- package/src/components/Table/README.md +29 -44
- package/src/components/Table/Table.spec.js +5 -37
- package/src/components/Table/Table.vue +16 -91
- package/src/components/Tabs/README.md +0 -2
- package/src/components/Tabs/Tab.vue +3 -2
- package/src/components/Tabs/Tabs.vue +8 -64
- package/src/foundations/YoutubeVideo/YoutubeVideo.vue +1 -1
- package/src/index.js +3 -2
- package/assets/fonts/qanelassoft-extrabold-webfont.woff +0 -0
- package/assets/fonts/qanelassoft-extrabold-webfont.woff2 +0 -0
- package/assets/js/main.js +0 -57
- package/assets/js/modules/modal.js +0 -69
- package/assets/sass/components/cardDeck.scss +0 -108
- package/assets/sass/components/modal.scss +0 -136
- package/assets/sass/components/tables.scss +0 -291
- package/assets/ts/main.ts +0 -68
- package/assets/ts/modules/modal.ts +0 -91
- package/src/components/CardDeck/CardDeck.spec.js +0 -99
- package/src/components/CardDeck/CardDeck.vue +0 -77
- package/src/components/CardDeck/README.md +0 -25
- package/src/components/Modal/Modal.spec.js +0 -22
- package/src/components/Modal/Modal.vue +0 -43
- package/src/components/Modal/README.md +0 -20
|
@@ -32,17 +32,8 @@
|
|
|
32
32
|
|
|
33
33
|
<script>
|
|
34
34
|
import Card from '../Card/Card.vue'
|
|
35
|
-
import CardDeck from '../CardDeck/CardDeck.vue'
|
|
36
35
|
import carousel from '../../../assets/ts/modules/carousel'
|
|
37
36
|
|
|
38
|
-
// Inherit the card deck props
|
|
39
|
-
let cardDeckProps = CardDeck.props;
|
|
40
|
-
// Update the default values
|
|
41
|
-
cardDeckProps.gap.default = 0
|
|
42
|
-
cardDeckProps.cols.default = 1
|
|
43
|
-
cardDeckProps.smcols.default = 2
|
|
44
|
-
cardDeckProps.mdcols.default = 4
|
|
45
|
-
|
|
46
37
|
|
|
47
38
|
export default {
|
|
48
39
|
components: {
|
|
@@ -55,7 +46,55 @@ export default {
|
|
|
55
46
|
}
|
|
56
47
|
},
|
|
57
48
|
props: {
|
|
58
|
-
|
|
49
|
+
items: {
|
|
50
|
+
type: Array,
|
|
51
|
+
required: false
|
|
52
|
+
},
|
|
53
|
+
cols: {
|
|
54
|
+
type: Number,
|
|
55
|
+
required: false,
|
|
56
|
+
default: 1
|
|
57
|
+
},
|
|
58
|
+
smcols: {
|
|
59
|
+
type: Number,
|
|
60
|
+
required: false,
|
|
61
|
+
default: 1
|
|
62
|
+
},
|
|
63
|
+
mdcols: {
|
|
64
|
+
type: Number,
|
|
65
|
+
required: false,
|
|
66
|
+
default: 3
|
|
67
|
+
},
|
|
68
|
+
gap: {
|
|
69
|
+
type: Number,
|
|
70
|
+
required: false,
|
|
71
|
+
default: 4
|
|
72
|
+
},
|
|
73
|
+
cardtype: {
|
|
74
|
+
type: String,
|
|
75
|
+
required: false
|
|
76
|
+
},
|
|
77
|
+
cardclass: {
|
|
78
|
+
type: String,
|
|
79
|
+
required: false
|
|
80
|
+
},
|
|
81
|
+
btntype: {
|
|
82
|
+
type: String,
|
|
83
|
+
required: false
|
|
84
|
+
},
|
|
85
|
+
titleclass: {
|
|
86
|
+
type: String,
|
|
87
|
+
required: false
|
|
88
|
+
},
|
|
89
|
+
ctatext: {
|
|
90
|
+
type: String,
|
|
91
|
+
required: false
|
|
92
|
+
},
|
|
93
|
+
hidectatext: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
required: false,
|
|
96
|
+
default: false
|
|
97
|
+
},
|
|
59
98
|
colclass: {
|
|
60
99
|
type: String,
|
|
61
100
|
required: false
|
|
@@ -14,14 +14,29 @@
|
|
|
14
14
|
<span>{{point.display}}</span>
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<div class="table__wrapper">
|
|
20
|
+
|
|
21
|
+
<table v-if="fields">
|
|
22
|
+
<thead>
|
|
23
|
+
<tr>
|
|
24
|
+
<th v-for="(field) in fields" :key="field.key">{{ cellHeading(field.key) }}</th>
|
|
25
|
+
</tr>
|
|
26
|
+
</thead>
|
|
27
|
+
<tbody v-if="items">
|
|
28
|
+
<tr v-for="(value,index) in items" :key="index" :data-row-id="value['rowid']">
|
|
29
|
+
<td :key="cellIndex" v-for="(cellValue,cellIndex) in Object.fromEntries(Object.entries(value).filter(([key]) => key !== 'rowid'))" v-html="cellValue" :data-label="cellHeading(cellIndex)" :data-numeric="numericValue(cellValue)"></td>
|
|
30
|
+
</tr>
|
|
31
|
+
</tbody>
|
|
32
|
+
</table>
|
|
18
33
|
|
|
19
34
|
<div class="chart__guidelines" role="presentation">
|
|
20
35
|
<div :key="index" v-for="(point,index) in yaxis" :data-value="point.value" :style="`--percent:${((point.value-min)/(max-min))*100}%;`" class="guideline">
|
|
21
36
|
</div>
|
|
22
37
|
</div>
|
|
23
38
|
<span class="lines" v-if="type == 'line'"></span>
|
|
24
|
-
</
|
|
39
|
+
</div>
|
|
25
40
|
<div class="pies" v-if="type == 'pie'"></div>
|
|
26
41
|
</div>
|
|
27
42
|
</figure>
|
|
@@ -34,13 +49,26 @@
|
|
|
34
49
|
|
|
35
50
|
<script>
|
|
36
51
|
import { ucfirst, unsnake } from '../../helpers/strings'
|
|
37
|
-
import Table from '../../components/Table/Table.vue'
|
|
38
52
|
import chartModule from '../../../assets/ts/modules/chart'
|
|
39
53
|
|
|
54
|
+
let numericValue = function(value) {
|
|
55
|
+
|
|
56
|
+
if(typeof(value) != "string")
|
|
57
|
+
return value;
|
|
58
|
+
|
|
59
|
+
value = value.replace('£','')
|
|
60
|
+
value = value.replace('%','')
|
|
61
|
+
|
|
62
|
+
if (Number.isNaN(Number.parseFloat(value))) {
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return Number.parseFloat(value);
|
|
67
|
+
}
|
|
68
|
+
|
|
40
69
|
export default {
|
|
41
70
|
name: 'Chart',
|
|
42
71
|
components: {
|
|
43
|
-
Table
|
|
44
72
|
},
|
|
45
73
|
props: {
|
|
46
74
|
type: {
|
|
@@ -74,6 +102,20 @@ export default {
|
|
|
74
102
|
required: true
|
|
75
103
|
}
|
|
76
104
|
},
|
|
105
|
+
computed: {
|
|
106
|
+
cellHeading () {
|
|
107
|
+
return (heading) => {
|
|
108
|
+
return `${ucfirst(unsnake(heading))}`
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
numericValue () {
|
|
112
|
+
return (value) => {
|
|
113
|
+
|
|
114
|
+
value = numericValue(value);
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
77
119
|
mounted(){
|
|
78
120
|
this.$nextTick(function () {
|
|
79
121
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- Custom element -->
|
|
3
|
+
<iam-filterlist>
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</iam-filterlist>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
// Load web components
|
|
10
|
+
import iamFilterlist from '../../../assets/ts/components/filterlist/filterlist.component'
|
|
11
|
+
|
|
12
|
+
// Register components
|
|
13
|
+
if (!window.customElements.get('iam-filterlist'))
|
|
14
|
+
window.customElements.define('iam-filterlist', iamFilterlist);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'Filter list',
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
```
|
|
2
|
+
<Filterlist>
|
|
3
|
+
<ul>
|
|
4
|
+
<li>Olivia Anderson</li>
|
|
5
|
+
<li>Ethan Ramirez</li>
|
|
6
|
+
<li>Sophia Patel</li>
|
|
7
|
+
<li>Noah Jenkins</li>
|
|
8
|
+
<li>Ava Thompson</li>
|
|
9
|
+
</ul>
|
|
10
|
+
</Filterlist>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Properties**
|
|
14
|
+
|
|
15
|
+
| Option | Type | Default Value | Description |
|
|
16
|
+
| ------ | ---- | ------------- | ----------- |
|
|
17
|
+
| data-max-height | string | '' | Optional choice from small, medium or large control of the height of the list. Giving it a scrollable area. |
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
2
|
import Header from './Header.vue'
|
|
3
3
|
|
|
4
4
|
describe('Header component', () => {
|
|
5
5
|
|
|
6
|
-
const test =
|
|
6
|
+
const test = mount(Header, {
|
|
7
7
|
propsData: {
|
|
8
8
|
title: 'Page title',
|
|
9
9
|
image: '/img/src/img.png'
|
|
@@ -27,7 +27,8 @@ describe('Header component', () => {
|
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
it('renders the image', () => {
|
|
30
|
-
|
|
31
|
-
expect(test.
|
|
30
|
+
|
|
31
|
+
expect(test.find('iam-header').wrapperElement.shadowRoot.innerHTML).toContain('<source srcset=\"\" media=\"(min-width: 62em)\">')
|
|
32
|
+
expect(test.find('iam-header').wrapperElement.shadowRoot.innerHTML).toContain('<img src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" alt=\"\" lazy=\"\">')
|
|
32
33
|
})
|
|
33
34
|
})
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<slot></slot>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
<picture v-if="image">
|
|
12
|
-
<!-- Actual image only loaded on desktops -->
|
|
13
|
-
<source :srcset="image" media="(min-width: 62em)">
|
|
14
|
-
<!-- Placeholder image -->
|
|
15
|
-
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt="" />
|
|
16
|
-
</picture>
|
|
17
|
-
</header>
|
|
2
|
+
<!-- Custom element -->
|
|
3
|
+
<iam-header class="bg-secondary" :image="image">
|
|
4
|
+
<slot name="breadcrumb"></slot>
|
|
5
|
+
<h1 v-if="title" v-html="title"></h1>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</iam-header>
|
|
18
8
|
</template>
|
|
19
9
|
|
|
20
|
-
<style lang="scss">
|
|
21
|
-
@import "../../../assets/sass/components/header.scss";
|
|
22
|
-
</style>
|
|
23
|
-
|
|
24
10
|
<script>
|
|
11
|
+
// Load web components
|
|
12
|
+
import iamHeader from '../../../assets/ts/components/header/header.component'
|
|
13
|
+
|
|
14
|
+
// Register components
|
|
15
|
+
if (!window.customElements.get('iam-header'))
|
|
16
|
+
window.customElements.define('iam-header', iamHeader);
|
|
17
|
+
|
|
18
|
+
|
|
25
19
|
export default {
|
|
26
20
|
name: 'Header',
|
|
27
21
|
props: {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<iam-pagination>
|
|
3
|
+
</iam-pagination>
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script>
|
|
7
|
+
import iamPagination from '../../../assets/ts/components/pagination/pagination.component'
|
|
8
|
+
import { ucfirst, unsnake } from '../../helpers/strings'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'Pagination',
|
|
12
|
+
props: {
|
|
13
|
+
|
|
14
|
+
},
|
|
15
|
+
computed: {
|
|
16
|
+
|
|
17
|
+
},
|
|
18
|
+
created(){
|
|
19
|
+
|
|
20
|
+
this.$nextTick(function () {
|
|
21
|
+
|
|
22
|
+
if (!window.customElements.get('iam-pagination'))
|
|
23
|
+
window.customElements.define('iam-pagination', iamPagination);
|
|
24
|
+
})
|
|
25
|
+
},
|
|
26
|
+
updated(){
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
```
|
|
2
|
+
<Pagination data-total="12"></Pagination>
|
|
3
|
+
```
|
|
4
|
+
|
|
5
|
+
**Properties**
|
|
6
|
+
|
|
7
|
+
| Option | Type | Default Value | Description |
|
|
8
|
+
| ------ | ---- | ------------- | ----------- |
|
|
9
|
+
| data-total | int | 0 | The total amount is needed to work out how many pagination buttons are needed |
|
|
10
|
+
| data-page | int | 1 | Override the current page value |
|
|
11
|
+
| data-show | int | 15 | Update how many items can be shown per page |
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<a :href="value.link" v-if="value.link">View {{value.title}}</a>
|
|
8
8
|
<div :class="`snapshot__item ${value.bg ? 'bg-'+value.bg : ''}`">
|
|
9
|
-
<span class="
|
|
9
|
+
<span class="lead snapshot__title">{{value.title}}</span>
|
|
10
10
|
<span class="stat">{{value.number}}</span>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
@@ -1,62 +1,47 @@
|
|
|
1
|
-
### Usage
|
|
2
|
-
|
|
3
1
|
```
|
|
4
2
|
<Table :fields="fields" :items="items"></Table>
|
|
5
3
|
```
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
**Properties**
|
|
8
6
|
|
|
9
7
|
| Option | Type | Default Value | Description |
|
|
10
8
|
| ------ | ---- | ------------- | ----------- |
|
|
11
9
|
| items | Array | - | Table row data passed |
|
|
12
|
-
| fields | Array | - | Table header titles
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
16
|
-
| page | number | - | Starting page for the pagination. |
|
|
17
|
-
| reorder | bool | - | Create an order column and allow for the table rows to be reordered |
|
|
18
|
-
| headingclass | string | - | Add a class to the table row within the thead, used to add a background or change test colour. |
|
|
10
|
+
| fields | Array | - | Table header titles |
|
|
11
|
+
| data-show | int | 15 | Update how many rows can be shown per page |
|
|
12
|
+
| data-filterby | string (form ID) | | Give an optional form ID to connect a form to the table and make it act like a filtering system |
|
|
13
|
+
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
**Class modifiers**
|
|
21
16
|
|
|
22
|
-
- **.table
|
|
23
|
-
- **.table
|
|
24
|
-
- **.table
|
|
17
|
+
- Adding a class of **.table--cta** to the table component will fix the last column of the table in place (While on tablet or desktop).
|
|
18
|
+
- Adding a class of **.table--export** to the table component will create a button at the bottom of the table to export its contents out as a CSV file.
|
|
19
|
+
- Adding a class of **.table--fullwidth** to the table component will prevent it from becoming a stacked view on mobile.
|
|
20
|
+
- Adding a class of **.table--mh-small**,**.table--mh-medium** or **.table--mh-large** to the table component will give the table container a max height and the ability to scroll.
|
|
25
21
|
|
|
26
|
-
|
|
22
|
+
**Example of items and fields**
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
**fields**
|
|
29
25
|
|
|
30
26
|
```
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
key: '
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
[
|
|
28
|
+
{
|
|
29
|
+
key: 'col_1',
|
|
30
|
+
key: 'col_2',
|
|
31
|
+
key: 'col_3',
|
|
32
|
+
key: 'col_4',
|
|
33
|
+
}
|
|
38
34
|
]
|
|
39
35
|
```
|
|
36
|
+
**items**
|
|
40
37
|
|
|
41
|
-
### Custom JavaScript Events
|
|
42
|
-
|
|
43
|
-
A custom event can be hooked into when the table gets updated by one of it filters.
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
this.$el.addEventListener('filtered', function (e) {
|
|
47
|
-
|
|
48
|
-
console.log('Table filtered')
|
|
49
|
-
}, false);
|
|
50
|
-
|
|
51
|
-
// Sorted
|
|
52
|
-
this.$el.addEventListener('sorted', function (e) {
|
|
53
|
-
|
|
54
|
-
console.log('Table sorted')
|
|
55
|
-
}, false);
|
|
56
|
-
|
|
57
|
-
// Re-ordered via drag and drop
|
|
58
|
-
this.$el.addEventListener('reordered', function (e) {
|
|
59
|
-
|
|
60
|
-
console.log('Table re-ordered')
|
|
61
|
-
}, false);
|
|
62
38
|
```
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
col_1: 'Row content 1',
|
|
42
|
+
col_2: 'Row content 2',
|
|
43
|
+
col_3: 'Row content 3',
|
|
44
|
+
col_4: 'Row content 4',
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
```
|
|
@@ -6,10 +6,10 @@ describe('Table component', () => {
|
|
|
6
6
|
const test = mount(Table, {
|
|
7
7
|
propsData: {
|
|
8
8
|
fields: [
|
|
9
|
-
{ key: 'name'
|
|
10
|
-
{ key: 'job'
|
|
9
|
+
{ key: 'name' },
|
|
10
|
+
{ key: 'job' },
|
|
11
11
|
{ key: 'address' },
|
|
12
|
-
{ key: 'emergency_contact'
|
|
12
|
+
{ key: 'emergency_contact' },
|
|
13
13
|
{ key: 'actions' }
|
|
14
14
|
],
|
|
15
15
|
items: [
|
|
@@ -40,11 +40,6 @@ describe('Table component', () => {
|
|
|
40
40
|
})
|
|
41
41
|
|
|
42
42
|
// On load
|
|
43
|
-
it('renders a div with the class of table wrapper', () => {
|
|
44
|
-
|
|
45
|
-
expect(test.classes()).toContain('table__wrapper')
|
|
46
|
-
})
|
|
47
|
-
|
|
48
43
|
it('renders a thead', () => {
|
|
49
44
|
|
|
50
45
|
expect(test.find('thead').exists()).toBe(true)
|
|
@@ -55,36 +50,9 @@ describe('Table component', () => {
|
|
|
55
50
|
expect(test.find('tbody').exists()).toBe(true)
|
|
56
51
|
})
|
|
57
52
|
|
|
58
|
-
it('renders a
|
|
59
|
-
|
|
60
|
-
expect(test.find('.table__filters').exists()).toBe(true)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('renders a pagination form when needed', () => {
|
|
64
|
-
|
|
65
|
-
expect(test.find('.table__pagination').exists()).toBe(true)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
// Events
|
|
69
|
-
it('can be sorted by name', async () => {
|
|
70
|
-
|
|
71
|
-
const firstCol = test.find('[data-sortable]')
|
|
72
|
-
expect(firstCol.html()).toContain('Name')
|
|
73
|
-
|
|
74
|
-
await firstCol.trigger('click')
|
|
75
|
-
|
|
76
|
-
let firstRowCol = test.find('tbody tr:first-child [data-label="Name"]')
|
|
77
|
-
expect(firstRowCol.html()).toContain('Andrew')
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
it('can be filtered by name', async () => {
|
|
81
|
-
|
|
82
|
-
const searchField = test.find('[type="search"]')
|
|
83
|
-
|
|
84
|
-
await searchField.setValue('Andrew')
|
|
85
|
-
await searchField.trigger('change')
|
|
53
|
+
it('renders a table heading', () => {
|
|
86
54
|
|
|
87
|
-
expect(test.
|
|
55
|
+
expect(test.find('thead th').exists()).toBe(true)
|
|
88
56
|
})
|
|
89
57
|
|
|
90
58
|
})
|
|
@@ -1,74 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<table>
|
|
4
|
-
<thead
|
|
5
|
-
<tr
|
|
6
|
-
<th v-for="(field) in fields" :key="field.key"
|
|
2
|
+
<iam-table >
|
|
3
|
+
<table v-if="fields">
|
|
4
|
+
<thead>
|
|
5
|
+
<tr>
|
|
6
|
+
<th v-for="(field) in fields" :key="field.key">{{ cellHeading(field.key) }}</th>
|
|
7
7
|
</tr>
|
|
8
8
|
</thead>
|
|
9
9
|
<tbody v-if="items">
|
|
10
10
|
<tr v-for="(value,index) in items" :key="index" :data-row-id="value['rowid']">
|
|
11
|
-
<td :key="cellIndex" v-for="(cellValue,cellIndex) in Object.fromEntries(Object.entries(value).filter(([key]) => key !== 'rowid'))" v-html="cellValue"
|
|
11
|
+
<td :key="cellIndex" v-for="(cellValue,cellIndex) in Object.fromEntries(Object.entries(value).filter(([key]) => key !== 'rowid'))" v-html="cellValue"></td>
|
|
12
12
|
</tr>
|
|
13
13
|
</tbody>
|
|
14
14
|
</table>
|
|
15
|
-
<slot></slot>
|
|
16
|
-
</
|
|
15
|
+
<slot v-else></slot>
|
|
16
|
+
</iam-table>
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script>
|
|
20
|
+
import iamTable from '../../../assets/ts/components/table/table.component'
|
|
20
21
|
import { ucfirst, unsnake } from '../../helpers/strings'
|
|
21
|
-
import table from '../../../assets/ts/modules/table'
|
|
22
|
-
|
|
23
|
-
let numericValue = function(value) {
|
|
24
|
-
|
|
25
|
-
if(typeof(value) != "string")
|
|
26
|
-
return value;
|
|
27
|
-
|
|
28
|
-
value = value.replace('£','')
|
|
29
|
-
value = value.replace('%','')
|
|
30
|
-
|
|
31
|
-
if (Number.isNaN(Number.parseFloat(value))) {
|
|
32
|
-
return 0;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return Number.parseFloat(value)
|
|
36
|
-
}
|
|
37
22
|
|
|
38
23
|
export default {
|
|
39
24
|
name: 'Table',
|
|
40
25
|
props: {
|
|
41
|
-
reorder: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
required: false
|
|
44
|
-
},
|
|
45
|
-
page: {
|
|
46
|
-
type: Number,
|
|
47
|
-
required: false
|
|
48
|
-
},
|
|
49
|
-
show: {
|
|
50
|
-
type: Number,
|
|
51
|
-
required: false
|
|
52
|
-
},
|
|
53
|
-
sortby: {
|
|
54
|
-
type: String,
|
|
55
|
-
required: false
|
|
56
|
-
},
|
|
57
|
-
sort: {
|
|
58
|
-
type: String,
|
|
59
|
-
required: false
|
|
60
|
-
},
|
|
61
|
-
headingclass: {
|
|
62
|
-
type: String,
|
|
63
|
-
required: false
|
|
64
|
-
},
|
|
65
26
|
items: {
|
|
66
27
|
type: Array,
|
|
67
|
-
required:
|
|
28
|
+
required: false
|
|
68
29
|
},
|
|
69
30
|
fields: {
|
|
70
31
|
type: Array,
|
|
71
|
-
required:
|
|
32
|
+
required: false
|
|
72
33
|
}
|
|
73
34
|
},
|
|
74
35
|
computed: {
|
|
@@ -76,54 +37,18 @@ export default {
|
|
|
76
37
|
return (heading) => {
|
|
77
38
|
return `${ucfirst(unsnake(heading))}`
|
|
78
39
|
}
|
|
79
|
-
},
|
|
80
|
-
numericValue () {
|
|
81
|
-
return (value) => {
|
|
82
|
-
|
|
83
|
-
value = numericValue(value);
|
|
84
|
-
return value;
|
|
85
|
-
}
|
|
86
40
|
}
|
|
87
41
|
},
|
|
88
|
-
|
|
42
|
+
created(){
|
|
89
43
|
|
|
90
44
|
this.$nextTick(function () {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// Listen for the event.
|
|
95
|
-
this.$el.addEventListener('sorted', function (e) {
|
|
96
|
-
|
|
97
|
-
console.log('Table sorted')
|
|
98
|
-
}, false);
|
|
99
|
-
|
|
100
|
-
this.$el.addEventListener('filtered', function (e) {
|
|
101
|
-
|
|
102
|
-
console.log('Table filtered')
|
|
103
|
-
}, false);
|
|
104
|
-
|
|
45
|
+
|
|
46
|
+
if (!window.customElements.get('iam-table'))
|
|
47
|
+
window.customElements.define('iam-table', iamTable);
|
|
105
48
|
})
|
|
106
49
|
},
|
|
107
50
|
updated(){
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// If the data gets updated we may need to recreate the tbody as it get detached when sorted in the table.js
|
|
111
|
-
let tbody = this.$refs.wrapper.querySelector('tbody');
|
|
112
|
-
|
|
113
|
-
let tbodyHTML = '';
|
|
114
|
-
this.items.forEach((row, index) => {
|
|
115
|
-
|
|
116
|
-
let rowID = row['rowid'] ? row['rowid'] : '';
|
|
117
|
-
row = Object.fromEntries(Object.entries(row).filter(([key]) => key !== 'rowid'));
|
|
118
|
-
|
|
119
|
-
tbodyHTML += `<tr data-row-id="${rowID}">${ Object.keys(row).map(col => `<td data-label="${ucfirst(unsnake(col))}" data-numeric="${numericValue(row[col])}">${row[col]}</td>` ).join("") }</tr>`;
|
|
120
|
-
});
|
|
121
|
-
tbody.innerHTML = tbodyHTML;
|
|
122
|
-
|
|
123
|
-
// Tell the framework that the table has been filtered so that it can re-sort it etc
|
|
124
|
-
const updatedEvent = new Event('filtered');
|
|
125
|
-
this.$refs.wrapper.dispatchEvent(updatedEvent);
|
|
126
|
-
})
|
|
51
|
+
|
|
127
52
|
}
|
|
128
53
|
}
|
|
129
54
|
</script>
|