@citruslime/ui 1.2.1-beta.0 → 2.0.0-beta.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.
Files changed (52) hide show
  1. package/dist/.eslintrc.js +8 -2
  2. package/dist/@types/appUser.d.ts +1 -0
  3. package/dist/@types/components/grid/column.d.ts +2 -1
  4. package/dist/@types/components/header/index.d.ts +0 -1
  5. package/dist/@types/components/{header/navigation.d.ts → navigation/index.d.ts} +7 -4
  6. package/dist/@types/index.d.ts +1 -0
  7. package/dist/components/index.d.ts +17 -14
  8. package/dist/main.d.ts +1 -1
  9. package/dist/style.css +1 -1
  10. package/dist/theme.js +2 -4
  11. package/dist/ui.es.js +1 -1
  12. package/dist/ui.umd.js +1 -1
  13. package/package.json +7 -4
  14. package/src/components/accordion/cl-ui-accordion.vue +89 -0
  15. package/src/components/app/cl-ui-app.vue +35 -0
  16. package/src/components/button/{button.vue → cl-ui-button.vue} +26 -6
  17. package/src/components/calendar/cl-ui-calendar.vue +277 -0
  18. package/src/components/card/{card.vue → cl-ui-card.vue} +17 -1
  19. package/src/components/combo-box/cl-ui-combo-box.vue +357 -0
  20. package/src/components/combo-box/search-container/cl-ui-combo-box-search.vue +279 -0
  21. package/src/components/combo-box/search-container/{header-option/header-option.vue → header/cl-ui-combo-box-header.vue} +17 -2
  22. package/src/components/combo-box/search-container/selectable/cl-ui-combo-box-selectable.vue +99 -0
  23. package/src/components/footer/{footer.vue → cl-ui-footer.vue} +10 -2
  24. package/src/components/grid/cell/{cell.vue → cl-ui-grid-cell.vue} +90 -1
  25. package/src/components/grid/cl-ui-grid.vue +477 -0
  26. package/src/components/grid/filter/cl-ui-grid-filter.vue +270 -0
  27. package/src/components/grid/footer/{footer.vue → cl-ui-grid-footer.vue} +100 -5
  28. package/src/components/grid/header/cl-ui-grid-header.vue +76 -0
  29. package/src/components/grid/view-manager/cl-ui-grid-view-manager.vue +145 -0
  30. package/src/components/header/cl-ui-header.vue +11 -0
  31. package/src/components/header-helper/cl-ui-header-helper.vue +50 -0
  32. package/src/components/language-switcher/{language-switcher.vue → cl-ui-language-switcher.vue} +49 -3
  33. package/src/components/loading-spinner/cl-ui-loading-spinner.vue +16 -0
  34. package/src/components/login/{login.vue → cl-ui-login.vue} +101 -19
  35. package/src/components/modal/{modal.vue → cl-ui-modal.vue} +74 -2
  36. package/src/components/navigation/cl-ui-navigation.vue +124 -0
  37. package/src/components/notification/{notification.vue → cl-ui-notification.vue} +21 -2
  38. package/src/components/slider/cl-ui-slider.vue +145 -0
  39. package/src/components/accordion/accordion.vue +0 -30
  40. package/src/components/calendar/calendar.vue +0 -35
  41. package/src/components/combo-box/combo-box.vue +0 -79
  42. package/src/components/combo-box/search-container/search-container.vue +0 -57
  43. package/src/components/combo-box/search-container/selectable-option/selectable-option.vue +0 -27
  44. package/src/components/grid/filter/filter.vue +0 -93
  45. package/src/components/grid/grid.vue +0 -194
  46. package/src/components/grid/header/header.vue +0 -39
  47. package/src/components/grid/view-manager/view-manager.vue +0 -73
  48. package/src/components/header/header-helper/header-helper.vue +0 -95
  49. package/src/components/header/header.vue +0 -33
  50. package/src/components/header/navigation/navigation.vue +0 -84
  51. package/src/components/loading-spinner/loading-spinner.vue +0 -8
  52. package/src/components/slider/slider.vue +0 -41
@@ -1,35 +0,0 @@
1
- <script lang="ts" src="./calendar"></script>
2
-
3
- <style src="./calendar-global.css"></style>
4
-
5
- <template>
6
- <div v-bind="$attrs"
7
- class="relative">
8
- <input ref="element"
9
- v-bind="$attrs"
10
- class="!text-base !text-sm"
11
- :class="{
12
- '!pr-12': date !== null,
13
- '!pr-8': date === null
14
- }"
15
- type="text"
16
- :placeholder="type === 'date' ? datePlaceholder : dateTimePlaceholder"
17
- :disabled="disabled">
18
-
19
- <ph-calendar v-show="date === null || disabled"
20
- class="absolute bg-white right-2 text-grey-4 top-3"
21
- weight="light"
22
- :size="18" />
23
-
24
- <div v-show="date !== null && !disabled"
25
- class="absolute bg-white flex right-2 text-grey-4 top-3">
26
- <ph-arrow-counter-clockwise class="cursor-pointer md:mr-1 mr-0.5"
27
- :size="16"
28
- @click="resetValue" />
29
-
30
- <ph-x class="cursor-pointer"
31
- :size="16"
32
- @click="clearValue" />
33
- </div>
34
- </div>
35
- </template>
@@ -1,79 +0,0 @@
1
- <script lang="ts" src="./combo-box"></script>
2
-
3
- <template>
4
- <div>
5
- <div class="flex">
6
- <input v-model="currentText"
7
- class="!bg-transparent z-10"
8
- :class="{ 'cursor-pointer': disabled === false }"
9
- type="text"
10
- :placeholder="hintText"
11
- :disabled="disabled"
12
- @focus="toggleDropdown(true)">
13
-
14
- <div v-if="required && disabled === false"
15
- class="relative right-20">
16
- <div class="absolute flex float-right font-semibold mt-2 text-danger-default text-sm">
17
- {{ localisations.required }}
18
-
19
- <ph-warning class="ml-1 mt-1" />
20
- </div>
21
- </div>
22
-
23
- <div class="border border-grey-1 float-right hover:bg-primary-default hover:text-white px-1 py-2.5 text-grey-3 w-min"
24
- :class="{
25
- 'bg-off-white cursor-default hover:bg-off-white hover:text-grey-3': disabled,
26
- 'cursor-pointer': disabled === false
27
- }"
28
- @click="toggleDropdown(true)">
29
- <ph-caret-down weight="fill" />
30
- </div>
31
- </div>
32
-
33
- <cl-ui-modal size="x-small"
34
- :title="createHeader"
35
- :confirm-button="localisations.create"
36
- :cancel-button="localisations.cancel"
37
- :confirm-enabled="objectToCreateValid"
38
- @confirm="createObject">
39
- <template #trigger="{toggleModal}">
40
- <cl-ui-combo-box-search-container v-show="searchContainerVisible"
41
- :can-create-new-object="canCreateNewObject"
42
- :can-clear-selected-object="canClearSelectedObject"
43
- :localisations="localisations"
44
- :loading="loading"
45
- :results="results"
46
- :object-type="objectType"
47
- :object-parent-type="objectParentType"
48
- :error-message="errorMessage"
49
- :current-object-name="currentText"
50
- :is-visible="searchContainerVisible"
51
- @create-object="toggleModal"
52
- @select-object="selectObject"
53
- @clear-object="clearObject"
54
- @search="search"
55
- @hide-dropdown="toggleDropdown(false)" />
56
- </template>
57
-
58
- <cl-ui-combo-box v-if="objectParentType !== ''"
59
- v-model:current-object="parentItem"
60
- class="mt-3"
61
- :results="parentResults"
62
- :loading="loading"
63
- :object-type="objectParentType"
64
- :object-created-response="parentObjectCreatedResponse"
65
- :can-create-new-object="canCreateNewObject"
66
- :can-clear-selected-object="canClearSelectedObject"
67
- :error-message="errorMessage"
68
- @search="searchParent"
69
- @create-object="createParentObject" />
70
-
71
- <label class="mt-3">
72
- {{ localisations.createProperty }}
73
- </label>
74
-
75
- <input v-model="objectToCreateValue"
76
- type="text">
77
- </cl-ui-modal>
78
- </div>
79
- </template>
@@ -1,57 +0,0 @@
1
- <script lang="ts" src="./search-container"></script>
2
-
3
- <template>
4
- <div ref="container"
5
- class="bg-white border border-collapse border-grey-0 h-52 overflow-y-auto p-2 text-sm"
6
- @keydown.up.prevent.stop="onKeyboardArrowUp(firstIndexInResults)"
7
- @keydown.down.prevent.stop="onKeyboardArrowDown(firstIndexInResults)"
8
- @keyup.enter.prevent.stop="onKeyboardEnter">
9
- <div class="flex">
10
- <input ref="searchBox"
11
- v-model="searchText"
12
- type="text"
13
- :placeholder="searchHint"
14
- @keyup="search"
15
- @blur="hideDropdown">
16
-
17
- <cl-ui-loading-spinner v-if="loading"
18
- class="absolute ml-2 mt-11" />
19
- </div>
20
-
21
- <cl-ui-combo-box-header-option v-if="currentObjectName !== ''"
22
- :show-clear-button="canClearSelectedObject"
23
- :text="currentObjectName"
24
- @clear-object="$emit('clear-object')" />
25
-
26
- <cl-ui-combo-box-header-option v-if="objectParentType !== '' && results !== null && results.length > 0 && errorMessage === ''"
27
- :text="objectType"
28
- :additional-text="objectParentType" />
29
-
30
- <cl-ui-combo-box-header-option v-if="results !== null && results.length === 0 && searchText.trim() !== '' && canCreateNewObject === false && errorMessage === ''"
31
- :text="noResults" />
32
-
33
- <cl-ui-combo-box-header-option v-if="errorMessage !== ''"
34
- class="!bg-danger-light text-danger-dark"
35
- :text="combinedErrorMessage" />
36
-
37
- <cl-ui-combo-box-selectable-option v-if="showAddNewOption"
38
- :is-create-new-option="true"
39
- :text="addPrompt"
40
- :index="-1"
41
- :localisations="localisations"
42
- :selected-index="currentSelection"
43
- @create-object="createObject"
44
- @option-highlighted="updateSelectedObjectIndex" />
45
-
46
- <div v-if="errorMessage === '' && results !== null">
47
- <cl-ui-combo-box-selectable-option v-for="(result, index) in results"
48
- :key="index"
49
- :localisations="localisations"
50
- :option="result"
51
- :index="index"
52
- :selected-index="currentSelection"
53
- @select-object="selectObject"
54
- @option-highlighted="updateSelectedObjectIndex" />
55
- </div>
56
- </div>
57
- </template>
@@ -1,27 +0,0 @@
1
- <script lang="ts" src="./selectable-option"></script>
2
-
3
- <template>
4
- <div class="border-b border-grey-0 border-t cursor-pointer flex p-1"
5
- :class="{
6
- 'bg-grey-0': isHighlighted === false,
7
- 'bg-primary-default text-white': isHighlighted
8
- }"
9
- @mousedown="optionSelected"
10
- @mousemove="onHover(true)"
11
- @mouseleave="onHover(false)">
12
- <div v-if="option !== null && option.parentId !== 0 && option.parentId !== undefined"
13
- class="w-1/2">
14
- {{ displayedParent }}
15
- </div>
16
- <div :class="{
17
- 'w-1/2': displayedParent !== '',
18
- 'w-full': displayedParent === ''
19
- }">
20
- {{ displayedText }}
21
- </div>
22
- <div v-show="isCreateNewOption"
23
- class="float-right py-1.5">
24
- <ph-plus-circle class="bg-primary-default rounded-full text-white" />
25
- </div>
26
- </div>
27
- </template>
@@ -1,93 +0,0 @@
1
- <script lang="ts" src="./filter"></script>
2
-
3
- <template>
4
- <div v-if="column.filterable === undefined || column.filterable === true"
5
- class="border-grey-2 flex rounded w-full"
6
- :class="{
7
- 'border-b p-5': column.type === GridColumnType.SLOT && (column.slotType === undefined || column.field === undefined),
8
- 'border': column.type !== GridColumnType.SLOT || (column.slotType !== undefined && column.field !== undefined)
9
- }">
10
- <div v-if="column.type !== GridColumnType.SLOT || (column.slotType !== undefined && column.field !== undefined)"
11
- class="border-grey-2 border-r capitalize group inline relative w-auto">
12
- <div class="bg-off-white flex h-full items-center justify-center w-10">
13
- <ph-sliders-horizontal :size="20" />
14
- </div>
15
-
16
- <div class="absolute bg-white flex-wrap font-normal group-hover:flex group-hover:h-auto group-hover:w-52 h-0 hidden pb-2 shadow-lg text-left text-sm top-10 z-10"
17
- :class="{ 'left-0': firstHalf, '-left-44': !firstHalf }">
18
- <strong class="p-3">
19
- {{ localisations.currentMethod }}
20
- </strong>
21
-
22
- <span class="px-4 py-1 w-full">
23
- {{ currentFilterMethod?.description }}
24
-
25
- <span class="float-right"
26
- v-html="currentFilterMethod?.icon"></span>
27
- </span>
28
-
29
- <strong class="p-3">
30
- {{ localisations.availableMethods }}
31
- </strong>
32
-
33
- <span v-for="(filterMethod, index) in allowedFilterMethods"
34
- :key="index"
35
- class="cursor-pointer hover:bg-off-white px-4 py-1 w-full"
36
- @click.prevent="setFilterMethod(filterMethod.method)">
37
- {{ filterMethod.description }}
38
-
39
- <span class="float-right"
40
- v-html="filterMethod.icon"></span>
41
- </span>
42
- </div>
43
- </div>
44
-
45
- <!-- Booleans -->
46
- <select v-if="column.type === GridColumnType.BOOLEAN ||
47
- (column.slotType === GridColumnType.BOOLEAN && typeof column.field !== 'undefined')"
48
- class="border-none w-full"
49
- @change="setFilter($event.target)">
50
- <option :value="undefined"></option>
51
-
52
- <option value="true"
53
- :selected="currentFilter === 'true'">
54
- {{ localisations.true }}
55
- </option>
56
-
57
- <option value="false"
58
- :selected="currentFilter === 'false'">
59
- {{ localisations.false }}
60
- </option>
61
- </select>
62
- <!-- Dates & DateTimes -->
63
- <cl-ui-calendar v-else-if="column.type === GridColumnType.DATE || column.type === GridColumnType.DATETIME ||
64
- ((column.slotType === GridColumnType.DATE || column.slotType === GridColumnType.DATETIME) && typeof column.field !== 'undefined')"
65
- :date="currentDateFilter"
66
- class="border-none w-full"
67
- :type="column.type"
68
- :date-placeholder="localisations.selectDate"
69
- :date-time-placeholder="localisations.selectDateTime"
70
- :current-locale="currentLocale"
71
- @update:date="setDateFilter($event)" />
72
- <!-- Numbers -->
73
- <input v-else-if="column.type === GridColumnType.NUMBER ||
74
- (column.slotType === GridColumnType.NUMBER && typeof column.field !== 'undefined')"
75
- :value="currentFilter"
76
- class="border-none w-full"
77
- type="text"
78
- @keyup.arrow-up="setFilter(null, (currentNumberFilter + 1).toString())"
79
- @keyup.arrow-down="setFilter(null, (currentNumberFilter - 1).toString())"
80
- @input="debounce(setNumberFilter, [ $event.target ])">
81
- <!-- Strings -->
82
- <input v-else-if="column.type !== GridColumnType.SLOT ||
83
- (column.slotType === GridColumnType.STRING && typeof column.field !== 'undefined')"
84
- :value="currentFilter"
85
- class="border-none w-full"
86
- type="text"
87
- @input="debounce(setFilter, [ $event.target ])">
88
- </div>
89
- <div v-else
90
- class="flex w-full">
91
- &nbsp;
92
- </div>
93
- </template>
@@ -1,194 +0,0 @@
1
- <script lang="ts" src="./grid"></script>
2
-
3
- <style scoped src="./grid.css"></style>
4
-
5
- <template>
6
- <div class="hidden lg:block lg:text-right mb-4 w-full">
7
- <cl-ui-grid-header v-model:columns="currentColumns"
8
- v-model:edit-mode="editMode"
9
- :localisations="localisations"
10
- @reset-filters="resetFilters" />
11
- </div>
12
-
13
- <div class="grid-wrapper relative w-full"
14
- :data-loading="loading">
15
- <div v-show="loading"
16
- class="absolute bg-white h-full opacity-40 w-full z-20"></div>
17
-
18
- <div class="bg-white flex flex-wrap lg:hidden sticky top-0 w-full">
19
- <div class="border-b border-grey-2 flex flex-wrap px-2 py-4 w-full">
20
- <strong class="mb-4 text-sm w-full">
21
- {{ localisations.gridTools }}
22
- </strong>
23
-
24
- <div class="flex flex-wrap w-full">
25
- <cl-ui-grid-header v-model:columns="currentColumns"
26
- v-model:edit-mode="editMode"
27
- v-model:filter-panel-open="filterPanelOpen"
28
- :localisations="localisations"
29
- @reset-filters="resetFilters" />
30
- </div>
31
- </div>
32
-
33
- <div v-show="filterPanelOpen"
34
- class="absolute bg-white h-screen overflow-x-auto p-4 text-sm w-full z-10">
35
- <div class="border-b border-grey-3 mb-2 pb-2 text-right w-full">
36
- <cl-ui-button colour="blue"
37
- size="small"
38
- @click.prevent="filterPanelOpen = false;">
39
- <ph-x class="-mt-1 inline-block"
40
- :size="16" />
41
-
42
- {{ localisations.confirmFilters }}
43
- </cl-ui-button>
44
- </div>
45
-
46
- <div class="grid grid-cols-3">
47
- <div>
48
- {{ localisations.field }}
49
- </div>
50
-
51
- <div>
52
- {{ localisations.filter }}
53
- </div>
54
-
55
- <div>
56
- {{ localisations.sortBy }}
57
- </div>
58
- </div>
59
-
60
- <div v-for="(column, index) in visibleColumns"
61
- :key="index"
62
- class="grid grid-cols-3 mb-4 w-full">
63
- <div>
64
- {{ column.caption }}
65
- </div>
66
-
67
- <cl-ui-grid-filter v-model:request="currentRequest"
68
- :localisations="localisations"
69
- :column="column"
70
- :current-locale="currentLocale" />
71
-
72
- <template v-if="(column.type !== GridColumnType.SLOT || (column.slotType !== undefined) && column.field !== undefined) &&
73
- (column.sortable === undefined || column.sortable === true)">
74
- <ph-minus v-if="currentRequest.sort === null || currentRequest.sort.sortOnColumn !== column.field"
75
- class="cursor-pointer ml-2"
76
- @click="setSort(column.field)" />
77
- <ph-caret-down v-else-if="currentRequest.sort.sortByAscending === false"
78
- class="cursor-pointer ml-2"
79
- @click="setSort(column.field)" />
80
- <ph-caret-up v-else
81
- class="cursor-pointer ml-2"
82
- @click="setSort(column.field)" />
83
- </template>
84
- <div v-else
85
- class="ml-2">
86
- &nbsp;
87
- </div>
88
- </div>
89
- </div>
90
- </div>
91
-
92
- <div class="overflow-auto w-full">
93
- <table class="min-w-full table-fixed">
94
- <colgroup class="hidden lg:table-column-group">
95
- <col v-for="(column, index) in visibleColumns"
96
- :key="index"
97
- :style="getStyleForColumn(column.name)"
98
- :span="1">
99
- </colgroup>
100
-
101
- <thead class="hidden lg:table-header-group">
102
- <tr>
103
- <th v-for="(column, index) in visibleColumns"
104
- :key="index"
105
- class="border-b border-grey-2 font-semibold p-1 text-grey-3 text-left text-sm uppercase"
106
- :style="getStyleForColumn(column.name)">
107
- <span v-if="data && data.results?.length &&
108
- (column.type !== GridColumnType.SLOT || (column.slotType !== undefined && column.field !== undefined)) &&
109
- (column.sortable === undefined || column.sortable === true)"
110
- class="cursor-pointer"
111
- @click="setSort(column.field)">
112
- {{ column.caption }}
113
-
114
- <ph-caret-up v-show="currentRequest.sort !== null && currentRequest.sort.sortOnColumn === column.field && currentRequest.sort.sortByAscending === true"
115
- class="-mt-1 inline-block" />
116
-
117
- <ph-caret-down v-show="currentRequest.sort !== null && currentRequest.sort.sortOnColumn === column.field && currentRequest.sort.sortByAscending === false"
118
- class="-mt-1 inline-block" />
119
- </span>
120
- <span v-else>
121
- {{ column.caption }}
122
- </span>
123
- </th>
124
- </tr>
125
-
126
- <tr v-if="(data && data.results?.length) || currentRequest.filters.length > 0">
127
- <th v-for="(column, index) in visibleColumns"
128
- :key="index"
129
- class="p-1"
130
- :style="getStyleForColumn(column.name)">
131
- <cl-ui-grid-filter v-model:request="currentRequest"
132
- :localisations="localisations"
133
- :column="column"
134
- :current-locale="currentLocale"
135
- :first-half="index <= visibleColumns.length / 2" />
136
- </th>
137
- </tr>
138
- </thead>
139
-
140
- <tbody>
141
- <template v-if="data && data.results?.length">
142
- <tr v-for="(record, recordIndex) in data.results"
143
- :key="recordIndex"
144
- :class="{
145
- 'bg-white': (recordIndex % 2) !== 1,
146
- 'bg-off-white': (recordIndex % 2) === 1
147
- }">
148
- <cl-ui-grid-cell v-for="(column, columnIndex) in visibleColumns"
149
- :key="columnIndex"
150
- class="align-top p-2 whitespace-nowrap"
151
- :style="getStyleForColumn(column.name)"
152
- :current-locale="currentLocale"
153
- :column="column"
154
- :record="record"
155
- :edit-mode="editMode"
156
- @focus="cellFocused(recordIndex)"
157
- @edit="cellFocused(recordIndex); cellChanged($event, column.field);"
158
- @undo-edit="cellReverted(column.field)">
159
- <template v-for="(_, name) in $slots"
160
- #[name]="data">
161
- <slot :name="name"
162
- v-bind="data"></slot>
163
- </template>
164
- </cl-ui-grid-cell>
165
- </tr>
166
- </template>
167
- <tr v-else>
168
- <td :colspan="visibleColumns.length">
169
- <div class="my-10 py-1 text-center text-sm w-full">
170
- <strong>
171
- {{ localisations.noData }}
172
- </strong>
173
-
174
- <div v-if="currentRequest.filters.length > 0"
175
- class="w-full">
176
- {{ localisations.noDataFiltersPresent }}
177
-
178
- <cl-ui-button size="small"
179
- @click.prevent="resetFilters">
180
- {{ localisations.clearFilters }}
181
- </cl-ui-button>
182
- </div>
183
- </div>
184
- </td>
185
- </tr>
186
- </tbody>
187
- </table>
188
- </div>
189
-
190
- <cl-ui-grid-footer v-model:request="currentRequest"
191
- :localisations="localisations"
192
- :data="data" />
193
- </div>
194
- </template>
@@ -1,39 +0,0 @@
1
- <script lang="ts" src="./header"></script>
2
-
3
- <template>
4
- <span class="lg:pb-0 lg:w-auto pb-2 pr-2 w-1/2">
5
- <cl-ui-button class="lg:w-auto w-full"
6
- size="small"
7
- colour="default"
8
- @click="$emit('update:edit-mode', !editMode)">
9
- <span v-show="!editMode">
10
- {{ localisations.editData }}
11
- </span>
12
- <span v-show="editMode">
13
- {{ localisations.finishEditing }}
14
- </span>
15
- </cl-ui-button>
16
- </span>
17
-
18
- <span class="hidden lg:inline-block pr-2">
19
- <cl-ui-view-manager v-model:columns="currentColumns"
20
- :localisations="localisations" />
21
- </span>
22
-
23
- <span class="lg:pb-0 lg:pr-0 lg:w-auto pb-2 pr-2 w-1/2">
24
- <cl-ui-button class="lg:w-auto w-full"
25
- size="small"
26
- @click.prevent="$emit('reset-filters')">
27
- {{ localisations.clearFilters }}
28
- </cl-ui-button>
29
- </span>
30
-
31
- <span class="lg:hidden pr-2 w-1/2">
32
- <cl-ui-button class="w-full"
33
- colour="blue"
34
- size="small"
35
- @click.prevent="$emit('update:filter-panel-open', true)">
36
- {{ localisations.modifyFilters }}
37
- </cl-ui-button>
38
- </span>
39
- </template>
@@ -1,73 +0,0 @@
1
- <script lang="ts" src="./view-manager"></script>
2
-
3
- <template>
4
- <cl-ui-button v-bind="$attrs"
5
- class="w-full"
6
- size="small"
7
- @click.prevent="visible = true">
8
- {{ localisations.manageView }}
9
- </cl-ui-button>
10
-
11
- <teleport to="body">
12
- <div v-show="visible"
13
- class="fixed flex h-full right-0 top-0 w-full z-40">
14
- <div class="bg-black cursor-pointer flex-1 h-full opacity-40"
15
- @click="visible = false"></div>
16
-
17
- <div class="bg-secondary-default h-full overflow-y-auto px-10 py-20 relative text-grey-2 w-80">
18
- <ph-x class="absolute cursor-pointer right-3 text-off-white top-3"
19
- :size="16"
20
- @click="visible = false" />
21
-
22
- <h3 class="mb-4 text-2xl text-off-white">
23
- {{ localisations.manageView }}
24
- </h3>
25
-
26
- <ul class="border-grey-3 border-t flex flex-wrap text-sm w-full">
27
- <li class="border-b border-grey-2 flex py-2 text-sm w-full">
28
- <strong class="flex-1 py-2">
29
- {{ localisations.column }}
30
- </strong>
31
-
32
- <strong class="py-2 w-1/4">
33
- {{ localisations.visible }}
34
- </strong>
35
-
36
- <strong class="py-2 w-1/5">
37
- {{ localisations.order }}
38
- </strong>
39
- </li>
40
-
41
- <li v-for="(column, index) in columns"
42
- :key="index"
43
- class="border-b border-grey-2 flex py-2 text-sm w-full">
44
- <div class="flex-1 py-2">
45
- {{ column.caption }}
46
- </div>
47
-
48
- <div class="py-2 w-1/4">
49
- <input :checked="column.visible === undefined || column.visible === true"
50
- type="checkbox"
51
- @click="updateColumnVisibility($event.target, column)">
52
- </div>
53
-
54
- <div class="py-2 text-off-white w-1/5">
55
- <template v-if="column.visible === undefined || column.visible === true">
56
- <ph-arrow-left v-if="index !== 0"
57
- class="cursor-pointer inline-block mr-2"
58
- @click="changeColumnOrder(index, 'down')" />
59
-
60
- <ph-arrow-right v-if="index !== columns.length - 1"
61
- class="cursor-pointer inline-block"
62
- @click="changeColumnOrder(index, 'up')" />
63
- </template>
64
- <em v-else>
65
- {{ localisations.hidden }}
66
- </em>
67
- </div>
68
- </li>
69
- </ul>
70
- </div>
71
- </div>
72
- </teleport>
73
- </template>