@zeedhi/teknisa-components-vuetify 1.117.1 → 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 (92) hide show
  1. package/.package.json +49 -0
  2. package/dist/teknisa-vuetify.css +1 -0
  3. package/dist/teknisa-vuetify.js +3882 -0
  4. package/environments.json +16 -0
  5. package/package.json +18 -17
  6. package/src/components/index.ts +38 -0
  7. package/src/components/public.ts +41 -0
  8. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts +34 -0
  9. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.vue +75 -0
  10. package/src/components/tek-grid/TekGrid.ts +318 -0
  11. package/src/components/tek-grid/TekGrid.vue +235 -0
  12. package/src/components/tek-grid/column-filter/TekGridColumnFilter.ts +244 -0
  13. package/src/components/tek-grid/column-filter/TekGridColumnFilter.vue +93 -0
  14. package/src/components/tek-grid/column-header/TekGridHeaderRow.ts +147 -0
  15. package/src/components/tek-grid/column-header/TekGridHeaderRow.vue +78 -0
  16. package/src/components/tek-grid/columns-button/TekGridColumnsButton.ts +96 -0
  17. package/src/components/tek-grid/columns-button/TekGridColumnsButton.vue +273 -0
  18. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsController.ts +470 -0
  19. package/src/components/tek-grid/columns-button/TekGridColumnsOptionsModal.ts +513 -0
  20. package/src/components/tek-grid/filter-button/TekGridFilterButton.ts +47 -0
  21. package/src/components/tek-grid/filter-button/TekGridFilterButton.vue +28 -0
  22. package/src/components/tek-grid/indentation/TekGridIndentation.ts +21 -0
  23. package/src/components/tek-grid/indentation/TekGridIndentation.vue +33 -0
  24. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.ts +119 -0
  25. package/src/components/tek-grid/layout-options/TekGridLayoutOptions.vue +172 -0
  26. package/src/components/tek-grid/row/TekGridFooterRow.ts +62 -0
  27. package/src/components/tek-grid/row/TekGridFooterRow.vue +64 -0
  28. package/src/components/tek-grid/row/TekGridGroupRow.ts +65 -0
  29. package/src/components/tek-grid/row/TekGridGroupRow.vue +65 -0
  30. package/src/components/tek-user-info/TekUserInfo.ts +51 -0
  31. package/src/components/tek-user-info/TekUserInfo.vue +53 -0
  32. package/src/components/tek-user-info/TekUserInfoList.ts +39 -0
  33. package/src/components/tek-user-info/TekUserInfoList.vue +12 -0
  34. package/src/composables/useTableLayout.ts +290 -0
  35. package/src/index.ts +29 -0
  36. package/src/shims-vue.d.ts +6 -0
  37. package/src/styles/index.scss +0 -0
  38. package/src/utils/isArrayOperation.ts +5 -0
  39. package/types/components/index.d.ts +5 -3
  40. package/types/components/public.d.ts +5 -18
  41. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.d.ts +1137 -12
  42. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts.d.ts +1138 -0
  43. package/types/components/tek-grid/TekGrid.d.ts +7208 -86
  44. package/types/components/tek-grid/TekGrid.ts.d.ts +7211 -0
  45. package/types/components/tek-grid/column-filter/TekGridColumnFilter.d.ts +130 -0
  46. package/types/components/tek-grid/column-filter/TekGridColumnFilter.ts.d.ts +130 -0
  47. package/types/components/tek-grid/column-header/TekGridHeaderRow.d.ts +225 -0
  48. package/types/components/tek-grid/column-header/TekGridHeaderRow.ts.d.ts +225 -0
  49. package/types/components/tek-grid/columns-button/TekGridColumnsButton.d.ts +2432 -0
  50. package/types/components/tek-grid/columns-button/TekGridColumnsButton.ts.d.ts +2432 -0
  51. package/types/components/tek-grid/{TekGridColumnsOptionsController.d.ts → columns-button/TekGridColumnsOptionsController.d.ts} +7 -8
  52. package/types/components/tek-grid/{TekGridColumnsOptionsModal.d.ts → columns-button/TekGridColumnsOptionsModal.d.ts} +2 -3
  53. package/types/components/tek-grid/filter-button/TekGridFilterButton.d.ts +2920 -0
  54. package/types/components/tek-grid/filter-button/TekGridFilterButton.ts.d.ts +2920 -0
  55. package/types/components/tek-grid/indentation/TekGridIndentation.d.ts +32 -0
  56. package/types/components/tek-grid/indentation/TekGridIndentation.ts.d.ts +32 -0
  57. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.d.ts +1893 -0
  58. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.ts.d.ts +1893 -0
  59. package/types/components/tek-grid/row/TekGridFooterRow.d.ts +90 -0
  60. package/types/components/tek-grid/row/TekGridFooterRow.ts.d.ts +90 -0
  61. package/types/components/tek-grid/row/TekGridGroupRow.d.ts +87 -0
  62. package/types/components/tek-grid/row/TekGridGroupRow.ts.d.ts +87 -0
  63. package/types/components/tek-user-info/TekUserInfo.d.ts +1937 -10
  64. package/types/components/tek-user-info/TekUserInfo.ts.d.ts +1940 -0
  65. package/types/components/tek-user-info/TekUserInfoList.d.ts +1014 -8
  66. package/types/components/tek-user-info/TekUserInfoList.ts.d.ts +1015 -0
  67. package/types/composables/useTableLayout.d.ts +26 -0
  68. package/types/index.d.ts +2 -2
  69. package/types/utils/isArrayOperation.d.ts +2 -0
  70. package/dist/tek-components-vuetify.esm.js +0 -8924
  71. package/dist/tek-components-vuetify.umd.js +0 -8949
  72. package/types/components/crud/TekCrudAddButton.d.ts +0 -14
  73. package/types/components/crud/TekCrudButton.d.ts +0 -12
  74. package/types/components/crud/TekCrudCancelButton.d.ts +0 -12
  75. package/types/components/crud/TekCrudDeleteButton.d.ts +0 -14
  76. package/types/components/crud/TekCrudForm.d.ts +0 -9
  77. package/types/components/crud/TekCrudSaveButton.d.ts +0 -11
  78. package/types/components/tek-card-title/TekCardTitle.d.ts +0 -16
  79. package/types/components/tek-drag-grid/TekDragGrid.d.ts +0 -20
  80. package/types/components/tek-grid/TekGridColumnsButton.d.ts +0 -16
  81. package/types/components/tek-grid/TekGridFilterButton.d.ts +0 -27
  82. package/types/components/tek-grid/TekGridLayoutOptions.d.ts +0 -19
  83. package/types/components/tek-grid/subcomponents/TekGridCellIdentation.d.ts +0 -9
  84. package/types/components/tek-grid/subcomponents/TekGridColumnFilter.d.ts +0 -16
  85. package/types/components/tek-grid/subcomponents/TekGridHeaderIndentation.d.ts +0 -5
  86. package/types/components/tek-image/TekImage.d.ts +0 -20
  87. package/types/components/tek-iterable-carousel/TekIterableCarousel.d.ts +0 -11
  88. package/types/components/tek-iterable-component-render/TekIterableComponentRender.d.ts +0 -9
  89. package/types/components/tek-loading/TekLoading.d.ts +0 -9
  90. package/types/components/tek-notifications/TekNotifications.d.ts +0 -12
  91. package/types/components/tek-product-card/TekProductCard.d.ts +0 -24
  92. package/types/components/tek-tree-grid/TekTreeGrid.d.ts +0 -72
@@ -0,0 +1,16 @@
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/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@zeedhi/teknisa-components-vuetify",
3
- "version": "1.117.1",
3
+ "version": "3.0.1",
4
4
  "description": "Teknisa Components based on Vuetify",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
7
- "main": "dist/tek-components-vuetify.umd.js",
8
- "module": "dist/tek-components-vuetify.esm.js",
7
+ "main": "src/index.ts",
8
+ "module": "dist/teknisa-vuetify.js",
9
9
  "typings": "types/index.d.ts",
10
+ "type": "module",
10
11
  "publishConfig": {
11
12
  "access": "public"
12
13
  },
@@ -18,31 +19,31 @@
18
19
  "watch": "rollup -cw"
19
20
  },
20
21
  "dependencies": {
21
- "@zeedhi/zd-drag-grid-common": "<=1.0.6",
22
- "@zeedhi/zd-drag-grid-vue": "<=1.0.6",
23
- "@zeedhi/zd-user-info-common": "^1.3.2",
24
- "@zeedhi/zd-user-info-vue": "^1.3.2",
22
+ "@zeedhi/teknisa-components-common": "^3.0.1",
23
+ "@zeedhi/vuetify": "^3.0.0",
24
+ "@zeedhi/zd-user-info-common": "^3.0.0",
25
+ "@zeedhi/zd-user-info-vue": "^3.0.0",
25
26
  "lodash.clonedeep": "4.5.*",
26
27
  "lodash.debounce": "4.0.*",
27
28
  "lodash.merge": "4.6.*",
28
29
  "sortablejs": "1.15.*",
29
- "vue-class-component": "7.2.*",
30
- "vue-property-decorator": "9.1.*",
31
- "vuedraggable": "^2.24.3"
30
+ "vue": "^3.0.0",
31
+ "vuetify": "~3.9.0"
32
32
  },
33
33
  "devDependencies": {
34
+ "@rollup/plugin-commonjs": "^24.0.1",
35
+ "@rollup/plugin-json": "^6.0.0",
36
+ "@rollup/plugin-typescript": "^11.1.1",
34
37
  "@types/jest": "26.0.*",
35
38
  "@types/lodash.clonedeep": "4.5.*",
36
39
  "@types/lodash.debounce": "4.0.*",
37
40
  "@types/lodash.merge": "4.6.*",
38
41
  "@types/sortablejs": "1.15.*",
39
- "@vue/test-utils": "1.3.*",
42
+ "rollup-plugin-vue": "^6.0.0",
40
43
  "ts-jest": "26.5.*"
41
44
  },
42
- "peerDependencies": {
43
- "@zeedhi/teknisa-components-common": "^1.97.0",
44
- "vue": "2.7.*",
45
- "vuetify": "2.6.*"
46
- },
47
- "gitHead": "af96b05ecd9d257920b9244fdd82f9502e70722c"
45
+ "gitHead": "1c6ee6c23a7e75036a459ada909c934d00f63373",
46
+ "env": {
47
+ "NODE_ENV": "production"
48
+ }
48
49
  }
@@ -0,0 +1,38 @@
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
+ }
@@ -0,0 +1,41 @@
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
+ };
@@ -0,0 +1,34 @@
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;
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <div
3
+ :id="instance.name"
4
+ class="tek-breadcrumb-header">
5
+ <zd-breadcrumbs
6
+ v-bind="instance.breadcrumb"
7
+ :theme="instance.theme"
8
+ />
9
+ <v-col class="tek-breadcrumb-header-title-col" cols="12">
10
+ <zd-text
11
+ v-bind="{
12
+ name: `${instance.name}-title`,
13
+ cssClass: 'tek-breadcrumb-header-title',
14
+ text: $t(instance.title),
15
+ }"
16
+ />
17
+ <span class="tek-breadcrumb-header-slot-right" >
18
+ <span v-if="instance.rightSlot.length">
19
+ <component
20
+ v-for="(child, index) in instance.rightSlot"
21
+ v-bind="child"
22
+ :is="child.component"
23
+ :key="index"
24
+ >
25
+ </component>
26
+ </span>
27
+ <slot name="rightSlot"></slot>
28
+ </span>
29
+ </v-col>
30
+ </div>
31
+ </template>
32
+
33
+ <script lang="ts" src="./TekBreadcrumbHeader.ts"></script>
34
+
35
+ <style lang="scss">
36
+ .tek-breadcrumb-header {
37
+ .v-breadcrumbs-item {
38
+ padding: 0;
39
+ }
40
+
41
+ .tek-breadcrumb-header-title-col {
42
+ display: flex;
43
+ padding-top: 5px;
44
+ padding-left: 0;
45
+
46
+ .tek-breadcrumb-header-slot-right {
47
+ margin-left: auto;
48
+ }
49
+ }
50
+
51
+ .zd-breadcrumbs {
52
+ padding: 0;
53
+ font-size: var(--zd-font-body2-size);
54
+
55
+ .v-breadcrumbs__item--disabled {
56
+ color: #667080;
57
+ }
58
+ }
59
+
60
+ .zd-text {
61
+ color: #667080;
62
+
63
+ &.tek-breadcrumb-header-title {
64
+ font-size: 32px;
65
+ font-weight: bold;
66
+ line-height: 35px;
67
+ margin-bottom: 10px;
68
+ }
69
+
70
+ > p {
71
+ margin: 0;
72
+ }
73
+ }
74
+ }
75
+ </style>
@@ -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;