@citruslime/ui 2.0.0-beta.2 → 2.0.0-beta.23

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 (141) hide show
  1. package/README.md +5 -4
  2. package/dist/citrus-lime-ui.es.js +4616 -0
  3. package/dist/citrus-lime-ui.umd.js +2 -0
  4. package/dist/components/accordion/cl-ui-accordion.vue.d.ts +26 -0
  5. package/dist/components/accordion/index.d.ts +4 -0
  6. package/dist/components/accordion/item/cl-ui-accordion-item.vue.d.ts +35 -0
  7. package/dist/{@types/components/accordion/item.d.ts → components/accordion/types.d.ts} +0 -0
  8. package/dist/components/app/cl-ui-app.vue.d.ts +51 -0
  9. package/dist/components/app/index.d.ts +1 -0
  10. package/dist/components/button/cl-ui-button.vue.d.ts +51 -0
  11. package/dist/components/button/index.d.ts +2 -0
  12. package/dist/components/button/types.d.ts +4 -0
  13. package/dist/components/calendar/cl-ui-calendar.vue.d.ts +2 -0
  14. package/dist/components/calendar/index.d.ts +2 -0
  15. package/dist/components/calendar/types.d.ts +2 -0
  16. package/dist/components/calendar/utils.d.ts +38 -0
  17. package/dist/components/card/cl-ui-card.vue.d.ts +27 -0
  18. package/dist/components/card/index.d.ts +2 -0
  19. package/dist/components/card/types.d.ts +2 -0
  20. package/dist/components/combo-box/cl-ui-combo-box.vue.d.ts +583 -0
  21. package/dist/components/combo-box/index.d.ts +2 -0
  22. package/dist/components/combo-box/search-container/cl-ui-combo-box-search.vue.d.ts +276 -0
  23. package/dist/components/combo-box/search-container/header/cl-ui-combo-box-header.vue.d.ts +42 -0
  24. package/dist/components/combo-box/search-container/selectable/cl-ui-combo-box-selectable.vue.d.ts +81 -0
  25. package/dist/{@types/components/combo-box/item.d.ts → components/combo-box/types.d.ts} +0 -0
  26. package/dist/components/footer/index.d.ts +1 -0
  27. package/dist/components/grid/cell/cl-ui-grid-cell.vue.d.ts +72 -0
  28. package/dist/components/grid/cl-ui-grid.vue.d.ts +550 -0
  29. package/dist/components/grid/filter/cl-ui-grid-filter.vue.d.ts +72 -0
  30. package/dist/components/grid/filter/filter-methods.d.ts +5 -0
  31. package/dist/components/grid/footer/cl-ui-grid-footer.vue.d.ts +63 -0
  32. package/dist/components/grid/header/cl-ui-grid-header.vue.d.ts +207 -0
  33. package/dist/components/grid/index.d.ts +2 -0
  34. package/dist/components/grid/types.d.ts +92 -0
  35. package/dist/components/grid/view-manager/cl-ui-grid-view-manager.vue.d.ts +88 -0
  36. package/dist/components/header/index.d.ts +2 -0
  37. package/dist/components/header/menu/cl-ui-header-menu.vue.d.ts +40 -0
  38. package/dist/components/header/menu/index.d.ts +1 -0
  39. package/dist/components/index.d.ts +16 -17
  40. package/dist/components/input/cl-ui-input.vue.d.ts +2 -0
  41. package/dist/components/input/index.d.ts +2 -0
  42. package/dist/components/input/types.d.ts +6 -0
  43. package/dist/components/input/utils.d.ts +44 -0
  44. package/dist/components/language-switcher/cl-ui-language-switcher.vue.d.ts +37 -0
  45. package/dist/components/language-switcher/index.d.ts +2 -0
  46. package/dist/{@types/language.d.ts → components/language-switcher/types.d.ts} +0 -1
  47. package/dist/components/loading-spinner/index.d.ts +1 -0
  48. package/dist/components/login/cl-ui-login.vue.d.ts +106 -0
  49. package/dist/components/login/index.d.ts +2 -0
  50. package/dist/{@types/components/login/authentication.d.ts → components/login/types.d.ts} +0 -0
  51. package/dist/components/modal/cl-ui-modal.vue.d.ts +49 -0
  52. package/dist/components/modal/index.d.ts +2 -0
  53. package/dist/components/modal/types.d.ts +4 -0
  54. package/dist/components/navigation/cl-ui-navigation.vue.d.ts +11 -0
  55. package/dist/components/navigation/group/cl-ui-navigation-group.vue.d.ts +12 -0
  56. package/dist/components/navigation/icon/cl-ui-navigation-icon.vue.d.ts +20 -0
  57. package/dist/components/navigation/index.d.ts +5 -0
  58. package/dist/components/notification/cl-ui-notification.vue.d.ts +36 -0
  59. package/dist/components/notification/index.d.ts +1 -0
  60. package/dist/components/notification/types.d.ts +9 -0
  61. package/dist/components/slider/cl-ui-slider.vue.d.ts +114 -0
  62. package/dist/components/slider/index.d.ts +1 -0
  63. package/dist/components/tab/cl-ui-tab.vue.d.ts +52 -0
  64. package/dist/components/tab/header/cl-ui-tab-header.vue.d.ts +60 -0
  65. package/dist/components/tab/index.d.ts +4 -0
  66. package/dist/components/tab/types.d.ts +4 -0
  67. package/dist/composables/notification.d.ts +1 -1
  68. package/dist/main.d.ts +2 -4
  69. package/dist/style.css +1 -1
  70. package/dist/utils/i18n/config.d.ts +33 -0
  71. package/dist/utils/i18n/defaults.d.ts +4 -0
  72. package/dist/utils/i18n/index.d.ts +3 -0
  73. package/dist/utils/i18n/types.d.ts +97 -0
  74. package/dist/utils/index.d.ts +2 -6
  75. package/dist/utils/validation.d.ts +37 -0
  76. package/package.json +27 -14
  77. package/dist/.eslintrc.js +0 -453
  78. package/dist/.stylelintrc.js +0 -119
  79. package/dist/@types/appUser.d.ts +0 -11
  80. package/dist/@types/components/accordion/index.d.ts +0 -1
  81. package/dist/@types/components/combo-box/index.d.ts +0 -2
  82. package/dist/@types/components/combo-box/localisations.d.ts +0 -19
  83. package/dist/@types/components/grid/column.d.ts +0 -46
  84. package/dist/@types/components/grid/index.d.ts +0 -4
  85. package/dist/@types/components/grid/localisations.d.ts +0 -47
  86. package/dist/@types/components/grid/request.d.ts +0 -49
  87. package/dist/@types/components/grid/update.d.ts +0 -4
  88. package/dist/@types/components/header/index.d.ts +0 -1
  89. package/dist/@types/components/header/localisations.d.ts +0 -8
  90. package/dist/@types/components/login/index.d.ts +0 -2
  91. package/dist/@types/components/login/localisations.d.ts +0 -7
  92. package/dist/@types/components/navigation/index.d.ts +0 -18
  93. package/dist/@types/components/notification/index.d.ts +0 -1
  94. package/dist/@types/components/notification/item.d.ts +0 -7
  95. package/dist/@types/components/slider/index.d.ts +0 -1
  96. package/dist/@types/components/slider/localisations.d.ts +0 -3
  97. package/dist/@types/date-format.d.ts +0 -8
  98. package/dist/@types/debouncer.d.ts +0 -6
  99. package/dist/@types/index.d.ts +0 -16
  100. package/dist/@types/locale.d.ts +0 -10
  101. package/dist/@types/number-format.d.ts +0 -7
  102. package/dist/@types/string-format.d.ts +0 -3
  103. package/dist/@types/string.d.ts +0 -47
  104. package/dist/theme.js +0 -120
  105. package/dist/ui.es.js +0 -1
  106. package/dist/ui.umd.js +0 -1
  107. package/dist/utils/copy.d.ts +0 -8
  108. package/dist/utils/debouncer.d.ts +0 -8
  109. package/dist/utils/extensions/string-utilities.d.ts +0 -83
  110. package/dist/utils/extensions/string.d.ts +0 -1
  111. package/dist/utils/i18n/datetime-formats.d.ts +0 -3
  112. package/dist/utils/i18n/number-formats.d.ts +0 -3
  113. package/dist/utils/id.d.ts +0 -6
  114. package/dist/utils/name-of.d.ts +0 -7
  115. package/dist/utils/sort.d.ts +0 -9
  116. package/dist/utils/url-params.d.ts +0 -8
  117. package/src/components/accordion/cl-ui-accordion.vue +0 -89
  118. package/src/components/app/cl-ui-app.vue +0 -26
  119. package/src/components/button/cl-ui-button.vue +0 -48
  120. package/src/components/calendar/cl-ui-calendar.vue +0 -277
  121. package/src/components/card/cl-ui-card.vue +0 -70
  122. package/src/components/combo-box/cl-ui-combo-box.vue +0 -357
  123. package/src/components/combo-box/search-container/cl-ui-combo-box-search.vue +0 -279
  124. package/src/components/combo-box/search-container/header/cl-ui-combo-box-header.vue +0 -36
  125. package/src/components/combo-box/search-container/selectable/cl-ui-combo-box-selectable.vue +0 -99
  126. package/src/components/footer/cl-ui-footer.vue +0 -31
  127. package/src/components/grid/cell/cl-ui-grid-cell.vue +0 -153
  128. package/src/components/grid/cl-ui-grid.vue +0 -477
  129. package/src/components/grid/filter/cl-ui-grid-filter.vue +0 -270
  130. package/src/components/grid/footer/cl-ui-grid-footer.vue +0 -186
  131. package/src/components/grid/header/cl-ui-grid-header.vue +0 -76
  132. package/src/components/grid/view-manager/cl-ui-grid-view-manager.vue +0 -145
  133. package/src/components/header/cl-ui-header.vue +0 -11
  134. package/src/components/header-helper/cl-ui-header-helper.vue +0 -50
  135. package/src/components/language-switcher/cl-ui-language-switcher.vue +0 -82
  136. package/src/components/loading-spinner/cl-ui-loading-spinner.vue +0 -16
  137. package/src/components/login/cl-ui-login.vue +0 -183
  138. package/src/components/modal/cl-ui-modal.vue +0 -120
  139. package/src/components/navigation/cl-ui-navigation.vue +0 -124
  140. package/src/components/notification/cl-ui-notification.vue +0 -55
  141. package/src/components/slider/cl-ui-slider.vue +0 -145
@@ -1,477 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
3
-
4
- import { FilterRequest, FilterResponse, GridColumn, GridColumnType, GridFilterLocalisations, GridFooterLocalisations, GridHeaderLocalisations, GridLocalisations, GridViewManagerLocalisations } from '../../@types';
5
- import { copy } from '../../utils/copy';
6
-
7
- import ClUiGridCell from './cell/cl-ui-grid-cell.vue';
8
- import ClUiGridFilter from './filter/cl-ui-grid-filter.vue';
9
- import ClUiGridFooter from './footer/cl-ui-grid-footer.vue';
10
- import ClUiGridHeader from './header/cl-ui-grid-header.vue';
11
-
12
- const props = withDefaults(defineProps<{
13
- currentLocale?: string;
14
- localisations?: GridLocalisations & GridHeaderLocalisations & GridViewManagerLocalisations & GridFilterLocalisations & GridFooterLocalisations;
15
- columns: GridColumn[];
16
- request: FilterRequest;
17
- loading: boolean;
18
- data?: FilterResponse<Record<string, unknown>> | null;
19
- }>(), {
20
- currentLocale: 'en-GB',
21
- localisations: () => ({
22
- confirmFilters: 'Confirm Filters',
23
- noData: 'No data to show.',
24
- noDataFiltersPresent: 'We noticed you have some filters present. Please update or clear your filters.',
25
- field: 'Field',
26
- filter: 'Filter',
27
- sortBy: 'Sort By',
28
- gridTools: 'Grid Tools',
29
-
30
- clearFilters: 'Clear Filters',
31
- modifyFilters: 'Modify Filters',
32
- editData: 'Edit Data',
33
- finishEditing: 'Finish Editing',
34
-
35
- equal: 'Equals',
36
- notequal: 'Does not equal',
37
- contains: 'Contains',
38
- notcontains: 'Does not contain',
39
- startswith: 'Starts with',
40
- endswith: 'Ends with',
41
- lessthan: 'Less than',
42
- greaterthan: 'Greater than',
43
- equalorlessthan: 'Less than or equal to',
44
- equalorgreaterthan: 'Greater than or equal to',
45
- currentMethod: 'Current filter method',
46
- availableMethods: 'Available filter methods',
47
- true: 'True',
48
- false: 'False',
49
- selectDate: 'Select date',
50
- selectDateTime: 'Select date & time',
51
-
52
- page: 'Page',
53
- pageSize: 'Page Size',
54
- totalRecords: 'Total Records',
55
- jumpToPage: 'Jump to Page',
56
-
57
- manageView: 'Manage View',
58
- column: 'Column',
59
- visible: 'Visible',
60
- order: 'Order',
61
- hidden: 'Hidden'
62
- }),
63
- data: () => null
64
- });
65
-
66
- const emit = defineEmits({
67
- 'update:columns': null,
68
- 'update:request': null,
69
- 'data-request': null,
70
- 'row-edit': null,
71
- 'edit-start': null,
72
- 'edit-end': null
73
- });
74
-
75
- const columnStyles = ref<Record<string, string>>({});
76
- const editMode = ref<boolean>(false);
77
- const editRow = ref<{ index: number; record: Record<string, unknown>; }>({
78
- index: -1,
79
- record: {}
80
- });
81
- const filterPanelOpen = ref<boolean>(false);
82
-
83
- const currentColumns = computed<GridColumn[]>({
84
- get: () => props.columns,
85
- set: (value) => emit('update:columns', value)
86
- });
87
-
88
- const currentRequest = computed<FilterRequest>({
89
- get: () => props.request,
90
- set: (value) => emit('update:request', value)
91
- });
92
-
93
- const visibleColumns = computed<GridColumn[]>(() => currentColumns.value.filter(e => typeof e.visible === 'undefined' || e.visible !== false));
94
-
95
- /**
96
- * Updates the columns styles, adding width, max width and min width values, for every column. No styles are added, for smaller screens.
97
- */
98
- function setColumnStyles (): void {
99
- const result: Record<string, string> = {};
100
-
101
- if (window.innerWidth >= 1024) {
102
- currentColumns.value.forEach((c) => {
103
- const value = c.width ? `${c.width}px` : '';
104
-
105
- result[`${c.name}`] = `width: ${value}; min-width: ${value};`;
106
- });
107
- }
108
-
109
- columnStyles.value = result;
110
- }
111
-
112
- /**.
113
- * Retrieves the style value, for the column with the provided name.
114
- *
115
- * @param name The name of the column.
116
- * @returns The calculated style value, as a string.
117
- */
118
- function getStyleForColumn (name: string): string {
119
- return columnStyles.value[name] ?? '';
120
- }
121
-
122
- /**
123
- * Set the column which the data is being ordered by or update that ordering from ascending to descending.
124
- *
125
- * @param field The field to sort by.
126
- */
127
- function setSort (field: string | undefined): void {
128
- if (typeof field !== 'undefined') {
129
- const filterRequest = copy(props.request);
130
-
131
- if (filterRequest.sort === null || filterRequest.sort.sortOnColumn !== field) {
132
- filterRequest.sort = {
133
- sortOnColumn: field,
134
- sortByAscending: true
135
- };
136
- }
137
- else if (filterRequest.sort.sortOnColumn === field && filterRequest.sort.sortByAscending === true) {
138
- filterRequest.sort.sortByAscending = false;
139
- }
140
- else {
141
- filterRequest.sort = null;
142
- }
143
-
144
- currentRequest.value = filterRequest;
145
- }
146
- }
147
-
148
- /**
149
- * Empty the filters, from the current filter request.
150
- */
151
- function resetFilters (): void {
152
- const request = copy(currentRequest.value);
153
-
154
- request.pageNumber = 1;
155
- request.filters = [];
156
-
157
- currentRequest.value = request;
158
- }
159
-
160
- /**
161
- * Updates the index of the cell for the current row If the row has updated, fires the row edited event.
162
- *
163
- * @param index The index of the row that the cell is in.
164
- */
165
- function cellFocused (index: number): void {
166
- if (editRow.value.index !== -1 && editRow.value.index !== index) {
167
- rowEdited();
168
- }
169
-
170
- editRow.value.index = index;
171
- }
172
-
173
- /**
174
- * Adds the provided property to the currently edited row data.
175
- *
176
- * @param value The value to add.
177
- * @param field The property to add.
178
- */
179
- function cellChanged (value: unknown, field?: string): void {
180
- if (field !== undefined) {
181
- editRow.value.record[field] = value;
182
- }
183
- }
184
-
185
- /**
186
- * Removes the provided property from the currently edited row data.
187
- *
188
- * @param field The property to remove.
189
- */
190
- function cellReverted (field?: string): void {
191
- if (field !== undefined) {
192
- const { [field]: _, ...remainder } = editRow.value.record;
193
-
194
- editRow.value.record = {
195
- ...remainder
196
- };
197
- }
198
- }
199
-
200
- /**
201
- * Emits an event containing information about the current edited row, before resetting the edited row data.
202
- */
203
- function rowEdited (): void {
204
- if (Object.keys(editRow.value.record).length !== 0) {
205
- emit('row-edit', copy(editRow.value));
206
-
207
- editRow.value.record = {};
208
- }
209
- }
210
-
211
- onMounted(() => {
212
- window.addEventListener('resize', setColumnStyles);
213
-
214
- setColumnStyles();
215
- });
216
- onUnmounted(() => window.removeEventListener('resize', setColumnStyles));
217
-
218
- watch(() => props.request, () => emit('data-request'), {
219
- deep: true,
220
- immediate: true
221
- });
222
-
223
- watch(() => editMode.value, () => {
224
- if (editMode.value) {
225
- emit('edit-start');
226
- }
227
- else {
228
- rowEdited();
229
- emit('edit-end');
230
-
231
- editRow.value.index = -1;
232
- }
233
- });
234
- </script>
235
-
236
- <style scoped lang="postcss">
237
- table {
238
- @apply lg:min-h-[450px];
239
- }
240
-
241
- td,
242
- colgroup {
243
- @apply whitespace-nowrap;
244
- }
245
-
246
- td {
247
- @apply grid grid-cols-2 lg:table-cell lg:border-none border-b border-grey-0 text-xs lg:text-base font-light;
248
- }
249
-
250
- td > span {
251
- @apply font-light;
252
- }
253
-
254
- th {
255
- @apply opacity-90;
256
- }
257
-
258
- td > *:last-child {
259
- @apply overflow-auto;
260
- }
261
-
262
- td:first-child {
263
- @apply lg:pt-2 pt-5 pb-2;
264
- }
265
-
266
- td:last-child {
267
- @apply lg:pt-2 pb-5 pt-2;
268
- }
269
-
270
- .grid-wrapper[data-loading='true']:after {
271
- @apply absolute animate-spin border-2 border-primary-default rounded-full h-16 w-16 top-1/3 left-[calc(50%-2rem)];
272
-
273
- border-bottom: 2px solid transparent;
274
- content: '';
275
- }
276
-
277
- .grid.grid-cols-3 {
278
- grid-template-columns: 75px auto 50px;
279
- }
280
- </style>
281
-
282
- <template>
283
- <div class="hidden lg:block lg:text-right mb-4 w-full">
284
- <cl-ui-grid-header v-model:columns="currentColumns"
285
- v-model:edit-mode="editMode"
286
- :localisations="localisations"
287
- @reset-filters="resetFilters" />
288
- </div>
289
-
290
- <div class="grid-wrapper relative w-full"
291
- :data-loading="loading">
292
- <div v-show="loading"
293
- class="absolute bg-white h-full opacity-40 w-full z-20"></div>
294
-
295
- <div class="bg-white flex flex-wrap lg:hidden sticky top-0 w-full">
296
- <div class="border-b border-grey-2 flex flex-wrap px-2 py-4 w-full">
297
- <strong class="mb-4 text-sm w-full">
298
- {{ localisations.gridTools }}
299
- </strong>
300
-
301
- <div class="flex flex-wrap w-full">
302
- <cl-ui-grid-header v-model:columns="currentColumns"
303
- v-model:edit-mode="editMode"
304
- v-model:filter-panel-open="filterPanelOpen"
305
- :localisations="localisations"
306
- @reset-filters="resetFilters" />
307
- </div>
308
- </div>
309
-
310
- <div v-show="filterPanelOpen"
311
- class="absolute bg-white h-screen overflow-x-auto p-4 text-sm w-full z-10">
312
- <div class="border-b border-grey-3 mb-2 pb-2 text-right w-full">
313
- <cl-ui-button colour="blue"
314
- size="small"
315
- @click.prevent="filterPanelOpen = false;">
316
- <icon class="-mt-1 inline-block"
317
- icon="ph:x"
318
- :size="16" />
319
-
320
- {{ localisations.confirmFilters }}
321
- </cl-ui-button>
322
- </div>
323
-
324
- <div class="grid grid-cols-3">
325
- <div>
326
- {{ localisations.field }}
327
- </div>
328
-
329
- <div>
330
- {{ localisations.filter }}
331
- </div>
332
-
333
- <div>
334
- {{ localisations.sortBy }}
335
- </div>
336
- </div>
337
-
338
- <div v-for="(column, index) in visibleColumns"
339
- :key="index"
340
- class="grid grid-cols-3 mb-4 w-full">
341
- <div>
342
- {{ column.caption }}
343
- </div>
344
-
345
- <cl-ui-grid-filter v-model:request="currentRequest"
346
- :localisations="localisations"
347
- :column="column"
348
- :current-locale="currentLocale" />
349
-
350
- <template v-if="(column.type !== GridColumnType.SLOT || (column.slotType !== undefined) && column.field !== undefined) &&
351
- (column.sortable === undefined || column.sortable === true)">
352
- <icon v-if="currentRequest.sort === null || currentRequest.sort.sortOnColumn !== column.field"
353
- class="cursor-pointer ml-2"
354
- icon="ph:minus"
355
- @click="setSort(column.field)" />
356
- <icon v-else-if="currentRequest.sort.sortByAscending === false"
357
- class="cursor-pointer ml-2"
358
- icon="ph:caret-down"
359
- @click="setSort(column.field)" />
360
- <icon v-else
361
- class="cursor-pointer ml-2"
362
- icon="ph:caret-up"
363
- @click="setSort(column.field)" />
364
- </template>
365
- <div v-else
366
- class="ml-2">
367
- &nbsp;
368
- </div>
369
- </div>
370
- </div>
371
- </div>
372
-
373
- <div class="overflow-auto w-full">
374
- <table class="min-w-full table-fixed">
375
- <colgroup class="hidden lg:table-column-group">
376
- <col v-for="(column, index) in visibleColumns"
377
- :key="index"
378
- :style="getStyleForColumn(column.name)"
379
- :span="1">
380
- </colgroup>
381
-
382
- <thead class="hidden lg:table-header-group">
383
- <tr>
384
- <th v-for="(column, index) in visibleColumns"
385
- :key="index"
386
- class="border-b border-grey-2 font-semibold p-1 text-grey-3 text-left text-sm uppercase"
387
- :style="getStyleForColumn(column.name)">
388
- <span v-if="data && data.results?.length &&
389
- (column.type !== GridColumnType.SLOT || (column.slotType !== undefined && column.field !== undefined)) &&
390
- (column.sortable === undefined || column.sortable === true)"
391
- class="cursor-pointer"
392
- @click="setSort(column.field)">
393
- {{ column.caption }}
394
-
395
- <icon v-show="currentRequest.sort !== null && currentRequest.sort.sortOnColumn === column.field && currentRequest.sort.sortByAscending === true"
396
- class="-mt-1 inline-block"
397
- icon="ph:caret-up" />
398
-
399
- <icon v-show="currentRequest.sort !== null && currentRequest.sort.sortOnColumn === column.field && currentRequest.sort.sortByAscending === false"
400
- class="-mt-1 inline-block"
401
- icon="ph:caret-down" />
402
- </span>
403
- <span v-else>
404
- {{ column.caption }}
405
- </span>
406
- </th>
407
- </tr>
408
-
409
- <tr v-if="(data && data.results?.length) || currentRequest.filters.length > 0">
410
- <th v-for="(column, index) in visibleColumns"
411
- :key="index"
412
- class="p-1"
413
- :style="getStyleForColumn(column.name)">
414
- <cl-ui-grid-filter v-model:request="currentRequest"
415
- :localisations="localisations"
416
- :column="column"
417
- :current-locale="currentLocale"
418
- :first-half="index <= visibleColumns.length / 2" />
419
- </th>
420
- </tr>
421
- </thead>
422
-
423
- <tbody>
424
- <template v-if="data && data.results?.length">
425
- <tr v-for="(record, recordIndex) in data.results"
426
- :key="recordIndex"
427
- :class="{
428
- 'bg-white': (recordIndex % 2) !== 1,
429
- 'bg-off-white': (recordIndex % 2) === 1
430
- }">
431
- <cl-ui-grid-cell v-for="(column, columnIndex) in visibleColumns"
432
- :key="columnIndex"
433
- class="align-top p-2 whitespace-nowrap"
434
- :style="getStyleForColumn(column.name)"
435
- :current-locale="currentLocale"
436
- :column="column"
437
- :record="record"
438
- :edit-mode="editMode"
439
- @focus="cellFocused(recordIndex)"
440
- @edit="cellFocused(recordIndex); cellChanged($event, column.field);"
441
- @undo-edit="cellReverted(column.field)">
442
- <template v-for="(_, name) in $slots"
443
- #[name]="cellData">
444
- <slot :name="name"
445
- v-bind="cellData"></slot>
446
- </template>
447
- </cl-ui-grid-cell>
448
- </tr>
449
- </template>
450
- <tr v-else>
451
- <td :colspan="visibleColumns.length">
452
- <div class="my-10 py-1 text-center text-sm w-full">
453
- <strong>
454
- {{ localisations.noData }}
455
- </strong>
456
-
457
- <div v-if="currentRequest.filters.length > 0"
458
- class="w-full">
459
- {{ localisations.noDataFiltersPresent }}
460
-
461
- <cl-ui-button size="small"
462
- @click.prevent="resetFilters">
463
- {{ localisations.clearFilters }}
464
- </cl-ui-button>
465
- </div>
466
- </div>
467
- </td>
468
- </tr>
469
- </tbody>
470
- </table>
471
- </div>
472
-
473
- <cl-ui-grid-footer v-model:request="currentRequest"
474
- :localisations="localisations"
475
- :data="data" />
476
- </div>
477
- </template>