@zeedhi/teknisa-components-vuetify 3.0.0 → 3.0.1

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 (59) hide show
  1. package/.package.json +10 -7
  2. package/dist/teknisa-vuetify.css +1 -1
  3. package/dist/teknisa-vuetify.js +3777 -14
  4. package/package.json +3 -3
  5. package/src/components/index.ts +22 -0
  6. package/src/components/public.ts +14 -18
  7. package/src/components/tek-grid/TekGrid.ts +318 -0
  8. package/src/components/tek-grid/TekGrid.vue +235 -0
  9. package/src/components/tek-grid/column-filter/TekGridColumnFilter.ts +244 -0
  10. package/src/components/tek-grid/column-filter/TekGridColumnFilter.vue +93 -0
  11. package/src/components/tek-grid/column-header/TekGridHeaderRow.ts +147 -0
  12. package/src/components/tek-grid/column-header/TekGridHeaderRow.vue +78 -0
  13. package/src/components/tek-grid/columns-button/TekGridColumnsButton.ts +96 -0
  14. package/src/components/tek-grid/columns-button/TekGridColumnsButton.vue +273 -0
  15. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsController.ts +470 -0
  16. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsModal.ts +513 -0
  17. package/src/components/tek-grid/filter-button/TekGridFilterButton.ts +47 -0
  18. package/src/components/tek-grid/filter-button/TekGridFilterButton.vue +28 -0
  19. package/src/components/tek-grid/indentation/TekGridIndentation.ts +21 -0
  20. package/src/components/tek-grid/indentation/TekGridIndentation.vue +33 -0
  21. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.ts +119 -0
  22. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.vue +172 -0
  23. package/src/components/tek-grid/row/TekGridFooterRow.ts +62 -0
  24. package/src/components/tek-grid/row/TekGridFooterRow.vue +64 -0
  25. package/src/components/tek-grid/row/TekGridGroupRow.ts +65 -0
  26. package/src/components/tek-grid/row/TekGridGroupRow.vue +65 -0
  27. package/src/components/tek-user-info/TekUserInfo.ts +51 -0
  28. package/src/components/tek-user-info/TekUserInfo.vue +53 -0
  29. package/src/components/tek-user-info/TekUserInfoList.ts +39 -0
  30. package/src/components/tek-user-info/TekUserInfoList.vue +12 -0
  31. package/src/composables/useTableLayout.ts +290 -0
  32. package/src/utils/isArrayOperation.ts +5 -0
  33. package/types/components/public.d.ts +8 -1
  34. package/types/components/tek-grid/TekGrid.d.ts +7211 -0
  35. package/types/components/tek-grid/TekGrid.ts.d.ts +7211 -0
  36. package/types/components/tek-grid/column-filter/TekGridColumnFilter.d.ts +130 -0
  37. package/types/components/tek-grid/column-filter/TekGridColumnFilter.ts.d.ts +130 -0
  38. package/types/components/tek-grid/column-header/TekGridHeaderRow.d.ts +225 -0
  39. package/types/components/tek-grid/column-header/TekGridHeaderRow.ts.d.ts +225 -0
  40. package/types/components/tek-grid/columns-button/TekGridColumnsButton.d.ts +2432 -0
  41. package/types/components/tek-grid/columns-button/TekGridColumnsButton.ts.d.ts +2432 -0
  42. package/types/components/tek-grid/columns-button/TekGridColumnsOptionsController.d.ts +66 -0
  43. package/types/components/tek-grid/columns-button/TekGridColumnsOptionsModal.d.ts +9 -0
  44. package/types/components/tek-grid/filter-button/TekGridFilterButton.d.ts +2920 -0
  45. package/types/components/tek-grid/filter-button/TekGridFilterButton.ts.d.ts +2920 -0
  46. package/types/components/tek-grid/indentation/TekGridIndentation.d.ts +32 -0
  47. package/types/components/tek-grid/indentation/TekGridIndentation.ts.d.ts +32 -0
  48. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.d.ts +1893 -0
  49. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.ts.d.ts +1893 -0
  50. package/types/components/tek-grid/row/TekGridFooterRow.d.ts +90 -0
  51. package/types/components/tek-grid/row/TekGridFooterRow.ts.d.ts +90 -0
  52. package/types/components/tek-grid/row/TekGridGroupRow.d.ts +87 -0
  53. package/types/components/tek-grid/row/TekGridGroupRow.ts.d.ts +87 -0
  54. package/types/components/tek-user-info/TekUserInfo.d.ts +1940 -0
  55. package/types/components/tek-user-info/TekUserInfo.ts.d.ts +1940 -0
  56. package/types/components/tek-user-info/TekUserInfoList.d.ts +1015 -0
  57. package/types/components/tek-user-info/TekUserInfoList.ts.d.ts +1015 -0
  58. package/types/composables/useTableLayout.d.ts +26 -0
  59. package/types/utils/isArrayOperation.d.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/teknisa-components-vuetify",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Teknisa Components based on Vuetify",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -19,7 +19,7 @@
19
19
  "watch": "rollup -cw"
20
20
  },
21
21
  "dependencies": {
22
- "@zeedhi/teknisa-components-common": "^3.0.0",
22
+ "@zeedhi/teknisa-components-common": "^3.0.1",
23
23
  "@zeedhi/vuetify": "^3.0.0",
24
24
  "@zeedhi/zd-user-info-common": "^3.0.0",
25
25
  "@zeedhi/zd-user-info-vue": "^3.0.0",
@@ -42,7 +42,7 @@
42
42
  "rollup-plugin-vue": "^6.0.0",
43
43
  "ts-jest": "26.5.*"
44
44
  },
45
- "gitHead": "8f96c641dd2a27edfd63eadf165843c9499d32b0",
45
+ "gitHead": "1c6ee6c23a7e75036a459ada909c934d00f63373",
46
46
  "env": {
47
47
  "NODE_ENV": "production"
48
48
  }
@@ -2,11 +2,33 @@ import type { App, DefineComponent } from 'vue';
2
2
  import type { IDictionary } from '@zeedhi/core';
3
3
 
4
4
  import TekBreadcrumbHeader from './tek-breadcrumb-header/TekBreadcrumbHeader.vue';
5
+ import TekGrid from './tek-grid/TekGrid.vue';
6
+ import TekGridColumnFilter from './tek-grid/column-filter/TekGridColumnFilter.vue';
7
+ import TekGridHeaderRow from './tek-grid/column-header/TekGridHeaderRow.vue';
8
+ import TekGridColumnsButton from './tek-grid/columns-button/TekGridColumnsButton.vue';
9
+ import TekGridFilterButton from './tek-grid/filter-button/TekGridFilterButton.vue';
10
+ import TekGridIndentation from './tek-grid/indentation/TekGridIndentation.vue';
11
+ import TekGridLayoutOptions from './tek-grid/layout-options/TekGridLayoutOptions.vue';
12
+ import TekGridFooterRow from './tek-grid/row/TekGridFooterRow.vue';
13
+ import TekGridGroupRow from './tek-grid/row/TekGridGroupRow.vue';
14
+ import TekUserInfo from './tek-user-info/TekUserInfo.vue';
15
+ import TekUserInfoList from './tek-user-info/TekUserInfoList.vue';
5
16
 
6
17
  export * from './tek-breadcrumb-header/TekBreadcrumbHeader';
7
18
 
8
19
  export const components: IDictionary<DefineComponent<any, any, any>> = {
9
20
  TekBreadcrumbHeader,
21
+ TekGrid,
22
+ TekGridColumnFilter,
23
+ TekGridHeaderRow,
24
+ TekGridColumnsButton,
25
+ TekGridFilterButton,
26
+ TekGridIndentation,
27
+ TekGridLayoutOptions,
28
+ TekGridFooterRow,
29
+ TekGridGroupRow,
30
+ TekUserInfo,
31
+ TekUserInfoList,
10
32
  };
11
33
 
12
34
  export function RegisterComponents(app: App) {
@@ -5,20 +5,18 @@ import TekBreadcrumbHeader from './tek-breadcrumb-header/TekBreadcrumbHeader';
5
5
  // import TekCrudDeleteButton from './crud/TekCrudDeleteButton';
6
6
  // import TekCrudForm from './crud/TekCrudForm';
7
7
  // import TekCrudSaveButton from './crud/TekCrudSaveButton';
8
- // import TekGrid from './tek-grid/TekGrid';
9
- // import TekGridCellIdentation from './tek-grid/subcomponents/TekGridCellIdentation';
10
- // import TekGridHeaderIndentation from './tek-grid/subcomponents/TekGridHeaderIndentation';
11
- // import TekGridColumnFilter from './tek-grid/subcomponents/TekGridColumnFilter';
8
+ import TekGrid from './tek-grid/TekGrid';
9
+ import TekGridColumnFilter from './tek-grid/column-filter/TekGridColumnFilter';
12
10
  // import TekDragGrid from './tek-drag-grid/TekDragGrid';
13
- // import TekGridColumnsButton from './tek-grid/TekGridColumnsButton';
14
- // import TekGridFilterButton from './tek-grid/TekGridFilterButton';
15
- // import TekGridLayoutOptions from './tek-grid/TekGridLayoutOptions';
11
+ import TekGridColumnsButton from './tek-grid/columns-button/TekGridColumnsButton';
12
+ import TekGridFilterButton from './tek-grid/filter-button/TekGridFilterButton';
13
+ import TekGridLayoutOptions from './tek-grid/layout-options/TekGridLayoutOptions';
16
14
  // import TekImage from './tek-image/TekImage';
17
15
  // import TekIterableComponentRender from './tek-iterable-component-render/TekIterableComponentRender';
18
16
  // import TekProductCard from './tek-product-card/TekProductCard';
19
17
  // import TekTreeGrid from './tek-tree-grid/TekTreeGrid';
20
- // import TekUserInfo from './tek-user-info/TekUserInfo';
21
- // import TekUserInfoList from './tek-user-info/TekUserInfoList';
18
+ import TekUserInfo from './tek-user-info/TekUserInfo';
19
+ import TekUserInfoList from './tek-user-info/TekUserInfoList';
22
20
 
23
21
  export {
24
22
  TekBreadcrumbHeader,
@@ -28,18 +26,16 @@ export {
28
26
  // TekCrudDeleteButton,
29
27
  // TekCrudForm,
30
28
  // TekCrudSaveButton,
31
- // TekGrid,
32
- // TekGridCellIdentation,
33
- // TekGridHeaderIndentation,
34
- // TekGridColumnFilter,
29
+ TekGrid,
30
+ TekGridColumnFilter,
35
31
  // TekDragGrid,
36
- // TekGridColumnsButton,
37
- // TekGridFilterButton,
38
- // TekGridLayoutOptions,
32
+ TekGridColumnsButton,
33
+ TekGridFilterButton,
34
+ TekGridLayoutOptions,
39
35
  // TekImage,
40
36
  // TekProductCard,
41
37
  // TekIterableComponentRender,
42
38
  // TekTreeGrid,
43
- // TekUserInfo,
44
- // TekUserInfoList,
39
+ TekUserInfo,
40
+ TekUserInfoList,
45
41
  };
@@ -0,0 +1,318 @@
1
+ import {
2
+ IDynamicFilterItem,
3
+ ITekConfig,
4
+ ITekGridGroupFooter,
5
+ ITekGridGroupHeader,
6
+ TekGrid,
7
+ TekMemoryDatasource,
8
+ TekRestDatasource,
9
+ } from '@zeedhi/teknisa-components-common';
10
+ import { Config, IDictionary, Utils } from '@zeedhi/core';
11
+ import cloneDeep from 'lodash.clonedeep';
12
+ import debounce from 'lodash.debounce';
13
+ import { ComponentPublicInstance, computed, defineComponent, nextTick } from 'vue';
14
+ import { buildProps, useGridColumns, getRootElement, useCreateInstance, ZdGridEditableProps, useGridEditableInstance } from '@zeedhi/vuetify';
15
+ import { provideTableLayout } from '../../composables/useTableLayout'
16
+
17
+ export const TekGridProps = buildProps({
18
+ ...ZdGridEditableProps,
19
+ toolbarSlot: {
20
+ type: Array,
21
+ default: undefined,
22
+ },
23
+ title: {
24
+ type: String,
25
+ default: '',
26
+ },
27
+ addButton: {
28
+ type: [Boolean, String],
29
+ default: false,
30
+ },
31
+ deleteButton: {
32
+ type: [String, Boolean],
33
+ default: 'none',
34
+ },
35
+ columnsButton: {
36
+ type: [Boolean, String],
37
+ default: false,
38
+ },
39
+ columnsButtonIgnore: {
40
+ type: [Array, String],
41
+ default: () => [],
42
+ },
43
+ showEditButtons: {
44
+ type: [Boolean, String],
45
+ default: true,
46
+ },
47
+ filterButton: {
48
+ type: [Boolean, String],
49
+ default: false,
50
+ },
51
+ modalFilterProps: {
52
+ type: Object,
53
+ default: () => ({}),
54
+ },
55
+ showSearch: {
56
+ type: [Boolean, String],
57
+ default: true,
58
+ },
59
+ columnFilterButton: {
60
+ type: [Boolean, String],
61
+ default: false,
62
+ },
63
+ hideActions: {
64
+ type: [Boolean, String],
65
+ default: false,
66
+ },
67
+ actions: {
68
+ type: Array,
69
+ default: () => [],
70
+ },
71
+ dragColumns: {
72
+ type: [Boolean, String],
73
+ default: true,
74
+ },
75
+ resizeColumns: {
76
+ type: [Boolean, String],
77
+ default: true,
78
+ },
79
+ showLayoutOptions: {
80
+ type: [Boolean, String],
81
+ default: true,
82
+ },
83
+ showExport: {
84
+ type: [String, Boolean],
85
+ default: false,
86
+ },
87
+ showReload: {
88
+ type: [Boolean, String],
89
+ default: true,
90
+ },
91
+ exportConfig: {
92
+ type: Array,
93
+ },
94
+ exportActions: {
95
+ type: Array,
96
+ },
97
+ groupsOpened: {
98
+ type: [Boolean, String],
99
+ default: false,
100
+ },
101
+ showSummaryTotal: {
102
+ type: [Boolean, String],
103
+ default: true,
104
+ },
105
+ mainGrid: {
106
+ type: [Boolean, String],
107
+ default: true,
108
+ },
109
+ xlsDefaultType: {
110
+ type: String,
111
+ default: undefined,
112
+ },
113
+ showCheckboxAllFilter: {
114
+ type: [Boolean, String],
115
+ default: (Config as ITekConfig).gridShowCheckboxAllFilter,
116
+ },
117
+ toolbarOpened: {
118
+ type: [Boolean],
119
+ default: true,
120
+ },
121
+ defaultFilter: {
122
+ type: Object,
123
+ },
124
+ reportTitle: {
125
+ type: String,
126
+ },
127
+ editNewRowsOnly: {
128
+ type: [Boolean, String],
129
+ default: false,
130
+ },
131
+ });
132
+
133
+ const gridEditableComponent = defineComponent({
134
+ props: TekGridProps,
135
+ inheritAttrs: false,
136
+ setup(props, ctx) {
137
+ const { instance, root } = useCreateInstance<TekGrid, ComponentPublicInstance>(props, ctx, TekGrid);
138
+
139
+ const renderedData = computed(() => {
140
+ if (instance.isGrouped()) {
141
+ return instance.getGroupedData();
142
+ }
143
+ return instance.getData();
144
+ });
145
+
146
+ const visibleData = computed(() => {
147
+ return renderedData.value.filter((row) => instance.isItemVisible(row));
148
+ });
149
+
150
+ const gridEditableScope = useGridEditableInstance({ instance, root, renderedData: visibleData });
151
+
152
+ const rootEl = getRootElement(root);
153
+ const { visibleColumns } = useGridColumns({
154
+ instance,
155
+ rootEl,
156
+ visibilityCondition: (column: any) => column.isVisible && !column.grouped,
157
+ });
158
+
159
+ provideTableLayout({ instance, rootEl });
160
+
161
+ const debouncedDatasourceGet = debounce((instance) => {
162
+ const event = new Event('change', { cancelable: true });
163
+ instance.callEvent('beforeApplyFilter', { component: instance, event });
164
+ if (event.defaultPrevented) return;
165
+
166
+ const { datasource } = instance;
167
+ if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
168
+ datasource.updateDynamicFilter();
169
+ } else {
170
+ datasource.get();
171
+ }
172
+ }, 500);
173
+
174
+ const filter = computed<IDictionary<IDynamicFilterItem[]>>(() => {
175
+ if (instance.datasource instanceof TekRestDatasource || instance.datasource instanceof TekMemoryDatasource) {
176
+ return instance.datasource.dynamicFilter;
177
+ }
178
+
179
+ const datasourceFilter = instance.datasource.filter;
180
+ const simpleFilter: IDictionary<IDynamicFilterItem[]> = {};
181
+ Object.keys(datasourceFilter).forEach((key) => {
182
+ simpleFilter[key] = [{ relation: 'AND', operation: 'CONTAINS', value: datasourceFilter[key] }];
183
+ });
184
+ return simpleFilter;
185
+ });
186
+
187
+ const setFilter = (newFilter: IDictionary<IDynamicFilterItem[]>) => {
188
+ if (Utils.isEqual(filter, newFilter)) return;
189
+
190
+ if (instance.datasource instanceof TekRestDatasource || instance.datasource instanceof TekMemoryDatasource) {
191
+ instance.datasource.dynamicFilter = cloneDeep(newFilter);
192
+ } else {
193
+ const normalFilter: IDictionary<any> = {};
194
+ Object.keys(newFilter).forEach((key) => {
195
+ if (!newFilter[key][0].value) return;
196
+
197
+ normalFilter[key] = newFilter[key][0].value;
198
+ });
199
+ instance.datasource.filter = normalFilter;
200
+ }
201
+ debouncedDatasourceGet(instance);
202
+ instance.changeLayout();
203
+ };
204
+
205
+ const columnHasFilter = (columnName: string) => {
206
+ return instance.columnHasFilter(columnName);
207
+ };
208
+
209
+ const isRowVisible = (row: IDictionary<any>, index: number) => {
210
+ return instance.isItemVisible(row) && gridEditableScope.shouldRender(index);
211
+ };
212
+
213
+ const isCurrentRowGroup = (row: IDictionary<any>) => {
214
+ const { uniqueKey, currentRow } = instance.datasource;
215
+
216
+ return !!(
217
+ (row.group && row.groupValue === currentRow.groupValue) ||
218
+ (row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey])
219
+ );
220
+ };
221
+
222
+ const isGroupSelectIndeterminate = (item: ITekGridGroupHeader) => {
223
+ let hasSelected = false;
224
+ let hasNotSelected = false;
225
+ const { uniqueKey } = instance.datasource;
226
+ item.children.forEach((child) => {
227
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
228
+ hasSelected = hasSelected || idx !== -1;
229
+ hasNotSelected = hasNotSelected || idx === -1;
230
+ });
231
+ return hasSelected && hasNotSelected;
232
+ };
233
+
234
+ const isGroupSelected = (item: ITekGridGroupHeader) => {
235
+ return item.children.every((child) => {
236
+ const { uniqueKey } = instance.datasource;
237
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
238
+ return idx !== -1;
239
+ });
240
+ };
241
+
242
+ const selectGroupRowClick = (row: IDictionary<any>, isSelected: boolean, event: Event) => {
243
+ nextTick(() => {
244
+ const rootElement = getRootElement(root);
245
+ instance.selectGroupClick(row, isSelected, event, rootElement.value);
246
+ });
247
+ };
248
+
249
+ const selectGroup = (item: ITekGridGroupHeader, event: Event) => {
250
+ const { uniqueKey } = instance.datasource;
251
+ const isSelected = isGroupSelected(item);
252
+ if (!isSelected) {
253
+ // here we fetch the item from renderedData because vuetify isSelected checks for object reference
254
+ // so we need to find the item inside renderedData to call selectRow() with the correct reference
255
+ // https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/components/VDataTable/composables/select.ts#L128
256
+ const items = item.children.map((child) => {
257
+ return renderedData.value.find((row) => child[uniqueKey] === row[uniqueKey]);
258
+ });
259
+
260
+ items.forEach((child) => {
261
+ if (!child) return;
262
+
263
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
264
+ if (idx === -1) {
265
+ instance.selectRow(child, true);
266
+ }
267
+ });
268
+ } else {
269
+ item.children.forEach((child) => {
270
+ const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
271
+ if (idx !== -1) {
272
+ instance.selectRow(child, false);
273
+ }
274
+ });
275
+ }
276
+ selectGroupRowClick(item, !isSelected, event);
277
+ };
278
+
279
+ const openGroup = (item: ITekGridGroupHeader) => {
280
+ instance.openGroup(item);
281
+ };
282
+
283
+ const isGroup = (item: IDictionary<any>): item is ITekGridGroupHeader => {
284
+ return !!item.group;
285
+ };
286
+
287
+ const isFooter = (item: IDictionary<any>): item is ITekGridGroupFooter => {
288
+ return !!item.groupFooter;
289
+ };
290
+
291
+ const groupColumnNames = computed(() => {
292
+ return instance.columns.filter((column) => column.grouped).map((column) => column.name) || [];
293
+ });
294
+
295
+ return {
296
+ ...gridEditableScope,
297
+ instance,
298
+ root,
299
+ filter,
300
+ setFilter,
301
+ columnHasFilter,
302
+ visibleColumns,
303
+ isRowVisible,
304
+ isCurrentRowGroup,
305
+ isGroupSelectIndeterminate,
306
+ selectGroup,
307
+ isGroup,
308
+ openGroup,
309
+ renderedData,
310
+ isGroupSelected,
311
+ groupColumnNames,
312
+ isFooter,
313
+ visibleData,
314
+ };
315
+ },
316
+ });
317
+
318
+ export default gridEditableComponent;
@@ -0,0 +1,235 @@
1
+ <template>
2
+ <v-data-table
3
+ v-show="instance.isVisible"
4
+ ref="root"
5
+ :id="instance.name"
6
+ v-model="selectedRows"
7
+ :class="[
8
+ 'zd-grid',
9
+ 'tek-grid',
10
+ 'zd-grid-editable',
11
+ instance.cssClass,
12
+ {
13
+ 'zd-grid--loading': instance.datasource.loading,
14
+ 'zd-grid--cell-selection': instance.cellSelection,
15
+ },
16
+ ]"
17
+ :style="[
18
+ cssColorVars,
19
+ {
20
+ height: $formatSize(instance.height),
21
+ width: $formatSize(instance.width),
22
+ maxHeight: $formatSize(instance.maxHeight),
23
+ minHeight: $formatSize(instance.minHeight),
24
+ maxWidth: $formatSize(instance.maxWidth),
25
+ minWidth: $formatSize(instance.minWidth),
26
+ },
27
+ $styleObject(instance.cssStyle),
28
+ ]"
29
+ :theme="instance.theme"
30
+ sort-asc-icon="$collapse"
31
+ sort-desc-icon="$expand"
32
+ fixed-header
33
+ multi-sort
34
+ hide-default-footer
35
+ :name="instance.name"
36
+ :headers="headers"
37
+ :items="renderedData"
38
+ :search="instance.datasource.search"
39
+ :density="instance.dense ? 'compact' : 'default'"
40
+ :loading="instance.datasource.loading"
41
+ :item-value="instance.datasource.uniqueKey"
42
+ :items-per-page="-1"
43
+ no-filter
44
+ :sort-by="sortBy"
45
+ disable-sort
46
+ return-object
47
+ tabindex="0"
48
+ @update:sort-by="updateSortBy($event)"
49
+ >
50
+ <template v-slot:top>
51
+ <zd-grid-toolbar v-if="!hasToolbarSlot"></zd-grid-toolbar>
52
+ <slot name="toolbarSlot"></slot>
53
+ </template>
54
+
55
+ <template
56
+ v-slot:headers="{ columns: tableColumns, isSorted, getSortIcon, toggleSort, sortBy }"
57
+ >
58
+ <tek-grid-header-row
59
+ v-if="instance.showHeader"
60
+ :name="instance.name"
61
+ :selectable="instance.selectable"
62
+ :headerBackground="instance.headerBackground"
63
+ :showSelectAll="instance.showSelectAll"
64
+ :allselectedState="allselectedState"
65
+ :visibleColumns="visibleColumns"
66
+ :dragColumns="instance.dragColumns"
67
+ :headerCellTextColor="instance.headerCellTextColor"
68
+ :resizeColumns="instance.resizeColumns"
69
+ :getSortIcon="getSortIcon"
70
+ :toggleSort="toggleSort"
71
+ :sortBy="sortBy"
72
+ :tableColumns="tableColumns"
73
+ :isSorted="isSorted"
74
+ :disableCheckbox="instance.editing"
75
+ :instanceName="instance.name"
76
+ :filterRelationsDatasource="instance.filterRelationsDatasource"
77
+ :filterOperationsDatasource="instance.filterOperationsDatasource"
78
+ :modelValue="filter"
79
+ :columnFilterButton="instance.columnFilterButton"
80
+ :columnHasFilter="columnHasFilter"
81
+ :level="groupColumnNames.length"
82
+ @update:modelValue="setFilter($event)"
83
+ @resizeMousedown="resizeMouseDownHandler($event.column, $event.event)"
84
+ @resizeClick="resizeClickHandler($event.event)"
85
+ @selectAllClick="selectAllClick($event)"
86
+ ></tek-grid-header-row>
87
+ </template>
88
+
89
+ <template
90
+ v-if="addTopPadding()"
91
+ v-slot:body.prepend="{ headers }"
92
+ >
93
+ <tr>
94
+ <td
95
+ :colspan="headers.length"
96
+ :style="`padding-top:${scrollData.startHeight}px`"
97
+ >
98
+ </td>
99
+ </tr>
100
+ </template>
101
+
102
+ <template
103
+ v-if="addBottomPadding()"
104
+ v-slot:body.append="{ headers }"
105
+ >
106
+ <tr>
107
+ <td
108
+ :colspan="headers.length"
109
+ :style="`padding-top:${scrollData.endHeight}px`"
110
+ >
111
+ </td>
112
+ </tr>
113
+ </template>
114
+
115
+ <template
116
+ v-if="instance.datasource.data.length"
117
+ v-slot:body="{ internalItems, isSelected }"
118
+ >
119
+ <template v-for="(item, i) in visibleData">
120
+ <template v-if="isRowVisible(item, i)">
121
+ <tek-grid-group-row
122
+ v-if="isGroup(item)"
123
+ :key="item.groupColumnName + item.groupValue"
124
+ :row="item"
125
+ :is-current-row="isCurrentRowGroup(item)"
126
+ :selectable="instance.selectable"
127
+ :selectionDisabled="instance.callDisableSelection(item)"
128
+ :cellSelection="instance.cellSelection"
129
+ :is-current="isCurrent"
130
+ :isSelected="isGroupSelected(item)"
131
+ :indeterminate="isGroupSelectIndeterminate(item)"
132
+ @click="rowClick(item, $event)"
133
+ @checkboxClick="selectGroup(item, $event)"
134
+ @focusin="cellFocusIn($event)"
135
+ @expandClick="openGroup(item)"
136
+ ></tek-grid-group-row>
137
+
138
+ <zd-grid-editable-row
139
+ v-else-if="!isFooter(item)"
140
+ :key="instance.getRowKey(item)"
141
+ :isSelected="isSelected(internalItems[i])"
142
+ :isCurrentRow="isCurrentRow(item)"
143
+ :selectable="instance.selectable"
144
+ :selectionDisabled="instance.callDisableSelection(item)"
145
+ :cellSelection="instance.cellSelection"
146
+ :isCurrent="isCurrent"
147
+ :columns="visibleColumns"
148
+ :row="item"
149
+ :fixedLeft="fixedLeft"
150
+ :fixedRight="fixedRight"
151
+ :isEditing="isEditing"
152
+ @cellFocus="cellFocus($event)"
153
+ @cellClick="cellClick($event)"
154
+ @click="rowClick(item, $event)"
155
+ @focusin="cellFocusIn($event)"
156
+ @checkboxClick="selectRowClick(item, !isSelected(internalItems[i]), $event)"
157
+ @cellEnterEdit="cellEnterEdit($event)"
158
+ @cellKeydown="cellKeydown($event)"
159
+ >
160
+ <template #cell-prepend="{ index }">
161
+ <tek-grid-indentation
162
+ v-if="index === 0 && groupColumnNames.length > 0"
163
+ :level="item.groupHeaders?.length"
164
+ ></tek-grid-indentation>
165
+ </template>
166
+ </zd-grid-editable-row>
167
+
168
+ <tek-grid-footer-row
169
+ v-else
170
+ :key="'footer' + item.groupColumnName + item.groupValue"
171
+ :isSelected="isSelected(internalItems[i])"
172
+ :selectable="instance.selectable"
173
+ :selectionDisabled="instance.callDisableSelection(item)"
174
+ :cellSelection="instance.cellSelection"
175
+ :isCurrent="isCurrent"
176
+ :columns="visibleColumns"
177
+ :row="item"
178
+ :fixedLeft="fixedLeft"
179
+ :fixedRight="fixedRight"
180
+ @cellFocus="cellFocus($event)"
181
+ @focusin="cellFocusIn($event)"
182
+ ></tek-grid-footer-row>
183
+ </template>
184
+ </template>
185
+ </template>
186
+
187
+ <template v-slot:no-data>
188
+ <zd-iterable-no-data>
189
+ <template v-slot:errorSlot>
190
+ <slot name="errorSlot"></slot>
191
+ </template>
192
+ <template v-slot:noResultSlot>
193
+ <slot name="noResultSlot"></slot>
194
+ </template>
195
+ <template v-slot:noDataSlot>
196
+ <slot name="noDataSlot"></slot>
197
+ </template>
198
+ </zd-iterable-no-data>
199
+ </template>
200
+
201
+ <template v-slot:bottom>
202
+ <zd-grid-footer v-if="instance.showFooter && !hasFooterSlot"></zd-grid-footer>
203
+ <slot name="footerSlot"></slot>
204
+ </template>
205
+ </v-data-table>
206
+ </template>
207
+
208
+ <script lang="ts" src="./TekGrid.ts"></script>
209
+
210
+ <style lang="scss">
211
+ .tek-grid {
212
+ .zd-grid__row:not(.tek-grid-group-row) {
213
+ :nth-child(1 of td:not(.zd-grid__selectable-cell)) {
214
+ display: flex;
215
+ }
216
+ }
217
+
218
+ .is-rotated {
219
+ transform: rotate(180deg);
220
+ transition: transform 0.3s ease;
221
+ }
222
+
223
+ .zd-grid__toolbar {
224
+ height: 38px;
225
+
226
+ .toolbar-divider {
227
+ margin: 10px;
228
+ }
229
+
230
+ .zd-search {
231
+ width: 200px;
232
+ }
233
+ }
234
+ }
235
+ </style>