@tekkare/auriga 0.1.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.
- package/README.md +89 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +7 -0
- package/dist/module.d.ts +7 -0
- package/dist/module.json +8 -0
- package/dist/module.mjs +23 -0
- package/dist/runtime/components/argAdvancedSearchBar.vue +866 -0
- package/dist/runtime/components/argAdvancedSearchBar.vue.d.ts +4 -0
- package/dist/runtime/components/argBtn.vue +108 -0
- package/dist/runtime/components/argBtn.vue.d.ts +4 -0
- package/dist/runtime/components/argComplexSelect.vue +558 -0
- package/dist/runtime/components/argComplexSelect.vue.d.ts +4 -0
- package/dist/runtime/components/argDataLoader.vue +337 -0
- package/dist/runtime/components/argDataLoader.vue.d.ts +4 -0
- package/dist/runtime/components/argDropdownSelect.vue +321 -0
- package/dist/runtime/components/argDropdownSelect.vue.d.ts +4 -0
- package/dist/runtime/components/argFileBtn.vue +136 -0
- package/dist/runtime/components/argFileBtn.vue.d.ts +4 -0
- package/dist/runtime/components/argHeaderTabs.vue +216 -0
- package/dist/runtime/components/argHeaderTabs.vue.d.ts +4 -0
- package/dist/runtime/components/argIcon.vue +3135 -0
- package/dist/runtime/components/argIcon.vue.d.ts +4 -0
- package/dist/runtime/components/argMultipleChoice.vue +149 -0
- package/dist/runtime/components/argMultipleChoice.vue.d.ts +4 -0
- package/dist/runtime/components/argNoData.vue +83 -0
- package/dist/runtime/components/argNoData.vue.d.ts +4 -0
- package/dist/runtime/components/argSearchInput.vue +123 -0
- package/dist/runtime/components/argSearchInput.vue.d.ts +4 -0
- package/dist/runtime/components/argSimpleLabel.vue +214 -0
- package/dist/runtime/components/argSimpleLabel.vue.d.ts +4 -0
- package/dist/runtime/components/argStyle.vue +975 -0
- package/dist/runtime/components/argStyle.vue.d.ts +4 -0
- package/dist/runtime/components/argTable.vue +863 -0
- package/dist/runtime/components/argTable.vue.d.ts +4 -0
- package/dist/runtime/components/argTags.vue +26 -0
- package/dist/runtime/components/argTags.vue.d.ts +4 -0
- package/dist/runtime/components/argTekkareLoader.vue +72 -0
- package/dist/runtime/components/argTekkareLoader.vue.d.ts +4 -0
- package/dist/runtime/components/argTooltip.vue +141 -0
- package/dist/runtime/components/argTooltip.vue.d.ts +4 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.mjs +4 -0
- package/dist/types.d.mts +15 -0
- package/dist/types.d.ts +15 -0
- package/package.json +45 -0
|
@@ -0,0 +1,863 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex-table">
|
|
3
|
+
<arg-search-input
|
|
4
|
+
v-if="search"
|
|
5
|
+
v-model:Value="searchKey"
|
|
6
|
+
:placeHolderValue="getPlaceHolder"
|
|
7
|
+
:value="searchKey"
|
|
8
|
+
class="table_input"
|
|
9
|
+
@submitSearch="searchSubmit = true"
|
|
10
|
+
/>
|
|
11
|
+
<div class="rcd_scrollTable">
|
|
12
|
+
<table id="rcd_table">
|
|
13
|
+
<thead>
|
|
14
|
+
<tr>
|
|
15
|
+
<th
|
|
16
|
+
v-for="(head, keyIndex) in heads"
|
|
17
|
+
:key="keyIndex"
|
|
18
|
+
:class="[
|
|
19
|
+
columnStyle.size && columnStyle.size[keyIndex]
|
|
20
|
+
? `oip_column is-${columnStyle.size[keyIndex]}`
|
|
21
|
+
: 'oip_column',
|
|
22
|
+
columnStyle.align && columnStyle.align[keyIndex]
|
|
23
|
+
? `column_align ${columnStyle.align[keyIndex]}`
|
|
24
|
+
: '',
|
|
25
|
+
]"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
class="rcd-table-header oip_row gap-8"
|
|
29
|
+
:class="
|
|
30
|
+
columnStyle.align && columnStyle.align[keyIndex]
|
|
31
|
+
? `column_align ${columnStyle.align[keyIndex]}`
|
|
32
|
+
: ''
|
|
33
|
+
"
|
|
34
|
+
>
|
|
35
|
+
<div class="rcd-col-title">
|
|
36
|
+
<p>{{ head }}</p>
|
|
37
|
+
</div>
|
|
38
|
+
<div
|
|
39
|
+
v-if="head !== 'More'"
|
|
40
|
+
class="rcd-table-sort"
|
|
41
|
+
@click="sortDatas(keyIndex)"
|
|
42
|
+
v-show="sort"
|
|
43
|
+
>
|
|
44
|
+
<arg-icon
|
|
45
|
+
name="CaretUp"
|
|
46
|
+
:color="changeColorAsc(keyIndex)"
|
|
47
|
+
size="12"
|
|
48
|
+
class="sort_up_icon"
|
|
49
|
+
thickness="36"
|
|
50
|
+
></arg-icon>
|
|
51
|
+
<arg-icon
|
|
52
|
+
name="CaretDown"
|
|
53
|
+
:color="changeColorDesc(keyIndex)"
|
|
54
|
+
size="12"
|
|
55
|
+
class="sort_down_icon"
|
|
56
|
+
thickness="36"
|
|
57
|
+
></arg-icon>
|
|
58
|
+
</div>
|
|
59
|
+
<arg-tooltip
|
|
60
|
+
v-if="tooltipHeader[keyIndex]"
|
|
61
|
+
:tooltip-text="tooltipHeader[keyIndex]"
|
|
62
|
+
dir="bottom"
|
|
63
|
+
class="filter_tooltip"
|
|
64
|
+
:sideLimit="keyIndex === heads.length - 1"
|
|
65
|
+
>
|
|
66
|
+
<arg-icon name="Info" size="16" color="var(--primary)" />
|
|
67
|
+
</arg-tooltip>
|
|
68
|
+
</div>
|
|
69
|
+
</th>
|
|
70
|
+
</tr>
|
|
71
|
+
</thead>
|
|
72
|
+
<tbody v-if="finalTable.length > 0">
|
|
73
|
+
<template
|
|
74
|
+
v-for="(content, contIndex, rowIndex) in finalTable"
|
|
75
|
+
:key="contIndex"
|
|
76
|
+
>
|
|
77
|
+
<tr
|
|
78
|
+
:id="`${contIndex}-row`"
|
|
79
|
+
:class="isOdd(contIndex) ? 'white_bg' : 'grey_bg'"
|
|
80
|
+
>
|
|
81
|
+
<td
|
|
82
|
+
v-for="(value, valIndex) in content"
|
|
83
|
+
:key="valIndex"
|
|
84
|
+
:class="[
|
|
85
|
+
{ 'rcd-NA': isNA(value) },
|
|
86
|
+
columnStyle.align && columnStyle.align[valIndex]
|
|
87
|
+
? `column_align ${columnStyle.align[valIndex]}`
|
|
88
|
+
: '',
|
|
89
|
+
]"
|
|
90
|
+
>
|
|
91
|
+
<arg-icon
|
|
92
|
+
v-if="columnTypeNonProps[valIndex] === 'More'"
|
|
93
|
+
name="CaretCircleRight"
|
|
94
|
+
@click.native="openLine(contIndex)"
|
|
95
|
+
:class="[
|
|
96
|
+
'icon-show-more',
|
|
97
|
+
showLine === contIndex ? 'icon_rotate' : '',
|
|
98
|
+
]"
|
|
99
|
+
/>
|
|
100
|
+
<slot
|
|
101
|
+
v-if="columnTypeNonProps[valIndex] !== ''"
|
|
102
|
+
:name="columnTypeNonProps[valIndex]"
|
|
103
|
+
v-bind:value="value"
|
|
104
|
+
></slot>
|
|
105
|
+
<p v-else>{{ value }}</p>
|
|
106
|
+
</td>
|
|
107
|
+
</tr>
|
|
108
|
+
<tr
|
|
109
|
+
v-if="showLine === contIndex"
|
|
110
|
+
class="more_row"
|
|
111
|
+
:key="rowIndex"
|
|
112
|
+
:class="greyBG(contIndex) ? 'grey_bg' : 'white_bg'"
|
|
113
|
+
>
|
|
114
|
+
<td class="more_section" :colspan="heads.length.toString()">
|
|
115
|
+
<slot name="showMore" v-bind:value="contIndex" />
|
|
116
|
+
</td>
|
|
117
|
+
</tr>
|
|
118
|
+
</template>
|
|
119
|
+
</tbody>
|
|
120
|
+
</table>
|
|
121
|
+
<div v-if="finalTable.length === 0" class="empty_table">
|
|
122
|
+
<arg-no-data :text="noDataValues[0]" :sub-text="noDataValues[1]" />
|
|
123
|
+
</div>
|
|
124
|
+
<div v-else-if="loadingData" class="empty_table">
|
|
125
|
+
<arg-tekkare-loader v-if="loaderType === 'tekkare'" />
|
|
126
|
+
<arg-data-loader v-else />
|
|
127
|
+
</div>
|
|
128
|
+
<div
|
|
129
|
+
v-if="saveTable.length > savePageSize && finalTable.length > 0"
|
|
130
|
+
:class="`rcd-datas align-${pagesPosition}`"
|
|
131
|
+
>
|
|
132
|
+
<div @click="prevPage" class="rcd-pagination-navigate">
|
|
133
|
+
<arg-icon
|
|
134
|
+
name="CaretLeft"
|
|
135
|
+
color="var(--independance)"
|
|
136
|
+
size="20"
|
|
137
|
+
></arg-icon>
|
|
138
|
+
</div>
|
|
139
|
+
<div
|
|
140
|
+
v-for="(pageNumber, pageIndex) in totalPages"
|
|
141
|
+
:key="pageIndex"
|
|
142
|
+
class="rcd-rows"
|
|
143
|
+
>
|
|
144
|
+
<p v-show="!showPage(pageNumber) && limitB(pageNumber)">...</p>
|
|
145
|
+
<p
|
|
146
|
+
class="rcd-pagination"
|
|
147
|
+
v-show="showPage(pageNumber)"
|
|
148
|
+
@click="setPage(pageNumber)"
|
|
149
|
+
:class="{ 'rcd-current': currentPage === pageNumber }"
|
|
150
|
+
>
|
|
151
|
+
{{ pageNumber }}
|
|
152
|
+
</p>
|
|
153
|
+
<p v-show="!showPage(pageNumber) && limitA(pageNumber)">...</p>
|
|
154
|
+
</div>
|
|
155
|
+
<div @click="nextPage" class="rcd-pagination-navigate">
|
|
156
|
+
<arg-icon
|
|
157
|
+
name="CaretRight"
|
|
158
|
+
color="var(--independance)"
|
|
159
|
+
size="20"
|
|
160
|
+
></arg-icon>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
<div class="show_full_table">
|
|
165
|
+
<arg-btn
|
|
166
|
+
v-if="
|
|
167
|
+
(saveTable.length > savePageSize || showFull) &&
|
|
168
|
+
finalTable.length > 0 &&
|
|
169
|
+
showToggle
|
|
170
|
+
"
|
|
171
|
+
btn-style="skeleton"
|
|
172
|
+
prefix-icon="Table"
|
|
173
|
+
@click.native="showFull = !showFull"
|
|
174
|
+
>{{ showFull ? "Show with pagination" : "Show full table" }}</arg-btn
|
|
175
|
+
>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
</template>
|
|
179
|
+
<script>
|
|
180
|
+
export default {
|
|
181
|
+
name: "argTable"
|
|
182
|
+
};
|
|
183
|
+
</script>
|
|
184
|
+
<script setup lang="ts">
|
|
185
|
+
import argIcon from "./argIcon.vue";
|
|
186
|
+
import argNoData from "./argNoData.vue";
|
|
187
|
+
import argDataLoader from "./argDataLoader.vue";
|
|
188
|
+
import argTekkareLoader from "./argTekkareLoader.vue";
|
|
189
|
+
import { onMounted, ref, computed, defineProps, defineEmits, watch } from "vue";
|
|
190
|
+
const props = defineProps({
|
|
191
|
+
heads: {
|
|
192
|
+
type: Array<string>,
|
|
193
|
+
required: true,
|
|
194
|
+
}, // column values
|
|
195
|
+
contents: {
|
|
196
|
+
type: Array<Object>,
|
|
197
|
+
required: true,
|
|
198
|
+
default: () => [{ values: Array<any> }],
|
|
199
|
+
}, // data values
|
|
200
|
+
pageSize: { type: Number, default: 3 }, // number of rows to be displayed in table
|
|
201
|
+
sort: { type: Boolean, default: true }, // allow for table sorting
|
|
202
|
+
search: { type: Boolean, default: false }, // allow for table filtering by keyword
|
|
203
|
+
searchColumns: { type: Array<number>, default: null },
|
|
204
|
+
columnType: {
|
|
205
|
+
type: Array<string>,
|
|
206
|
+
default: () => [],
|
|
207
|
+
},
|
|
208
|
+
columnStyle: {
|
|
209
|
+
type: Object,
|
|
210
|
+
default() {
|
|
211
|
+
return {};
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
tooltipHeader: {
|
|
215
|
+
type: Array<string>,
|
|
216
|
+
default() {
|
|
217
|
+
return [];
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
searchFullWord: {
|
|
221
|
+
type: Boolean,
|
|
222
|
+
default: false,
|
|
223
|
+
},
|
|
224
|
+
toggleDisplay: {
|
|
225
|
+
type: Boolean,
|
|
226
|
+
default: false,
|
|
227
|
+
},
|
|
228
|
+
pagesPosition: {
|
|
229
|
+
type: String,
|
|
230
|
+
default: "right",
|
|
231
|
+
},
|
|
232
|
+
noDataValues: {
|
|
233
|
+
type: Array,
|
|
234
|
+
default: () => [
|
|
235
|
+
"No content found for your search.",
|
|
236
|
+
"Change or empty your search.",
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
loadingData: {
|
|
240
|
+
type: Boolean,
|
|
241
|
+
default: false,
|
|
242
|
+
},
|
|
243
|
+
loaderType: {
|
|
244
|
+
type: String,
|
|
245
|
+
default: "data",
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
var dataValues = ref();
|
|
250
|
+
var sortCol = ref();
|
|
251
|
+
var sortDir = ref();
|
|
252
|
+
var currentPage = ref();
|
|
253
|
+
var sortIndex = ref();
|
|
254
|
+
var searchIndex = ref();
|
|
255
|
+
var searchKey = ref();
|
|
256
|
+
var showSearch = ref(false);
|
|
257
|
+
var saveTable = ref([]);
|
|
258
|
+
var columnTypeNonProps = ref();
|
|
259
|
+
var searchSubmit = ref(false);
|
|
260
|
+
var showFull = ref(false);
|
|
261
|
+
var savePageSize = ref(0);
|
|
262
|
+
var showToggle = ref(false);
|
|
263
|
+
var showLine = ref();
|
|
264
|
+
|
|
265
|
+
watch(
|
|
266
|
+
() => props.contents,
|
|
267
|
+
(newContent: Object[]) => {
|
|
268
|
+
saveTable.value = Object.assign([], [...new Set(fillTable.value)]);
|
|
269
|
+
dataValues.value = fillTable.value;
|
|
270
|
+
currentPage.value = 1;
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
watch(
|
|
275
|
+
() => props.heads,
|
|
276
|
+
(newHeads: string[]) => {
|
|
277
|
+
getColumnTypes();
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
watch(searchKey, (newSearchKey: string) => {
|
|
282
|
+
setPage(1);
|
|
283
|
+
if (newSearchKey.length === 0) {
|
|
284
|
+
searchSubmit.value = false;
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
watch(showFull, (newShowValue: boolean) => {
|
|
289
|
+
if (newShowValue) {
|
|
290
|
+
savePageSize.value = saveTable.value.length;
|
|
291
|
+
} else savePageSize.value = props.pageSize;
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
watch(
|
|
295
|
+
() => props.toggleDisplay,
|
|
296
|
+
(newToggle: boolean) => {
|
|
297
|
+
showToggle.value = newToggle;
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
watch(
|
|
302
|
+
() => props.pageSize,
|
|
303
|
+
(newPageSize: number) => {
|
|
304
|
+
savePageSize.value = newPageSize;
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
function openLine(index: number) {
|
|
309
|
+
if (showLine.value === index) {
|
|
310
|
+
showLine.value = null;
|
|
311
|
+
} else showLine.value = index;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function getTooltipDir(index: number) {
|
|
315
|
+
if (index === props.heads.length - 1) {
|
|
316
|
+
return "left";
|
|
317
|
+
} else return "bottom";
|
|
318
|
+
}
|
|
319
|
+
function getColumnTypes() {
|
|
320
|
+
if (props.columnType.length <= 1) {
|
|
321
|
+
columnTypeNonProps.value = new Array(props.heads.length);
|
|
322
|
+
columnTypeNonProps.value.fill("", 0);
|
|
323
|
+
} else {
|
|
324
|
+
columnTypeNonProps.value = props.columnType;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function isNA(val: string) {
|
|
328
|
+
// check for null values
|
|
329
|
+
if (val === "-") {
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function sortDatas(index: number) {
|
|
336
|
+
// sort Table - column to sort and sorting order
|
|
337
|
+
if (sortCol.value === props.heads[index]) {
|
|
338
|
+
sortDir.value =
|
|
339
|
+
sortDir.value === "asc"
|
|
340
|
+
? "desc"
|
|
341
|
+
: sortDir.value === "desc"
|
|
342
|
+
? "none"
|
|
343
|
+
: "asc";
|
|
344
|
+
} else {
|
|
345
|
+
sortDir.value = "asc";
|
|
346
|
+
}
|
|
347
|
+
sortCol.value = props.heads[index];
|
|
348
|
+
sortIndex.value = index;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function nextPage() {
|
|
352
|
+
// go to next page
|
|
353
|
+
if (currentPage.value * savePageSize.value < filteredTable.value.length) {
|
|
354
|
+
currentPage.value += 1;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function prevPage() {
|
|
359
|
+
// go to previous page
|
|
360
|
+
if (currentPage.value > 1) {
|
|
361
|
+
currentPage.value -= 1;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function setPage(pageNumber: number) {
|
|
366
|
+
// set current page
|
|
367
|
+
currentPage.value = pageNumber;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function showPage(pageNumber: number) {
|
|
371
|
+
// display or hide page number
|
|
372
|
+
if (
|
|
373
|
+
currentPage.value === pageNumber ||
|
|
374
|
+
pageNumber === totalPages.value ||
|
|
375
|
+
pageNumber === 1 ||
|
|
376
|
+
Math.abs(pageNumber - currentPage.value) < 2 ||
|
|
377
|
+
totalPages.value === 3
|
|
378
|
+
) {
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function limitA(pageNumber: number) {
|
|
385
|
+
// display '...' once instead of page number (after page number)
|
|
386
|
+
if (pageNumber === 2 && currentPage.value >= 4) {
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function limitB(pageNumber: number) {
|
|
393
|
+
// display '...' once instead of page number (before page number)
|
|
394
|
+
if (Math.abs(pageNumber - totalPages.value) > 1) {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function toggle(index: number) {
|
|
401
|
+
// toggle input for searchKey: show/hide on click, show if new column chosen
|
|
402
|
+
if (searchIndex.value === index) {
|
|
403
|
+
showSearch.value = !showSearch.value;
|
|
404
|
+
} else {
|
|
405
|
+
showSearch.value = true;
|
|
406
|
+
searchKey.value = "";
|
|
407
|
+
}
|
|
408
|
+
searchIndex.value = index;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
function viewSearchInput(index: number) {
|
|
412
|
+
// show searchKey input
|
|
413
|
+
if (searchIndex.value === index && showSearch) {
|
|
414
|
+
return true;
|
|
415
|
+
}
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
function changeColorAsc(index: number) {
|
|
420
|
+
// icon color change for asc sorting
|
|
421
|
+
if (sortIndex.value === index && sortDir.value !== "none") {
|
|
422
|
+
if (sortDir.value === "asc") {
|
|
423
|
+
return "var(--accent)";
|
|
424
|
+
}
|
|
425
|
+
return "transparent";
|
|
426
|
+
}
|
|
427
|
+
return "var(--lavendar-grey)";
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function changeColorDesc(index: number) {
|
|
431
|
+
// icon color change for desc sorting
|
|
432
|
+
if (sortIndex.value === index && sortDir.value !== "none") {
|
|
433
|
+
if (sortDir.value === "desc") {
|
|
434
|
+
return "var(--accent)";
|
|
435
|
+
}
|
|
436
|
+
return "transparent";
|
|
437
|
+
}
|
|
438
|
+
return "var(--lavendar-grey)";
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function greyBG(index: number) {
|
|
442
|
+
const myDivObj = document?.getElementById(`${index}-row`);
|
|
443
|
+
if (myDivObj) {
|
|
444
|
+
const color = window?.getComputedStyle(myDivObj).backgroundColor;
|
|
445
|
+
if (color === "rgb(255, 255, 255)") {
|
|
446
|
+
return false;
|
|
447
|
+
} else return true;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function isOdd(contIndex: number) {
|
|
452
|
+
if (contIndex % 2 == 0) {
|
|
453
|
+
return false;
|
|
454
|
+
} else return true;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
var fillTable = computed(() => {
|
|
458
|
+
let row = [];
|
|
459
|
+
const result = [];
|
|
460
|
+
const nullValue = "-";
|
|
461
|
+
for (let i = 0; i < props.contents.length; i += 1) {
|
|
462
|
+
for (let j = 0; j < props.contents[i].values.length; j += 1) {
|
|
463
|
+
if (props.contents[i].values[j] !== null) {
|
|
464
|
+
row.push(props.contents[i].values[j]);
|
|
465
|
+
} else {
|
|
466
|
+
row.push(nullValue);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
result.push(row);
|
|
470
|
+
row = [];
|
|
471
|
+
}
|
|
472
|
+
return result;
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
var filteredTable = computed(() => {
|
|
476
|
+
if (
|
|
477
|
+
(props.searchFullWord && searchSubmit.value === false) ||
|
|
478
|
+
(!props.searchFullWord && searchKey.value.length === 0)
|
|
479
|
+
) {
|
|
480
|
+
return dataValues.value;
|
|
481
|
+
} else {
|
|
482
|
+
const tempTable = [];
|
|
483
|
+
let row = [];
|
|
484
|
+
if (props.searchColumns !== null) {
|
|
485
|
+
for (let i = 0; i < dataValues.value.length; i += 1) {
|
|
486
|
+
let j = 0;
|
|
487
|
+
while (j < props.searchColumns.length) {
|
|
488
|
+
if (
|
|
489
|
+
dataValues.value[i][props.searchColumns[j]]
|
|
490
|
+
.toString()
|
|
491
|
+
.toLowerCase()
|
|
492
|
+
.includes(searchKey.value.toLowerCase())
|
|
493
|
+
) {
|
|
494
|
+
row = dataValues.value[i];
|
|
495
|
+
tempTable.push(row);
|
|
496
|
+
row = [];
|
|
497
|
+
j = props.searchColumns.length;
|
|
498
|
+
} else j += 1;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
} else {
|
|
502
|
+
for (let i = 0; i < dataValues.value.length; i += 1) {
|
|
503
|
+
for (let j = 0; j < dataValues.value[i].length; j++) {
|
|
504
|
+
if (
|
|
505
|
+
dataValues.value[i][j]
|
|
506
|
+
.toString()
|
|
507
|
+
.toLowerCase()
|
|
508
|
+
.includes(searchKey.value.toLowerCase())
|
|
509
|
+
) {
|
|
510
|
+
row = dataValues.value[i];
|
|
511
|
+
tempTable.push(row);
|
|
512
|
+
row = [];
|
|
513
|
+
j = dataValues.value[i].length;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return tempTable;
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
const sortedTable = computed(() => {
|
|
523
|
+
// sort table depending on selected order: asc/desc
|
|
524
|
+
const sorted = filteredTable.value;
|
|
525
|
+
if (sortDir.value === "none") {
|
|
526
|
+
return sorted;
|
|
527
|
+
}
|
|
528
|
+
return sorted.sort((a: any, b: any) => {
|
|
529
|
+
if (sortDir.value === "asc") {
|
|
530
|
+
if (a[sortIndex.value] < b[sortIndex.value]) {
|
|
531
|
+
if (navigator.userAgent.indexOf("Firefox") !== -1) {
|
|
532
|
+
return 1;
|
|
533
|
+
} else {
|
|
534
|
+
return -1;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
if (sortDir.value === "desc") {
|
|
539
|
+
if (a[sortIndex.value] > b[sortIndex.value]) {
|
|
540
|
+
if (navigator.userAgent.indexOf("Firefox") !== -1) {
|
|
541
|
+
return 1;
|
|
542
|
+
} else {
|
|
543
|
+
return -1;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return 0;
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
var finalTable = computed(() => {
|
|
552
|
+
const sorted = sortedTable;
|
|
553
|
+
// final data sorted by order, filtered by keyword and displayed according to page size
|
|
554
|
+
return sorted.value.filter((row: any, index: number) => {
|
|
555
|
+
const start = (currentPage.value - 1) * savePageSize.value;
|
|
556
|
+
const end = currentPage.value * savePageSize.value;
|
|
557
|
+
if (index >= start && index < end) return true;
|
|
558
|
+
return false;
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
var resultCount = computed(() => {
|
|
563
|
+
// total data length
|
|
564
|
+
return sortedTable.value.length;
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
var totalPages = computed(() => {
|
|
568
|
+
// total number of pages for table depending on length and page size
|
|
569
|
+
return Math.ceil(resultCount.value / savePageSize.value);
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
var getPlaceHolder = computed(() => {
|
|
573
|
+
if (props.searchColumns !== null) {
|
|
574
|
+
let columnNames = `Search by ${props.heads[props.searchColumns[0]]}`;
|
|
575
|
+
for (let i = 1; i < props.searchColumns.length; i++) {
|
|
576
|
+
if (i === props.searchColumns.length - 1) {
|
|
577
|
+
columnNames += ` or ${props.heads[props.searchColumns[i]]}...`;
|
|
578
|
+
} else columnNames += `, ${props.heads[props.searchColumns[i]]}`;
|
|
579
|
+
}
|
|
580
|
+
return columnNames;
|
|
581
|
+
} else return "Search all";
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
getColumnTypes();
|
|
585
|
+
dataValues.value = fillTable.value;
|
|
586
|
+
saveTable.value = Object.assign(
|
|
587
|
+
[],
|
|
588
|
+
[...new Set(fillTable.value)] // eslint-disable-line
|
|
589
|
+
);
|
|
590
|
+
sortDir.value = "none";
|
|
591
|
+
currentPage.value = 1;
|
|
592
|
+
sortIndex.value = null;
|
|
593
|
+
searchKey.value = "";
|
|
594
|
+
showSearch.value = false;
|
|
595
|
+
searchIndex.value = null;
|
|
596
|
+
|
|
597
|
+
savePageSize.value = props.pageSize;
|
|
598
|
+
showToggle.value = props.toggleDisplay;
|
|
599
|
+
</script>
|
|
600
|
+
|
|
601
|
+
<style scoped>
|
|
602
|
+
.empty_table {
|
|
603
|
+
width: 100%;
|
|
604
|
+
display: flex;
|
|
605
|
+
align-items: center;
|
|
606
|
+
justify-content: center;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
.filter_tooltip {
|
|
610
|
+
cursor: pointer;
|
|
611
|
+
}
|
|
612
|
+
.sort_up_icon {
|
|
613
|
+
position: relative;
|
|
614
|
+
top: 3px;
|
|
615
|
+
}
|
|
616
|
+
.sort_down_icon {
|
|
617
|
+
position: relative;
|
|
618
|
+
top: -2px;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.table_input {
|
|
622
|
+
width: auto !important;
|
|
623
|
+
align-self: stretch !important;
|
|
624
|
+
margin: 0px 24px !important;
|
|
625
|
+
}
|
|
626
|
+
.oip_column {
|
|
627
|
+
display: table-cell;
|
|
628
|
+
padding-left: 0px;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.rcd_scrollTable {
|
|
632
|
+
overflow-x: auto;
|
|
633
|
+
gap: 8px;
|
|
634
|
+
padding-top: 8px;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
td {
|
|
638
|
+
font-size: 14px;
|
|
639
|
+
}
|
|
640
|
+
tr {
|
|
641
|
+
position: relative;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
table {
|
|
645
|
+
width: 100%;
|
|
646
|
+
padding: 0px;
|
|
647
|
+
border-collapse: collapse;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
thead tr th {
|
|
651
|
+
background-color: transparent;
|
|
652
|
+
height: 35px;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/* .simple_row:nth-of-type(even) {
|
|
656
|
+
background: var(--pure-white);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.simple_row:nth-of-type(odd) {
|
|
660
|
+
background: var(--demi-fond);
|
|
661
|
+
} */
|
|
662
|
+
|
|
663
|
+
td,
|
|
664
|
+
th {
|
|
665
|
+
padding: 10px 24px;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
tr,
|
|
669
|
+
th {
|
|
670
|
+
height: 43px;
|
|
671
|
+
text-align: start;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
th {
|
|
675
|
+
font-weight: 700;
|
|
676
|
+
font-size: 12px;
|
|
677
|
+
line-height: 14px;
|
|
678
|
+
order: 0;
|
|
679
|
+
flex-grow: 0;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
th:last-child div.rcd-table-header,
|
|
683
|
+
td:last-child {
|
|
684
|
+
text-align: end;
|
|
685
|
+
justify-content: end;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
th:last-child div.show .rcd-searchInput {
|
|
689
|
+
margin-left: auto;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.rcd-table-header {
|
|
693
|
+
margin-left: 24px;
|
|
694
|
+
display: flex;
|
|
695
|
+
flex-direction: row;
|
|
696
|
+
align-items: center;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
.rcd-col-title {
|
|
700
|
+
display: flex;
|
|
701
|
+
justify-content: center;
|
|
702
|
+
align-items: center;
|
|
703
|
+
gap: 4px;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
.rcd-table-sort {
|
|
707
|
+
display: flex;
|
|
708
|
+
flex-direction: column;
|
|
709
|
+
justify-content: center;
|
|
710
|
+
cursor: pointer;
|
|
711
|
+
text-align-last: right;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
.rcd-NA {
|
|
715
|
+
color: var(--independance);
|
|
716
|
+
font-weight: normal;
|
|
717
|
+
font-style: italic;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
.rcd-pagination {
|
|
721
|
+
display: flex;
|
|
722
|
+
padding: 10px 16px;
|
|
723
|
+
justify-content: center;
|
|
724
|
+
align-items: center;
|
|
725
|
+
gap: 10px;
|
|
726
|
+
cursor: pointer;
|
|
727
|
+
border-radius: 8px;
|
|
728
|
+
background: transparent;
|
|
729
|
+
font-size: 14px;
|
|
730
|
+
font-style: normal;
|
|
731
|
+
font-weight: 700;
|
|
732
|
+
line-height: normal;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
.rcd-pagination:hover {
|
|
736
|
+
color: var(--primary) !important;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.rcd-pagination-navigate {
|
|
740
|
+
cursor: pointer;
|
|
741
|
+
}
|
|
742
|
+
.rcd-pagination-navigate:hover svg {
|
|
743
|
+
color: var(--primary) !important;
|
|
744
|
+
}
|
|
745
|
+
.rcd-current:hover {
|
|
746
|
+
color: var(--pure-white) !important;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
.rcd-datas {
|
|
750
|
+
display: flex;
|
|
751
|
+
align-items: center;
|
|
752
|
+
margin: 10px 10px 15px 10px;
|
|
753
|
+
gap: 10px;
|
|
754
|
+
}
|
|
755
|
+
.align-left {
|
|
756
|
+
justify-content: left;
|
|
757
|
+
}
|
|
758
|
+
.align-center {
|
|
759
|
+
justify-content: center;
|
|
760
|
+
}
|
|
761
|
+
.align-right {
|
|
762
|
+
justify-content: right;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.rcd-rows {
|
|
766
|
+
display: flex;
|
|
767
|
+
justify-content: right;
|
|
768
|
+
align-items: center;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
.rcd-current {
|
|
772
|
+
background: var(--primary);
|
|
773
|
+
color: var(--pure-white);
|
|
774
|
+
box-shadow: 4px 7px 12px 0px rgba(33, 118, 255, 0.2);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
.rcd-searchInput {
|
|
778
|
+
border: 1px solid var(--nested-table-bg);
|
|
779
|
+
border-radius: 4px;
|
|
780
|
+
margin: 0px 5px 5px 0px;
|
|
781
|
+
padding: 3px;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
.rcd-searchInput:focus-visible {
|
|
785
|
+
outline: none !important;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
.hideInput {
|
|
789
|
+
display: none;
|
|
790
|
+
visibility: hidden;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
.showInput {
|
|
794
|
+
display: flex;
|
|
795
|
+
visibility: visible;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
.rcd-search {
|
|
799
|
+
cursor: pointer;
|
|
800
|
+
margin-right: 5px;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
.column_align.left {
|
|
804
|
+
text-align: left !important;
|
|
805
|
+
justify-content: left !important;
|
|
806
|
+
}
|
|
807
|
+
.column_align.center {
|
|
808
|
+
text-align: center !important;
|
|
809
|
+
justify-content: center !important;
|
|
810
|
+
}
|
|
811
|
+
.column_align.right {
|
|
812
|
+
text-align: right !important;
|
|
813
|
+
justify-content: right !important;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
.show_full_table {
|
|
817
|
+
width: 100%;
|
|
818
|
+
display: flex;
|
|
819
|
+
align-items: center;
|
|
820
|
+
justify-content: center;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
.flex-table {
|
|
824
|
+
display: flex;
|
|
825
|
+
flex-direction: column;
|
|
826
|
+
align-items: flex-start;
|
|
827
|
+
gap: 12px;
|
|
828
|
+
width: 100%;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
.rcd_scrollTable {
|
|
832
|
+
width: 100%;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
.more_section {
|
|
836
|
+
width: 100%;
|
|
837
|
+
padding: 24px;
|
|
838
|
+
text-align: start !important;
|
|
839
|
+
}
|
|
840
|
+
.more_row {
|
|
841
|
+
border-top: 1px solid var(--dividers, #ececf2);
|
|
842
|
+
border-bottom: 1px solid var(--dividers, #ececf2);
|
|
843
|
+
}
|
|
844
|
+
.grey_bg,
|
|
845
|
+
.grey_bg > td {
|
|
846
|
+
background: var(--demi-fond) !important;
|
|
847
|
+
}
|
|
848
|
+
.white_bg,
|
|
849
|
+
.white_bg td {
|
|
850
|
+
background: var(--pure-white) !important;
|
|
851
|
+
}
|
|
852
|
+
.icon-show-more {
|
|
853
|
+
cursor: pointer;
|
|
854
|
+
transition: transform 0.3s;
|
|
855
|
+
}
|
|
856
|
+
.icon-show-more:hover {
|
|
857
|
+
color: var(--primary) !important;
|
|
858
|
+
}
|
|
859
|
+
.icon_rotate {
|
|
860
|
+
transform: rotate(90deg);
|
|
861
|
+
color: var(--primary) !important;
|
|
862
|
+
}
|
|
863
|
+
</style>
|