innoboxrr-vue-datatable 1.3.3 → 2.0.0

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.
@@ -1,85 +1,71 @@
1
- <template>
2
-
3
- <router-link
4
- :to="pathObject"
5
- class="block px-4 py-2 dark:hover:text-white dark:text-slate-400">
6
-
7
- <span
8
- class="uk-margin-small-right uk-icon"
9
- :uk-icon="iconAttr"
10
- :style="iconStyle"></span>
11
-
12
- <span :class="textClass">{{ text }}</span>
13
-
14
- </router-link>
15
-
16
- </template>
17
-
18
-
19
- <script>
20
-
21
- export default {
22
-
23
- props: {
24
- name: {
25
- type: String,
26
- required: true
27
- },
28
- params: {
29
- type: Object,
30
- default: {}
31
- },
32
- query: {
33
- type: Object,
34
- default: {}
35
- },
36
- text: {
37
- type: String,
38
- required: true
39
- },
40
- icon: {
41
- type: String,
42
- required: true
43
- },
44
- ratio: {
45
- type: Number,
46
- required: false,
47
- default: 1
48
- },
49
- textClass: {
50
- type: String,
51
- default: ""
52
- },
53
- },
54
-
55
- data() {
56
- return {
57
- pathObject: {
58
- name: this.name,
59
- params: this.params,
60
- query: this.query
61
- }
62
- }
63
- },
64
-
65
- computed: {
66
-
67
- iconAttr() {
68
-
69
- return `icon: ${this.icon}; ratio: ${this.ratio};`;
70
-
71
- },
72
-
73
- iconStyle() {
74
-
75
- return {
76
- fontSize: (this.ratio * 16) + 'px'
77
- }
78
-
79
- }
80
-
81
- }
82
-
83
- }
84
-
85
- </script>
1
+ <template>
2
+
3
+ <router-link
4
+ :to="pathObject"
5
+ class="block px-4 py-2 dark:hover:text-white dark:text-slate-400">
6
+
7
+ <span
8
+ class="fe-mr-sm uk-icon"
9
+ :uk-icon="iconAttr"
10
+ :style="iconStyle"></span>
11
+
12
+ <span :class="textClass">{{ text }}</span>
13
+
14
+ </router-link>
15
+
16
+ </template>
17
+
18
+ <script setup>
19
+
20
+ import { computed } from 'vue'
21
+
22
+ const props = defineProps({
23
+ name: {
24
+ type: String,
25
+ required: true
26
+ },
27
+ // Vue 3 exige factoria en los defaults de objeto: un literal comparte
28
+ // la misma instancia entre todas las filas de la tabla.
29
+ params: {
30
+ type: Object,
31
+ default: () => ({})
32
+ },
33
+ query: {
34
+ type: Object,
35
+ default: () => ({})
36
+ },
37
+ text: {
38
+ type: String,
39
+ required: true
40
+ },
41
+ icon: {
42
+ type: String,
43
+ required: true
44
+ },
45
+ ratio: {
46
+ type: Number,
47
+ required: false,
48
+ default: 1
49
+ },
50
+ textClass: {
51
+ type: String,
52
+ default: ""
53
+ },
54
+ })
55
+
56
+ // Estaba en data(), asi que se calculaba una sola vez al crear el
57
+ // componente: al reutilizar la fila para otro registro el enlace seguia
58
+ // apuntando al anterior.
59
+ const pathObject = computed(() => ({
60
+ name: props.name,
61
+ params: props.params,
62
+ query: props.query,
63
+ }))
64
+
65
+ const iconAttr = computed(() => `icon: ${props.icon}; ratio: ${props.ratio};`)
66
+
67
+ const iconStyle = computed(() => ({
68
+ fontSize: (props.ratio * 16) + 'px'
69
+ }))
70
+
71
+ </script>
@@ -1,62 +1,55 @@
1
- <template>
2
-
3
- <div
4
- :uk-dropdown="options"
5
- class="uk-padding-remove z-10 hidden text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-slate-800 p-2">
6
-
7
- <ul class="uk-nav uk-dropdown-nav">
8
-
9
- <slot></slot>
10
-
11
- </ul>
12
-
13
- </div>
14
-
15
- </template>
16
-
17
- <script>
18
-
19
- export default {
20
-
21
- props: {
22
- pos: {
23
- type: String,
24
- default: "bottom-left"
25
- },
26
- mode: {
27
- type: String,
28
- default: "click"
29
- },
30
- offset: {
31
- type: Number,
32
- default: 0
33
- },
34
- animation: {
35
- type: String,
36
- default: "uk-animation-slide-top-small"
37
- },
38
- duration: {
39
- type: Number,
40
- default: 500
41
- }
42
- },
43
-
44
- computed: {
45
-
46
- options () {
47
-
48
- return `
49
- pos: ${this.pos};
50
- mode: ${this.mode};
51
- offset: ${this.offset};
52
- animation: ${this.animation};
53
- duration: ${this.duration};
54
- `;
55
-
56
- }
57
-
58
- }
59
-
60
- }
61
-
62
- </script>
1
+ <template>
2
+
3
+ <div
4
+ :uk-dropdown="options"
5
+ class="fe-p-0 z-10 hidden text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-slate-800 p-2">
6
+
7
+ <ul class="fe-menu">
8
+
9
+ <slot></slot>
10
+
11
+ </ul>
12
+
13
+ </div>
14
+
15
+ </template>
16
+
17
+ <script setup>
18
+
19
+ import { computed } from 'vue'
20
+
21
+ const props = defineProps({
22
+ pos: {
23
+ type: String,
24
+ default: "bottom-left"
25
+ },
26
+ mode: {
27
+ type: String,
28
+ default: "click"
29
+ },
30
+ offset: {
31
+ type: Number,
32
+ default: 0
33
+ },
34
+ animation: {
35
+ type: String,
36
+ // Es el nombre de una animacion de UIkit, no una clase nuestra: el
37
+ // dropdown sigue siendo de UIkit hasta que lo sustituya un componente
38
+ // headless propio.
39
+ default: "uk-animation-slide-top-small"
40
+ },
41
+ duration: {
42
+ type: Number,
43
+ default: 500
44
+ }
45
+ })
46
+
47
+ const options = computed(() => `
48
+ pos: ${props.pos};
49
+ mode: ${props.mode};
50
+ offset: ${props.offset};
51
+ animation: ${props.animation};
52
+ duration: ${props.duration};
53
+ `)
54
+
55
+ </script>
@@ -1,110 +1,79 @@
1
- <template>
2
-
3
- <ul v-if="length > 3" class="uk-pagination uk-flex-center" uk-margin>
4
-
5
- <li v-if="firstLink != null">
6
-
7
- <a href="#" @click="$emit('go', firstLink)">
8
-
9
- <span uk-pagination-previous></span>
10
-
11
- </a>
12
-
13
- </li>
14
-
15
- <li
16
- v-for="link in middleLinks"
17
- :key="link.label"
18
- :class="{
19
- 'uk-disabled': link.url == null,
20
- 'uk-active': link.active,
21
- }">
22
-
23
- <a href="#" @click="$emit('go', link.url)">
24
-
25
- {{ link.label }}
26
-
27
- </a>
28
-
29
- </li>
30
-
31
- <li v-if="lastLink != null">
32
-
33
- <a href="#" @click="$emit('go', lastLink)">
34
-
35
- <span uk-pagination-next></span>
36
-
37
- </a>
38
-
39
- </li>
40
-
41
- </ul>
42
-
43
- </template>
44
-
45
- <script>
46
-
47
- export default {
48
-
49
- props: {
50
- links: {
51
- type: Array,
52
- required: true,
53
- }
54
- },
55
-
56
- emits: ['go'],
57
-
58
- computed: {
59
-
60
- length() {
61
-
62
- return this.links.length;
63
-
64
- },
65
-
66
- lastLinkIndex() {
67
-
68
- return this.length - 1;
69
-
70
- },
71
-
72
- firstLink() {
73
-
74
- return (this.length > 0) ? this.links[0].url : null;
75
-
76
- },
77
-
78
- lastLink() {
79
-
80
- return (this.length > 0 && this.links[this.lastLinkIndex] != undefined) ?
81
- this.links[this.lastLinkIndex].url :
82
- null;
83
-
84
- },
85
-
86
- middleLinks() {
87
-
88
- let auxLinks = this.links;
89
-
90
- let middleLinks = auxLinks.slice(1, -1);
91
-
92
- return middleLinks;
93
-
94
- },
95
-
96
- }
97
-
98
- }
99
-
100
- </script>
101
-
102
- <style scoped>
103
-
104
- .uk-pagination > .uk-active > * {
105
- color: #666;
106
- font-weight: 600;
107
- border-bottom: 3px solid var(--primary-color);
108
- }
109
-
110
- </style>
1
+ <template>
2
+
3
+ <ul v-if="length > 3" class="fe-pagination fe-justify-center" fe-mb>
4
+
5
+ <li v-if="firstLink != null">
6
+
7
+ <a href="#" @click="emit('go', firstLink)">
8
+
9
+ <span fe-page-prev></span>
10
+
11
+ </a>
12
+
13
+ </li>
14
+
15
+ <li
16
+ v-for="link in middleLinks"
17
+ :key="link.label"
18
+ :class="{ 'fe-disabled': link.url == null, 'fe-active': link.active, }">
19
+
20
+ <a href="#" @click="emit('go', link.url)">
21
+
22
+ {{ link.label }}
23
+
24
+ </a>
25
+
26
+ </li>
27
+
28
+ <li v-if="lastLink != null">
29
+
30
+ <a href="#" @click="emit('go', lastLink)">
31
+
32
+ <span fe-page-next></span>
33
+
34
+ </a>
35
+
36
+ </li>
37
+
38
+ </ul>
39
+
40
+ </template>
41
+
42
+ <script setup>
43
+
44
+ import { computed } from 'vue'
45
+
46
+ const props = defineProps({
47
+ links: {
48
+ type: Array,
49
+ required: true,
50
+ }
51
+ })
52
+
53
+ const emit = defineEmits(['go'])
54
+
55
+ const length = computed(() => props.links.length)
56
+
57
+ const firstLink = computed(() => length.value > 0 ? props.links[0].url : null)
58
+
59
+ const lastLink = computed(() => {
60
+
61
+ const last = props.links[length.value - 1]
62
+
63
+ return length.value > 0 && last !== undefined ? last.url : null
64
+
65
+ })
66
+
67
+ const middleLinks = computed(() => props.links.slice(1, -1))
68
+
69
+ </script>
70
+
71
+ <style scoped>
72
+
73
+ .fe-pagination > .fe-active > * {
74
+ color: #666;
75
+ font-weight: 600;
76
+ border-bottom: 3px solid var(--primary-color);
77
+ }
78
+
79
+ </style>