11<template >
2- <div
3- class =" text-error-10 tw-rounded-md tw-bg-error-90 tw-p-2 dark:tw-bg-error-30 dark:tw-text-error-90"
4- >
5- {{ $t('temp') }}
6- </div >
7- <!-- <transition-group name="table-columns" class="tw-list-none !tw-pl-0" tag="ul">
8- <li
9- class="tw-flex tw-items-center tw-gap-1"
10- v-for="(column, index) in columns"
11- :key="column.field"
2+ <div >
3+ <h3 class =" tw-text-xs tw-font-medium tw-leading-4" >{{ $t('visible') }}</h3 >
4+ <draggable
5+ v-model =" visibleColumns"
6+ group =" tableColumns"
7+ draggable =" .tableColumns"
8+ class =" tw-mt-2 tw-space-y-2"
129 >
13- <TwStandardIconButton
14- @click="toggleVisiblity(column.field, !column.visible)"
15- :color="column.visible && 'primary'"
10+ <div
11+ v-for =" column in visibleColumns"
12+ :key =" column"
13+ class =" tableColumns tw-flex tw-h-8 tw-items-center tw-gap-x-2 tw-rounded-lg tw-bg-neutralVariant-90 tw-pr-4 tw-pl-2 tw-text-sm tw-text-neutralVariant-30 dark:tw-bg-neutralVariant-30 dark:tw-text-neutralVariant-80"
1614 >
17- <TwIcon :path="column.visible ? mdiEyeOutline : mdiEyeOffOutline" />
18- </TwStandardIconButton>
19- <span
20- :class="[
21- column.visible
22- ? 'tw-font-medium'
23- : 'tw-text-neutralVariant-30 dark:tw-text-neutral-80',
24- ]"
15+ <TwIcon
16+ :path =" mdiReorderHorizontal"
17+ class =" !tw-h-[1.125rem] !tw-w-[1.125rem]"
18+ />
19+ <span >{{ $t(`properties.${column}`) }}</span >
20+ </div >
21+ <div
22+ v-if =" !visibleColumns.length"
23+ class =" tw-flex tw-items-center tw-justify-center tw-rounded-xl tw-border tw-border-dashed tw-border-neutralVariant-50 tw-px-4 tw-py-4 dark:tw-border-neutralVariant-60"
2524 >
26- {{ $t(`properties.${column.field}`) }}
27- </span>
28- <div class="tw-grow"></div>
29- <TwStandardIconButton
30- @click="changeOrder(column.field, true)"
31- :disabled="index === 0"
25+ {{ $t('dropHereVisible') }}
26+ </div >
27+ </draggable >
28+ <!-- TODO: Convert chip to component with hover effect -->
29+ <button
30+ v-if =" visibleColumns.length !== availableColumns.length"
31+ class =" tw-mt-2 tw-flex tw-h-8 tw-items-center tw-gap-x-2 tw-rounded-lg tw-border tw-border-solid tw-border-neutralVariant-50 tw-pr-4 tw-pl-2 tw-text-sm tw-leading-8 dark:tw-border-neutralVariant-60"
32+ @click =" addAll"
33+ >
34+ <TwIcon
35+ :path =" mdiTableColumnPlusAfter"
36+ class =" !tw-h-[1.125rem] !tw-w-[1.125rem]"
37+ />
38+ <span >{{ $t('addAll') }}</span >
39+ </button >
40+ <h3 class =" tw-mt-4 tw-text-xs tw-font-medium tw-leading-4" >
41+ {{ $t('hidden') }}
42+ </h3 >
43+ <draggable
44+ v-model =" hiddenColumns"
45+ group =" tableColumns"
46+ class =" tw-mt-2 tw-space-y-2"
47+ draggable =" .tableColumns"
48+ >
49+ <div
50+ v-for =" column in hiddenColumns"
51+ :key =" column"
52+ class =" tableColumns tw-flex tw-h-8 tw-items-center tw-gap-x-2 tw-rounded-lg tw-bg-neutralVariant-90 tw-pr-4 tw-pl-2 tw-text-sm tw-text-neutralVariant-30 dark:tw-bg-neutralVariant-30 dark:tw-text-neutralVariant-80"
3253 >
33- <TwIcon :path="mdiArrowUp" />
34- </TwStandardIconButton>
35- <TwStandardIconButton
36- @click="changeOrder(column.field, false)"
37- :disabled="index + 1 === columns.length"
54+ <TwIcon
55+ :path =" mdiReorderHorizontal"
56+ class =" !tw-h-[1.125rem] !tw-w-[1.125rem]"
57+ />
58+ <span >{{ $t(`properties.${column}`) }}</span >
59+ </div >
60+ <div
61+ v-if =" !hiddenColumns.length"
62+ slot =" header"
63+ class =" tw-flex tw-items-center tw-justify-center tw-rounded-xl tw-border tw-border-dashed tw-border-neutralVariant-50 tw-px-4 tw-py-4 dark:tw-border-neutralVariant-60"
3864 >
39- <TwIcon :path="mdiArrowDown" />
40- </TwStandardIconButton >
41- </li >
42- </transition-group> -- >
65+ {{ $t('dropHereHidden') }}
66+ </div >
67+ </draggable >
68+ </div >
4369</template >
4470
4571<script >
46- import {
47- mdiEyeOutline ,
48- mdiEyeOffOutline ,
49- mdiArrowUp ,
50- mdiArrowDown ,
51- } from ' @mdi/js'
72+ import draggable from ' vuedraggable'
73+
74+ import { mdiReorderHorizontal , mdiTableColumnPlusAfter } from ' @mdi/js'
5275
5376export default {
77+ components: {
78+ draggable,
79+ },
5480 data : () => ({
55- mdiEyeOutline,
56- mdiEyeOffOutline,
57- mdiArrowUp,
58- mdiArrowDown,
81+ mdiReorderHorizontal,
82+ mdiTableColumnPlusAfter,
5983 }),
6084 computed: {
61- columns () {
62- return this .$store .state .settings .tableColumns
85+ availableColumns () {
86+ return this .$store .getters [' settings/availableTableColumns' ]
87+ },
88+ visibleColumns: {
89+ get () {
90+ return this .$store .getters [' settings/visibleTableColumns' ]
91+ },
92+ set (value ) {
93+ this .$store .commit (' settings/set' , {
94+ setting: ' selectedTableColumns' ,
95+ value,
96+ })
97+ },
98+ },
99+ hiddenColumns: {
100+ get () {
101+ return this .$store .getters [' settings/hiddenTableColumns' ]
102+ },
103+ set (value ) {
104+ this .$store .commit (' settings/set' , {
105+ setting: ' selectedTableColumns' ,
106+ value: this .availableColumns .filter (
107+ (column ) => ! value .includes (column)
108+ ),
109+ })
110+ },
63111 },
64112 },
65113 methods: {
66- changeOrder (columnField , up ) {
67- this .$store .commit (' settings/changeColumnOrder' , {
68- columnField,
69- up,
70- })
71- },
72- toggleVisiblity (columnField , visibility ) {
73- this .$store .commit (' settings/changeVisibilityOfColumn' , {
74- columnField,
75- visibility,
114+ addAll () {
115+ this .$store .commit (' settings/set' , {
116+ setting: ' selectedTableColumns' ,
117+ value: [... this .visibleColumns , ... this .hiddenColumns ],
76118 })
77119 },
78120 },
@@ -88,10 +130,18 @@ export default {
88130<i18n >
89131 {
90132 "en": {
91- "temp": "This feature has been temporarily disabled. It will return soon once some issues have been resolved."
133+ "visible": "Visible",
134+ "addAll": "Make all columns visible",
135+ "hidden": "Hidden",
136+ "dropHereVisible": "Grab and drop a column here to make it visible",
137+ "dropHereHidden": "Grab and drop a column here to hide it"
92138 },
93139 "fr": {
94- "temp": "Cette fonctionnalité a été temporairement désactivée. Elle reviendra bientôt une fois que certains problèmes auront été résolus."
140+ "visible": "Visible",
141+ "addAll": "Rendre toutes les colonnes visibles",
142+ "hidden": "Caché",
143+ "dropHereVisible": "Prenez et déposez une colonne ici pour la rendre visible",
144+ "dropHereHidden": "Prenez et déposez une colonne ici pour la masquer"
95145 }
96146 }
97147</i18n >
0 commit comments