@monoui/vuejs 1.1.10
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/README.md +27 -0
- package/dist/main.js +410 -0
- package/package.json +105 -0
- package/src/components/BreadCrumb/BreadCrumb.vue +59 -0
- package/src/components/BreadCrumb/index.js +3 -0
- package/src/components/Button/Button.vue +118 -0
- package/src/components/Button/ButtonCore.vue +59 -0
- package/src/components/Button/ButtonEdit.vue +15 -0
- package/src/components/Button/ButtonRemove.vue +15 -0
- package/src/components/Button/index.js +4 -0
- package/src/components/Card/Card.vue +82 -0
- package/src/components/Card/CardBody.vue +72 -0
- package/src/components/Card/CardFooter.vue +55 -0
- package/src/components/Card/CardHeader.vue +58 -0
- package/src/components/Card/CardSubTitle.vue +43 -0
- package/src/components/Card/CardText.vue +21 -0
- package/src/components/Card/CardTitle.vue +38 -0
- package/src/components/Card/index.js +17 -0
- package/src/components/Checkbox/Checkbox.vue +72 -0
- package/src/components/Checkbox/index.js +3 -0
- package/src/components/Cron/Cron.vue +68 -0
- package/src/components/Cron/index.js +3 -0
- package/src/components/Date/DatePicker.vue +406 -0
- package/src/components/Date/index.js +3 -0
- package/src/components/Dropdown/Dropdown.vue +51 -0
- package/src/components/Dropdown/DropdownDivider.vue +12 -0
- package/src/components/Dropdown/DropdownItem.vue +23 -0
- package/src/components/Dropdown/index.js +5 -0
- package/src/components/DynamicInput/DynamicInput.vue +192 -0
- package/src/components/DynamicInput/index.js +3 -0
- package/src/components/DynamicInput/inputTypes.js +14 -0
- package/src/components/Icon/Icon.vue +43 -0
- package/src/components/Icon/index.js +3 -0
- package/src/components/Info/Info.vue +19 -0
- package/src/components/Info/index.js +3 -0
- package/src/components/Input/Input.vue +73 -0
- package/src/components/Input/index.js +3 -0
- package/src/components/KeyValue/KeyValue.vue +138 -0
- package/src/components/KeyValue/index.js +3 -0
- package/src/components/KeyValueInput/KeyValueInput.vue +203 -0
- package/src/components/KeyValueInput/index.js +3 -0
- package/src/components/Loader/Loader.vue +82 -0
- package/src/components/Loader/content-loader.js +150 -0
- package/src/components/Loader/index.js +2 -0
- package/src/components/Modal/Alert.vue +96 -0
- package/src/components/Modal/Modal.vue +125 -0
- package/src/components/Modal/RemoveAlert.vue +58 -0
- package/src/components/Modal/UnsavedChangesAlert.vue +83 -0
- package/src/components/Modal/index.js +6 -0
- package/src/components/MultiKeyValue/MultiKeyValue.vue +359 -0
- package/src/components/MultiKeyValue/index.js +3 -0
- package/src/components/NoData/NoData.vue +20 -0
- package/src/components/NoData/index.js +3 -0
- package/src/components/Popover/Popover.vue +91 -0
- package/src/components/Popover/index.js +3 -0
- package/src/components/Select/Select.vue +71 -0
- package/src/components/Select/index.js +3 -0
- package/src/components/Spinner/Spinner.vue +19 -0
- package/src/components/Spinner/index.js +3 -0
- package/src/components/Table/Icons/ArrowDown.vue +18 -0
- package/src/components/Table/Icons/ArrowDownLong.vue +18 -0
- package/src/components/Table/Icons/ArrowUp.vue +18 -0
- package/src/components/Table/Icons/ArrowUpLong.vue +18 -0
- package/src/components/Table/Icons/BaseIcon.vue +46 -0
- package/src/components/Table/Icons/Sorting.vue +16 -0
- package/src/components/Table/Icons/SortingAZ.vue +18 -0
- package/src/components/Table/Icons/SortingArrows.vue +18 -0
- package/src/components/Table/Table.vue +548 -0
- package/src/components/Table/index.js +3 -0
- package/src/components/Tabs/Tab.vue +36 -0
- package/src/components/Tabs/Tabs.vue +44 -0
- package/src/components/Tabs/index.js +4 -0
- package/src/components/TagInput/TagInput.vue +129 -0
- package/src/components/TagInput/index.js +3 -0
- package/src/components/Timeline/Timeline.vue +33 -0
- package/src/components/Timeline/TimelineItem.vue +40 -0
- package/src/components/Timeline/index.js +4 -0
- package/src/components/Tooltip/Tooltip.vue +62 -0
- package/src/components/Tooltip/index.js +3 -0
- package/src/functions/alert.js +40 -0
- package/src/functions/notification.js +51 -0
- package/src/icons.js +144 -0
- package/src/index.js +133 -0
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div
|
|
4
|
+
:class="{
|
|
5
|
+
'table-responsive': isResponsive,
|
|
6
|
+
'table-relative': isLoading
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
v-if="isLoading && !isEmpty"
|
|
11
|
+
style="position: absolute; width: 100%; height: 100%; left:0; top:0;"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
class="d-flex align-items-center justify-content-center w-100 h-100"
|
|
15
|
+
>
|
|
16
|
+
<b-spinner variant="primary" />
|
|
17
|
+
</div>
|
|
18
|
+
<div
|
|
19
|
+
style="background:#ddd; opacity: 0.4; position: absolute; width: 100%; height:100%; left:0; top:0;"
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
<table
|
|
23
|
+
:class="
|
|
24
|
+
`table mt-0 w-100 d-block d-md-table table-hover flex-grow-1 ${tableClass}`
|
|
25
|
+
"
|
|
26
|
+
>
|
|
27
|
+
<thead :class="`${headerClass} w-100`">
|
|
28
|
+
<tr>
|
|
29
|
+
<slot name="header" v-bind="columns">
|
|
30
|
+
<template
|
|
31
|
+
v-for="(columnValue,
|
|
32
|
+
columnKey,
|
|
33
|
+
indexColumn) in columns"
|
|
34
|
+
>
|
|
35
|
+
<template>
|
|
36
|
+
<th
|
|
37
|
+
:key="indexColumn"
|
|
38
|
+
:class="{
|
|
39
|
+
'has-sort': isSortable(columnKey),
|
|
40
|
+
'has-sorted-th': isSorted(columnKey)
|
|
41
|
+
}"
|
|
42
|
+
@click="toggleSort(columnKey)"
|
|
43
|
+
>
|
|
44
|
+
<slot
|
|
45
|
+
:name="`header-${columnKey}`"
|
|
46
|
+
v-bind="{
|
|
47
|
+
key: columnKey,
|
|
48
|
+
value: columnValue,
|
|
49
|
+
index: indexColumn
|
|
50
|
+
}"
|
|
51
|
+
>
|
|
52
|
+
{{ columnValue }}
|
|
53
|
+
<small
|
|
54
|
+
v-if="showColumnSubHeader"
|
|
55
|
+
class="d-block text-muted"
|
|
56
|
+
>
|
|
57
|
+
{{ columnKey }}
|
|
58
|
+
</small>
|
|
59
|
+
<span
|
|
60
|
+
v-if="isSortable(columnKey)"
|
|
61
|
+
class="sort-position"
|
|
62
|
+
>
|
|
63
|
+
<component
|
|
64
|
+
:is="
|
|
65
|
+
sortableIcon(columnKey)
|
|
66
|
+
"
|
|
67
|
+
:class="
|
|
68
|
+
sortableIconClass(
|
|
69
|
+
columnKey
|
|
70
|
+
)
|
|
71
|
+
"
|
|
72
|
+
/>
|
|
73
|
+
</span>
|
|
74
|
+
</slot>
|
|
75
|
+
</th>
|
|
76
|
+
</template>
|
|
77
|
+
</template>
|
|
78
|
+
</slot>
|
|
79
|
+
</tr>
|
|
80
|
+
<template v-if="filterable">
|
|
81
|
+
<tr v-if="filterable.length !== 0">
|
|
82
|
+
<th
|
|
83
|
+
class="p-0 p-t-1 p-b-1"
|
|
84
|
+
:colspan="Object.keys(columns).length"
|
|
85
|
+
>
|
|
86
|
+
<b-form-input
|
|
87
|
+
type="search"
|
|
88
|
+
placeholder="Search"
|
|
89
|
+
v-model="searchWord"
|
|
90
|
+
/>
|
|
91
|
+
</th>
|
|
92
|
+
</tr>
|
|
93
|
+
</template>
|
|
94
|
+
</thead>
|
|
95
|
+
<tbody>
|
|
96
|
+
<tr class="text-center" v-if="isDataEmpty">
|
|
97
|
+
<td :colspan="Object.keys(columns).length">
|
|
98
|
+
<slot name="empty-data">
|
|
99
|
+
<span> {{ emptyMessage }}</span>
|
|
100
|
+
</slot>
|
|
101
|
+
</td>
|
|
102
|
+
</tr>
|
|
103
|
+
<template v-if="isLoading && isEmpty">
|
|
104
|
+
<tr v-for="i of settings.itemPerPage" :key="'row-' + i">
|
|
105
|
+
<td
|
|
106
|
+
v-for="col in Object.keys(columns)"
|
|
107
|
+
:key="'col-' + col"
|
|
108
|
+
class="text-center"
|
|
109
|
+
>
|
|
110
|
+
<div
|
|
111
|
+
:style="{
|
|
112
|
+
opacity: (10 - i) * 0.15
|
|
113
|
+
}"
|
|
114
|
+
>
|
|
115
|
+
<slot :name="'loading-' + col">
|
|
116
|
+
<b-skeleton width="70%" />
|
|
117
|
+
</slot>
|
|
118
|
+
</div>
|
|
119
|
+
</td>
|
|
120
|
+
</tr>
|
|
121
|
+
</template>
|
|
122
|
+
<slot name="body" v-bind="tableData" v-if="!isDataEmpty">
|
|
123
|
+
<slot
|
|
124
|
+
name="row-base"
|
|
125
|
+
v-bind="{ row: row, index: rowIndex }"
|
|
126
|
+
v-for="(row, rowIndex) in tableData"
|
|
127
|
+
>
|
|
128
|
+
<tr :key="rowIndex">
|
|
129
|
+
<slot
|
|
130
|
+
name="row"
|
|
131
|
+
v-bind="{ row: row, index: rowIndex }"
|
|
132
|
+
>
|
|
133
|
+
<template
|
|
134
|
+
v-for="(columnValue,
|
|
135
|
+
columnKey,
|
|
136
|
+
indexColumn) in columns"
|
|
137
|
+
>
|
|
138
|
+
<template>
|
|
139
|
+
<slot
|
|
140
|
+
:name="
|
|
141
|
+
`column-base-${columnKey}`
|
|
142
|
+
"
|
|
143
|
+
v-bind="{
|
|
144
|
+
row: row,
|
|
145
|
+
index: rowIndex
|
|
146
|
+
}"
|
|
147
|
+
>
|
|
148
|
+
<td
|
|
149
|
+
:key="indexColumn"
|
|
150
|
+
:class="{
|
|
151
|
+
'has-sorted-td': isSorted(
|
|
152
|
+
columnKey
|
|
153
|
+
)
|
|
154
|
+
}"
|
|
155
|
+
>
|
|
156
|
+
<template>
|
|
157
|
+
<slot
|
|
158
|
+
:name="
|
|
159
|
+
`column-${columnKey}`
|
|
160
|
+
"
|
|
161
|
+
v-bind="{
|
|
162
|
+
row: row,
|
|
163
|
+
index: rowIndex
|
|
164
|
+
}"
|
|
165
|
+
>
|
|
166
|
+
{{
|
|
167
|
+
getRowValue(
|
|
168
|
+
row,
|
|
169
|
+
columnKey
|
|
170
|
+
)
|
|
171
|
+
}}
|
|
172
|
+
</slot>
|
|
173
|
+
</template>
|
|
174
|
+
</td>
|
|
175
|
+
</slot>
|
|
176
|
+
</template>
|
|
177
|
+
</template>
|
|
178
|
+
</slot>
|
|
179
|
+
</tr>
|
|
180
|
+
</slot>
|
|
181
|
+
</slot>
|
|
182
|
+
</tbody>
|
|
183
|
+
</table>
|
|
184
|
+
</div>
|
|
185
|
+
<slot name="pagination-seperator" />
|
|
186
|
+
<slot name="pagination">
|
|
187
|
+
<div class="d-flex justify-content-between align-items-center mt-2">
|
|
188
|
+
<slot name="pagination-filters">
|
|
189
|
+
<div v-show="!isDataEmpty">
|
|
190
|
+
<span>Show</span>
|
|
191
|
+
<b-dropdown
|
|
192
|
+
:text="itemPerPageText"
|
|
193
|
+
class="m-md-2"
|
|
194
|
+
size="sm"
|
|
195
|
+
variant="light"
|
|
196
|
+
>
|
|
197
|
+
<template v-for="perPage in filteredPerPageValues">
|
|
198
|
+
<b-dropdown-item
|
|
199
|
+
:key="'per-page-' + perPage"
|
|
200
|
+
@click="changeItemPerPage(perPage)"
|
|
201
|
+
>
|
|
202
|
+
{{ perPage }}
|
|
203
|
+
</b-dropdown-item>
|
|
204
|
+
</template>
|
|
205
|
+
<b-dropdown-divider
|
|
206
|
+
v-if="
|
|
207
|
+
filteredPerPageValues &&
|
|
208
|
+
filteredPerPageValues.length
|
|
209
|
+
"
|
|
210
|
+
></b-dropdown-divider>
|
|
211
|
+
<b-dropdown-item
|
|
212
|
+
@click="
|
|
213
|
+
changeItemPerPage(settings.totalItemCount)
|
|
214
|
+
"
|
|
215
|
+
>
|
|
216
|
+
All
|
|
217
|
+
</b-dropdown-item>
|
|
218
|
+
</b-dropdown>
|
|
219
|
+
</div>
|
|
220
|
+
</slot>
|
|
221
|
+
<slot name="pagination-center" v-bind="settings">
|
|
222
|
+
<span v-show="!isDataEmpty">
|
|
223
|
+
{{ settings.totalItemCount }} rows
|
|
224
|
+
</span>
|
|
225
|
+
</slot>
|
|
226
|
+
<slot name="pagination-buttons">
|
|
227
|
+
<b-pagination
|
|
228
|
+
v-if="settings.pageCount > 1"
|
|
229
|
+
v-model="settings.currentPage"
|
|
230
|
+
:total-rows="settings.totalItemCount"
|
|
231
|
+
:per-page="settings.itemPerPage"
|
|
232
|
+
@change="changePage"
|
|
233
|
+
v-bind="pagination"
|
|
234
|
+
/>
|
|
235
|
+
</slot>
|
|
236
|
+
</div>
|
|
237
|
+
</slot>
|
|
238
|
+
<slot name="footer" />
|
|
239
|
+
</div>
|
|
240
|
+
</template>
|
|
241
|
+
<style>
|
|
242
|
+
.table-relative {
|
|
243
|
+
position: relative;
|
|
244
|
+
}
|
|
245
|
+
</style>
|
|
246
|
+
<script>
|
|
247
|
+
import IconArrowUp from "./Icons/ArrowUp.vue";
|
|
248
|
+
import IconArrowUpLong from "./Icons/ArrowUpLong.vue";
|
|
249
|
+
import IconArrowDown from "./Icons/ArrowDown.vue";
|
|
250
|
+
import IconArrowDownLong from "./Icons/ArrowDownLong.vue";
|
|
251
|
+
import IconSorting from "./Icons/Sorting.vue";
|
|
252
|
+
import IconSortingAZ from "./Icons/SortingAZ.vue";
|
|
253
|
+
import IconSortingArrows from "./Icons/SortingArrows.vue";
|
|
254
|
+
export default {
|
|
255
|
+
name: "mui-table",
|
|
256
|
+
components: {
|
|
257
|
+
IconArrowUp,
|
|
258
|
+
IconArrowUpLong,
|
|
259
|
+
IconArrowDown,
|
|
260
|
+
IconArrowDownLong,
|
|
261
|
+
IconSorting,
|
|
262
|
+
IconSortingAZ,
|
|
263
|
+
IconSortingArrows
|
|
264
|
+
},
|
|
265
|
+
props: {
|
|
266
|
+
columns: {
|
|
267
|
+
type: Object,
|
|
268
|
+
required: false
|
|
269
|
+
},
|
|
270
|
+
sortable: {
|
|
271
|
+
type: Array,
|
|
272
|
+
required: false
|
|
273
|
+
},
|
|
274
|
+
showColumnSubHeader: {
|
|
275
|
+
type: Boolean,
|
|
276
|
+
required: false,
|
|
277
|
+
default: false
|
|
278
|
+
},
|
|
279
|
+
requestFunction: {
|
|
280
|
+
type: Function,
|
|
281
|
+
required: false
|
|
282
|
+
},
|
|
283
|
+
filterable: {
|
|
284
|
+
type: Array,
|
|
285
|
+
required: false
|
|
286
|
+
},
|
|
287
|
+
headerClass: {
|
|
288
|
+
type: String,
|
|
289
|
+
required: false,
|
|
290
|
+
default: ""
|
|
291
|
+
},
|
|
292
|
+
tableClass: {
|
|
293
|
+
type: String,
|
|
294
|
+
required: false,
|
|
295
|
+
default: ""
|
|
296
|
+
},
|
|
297
|
+
isResponsive: {
|
|
298
|
+
type: Boolean,
|
|
299
|
+
required: false,
|
|
300
|
+
default: true
|
|
301
|
+
},
|
|
302
|
+
pagination: {
|
|
303
|
+
type: Object,
|
|
304
|
+
required: false,
|
|
305
|
+
default: () => {
|
|
306
|
+
return { class: "m-0", size: "sm" };
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
perPageValues: {
|
|
310
|
+
type: Array,
|
|
311
|
+
required: false,
|
|
312
|
+
default: () => [10, 25, 50, 100, 250]
|
|
313
|
+
},
|
|
314
|
+
emptyMessage: {
|
|
315
|
+
type: String,
|
|
316
|
+
required: false,
|
|
317
|
+
default: "No data avaible in table"
|
|
318
|
+
},
|
|
319
|
+
autoLoad: {
|
|
320
|
+
type: Boolean,
|
|
321
|
+
required: false,
|
|
322
|
+
default: true
|
|
323
|
+
},
|
|
324
|
+
filters: {
|
|
325
|
+
type: Array,
|
|
326
|
+
required: false,
|
|
327
|
+
default: () => []
|
|
328
|
+
},
|
|
329
|
+
sorting: {
|
|
330
|
+
type: Array,
|
|
331
|
+
required: false,
|
|
332
|
+
default: () => []
|
|
333
|
+
},
|
|
334
|
+
sortingIconName: {
|
|
335
|
+
type: String,
|
|
336
|
+
required: false,
|
|
337
|
+
default: "icon-sorting-a-z"
|
|
338
|
+
},
|
|
339
|
+
sortingIconClass: {
|
|
340
|
+
type: String,
|
|
341
|
+
required: false,
|
|
342
|
+
default: "text-muted"
|
|
343
|
+
},
|
|
344
|
+
sortingIconActiveClass: {
|
|
345
|
+
type: String,
|
|
346
|
+
required: false,
|
|
347
|
+
default: "text-primary"
|
|
348
|
+
},
|
|
349
|
+
sortingIconAscName: {
|
|
350
|
+
type: String,
|
|
351
|
+
required: false,
|
|
352
|
+
default: "icon-arrow-up-long"
|
|
353
|
+
},
|
|
354
|
+
sortingIconDescName: {
|
|
355
|
+
type: String,
|
|
356
|
+
required: false,
|
|
357
|
+
default: "icon-arrow-down-long"
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
watch: {
|
|
361
|
+
searchWord(word) {
|
|
362
|
+
this.addFilter(word);
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
data() {
|
|
366
|
+
return {
|
|
367
|
+
settings: {
|
|
368
|
+
currentPage: 1,
|
|
369
|
+
pageCount: 0,
|
|
370
|
+
itemPerPage: 10,
|
|
371
|
+
totalItemCount: 0
|
|
372
|
+
},
|
|
373
|
+
tableData: [],
|
|
374
|
+
searchWord: null,
|
|
375
|
+
isDataEmpty: false,
|
|
376
|
+
isLoading: false
|
|
377
|
+
};
|
|
378
|
+
},
|
|
379
|
+
computed: {
|
|
380
|
+
filteredPerPageValues() {
|
|
381
|
+
const values = [];
|
|
382
|
+
for (const value of this.perPageValues) {
|
|
383
|
+
if (value <= this.settings.totalItemCount) {
|
|
384
|
+
values.push(value);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return values;
|
|
388
|
+
},
|
|
389
|
+
itemPerPageText() {
|
|
390
|
+
if (this.settings.itemPerPage >= this.settings.totalItemCount) {
|
|
391
|
+
return "All";
|
|
392
|
+
}
|
|
393
|
+
return `${this.settings.itemPerPage}`;
|
|
394
|
+
},
|
|
395
|
+
isEmpty() {
|
|
396
|
+
return this.settings.totalItemCount <= 0;
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
async mounted() {
|
|
400
|
+
if (this.autoLoad) await this.getValues();
|
|
401
|
+
},
|
|
402
|
+
created() {},
|
|
403
|
+
methods: {
|
|
404
|
+
sortableIcon(column) {
|
|
405
|
+
const currentSort = this.sorting.find(x => x.Column === column);
|
|
406
|
+
if (!currentSort) {
|
|
407
|
+
return this.sortingIconName;
|
|
408
|
+
}
|
|
409
|
+
if (currentSort.Asc) {
|
|
410
|
+
return this.sortingIconAscName;
|
|
411
|
+
} else {
|
|
412
|
+
return this.sortingIconDescName;
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
sortableIconClass(column) {
|
|
416
|
+
if (this.isSorted(column)) {
|
|
417
|
+
return this.sortingIconActiveClass;
|
|
418
|
+
}
|
|
419
|
+
return this.sortingIconClass;
|
|
420
|
+
},
|
|
421
|
+
isSorted(column) {
|
|
422
|
+
return this.sorting.some(x => x.Column === column);
|
|
423
|
+
},
|
|
424
|
+
async toggleSort(column) {
|
|
425
|
+
if (!this.isSortable(column)) {
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
let currentSort = this.sorting.find(x => x.Column === column);
|
|
429
|
+
if (!currentSort) {
|
|
430
|
+
currentSort = { Column: column, Asc: true };
|
|
431
|
+
this.sorting.push(currentSort);
|
|
432
|
+
} else {
|
|
433
|
+
if (!currentSort.Asc) {
|
|
434
|
+
this.sorting.splice(this.sorting.indexOf(currentSort), 1);
|
|
435
|
+
} else {
|
|
436
|
+
currentSort.Asc = false;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
await this.getValues();
|
|
441
|
+
},
|
|
442
|
+
isSortable(column) {
|
|
443
|
+
if (!this.sortable) return false;
|
|
444
|
+
if (this.sortable.indexOf(column) > -1) return true;
|
|
445
|
+
return false;
|
|
446
|
+
},
|
|
447
|
+
getRowValue(row, key) {
|
|
448
|
+
const splitted = key.split(".");
|
|
449
|
+
return splitted.reduce(
|
|
450
|
+
(obj, key) =>
|
|
451
|
+
obj && obj[key] !== "undefined" ? obj[key] : undefined,
|
|
452
|
+
row
|
|
453
|
+
);
|
|
454
|
+
},
|
|
455
|
+
async getValues() {
|
|
456
|
+
this.isLoading = true;
|
|
457
|
+
this.$emit("loading", this.isLoading);
|
|
458
|
+
const { currentPage, itemPerPage } = this.settings;
|
|
459
|
+
|
|
460
|
+
let result = await this.requestFunction(
|
|
461
|
+
this.filters,
|
|
462
|
+
this.sorting,
|
|
463
|
+
currentPage,
|
|
464
|
+
itemPerPage
|
|
465
|
+
);
|
|
466
|
+
|
|
467
|
+
if (!result || result.status !== 200) {
|
|
468
|
+
this.isLoading = false;
|
|
469
|
+
this.isDataEmpty = true;
|
|
470
|
+
this.$emit("loading", this.isLoading);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const resultData = result.data.data
|
|
475
|
+
? result.data.data
|
|
476
|
+
: result.data.Data;
|
|
477
|
+
|
|
478
|
+
this.settings.currentPage =
|
|
479
|
+
resultData.currentPage || resultData.CurrentPage;
|
|
480
|
+
this.settings.pageCount =
|
|
481
|
+
resultData.pageCount || resultData.PageCount;
|
|
482
|
+
this.settings.itemPerPage =
|
|
483
|
+
resultData.itemPerPage || resultData.ItemPerPage;
|
|
484
|
+
this.settings.totalItemCount =
|
|
485
|
+
resultData.totalItemCount || resultData.TotalItemCount;
|
|
486
|
+
|
|
487
|
+
this.tableData = resultData.data || resultData.Data;
|
|
488
|
+
if (this.settings.totalItemCount == 0) {
|
|
489
|
+
this.isDataEmpty = true;
|
|
490
|
+
} else {
|
|
491
|
+
this.isDataEmpty = false;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
this.settings.currentPage = currentPage;
|
|
495
|
+
this.settings.itemPerPage = itemPerPage;
|
|
496
|
+
if (
|
|
497
|
+
this.settings.itemPerPage ===
|
|
498
|
+
(resultData.totalItemCount || resultData.TotalItemCount)
|
|
499
|
+
) {
|
|
500
|
+
this.settings.pageCount = 1;
|
|
501
|
+
}
|
|
502
|
+
this.isLoading = false;
|
|
503
|
+
this.$emit("loading", this.isLoading);
|
|
504
|
+
},
|
|
505
|
+
changePage(page) {
|
|
506
|
+
this.settings.currentPage = page;
|
|
507
|
+
|
|
508
|
+
this.getValues();
|
|
509
|
+
},
|
|
510
|
+
changeItemPerPage(value) {
|
|
511
|
+
this.settings.itemPerPage = value;
|
|
512
|
+
this.getValues();
|
|
513
|
+
},
|
|
514
|
+
isLessThanTotalItemCount(val) {
|
|
515
|
+
return this.settings.totalItemCount > val;
|
|
516
|
+
},
|
|
517
|
+
/** */
|
|
518
|
+
refresh() {
|
|
519
|
+
this.getValues();
|
|
520
|
+
},
|
|
521
|
+
addFilter(word) {
|
|
522
|
+
if (!word || word.length < 3) {
|
|
523
|
+
this.getValues();
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
this.getValues();
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
</script>
|
|
532
|
+
<style scoped>
|
|
533
|
+
.has-sort {
|
|
534
|
+
cursor: pointer;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.sort-position {
|
|
538
|
+
float: right;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.has-sorted-th {
|
|
542
|
+
background-color: #e5e7eb;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.has-sorted-td {
|
|
546
|
+
background-color: #f9fafb;
|
|
547
|
+
}
|
|
548
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-tab v-on="$listeners" v-bind="$props" :title="title">
|
|
3
|
+
<template slot="title">
|
|
4
|
+
<slot name="title"></slot>
|
|
5
|
+
</template>
|
|
6
|
+
<slot name="content"></slot>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</b-tab>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
/**
|
|
13
|
+
* MonoUI Tab Component
|
|
14
|
+
*/
|
|
15
|
+
export default {
|
|
16
|
+
name: "mui-tab",
|
|
17
|
+
props: {
|
|
18
|
+
/**
|
|
19
|
+
* Tab title
|
|
20
|
+
* @type String
|
|
21
|
+
*/
|
|
22
|
+
title: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Disable component when value is true.
|
|
28
|
+
* @type Boolean
|
|
29
|
+
*/
|
|
30
|
+
disabled: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-tabs v-on="$listeners" v-bind="$props" v-model="tabIndex">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</b-tabs>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
/**
|
|
9
|
+
* MonoUI Tabs Component
|
|
10
|
+
*/
|
|
11
|
+
export default {
|
|
12
|
+
name: "mui-tabs",
|
|
13
|
+
watch: {
|
|
14
|
+
tabIndex(val) {
|
|
15
|
+
this.$emit("input", val);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
/**
|
|
20
|
+
* Tabs change state value.
|
|
21
|
+
*/
|
|
22
|
+
value: {},
|
|
23
|
+
active: {},
|
|
24
|
+
pills: {},
|
|
25
|
+
card: {},
|
|
26
|
+
vertical: {},
|
|
27
|
+
small: {},
|
|
28
|
+
"content-class": {},
|
|
29
|
+
"nav-class": {},
|
|
30
|
+
"nav-wrapper-class": {},
|
|
31
|
+
"active-nav-item-class": {},
|
|
32
|
+
"active-tab-class": {},
|
|
33
|
+
"no-fade": {}
|
|
34
|
+
},
|
|
35
|
+
data() {
|
|
36
|
+
return {
|
|
37
|
+
tabIndex: 0
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
mounted() {
|
|
41
|
+
this.tabIndex = this.value;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
</script>
|