@zeedhi/teknisa-components-vuetify 3.1.0 → 3.3.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 (92) hide show
  1. package/dist/teknisa-components-vuetify.es.js +3235 -0
  2. package/dist/teknisa-components-vuetify.es.js.map +1 -0
  3. package/dist/teknisa-vuetify.css +1 -1
  4. package/dist/types/components/index.d.ts +6 -0
  5. package/dist/types/components/public.d.ts +11 -0
  6. package/dist/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.d.ts +3 -0
  7. package/dist/types/components/tek-grid/TekGrid.d.ts +3 -0
  8. package/dist/types/components/tek-grid/column-filter/TekGridColumnFilter.d.ts +36 -0
  9. package/dist/types/components/tek-grid/column-header/TekGridHeaderRow.d.ts +2 -0
  10. package/dist/types/components/tek-grid/columns-button/TekGridColumnsButton.d.ts +3 -0
  11. package/{types → dist/types}/components/tek-grid/columns-button/TekGridColumnsOptionsController.d.ts +1 -0
  12. package/{types → dist/types}/components/tek-grid/columns-button/TekGridColumnsOptionsModal.d.ts +1 -0
  13. package/dist/types/components/tek-grid/filter-button/TekGridFilterButton.d.ts +3 -0
  14. package/dist/types/components/tek-grid/indentation/TekGridIndentation.d.ts +2 -0
  15. package/dist/types/components/tek-grid/layout-options/TekGridLayoutOptions.d.ts +3 -0
  16. package/dist/types/components/tek-grid/row/TekGridFooterRow.d.ts +2 -0
  17. package/dist/types/components/tek-grid/row/TekGridGroupRow.d.ts +2 -0
  18. package/dist/types/components/tek-loading/TekLoading.d.ts +3 -0
  19. package/dist/types/components/tek-user-info/TekUserInfo.d.ts +3 -0
  20. package/dist/types/components/tek-user-info/TekUserInfoList.d.ts +2 -0
  21. package/{types → dist/types}/composables/useTableLayout.d.ts +3 -3
  22. package/{types → dist/types}/index.d.ts +0 -1
  23. package/package.json +40 -20
  24. package/src/index.ts +5 -0
  25. package/dist/teknisa-vuetify.js +0 -4117
  26. package/environments.json +0 -16
  27. package/jest.config.cjs +0 -31
  28. package/rollup.scss.config.js +0 -13
  29. package/src/components/index.ts +0 -41
  30. package/src/components/public.ts +0 -45
  31. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts +0 -41
  32. package/src/components/tek-breadcrumb-header/TekBreadcrumbHeader.vue +0 -76
  33. package/src/components/tek-grid/TekGrid.ts +0 -332
  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 -97
  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 -48
  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 -124
  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-loading/TekLoading.ts +0 -30
  54. package/src/components/tek-loading/TekLoading.vue +0 -18
  55. package/src/components/tek-user-info/TekUserInfo.ts +0 -52
  56. package/src/components/tek-user-info/TekUserInfo.vue +0 -53
  57. package/src/components/tek-user-info/TekUserInfoList.ts +0 -44
  58. package/src/components/tek-user-info/TekUserInfoList.vue +0 -12
  59. package/src/composables/useTableLayout.ts +0 -290
  60. package/src/shims-vue.d.ts +0 -6
  61. package/src/styles/index.scss +0 -0
  62. package/src/utils/isArrayOperation.ts +0 -5
  63. package/tsconfig.eslint.json +0 -9
  64. package/types/components/index.d.ts +0 -6
  65. package/types/components/public.d.ts +0 -11
  66. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.d.ts +0 -1168
  67. package/types/components/tek-breadcrumb-header/TekBreadcrumbHeader.ts.d.ts +0 -1168
  68. package/types/components/tek-grid/TekGrid.d.ts +0 -6443
  69. package/types/components/tek-grid/TekGrid.ts.d.ts +0 -6443
  70. package/types/components/tek-grid/column-filter/TekGridColumnFilter.d.ts +0 -130
  71. package/types/components/tek-grid/column-filter/TekGridColumnFilter.ts.d.ts +0 -130
  72. package/types/components/tek-grid/column-header/TekGridHeaderRow.d.ts +0 -225
  73. package/types/components/tek-grid/column-header/TekGridHeaderRow.ts.d.ts +0 -225
  74. package/types/components/tek-grid/columns-button/TekGridColumnsButton.d.ts +0 -2933
  75. package/types/components/tek-grid/columns-button/TekGridColumnsButton.ts.d.ts +0 -2933
  76. package/types/components/tek-grid/filter-button/TekGridFilterButton.d.ts +0 -3580
  77. package/types/components/tek-grid/filter-button/TekGridFilterButton.ts.d.ts +0 -3580
  78. package/types/components/tek-grid/indentation/TekGridIndentation.d.ts +0 -32
  79. package/types/components/tek-grid/indentation/TekGridIndentation.ts.d.ts +0 -32
  80. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.d.ts +0 -2394
  81. package/types/components/tek-grid/layout-options/TekGridLayoutOptions.ts.d.ts +0 -2394
  82. package/types/components/tek-grid/row/TekGridFooterRow.d.ts +0 -90
  83. package/types/components/tek-grid/row/TekGridFooterRow.ts.d.ts +0 -90
  84. package/types/components/tek-grid/row/TekGridGroupRow.d.ts +0 -87
  85. package/types/components/tek-grid/row/TekGridGroupRow.ts.d.ts +0 -87
  86. package/types/components/tek-loading/TekLoading.d.ts +0 -663
  87. package/types/components/tek-loading/TekLoading.ts.d.ts +0 -663
  88. package/types/components/tek-user-info/TekUserInfo.d.ts +0 -2459
  89. package/types/components/tek-user-info/TekUserInfo.ts.d.ts +0 -2459
  90. package/types/components/tek-user-info/TekUserInfoList.d.ts +0 -1245
  91. package/types/components/tek-user-info/TekUserInfoList.ts.d.ts +0 -1245
  92. /package/{types → dist/types}/utils/isArrayOperation.d.ts +0 -0
@@ -1,44 +0,0 @@
1
- import { TekUserInfoList as TekUserInfoListClass } from '@zeedhi/teknisa-components-common';
2
- import { defineComponent } from 'vue';
3
- import { useCreateInstance, useGetMethods, ZdListProps } from '@zeedhi/vuetify';
4
-
5
-
6
- const TekUserInfoListProps = {
7
- ...ZdListProps,
8
- parentName: {
9
- type: String,
10
- default: '',
11
- },
12
- dense: {
13
- type: [Boolean, String],
14
- default: true,
15
- },
16
- };
17
-
18
- const tekUserInfoListComponent = defineComponent({
19
- props: TekUserInfoListProps,
20
- inheritAttrs: false,
21
- setup(props,ctx) {
22
- const { instance, root } = useCreateInstance<TekUserInfoListClass>(
23
- props,
24
- ctx,
25
- TekUserInfoListClass,
26
- TekUserInfoListProps,
27
- );
28
-
29
- const { click, focus, blur, mouseenter, mouseleave } = useGetMethods(instance, root);
30
-
31
- return {
32
- instance,
33
- root,
34
- click,
35
- focus,
36
- blur,
37
- mouseenter,
38
- mouseleave,
39
- };
40
- }
41
-
42
- })
43
-
44
- export default tekUserInfoListComponent;
@@ -1,12 +0,0 @@
1
- <template>
2
- <zd-list
3
- :id="instance.name"
4
- :instance-object="instance"
5
- name="list"
6
- ></zd-list>
7
- </template>
8
-
9
- <script lang="ts" src="./TekUserInfoList.ts"></script>
10
-
11
- <style lang="scss">
12
- </style>
@@ -1,290 +0,0 @@
1
- import { IIterable } from '@zeedhi/common';
2
- import { IDynamicFilterItem, IGroupedDataManager,
3
- ITekGridLayout,
4
- ITekGridLayoutColumn,
5
- TekFilterHelper,
6
- TekGridColumn,
7
- TekRestDatasource, } from '@zeedhi/teknisa-components-common';
8
- import { IDictionary, Utils } from '@zeedhi/core';
9
- import cloneDeep from 'lodash.clonedeep';
10
- import { NotProvidedError } from '@zeedhi/vuetify';
11
- import { ComputedRef, UnwrapNestedRefs, computed, inject, nextTick, provide } from 'vue';
12
-
13
- export type DefaultLayout = {
14
- originalDatasourceOrder: string[];
15
- originalDatasourceFilter: IDictionary<any>;
16
- originalColumnProps: ITekGridLayoutColumn[];
17
- originalDatasourceDynamicFilter: IDictionary<IDynamicFilterItem[]>;
18
- };
19
-
20
- export type ApplyLayout = (params: {
21
- layout?: ITekGridLayout;
22
- defaultLayout: DefaultLayout;
23
- changeLayoutCallback: (layout: ITekGridLayout) => void;
24
- }) => void;
25
- export type GetColumnElements = () => IDictionary<Element>;
26
- export type GetTableWidth = () => string;
27
-
28
- export function useTableLayout() {
29
- const applyLayout = inject<ApplyLayout>('applyLayout');
30
- const getColumnElements = inject<GetColumnElements>('getColumnElements');
31
- const getTableWidth = inject<GetTableWidth>('getTableWidth');
32
-
33
- if (!applyLayout) {
34
- throw new NotProvidedError('applyLayout');
35
- }
36
-
37
- if (!getColumnElements) {
38
- throw new NotProvidedError('getColumnElements');
39
- }
40
-
41
- if (!getTableWidth) {
42
- throw new NotProvidedError('getTableWidth');
43
- }
44
-
45
- return { applyLayout, getColumnElements, getTableWidth };
46
- }
47
-
48
- export function provideTableLayout<T extends IIterable<TekGridColumn> & IGroupedDataManager>({
49
- instance,
50
- rootEl,
51
- }: {
52
- instance: UnwrapNestedRefs<T>;
53
- rootEl: ComputedRef<HTMLElement | undefined>;
54
- }) {
55
- const tableElement = rootEl.value?.querySelector('table');
56
-
57
- const columnDictionary = computed(() => getColumnDictionary(instance.columns));
58
-
59
- const datasourceDynamicFilter = () => {
60
- const datasource = instance.datasource;
61
- if (datasource instanceof TekRestDatasource) return datasource.dynamicFilter;
62
- return {};
63
- };
64
-
65
- const getColumnDictionary = (columns: UnwrapNestedRefs<TekGridColumn>[]) => {
66
- const columnDictionary: IDictionary<UnwrapNestedRefs<TekGridColumn>> = {};
67
- columns.forEach((column: UnwrapNestedRefs<TekGridColumn>) => {
68
- columnDictionary[column.name] = column;
69
- });
70
- return columnDictionary;
71
- };
72
-
73
- const addMissingColumns = (layout: ITekGridLayout) => {
74
- const layoutColumnNames: string[] = layout.columns?.map((column) => column.name) || [];
75
- const columnNames: string[] = Object.keys(columnDictionary.value);
76
- columnNames.forEach((columnName) => {
77
- if (!layoutColumnNames.includes(columnName)) {
78
- layout.columns?.push(columnDictionary.value[columnName]);
79
- }
80
- });
81
- };
82
-
83
- const setHelperValue = (column: any, value: string | IDictionary<any>) => {
84
- if (column instanceof TekGridColumn) {
85
- if (!Array.isArray(column.filterProps) && typeof value === 'string') {
86
- column.filterProps.helperValue = value;
87
- } else if (Array.isArray(column.filterProps) && Array.isArray(value)) {
88
- column.filterProps.forEach((prop: any, index: number) => {
89
- prop.value = value[index];
90
- });
91
- }
92
- }
93
- };
94
-
95
- const getHelperValues = (dynamicFilter: IDictionary<IDynamicFilterItem[]>, columns: any[]) => {
96
- const filter = cloneDeep(dynamicFilter);
97
- Object.keys(filter).forEach((columnName) => {
98
- const filterOptions = filter[columnName];
99
- const column = columns[columns.findIndex((col) => col.name === columnName)];
100
- const { filterHelperValue } = column;
101
-
102
- filterOptions.forEach((item) => {
103
- if (['IN', 'NOT_IN', 'BETWEEN'].includes(item.operation) && !Array.isArray(item.value)) {
104
- item.value = item.value.split(';');
105
- }
106
-
107
- let helperValue = '';
108
- if (!Array.isArray(filterHelperValue)) {
109
- helperValue = filterHelperValue;
110
- } else {
111
- Object.keys(filterHelperValue).forEach((key: any) => {
112
- const value = filterHelperValue[key] || '';
113
- if (`${item.relation || 'AND'}-${item.operation || 'CONTAINS'}` === key) {
114
- helperValue = value;
115
- }
116
- });
117
- }
118
-
119
- if (helperValue) {
120
- const columnObj = instance.getColumn(column.name);
121
- item.value = TekFilterHelper.getValue(helperValue, columnObj as any);
122
- }
123
- });
124
- });
125
-
126
- return filter;
127
- };
128
-
129
- /**
130
- * Applies the default grid layout
131
- * @returns a boolean to indicate whether the group parameters changed
132
- */
133
- const applyDefaultLayout = (defaultLayout: DefaultLayout) => {
134
- let groupParamsChanged = false;
135
-
136
- instance.datasource.order = [...defaultLayout.originalDatasourceOrder];
137
- instance.datasource.filter = { ...defaultLayout.originalDatasourceFilter };
138
- if (instance.datasource instanceof TekRestDatasource) {
139
- instance.datasource.dynamicFilter = getHelperValues(
140
- defaultLayout.originalDatasourceDynamicFilter,
141
- defaultLayout.originalColumnProps,
142
- );
143
- }
144
- instance.columns = defaultLayout.originalColumnProps.map((defaultColumn) => {
145
- const col = columnDictionary.value[defaultColumn.name];
146
-
147
- groupParamsChanged =
148
- groupParamsChanged ||
149
- col.grouped !== defaultColumn.grouped ||
150
- col.groupOpened !== defaultColumn.groupOpened ||
151
- col.aggregation !== defaultColumn.aggregation;
152
-
153
- col.isVisible = defaultColumn.isVisible ?? col.isVisible;
154
- col.label = defaultColumn.label ?? col.label;
155
- col.align = defaultColumn.align ?? col.align;
156
- col.fixed = defaultColumn.fixed ?? col.fixed;
157
- col.grouped = defaultColumn.grouped ?? col.grouped;
158
- col.groupOpened = defaultColumn.groupOpened ?? col.groupOpened;
159
- col.aggregation = defaultColumn.aggregation ?? col.aggregation;
160
- col.minWidth = defaultColumn.minWidth ?? col.minWidth;
161
- col.maxWidth = defaultColumn.maxWidth ?? col.maxWidth;
162
- col.width = defaultColumn.width ?? col.width;
163
-
164
- setHelperValue(col, defaultColumn.filterHelperValue || '');
165
- return col;
166
- });
167
-
168
- if (tableElement) {
169
- tableElement.style.width = '100%';
170
- const columnElements = Array.from(tableElement.querySelectorAll('tr th:not(.selectable)'));
171
- columnElements.forEach((item) => {
172
- (item as HTMLElement).style.width = 'unset';
173
- });
174
- }
175
-
176
- return groupParamsChanged;
177
- };
178
-
179
- const applyNewLayout = (layout: ITekGridLayout, changeLayoutCallback: (layout: ITekGridLayout) => void) => {
180
- const gridColumnNames: string[] = Object.keys(columnDictionary.value);
181
- let layoutChanged = false;
182
-
183
- // removes columns that are in the layout but not in grid
184
- layout.columns = layout.columns?.filter((column: any) => {
185
- const isInGrid = gridColumnNames.includes(column.name);
186
- if (!isInGrid) layoutChanged = true;
187
-
188
- return isInGrid;
189
- });
190
-
191
- if (layoutChanged) {
192
- changeLayoutCallback(layout);
193
- }
194
-
195
- if (tableElement) tableElement.style.width = layout.gridWidth || 'auto';
196
-
197
- instance.datasource.order = layout.order !== undefined ? layout.order : instance.datasource.order;
198
- instance.datasource.filter = layout.filter !== undefined ? layout.filter : instance.datasource.filter;
199
- if (instance.datasource instanceof TekRestDatasource && layout.dynamicFilter !== undefined) {
200
- instance.datasource.dynamicFilter = getHelperValues(layout.dynamicFilter, layout.columns || instance.columns);
201
- }
202
-
203
- if (layout.columns) {
204
- instance.columns = layout.columns.map((column) => {
205
- const col = columnDictionary.value[column.name];
206
- col.label = column.label !== undefined ? column.label : col.label;
207
- col.align = column.align !== undefined ? column.align : col.align;
208
- col.isVisible = column.isVisible !== undefined ? column.isVisible : col.isVisible;
209
- col.fixed = !!column.fixed;
210
- col.grouped = !!column.grouped;
211
- col.groupOpened = !!column.groupOpened;
212
- col.aggregation = column.aggregation;
213
- col.minWidth = column.minWidth || '';
214
- col.maxWidth = column.maxWidth || '';
215
- col.width = column.width;
216
- setHelperValue(col, column.filterHelperValue || '');
217
-
218
- return col;
219
- });
220
-
221
- // wait to change column orders
222
- nextTick(() => {
223
- gridColumnNames.forEach((_key, index) => {
224
- const columnElement: HTMLElement | null | undefined = tableElement?.querySelector(
225
- `tr th:not(.selectable)[index="${index}"]`,
226
- );
227
- if (columnElement) {
228
- columnElement.style.width = layout.columns![index].width || 'unset';
229
- }
230
- });
231
- });
232
- }
233
- };
234
-
235
- const applyLayout: ApplyLayout = ({
236
- layout,
237
- defaultLayout,
238
- changeLayoutCallback,
239
- }: {
240
- defaultLayout: DefaultLayout;
241
- layout?: ITekGridLayout;
242
- changeLayoutCallback: (layout: ITekGridLayout) => void;
243
- }) => {
244
- const oldOrder = instance.datasource.order;
245
- const oldFilter = instance.datasource.filter;
246
- const oldDynamicFilter = datasourceDynamicFilter();
247
-
248
- let groupParamsChanged = false;
249
-
250
- if (layout) {
251
- addMissingColumns(layout);
252
- applyNewLayout(layout, changeLayoutCallback);
253
- } else {
254
- groupParamsChanged = applyDefaultLayout(defaultLayout);
255
- }
256
-
257
- if (
258
- (!Utils.isEqual(instance.datasource.order, oldOrder) ||
259
- !Utils.isEqual(instance.datasource.filter, oldFilter) ||
260
- !Utils.isEqual(datasourceDynamicFilter(), oldDynamicFilter)) &&
261
- !groupParamsChanged
262
- ) {
263
- // Se os parametros de agrupamento tiverem sido alterados um get é feito automaticamente
264
- instance.loadAfterTasks();
265
- }
266
- };
267
-
268
- const getColumnElements: GetColumnElements = () => {
269
- const elementDict: IDictionary<Element> = {};
270
-
271
- const columnElements = tableElement?.querySelectorAll('tr th:not(.selectable)[index]') || [];
272
-
273
- columnElements.forEach((el) => {
274
- const index = el.getAttribute('index');
275
- if (index === null) return;
276
-
277
- elementDict[index] = el;
278
- });
279
-
280
- return elementDict;
281
- };
282
-
283
- const getTableWidth: GetTableWidth = () => {
284
- return tableElement ? window.getComputedStyle(tableElement).width : 'auto';
285
- };
286
-
287
- provide('applyLayout', applyLayout);
288
- provide('getColumnElements', getColumnElements);
289
- provide('getTableWidth', getTableWidth);
290
- }
@@ -1,6 +0,0 @@
1
- declare module '*.vue' {
2
- import type { DefineComponent } from 'vue';
3
-
4
- const component: DefineComponent<object, object, any>;
5
- export default component;
6
- }
File without changes
@@ -1,5 +0,0 @@
1
- const isArrayOperation = (operation: string) => {
2
- return ['IN', 'NOT_IN', 'BETWEEN'].includes(operation);
3
- };
4
-
5
- export { isArrayOperation };
@@ -1,9 +0,0 @@
1
- {
2
- // extend your base config so you don't have to redefine your compilerOptions
3
- "extends": "./tsconfig.json",
4
- "include": [
5
- "./src/**/*.ts",
6
- "./tests/**/*.ts",
7
- ],
8
- "exclude": ["node_modules"]
9
- }
@@ -1,6 +0,0 @@
1
- import type { App, DefineComponent } from 'vue';
2
- import type { IDictionary } from '@zeedhi/core';
3
- export * from './tek-breadcrumb-header/TekBreadcrumbHeader';
4
- export * from './tek-loading/TekLoading';
5
- export declare const components: IDictionary<DefineComponent<any, any, any>>;
6
- export declare function RegisterComponents(app: App): void;
@@ -1,11 +0,0 @@
1
- import TekBreadcrumbHeader from './tek-breadcrumb-header/TekBreadcrumbHeader';
2
- import TekGrid from './tek-grid/TekGrid';
3
- import TekGridColumnFilter from './tek-grid/column-filter/TekGridColumnFilter';
4
- import TekGridColumnsButton from './tek-grid/columns-button/TekGridColumnsButton';
5
- import TekGridFilterButton from './tek-grid/filter-button/TekGridFilterButton';
6
- import TekGridLayoutOptions from './tek-grid/layout-options/TekGridLayoutOptions';
7
- import TekLoading from './tek-loading/TekLoading.vue';
8
- import TekUserInfo from './tek-user-info/TekUserInfo';
9
- import TekUserInfoList from './tek-user-info/TekUserInfoList';
10
- export { TekBreadcrumbHeader, TekGrid, TekGridColumnFilter, TekGridColumnsButton, TekGridFilterButton, TekGridLayoutOptions, TekLoading, TekUserInfo, TekUserInfoList, };
11
- export { TekLoadingProps } from './tek-loading/TekLoading';