@politicalwatch/tipi-uikit 1.5.6 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@politicalwatch/tipi-uikit",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "main": "src/components/index.js",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -22,8 +22,8 @@
22
22
  "vite-plugin-require": "^1.1.11",
23
23
  "vite-svg-loader": "^4.0.0",
24
24
  "vue": "^3.3.4",
25
- "vue-csv-downloader": "^1.0.3",
26
- "vue-inline-svg": "^2.1.3"
25
+ "vue-inline-svg": "^2.1.3",
26
+ "vue-json-excel3": "^1.0.18"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@rushstack/eslint-patch": "^1.1.0",
@@ -3,51 +3,95 @@
3
3
  <a
4
4
  v-if="!csvItems.length"
5
5
  :class="{ disabled: !canDownloadCSV }"
6
- :title="!canDownloadCSV ? 'Demasiados resultados para poder descargar. Afina la búsqueda' : 'Descarga CSV con todos los resultados'"
6
+ :title="
7
+ !canDownloadCSV
8
+ ? 'Demasiados resultados para poder descargar. Afina la búsqueda'
9
+ : 'Descarga CSV con todos los resultados'
10
+ "
7
11
  @click.prevent="loadCSVItems"
8
- class="c-button c-button--compact c-button--secondary c-button--icon-right" href="#">
9
- {{ label }}
10
- <span class="c-icon c-icon--type-download">
11
- <svg xmlns="http://www.w3.org/2000/svg" width="12" height="16" fill="none" viewBox="0 0 12 16">
12
- <path fill="#2D4252" d="M12 5.647H8.571V0H3.43v5.647H0l6 6.588 6-6.588zm-12 8.47V16h12v-1.882H0z"></path>
13
- </svg>
14
- </span>
12
+ class="c-button c-button--compact c-button--secondary c-button--icon-right"
13
+ href="#"
14
+ >
15
+ {{ label }}
16
+ <span class="c-icon c-icon--type-download">
17
+ <svg
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ width="12"
20
+ height="16"
21
+ fill="none"
22
+ viewBox="0 0 12 16"
23
+ >
24
+ <path
25
+ fill="#2D4252"
26
+ d="M12 5.647H8.571V0H3.43v5.647H0l6 6.588 6-6.588zm-12 8.47V16h12v-1.882H0z"
27
+ ></path>
28
+ </svg>
29
+ </span>
15
30
  </a>
16
- <vue-csv-downloader
31
+ <json-excel
17
32
  v-else
18
33
  :data="csvItems"
19
34
  :fields="csvFields"
20
- :downloadName="getNameFromCSV()"
35
+ :name="getNameFromCSV()"
21
36
  id="downloadCSV"
22
- class="c-button c-button--icon-right" :class="buttonClass">
23
- {{ label }}
24
- <span class="c-icon c-icon--type-download">
25
- <svg xmlns="http://www.w3.org/2000/svg" width="12" height="16" fill="none" viewBox="0 0 12 16">
26
- <path fill="#2D4252" d="M12 5.647H8.571V0H3.43v5.647H0l6 6.588 6-6.588zm-12 8.47V16h12v-1.882H0z"></path>
27
- </svg>
28
- </span>
29
- </vue-csv-downloader>
37
+ type="csv"
38
+ class="c-button c-button--icon-right"
39
+ :class="buttonClass"
40
+ >
41
+ {{ label }}
42
+ <span class="c-icon c-icon--type-download">
43
+ <svg
44
+ xmlns="http://www.w3.org/2000/svg"
45
+ width="12"
46
+ height="16"
47
+ fill="none"
48
+ viewBox="0 0 12 16"
49
+ >
50
+ <path
51
+ fill="#2D4252"
52
+ d="M12 5.647H8.571V0H3.43v5.647H0l6 6.588 6-6.588zm-12 8.47V16h12v-1.882H0z"
53
+ ></path>
54
+ </svg>
55
+ </span>
56
+ </json-excel>
30
57
  </span>
31
58
  </template>
32
59
 
33
60
  <script>
34
- import VueCsvDownloader from 'vue-csv-downloader';
61
+ import JsonExcel from 'vue-json-excel3';
35
62
 
36
63
  export default {
37
64
  name: 'TipiCsvDownload',
38
65
  components: {
39
- VueCsvDownloader,
66
+ JsonExcel,
40
67
  },
41
68
  props: {
42
69
  initiatives: {
43
70
  type: Array,
44
- default: function() { return []; },
71
+ default: function () {
72
+ return [];
73
+ },
45
74
  },
46
75
  csvItems: Array,
47
76
  canDownloadCSV: Boolean,
48
77
  csvFields: {
49
78
  type: Array,
50
- default: function() { return ['title', 'reference', 'initiative_type_alt', 'authors', 'deputies', 'tagged.0.topics', 'tagged.0.tags', 'place', 'status', 'created','updated', 'url']; },
79
+ default: function () {
80
+ return [
81
+ 'title',
82
+ 'reference',
83
+ 'initiative_type_alt',
84
+ 'authors',
85
+ 'deputies',
86
+ 'tagged.0.topics',
87
+ 'tagged.0.tags',
88
+ 'place',
89
+ 'status',
90
+ 'created',
91
+ 'updated',
92
+ 'url',
93
+ ];
94
+ },
51
95
  },
52
96
  label: {
53
97
  type: String,
@@ -59,12 +103,12 @@ export default {
59
103
  },
60
104
  },
61
105
  methods: {
62
- loadCSVItems: function(event) {
106
+ loadCSVItems: function (event) {
63
107
  this.$emit('loadCSVItems', event);
64
108
  },
65
- getNameFromCSV: function() {
109
+ getNameFromCSV: function () {
66
110
  let d = new Date();
67
- return "export-" + d.toISOString() + ".csv";
111
+ return 'export-' + d.toISOString() + '.csv';
68
112
  },
69
113
  },
70
114
  };