@zeedhi/teknisa-components-vuetify 3.0.4 → 3.2.0

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 (87) hide show
  1. package/dist/teknisa-components-vuetify.es.js +3234 -0
  2. package/dist/teknisa-vuetify.css +1 -1
  3. package/dist/types/components/index.d.ts +6 -0
  4. package/dist/types/components/public.d.ts +11 -0
  5. package/dist/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.d.ts +3 -0
  6. package/dist/types/components/tek-grid/TekGrid.d.ts +3 -0
  7. package/dist/types/components/tek-grid/column-filter/TekGridColumnFilter.d.ts +36 -0
  8. package/dist/types/components/tek-grid/column-header/TekGridHeaderRow.d.ts +2 -0
  9. package/dist/types/components/tek-grid/columns-button/TekGridColumnsButton.d.ts +3 -0
  10. package/{types → dist/types}/components/tek-grid/columns-button/TekGridColumnsOptionsController.d.ts +67 -66
  11. package/{types → dist/types}/components/tek-grid/columns-button/TekGridColumnsOptionsModal.d.ts +10 -9
  12. package/dist/types/components/tek-grid/filter-button/TekGridFilterButton.d.ts +3 -0
  13. package/dist/types/components/tek-grid/indentation/TekGridIndentation.d.ts +2 -0
  14. package/dist/types/components/tek-grid/layout-options/TekGridLayoutOptions.d.ts +3 -0
  15. package/dist/types/components/tek-grid/row/TekGridFooterRow.d.ts +2 -0
  16. package/dist/types/components/tek-grid/row/TekGridGroupRow.d.ts +2 -0
  17. package/dist/types/components/tek-loading/TekLoading.d.ts +3 -0
  18. package/dist/types/components/tek-user-info/TekUserInfo.d.ts +3 -0
  19. package/dist/types/components/tek-user-info/TekUserInfoList.d.ts +2 -0
  20. package/{types → dist/types}/composables/useTableLayout.d.ts +26 -26
  21. package/{types → dist/types}/index.d.ts +5 -6
  22. package/{types → dist/types}/utils/isArrayOperation.d.ts +2 -2
  23. package/package.json +40 -20
  24. package/src/index.ts +5 -3
  25. package/dist/teknisa-vuetify.js +0 -3885
  26. package/environments.json +0 -16
  27. package/jest.config.js +0 -31
  28. package/rollup.scss.config.js +0 -13
  29. package/src/components/index.ts +0 -38
  30. package/src/components/public.ts +0 -41
  31. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts +0 -34
  32. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.vue +0 -76
  33. package/src/components/tek-grid/TekGrid.ts +0 -318
  34. package/src/components/tek-grid/TekGrid.vue +0 -235
  35. package/src/components/tek-grid/column-filter/TekGridColumnFilter.ts +0 -244
  36. package/src/components/tek-grid/column-filter/TekGridColumnFilter.vue +0 -93
  37. package/src/components/tek-grid/column-header/TekGridHeaderRow.ts +0 -147
  38. package/src/components/tek-grid/column-header/TekGridHeaderRow.vue +0 -78
  39. package/src/components/tek-grid/columns-button/TekGridColumnsButton.ts +0 -96
  40. package/src/components/tek-grid/columns-button/TekGridColumnsButton.vue +0 -273
  41. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsController.ts +0 -470
  42. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsModal.ts +0 -513
  43. package/src/components/tek-grid/filter-button/TekGridFilterButton.ts +0 -47
  44. package/src/components/tek-grid/filter-button/TekGridFilterButton.vue +0 -28
  45. package/src/components/tek-grid/indentation/TekGridIndentation.ts +0 -21
  46. package/src/components/tek-grid/indentation/TekGridIndentation.vue +0 -33
  47. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.ts +0 -119
  48. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.vue +0 -172
  49. package/src/components/tek-grid/row/TekGridFooterRow.ts +0 -62
  50. package/src/components/tek-grid/row/TekGridFooterRow.vue +0 -64
  51. package/src/components/tek-grid/row/TekGridGroupRow.ts +0 -65
  52. package/src/components/tek-grid/row/TekGridGroupRow.vue +0 -65
  53. package/src/components/tek-user-info/TekUserInfo.ts +0 -51
  54. package/src/components/tek-user-info/TekUserInfo.vue +0 -53
  55. package/src/components/tek-user-info/TekUserInfoList.ts +0 -39
  56. package/src/components/tek-user-info/TekUserInfoList.vue +0 -12
  57. package/src/composables/useTableLayout.ts +0 -290
  58. package/src/shims-vue.d.ts +0 -6
  59. package/src/styles/index.scss +0 -0
  60. package/src/utils/isArrayOperation.ts +0 -5
  61. package/tsconfig.eslint.json +0 -9
  62. package/types/components/index.d.ts +0 -5
  63. package/types/components/public.d.ts +0 -9
  64. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.d.ts +0 -1138
  65. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts.d.ts +0 -1138
  66. package/types/components/tek-grid/TekGrid.d.ts +0 -7211
  67. package/types/components/tek-grid/TekGrid.ts.d.ts +0 -7211
  68. package/types/components/tek-grid/column-filter/TekGridColumnFilter.d.ts +0 -130
  69. package/types/components/tek-grid/column-filter/TekGridColumnFilter.ts.d.ts +0 -130
  70. package/types/components/tek-grid/column-header/TekGridHeaderRow.d.ts +0 -225
  71. package/types/components/tek-grid/column-header/TekGridHeaderRow.ts.d.ts +0 -225
  72. package/types/components/tek-grid/columns-button/TekGridColumnsButton.d.ts +0 -2432
  73. package/types/components/tek-grid/columns-button/TekGridColumnsButton.ts.d.ts +0 -2432
  74. package/types/components/tek-grid/filter-button/TekGridFilterButton.d.ts +0 -2920
  75. package/types/components/tek-grid/filter-button/TekGridFilterButton.ts.d.ts +0 -2920
  76. package/types/components/tek-grid/indentation/TekGridIndentation.d.ts +0 -32
  77. package/types/components/tek-grid/indentation/TekGridIndentation.ts.d.ts +0 -32
  78. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.d.ts +0 -1893
  79. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.ts.d.ts +0 -1893
  80. package/types/components/tek-grid/row/TekGridFooterRow.d.ts +0 -90
  81. package/types/components/tek-grid/row/TekGridFooterRow.ts.d.ts +0 -90
  82. package/types/components/tek-grid/row/TekGridGroupRow.d.ts +0 -87
  83. package/types/components/tek-grid/row/TekGridGroupRow.ts.d.ts +0 -87
  84. package/types/components/tek-user-info/TekUserInfo.d.ts +0 -1940
  85. package/types/components/tek-user-info/TekUserInfo.ts.d.ts +0 -1940
  86. package/types/components/tek-user-info/TekUserInfoList.d.ts +0 -1015
  87. package/types/components/tek-user-info/TekUserInfoList.ts.d.ts +0 -1015
package/environments.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "development": {
3
- "dependencies": {
4
- "@zeedhi/vuetify": "file:../../../zeedhi-vue/packages/vuetify",
5
- "@zeedhi/zd-user-info-common": "file:../../../userinfo/packages/common",
6
- "@zeedhi/zd-user-info-vue": "file:../../../userinfo/packages/vue"
7
- }
8
- },
9
- "production": {
10
- "dependencies": {
11
- "@zeedhi/vuetify": "^3.0.0",
12
- "@zeedhi/zd-user-info-common": "^3.0.0",
13
- "@zeedhi/zd-user-info-vue": "^3.0.0"
14
- }
15
- }
16
- }
package/jest.config.js DELETED
@@ -1,31 +0,0 @@
1
- module.exports = {
2
- moduleFileExtensions: [
3
- 'js',
4
- 'jsx',
5
- 'json',
6
- 'vue',
7
- 'ts',
8
- 'tsx'
9
- ],
10
- transform: {
11
- '^.+\\.vue$': 'vue-jest',
12
- '^.+\\.tsx?$': 'ts-jest'
13
- },
14
- transformIgnorePatterns: [
15
- '/node_modules/'
16
- ],
17
- moduleNameMapper: {
18
- '^@/(.*)$': '<rootDir>/src/$1'
19
- },
20
- snapshotSerializers: [
21
- 'jest-serializer-vue'
22
- ],
23
- testMatch: [
24
- '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
25
- ],
26
- testURL: 'http://localhost/',
27
- watchPlugins: [
28
- 'jest-watch-typeahead/filename',
29
- 'jest-watch-typeahead/testname'
30
- ]
31
- }
@@ -1,13 +0,0 @@
1
- import scss from 'rollup-plugin-scss';
2
-
3
- export default {
4
- input: './src/styles/index.scss',
5
- output: {
6
- format: 'esm',
7
- },
8
- plugins: [
9
- scss({
10
- output: 'dist/tek-style.css',
11
- }),
12
- ],
13
- };
@@ -1,38 +0,0 @@
1
- import type { App, DefineComponent } from 'vue';
2
- import type { IDictionary } from '@zeedhi/core';
3
-
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';
16
-
17
- export * from './tek-breadcrumb-header/TekBreadcrumbHeader';
18
-
19
- export const components: IDictionary<DefineComponent<any, any, any>> = {
20
- TekBreadcrumbHeader,
21
- TekGrid,
22
- TekGridColumnFilter,
23
- TekGridHeaderRow,
24
- TekGridColumnsButton,
25
- TekGridFilterButton,
26
- TekGridIndentation,
27
- TekGridLayoutOptions,
28
- TekGridFooterRow,
29
- TekGridGroupRow,
30
- TekUserInfo,
31
- TekUserInfoList,
32
- };
33
-
34
- export function RegisterComponents(app: App) {
35
- for (const name in components) {
36
- app.component(name, components[name]);
37
- }
38
- }
@@ -1,41 +0,0 @@
1
- import TekBreadcrumbHeader from './tek-breadcrumb-header/TekBreadcrumbHeader';
2
- // import TekCardTitle from './tek-card-title/TekCardTitle';
3
- // import TekCrudAddButton from './crud/TekCrudAddButton';
4
- // import TekCrudCancelButton from './crud/TekCrudCancelButton';
5
- // import TekCrudDeleteButton from './crud/TekCrudDeleteButton';
6
- // import TekCrudForm from './crud/TekCrudForm';
7
- // import TekCrudSaveButton from './crud/TekCrudSaveButton';
8
- import TekGrid from './tek-grid/TekGrid';
9
- import TekGridColumnFilter from './tek-grid/column-filter/TekGridColumnFilter';
10
- // import TekDragGrid from './tek-drag-grid/TekDragGrid';
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';
14
- // import TekImage from './tek-image/TekImage';
15
- // import TekIterableComponentRender from './tek-iterable-component-render/TekIterableComponentRender';
16
- // import TekProductCard from './tek-product-card/TekProductCard';
17
- // import TekTreeGrid from './tek-tree-grid/TekTreeGrid';
18
- import TekUserInfo from './tek-user-info/TekUserInfo';
19
- import TekUserInfoList from './tek-user-info/TekUserInfoList';
20
-
21
- export {
22
- TekBreadcrumbHeader,
23
- // TekCardTitle,
24
- // TekCrudAddButton,
25
- // TekCrudCancelButton,
26
- // TekCrudDeleteButton,
27
- // TekCrudForm,
28
- // TekCrudSaveButton,
29
- TekGrid,
30
- TekGridColumnFilter,
31
- // TekDragGrid,
32
- TekGridColumnsButton,
33
- TekGridFilterButton,
34
- TekGridLayoutOptions,
35
- // TekImage,
36
- // TekProductCard,
37
- // TekIterableComponentRender,
38
- // TekTreeGrid,
39
- TekUserInfo,
40
- TekUserInfoList,
41
- };
@@ -1,34 +0,0 @@
1
- import { BreadcrumbHeader } from '@zeedhi/teknisa-components-common';
2
- import { defineComponent } from 'vue';
3
- import { useCreateInstance, ZdComponentRenderProps } from '@zeedhi/vuetify';
4
-
5
- export const TekBreadcrumbHeaderProps = {
6
- ...ZdComponentRenderProps,
7
- title: {
8
- type: String,
9
- default: '',
10
- },
11
- breadcrumb: {
12
- type: Object,
13
- default: {},
14
- },
15
- rightSlot: {
16
- type: Array,
17
- default: () => [],
18
- },
19
- };
20
-
21
- const breadcrumbHeaderComponent = defineComponent({
22
- props: TekBreadcrumbHeaderProps,
23
- inheritAttrs: false,
24
- setup(props, ctx) {
25
- const { instance, root } = useCreateInstance<BreadcrumbHeader>(props, ctx, BreadcrumbHeader);
26
-
27
- return {
28
- instance,
29
- root,
30
- };
31
- },
32
- });
33
-
34
- export default breadcrumbHeaderComponent;
@@ -1,76 +0,0 @@
1
- <template>
2
- <div
3
- :id="instance.name"
4
- ref="root"
5
- class="tek-breadcrumb-header">
6
- <zd-breadcrumbs
7
- v-bind="instance.breadcrumb"
8
- :theme="instance.theme"
9
- />
10
- <v-col class="tek-breadcrumb-header-title-col" cols="12">
11
- <zd-text
12
- v-bind="{
13
- name: `${instance.name}-title`,
14
- cssClass: 'tek-breadcrumb-header-title',
15
- text: $t(instance.title),
16
- }"
17
- />
18
- <span class="tek-breadcrumb-header-slot-right" >
19
- <span v-if="instance.rightSlot.length">
20
- <component
21
- v-for="(child) in instance.rightSlot"
22
- v-bind="child"
23
- :is="child.component"
24
- :key="child.name"
25
- >
26
- </component>
27
- </span>
28
- <slot name="rightSlot"></slot>
29
- </span>
30
- </v-col>
31
- </div>
32
- </template>
33
-
34
- <script lang="ts" src="./TekBreadcrumbHeader.ts"></script>
35
-
36
- <style lang="scss">
37
- .tek-breadcrumb-header {
38
- .v-breadcrumbs-item {
39
- padding: 0;
40
- }
41
-
42
- .tek-breadcrumb-header-title-col {
43
- display: flex;
44
- padding-top: 5px;
45
- padding-left: 0;
46
-
47
- .tek-breadcrumb-header-slot-right {
48
- margin-left: auto;
49
- }
50
- }
51
-
52
- .zd-breadcrumbs {
53
- padding: 0;
54
- font-size: var(--zd-font-body2-size);
55
-
56
- .v-breadcrumbs__item--disabled {
57
- color: #667080;
58
- }
59
- }
60
-
61
- .zd-text {
62
- color: #667080;
63
-
64
- &.tek-breadcrumb-header-title {
65
- font-size: 32px;
66
- font-weight: bold;
67
- line-height: 35px;
68
- margin-bottom: 10px;
69
- }
70
-
71
- > p {
72
- margin: 0;
73
- }
74
- }
75
- }
76
- </style>
@@ -1,318 +0,0 @@
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;