clbs-libs-ui 1.0.0 → 1.0.2
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 +4 -2
- package/src/index.js +0 -1
- package/src/pages/FavoriteModal.vue +0 -207
- package/vite.config.js +0 -18
package/package.json
CHANGED
package/src/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as FavoritePage } from './pages/FavoriteModal.vue'
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref } from "vue"
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
type: {
|
|
6
|
-
type: String,
|
|
7
|
-
required: true
|
|
8
|
-
},
|
|
9
|
-
miniState: {
|
|
10
|
-
type: Boolean,
|
|
11
|
-
required: true
|
|
12
|
-
},
|
|
13
|
-
api: {
|
|
14
|
-
type: Object,
|
|
15
|
-
required: true
|
|
16
|
-
},
|
|
17
|
-
stores: {
|
|
18
|
-
type: Object,
|
|
19
|
-
required: true
|
|
20
|
-
},
|
|
21
|
-
constants: {
|
|
22
|
-
type: Object,
|
|
23
|
-
required: true
|
|
24
|
-
},
|
|
25
|
-
ui: {
|
|
26
|
-
type: Object,
|
|
27
|
-
required: true
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
ModalViewSmall,
|
|
33
|
-
CloseButton,
|
|
34
|
-
LoadingComponent,
|
|
35
|
-
EmptyData,
|
|
36
|
-
ContentBtn,
|
|
37
|
-
SearchInput,
|
|
38
|
-
FavoriteOutlineIcon,
|
|
39
|
-
FavoriteIcon,
|
|
40
|
-
Dots,
|
|
41
|
-
HomeIcon,
|
|
42
|
-
EmailIcon
|
|
43
|
-
} = props.ui
|
|
44
|
-
|
|
45
|
-
const tab = ref("SUPPORT")
|
|
46
|
-
const filter = ref("")
|
|
47
|
-
const isLoading = ref(false)
|
|
48
|
-
|
|
49
|
-
const rows = ref({
|
|
50
|
-
WIKI: [],
|
|
51
|
-
LMS: [],
|
|
52
|
-
SUPPORT: []
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const pagination = ref({
|
|
56
|
-
WIKI: { page: 1, rowsPerPage: 18, rowsNumber: 0 },
|
|
57
|
-
LMS: { page: 1, rowsPerPage: 18, rowsNumber: 0 },
|
|
58
|
-
SUPPORT: { page: 1, rowsPerPage: 18, rowsNumber: 0 }
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
const maxTitleLength = 75
|
|
62
|
-
|
|
63
|
-
const changeTab = async (value) => {
|
|
64
|
-
tab.value = value
|
|
65
|
-
await getData()
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const getData = async () => {
|
|
69
|
-
isLoading.value = true
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
let result
|
|
73
|
-
if (props.type === "history") {
|
|
74
|
-
result = await props.api.fetchHistory()
|
|
75
|
-
}
|
|
76
|
-
else if (tab.value === "SUPPORT") {
|
|
77
|
-
result = await props.api.fetchFavoritesTasksRows()
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
result = await props.api.fetchFavorites({
|
|
81
|
-
query: filter.value,
|
|
82
|
-
type: tab.value.toLowerCase()
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
rows.value[tab.value] = result?.data || []
|
|
86
|
-
} catch (e) {
|
|
87
|
-
console.error(e)
|
|
88
|
-
props.stores?.notifications?.cancel?.(e.message)
|
|
89
|
-
}
|
|
90
|
-
isLoading.value = false
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const toggleFavorite = async (row) => {
|
|
94
|
-
try {
|
|
95
|
-
if (row.favorite === 0) {
|
|
96
|
-
const res = await props.api.fetchAddFavorite(
|
|
97
|
-
row.idPage,
|
|
98
|
-
tab.value
|
|
99
|
-
)
|
|
100
|
-
if (res) row.favorite = 1
|
|
101
|
-
} else {
|
|
102
|
-
const res = await props.api.fetchDeleteFavorite(
|
|
103
|
-
row.idPage,
|
|
104
|
-
tab.value
|
|
105
|
-
)
|
|
106
|
-
if (res) row.favorite = 0
|
|
107
|
-
}
|
|
108
|
-
} catch (e) {
|
|
109
|
-
console.error(e)
|
|
110
|
-
props.stores?.notifications?.cancel?.(e.message)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const goToPage = (row) => {
|
|
115
|
-
const { WIKI_URL, LMS_URL } = props.constants
|
|
116
|
-
if (tab.value === "SUPPORT") {
|
|
117
|
-
window.open(row.url, "_blank")
|
|
118
|
-
}
|
|
119
|
-
if (tab.value === "WIKI") {
|
|
120
|
-
window.open(`${WIKI_URL}/${row.idPage}`, "_blank")
|
|
121
|
-
}
|
|
122
|
-
if (tab.value === "LMS") {
|
|
123
|
-
window.open(`${LMS_URL}/#/course/${row.idPage}`, "_blank")
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
</script>
|
|
127
|
-
|
|
128
|
-
<template>
|
|
129
|
-
<ModalViewSmall
|
|
130
|
-
:modal-open="true"
|
|
131
|
-
:mini-state="miniState"
|
|
132
|
-
>
|
|
133
|
-
<q-card
|
|
134
|
-
:style="{ left: miniState ? '57px' : '240px' }"
|
|
135
|
-
class="modal"
|
|
136
|
-
>
|
|
137
|
-
<CloseButton />
|
|
138
|
-
<div style="max-width:800px">
|
|
139
|
-
<SearchInput v-model="filter"/>
|
|
140
|
-
<q-tabs
|
|
141
|
-
v-model="tab"
|
|
142
|
-
dense
|
|
143
|
-
active-color="primary"
|
|
144
|
-
indicator-color="primary"
|
|
145
|
-
align="justify"
|
|
146
|
-
>
|
|
147
|
-
<q-tab
|
|
148
|
-
v-if="type === 'favorites'"
|
|
149
|
-
name="SUPPORT"
|
|
150
|
-
label="Support"
|
|
151
|
-
@click="changeTab('SUPPORT')"
|
|
152
|
-
/>
|
|
153
|
-
<q-tab
|
|
154
|
-
name="WIKI"
|
|
155
|
-
label="Wiki"
|
|
156
|
-
@click="changeTab('WIKI')"
|
|
157
|
-
/>
|
|
158
|
-
<q-tab
|
|
159
|
-
name="LMS"
|
|
160
|
-
label="Learning"
|
|
161
|
-
@click="changeTab('LMS')"
|
|
162
|
-
/>
|
|
163
|
-
</q-tabs>
|
|
164
|
-
<q-tab-panels v-model="tab">
|
|
165
|
-
<q-tab-panel name="WIKI">
|
|
166
|
-
<LoadingComponent v-if="isLoading"/>
|
|
167
|
-
<EmptyData v-else-if="rows.WIKI.length === 0"/>
|
|
168
|
-
<q-table
|
|
169
|
-
v-else
|
|
170
|
-
:rows="rows.WIKI"
|
|
171
|
-
>
|
|
172
|
-
<template #body="props">
|
|
173
|
-
<q-tr :props="props">
|
|
174
|
-
<q-td>
|
|
175
|
-
<q-btn
|
|
176
|
-
flat
|
|
177
|
-
no-caps
|
|
178
|
-
@click="goToPage(props.row)"
|
|
179
|
-
>
|
|
180
|
-
<span v-if="props.row.name.length < maxTitleLength">
|
|
181
|
-
{{ props.row.name }}
|
|
182
|
-
</span>
|
|
183
|
-
<span v-else>
|
|
184
|
-
{{ props.row.name.slice(0, maxTitleLength) }}
|
|
185
|
-
<Dots size="18"/>
|
|
186
|
-
</span>
|
|
187
|
-
</q-btn>
|
|
188
|
-
</q-td>
|
|
189
|
-
<q-td>
|
|
190
|
-
<ContentBtn
|
|
191
|
-
@click="toggleFavorite(props.row)"
|
|
192
|
-
>
|
|
193
|
-
<FavoriteOutlineIcon
|
|
194
|
-
v-if="props.row.favorite === 0"
|
|
195
|
-
/>
|
|
196
|
-
<FavoriteIcon v-else/>
|
|
197
|
-
</ContentBtn>
|
|
198
|
-
</q-td>
|
|
199
|
-
</q-tr>
|
|
200
|
-
</template>
|
|
201
|
-
</q-table>
|
|
202
|
-
</q-tab-panel>
|
|
203
|
-
</q-tab-panels>
|
|
204
|
-
</div>
|
|
205
|
-
</q-card>
|
|
206
|
-
</ModalViewSmall>
|
|
207
|
-
</template>
|
package/vite.config.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vite"
|
|
2
|
-
import vue from "@vitejs/plugin-vue"
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
plugins: [vue()],
|
|
6
|
-
|
|
7
|
-
build: {
|
|
8
|
-
lib: {
|
|
9
|
-
entry: "src/index.js",
|
|
10
|
-
name: "ClbsUI",
|
|
11
|
-
fileName: "clbs-ui"
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
rollupOptions: {
|
|
15
|
-
external: ["vue"]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
})
|