@zeedhi/teknisa-components-vuetify 3.1.0 → 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 (91) 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 +1 -0
  11. package/{types → dist/types}/components/tek-grid/columns-button/TekGridColumnsOptionsModal.d.ts +1 -0
  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 +3 -3
  21. package/{types → dist/types}/index.d.ts +0 -1
  22. package/package.json +40 -20
  23. package/src/index.ts +5 -0
  24. package/dist/teknisa-vuetify.js +0 -4117
  25. package/environments.json +0 -16
  26. package/jest.config.cjs +0 -31
  27. package/rollup.scss.config.js +0 -13
  28. package/src/components/index.ts +0 -41
  29. package/src/components/public.ts +0 -45
  30. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts +0 -41
  31. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.vue +0 -76
  32. package/src/components/tek-grid/TekGrid.ts +0 -332
  33. package/src/components/tek-grid/TekGrid.vue +0 -235
  34. package/src/components/tek-grid/column-filter/TekGridColumnFilter.ts +0 -244
  35. package/src/components/tek-grid/column-filter/TekGridColumnFilter.vue +0 -93
  36. package/src/components/tek-grid/column-header/TekGridHeaderRow.ts +0 -147
  37. package/src/components/tek-grid/column-header/TekGridHeaderRow.vue +0 -78
  38. package/src/components/tek-grid/columns-button/TekGridColumnsButton.ts +0 -97
  39. package/src/components/tek-grid/columns-button/TekGridColumnsButton.vue +0 -273
  40. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsController.ts +0 -470
  41. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsModal.ts +0 -513
  42. package/src/components/tek-grid/filter-button/TekGridFilterButton.ts +0 -48
  43. package/src/components/tek-grid/filter-button/TekGridFilterButton.vue +0 -28
  44. package/src/components/tek-grid/indentation/TekGridIndentation.ts +0 -21
  45. package/src/components/tek-grid/indentation/TekGridIndentation.vue +0 -33
  46. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.ts +0 -124
  47. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.vue +0 -172
  48. package/src/components/tek-grid/row/TekGridFooterRow.ts +0 -62
  49. package/src/components/tek-grid/row/TekGridFooterRow.vue +0 -64
  50. package/src/components/tek-grid/row/TekGridGroupRow.ts +0 -65
  51. package/src/components/tek-grid/row/TekGridGroupRow.vue +0 -65
  52. package/src/components/tek-loading/TekLoading.ts +0 -30
  53. package/src/components/tek-loading/TekLoading.vue +0 -18
  54. package/src/components/tek-user-info/TekUserInfo.ts +0 -52
  55. package/src/components/tek-user-info/TekUserInfo.vue +0 -53
  56. package/src/components/tek-user-info/TekUserInfoList.ts +0 -44
  57. package/src/components/tek-user-info/TekUserInfoList.vue +0 -12
  58. package/src/composables/useTableLayout.ts +0 -290
  59. package/src/shims-vue.d.ts +0 -6
  60. package/src/styles/index.scss +0 -0
  61. package/src/utils/isArrayOperation.ts +0 -5
  62. package/tsconfig.eslint.json +0 -9
  63. package/types/components/index.d.ts +0 -6
  64. package/types/components/public.d.ts +0 -11
  65. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.d.ts +0 -1168
  66. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts.d.ts +0 -1168
  67. package/types/components/tek-grid/TekGrid.d.ts +0 -6443
  68. package/types/components/tek-grid/TekGrid.ts.d.ts +0 -6443
  69. package/types/components/tek-grid/column-filter/TekGridColumnFilter.d.ts +0 -130
  70. package/types/components/tek-grid/column-filter/TekGridColumnFilter.ts.d.ts +0 -130
  71. package/types/components/tek-grid/column-header/TekGridHeaderRow.d.ts +0 -225
  72. package/types/components/tek-grid/column-header/TekGridHeaderRow.ts.d.ts +0 -225
  73. package/types/components/tek-grid/columns-button/TekGridColumnsButton.d.ts +0 -2933
  74. package/types/components/tek-grid/columns-button/TekGridColumnsButton.ts.d.ts +0 -2933
  75. package/types/components/tek-grid/filter-button/TekGridFilterButton.d.ts +0 -3580
  76. package/types/components/tek-grid/filter-button/TekGridFilterButton.ts.d.ts +0 -3580
  77. package/types/components/tek-grid/indentation/TekGridIndentation.d.ts +0 -32
  78. package/types/components/tek-grid/indentation/TekGridIndentation.ts.d.ts +0 -32
  79. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.d.ts +0 -2394
  80. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.ts.d.ts +0 -2394
  81. package/types/components/tek-grid/row/TekGridFooterRow.d.ts +0 -90
  82. package/types/components/tek-grid/row/TekGridFooterRow.ts.d.ts +0 -90
  83. package/types/components/tek-grid/row/TekGridGroupRow.d.ts +0 -87
  84. package/types/components/tek-grid/row/TekGridGroupRow.ts.d.ts +0 -87
  85. package/types/components/tek-loading/TekLoading.d.ts +0 -663
  86. package/types/components/tek-loading/TekLoading.ts.d.ts +0 -663
  87. package/types/components/tek-user-info/TekUserInfo.d.ts +0 -2459
  88. package/types/components/tek-user-info/TekUserInfo.ts.d.ts +0 -2459
  89. package/types/components/tek-user-info/TekUserInfoList.d.ts +0 -1245
  90. package/types/components/tek-user-info/TekUserInfoList.ts.d.ts +0 -1245
  91. /package/{types → dist/types}/utils/isArrayOperation.d.ts +0 -0
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.cjs 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,41 +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 TekLoading from './tek-loading/TekLoading.vue';
15
- import TekUserInfo from './tek-user-info/TekUserInfo.vue';
16
- import TekUserInfoList from './tek-user-info/TekUserInfoList.vue';
17
-
18
- export * from './tek-breadcrumb-header/TekBreadcrumbHeader';
19
- export * from './tek-loading/TekLoading';
20
-
21
- export const components: IDictionary<DefineComponent<any, any, any>> = {
22
- TekBreadcrumbHeader,
23
- TekGrid,
24
- TekGridColumnFilter,
25
- TekGridHeaderRow,
26
- TekGridColumnsButton,
27
- TekGridFilterButton,
28
- TekGridIndentation,
29
- TekGridLayoutOptions,
30
- TekGridFooterRow,
31
- TekGridGroupRow,
32
- TekLoading,
33
- TekUserInfo,
34
- TekUserInfoList,
35
- };
36
-
37
- export function RegisterComponents(app: App) {
38
- for (const name in components) {
39
- app.component(name, components[name]);
40
- }
41
- }
@@ -1,45 +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 TekLoading from './tek-loading/TekLoading.vue';
15
- // import TekImage from './tek-image/TekImage';
16
- // import TekIterableComponentRender from './tek-iterable-component-render/TekIterableComponentRender';
17
- // import TekProductCard from './tek-product-card/TekProductCard';
18
- // import TekTreeGrid from './tek-tree-grid/TekTreeGrid';
19
- import TekUserInfo from './tek-user-info/TekUserInfo';
20
- import TekUserInfoList from './tek-user-info/TekUserInfoList';
21
-
22
- export {
23
- TekBreadcrumbHeader,
24
- // TekCardTitle,
25
- // TekCrudAddButton,
26
- // TekCrudCancelButton,
27
- // TekCrudDeleteButton,
28
- // TekCrudForm,
29
- // TekCrudSaveButton,
30
- TekGrid,
31
- TekGridColumnFilter,
32
- // TekDragGrid,
33
- TekGridColumnsButton,
34
- TekGridFilterButton,
35
- TekGridLayoutOptions,
36
- TekLoading,
37
- // TekImage,
38
- // TekProductCard,
39
- // TekIterableComponentRender,
40
- // TekTreeGrid,
41
- TekUserInfo,
42
- TekUserInfoList,
43
- };
44
-
45
- export { TekLoadingProps } from './tek-loading/TekLoading';
@@ -1,41 +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
- watch: false,
15
- },
16
- rightSlot: {
17
- type: Array,
18
- default: () => [],
19
- watch: false,
20
- },
21
- };
22
-
23
- const breadcrumbHeaderComponent = defineComponent({
24
- props: TekBreadcrumbHeaderProps,
25
- inheritAttrs: false,
26
- setup(props, ctx) {
27
- const { instance, root } = useCreateInstance<BreadcrumbHeader>(
28
- props,
29
- ctx,
30
- BreadcrumbHeader,
31
- TekBreadcrumbHeaderProps,
32
- );
33
-
34
- return {
35
- instance,
36
- root,
37
- };
38
- },
39
- });
40
-
41
- 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,332 +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
- watch: false,
23
- },
24
- title: {
25
- type: String,
26
- default: '',
27
- },
28
- addButton: {
29
- type: [Boolean, String],
30
- default: false,
31
- },
32
- deleteButton: {
33
- type: [String, Boolean],
34
- default: 'none',
35
- },
36
- columnsButton: {
37
- type: [Boolean, String],
38
- default: false,
39
- },
40
- columnsButtonIgnore: {
41
- type: [Array, String],
42
- default: () => [],
43
- },
44
- showEditButtons: {
45
- type: [Boolean, String],
46
- default: true,
47
- },
48
- filterButton: {
49
- type: [Boolean, String],
50
- default: false,
51
- },
52
- modalFilterProps: {
53
- type: Object,
54
- default: () => ({}),
55
- },
56
- showSearch: {
57
- type: [Boolean, String],
58
- default: true,
59
- },
60
- columnFilterButton: {
61
- type: [Boolean, String],
62
- default: false,
63
- },
64
- hideActions: {
65
- type: [Boolean, String],
66
- default: false,
67
- },
68
- actions: {
69
- type: Array,
70
- default: () => [],
71
- watch: false,
72
- },
73
- dragColumns: {
74
- type: [Boolean, String],
75
- default: true,
76
- },
77
- resizeColumns: {
78
- type: [Boolean, String],
79
- default: true,
80
- },
81
- showLayoutOptions: {
82
- type: [Boolean, String],
83
- default: true,
84
- },
85
- showExport: {
86
- type: [String, Boolean],
87
- default: false,
88
- },
89
- showReload: {
90
- type: [Boolean, String],
91
- default: true,
92
- },
93
- exportConfig: {
94
- type: Array,
95
- },
96
- exportActions: {
97
- type: Array,
98
- watch: false,
99
- },
100
- groupsOpened: {
101
- type: [Boolean, String],
102
- default: false,
103
- },
104
- showSummaryTotal: {
105
- type: [Boolean, String],
106
- default: true,
107
- },
108
- mainGrid: {
109
- type: [Boolean, String],
110
- default: true,
111
- },
112
- xlsDefaultType: {
113
- type: String,
114
- default: undefined,
115
- },
116
- showCheckboxAllFilter: {
117
- type: [Boolean, String],
118
- default: (Config as ITekConfig).gridShowCheckboxAllFilter,
119
- },
120
- toolbarOpened: {
121
- type: [Boolean],
122
- default: true,
123
- },
124
- defaultFilter: {
125
- type: Object,
126
- },
127
- reportTitle: {
128
- type: String,
129
- },
130
- editNewRowsOnly: {
131
- type: [Boolean, String],
132
- default: false,
133
- },
134
- });
135
-
136
- const gridEditableComponent = defineComponent({
137
- props: TekGridProps,
138
- inheritAttrs: false,
139
- setup(props, ctx) {
140
- const { instance, root } = useCreateInstance<TekGrid, ComponentPublicInstance>(props, ctx, TekGrid, TekGridProps);
141
-
142
- const renderedData = computed(() => {
143
- if (instance.isGrouped()) {
144
- return instance.getGroupedData();
145
- }
146
- return instance.getData();
147
- });
148
-
149
- const visibleData = computed(() => {
150
- return renderedData.value.filter((row) => instance.isItemVisible(row));
151
- });
152
-
153
- const isNavigableRow = (element: Element) => {
154
- return element.classList.contains('zd-grid__row')
155
- && !element.classList.contains('tek-grid-group-row')
156
- && !element.classList.contains('tek-grid-footer-row');
157
- };
158
-
159
- const gridEditableScope = useGridEditableInstance({
160
- instance,
161
- root,
162
- renderedData: visibleData,
163
- isNavigableRow,
164
- });
165
-
166
- const rootEl = getRootElement(root);
167
- const { visibleColumns } = useGridColumns({
168
- instance,
169
- rootEl,
170
- visibilityCondition: (column: any) => column.isVisible && !column.grouped,
171
- });
172
-
173
- provideTableLayout({ instance, rootEl });
174
-
175
- const debouncedDatasourceGet = debounce((instance) => {
176
- const event = new Event('change', { cancelable: true });
177
- instance.callEvent('beforeApplyFilter', { component: instance, event });
178
- if (event.defaultPrevented) return;
179
-
180
- const { datasource } = instance;
181
- if (datasource instanceof TekRestDatasource || datasource instanceof TekMemoryDatasource) {
182
- datasource.updateDynamicFilter();
183
- } else {
184
- datasource.get();
185
- }
186
- }, 500);
187
-
188
- const filter = computed<IDictionary<IDynamicFilterItem[]>>(() => {
189
- if (instance.datasource instanceof TekRestDatasource || instance.datasource instanceof TekMemoryDatasource) {
190
- return instance.datasource.dynamicFilter;
191
- }
192
-
193
- const datasourceFilter = instance.datasource.filter;
194
- const simpleFilter: IDictionary<IDynamicFilterItem[]> = {};
195
- Object.keys(datasourceFilter).forEach((key) => {
196
- simpleFilter[key] = [{ relation: 'AND', operation: 'CONTAINS', value: datasourceFilter[key] }];
197
- });
198
- return simpleFilter;
199
- });
200
-
201
- const setFilter = (newFilter: IDictionary<IDynamicFilterItem[]>) => {
202
- if (Utils.isEqual(filter, newFilter)) return;
203
-
204
- if (instance.datasource instanceof TekRestDatasource || instance.datasource instanceof TekMemoryDatasource) {
205
- instance.datasource.dynamicFilter = cloneDeep(newFilter);
206
- } else {
207
- const normalFilter: IDictionary<any> = {};
208
- Object.keys(newFilter).forEach((key) => {
209
- if (!newFilter[key][0].value) return;
210
-
211
- normalFilter[key] = newFilter[key][0].value;
212
- });
213
- instance.datasource.filter = normalFilter;
214
- }
215
- debouncedDatasourceGet(instance);
216
- instance.changeLayout();
217
- };
218
-
219
- const columnHasFilter = (columnName: string) => {
220
- return instance.columnHasFilter(columnName);
221
- };
222
-
223
- const isRowVisible = (row: IDictionary<any>, index: number) => {
224
- return instance.isItemVisible(row) && gridEditableScope.shouldRender(index);
225
- };
226
-
227
- const isCurrentRowGroup = (row: IDictionary<any>) => {
228
- const { uniqueKey, currentRow } = instance.datasource;
229
-
230
- return !!(
231
- (row.group && row.groupValue === currentRow.groupValue) ||
232
- (row[uniqueKey] && row[uniqueKey] === currentRow[uniqueKey])
233
- );
234
- };
235
-
236
- const isGroupSelectIndeterminate = (item: ITekGridGroupHeader) => {
237
- let hasSelected = false;
238
- let hasNotSelected = false;
239
- const { uniqueKey } = instance.datasource;
240
- item.children.forEach((child) => {
241
- const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
242
- hasSelected = hasSelected || idx !== -1;
243
- hasNotSelected = hasNotSelected || idx === -1;
244
- });
245
- return hasSelected && hasNotSelected;
246
- };
247
-
248
- const isGroupSelected = (item: ITekGridGroupHeader) => {
249
- return item.children.every((child) => {
250
- const { uniqueKey } = instance.datasource;
251
- const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
252
- return idx !== -1;
253
- });
254
- };
255
-
256
- const selectGroupRowClick = (row: IDictionary<any>, isSelected: boolean, event: Event) => {
257
- nextTick(() => {
258
- const rootElement = getRootElement(root);
259
- instance.selectGroupClick(row, isSelected, event, rootElement.value);
260
- });
261
- };
262
-
263
- const selectGroup = (item: ITekGridGroupHeader, event: Event) => {
264
- const { uniqueKey } = instance.datasource;
265
- const isSelected = isGroupSelected(item);
266
- if (!isSelected) {
267
- // here we fetch the item from renderedData because vuetify isSelected checks for object reference
268
- // so we need to find the item inside renderedData to call selectRow() with the correct reference
269
- // https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/components/VDataTable/composables/select.ts#L128
270
- const items = item.children.map((child) => {
271
- return renderedData.value.find((row) => child[uniqueKey] === row[uniqueKey]);
272
- });
273
-
274
- items.forEach((child) => {
275
- if (!child) return;
276
-
277
- const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
278
- if (idx === -1) {
279
- instance.selectRow(child, true);
280
- }
281
- });
282
- } else {
283
- item.children.forEach((child) => {
284
- const idx = instance.selectedRows.findIndex((row) => child[uniqueKey] === row[uniqueKey]);
285
- if (idx !== -1) {
286
- instance.selectRow(child, false);
287
- }
288
- });
289
- }
290
- selectGroupRowClick(item, !isSelected, event);
291
- };
292
-
293
- const openGroup = (item: ITekGridGroupHeader) => {
294
- instance.openGroup(item);
295
- };
296
-
297
- const isGroup = (item: IDictionary<any>): item is ITekGridGroupHeader => {
298
- return !!item.group;
299
- };
300
-
301
- const isFooter = (item: IDictionary<any>): item is ITekGridGroupFooter => {
302
- return !!item.groupFooter;
303
- };
304
-
305
- const groupColumnNames = computed(() => {
306
- return instance.columns.filter((column) => column.grouped).map((column) => column.name) || [];
307
- });
308
-
309
- return {
310
- ...gridEditableScope,
311
- instance,
312
- root,
313
- filter,
314
- setFilter,
315
- columnHasFilter,
316
- visibleColumns,
317
- isRowVisible,
318
- isCurrentRowGroup,
319
- isGroupSelectIndeterminate,
320
- selectGroup,
321
- isGroup,
322
- openGroup,
323
- renderedData,
324
- isGroupSelected,
325
- groupColumnNames,
326
- isFooter,
327
- visibleData,
328
- };
329
- },
330
- });
331
-
332
- export default gridEditableComponent;