@politicalwatch/tipi-uikit 1.8.6 → 1.9.1
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/.storybook/main.js +5 -2
- package/.storybook/preview.js +2 -0
- package/package.json +11 -10
- package/src/components/CSVDownload/CSVDownload.vue +43 -49
- package/src/components/CongressLink/CongressLink.vue +11 -11
- package/src/components/Deputy/Deputy.vue +44 -58
- package/src/components/Header/Header.vue +1 -1
- package/src/components/Icon/Icon.vue +21 -80
- package/src/components/InitiativeCard/InitiativeCard.vue +25 -33
- package/src/components/InitiativeMeta/InitiativeMeta.vue +54 -59
- package/src/components/Loader/Loader.vue +6 -10
- package/src/components/Message/Message.vue +12 -18
- package/src/components/Navbar/Navbar.vue +81 -62
- package/src/components/Neuron/Neuron.vue +181 -180
- package/src/components/PartyLogo/PartyLogo.vue +50 -51
- package/src/components/PartyLogo/PartyLogoIcon.vue +197 -204
- package/src/components/Results/Results.vue +69 -65
- package/src/components/Splash/Splash.vue +28 -28
- package/src/components/Text/Text.vue +44 -38
- package/src/components/TopicCard/TopicCard.vue +36 -29
- package/src/components/TopicLink/TopicLink.vue +20 -19
- package/src/components/TopicPill/TopicPill.vue +42 -51
- package/src/components/Topics/Topics.vue +18 -20
- package/src/components/TwoCircles/TwoCircles.vue +112 -122
- package/src/stories/CSVDownload.stories.js +245 -0
- package/src/stories/CongressLink.stories.js +21 -0
- package/src/stories/Deputy.stories.js +168 -0
- package/src/stories/Header.stories.js +26 -0
- package/src/stories/Icon.stories.js +1 -1
- package/src/stories/InitiativeCard.stories.js +208 -0
- package/src/stories/InitiativeMeta.stories.js +8 -14
- package/src/stories/Loader.stories.js +25 -0
- package/src/stories/Message.stories.js +6 -6
- package/src/stories/Navbar.stories.js +45 -0
- package/src/stories/Neuron.stories.js +210 -0
- package/src/stories/PartyLogo.stories.js +21 -0
- package/src/stories/PartyLogoIcon.stories.js +21 -0
- package/src/stories/Results.stories.js +453 -0
- package/src/stories/Splash.stories.js +25 -0
- package/src/stories/Text.stories.js +36 -0
- package/src/stories/TopicCard.stories.js +782 -0
- package/src/stories/TopicLink.stories.js +778 -0
- package/src/stories/TopicPill.stories.js +147 -0
- package/src/stories/TwoCircles.stories.js +144 -0
package/.storybook/main.js
CHANGED
|
@@ -5,12 +5,15 @@ const config = {
|
|
|
5
5
|
'@storybook/addon-links',
|
|
6
6
|
'@storybook/addon-essentials',
|
|
7
7
|
'@storybook/addon-interactions',
|
|
8
|
-
'@chromatic-com/storybook'
|
|
8
|
+
'@chromatic-com/storybook',
|
|
9
9
|
],
|
|
10
10
|
framework: {
|
|
11
11
|
name: '@storybook/vue3-vite',
|
|
12
|
-
options: {
|
|
12
|
+
options: {
|
|
13
|
+
docgen: 'vue-component-meta',
|
|
14
|
+
},
|
|
13
15
|
},
|
|
14
16
|
docs: {},
|
|
17
|
+
staticDirs: [{ from: '../src/assets', to: '/assets' }],
|
|
15
18
|
};
|
|
16
19
|
export default config;
|
package/.storybook/preview.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@politicalwatch/tipi-uikit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"main": "src/components/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build-storybook": "storybook build"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@storybook/test": "^8.1.
|
|
15
|
+
"@storybook/test": "^8.1.5",
|
|
16
16
|
"core-js": "^3.32.2",
|
|
17
17
|
"d3": "^7.8.5",
|
|
18
18
|
"d3-cloud": "^1.2.5",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"vue-json-excel3": "^1.0.20"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@chromatic-com/storybook": "^1.
|
|
31
|
+
"@chromatic-com/storybook": "^1.5.0",
|
|
32
32
|
"@rushstack/eslint-patch": "^1.1.0",
|
|
33
|
-
"@storybook/addon-essentials": "^8.1.
|
|
34
|
-
"@storybook/addon-interactions": "^8.1.
|
|
35
|
-
"@storybook/addon-links": "^8.1.
|
|
36
|
-
"@storybook/blocks": "^8.1.
|
|
37
|
-
"@storybook/vue3": "^8.1.
|
|
38
|
-
"@storybook/vue3-vite": "^8.1.
|
|
33
|
+
"@storybook/addon-essentials": "^8.1.5",
|
|
34
|
+
"@storybook/addon-interactions": "^8.1.5",
|
|
35
|
+
"@storybook/addon-links": "^8.1.5",
|
|
36
|
+
"@storybook/blocks": "^8.1.5",
|
|
37
|
+
"@storybook/vue3": "^8.1.5",
|
|
38
|
+
"@storybook/vue3-vite": "^8.1.5",
|
|
39
39
|
"@vitejs/plugin-vue": "^5.0.0",
|
|
40
40
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
41
41
|
"@vue/test-utils": "^2.4.1",
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"jsdom": "^24.0.0",
|
|
47
47
|
"prettier": "^3.0.3",
|
|
48
48
|
"sass": "^1.67.0",
|
|
49
|
-
"storybook": "^8.1.
|
|
49
|
+
"storybook": "^8.1.5",
|
|
50
|
+
"storybook-vue3-router": "^5.0.0",
|
|
50
51
|
"stylelint": "^16.1.0",
|
|
51
52
|
"terser": "^5.14.2",
|
|
52
53
|
"vite": "^5.0.12",
|
|
@@ -57,60 +57,54 @@
|
|
|
57
57
|
</span>
|
|
58
58
|
</template>
|
|
59
59
|
|
|
60
|
-
<script>
|
|
60
|
+
<script setup>
|
|
61
61
|
import JsonExcel from 'vue-json-excel3';
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
props: {
|
|
69
|
-
initiatives: {
|
|
70
|
-
type: Array,
|
|
71
|
-
default: function () {
|
|
72
|
-
return [];
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
csvItems: Array,
|
|
76
|
-
canDownloadCSV: Boolean,
|
|
77
|
-
csvFields: {
|
|
78
|
-
type: Object,
|
|
79
|
-
default: function () {
|
|
80
|
-
return {
|
|
81
|
-
title: 'title',
|
|
82
|
-
reference: 'reference',
|
|
83
|
-
initiative_type_alt: 'initiative_type_alt',
|
|
84
|
-
authors: 'authors',
|
|
85
|
-
deputies: 'deputies',
|
|
86
|
-
topics: 'topics',
|
|
87
|
-
tags: 'tags',
|
|
88
|
-
place: 'place',
|
|
89
|
-
status: 'status',
|
|
90
|
-
created: 'created',
|
|
91
|
-
updated: 'updated',
|
|
92
|
-
url: 'url',
|
|
93
|
-
};
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
label: {
|
|
97
|
-
type: String,
|
|
98
|
-
default: 'Descarga los datos',
|
|
99
|
-
},
|
|
100
|
-
buttonClass: {
|
|
101
|
-
type: String,
|
|
102
|
-
default: 'c-button--compact',
|
|
63
|
+
const { initiatives } = defineProps({
|
|
64
|
+
initiatives: {
|
|
65
|
+
type: Array,
|
|
66
|
+
default: function () {
|
|
67
|
+
return () => [];
|
|
103
68
|
},
|
|
104
69
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
70
|
+
csvItems: Array,
|
|
71
|
+
canDownloadCSV: Boolean,
|
|
72
|
+
csvFields: {
|
|
73
|
+
type: Object,
|
|
74
|
+
default: () => ({
|
|
75
|
+
title: 'title',
|
|
76
|
+
reference: 'reference',
|
|
77
|
+
initiative_type_alt: 'initiative_type_alt',
|
|
78
|
+
authors: 'authors',
|
|
79
|
+
deputies: 'deputies',
|
|
80
|
+
topics: 'topics',
|
|
81
|
+
tags: 'tags',
|
|
82
|
+
place: 'place',
|
|
83
|
+
status: 'status',
|
|
84
|
+
created: 'created',
|
|
85
|
+
updated: 'updated',
|
|
86
|
+
url: 'url',
|
|
87
|
+
}),
|
|
113
88
|
},
|
|
89
|
+
label: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: 'Descarga los datos',
|
|
92
|
+
},
|
|
93
|
+
buttonClass: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: 'c-button--compact',
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const emit = defineEmits(['loadCSVItems']);
|
|
100
|
+
|
|
101
|
+
const loadCSVItems = (event) => {
|
|
102
|
+
emit('loadCSVItems', event);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const getNameFromCSV = () => {
|
|
106
|
+
let d = new Date();
|
|
107
|
+
return 'export-' + d.toISOString() + '.csv';
|
|
114
108
|
};
|
|
115
109
|
</script>
|
|
116
110
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<a
|
|
2
|
+
<a
|
|
3
|
+
:href="url"
|
|
4
|
+
class="c-congress-link u-color-primary"
|
|
5
|
+
target="_blank"
|
|
6
|
+
title="Ver en el Congreso.es"
|
|
7
|
+
><tipi-icon class="u-filling-primary" icon="open-blank"></tipi-icon>Ver en el Congreso.es</a
|
|
8
|
+
>
|
|
3
9
|
</template>
|
|
4
10
|
|
|
5
|
-
<script>
|
|
11
|
+
<script setup>
|
|
6
12
|
import TipiIcon from '../Icon/Icon.vue';
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
TipiIcon,
|
|
12
|
-
},
|
|
13
|
-
props: {
|
|
14
|
-
url: String,
|
|
15
|
-
},
|
|
16
|
-
};
|
|
14
|
+
const { url } = defineProps({
|
|
15
|
+
url: { type: String },
|
|
16
|
+
});
|
|
17
17
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="c-deputy" :class="addBirthdayClass()" v-if="deputy">
|
|
3
3
|
<div class="o-container">
|
|
4
|
-
<div class="o-grid
|
|
4
|
+
<div class="o-grid o-grid--reverse">
|
|
5
5
|
<div class="o-grid__col u-4@sm">
|
|
6
6
|
<div class="c-deputy__image_container">
|
|
7
7
|
<img class="c-deputy__image" :src="deputy.image" :alt="'Foto de ' + deputy.name" />
|
|
@@ -52,67 +52,53 @@
|
|
|
52
52
|
</div>
|
|
53
53
|
</template>
|
|
54
54
|
|
|
55
|
-
<script>
|
|
55
|
+
<script setup>
|
|
56
|
+
import { ref } from 'vue';
|
|
57
|
+
|
|
56
58
|
import TipiIcon from '../Icon/Icon.vue';
|
|
57
59
|
import PartyLogo from '../PartyLogo/PartyLogo.vue';
|
|
58
60
|
import PartyLogoIcon from '../PartyLogo/PartyLogoIcon.vue';
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const today = new Date();
|
|
101
|
-
if (date.getDate() == today.getDate() && date.getMonth() == today.getMonth()) {
|
|
102
|
-
return 'c-deputy__birthday';
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
getAge: function() {
|
|
106
|
-
const date = new Date(this.deputy.birthdate);
|
|
107
|
-
const today = new Date();
|
|
108
|
-
const age = today.getFullYear() - date.getFullYear();
|
|
109
|
-
return age;
|
|
110
|
-
},
|
|
111
|
-
getConstituency: function() {
|
|
112
|
-
const constituency = this.deputy.constituency;
|
|
113
|
-
return constituency;
|
|
114
|
-
},
|
|
115
|
-
},
|
|
62
|
+
const { deputy, parliamentaryGroup } = defineProps({
|
|
63
|
+
deputy: Object,
|
|
64
|
+
parliamentaryGroup: Object,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const isCollapsed = ref(true);
|
|
68
|
+
|
|
69
|
+
const getCollapsedClass = () => {
|
|
70
|
+
return isCollapsed.value ? 'c-deputy__hidden' : 'c-deputy__info';
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const getCollapseIcon = () => {
|
|
74
|
+
return isCollapsed.value ? 'plus' : 'less';
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const getCollapseMessage = () => {
|
|
78
|
+
return isCollapsed.value ? 'Mostrar más' : 'Mostrar menos';
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const collapse = () => {
|
|
82
|
+
isCollapsed.value = !isCollapsed.value;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const addBirthdayClass = () => {
|
|
86
|
+
const date = new Date(deputy.birthdate);
|
|
87
|
+
const today = new Date();
|
|
88
|
+
if (date.getDate() == today.getDate() && date.getMonth() == today.getMonth()) {
|
|
89
|
+
return 'c-deputy__birthday';
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const getAge = () => {
|
|
94
|
+
const date = new Date(deputy.birthdate);
|
|
95
|
+
const today = new Date();
|
|
96
|
+
const age = today.getFullYear() - date.getFullYear();
|
|
97
|
+
return age;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const getConstituency = () => {
|
|
101
|
+
return deputy.constituency;
|
|
116
102
|
};
|
|
117
103
|
</script>
|
|
118
104
|
|
|
@@ -1,87 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span class="c-icon" :class="`c-icon--type-${icon}`">
|
|
3
|
-
<component :is="
|
|
3
|
+
<component :is="svg" :style="{ fill: customColor }" />
|
|
4
4
|
</span>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
-
<script>
|
|
8
|
-
import
|
|
9
|
-
import icon_bell from '../../assets/svg/icon-bell.svg';
|
|
10
|
-
import icon_birthday from '../../assets/svg/icon-birthday.svg';
|
|
11
|
-
import icon_building from '../../assets/svg/icon-building.svg';
|
|
12
|
-
import icon_calendar from '../../assets/svg/icon-calendar.svg';
|
|
13
|
-
import icon_chevron_down from '../../assets/svg/icon-chevron-down.svg';
|
|
14
|
-
import icon_chevron_left from '../../assets/svg/icon-chevron-left.svg';
|
|
15
|
-
import icon_chevron_right from '../../assets/svg/icon-chevron-right.svg';
|
|
16
|
-
import icon_chevron_up from '../../assets/svg/icon-chevron-up.svg';
|
|
17
|
-
import icon_clock from '../../assets/svg/icon-clock.svg';
|
|
18
|
-
import icon_close_menu from '../../assets/svg/icon-close-menu.svg';
|
|
19
|
-
import icon_close from '../../assets/svg/icon-close.svg';
|
|
20
|
-
import icon_conversation from '../../assets/svg/icon-conversation.svg';
|
|
21
|
-
import icon_denied from '../../assets/svg/icon-denied.svg';
|
|
22
|
-
import icon_document from '../../assets/svg/icon-document.svg';
|
|
23
|
-
import icon_download from '../../assets/svg/icon-download.svg';
|
|
24
|
-
import icon_error from '../../assets/svg/icon-error.svg';
|
|
25
|
-
import icon_footprint from '../../assets/svg/icon-footprint.svg';
|
|
26
|
-
import icon_github from '../../assets/svg/icon-github.svg';
|
|
27
|
-
import icon_hamburger from '../../assets/svg/icon-hamburger.svg';
|
|
28
|
-
import icon_info from '../../assets/svg/icon-info.svg';
|
|
29
|
-
import icon_less from '../../assets/svg/icon-less.svg';
|
|
30
|
-
import icon_location from '../../assets/svg/icon-location.svg';
|
|
31
|
-
import icon_logout from '../../assets/svg/icon-logout.svg';
|
|
32
|
-
import icon_mail from '../../assets/svg/icon-mail.svg';
|
|
33
|
-
import icon_more from '../../assets/svg/icon-more.svg';
|
|
34
|
-
import icon_open_blank from '../../assets/svg/icon-open-blank.svg';
|
|
35
|
-
import icon_plus from '../../assets/svg/icon-plus.svg';
|
|
36
|
-
import icon_search from '../../assets/svg/icon-search.svg';
|
|
37
|
-
import icon_success from '../../assets/svg/icon-success.svg';
|
|
38
|
-
import icon_twitter from '../../assets/svg/icon-twitter.svg';
|
|
39
|
-
import icon_upload from '../../assets/svg/icon-upload.svg';
|
|
7
|
+
<script setup>
|
|
8
|
+
import { toRefs, computed, defineAsyncComponent } from 'vue';
|
|
40
9
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
icon_download,
|
|
60
|
-
icon_error,
|
|
61
|
-
icon_footprint,
|
|
62
|
-
icon_github,
|
|
63
|
-
icon_hamburger,
|
|
64
|
-
icon_info,
|
|
65
|
-
icon_less,
|
|
66
|
-
icon_location,
|
|
67
|
-
icon_logout,
|
|
68
|
-
icon_mail,
|
|
69
|
-
icon_more,
|
|
70
|
-
icon_open_blank,
|
|
71
|
-
icon_plus,
|
|
72
|
-
icon_search,
|
|
73
|
-
icon_success,
|
|
74
|
-
icon_twitter,
|
|
75
|
-
icon_upload,
|
|
76
|
-
},
|
|
77
|
-
props: {
|
|
78
|
-
icon: String,
|
|
79
|
-
color: String,
|
|
80
|
-
},
|
|
81
|
-
updated() {
|
|
82
|
-
if (this.color && this.$el.querySelector('svg path')) {
|
|
83
|
-
this.$el.querySelector('svg path').style.fill = this.color;
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
};
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
icon: { type: String },
|
|
12
|
+
color: { type: String },
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const { icon, color } = toRefs(props);
|
|
16
|
+
|
|
17
|
+
const svg = computed(() => {
|
|
18
|
+
let svg = '';
|
|
19
|
+
try {
|
|
20
|
+
svg = defineAsyncComponent(() => import(`../../assets/svg/icon-${icon.value}.svg`));
|
|
21
|
+
} catch (error) {
|
|
22
|
+
svg = icon.value;
|
|
23
|
+
}
|
|
24
|
+
return svg;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const customColor = computed(() => color.value || '#2d4252');
|
|
87
28
|
</script>
|
|
@@ -51,48 +51,40 @@
|
|
|
51
51
|
</div>
|
|
52
52
|
</template>
|
|
53
53
|
|
|
54
|
-
<script>
|
|
54
|
+
<script setup>
|
|
55
55
|
import TipiIcon from '../Icon/Icon.vue';
|
|
56
56
|
import TipiTopicPill from '../TopicPill/TopicPill.vue';
|
|
57
57
|
import TipiInitiativeMeta from '../InitiativeMeta/InitiativeMeta.vue';
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
components: {
|
|
62
|
-
TipiIcon,
|
|
63
|
-
TipiTopicPill,
|
|
64
|
-
TipiInitiativeMeta,
|
|
65
|
-
},
|
|
66
|
-
props: {
|
|
59
|
+
const { initiative, topicsStyles, extendedLayout, metaDeputies, metaGroupsOthers, metaColors } =
|
|
60
|
+
defineProps({
|
|
67
61
|
initiative: Object,
|
|
68
62
|
topicsStyles: Object,
|
|
69
63
|
extendedLayout: Boolean,
|
|
70
64
|
metaDeputies: String,
|
|
71
65
|
metaGroupsOthers: String,
|
|
72
66
|
metaColors: { type: Object, default: undefined },
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const getAuthors = (initiative) => {
|
|
70
|
+
return initiative.authors.length ? initiative.authors.join('<br/>') : '';
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const getTopics = (initiative) => {
|
|
74
|
+
return initiative['tagged'].reduce((topics, tagged) => {
|
|
75
|
+
return topics.concat(tagged['topics']);
|
|
76
|
+
}, []);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const getDeputies = (initiative) => {
|
|
80
|
+
if (initiative.deputies.length == 0) return '';
|
|
81
|
+
let regex_id = /\[.*\]/;
|
|
82
|
+
return initiative.deputies
|
|
83
|
+
.map((d) => {
|
|
84
|
+
var has_id = regex_id.exec(d);
|
|
85
|
+
if (!has_id) return d;
|
|
86
|
+
return d.replace(has_id[0], '').trim();
|
|
87
|
+
})
|
|
88
|
+
.join('<br/>');
|
|
97
89
|
};
|
|
98
90
|
</script>
|
|
@@ -13,72 +13,67 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
|
-
<script>
|
|
16
|
+
<script setup>
|
|
17
17
|
import { formatDistanceToNow } from 'date-fns/formatDistanceToNow';
|
|
18
18
|
import { es } from 'date-fns/locale/es';
|
|
19
19
|
import TipiIcon from '../Icon/Icon.vue';
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
'Retirada',
|
|
46
|
-
'Derogada',
|
|
47
|
-
'No celebrada',
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
},
|
|
21
|
+
const { initiative, metaColors } = defineProps({
|
|
22
|
+
initiative: Object,
|
|
23
|
+
metaColors: {
|
|
24
|
+
type: Object,
|
|
25
|
+
default: function () {
|
|
26
|
+
return {
|
|
27
|
+
completed: [
|
|
28
|
+
'Aprobada',
|
|
29
|
+
'Respondida',
|
|
30
|
+
'Celebrada',
|
|
31
|
+
'Convertida en otra',
|
|
32
|
+
'Acumulada en otra',
|
|
33
|
+
],
|
|
34
|
+
neutral: ['En tramitación', 'Desconocida'],
|
|
35
|
+
error: [
|
|
36
|
+
'No admitida a trámite',
|
|
37
|
+
'No debatida',
|
|
38
|
+
'Caducada',
|
|
39
|
+
'Rechazada',
|
|
40
|
+
'Retirada',
|
|
41
|
+
'Derogada',
|
|
42
|
+
'No celebrada',
|
|
43
|
+
],
|
|
44
|
+
};
|
|
51
45
|
},
|
|
52
46
|
},
|
|
53
|
-
|
|
54
|
-
getColorByStatus: function (status) {
|
|
55
|
-
for (let color in this.metaColors) {
|
|
56
|
-
if (this.metaColors[color].indexOf(status) != -1) return color;
|
|
57
|
-
}
|
|
58
|
-
return 'neutral';
|
|
59
|
-
},
|
|
60
|
-
getIcon: function (initiative) {
|
|
61
|
-
const color = this.getColorByStatus(initiative['status']);
|
|
62
|
-
const map = { completed: 'success', neutral: 'clock', error: 'denied' };
|
|
63
|
-
return map[color];
|
|
64
|
-
},
|
|
65
|
-
getStateMessage: function (initiative) {
|
|
66
|
-
if (initiative['status'] == 'Desconocida') {
|
|
67
|
-
return `${initiative['status']}`;
|
|
68
|
-
}
|
|
47
|
+
});
|
|
69
48
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
49
|
+
const getColorByStatus = (status) => {
|
|
50
|
+
for (let color in metaColors) {
|
|
51
|
+
if (metaColors[color].indexOf(status) != -1) return color;
|
|
52
|
+
}
|
|
53
|
+
return 'neutral';
|
|
54
|
+
};
|
|
75
55
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
56
|
+
const getIcon = (initiative) => {
|
|
57
|
+
const color = getColorByStatus(initiative['status']);
|
|
58
|
+
const map = { completed: 'success', neutral: 'clock', error: 'denied' };
|
|
59
|
+
return map[color];
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const getStateMessage = (initiative) => {
|
|
63
|
+
if (initiative['status'] == 'Desconocida') {
|
|
64
|
+
return `${initiative['status']}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const color = getColorByStatus(initiative['status']);
|
|
68
|
+
let date = initiative['updated'];
|
|
69
|
+
if (color == 'neutral') {
|
|
70
|
+
date = initiative['created'];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const formattedDate = formatDistanceToNow(new Date(date), {
|
|
74
|
+
locale: es,
|
|
75
|
+
addSuffix: true,
|
|
76
|
+
}).replace('alrededor de ', '');
|
|
77
|
+
return `${initiative['status']} ${formattedDate}`;
|
|
83
78
|
};
|
|
84
79
|
</script>
|