@tekkare/auriga 0.1.0 → 0.1.3
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/dist/module.json +1 -1
- package/dist/runtime/components/argAdvancedSearchBar.vue +318 -321
- package/dist/runtime/components/argAdvancedSearchBar.vue.d.ts +89 -3
- package/dist/runtime/components/argBtn.vue +48 -39
- package/dist/runtime/components/argBtn.vue.d.ts +72 -3
- package/dist/runtime/components/argComplexSelect.vue +255 -256
- package/dist/runtime/components/argComplexSelect.vue.d.ts +175 -3
- package/dist/runtime/components/argDataLoader.vue +8 -3
- package/dist/runtime/components/argDataLoader.vue.d.ts +1 -3
- package/dist/runtime/components/argDropdownSelect.vue +145 -138
- package/dist/runtime/components/argDropdownSelect.vue.d.ts +139 -3
- package/dist/runtime/components/argFileBtn.vue +58 -56
- package/dist/runtime/components/argFileBtn.vue.d.ts +60 -3
- package/dist/runtime/components/argHeaderTabs.vue +94 -101
- package/dist/runtime/components/argHeaderTabs.vue.d.ts +30 -3
- package/dist/runtime/components/argIcon.vue +2136 -3117
- package/dist/runtime/components/argIcon.vue.d.ts +1110 -2
- package/dist/runtime/components/argMultipleChoice.vue +84 -78
- package/dist/runtime/components/argMultipleChoice.vue.d.ts +49 -3
- package/dist/runtime/components/argNoData.vue +28 -25
- package/dist/runtime/components/argNoData.vue.d.ts +26 -3
- package/dist/runtime/components/argSearchInput.vue +38 -37
- package/dist/runtime/components/argSearchInput.vue.d.ts +30 -3
- package/dist/runtime/components/argSimpleLabel.vue +13 -11
- package/dist/runtime/components/argSimpleLabel.vue.d.ts +13 -3
- package/dist/runtime/components/argStyle.vue +8 -3
- package/dist/runtime/components/argStyle.vue.d.ts +1 -3
- package/dist/runtime/components/argTable.vue +384 -395
- package/dist/runtime/components/argTable.vue.d.ts +337 -3
- package/dist/runtime/components/argTags.vue +20 -10
- package/dist/runtime/components/argTags.vue.d.ts +26 -3
- package/dist/runtime/components/argTekkareLoader.vue +5 -2
- package/dist/runtime/components/argTekkareLoader.vue.d.ts +1 -3
- package/dist/runtime/components/argTooltip.vue +11 -11
- package/dist/runtime/components/argTooltip.vue.d.ts +39 -3
- package/package.json +5 -2
|
@@ -176,426 +176,415 @@
|
|
|
176
176
|
</div>
|
|
177
177
|
</div>
|
|
178
178
|
</template>
|
|
179
|
+
|
|
179
180
|
<script>
|
|
180
|
-
export default {
|
|
181
|
-
name: "argTable"
|
|
182
|
-
};
|
|
183
|
-
</script>
|
|
184
|
-
<script setup lang="ts">
|
|
185
181
|
import argIcon from "./argIcon.vue";
|
|
186
182
|
import argNoData from "./argNoData.vue";
|
|
187
183
|
import argDataLoader from "./argDataLoader.vue";
|
|
188
184
|
import argTekkareLoader from "./argTekkareLoader.vue";
|
|
189
|
-
import {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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 {};
|
|
185
|
+
import {
|
|
186
|
+
ref,
|
|
187
|
+
computed,
|
|
188
|
+
watch,
|
|
189
|
+
defineComponent
|
|
190
|
+
} from "vue";
|
|
191
|
+
export default defineComponent({
|
|
192
|
+
name: "argTable",
|
|
193
|
+
components: { argIcon, argNoData, argDataLoader, argTekkareLoader },
|
|
194
|
+
props: {
|
|
195
|
+
heads: {
|
|
196
|
+
type: Array,
|
|
197
|
+
required: true
|
|
212
198
|
},
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
199
|
+
// column values
|
|
200
|
+
contents: {
|
|
201
|
+
type: Array,
|
|
202
|
+
required: true,
|
|
203
|
+
default: () => [{ values: Array }]
|
|
218
204
|
},
|
|
205
|
+
// data values
|
|
206
|
+
pageSize: { type: Number, default: 3 },
|
|
207
|
+
// number of rows to be displayed in table
|
|
208
|
+
sort: { type: Boolean, default: true },
|
|
209
|
+
// allow for table sorting
|
|
210
|
+
search: { type: Boolean, default: false },
|
|
211
|
+
// allow for table filtering by keyword
|
|
212
|
+
searchColumns: { type: Array, default: null },
|
|
213
|
+
columnType: {
|
|
214
|
+
type: Array,
|
|
215
|
+
default: () => []
|
|
216
|
+
},
|
|
217
|
+
columnStyle: {
|
|
218
|
+
type: Object,
|
|
219
|
+
default() {
|
|
220
|
+
return {};
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
tooltipHeader: {
|
|
224
|
+
type: Array,
|
|
225
|
+
default() {
|
|
226
|
+
return [];
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
searchFullWord: {
|
|
230
|
+
type: Boolean,
|
|
231
|
+
default: false
|
|
232
|
+
},
|
|
233
|
+
toggleDisplay: {
|
|
234
|
+
type: Boolean,
|
|
235
|
+
default: false
|
|
236
|
+
},
|
|
237
|
+
pagesPosition: {
|
|
238
|
+
type: String,
|
|
239
|
+
default: "right"
|
|
240
|
+
},
|
|
241
|
+
noDataValues: {
|
|
242
|
+
type: Array,
|
|
243
|
+
default: () => [
|
|
244
|
+
"No content found for your search.",
|
|
245
|
+
"Change or empty your search."
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
loadingData: {
|
|
249
|
+
type: Boolean,
|
|
250
|
+
default: false
|
|
251
|
+
},
|
|
252
|
+
loaderType: {
|
|
253
|
+
type: String,
|
|
254
|
+
default: "data"
|
|
255
|
+
}
|
|
219
256
|
},
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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)";
|
|
257
|
+
setup(props) {
|
|
258
|
+
const dataValues = ref();
|
|
259
|
+
const sortCol = ref();
|
|
260
|
+
const sortDir = ref();
|
|
261
|
+
const currentPage = ref();
|
|
262
|
+
const sortIndex = ref();
|
|
263
|
+
const searchIndex = ref();
|
|
264
|
+
const searchKey = ref();
|
|
265
|
+
const showSearch = ref(false);
|
|
266
|
+
const saveTable = ref([]);
|
|
267
|
+
const columnTypeNonProps = ref();
|
|
268
|
+
const searchSubmit = ref(false);
|
|
269
|
+
const showFull = ref(false);
|
|
270
|
+
const savePageSize = ref(0);
|
|
271
|
+
const showToggle = ref(false);
|
|
272
|
+
const showLine = ref();
|
|
273
|
+
watch(
|
|
274
|
+
() => props.contents,
|
|
275
|
+
(newContent) => {
|
|
276
|
+
saveTable.value = Object.assign([], [...new Set(fillTable.value)]);
|
|
277
|
+
dataValues.value = fillTable.value;
|
|
278
|
+
currentPage.value = 1;
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
watch(
|
|
282
|
+
() => props.heads,
|
|
283
|
+
(newHeads) => {
|
|
284
|
+
getColumnTypes();
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
watch(searchKey, (newSearchKey) => {
|
|
288
|
+
setPage(1);
|
|
289
|
+
if (newSearchKey.length === 0) {
|
|
290
|
+
searchSubmit.value = false;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
watch(showFull, (newShowValue) => {
|
|
294
|
+
if (newShowValue) {
|
|
295
|
+
savePageSize.value = saveTable.value.length;
|
|
296
|
+
} else
|
|
297
|
+
savePageSize.value = props.pageSize;
|
|
298
|
+
});
|
|
299
|
+
watch(
|
|
300
|
+
() => props.toggleDisplay,
|
|
301
|
+
(newToggle) => {
|
|
302
|
+
showToggle.value = newToggle;
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
watch(
|
|
306
|
+
() => props.pageSize,
|
|
307
|
+
(newPageSize) => {
|
|
308
|
+
savePageSize.value = newPageSize;
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
function openLine(index) {
|
|
312
|
+
if (showLine.value === index) {
|
|
313
|
+
showLine.value = null;
|
|
314
|
+
} else
|
|
315
|
+
showLine.value = index;
|
|
424
316
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
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)";
|
|
317
|
+
function getTooltipDir(index) {
|
|
318
|
+
if (index === props.heads.length - 1) {
|
|
319
|
+
return "left";
|
|
320
|
+
} else
|
|
321
|
+
return "bottom";
|
|
435
322
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
323
|
+
function getColumnTypes() {
|
|
324
|
+
if (props.columnType.length <= 1) {
|
|
325
|
+
columnTypeNonProps.value = new Array(props.heads.length);
|
|
326
|
+
columnTypeNonProps.value.fill("", 0);
|
|
327
|
+
} else {
|
|
328
|
+
columnTypeNonProps.value = props.columnType;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function isNA(val) {
|
|
332
|
+
if (val === "-") {
|
|
333
|
+
return true;
|
|
334
|
+
}
|
|
446
335
|
return false;
|
|
447
|
-
}
|
|
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]);
|
|
336
|
+
}
|
|
337
|
+
function sortDatas(index) {
|
|
338
|
+
if (sortCol.value === props.heads[index]) {
|
|
339
|
+
sortDir.value = sortDir.value === "asc" ? "desc" : sortDir.value === "desc" ? "none" : "asc";
|
|
465
340
|
} else {
|
|
466
|
-
|
|
341
|
+
sortDir.value = "asc";
|
|
467
342
|
}
|
|
343
|
+
sortCol.value = props.heads[index];
|
|
344
|
+
sortIndex.value = index;
|
|
468
345
|
}
|
|
469
|
-
|
|
470
|
-
|
|
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
|
-
}
|
|
346
|
+
function nextPage() {
|
|
347
|
+
if (currentPage.value * savePageSize.value < filteredTable.value.length) {
|
|
348
|
+
currentPage.value += 1;
|
|
500
349
|
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
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
|
-
}
|
|
350
|
+
}
|
|
351
|
+
function prevPage() {
|
|
352
|
+
if (currentPage.value > 1) {
|
|
353
|
+
currentPage.value -= 1;
|
|
516
354
|
}
|
|
517
355
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
356
|
+
function setPage(pageNumber) {
|
|
357
|
+
currentPage.value = pageNumber;
|
|
358
|
+
}
|
|
359
|
+
function showPage(pageNumber) {
|
|
360
|
+
if (currentPage.value === pageNumber || pageNumber === totalPages.value || pageNumber === 1 || Math.abs(pageNumber - currentPage.value) < 2 || totalPages.value === 3) {
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
function limitA(pageNumber) {
|
|
366
|
+
if (pageNumber === 2 && currentPage.value >= 4) {
|
|
367
|
+
return true;
|
|
368
|
+
}
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
function limitB(pageNumber) {
|
|
372
|
+
if (Math.abs(pageNumber - totalPages.value) > 1) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
function toggle(index) {
|
|
378
|
+
if (searchIndex.value === index) {
|
|
379
|
+
showSearch.value = !showSearch.value;
|
|
380
|
+
} else {
|
|
381
|
+
showSearch.value = true;
|
|
382
|
+
searchKey.value = "";
|
|
383
|
+
}
|
|
384
|
+
searchIndex.value = index;
|
|
385
|
+
}
|
|
386
|
+
function viewSearchInput(index) {
|
|
387
|
+
if (searchIndex.value === index && showSearch) {
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
function changeColorAsc(index) {
|
|
393
|
+
if (sortIndex.value === index && sortDir.value !== "none") {
|
|
394
|
+
if (sortDir.value === "asc") {
|
|
395
|
+
return "var(--accent)";
|
|
535
396
|
}
|
|
397
|
+
return "transparent";
|
|
536
398
|
}
|
|
399
|
+
return "var(--lavendar-grey)";
|
|
537
400
|
}
|
|
538
|
-
|
|
539
|
-
if (
|
|
540
|
-
if (
|
|
541
|
-
return
|
|
542
|
-
} else {
|
|
543
|
-
return -1;
|
|
401
|
+
function changeColorDesc(index) {
|
|
402
|
+
if (sortIndex.value === index && sortDir.value !== "none") {
|
|
403
|
+
if (sortDir.value === "desc") {
|
|
404
|
+
return "var(--accent)";
|
|
544
405
|
}
|
|
406
|
+
return "transparent";
|
|
545
407
|
}
|
|
408
|
+
return "var(--lavendar-grey)";
|
|
546
409
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
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]]}`;
|
|
410
|
+
function greyBG(index) {
|
|
411
|
+
const myDivObj = document?.getElementById(`${index}-row`);
|
|
412
|
+
if (myDivObj) {
|
|
413
|
+
const color = window?.getComputedStyle(myDivObj).backgroundColor;
|
|
414
|
+
if (color === "rgb(255, 255, 255)") {
|
|
415
|
+
return false;
|
|
416
|
+
} else
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function isOdd(contIndex) {
|
|
421
|
+
if (contIndex % 2 == 0) {
|
|
422
|
+
return false;
|
|
423
|
+
} else
|
|
424
|
+
return true;
|
|
579
425
|
}
|
|
580
|
-
|
|
581
|
-
|
|
426
|
+
const fillTable = computed(() => {
|
|
427
|
+
let row = [];
|
|
428
|
+
const result = [];
|
|
429
|
+
const nullValue = "-";
|
|
430
|
+
for (let i = 0; i < props.contents.length; i += 1) {
|
|
431
|
+
for (let j = 0; j < props.contents[i].values.length; j += 1) {
|
|
432
|
+
if (props.contents[i].values[j] !== null) {
|
|
433
|
+
row.push(props.contents[i].values[j]);
|
|
434
|
+
} else {
|
|
435
|
+
row.push(nullValue);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
result.push(row);
|
|
439
|
+
row = [];
|
|
440
|
+
}
|
|
441
|
+
return result;
|
|
442
|
+
});
|
|
443
|
+
const filteredTable = computed(() => {
|
|
444
|
+
if (props.searchFullWord && searchSubmit.value === false || !props.searchFullWord && searchKey.value.length === 0) {
|
|
445
|
+
return dataValues.value;
|
|
446
|
+
} else {
|
|
447
|
+
const tempTable = [];
|
|
448
|
+
let row = [];
|
|
449
|
+
if (props.searchColumns !== null) {
|
|
450
|
+
for (let i = 0; i < dataValues.value.length; i += 1) {
|
|
451
|
+
let j = 0;
|
|
452
|
+
while (j < props.searchColumns.length) {
|
|
453
|
+
if (dataValues.value[i][props.searchColumns[j]].toString().toLowerCase().includes(searchKey.value.toLowerCase())) {
|
|
454
|
+
row = dataValues.value[i];
|
|
455
|
+
tempTable.push(row);
|
|
456
|
+
row = [];
|
|
457
|
+
j = props.searchColumns.length;
|
|
458
|
+
} else
|
|
459
|
+
j += 1;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
} else {
|
|
463
|
+
for (let i = 0; i < dataValues.value.length; i += 1) {
|
|
464
|
+
for (let j = 0; j < dataValues.value[i].length; j++) {
|
|
465
|
+
if (dataValues.value[i][j].toString().toLowerCase().includes(searchKey.value.toLowerCase())) {
|
|
466
|
+
row = dataValues.value[i];
|
|
467
|
+
tempTable.push(row);
|
|
468
|
+
row = [];
|
|
469
|
+
j = dataValues.value[i].length;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return tempTable;
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
const sortedTable = computed(() => {
|
|
478
|
+
const sorted = filteredTable.value;
|
|
479
|
+
if (sortDir.value === "none") {
|
|
480
|
+
return sorted;
|
|
481
|
+
}
|
|
482
|
+
return sorted.sort((a, b) => {
|
|
483
|
+
if (sortDir.value === "asc") {
|
|
484
|
+
if (a[sortIndex.value] < b[sortIndex.value]) {
|
|
485
|
+
if (navigator.userAgent.indexOf("Firefox") !== -1) {
|
|
486
|
+
return 1;
|
|
487
|
+
} else {
|
|
488
|
+
return -1;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
if (sortDir.value === "desc") {
|
|
493
|
+
if (a[sortIndex.value] > b[sortIndex.value]) {
|
|
494
|
+
if (navigator.userAgent.indexOf("Firefox") !== -1) {
|
|
495
|
+
return 1;
|
|
496
|
+
} else {
|
|
497
|
+
return -1;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return 0;
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
const finalTable = computed(() => {
|
|
505
|
+
const sorted = sortedTable;
|
|
506
|
+
return sorted.value.filter((row, index) => {
|
|
507
|
+
const start = (currentPage.value - 1) * savePageSize.value;
|
|
508
|
+
const end = currentPage.value * savePageSize.value;
|
|
509
|
+
if (index >= start && index < end)
|
|
510
|
+
return true;
|
|
511
|
+
return false;
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
const resultCount = computed(() => {
|
|
515
|
+
return sortedTable.value.length;
|
|
516
|
+
});
|
|
517
|
+
const totalPages = computed(() => {
|
|
518
|
+
return Math.ceil(resultCount.value / savePageSize.value);
|
|
519
|
+
});
|
|
520
|
+
const getPlaceHolder = computed(() => {
|
|
521
|
+
if (props.searchColumns !== null) {
|
|
522
|
+
let columnNames = `Search by ${props.heads[props.searchColumns[0]]}`;
|
|
523
|
+
for (let i = 1; i < props.searchColumns.length; i++) {
|
|
524
|
+
if (i === props.searchColumns.length - 1) {
|
|
525
|
+
columnNames += ` or ${props.heads[props.searchColumns[i]]}...`;
|
|
526
|
+
} else
|
|
527
|
+
columnNames += `, ${props.heads[props.searchColumns[i]]}`;
|
|
528
|
+
}
|
|
529
|
+
return columnNames;
|
|
530
|
+
} else
|
|
531
|
+
return "Search all";
|
|
532
|
+
});
|
|
533
|
+
getColumnTypes();
|
|
534
|
+
dataValues.value = fillTable.value;
|
|
535
|
+
saveTable.value = Object.assign(
|
|
536
|
+
[],
|
|
537
|
+
[...new Set(fillTable.value)]
|
|
538
|
+
// eslint-disable-line
|
|
539
|
+
);
|
|
540
|
+
sortDir.value = "none";
|
|
541
|
+
currentPage.value = 1;
|
|
542
|
+
sortIndex.value = null;
|
|
543
|
+
searchKey.value = "";
|
|
544
|
+
showSearch.value = false;
|
|
545
|
+
searchIndex.value = null;
|
|
546
|
+
savePageSize.value = props.pageSize;
|
|
547
|
+
showToggle.value = props.toggleDisplay;
|
|
548
|
+
return {
|
|
549
|
+
sortCol,
|
|
550
|
+
sortDir,
|
|
551
|
+
currentPage,
|
|
552
|
+
sortIndex,
|
|
553
|
+
searchIndex,
|
|
554
|
+
searchKey,
|
|
555
|
+
showSearch,
|
|
556
|
+
saveTable,
|
|
557
|
+
columnTypeNonProps,
|
|
558
|
+
searchSubmit,
|
|
559
|
+
showFull,
|
|
560
|
+
savePageSize,
|
|
561
|
+
showToggle,
|
|
562
|
+
showLine,
|
|
563
|
+
openLine,
|
|
564
|
+
getTooltipDir,
|
|
565
|
+
getColumnTypes,
|
|
566
|
+
isNA,
|
|
567
|
+
sortDatas,
|
|
568
|
+
nextPage,
|
|
569
|
+
prevPage,
|
|
570
|
+
setPage,
|
|
571
|
+
showPage,
|
|
572
|
+
limitA,
|
|
573
|
+
limitB,
|
|
574
|
+
toggle,
|
|
575
|
+
viewSearchInput,
|
|
576
|
+
changeColorAsc,
|
|
577
|
+
changeColorDesc,
|
|
578
|
+
greyBG,
|
|
579
|
+
isOdd,
|
|
580
|
+
fillTable,
|
|
581
|
+
finalTable,
|
|
582
|
+
resultCount,
|
|
583
|
+
totalPages,
|
|
584
|
+
getPlaceHolder
|
|
585
|
+
};
|
|
586
|
+
}
|
|
582
587
|
});
|
|
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
588
|
</script>
|
|
600
589
|
|
|
601
590
|
<style scoped>
|