overview-components 1.1.159 → 1.1.161

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 (242) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +82 -0
  3. package/dist/icons.js +692 -0
  4. package/dist/index.js +19890 -7
  5. package/dist/shared/lit-icon.d.ts.map +1 -1
  6. package/package.json +58 -21
  7. package/dist/assets/generated/locales/de.js +0 -269
  8. package/dist/assets/generated/locales/de.js.map +0 -1
  9. package/dist/assets/generated/locales/en.js +0 -269
  10. package/dist/assets/generated/locales/en.js.map +0 -1
  11. package/dist/assets/generated/locales/fr.js +0 -269
  12. package/dist/assets/generated/locales/fr.js.map +0 -1
  13. package/dist/assets/generated/locales/hr.js +0 -269
  14. package/dist/assets/generated/locales/hr.js.map +0 -1
  15. package/dist/assets/generated/locales/it.js +0 -269
  16. package/dist/assets/generated/locales/it.js.map +0 -1
  17. package/dist/assets/generated/locales/pl.js +0 -269
  18. package/dist/assets/generated/locales/pl.js.map +0 -1
  19. package/dist/assets/generated/locales/ro.js +0 -269
  20. package/dist/assets/generated/locales/ro.js.map +0 -1
  21. package/dist/assets/generated/locales/sk.js +0 -269
  22. package/dist/assets/generated/locales/sk.js.map +0 -1
  23. package/dist/assets/generated/locales/sr.js +0 -269
  24. package/dist/assets/generated/locales/sr.js.map +0 -1
  25. package/dist/assets/icons/iconGlyphs.js +0 -691
  26. package/dist/assets/icons/iconGlyphs.js.map +0 -1
  27. package/dist/assets/illustration/aichatbot-illustration.js +0 -144
  28. package/dist/assets/illustration/aichatbot-illustration.js.map +0 -1
  29. package/dist/assets/illustration/delete-illustration.js +0 -88
  30. package/dist/assets/illustration/delete-illustration.js.map +0 -1
  31. package/dist/assets/illustration/no-content.js +0 -159
  32. package/dist/assets/illustration/no-content.js.map +0 -1
  33. package/dist/assets/illustration/no-preview.js +0 -125
  34. package/dist/assets/illustration/no-preview.js.map +0 -1
  35. package/dist/assets/illustration/not-found.js +0 -98
  36. package/dist/assets/illustration/not-found.js.map +0 -1
  37. package/dist/assets/illustration/settings-illustration.js +0 -168
  38. package/dist/assets/illustration/settings-illustration.js.map +0 -1
  39. package/dist/components/components-settings/attachments-tab-settings.js +0 -318
  40. package/dist/components/components-settings/attachments-tab-settings.js.map +0 -1
  41. package/dist/components/components-settings/data-grid-settings.js +0 -553
  42. package/dist/components/components-settings/data-grid-settings.js.map +0 -1
  43. package/dist/components/components-settings/section-tab-settings.js +0 -719
  44. package/dist/components/components-settings/section-tab-settings.js.map +0 -1
  45. package/dist/components/components-settings/tabs-overview-settings.js +0 -421
  46. package/dist/components/components-settings/tabs-overview-settings.js.map +0 -1
  47. package/dist/components/index.js +0 -30
  48. package/dist/components/index.js.map +0 -1
  49. package/dist/components/lit-ai-filter-assistant.js +0 -443
  50. package/dist/components/lit-ai-filter-assistant.js.map +0 -1
  51. package/dist/components/lit-attachments-tab.js +0 -2044
  52. package/dist/components/lit-attachments-tab.js.map +0 -1
  53. package/dist/components/lit-badge.js +0 -124
  54. package/dist/components/lit-badge.js.map +0 -1
  55. package/dist/components/lit-case-variables-tab.js +0 -3718
  56. package/dist/components/lit-case-variables-tab.js.map +0 -1
  57. package/dist/components/lit-chart.js +0 -727
  58. package/dist/components/lit-chart.js.map +0 -1
  59. package/dist/components/lit-data-grid-tanstack.js +0 -2550
  60. package/dist/components/lit-data-grid-tanstack.js.map +0 -1
  61. package/dist/components/lit-filter-builder.js +0 -701
  62. package/dist/components/lit-filter-builder.js.map +0 -1
  63. package/dist/components/lit-filter-modal.js +0 -349
  64. package/dist/components/lit-filter-modal.js.map +0 -1
  65. package/dist/components/lit-multiselect-item.js +0 -707
  66. package/dist/components/lit-multiselect-item.js.map +0 -1
  67. package/dist/components/lit-section-tab.js +0 -268
  68. package/dist/components/lit-section-tab.js.map +0 -1
  69. package/dist/components/lit-tabs-overview.js +0 -356
  70. package/dist/components/lit-tabs-overview.js.map +0 -1
  71. package/dist/components/modals/lit-confirm-modal.js +0 -121
  72. package/dist/components/modals/lit-confirm-modal.js.map +0 -1
  73. package/dist/components/modals/lit-delete-modal.js +0 -131
  74. package/dist/components/modals/lit-delete-modal.js.map +0 -1
  75. package/dist/components/react-wrappers/ai-filter-assistant.js +0 -9
  76. package/dist/components/react-wrappers/ai-filter-assistant.js.map +0 -1
  77. package/dist/components/react-wrappers/attachments-tab.js +0 -9
  78. package/dist/components/react-wrappers/attachments-tab.js.map +0 -1
  79. package/dist/components/react-wrappers/badge.js +0 -9
  80. package/dist/components/react-wrappers/badge.js.map +0 -1
  81. package/dist/components/react-wrappers/button.js +0 -9
  82. package/dist/components/react-wrappers/button.js.map +0 -1
  83. package/dist/components/react-wrappers/calendar.js +0 -9
  84. package/dist/components/react-wrappers/calendar.js.map +0 -1
  85. package/dist/components/react-wrappers/case-variables-tab.js +0 -9
  86. package/dist/components/react-wrappers/case-variables-tab.js.map +0 -1
  87. package/dist/components/react-wrappers/chart.js +0 -9
  88. package/dist/components/react-wrappers/chart.js.map +0 -1
  89. package/dist/components/react-wrappers/data-grid-tanstack.js +0 -9
  90. package/dist/components/react-wrappers/data-grid-tanstack.js.map +0 -1
  91. package/dist/components/react-wrappers/filter-builder.js +0 -12
  92. package/dist/components/react-wrappers/filter-builder.js.map +0 -1
  93. package/dist/components/react-wrappers/filter-modal.js +0 -9
  94. package/dist/components/react-wrappers/filter-modal.js.map +0 -1
  95. package/dist/components/react-wrappers/index.js +0 -27
  96. package/dist/components/react-wrappers/index.js.map +0 -1
  97. package/dist/components/react-wrappers/progress-bar.js +0 -9
  98. package/dist/components/react-wrappers/progress-bar.js.map +0 -1
  99. package/dist/components/react-wrappers/section-tab.js +0 -9
  100. package/dist/components/react-wrappers/section-tab.js.map +0 -1
  101. package/dist/components/react-wrappers/tabs-overview.js +0 -9
  102. package/dist/components/react-wrappers/tabs-overview.js.map +0 -1
  103. package/dist/data/translations.js +0 -2768
  104. package/dist/data/translations.js.map +0 -1
  105. package/dist/index.js.map +0 -1
  106. package/dist/schemas/index.js +0 -18
  107. package/dist/schemas/index.js.map +0 -1
  108. package/dist/schemas/lit-attachments-tab-document.schema.js +0 -39
  109. package/dist/schemas/lit-attachments-tab-document.schema.js.map +0 -1
  110. package/dist/schemas/lit-attachments-tab-settings-value.schema.js +0 -30
  111. package/dist/schemas/lit-attachments-tab-settings-value.schema.js.map +0 -1
  112. package/dist/schemas/lit-attachments-tab.schema.js +0 -68
  113. package/dist/schemas/lit-attachments-tab.schema.js.map +0 -1
  114. package/dist/schemas/lit-case-variables-tab-cell.schema.js +0 -225
  115. package/dist/schemas/lit-case-variables-tab-cell.schema.js.map +0 -1
  116. package/dist/schemas/lit-case-variables-tab-rows.schema.js +0 -6
  117. package/dist/schemas/lit-case-variables-tab-rows.schema.js.map +0 -1
  118. package/dist/schemas/lit-case-variables-tab.schema.js +0 -27
  119. package/dist/schemas/lit-case-variables-tab.schema.js.map +0 -1
  120. package/dist/schemas/lit-data-grid-tanstack-column-array.schema.js +0 -6
  121. package/dist/schemas/lit-data-grid-tanstack-column-array.schema.js.map +0 -1
  122. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter-array.schema.js +0 -6
  123. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter-array.schema.js.map +0 -1
  124. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter.schema.js +0 -11
  125. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter.schema.js.map +0 -1
  126. package/dist/schemas/lit-data-grid-tanstack-column.schema.js +0 -79
  127. package/dist/schemas/lit-data-grid-tanstack-column.schema.js.map +0 -1
  128. package/dist/schemas/lit-data-grid-tanstack.schema.js +0 -108
  129. package/dist/schemas/lit-data-grid-tanstack.schema.js.map +0 -1
  130. package/dist/schemas/lit-filter-builder.schema.js +0 -61
  131. package/dist/schemas/lit-filter-builder.schema.js.map +0 -1
  132. package/dist/schemas/lit-section-tab-schema.js +0 -37
  133. package/dist/schemas/lit-section-tab-schema.js.map +0 -1
  134. package/dist/schemas/lit-tabs-overview-tab-array.schema.js +0 -6
  135. package/dist/schemas/lit-tabs-overview-tab-array.schema.js.map +0 -1
  136. package/dist/schemas/lit-tabs-overview-tab.schema.js +0 -32
  137. package/dist/schemas/lit-tabs-overview-tab.schema.js.map +0 -1
  138. package/dist/schemas/lit-tabs-overview.schema.js +0 -29
  139. package/dist/schemas/lit-tabs-overview.schema.js.map +0 -1
  140. package/dist/scripts/translate-locales.js +0 -241
  141. package/dist/scripts/translate-locales.js.map +0 -1
  142. package/dist/shared/filter-inputs.js +0 -429
  143. package/dist/shared/filter-inputs.js.map +0 -1
  144. package/dist/shared/index.js +0 -40
  145. package/dist/shared/index.js.map +0 -1
  146. package/dist/shared/lit-button.js +0 -159
  147. package/dist/shared/lit-button.js.map +0 -1
  148. package/dist/shared/lit-calendar.js +0 -485
  149. package/dist/shared/lit-calendar.js.map +0 -1
  150. package/dist/shared/lit-case-variables-tab-cell.js +0 -226
  151. package/dist/shared/lit-case-variables-tab-cell.js.map +0 -1
  152. package/dist/shared/lit-checkbox.js +0 -184
  153. package/dist/shared/lit-checkbox.js.map +0 -1
  154. package/dist/shared/lit-custom-popper.js +0 -116
  155. package/dist/shared/lit-custom-popper.js.map +0 -1
  156. package/dist/shared/lit-data-grid-action-buttons-popover.js +0 -295
  157. package/dist/shared/lit-data-grid-action-buttons-popover.js.map +0 -1
  158. package/dist/shared/lit-data-grid-density-popover.js +0 -84
  159. package/dist/shared/lit-data-grid-density-popover.js.map +0 -1
  160. package/dist/shared/lit-data-grid-export-popover.js +0 -68
  161. package/dist/shared/lit-data-grid-export-popover.js.map +0 -1
  162. package/dist/shared/lit-data-grid-operators-popover.js +0 -114
  163. package/dist/shared/lit-data-grid-operators-popover.js.map +0 -1
  164. package/dist/shared/lit-data-grid-row-actions.js +0 -87
  165. package/dist/shared/lit-data-grid-row-actions.js.map +0 -1
  166. package/dist/shared/lit-date-picker.js +0 -608
  167. package/dist/shared/lit-date-picker.js.map +0 -1
  168. package/dist/shared/lit-document-thumbnail.js +0 -383
  169. package/dist/shared/lit-document-thumbnail.js.map +0 -1
  170. package/dist/shared/lit-filter-input.js +0 -115
  171. package/dist/shared/lit-filter-input.js.map +0 -1
  172. package/dist/shared/lit-icon-button.js +0 -165
  173. package/dist/shared/lit-icon-button.js.map +0 -1
  174. package/dist/shared/lit-icon.js +0 -338
  175. package/dist/shared/lit-icon.js.map +0 -1
  176. package/dist/shared/lit-input.js +0 -282
  177. package/dist/shared/lit-input.js.map +0 -1
  178. package/dist/shared/lit-label.js +0 -103
  179. package/dist/shared/lit-label.js.map +0 -1
  180. package/dist/shared/lit-loader.js +0 -68
  181. package/dist/shared/lit-loader.js.map +0 -1
  182. package/dist/shared/lit-loading-bar.js +0 -91
  183. package/dist/shared/lit-loading-bar.js.map +0 -1
  184. package/dist/shared/lit-menu-item.js +0 -98
  185. package/dist/shared/lit-menu-item.js.map +0 -1
  186. package/dist/shared/lit-menu.js +0 -29
  187. package/dist/shared/lit-menu.js.map +0 -1
  188. package/dist/shared/lit-modal-body.js +0 -24
  189. package/dist/shared/lit-modal-body.js.map +0 -1
  190. package/dist/shared/lit-modal-footer.js +0 -21
  191. package/dist/shared/lit-modal-footer.js.map +0 -1
  192. package/dist/shared/lit-modal-header.js +0 -34
  193. package/dist/shared/lit-modal-header.js.map +0 -1
  194. package/dist/shared/lit-modal.js +0 -168
  195. package/dist/shared/lit-modal.js.map +0 -1
  196. package/dist/shared/lit-overflow-tooltip.js +0 -114
  197. package/dist/shared/lit-overflow-tooltip.js.map +0 -1
  198. package/dist/shared/lit-pill.js +0 -87
  199. package/dist/shared/lit-pill.js.map +0 -1
  200. package/dist/shared/lit-progress-bar.js +0 -130
  201. package/dist/shared/lit-progress-bar.js.map +0 -1
  202. package/dist/shared/lit-responsive-button.js +0 -106
  203. package/dist/shared/lit-responsive-button.js.map +0 -1
  204. package/dist/shared/lit-select-field.js +0 -457
  205. package/dist/shared/lit-select-field.js.map +0 -1
  206. package/dist/shared/lit-select.js +0 -668
  207. package/dist/shared/lit-select.js.map +0 -1
  208. package/dist/shared/lit-settings.js +0 -76
  209. package/dist/shared/lit-settings.js.map +0 -1
  210. package/dist/shared/lit-text-field.js +0 -252
  211. package/dist/shared/lit-text-field.js.map +0 -1
  212. package/dist/shared/lit-toggle.js +0 -240
  213. package/dist/shared/lit-toggle.js.map +0 -1
  214. package/dist/shared/lit-tooltip.js +0 -165
  215. package/dist/shared/lit-tooltip.js.map +0 -1
  216. package/dist/shared/simple-popper.js +0 -285
  217. package/dist/shared/simple-popper.js.map +0 -1
  218. package/dist/shared/simple-tooltip.js +0 -249
  219. package/dist/shared/simple-tooltip.js.map +0 -1
  220. package/dist/shared/styles/button-shared-styles.js +0 -494
  221. package/dist/shared/styles/button-shared-styles.js.map +0 -1
  222. package/dist/styles.js +0 -169
  223. package/dist/styles.js.map +0 -1
  224. package/dist/utils/custom-filters.js +0 -42
  225. package/dist/utils/custom-filters.js.map +0 -1
  226. package/dist/utils/date.js +0 -21
  227. package/dist/utils/date.js.map +0 -1
  228. package/dist/utils/file-type-utils.js +0 -55
  229. package/dist/utils/file-type-utils.js.map +0 -1
  230. package/dist/utils/formatNumber.js +0 -62
  231. package/dist/utils/formatNumber.js.map +0 -1
  232. package/dist/utils/getOperatorByType.js +0 -70
  233. package/dist/utils/getOperatorByType.js.map +0 -1
  234. package/dist/utils/getOverviewValue.js +0 -175
  235. package/dist/utils/getOverviewValue.js.map +0 -1
  236. package/dist/utils/localization.js +0 -433
  237. package/dist/utils/localization.js.map +0 -1
  238. package/dist/utils/pdf-thumbnail-generator.js +0 -91
  239. package/dist/utils/pdf-thumbnail-generator.js.map +0 -1
  240. package/dist/utils/utils.js +0 -94
  241. package/dist/utils/utils.js.map +0 -1
  242. package/dist/vite.svg +0 -1
@@ -1,2550 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { css, html, LitElement } from 'lit';
8
- import { isEqual } from 'lodash';
9
- import { msg } from '@lit/localize';
10
- import { property, state, query } from 'lit/decorators.js';
11
- import { unsafeHTML } from 'lit/directives/unsafe-html.js';
12
- import { TableController, getCoreRowModel, flexRender, getSortedRowModel, getFilteredRowModel, getFacetedRowModel, getFacetedUniqueValues, getGroupedRowModel, getExpandedRowModel, filterFns, } from '@tanstack/lit-table';
13
- import { repeat } from 'lit/directives/repeat.js';
14
- import { VirtualizerController } from '@tanstack/lit-virtual';
15
- import { createRef, ref } from 'lit/directives/ref.js';
16
- import { styleMap } from 'lit/directives/style-map.js';
17
- import Sortable from 'sortablejs';
18
- // components
19
- import '../shared/filter-inputs.js';
20
- import '../shared/lit-icon.js';
21
- import '../shared/lit-icon-button.js';
22
- import '../shared/lit-button.js';
23
- import '../shared/lit-responsive-button.js';
24
- import '../shared/lit-data-grid-export-popover.js';
25
- import '../shared/lit-data-grid-action-buttons-popover.js';
26
- import '../assets/illustration/not-found.js';
27
- import '../shared/lit-data-grid-density-popover.js';
28
- import '../shared/lit-loading-bar.js';
29
- import '../shared/lit-data-grid-row-actions.js';
30
- import '../shared/simple-tooltip.js';
31
- import '../shared/lit-checkbox.js';
32
- import '../shared/lit-overflow-tooltip.js';
33
- import '../shared/lit-document-thumbnail.js';
34
- import './components-settings/data-grid-settings.js';
35
- // utils
36
- import { formatDate } from '../utils/date.js';
37
- import { formatCurrency, formatDecimal } from '../utils/formatNumber.js';
38
- import { dateFilterFn, multiselectFilterFn, dateRangeFilterFn } from '../utils/custom-filters.js';
39
- import { setLocale, getLocale, LOCALE_LANGS } from '../utils/localization.js';
40
- import { getOperatorsByColumnType } from '../utils/getOperatorByType.js';
41
- import { tooltip } from '../shared/simple-tooltip.js';
42
- export class LitDataGridTanstack extends LitElement {
43
- constructor() {
44
- super(...arguments);
45
- this.row = [];
46
- this.columns = [];
47
- this.allColumns = [];
48
- this.enableRowVirtualization = true;
49
- this.enableColumnVirtualization = false;
50
- this.enableColumnPinning = true;
51
- this.enableColumnOrdering = false;
52
- this.enableGrouping = true;
53
- this.enablePinning = true;
54
- this.exportData = true;
55
- this.actionButtonsInMenu = false;
56
- this.id = '';
57
- this.initialGroups = [];
58
- this.initialSorting = [];
59
- this.initialRowExpanded = {};
60
- this.columnSizing = {};
61
- this.leftPinnedColumns = [];
62
- this.rightPinnedColumns = [];
63
- this.enableFiltering = true;
64
- this.enableSorting = true;
65
- this.userLang = 'cs';
66
- this.allowedLang = ['cs'];
67
- this.dateFormat = null;
68
- this.isLoading = false;
69
- this.enableRowSelection = false;
70
- this.initialFiltering = [];
71
- this.server = false;
72
- this.scrollEndThreshold = 100;
73
- this.rowDensity = 'standard';
74
- this.enableMultiRowSelection = false;
75
- this.minFilterCharacters = 3;
76
- this.rowsSelected = {};
77
- this.enableSettings = false;
78
- this.enableSettingsAlwaysFilter = false;
79
- this.alwaysFilterActive = false;
80
- this.onSettingsChanged = () => { };
81
- this.onCellKeyDown = (event, row) => { };
82
- this.onColumnResize = () => { };
83
- this.onColumnFiltersChanged = (table, filterModel) => { };
84
- this.onColumnSortChanged = (table, sortModel) => { };
85
- this.onRowSelectionChanged = (table, selectedRows) => { };
86
- this.onColumnOrderChanged = (table, columnOrder) => { };
87
- this.hideFooter = false;
88
- this.columnVisibility = {};
89
- this.onColumnVisibilityChanged = (table, columnVisibility) => { };
90
- this.onMouseDown = (e, row) => { };
91
- this.onRowFocusChanged = (table, rowIndex) => { };
92
- this.focusedRowIndex = null;
93
- this.autoFocus = false;
94
- this.onColumnPinningChanged = (table, leftPinnedColumns) => { };
95
- this.onGroupingChanged = (table, grouping) => { };
96
- this.onRowExpanded = (table, rowsExpanded) => { };
97
- this.variables = [];
98
- this._prevRowsCount = 0;
99
- this.isScrollable = false;
100
- this.disableScrollLeft = true;
101
- this.disableScrollRight = false;
102
- this.columnOrder = [];
103
- this.isOpen = false;
104
- this.filterText = '';
105
- this.isOpenModal = false;
106
- this.scrollToEnd = false;
107
- this.resizeTimeout = null;
108
- this.tableContainerRef = createRef();
109
- this.scrollInterval = null;
110
- this.currentScrollTop = 0;
111
- this.lastSelectedIndex = null;
112
- this.getCellBackgroundColor = (cell) => {
113
- if (cell.getIsGrouped()) {
114
- return this.columnGroupedColor ?? `var(--color-primary-light, #f0fadf)`;
115
- }
116
- if (cell.getIsAggregated()) {
117
- return this.rowAggregationColor ?? `var(--color-warning-light, #ffe1a8)`;
118
- }
119
- if (cell.getIsPlaceholder()) {
120
- return `var(--background-default, #eff3f4)`;
121
- }
122
- if (cell.column.getIsPinned()) {
123
- return `var(--background-paper, #fff)`;
124
- }
125
- return 'transparent';
126
- };
127
- this.handleWindowResize = () => {
128
- // Clear any existing timeout
129
- if (this.resizeTimeout) {
130
- clearTimeout(this.resizeTimeout);
131
- }
132
- // Debounce the resize event
133
- this.resizeTimeout = window.setTimeout(() => {
134
- this.updateScrollState();
135
- // Call the onWindowResize callback to potentially fetch new rows
136
- if (this.onWindowResize) {
137
- this.onWindowResize();
138
- }
139
- }, 500); // 500ms debounce
140
- };
141
- this.updateScrollState = () => {
142
- const grid = this.tableContainerRef.value;
143
- if (grid) {
144
- const canScrollHorizontally = grid.scrollWidth > grid.clientWidth;
145
- this.isScrollable = canScrollHorizontally;
146
- this.disableScrollLeft = grid.scrollLeft === 0;
147
- this.disableScrollRight = grid.scrollLeft + grid.clientWidth >= grid.scrollWidth;
148
- this.currentScrollTop = grid.scrollTop;
149
- }
150
- // Check if we've reached the scroll end after scroll state update
151
- this._maybeTriggerScrollEnd();
152
- };
153
- }
154
- getLocaleLang() {
155
- if (this.userLang && LOCALE_LANGS.has(this.userLang)) {
156
- return this.userLang;
157
- }
158
- return 'cs';
159
- }
160
- get rows() {
161
- return [...(this.row || [])];
162
- }
163
- get getColumns() {
164
- return [...(this.columns || [])];
165
- }
166
- // lifecycle
167
- connectedCallback() {
168
- this.initRowVirtualizer();
169
- this.initColumnVirtualizer();
170
- this.initTable();
171
- window.addEventListener('resize', this.handleWindowResize);
172
- super.connectedCallback();
173
- }
174
- disconnectedCallback() {
175
- super.disconnectedCallback();
176
- window.removeEventListener('resize', this.handleWindowResize);
177
- if (this.resizeTimeout) {
178
- clearTimeout(this.resizeTimeout);
179
- }
180
- }
181
- updated(changedProperties) {
182
- if (changedProperties.has('userLang')) {
183
- const localeLang = this.getLocaleLang();
184
- if (getLocale() !== localeLang) {
185
- setLocale(localeLang).then(() => this.requestUpdate());
186
- }
187
- }
188
- let needsUpdate = false;
189
- if ((changedProperties.has('columns') || changedProperties.has('columnVisibility')) &&
190
- this.enableColumnVirtualization) {
191
- const virtualizer = this.columnVirtualizerController?.getVirtualizer();
192
- if (virtualizer) {
193
- virtualizer.setOptions({
194
- ...virtualizer.options,
195
- count: this.table?.getVisibleLeafColumns().length,
196
- });
197
- }
198
- }
199
- if (changedProperties.has('row') || changedProperties.has('columns')) {
200
- this.initTable();
201
- needsUpdate = true;
202
- }
203
- if (changedProperties.has('rowDensity') && this.enableRowVirtualization) {
204
- const virtualizer = this.rowVirtualizerController?.getVirtualizer();
205
- if (virtualizer) {
206
- virtualizer.setOptions({
207
- ...virtualizer.options,
208
- estimateSize: () => this.getRowHeight(),
209
- });
210
- // Force full re-measure of all rows with new height
211
- virtualizer.measure();
212
- }
213
- needsUpdate = true;
214
- }
215
- // Single requestUpdate() call if needed
216
- if (needsUpdate) {
217
- this.requestUpdate();
218
- }
219
- // Check scroll end when data or layout changes
220
- if (changedProperties.has('rowDensity')) {
221
- // Use setTimeout to ensure DOM is updated
222
- setTimeout(() => this._maybeTriggerScrollEnd(), 100);
223
- }
224
- }
225
- firstUpdated() {
226
- const grid = this.tableContainerRef.value;
227
- if (grid) {
228
- grid.addEventListener('scroll', this.updateScrollState);
229
- }
230
- setTimeout(() => {
231
- this.updateScrollState();
232
- }, 1500);
233
- this.initSortable();
234
- this._container.addEventListener('scroll', this.handleScroll.bind(this));
235
- // focus row by index
236
- if (this.autoFocus) {
237
- setTimeout(() => {
238
- if (this.focusedRowIndex !== null && this.focusedRowIndex !== undefined) {
239
- this.focusRow?.(this.focusedRowIndex);
240
- }
241
- else {
242
- // first selected row if exists
243
- const selectedRows = this.table.getSelectedRowModel().rows;
244
- if (selectedRows.length > 0) {
245
- this.focusRow?.(selectedRows[0].index);
246
- }
247
- }
248
- }, 0);
249
- }
250
- }
251
- toggleModal() {
252
- this.isOpenModal = !this.isOpenModal;
253
- }
254
- async initSortable() {
255
- if (!this.enableColumnOrdering)
256
- return;
257
- const headerRow = this.shadowRoot?.querySelector('thead tr.head');
258
- if (!headerRow)
259
- return;
260
- Sortable.create(headerRow, {
261
- animation: 150,
262
- direction: 'horizontal',
263
- handle: '.drag-handle',
264
- filter: 'th[data-index="checkbox"], th[data-index="actions"]',
265
- preventOnFilter: false,
266
- onMove: (evt) => {
267
- const dragged = evt.dragged.getAttribute('data-index');
268
- const target = evt.related.getAttribute('data-index');
269
- const disallowed = ['checkbox', 'actions'];
270
- if (disallowed.includes(dragged) || disallowed.includes(target)) {
271
- return false;
272
- }
273
- const headers = this.table.getHeaderGroups()[0].headers;
274
- const draggedHeader = headers.find((header) => header.id === dragged);
275
- const targetHeader = headers.find((header) => header.id === target);
276
- if (!draggedHeader || !targetHeader)
277
- return false;
278
- const isDraggedPinned = draggedHeader.column.getIsPinned?.();
279
- const isTargetPinned = targetHeader.column.getIsPinned?.();
280
- const isDraggedGrouped = draggedHeader.column.getIsGrouped?.();
281
- const isTargetGrouped = targetHeader.column.getIsGrouped?.();
282
- return !(isDraggedPinned || isTargetPinned || isDraggedGrouped || isTargetGrouped);
283
- },
284
- onEnd: () => {
285
- const newOrder = Array.from(headerRow.querySelectorAll('th'))
286
- .map((th) => th.getAttribute('data-index'))
287
- .filter((id) => {
288
- if (!id || id === 'checkbox' || id === 'actions')
289
- return false;
290
- const header = this.table
291
- .getHeaderGroups()[0]
292
- .headers.find((h) => h.id === id);
293
- if (!header)
294
- return false;
295
- return !header.column.getIsPinned?.() && !header.column.getIsGrouped?.();
296
- });
297
- this.table.setColumnOrder(newOrder);
298
- },
299
- });
300
- }
301
- async loadXLSX() {
302
- if (!window.XLSX && !this.server) {
303
- await new Promise((resolve) => {
304
- const script = document.createElement('script');
305
- script.src = '../../public/libs/xlsx.mini.min.js';
306
- script.onload = resolve;
307
- document.head.appendChild(script);
308
- });
309
- }
310
- }
311
- // row density
312
- getRowHeight() {
313
- switch (this.rowDensity) {
314
- case 'compact':
315
- return 31;
316
- case 'standard':
317
- return 38;
318
- case 'comfort':
319
- return 50;
320
- default:
321
- return 38;
322
- }
323
- }
324
- getButtonSize() {
325
- switch (this.rowDensity) {
326
- case 'compact':
327
- return 'small';
328
- case 'standard':
329
- return 'medium';
330
- case 'comfort':
331
- return 'large';
332
- default:
333
- return 'medium';
334
- }
335
- }
336
- handleSetDensity(density) {
337
- this.rowDensity = density;
338
- if (this.rowDensityChange) {
339
- this.rowDensityChange(this.table, density);
340
- }
341
- }
342
- handleMouseDown(event, row) {
343
- if (this.onMouseDown) {
344
- this.onMouseDown(event, row);
345
- }
346
- }
347
- handleFilterTabNavigation(event) {
348
- const { direction, currentFilter } = event.detail;
349
- // Získajte všetky filter-inputs elementy z DOM
350
- const filterInputs = Array.from(this.shadowRoot?.querySelectorAll('filter-inputs') || []);
351
- if (filterInputs.length === 0)
352
- return;
353
- const currentIndex = filterInputs.indexOf(currentFilter);
354
- let nextIndex;
355
- if (direction === 'forward') {
356
- // Ak je aktuálny filter posledný vo viditeľnom zozname
357
- if (currentIndex === filterInputs.length - 1) {
358
- // Scroll na začiatok (ľavá strana)
359
- const grid = this.shadowRoot?.querySelector('.grid');
360
- if (grid) {
361
- grid.scrollLeft = 0;
362
- }
363
- // Po vykonaní scrollu čakáme krátko a potom nastavený focus na prvý filter
364
- setTimeout(() => {
365
- const firstFilter = this.shadowRoot?.querySelector('filter-inputs');
366
- if (firstFilter) {
367
- firstFilter.focus();
368
- }
369
- }, 0);
370
- return;
371
- }
372
- else {
373
- nextIndex = currentIndex + 1;
374
- }
375
- }
376
- else {
377
- // Podobne môžeme spracovať aj spätnú navigáciu
378
- if (currentIndex === 0) {
379
- const grid = this.shadowRoot?.querySelector('.grid');
380
- if (grid) {
381
- // Scroll na koniec (pravá strana)
382
- grid.scrollLeft = grid.scrollWidth;
383
- }
384
- setTimeout(() => {
385
- const filters = Array.from(this.shadowRoot?.querySelectorAll('filter-inputs') || []);
386
- if (filters.length > 0) {
387
- filters[filters.length - 1].focus();
388
- }
389
- }, 0);
390
- return;
391
- }
392
- else {
393
- nextIndex = currentIndex - 1;
394
- }
395
- }
396
- // Nastav focus na ďalší filter podľa smeru
397
- filterInputs[nextIndex].focus();
398
- }
399
- // virtualization
400
- initRowVirtualizer() {
401
- this.rowVirtualizerController = new VirtualizerController(this, {
402
- count: this.table?.getRowModel()?.rows.length || this.row?.length || 1,
403
- getScrollElement: () => this.tableContainerRef.value,
404
- estimateSize: () => this.getRowHeight(),
405
- overscan: 5,
406
- initialOffset: this.currentScrollTop,
407
- enabled: this.enableRowVirtualization,
408
- });
409
- }
410
- initTable() {
411
- this.tableController = new TableController(this);
412
- }
413
- initColumnVirtualizer() {
414
- this.columnVirtualizerController = new VirtualizerController(this, {
415
- horizontal: true,
416
- count: this.table?.getVisibleLeafColumns().length || this.columns.length || 1,
417
- getScrollElement: () => this.tableContainerRef.value,
418
- estimateSize: (index) => this.table.getVisibleLeafColumns()[index]?.getSize() || 200,
419
- overscan: 5,
420
- enabled: this.enableColumnVirtualization,
421
- });
422
- }
423
- handleRowClick(event, row) {
424
- this.onRowClick?.(event, this.table, row);
425
- this.onRowFocusChanged?.(this.table, row.index);
426
- const isShift = event.shiftKey;
427
- const isCtrlOrMeta = event.ctrlKey || event.metaKey;
428
- if (this.enableRowSelection && row.getCanSelect() && (isCtrlOrMeta || isShift)) {
429
- const { rows } = this.table.getRowModel();
430
- if (this.enableMultiRowSelection &&
431
- isShift &&
432
- this.focusedRowIndex !== null &&
433
- this.focusedRowIndex !== undefined) {
434
- const [start, end] = [
435
- Math.min(this.focusedRowIndex, row.index),
436
- Math.max(this.focusedRowIndex, row.index),
437
- ];
438
- const ids = rows.slice(start, end + 1).map((r) => r.id);
439
- const selected = { ...this.rowsSelected };
440
- ids.forEach((id) => (selected[id] = true));
441
- this.table.setRowSelection(selected);
442
- }
443
- else if (isCtrlOrMeta && this.enableMultiRowSelection) {
444
- // Ctrl/Cmd+Click: toggle row selection
445
- const selected = { ...this.rowsSelected };
446
- if (selected[row.id]) {
447
- delete selected[row.id];
448
- }
449
- else {
450
- selected[row.id] = true;
451
- }
452
- this.table.setRowSelection(selected);
453
- }
454
- else {
455
- // Single click: select only this row
456
- const selected = { [row.id]: true };
457
- this.table.setRowSelection(selected);
458
- }
459
- }
460
- this.focusedRowIndex = row.index;
461
- }
462
- handleRowDoubleClick(row) {
463
- if (this.onRowDoubleClick) {
464
- this.onRowDoubleClick(this.table, row);
465
- }
466
- }
467
- handleKeyDown(e) {
468
- const rows = this.table.getRowModel().rows;
469
- if (!rows.length)
470
- return;
471
- let index = this.focusedRowIndex ?? rows.findIndex((row) => this.rowsSelected[row.id]);
472
- if (this.enableRowSelection) {
473
- if (index === -1)
474
- index = 0;
475
- if (e.key === 'ArrowDown' && e.shiftKey && this.enableMultiRowSelection) {
476
- e.preventDefault();
477
- const nextIndex = index + 1;
478
- if (nextIndex < rows.length) {
479
- const nextRowId = rows[nextIndex].id;
480
- this.table.setRowSelection((prev) => ({
481
- ...prev,
482
- [nextRowId]: !prev[nextRowId],
483
- }));
484
- this.focusRow(nextIndex);
485
- }
486
- }
487
- else if (e.key === 'ArrowUp' && e.shiftKey && this.enableMultiRowSelection) {
488
- e.preventDefault();
489
- const prevIndex = index - 1;
490
- if (prevIndex >= 0) {
491
- const prevRowId = rows[prevIndex].id;
492
- this.table.setRowSelection((prev) => ({
493
- ...prev,
494
- [prevRowId]: !prev[prevRowId],
495
- }));
496
- this.focusRow(prevIndex);
497
- }
498
- }
499
- else if (e.key === 'ArrowDown' && index < rows.length - 1) {
500
- e.preventDefault();
501
- const nextIndex = index + 1;
502
- this.focusRow(nextIndex);
503
- }
504
- else if (e.key === 'ArrowUp' && index > 0) {
505
- e.preventDefault();
506
- const prevIndex = index - 1;
507
- this.focusRow(prevIndex);
508
- }
509
- }
510
- this.onCellKeyDown?.(e, rows[index]);
511
- }
512
- focusRow(index) {
513
- const rowIndex = index ?? this.focusedRowIndex;
514
- // Scroll to the row using virtualizer if available
515
- this.rowVirtualizerController
516
- ?.getVirtualizer()
517
- .scrollToIndex(rowIndex ?? 0, { align: 'auto' });
518
- setTimeout(() => {
519
- const row = this.shadowRoot?.querySelector(`[data-row-index="${rowIndex}"]`);
520
- // Find the row element in the shadow DOM
521
- if (this.enableRowVirtualization) {
522
- if (row) {
523
- setTimeout(() => {
524
- row.focus();
525
- }, 0);
526
- }
527
- }
528
- else {
529
- if (row) {
530
- row.focus();
531
- row.scrollIntoView({ block: 'nearest' });
532
- }
533
- }
534
- }, 100);
535
- this.onRowFocusChanged?.(this.table, rowIndex);
536
- this.focusedRowIndex = rowIndex;
537
- }
538
- // Optimized getTanstackColumns for performance
539
- getTanstackColumns(columns) {
540
- // Cache config values to avoid repeated property lookups
541
- const userLang = this.userLang || 'cs';
542
- const dateFormat = this.dateFormat;
543
- const columnDefaultSize = this.columnDefaultSize;
544
- const columnDefaultMaxSize = this.columnDefaultMaxSize || 500;
545
- const columnDefaultMinSize = this.columnDefaultMinSize || 100;
546
- const enableFiltering = this.enableFiltering;
547
- const enablePinning = this.enablePinning;
548
- // Precompute type-based filterFns for all columns
549
- const typeToFilterFn = {
550
- numberRange: filterFns.inNumberRange,
551
- select: filterFns.weakEquals,
552
- multiselect: multiselectFilterFn,
553
- number: filterFns.weakEquals,
554
- currency: filterFns.weakEquals,
555
- dateRange: dateRangeFilterFn,
556
- dateTimeRange: dateRangeFilterFn,
557
- date: dateFilterFn,
558
- dateTime: dateFilterFn,
559
- string: filterFns.includesString,
560
- };
561
- return columns.map((column) => {
562
- const isDateType = column.type === 'date' ||
563
- column.type === 'dateTime' ||
564
- column.type === 'dateTimeRange' ||
565
- column.type === 'dateRange';
566
- // Precompute some column config
567
- const colType = column.type ?? 'string';
568
- const colField = column.field;
569
- const colHeader = column[`headerName_${userLang}`] || column.headerName;
570
- const colCell = column.cell;
571
- const colAggCell = column.aggregatedCell;
572
- const colCurrency = column.currency;
573
- const colNumDecimals = column.numberOfDecimal;
574
- const colValueOptions = column.valueOptions;
575
- const colFilterOperators = column.filterOperators;
576
- const colEnableSorting = column.enableSorting ?? true;
577
- const colEnableFilter = column.enableFilter ?? true;
578
- const colEnableGrouping = column.enableGrouping ?? true;
579
- const colSortDescFirst = column.sortDescFirst ?? true;
580
- const colEnableResizing = column.enableResizing ?? true;
581
- const colEnablePinning = column.enablePinning ?? true;
582
- const colSize = column.size || columnDefaultSize || undefined;
583
- const colMaxSize = column.maxSize || columnDefaultMaxSize;
584
- const colMinSize = column.minSize || columnDefaultMinSize;
585
- const colAggFn = column.columnAggregation ?? undefined;
586
- // Precompute filterFn
587
- const filterFn = typeToFilterFn[colType] || filterFns.includesString;
588
- // Precompute accessorFn
589
- let accessorFn;
590
- if (column.accessorFn) {
591
- accessorFn = column.accessorFn;
592
- }
593
- else {
594
- accessorFn = (originalRow) => originalRow[colField];
595
- }
596
- // Precompute cell renderer
597
- const cell = (props) => {
598
- const value = props.getValue();
599
- if (colType === 'actions') {
600
- return html `
601
- <lit-data-grid-row-actions
602
- @click=${(e) => {
603
- e.stopPropagation();
604
- this.onRowFocusChanged?.(this.table, props.row.index);
605
- }}
606
- .buttons=${column.getActions?.(props) || []}
607
- ></lit-data-grid-row-actions>
608
- `;
609
- }
610
- if ((colType === 'number' || colType === 'numberRange') && !colCell) {
611
- return html `<div style="text-align: right;">
612
- ${formatDecimal(value, {
613
- locale: userLang,
614
- numberOfDecimal: colNumDecimals || 0,
615
- })}
616
- </div>`;
617
- }
618
- if (colType === 'currency' && !colCell) {
619
- return html `<div style="text-align: right;">
620
- ${formatCurrency(value, {
621
- locale: userLang,
622
- currency: colCurrency,
623
- numberOfDecimal: colNumDecimals || 2,
624
- })}
625
- </div>`;
626
- }
627
- if (isDateType && !this.server) {
628
- return formatDate(value, userLang, colType === 'date' || colType === 'dateRange' ? undefined : true, dateFormat);
629
- }
630
- if (colType === 'thumbnail' && !colCell) {
631
- const thumbnailSize = this.rowDensity === 'compact' ? 24 : this.rowDensity === 'comfort' ? 40 : 30;
632
- return html `<div style="display: flex; align-items: center; justify-content: center; height: 100%;">
633
- <lit-document-thumbnail
634
- .thumbnail="${value?.thumbnail}"
635
- .fileType="${value?.fileType}"
636
- .size="${thumbnailSize}"
637
- .previewMaxWidth="${column.thumbnailPreviewMaxWidth ?? 300}"
638
- .previewMaxHeight="${column.thumbnailPreviewMaxHeight ?? 300}"
639
- .enableHoverPreview="${true}"
640
- .enableThumbnailDetail="${true}"
641
- ></lit-document-thumbnail>
642
- </div>`;
643
- }
644
- return colCell ? colCell(props, html, unsafeHTML) : value;
645
- };
646
- // Precompute aggregatedCell renderer
647
- const aggregatedCell = (props) => colAggCell ? colAggCell(props, html, unsafeHTML) : props.getValue();
648
- return {
649
- id: colField,
650
- accessorKey: colField,
651
- accessorFn,
652
- type: colType,
653
- header: colHeader,
654
- cell,
655
- filterFn,
656
- enableSorting: colEnableSorting,
657
- enableColumnFilter: enableFiltering && colEnableFilter,
658
- size: colSize,
659
- maxSize: colMaxSize,
660
- minSize: colMinSize,
661
- meta: {
662
- filterVariant: colType,
663
- valueOptions: colValueOptions,
664
- filterOperators: colFilterOperators,
665
- },
666
- aggregationFn: colAggFn,
667
- enableGrouping: colEnableGrouping,
668
- sortDescFirst: colSortDescFirst,
669
- enableResizing: colEnableResizing,
670
- enablePinning: enablePinning && colEnablePinning,
671
- aggregatedCell,
672
- };
673
- });
674
- }
675
- getCommonPinningStyles(column) {
676
- const isPinned = column.getIsPinned();
677
- if (!isPinned) {
678
- return {};
679
- }
680
- const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
681
- return {
682
- position: isPinned ? 'sticky' : 'relative',
683
- left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,
684
- right: isPinned === 'right' ? `0px` : undefined,
685
- boxShadow: isLastLeftPinnedColumn && column.columnDef.type !== 'checkbox'
686
- ? '-4px 0 4px -4px gray inset'
687
- : undefined,
688
- zIndex: `${isPinned ? 1 : 'auto'}`,
689
- background: isPinned ? 'var(--background-paper, #fff)' : undefined,
690
- };
691
- }
692
- togglePin(header) {
693
- if (header.column.getIsPinned()) {
694
- header.column.pin(false); // Odpinovanie
695
- }
696
- else {
697
- header.column.pin('left'); // Pripnutie doľava
698
- }
699
- }
700
- // export to excel and csv
701
- exportDataToCsv() {
702
- const rows = this.getAllRowsIncludingGrouped(this.table.getRowModel().rows); // Získanie všetkých riadkov vrátane skupín
703
- if (!rows || rows.length === 0) {
704
- console.warn('No data to export');
705
- return;
706
- }
707
- // Generovanie hlavičky CSV zo stĺpcov
708
- const vLang = this.userLang || 'cs';
709
- const header = this.columns
710
- .map((col) => col[`headerName_${vLang}`] || col.headerName || '') // Získanie názvov stĺpcov
711
- .join(',');
712
- // Generovanie dát pre CSV
713
- const csvRows = rows.map((row) => {
714
- return this.columns
715
- .map((col) => {
716
- const accessor = col.field; // Získanie kľúča pre hodnotu
717
- if (row.getIsGrouped?.()) {
718
- // Ak je skupinový riadok, pridaj počet záznamov do prvej bunky
719
- if (col.field === row.groupingColumnId) {
720
- return `"${row.getValue(col.field)} (${row.subRows.length})"`;
721
- }
722
- return ''; // Ostatné stĺpce v skupinovom riadku prázdne
723
- }
724
- const value = row.getValue?.(accessor) || ''; // Získanie hodnoty pre normálny riadok
725
- return typeof value === 'string'
726
- ? `"${value.replace(/"/g, '""')}"` // Ošetrenie dvojitých úvodzoviek
727
- : value;
728
- })
729
- .join(',');
730
- });
731
- // Pridanie hlavičky na začiatok CSV
732
- csvRows.unshift(header);
733
- // Vytvorenie CSV súboru
734
- const csvContent = csvRows.join('\n');
735
- const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
736
- // Export do súboru
737
- const fileName = prompt(msg('Zadejte název souboru:'), 'data');
738
- // Ak používateľ stlačí Cancel, export sa zruší
739
- if (!fileName) {
740
- return;
741
- }
742
- // Stiahnutie CSV súboru
743
- const url = URL.createObjectURL(blob);
744
- const link = document.createElement('a');
745
- link.href = url;
746
- link.download = `${fileName}.csv`;
747
- link.click();
748
- URL.revokeObjectURL(url);
749
- }
750
- async exportDataToExcel() {
751
- await this.loadXLSX(); // Ensure XLSX is loaded
752
- const XLSX = window.XLSX;
753
- const rows = this.getAllRowsIncludingGrouped(this.table.getRowModel().rows); // Získanie všetkých riadkov vrátane skupín
754
- if (!rows || rows.length === 0) {
755
- console.warn('No data to export');
756
- return;
757
- }
758
- // Príprava dát pre Excel
759
- const vLang = this.userLang || 'cs';
760
- const data = rows.map((row) => {
761
- const formattedRow = {};
762
- this.columns.forEach((col) => {
763
- const columnName = col[`headerName_${vLang}`] || col.headerName || ''; // Dynamický názov stĺpca
764
- const accessor = col.field; // Dynamický kľúč pre hodnoty
765
- if (row.getIsGrouped?.()) {
766
- // Skupinový riadok
767
- if (col.field === row.groupingColumnId) {
768
- // Pridanie názvu skupiny a počtu záznamov
769
- formattedRow[columnName] =
770
- `${row.getValue(accessor)} (${row.subRows.length})`;
771
- }
772
- else {
773
- // Ostatné stĺpce prázdne
774
- formattedRow[columnName] = '';
775
- }
776
- }
777
- else if (accessor) {
778
- // Normálny riadok
779
- formattedRow[columnName] = row.getValue?.(accessor) || '';
780
- }
781
- });
782
- return formattedRow;
783
- });
784
- // Vytvorenie pracovného listu a zošita
785
- const worksheet = XLSX.utils.json_to_sheet(data); // Konverzia dát do Excel formátu
786
- // Automatické prispôsobenie šírky stĺpcov
787
- const colWidths = this.columns.map((col, colIndex) => {
788
- const resolvedHeader = col[`headerName_${vLang}`] || col.headerName || '';
789
- const maxContentLength = Math.max(resolvedHeader.length || 10, // Dĺžka názvu stĺpca
790
- ...data.map((row) => row[resolvedHeader]?.toString().length || 0));
791
- return { wch: maxContentLength + 2 }; // Pridanie extra priestoru
792
- });
793
- worksheet['!cols'] = colWidths; // Nastavenie šírky stĺpcov
794
- const workbook = XLSX.utils.book_new(); // Nový Excel zošit
795
- XLSX.utils.book_append_sheet(workbook, worksheet, 'Data'); // Pridanie dát do zošita
796
- // Export do súboru
797
- const fileName = prompt(msg('Zadejte název souboru:'), 'data');
798
- // Ak používateľ stlačí Cancel, export sa zruší
799
- if (!fileName) {
800
- return;
801
- }
802
- XLSX.writeFile(workbook, `${fileName}.xlsx`);
803
- }
804
- getAllRowsIncludingGrouped(rows) {
805
- const allRows = [];
806
- rows.forEach((row) => {
807
- if (row.getIsGrouped?.()) {
808
- allRows.push(row);
809
- if (row.subRows && row.subRows.length > 0) {
810
- allRows.push(...this.getAllRowsIncludingGrouped(row.subRows));
811
- }
812
- }
813
- else {
814
- allRows.push(row);
815
- }
816
- });
817
- return allRows.filter((row, index, self) => index === self.findIndex((r) => r.id === row.id));
818
- }
819
- startScroll(direction) {
820
- const grid = this.tableContainerRef.value;
821
- if (!grid)
822
- return;
823
- const scrollAmount = direction === 'left' ? -15 : 15;
824
- const scroll = () => {
825
- grid.scrollLeft += scrollAmount;
826
- this.updateScrollState();
827
- this.scrollInterval = requestAnimationFrame(scroll);
828
- };
829
- this.scrollInterval = requestAnimationFrame(scroll);
830
- }
831
- stopScroll() {
832
- if (this.scrollInterval) {
833
- cancelAnimationFrame(this.scrollInterval);
834
- this.scrollInterval = null;
835
- }
836
- }
837
- // centralize your “at end” logic
838
- _atScrollEnd(container) {
839
- const thresh = this.scrollEndThreshold ?? 100;
840
- // if not scrollable OR within threshold of bottom
841
- return (container.scrollHeight <= container.clientHeight ||
842
- container.scrollTop + container.clientHeight >= container.scrollHeight - thresh);
843
- }
844
- _maybeTriggerScrollEnd() {
845
- if (this._atScrollEnd(this._container)) {
846
- if (this.onRowsScrollEnd && !this.isLoading && !this.scrollToEnd) {
847
- this.scrollToEnd = true;
848
- this.onRowsScrollEnd();
849
- }
850
- }
851
- else {
852
- // Reset scrollToEnd flag when not at the end anymore
853
- this.scrollToEnd = false;
854
- }
855
- }
856
- handleScroll(_event) {
857
- // every scroll, re‑test
858
- this._maybeTriggerScrollEnd();
859
- }
860
- handleGetTotalNumber() {
861
- if (this.getTotalNumberFn) {
862
- this.getTotalNumberFn();
863
- }
864
- }
865
- toggleCustomPopover() {
866
- this.isOpen = !this.isOpen;
867
- }
868
- closePopover() {
869
- this.isOpen = false;
870
- }
871
- toggleColumn(field) {
872
- this.columnVisibility = {
873
- ...this.columnVisibility,
874
- [field]: !(this.columnVisibility?.[field] ?? true),
875
- };
876
- this.table.setColumnVisibility(this.columnVisibility);
877
- }
878
- onSettingsChangedCallback(value) {
879
- if (value?.enableSorting !== undefined) {
880
- this.enableSorting = value.enableSorting;
881
- }
882
- if (value?.enableFiltering !== undefined) {
883
- this.enableFiltering = value.enableFiltering;
884
- }
885
- if (value?.columnDefaultSize !== undefined) {
886
- this.columnDefaultSize = value.columnDefaultSize;
887
- }
888
- if (value?.columnGroupedColor !== undefined) {
889
- this.columnGroupedColor = value.columnGroupedColor;
890
- }
891
- if (value?.rowAggregationColor !== undefined) {
892
- this.rowAggregationColor = value.rowAggregationColor;
893
- }
894
- if (value?.enableGrouping !== undefined) {
895
- this.enableGrouping = value.enableGrouping;
896
- }
897
- if (value?.exportData !== undefined) {
898
- this.exportData = value.exportData;
899
- }
900
- if (value?.actionButtonsInMenu !== undefined) {
901
- this.actionButtonsInMenu = value.actionButtonsInMenu;
902
- }
903
- if (value?.hideFooter !== undefined) {
904
- this.hideFooter = value.hideFooter;
905
- }
906
- if (value?.enableColumnPinning !== undefined) {
907
- this.enableColumnPinning = value.enableColumnPinning;
908
- }
909
- if (value?.alwaysFilter !== undefined) {
910
- this.alwaysFilter = value.alwaysFilter;
911
- }
912
- if (value?.alwaysFilterActive !== undefined) {
913
- this.alwaysFilterActive = value.alwaysFilterActive;
914
- }
915
- if (value?.emptyText !== undefined) {
916
- this.emptyText = value.emptyText;
917
- }
918
- this.initTable();
919
- this.requestUpdate();
920
- if (this.onSettingsChanged) {
921
- this.dispatchEvent(new CustomEvent('onSettingsChanged', {
922
- bubbles: true,
923
- composed: true,
924
- detail: value,
925
- }));
926
- this.onSettingsChanged?.(value);
927
- }
928
- }
929
- _onRowMouseDown(event, row) {
930
- this.handleMouseDown(event, row);
931
- // do not highlight cell text if multirow selection is enabled and shift key is pressed
932
- if (event.shiftKey) {
933
- if (event.currentTarget) {
934
- event.currentTarget.classList.add('no-select');
935
- }
936
- // Optionally, clear existing selection:
937
- const selection = window.getSelection();
938
- if (selection) {
939
- selection.removeAllRanges();
940
- }
941
- }
942
- }
943
- _onRowMouseUp(event) {
944
- event.currentTarget.classList.remove('no-select');
945
- }
946
- _rowUnselectAll(table) {
947
- table.resetRowSelection();
948
- this.focusedRowIndex = 0;
949
- }
950
- render() {
951
- const filteredColumns = this.columns?.filter((col) => {
952
- const name = (col[`headerName_${this.userLang}`] ||
953
- col.headerName ||
954
- col.field).toLowerCase();
955
- return name.includes(this.filterText);
956
- }) || [];
957
- // checbox column for multiple selection
958
- const checkboxColumn = this.enableMultiRowSelection
959
- ? [
960
- {
961
- id: 'checkboxForMultiselect',
962
- type: 'checkbox',
963
- minSize: 30,
964
- size: 30,
965
- enablePinning: false,
966
- enableResizing: false,
967
- header: ({ table }) => html `
968
- <div style="position: absolute; left: 0; bottom: 0; margin: 0.65rem 0;">
969
- <lit-checkbox
970
- type="checkbox"
971
- .onChange="${() => table.getIsSomeRowsSelected()
972
- ? this._rowUnselectAll(table)
973
- : table.toggleAllRowsSelected()}"
974
- .checked="${table.getIsAllRowsSelected()}"
975
- .indeterminate="${table.getIsSomeRowsSelected()}"
976
- ></lit-checkbox>
977
- </div>
978
- `,
979
- cell: ({ table, row }) => html `
980
- <div
981
- style="padding: 0.1875rem 0px 0px 0px"
982
- @click=${(e) => e.stopPropagation()}
983
- >
984
- <lit-checkbox
985
- type="checkbox"
986
- .onChange="${(e) => {
987
- e.stopPropagation();
988
- row.toggleSelected(e.target.checked);
989
- }}"
990
- .checked="${row.getIsSelected()}"
991
- ?disabled="${!row.getCanSelect()}"
992
- .indeterminate="${row.getIsSomeSelected()}"
993
- ></lit-checkbox>
994
- </div>
995
- `,
996
- },
997
- ]
998
- : [];
999
- this.table = this.tableController.table({
1000
- data: this.rows || [],
1001
- columns: [...checkboxColumn, ...this.getTanstackColumns(this.columns || [])],
1002
- columnResizeMode: 'onChange',
1003
- columnResizeDirection: 'ltr',
1004
- defaultColumn: {
1005
- size: this.columnDefaultSize || undefined, //starting column size
1006
- minSize: this.columnDefaultMinSize || 100, //enforced during column resizing
1007
- maxSize: this.columnDefaultMaxSize || 500, //enforced during column resizing
1008
- },
1009
- initialState: {
1010
- // columnFilters: [...(this.initialFiltering || [])],
1011
- // sorting: [...(this.initialSorting || [])],
1012
- // expanded: { ...this.initialRowExpanded },
1013
- columnVisibility: { ...this.initialColumnVisibility },
1014
- },
1015
- state: {
1016
- grouping: this.initialGroups,
1017
- columnVisibility: this.columnVisibility,
1018
- // columnFilters: this.server ? this.filtersServer : this.filters,
1019
- columnFilters: this.initialFiltering,
1020
- sorting: this.initialSorting,
1021
- rowSelection: this.rowsSelected,
1022
- columnSizing: this.columnSizing,
1023
- expanded: this.initialRowExpanded,
1024
- columnOrder: this.columnOrder,
1025
- columnPinning: {
1026
- left: [
1027
- 'checkboxForMultiselect',
1028
- ...(this.leftPinnedColumns ?? []).filter((col) => col !== 'checkboxForMultiselect'),
1029
- ],
1030
- right: [
1031
- 'actions',
1032
- ...(this.rightPinnedColumns ?? []).filter((col) => col !== 'actions'),
1033
- ],
1034
- },
1035
- },
1036
- filterFns: {
1037
- dateRangeFilterFn: dateRangeFilterFn,
1038
- dateFilterFn: dateFilterFn,
1039
- multiselectFilterFn: multiselectFilterFn,
1040
- },
1041
- // debugTable: true,
1042
- enableRowSelection: this.enableRowSelection,
1043
- enableMultiRowSelection: this.enableMultiRowSelection,
1044
- enableColumnPinning: this.enableColumnPinning,
1045
- enableGrouping: this.enableGrouping,
1046
- manualFiltering: this.server,
1047
- manualSorting: this.server,
1048
- enableSorting: this.enableSorting,
1049
- getRowId: (row, index) => {
1050
- if (this.getRowId) {
1051
- return this.getRowId(row, index);
1052
- }
1053
- return index.toString();
1054
- },
1055
- // groupedColumnMode: 'reorder',
1056
- getCoreRowModel: getCoreRowModel(),
1057
- getSortedRowModel: getSortedRowModel(),
1058
- getFilteredRowModel: getFilteredRowModel(),
1059
- getFacetedRowModel: getFacetedRowModel(),
1060
- getGroupedRowModel: getGroupedRowModel(),
1061
- getExpandedRowModel: getExpandedRowModel(),
1062
- getFacetedUniqueValues: getFacetedUniqueValues(),
1063
- onColumnFiltersChange: (updaterOrValue) => {
1064
- // Preserve expanded state before filtering
1065
- const currentExpandedState = this.table.getState().expanded;
1066
- this.currentScrollTop = 0;
1067
- const scrollElement = this.tableContainerRef.value;
1068
- if (scrollElement) {
1069
- scrollElement.scrollTop = 0;
1070
- }
1071
- const filtersState = typeof updaterOrValue === 'function'
1072
- ? updaterOrValue(this.table.getState().columnFilters)
1073
- : updaterOrValue;
1074
- this.initialFiltering = filtersState;
1075
- // Restore expanded state after filtering
1076
- if (currentExpandedState && Object.keys(currentExpandedState).length > 0) {
1077
- setTimeout(() => {
1078
- this.table.setExpanded(currentExpandedState);
1079
- }, 0);
1080
- }
1081
- if (this.onColumnFiltersChanged) {
1082
- this.onColumnFiltersChanged(this.table, filtersState);
1083
- }
1084
- },
1085
- onSortingChange: (updaterOrValue) => {
1086
- this.currentScrollTop = 0;
1087
- const scrollElement = this.tableContainerRef.value;
1088
- if (scrollElement) {
1089
- scrollElement.scrollTop = 0;
1090
- }
1091
- const sortingState = typeof updaterOrValue === 'function'
1092
- ? updaterOrValue(this.table.getState().sorting)
1093
- : updaterOrValue;
1094
- this.initialSorting = sortingState;
1095
- if (this.onColumnSortChanged) {
1096
- this.onColumnSortChanged(this.table, sortingState);
1097
- }
1098
- },
1099
- onRowSelectionChange: (updaterOrValue) => {
1100
- const rowSelection = typeof updaterOrValue === 'function'
1101
- ? updaterOrValue(this.rowsSelected)
1102
- : updaterOrValue;
1103
- this.rowsSelected = rowSelection;
1104
- if (this.onRowSelectionChanged) {
1105
- this.onRowSelectionChanged(this.table, rowSelection);
1106
- }
1107
- },
1108
- onColumnSizingChange: (updaterOrValue) => {
1109
- const columnSizingState = typeof updaterOrValue === 'function'
1110
- ? updaterOrValue(this.table.getState().columnSizing)
1111
- : updaterOrValue;
1112
- this.columnSizing = columnSizingState;
1113
- if (this.onColumnResize) {
1114
- this.onColumnResize(this.table, columnSizingState);
1115
- }
1116
- },
1117
- onExpandedChange: (updaterOrValue) => {
1118
- const rowExpanded = typeof updaterOrValue === 'function'
1119
- ? updaterOrValue(this.table.getState().expanded)
1120
- : updaterOrValue;
1121
- this.initialRowExpanded = rowExpanded;
1122
- if (this.onRowExpanded) {
1123
- this.onRowExpanded(this.table, this.initialRowExpanded);
1124
- }
1125
- },
1126
- onColumnOrderChange: (updaterOrValue) => {
1127
- const newOrder = typeof updaterOrValue === 'function'
1128
- ? updaterOrValue(this.columnOrder)
1129
- : updaterOrValue;
1130
- this.columnOrder = newOrder;
1131
- this.render();
1132
- if (this.onColumnOrderChanged) {
1133
- this.onColumnOrderChanged(this.table, newOrder);
1134
- }
1135
- },
1136
- onColumnVisibilityChange: (updaterOrValue) => {
1137
- const columnVisibility = typeof updaterOrValue === 'function'
1138
- ? updaterOrValue(this.table.getState().columnVisibility)
1139
- : updaterOrValue;
1140
- this.columnVisibility = columnVisibility;
1141
- if (this.onColumnVisibilityChanged) {
1142
- this.onColumnVisibilityChanged(this.table, columnVisibility);
1143
- }
1144
- },
1145
- onColumnPinningChange: (updaterOrValue) => {
1146
- const columnPinning = typeof updaterOrValue === 'function'
1147
- ? updaterOrValue(this.table.getState().columnPinning)
1148
- : updaterOrValue;
1149
- this.leftPinnedColumns = columnPinning.left || [];
1150
- if (this.onColumnPinningChanged) {
1151
- this.onColumnPinningChanged(this.table, columnPinning);
1152
- }
1153
- },
1154
- onGroupingChange: (updaterOrValue) => {
1155
- // Preserve expanded state before grouping
1156
- const currentExpandedState = this.table.getState().expanded;
1157
- const groupingState = typeof updaterOrValue === 'function'
1158
- ? updaterOrValue(this.table.getState().grouping)
1159
- : updaterOrValue;
1160
- this.initialGroups = groupingState;
1161
- // Restore expanded state after grouping
1162
- if (currentExpandedState && Object.keys(currentExpandedState).length > 0) {
1163
- setTimeout(() => {
1164
- this.table.setExpanded(currentExpandedState);
1165
- }, 0);
1166
- }
1167
- if (this.onGroupingChanged) {
1168
- this.onGroupingChanged(this.table, groupingState);
1169
- }
1170
- },
1171
- });
1172
- const rowModel = this.table.getRowModel();
1173
- const { rows } = rowModel;
1174
- const rowsLength = rows.length;
1175
- // Update virtualizer and trigger scroll-end check when row count changes
1176
- // Done here instead of via @state to avoid scheduling updates during render
1177
- if (this._prevRowsCount !== rowsLength) {
1178
- this._prevRowsCount = rowsLength;
1179
- this.scrollToEnd = false;
1180
- if (this.enableRowVirtualization) {
1181
- const virtualizer = this.rowVirtualizerController?.getVirtualizer();
1182
- if (virtualizer) {
1183
- virtualizer.setOptions({
1184
- ...virtualizer.options,
1185
- count: rowsLength,
1186
- });
1187
- }
1188
- }
1189
- setTimeout(() => this._maybeTriggerScrollEnd(), 100);
1190
- }
1191
- // Pre-calculate row height to avoid repeated function calls
1192
- const cachedRowHeight = this.getRowHeight();
1193
- // Cache expensive calls to avoid recalculation on every render
1194
- const rowVirtualizer = this.enableRowVirtualization
1195
- ? this.rowVirtualizerController?.getVirtualizer()
1196
- : null;
1197
- const columnVirtualizer = this.enableColumnVirtualization
1198
- ? this.columnVirtualizerController?.getVirtualizer()
1199
- : null;
1200
- const virtualColumns = columnVirtualizer?.getVirtualItems() ?? [];
1201
- const rowItems = rowVirtualizer
1202
- ? rowVirtualizer.getVirtualItems()
1203
- : rows.length > 0
1204
- ? rows.map((_, index) => ({
1205
- key: index,
1206
- index,
1207
- start: index * cachedRowHeight,
1208
- end: (index + 1) * cachedRowHeight,
1209
- size: cachedRowHeight,
1210
- lane: 0,
1211
- }))
1212
- : [];
1213
- // Calculate padding for virtualization
1214
- let virtualPaddingLeft;
1215
- let virtualPaddingRight;
1216
- if (columnVirtualizer && virtualColumns?.length && this.enableColumnVirtualization) {
1217
- virtualPaddingLeft = virtualColumns[0]?.start ?? 0;
1218
- virtualPaddingRight =
1219
- columnVirtualizer.getTotalSize() -
1220
- (virtualColumns[virtualColumns.length - 1]?.end ?? 0);
1221
- }
1222
- // Cache common styles that don't change per row
1223
- const commonRowStyles = {
1224
- height: `${cachedRowHeight}px`,
1225
- lineHeight: `${cachedRowHeight}px`,
1226
- };
1227
- // Create caches for expensive style calculations
1228
- const pinningStylesCache = new Map();
1229
- const backgroundColorCache = new Map();
1230
- // Helper to get cached pinning styles
1231
- const getCachedPinningStyles = (column) => {
1232
- const cacheKey = `${column.id}-${column.getIsPinned()}-${column.getStart?.('left') || 0}`;
1233
- if (!pinningStylesCache.has(cacheKey)) {
1234
- pinningStylesCache.set(cacheKey, this.getCommonPinningStyles(column));
1235
- }
1236
- return pinningStylesCache.get(cacheKey);
1237
- };
1238
- // Helper to get cached background colors
1239
- const getCachedBackgroundColor = (cell) => {
1240
- const cacheKey = `${cell.id}-${cell.getIsGrouped()}-${cell.getIsAggregated()}-${cell.getIsPlaceholder()}-${cell.column.getIsPinned()}`;
1241
- if (!backgroundColorCache.has(cacheKey)) {
1242
- backgroundColorCache.set(cacheKey, this.getCellBackgroundColor(cell));
1243
- }
1244
- return backgroundColorCache.get(cacheKey);
1245
- };
1246
- let isMobile = window.matchMedia('(max-width: 600px)').matches;
1247
- return html `
1248
- <div
1249
- class="data-grid__wrapper"
1250
- style="min-height: ${rowsLength < 1 ? '14.375rem' : ''}"
1251
- >
1252
- ${this.isScrollable && !isMobile
1253
- ? html `
1254
- <lit-icon-button
1255
- class="scroll-button left"
1256
- .disabled="${this.disableScrollLeft}"
1257
- @pointerdown="${() => this.startScroll('left')}"
1258
- @pointerup="${this.stopScroll}"
1259
- @pointerleave="${this.stopScroll}"
1260
- size="small"
1261
- variant="contained"
1262
- icon="arrowLeft"
1263
- >
1264
- </lit-icon-button>
1265
- <lit-icon-button
1266
- class="scroll-button right"
1267
- .disabled="${this.disableScrollRight}"
1268
- @pointerdown="${() => this.startScroll('right')}"
1269
- @pointerup="${this.stopScroll}"
1270
- @pointerleave="${this.stopScroll}"
1271
- size="small"
1272
- variant="contained"
1273
- icon="arrowRight"
1274
- >
1275
- </lit-icon-button>
1276
- `
1277
- : null}
1278
-
1279
- <div class="grid" ${ref(this.tableContainerRef)}>
1280
- <table
1281
- part="dataGrid-table"
1282
- style="width: ${this.table.getCenterTotalSize()}px"
1283
- >
1284
- <thead
1285
- part="dataGrid-header"
1286
- style="height: ${this.enableFiltering ? '4rem' : '1.625rem'};"
1287
- >
1288
- ${repeat(this.table.getHeaderGroups(), (headerGroup) => headerGroup.id, (headerGroup) => {
1289
- const headerColumns = this.enableColumnVirtualization
1290
- ? virtualColumns.map((vc) => headerGroup.headers[vc.index])
1291
- : headerGroup.headers;
1292
- const newHeaderColumns = this.enableColumnVirtualization
1293
- ? [
1294
- ...headerGroup.headers.filter((hc) => hc.column.getIsPinned()),
1295
- ...headerColumns.filter((hc) => !hc.column.getIsPinned()),
1296
- ]
1297
- : headerColumns;
1298
- return html `
1299
- <tr class="head" data-index="${headerGroup.id}">
1300
- ${virtualPaddingLeft
1301
- ? html `
1302
- <th
1303
- style=" display: flex; width: ${virtualPaddingLeft}px;"
1304
- ></th>
1305
- `
1306
- : ''}
1307
- ${repeat(newHeaderColumns, (header) => header.id, (header, index) => {
1308
- const column = header.column;
1309
- const style = {
1310
- visibility: column.columnDef.type === 'actions'
1311
- ? 'hidden'
1312
- : 'visible',
1313
- ...getCachedPinningStyles(header.column),
1314
- width: `${column?.getSize()}px`,
1315
- flexGrow: `${column.columnDef.size === undefined ? 1 : 'unset'}`,
1316
- };
1317
- const filterVariant = column.columnDef.meta?.filterVariant;
1318
- const filterOperators = column?.columnDef?.meta?.filterOperators ||
1319
- getOperatorsByColumnType(filterVariant);
1320
- const value = column?.getFilterValue()?.value ||
1321
- column?.getFilterValue() ||
1322
- '';
1323
- const operator = column?.getFilterValue()?.operator ||
1324
- filterOperators[0]?.value;
1325
- let valueOptions = [];
1326
- if (filterVariant === 'select' ||
1327
- filterVariant === 'multiselect') {
1328
- if (column?.columnDef?.meta.valueOptions ||
1329
- this.server) {
1330
- valueOptions =
1331
- column?.columnDef?.meta
1332
- .valueOptions || [];
1333
- }
1334
- else {
1335
- const sortedUniqueValues = Array.from(column
1336
- ?.getFacetedUniqueValues()
1337
- .keys())
1338
- .sort()
1339
- .slice(0, 5000);
1340
- valueOptions = sortedUniqueValues.map((value) => ({
1341
- value,
1342
- label: value,
1343
- }));
1344
- }
1345
- }
1346
- return html `
1347
- <th
1348
- class="head"
1349
- style="${styleMap(style)}"
1350
- colspan="${header.colSpan}"
1351
- data-index="${header.id}"
1352
- >
1353
- ${header.isPlaceholder
1354
- ? ''
1355
- : html `
1356
- <div
1357
- class="resizer ${this
1358
- .table.options
1359
- .columnResizeDirection} ${header.column.getIsResizing()
1360
- ? 'is-resizing'
1361
- : ''}"
1362
- style="transform: ${this
1363
- .table.options
1364
- .columnResizeMode ===
1365
- 'onEnd' &&
1366
- header.column.getIsResizing()
1367
- ? `translateX(${(this.table
1368
- .options
1369
- .columnResizeDirection ===
1370
- 'rtl'
1371
- ? -1
1372
- : 1) *
1373
- (this.table.getState()
1374
- .columnSizingInfo
1375
- .deltaOffset ??
1376
- 0)}px)`
1377
- : ''}"
1378
- >
1379
- <div class="header">
1380
- ${header.column.getIsFiltered()
1381
- ? html `
1382
- <div
1383
- class="filterCirclePoint"
1384
- ></div>
1385
- `
1386
- : ''}
1387
- <div
1388
- class="column-header"
1389
- @click=${header.column.getToggleSortingHandler()}
1390
- >
1391
- <lit-overflow-tooltip
1392
- label="${header
1393
- .column
1394
- .columnDef
1395
- .header}"
1396
- >
1397
- ${flexRender(header
1398
- .column
1399
- .columnDef
1400
- .header, header.getContext())}
1401
- </lit-overflow-tooltip>
1402
- </div>
1403
-
1404
- <div
1405
- class="icons-group-pin"
1406
- >
1407
- ${header.column.getCanSort()
1408
- ? header.column.getIsSorted()
1409
- ? header.column.getIsSorted() ===
1410
- 'asc'
1411
- ? html `<slot
1412
- name="iconSortUp"
1413
- ><lit-icon
1414
- class="cursor"
1415
- @click=${header.column.getToggleSortingHandler()}
1416
- size="0.75rem"
1417
- icon="chevronUpFilled"
1418
- ></lit-icon
1419
- ></slot>`
1420
- : html `<slot
1421
- name="iconSortDown"
1422
- >
1423
- <lit-icon
1424
- class="cursor"
1425
- @click=${header.column.getToggleSortingHandler()}
1426
- size="0.75rem"
1427
- icon="chevronDownFilled"
1428
- ></lit-icon>
1429
- </slot>`
1430
- : html `<div
1431
- class="sortFilled"
1432
- >
1433
- <lit-icon
1434
- class="cursor"
1435
- @click=${header.column.getToggleSortingHandler()}
1436
- size="0.75rem"
1437
- icon="sortFilled"
1438
- ></lit-icon>
1439
- </div>`
1440
- : html `<div></div>`}
1441
- <div class="flex">
1442
- ${!this
1443
- .actionButtonsInMenu
1444
- ? html `
1445
- ${header.column.getCanPin()
1446
- ? html `
1447
- <lit-icon-button
1448
- @click="${() => this.togglePin(header)}"
1449
- size="small"
1450
- variant="text"
1451
- color="secondary"
1452
- icon="pin"
1453
- .active="${header.column.getIsPinned()}"
1454
- ${tooltip(header.column.getIsPinned()
1455
- ? msg('Zrušit připnutí sloupce')
1456
- : msg('Připnout sloupec vlevo'), 'bottom')}
1457
- >
1458
- </lit-icon-button>
1459
- `
1460
- : ''}
1461
- ${header.column.getCanGroup()
1462
- ? html `
1463
- <lit-icon-button
1464
- @click="${header.column.getToggleGroupingHandler()}"
1465
- size="small"
1466
- variant="text"
1467
- color="secondary"
1468
- .active="${header.column.getIsGrouped()}"
1469
- icon="agregation"
1470
- ${tooltip(header.column.getIsGrouped()
1471
- ? msg('Zrušit seskupení')
1472
- : msg('Seskupit sloupec'), 'bottom')}
1473
- >
1474
- </lit-icon-button>
1475
- `
1476
- : ''}
1477
- `
1478
- : html `
1479
- <lit-data-grid-action-buttons-popover
1480
- .group="${header.column.getToggleGroupingHandler()}"
1481
- .pin="${() => this.togglePin(header)}"
1482
- .header="${header}"
1483
- .table="${this
1484
- .table}"
1485
- ></lit-data-grid-action-buttons-popover>
1486
- `}
1487
- ${this
1488
- .enableColumnOrdering &&
1489
- !header.column.getIsPinned() &&
1490
- !header.column.getIsGrouped() &&
1491
- ![
1492
- 'checkbox',
1493
- 'actions',
1494
- ].includes(header
1495
- .column
1496
- .id)
1497
- ? html `<div
1498
- class="drag-handle"
1499
- >
1500
- <lit-icon
1501
- icon="hamburger"
1502
- size="1rem"
1503
- ></lit-icon>
1504
- </div>
1505
- <simple-tooltip
1506
- placement="bottom"
1507
- >${msg('Přesunout sloupec')}</simple-tooltip
1508
- > `
1509
- : null}
1510
- </div>
1511
- </div>
1512
- </div>
1513
- </div>
1514
- ${header.column.getCanFilter()
1515
- ? html `
1516
- <div>
1517
- <filter-inputs
1518
- .minFilterCharacters=${this
1519
- .minFilterCharacters}
1520
- .column=${header.column}
1521
- .dateFormat=${this
1522
- .dateFormat}
1523
- .userLang=${this
1524
- .userLang}
1525
- @filter-tab=${this
1526
- .handleFilterTabNavigation}
1527
- .server=${this
1528
- .server}
1529
- .value="${value}"
1530
- .operator="${operator}"
1531
- .filterVariant="${filterVariant}"
1532
- .filterOperators="${filterOperators}"
1533
- ></filter-inputs>
1534
- </div>
1535
- `
1536
- : null}
1537
- `}
1538
- <div
1539
- class="resize-handle"
1540
- @dblclick="${(event) => {
1541
- if (event.target.classList.contains('resize-handle')) {
1542
- header.column.resetSize();
1543
- }
1544
- }}"
1545
- @mousedown="${(event) => {
1546
- event.preventDefault();
1547
- event.stopPropagation();
1548
- if (event.target.classList.contains('resize-handle')) {
1549
- header.getResizeHandler()(event);
1550
- }
1551
- }}"
1552
- @touchstart="${(event) => {
1553
- event.preventDefault();
1554
- event.stopPropagation();
1555
- if (event.target.classList.contains('resize-handle')) {
1556
- header.getResizeHandler()(event);
1557
- }
1558
- }}"
1559
- ></div>
1560
- </th>
1561
- `;
1562
- })}
1563
- ${virtualPaddingRight
1564
- ? html `
1565
- <th
1566
- style=" display: flex; width: ${virtualPaddingRight}px;"
1567
- ></th>
1568
- `
1569
- : ''}
1570
- </tr>
1571
- `;
1572
- })}
1573
- ${this.isLoading
1574
- ? html `
1575
- <div style="position: absolute; bottom: 0px; width: 100%;">
1576
- <lit-loading-bar></lit-loading-bar>
1577
- </div>
1578
- `
1579
- : ''}
1580
- </thead>
1581
-
1582
- <tbody
1583
- @keydown=${this.handleKeyDown}
1584
- tabindex="0"
1585
- part="dataGrid-body"
1586
- style="height: ${rowVirtualizer && rows.length > 0
1587
- ? rowVirtualizer.getTotalSize() + 'px'
1588
- : rows.length < 1
1589
- ? '8.125rem'
1590
- : 'auto'};"
1591
- >
1592
- ${rows.length > 0
1593
- ? repeat(rowItems, (item) => item.key, (item) => {
1594
- const row = rows[item.index];
1595
- if (!row)
1596
- return null;
1597
- const visibleCells = row.getVisibleCells();
1598
- if (!visibleCells)
1599
- return null;
1600
- // Optimize column calculations
1601
- let newBodyColumns;
1602
- if (this.enableColumnVirtualization) {
1603
- const pinnedColumns = visibleCells.filter((cell) => cell.column.getIsPinned());
1604
- const virtualBodyColumns = virtualColumns
1605
- .map((vc) => visibleCells[vc.index])
1606
- .filter(Boolean);
1607
- // Use Set for deduplication only when necessary
1608
- const combinedColumns = [
1609
- ...pinnedColumns,
1610
- ...virtualBodyColumns,
1611
- ];
1612
- newBodyColumns =
1613
- pinnedColumns.length > 0
1614
- ? [...new Set(combinedColumns)]
1615
- : virtualBodyColumns;
1616
- }
1617
- else {
1618
- newBodyColumns = visibleCells;
1619
- }
1620
- // Optimize row styles
1621
- const rowStyle = {
1622
- ...commonRowStyles,
1623
- transform: rowVirtualizer
1624
- ? `translateY(${item.start}px)`
1625
- : 'none',
1626
- position: rowVirtualizer ? 'absolute' : 'relative',
1627
- };
1628
- return row
1629
- ? html `
1630
- <tr
1631
- tabindex=${this.enableRowSelection
1632
- ? '0'
1633
- : undefined}
1634
- data-row-index="${row.index}"
1635
- class="${this.rowsSelected[row.id]
1636
- ? 'selected body'
1637
- : 'body'}"
1638
- data-index="${item.index}"
1639
- @click="${row.getIsGrouped()
1640
- ? row.getToggleExpandedHandler()
1641
- : (e) => this.handleRowClick(e, row)}"
1642
- @mousedown=${(e) => this._onRowMouseDown(e, row)}
1643
- @mouseup=${this._onRowMouseUp}
1644
- @mouseleave=${this._onRowMouseUp}
1645
- @contextmenu=${(e) => e.preventDefault()}
1646
- @dblclick="${() => this.handleRowDoubleClick(row)}"
1647
- @touchend="${() => this.handleRowDoubleClick(row)}"
1648
- style="${styleMap(rowStyle)}"
1649
- ${ref(() => {
1650
- // No measurement needed - using fixed row heights
1651
- })}
1652
- >
1653
- ${virtualPaddingLeft
1654
- ? html `
1655
- <th
1656
- style=" display: flex; width: ${virtualPaddingLeft}px;"
1657
- ></th>
1658
- `
1659
- : ''}
1660
- <!-- Cells for each row -->
1661
- ${repeat(newBodyColumns, (cell) => cell.key, (cell) => {
1662
- const { column } = cell;
1663
- const style = {
1664
- ...getCachedPinningStyles(cell.column),
1665
- width: `${cell.column?.getSize()}px`,
1666
- flexGrow: `${column.columnDef.size === undefined ? 1 : 'unset'}`,
1667
- background: getCachedBackgroundColor(cell),
1668
- lineHeight: `${cachedRowHeight}px`,
1669
- padding: column.columnDef.type ===
1670
- 'actions' ||
1671
- column.columnDef.type ===
1672
- 'checkbox' ||
1673
- column.columnDef.type ===
1674
- 'thumbnail'
1675
- ? '0'
1676
- : '0px 14px',
1677
- overflow: column.columnDef.type ===
1678
- 'thumbnail'
1679
- ? 'visible'
1680
- : undefined,
1681
- justifyContent: column.columnDef.type ===
1682
- 'thumbnail'
1683
- ? 'center'
1684
- : undefined,
1685
- };
1686
- return html `
1687
- <td style="${styleMap(style)}">
1688
- ${cell.getIsGrouped()
1689
- ? html `<div
1690
- class="grouped-column"
1691
- >
1692
- <lit-icon
1693
- class="grouped-column--icon-button"
1694
- size="1.25rem"
1695
- icon="${row.getIsExpanded()
1696
- ? 'chevronDownFilled'
1697
- : 'chevron'}"
1698
- ></lit-icon>
1699
- <div
1700
- class="grouped-column--label"
1701
- >
1702
- <lit-overflow-tooltip
1703
- label=${this.table.getColumn(cell
1704
- .column
1705
- .id)
1706
- ?.columnDef
1707
- .cell
1708
- ? flexRender(this.table.getColumn(cell
1709
- .column
1710
- .id)
1711
- .columnDef
1712
- .cell, cell.getContext())
1713
- : cell.getValue()}
1714
- >
1715
- ${this.table.getColumn(cell
1716
- .column
1717
- .id)
1718
- ?.columnDef
1719
- .cell
1720
- ? flexRender(this.table.getColumn(cell
1721
- .column
1722
- .id)
1723
- .columnDef
1724
- .cell, cell.getContext())
1725
- : cell.getValue()}
1726
- </lit-overflow-tooltip>
1727
- </div>
1728
- <lit-pill
1729
- class="grouped-column--pill"
1730
- style="margin-left: 0.5rem"
1731
- count="${row
1732
- .subRows
1733
- .length}"
1734
- ></lit-pill>
1735
- </div>`
1736
- : cell.getIsAggregated()
1737
- ? html `
1738
- <div
1739
- style="flex-grow:1"
1740
- >
1741
- ${flexRender(cell
1742
- .column
1743
- .columnDef
1744
- .aggregatedCell ??
1745
- cell
1746
- .column
1747
- .columnDef
1748
- .cell, cell.getContext())}
1749
- </div>
1750
- `
1751
- : cell.getIsPlaceholder()
1752
- ? null
1753
- : column.columnDef.type === 'thumbnail'
1754
- ? flexRender(cell
1755
- .column
1756
- .columnDef
1757
- .cell, cell.getContext())
1758
- : html `<lit-overflow-tooltip
1759
- placement="right"
1760
- label=${flexRender(cell
1761
- .column
1762
- .columnDef
1763
- .cell, cell.getContext())}
1764
- >
1765
- ${flexRender(cell
1766
- .column
1767
- .columnDef
1768
- .cell, cell.getContext())}
1769
- </lit-overflow-tooltip>`}
1770
- </td>
1771
- `;
1772
- })}
1773
- ${virtualPaddingRight
1774
- ? html `
1775
- <th
1776
- style=" display: flex; width: ${virtualPaddingRight}px;"
1777
- ></th>
1778
- `
1779
- : ''}
1780
- </tr>
1781
- `
1782
- : null;
1783
- })
1784
- : null}
1785
- </tbody>
1786
- </table>
1787
- </div>
1788
- ${!this.hideFooter || this.exportData || this.enableSettings
1789
- ? html `
1790
- <slot
1791
- part="dataGrid-footer"
1792
- name="dataGridFooter"
1793
- class="footer-container"
1794
- >
1795
- ${!this.hideFooter
1796
- ? html ` <div class="numberCount">
1797
- ${msg('Počet záznamů')}: ${rows.length}
1798
- <pre>/</pre>
1799
- ${this.server
1800
- ? this.totalNumberRows
1801
- ? this.totalNumberRows
1802
- : '?'
1803
- : rows.length}
1804
- ${this.server
1805
- ? html `<lit-icon-button
1806
- icon="reload"
1807
- size="mini"
1808
- variant="text"
1809
- color="secondary"
1810
- @click="${() => this.handleGetTotalNumber()}"
1811
- style="margin-left: 0.2rem; margin-top: -0.1rem"
1812
- ></lit-icon-button>`
1813
- : ''}
1814
- </div>`
1815
- : ''}
1816
- <div class="right-actions">
1817
- ${!this.hideFooter
1818
- ? html `
1819
- <lit-data-grid-density-popover
1820
- .density="${this.rowDensity}"
1821
- .setDensity="${(density) => this.handleSetDensity(density)}"
1822
- >
1823
- </lit-data-grid-density-popover>
1824
- <lit-responsive-button
1825
- size="medium"
1826
- variant="text"
1827
- color="secondary"
1828
- label=${msg('Přizpůsobit sloupce')}
1829
- icon="columns"
1830
- @click=${() => this.table.resetColumnSizing()}
1831
- ></lit-responsive-button>
1832
- `
1833
- : ''}
1834
- ${this.exportData
1835
- ? html `
1836
- <lit-data-grid-export-popover
1837
- .exportToCsv="${typeof this.exportExcelFn ===
1838
- 'function'
1839
- ? () => this.exportCsvFn && this.exportCsvFn()
1840
- : () => this.exportDataToCsv()}"
1841
- .exportToExcel="${typeof this.exportExcelFn ===
1842
- 'function'
1843
- ? () => this.exportExcelFn &&
1844
- this.exportExcelFn()
1845
- : () => this.exportDataToExcel()}"
1846
- .disabledButtons="${this.isLoading}"
1847
- >
1848
- </lit-data-grid-export-popover>
1849
- `
1850
- : null}
1851
- ${this.enableSettings
1852
- ? html `
1853
- <div>
1854
- <lit-responsive-button
1855
- color="secondary"
1856
- variant="dashed"
1857
- label="${msg('Přiřadit sloupec')}"
1858
- icon="add"
1859
- style="display: inline-block"
1860
- @click="${this.toggleCustomPopover}"
1861
- ></lit-responsive-button>
1862
-
1863
- <simple-popper
1864
- .showing=${this.isOpen}
1865
- .placement=${'top-end'}
1866
- .manualOpening=${true}
1867
- .maxWidthAsTarget=${false}
1868
- .onClose=${() => this.closePopover()}
1869
- >
1870
- <div
1871
- class="popper-input"
1872
- style="position: sticky; top: 0; z-index: 1;"
1873
- >
1874
- <lit-input
1875
- .value=${this.filterText}
1876
- .onInput=${(value) => {
1877
- this.filterText =
1878
- value?.toLowerCase?.() ||
1879
- '';
1880
- }}
1881
- .onClear=${() => {
1882
- this.filterText = '';
1883
- }}
1884
- placeholder="${msg('Zadejte název sloupce')}"
1885
- ></lit-input>
1886
- </div>
1887
- <lit-menu tabindex="0">
1888
- ${this.columns
1889
- .filter((col) => {
1890
- const name = col?.headerName?.toLowerCase() ||
1891
- col?.field.toLowerCase();
1892
- return name.includes(this.filterText);
1893
- })
1894
- .sort((a, b) => {
1895
- const aUnderscore = a.field.startsWith('_');
1896
- const bUnderscore = b.field.startsWith('_');
1897
- if (aUnderscore && !bUnderscore)
1898
- return 1;
1899
- if (!aUnderscore && bUnderscore)
1900
- return -1;
1901
- return (a.headerName || a.field).localeCompare(b.headerName || b.field);
1902
- })
1903
- .map((col) => html `
1904
- <lit-menu-item
1905
- .onClick=${() => this.toggleColumn(col?.field)}
1906
- .isActive=${!(this
1907
- .columnVisibility?.[col?.field] === false)}
1908
- >
1909
- <span
1910
- class="menu-item--multiple"
1911
- >
1912
- <lit-checkbox
1913
- class="cursor"
1914
- .checked=${!(this
1915
- .columnVisibility?.[col
1916
- ?.field] === false)}
1917
- ></lit-checkbox>
1918
- ${col?.headerName ||
1919
- col?.field}
1920
- </span>
1921
- </lit-menu-item>
1922
- `)}
1923
- </lit-menu>
1924
-
1925
- ${isEqual(filteredColumns.length, 0)
1926
- ? html `
1927
- <div
1928
- style="display: flex; flex-direction: column; align-items: center; padding: 1rem;"
1929
- >
1930
- <div
1931
- style="max-height: 6rem; max-width: 6rem;"
1932
- >
1933
- <not-found></not-found>
1934
- </div>
1935
- <div>
1936
- ${msg('Nenalezeno')}
1937
- </div>
1938
- </div>
1939
- `
1940
- : null}
1941
- </simple-popper>
1942
-
1943
- <lit-icon-button
1944
- icon="administration"
1945
- @click="${this.toggleModal}"
1946
- variant="dashed"
1947
- color="secondary"
1948
- style="display: inline-block"
1949
- ></lit-icon-button>
1950
- <data-grid-settings
1951
- .onClose="${() => {
1952
- this.isOpenModal = false;
1953
- }}"
1954
- .isOpenModal="${this.isOpenModal}"
1955
- .enableFiltering="${this.enableFiltering}"
1956
- .enableSorting="${this.enableSorting}"
1957
- .columnDefaultSize="${this
1958
- .columnDefaultSize}"
1959
- .columnGroupedColor="${this
1960
- .columnGroupedColor}"
1961
- .rowAggregationColor="${this
1962
- .rowAggregationColor}"
1963
- .enableGrouping="${this.enableGrouping}"
1964
- .enableColumnPinning="${this
1965
- .enableColumnPinning}"
1966
- .exportData="${this.exportData}"
1967
- .actionButtonsInMenu="${this
1968
- .actionButtonsInMenu}"
1969
- .hideFooter="${this.hideFooter}"
1970
- .alwaysFilter="${this.alwaysFilter}"
1971
- .alwaysFilterActive="${this
1972
- .alwaysFilterActive}"
1973
- .enableSettingsAlwaysFilter="${this
1974
- .enableSettingsAlwaysFilter}"
1975
- .columns="${this.allColumns ||
1976
- this.columns}"
1977
- .variables="${this.variables}"
1978
- .userLang="${this.userLang}"
1979
- .allowedLang="${this.allowedLang}"
1980
- .emptyText="${this.emptyText}"
1981
- .onSettingsChangedModal="${this.onSettingsChangedCallback.bind(this)}"
1982
- ></data-grid-settings>
1983
- </div>
1984
- `
1985
- : null}
1986
- </div>
1987
- </slot>
1988
- `
1989
- : ''}
1990
- ${rows.length < 1 && !this.isLoading
1991
- ? html ` <div class="data-grid__empty">
1992
- <slot name="empty">
1993
- <div style="max-height: 7.125rem; max-width: 7.125rem">
1994
- <not-found></not-found>
1995
- </div>
1996
- <div class="data-grid__empty-text">
1997
- ${this.emptyText
1998
- ? this.emptyText?.[this.userLang || ''] || this.emptyText?.default || msg('Nic tady není')
1999
- : msg('Nic tady není')}
2000
- </div>
2001
- </slot>
2002
- </div>`
2003
- : null}
2004
- </div>
2005
- `;
2006
- }
2007
- }
2008
- LitDataGridTanstack.styles = [
2009
- // styles,
2010
- css `
2011
- *,
2012
- *::before,
2013
- *::after {
2014
- margin: 0;
2015
- padding: 0;
2016
- box-sizing: border-box;
2017
- }
2018
-
2019
- :host {
2020
- display: block;
2021
- height: 100%;
2022
- overflow: hidden;
2023
- }
2024
-
2025
- font-family: 'Inter', sans-serif;
2026
- box-sizing: border-box;
2027
-
2028
- td {
2029
- padding: 0px;
2030
- }
2031
- .data-grid__wrapper {
2032
- position: relative;
2033
- background-color: var(--background-paper, #fff);
2034
- height: 100%;
2035
- z-index: 1;
2036
- display: flex;
2037
- flex-direction: column;
2038
- }
2039
-
2040
- .grid {
2041
- overflow: auto;
2042
- position: relative;
2043
- flex: 1;
2044
- min-height: 0;
2045
- }
2046
-
2047
- .data-grid__empty {
2048
- position: absolute;
2049
- top: 50%;
2050
- left: 50%;
2051
- transform: translate(-50%, -50%);
2052
- font-size: 0.875rem;
2053
- text-align: center;
2054
- }
2055
-
2056
- table {
2057
- border-collapse: collapse;
2058
- border-spacing: 0;
2059
- width: 99% !important;
2060
- }
2061
-
2062
- thead {
2063
- display: flex;
2064
- position: sticky;
2065
- top: 0;
2066
- z-index: 10;
2067
- background-color: var(--background-paper, #fff);
2068
- border-bottom: 1px solid var(--color-divider, #d0d3db);
2069
- }
2070
-
2071
- tr.head {
2072
- display: flex;
2073
- width: 100%;
2074
- }
2075
-
2076
- th.head {
2077
- display: block;
2078
- position: relative;
2079
- padding: 0 6px;
2080
- gap: 0.25rem;
2081
- //z-index: auto !important;
2082
- }
2083
-
2084
- tbody {
2085
- display: grid;
2086
- position: relative;
2087
- outline: none;
2088
- }
2089
-
2090
- tr.body {
2091
- width: 100%;
2092
- border-bottom: 1px solid var(--color-divider, #d0d3db);
2093
- display: flex;
2094
- overflow: visible;
2095
- }
2096
- tr:focus {
2097
- background-color: var(--color-primary-light, #f0fadf);
2098
- outline: none;
2099
- }
2100
- // tr.selected:focus {
2101
- // background-color: var(--color-primary-main, #f0fadf);
2102
- // outline: none;
2103
- // }
2104
-
2105
- tr.body:hover:not(.selected):not(:focus) {
2106
- cursor: pointer;
2107
- background-color: var(--background-default, #eff3f4);
2108
- }
2109
-
2110
- td {
2111
- display: table-cell;
2112
- white-space: nowrap;
2113
- overflow: hidden;
2114
- padding: 0px 14px;
2115
- font-weight: 500;
2116
- font-size: 12px;
2117
- color: var(--text-primary, #111827);
2118
- display: flex;
2119
- align-items: center;
2120
- }
2121
-
2122
- .column-header {
2123
- font-size: 11px;
2124
- font-weight: 600;
2125
- color: var(--text-secondary, #5d6371);
2126
- cursor: pointer;
2127
- gap: 0.25rem;
2128
- justify-content: center;
2129
- align-items: center;
2130
- margin: 0 0.25rem;
2131
- overflow: hidden;
2132
- white-space: nowrap;
2133
- text-overflow: ellipsis;
2134
- height: inherit;
2135
- display: flex;
2136
- }
2137
- .no-select,
2138
- .no-select * {
2139
- user-select: none !important;
2140
- }
2141
- .ellipsis {
2142
- overflow: hidden;
2143
- white-space: nowrap;
2144
- text-overflow: ellipsis;
2145
- }
2146
-
2147
- .icons-group-pin {
2148
- display: flex;
2149
- height: 100%;
2150
- justify-content: space-between;
2151
- flex-grow: 1;
2152
- }
2153
-
2154
- .flex {
2155
- display: flex;
2156
- }
2157
-
2158
- .drag-handle {
2159
- display: flex;
2160
- align-items: center;
2161
- justify-content: center;
2162
- padding: 1px 6px;
2163
- cursor: grab;
2164
- }
2165
-
2166
- .resizer {
2167
- height: 23px;
2168
- padding: 0 0 0 6px;
2169
- text-align: start;
2170
- //cursor: col-resize;
2171
- user-select: none;
2172
- touch-action: none;
2173
- }
2174
-
2175
- .resize-handle {
2176
- position: absolute;
2177
- top: 0;
2178
- right: 0px;
2179
- width: 6px;
2180
- height: 100%;
2181
- background: transparent;
2182
- cursor: col-resize;
2183
- transition: background-color 0.2s ease-in-out;
2184
- // border-radius: 5px;
2185
- // padding-bottom: 5px;
2186
- }
2187
-
2188
- .resize-handle:hover {
2189
- border-right: 2px solid var(--color-primary-main, #75b603);
2190
- }
2191
-
2192
- .resizer.ltr {
2193
- right: 0;
2194
- }
2195
-
2196
- .resizer.rtl {
2197
- left: 0;
2198
- }
2199
-
2200
- .resizer.is-resizing {
2201
- opacity: 1;
2202
- }
2203
-
2204
- .footer-container {
2205
- position: relative;
2206
- background-color: var(--background-paper, #fff);
2207
- width: auto;
2208
- border-top: 1px solid var(--color-divider, #d0d3db);
2209
- height: 2.375rem;
2210
- display: flex;
2211
- flex-direction: row;
2212
- justify-content: space-between;
2213
- align-items: center;
2214
- z-index: 10;
2215
- flex-shrink: 0;
2216
- }
2217
-
2218
- .right-actions {
2219
- position: absolute;
2220
- right: 0;
2221
- display: flex;
2222
- }
2223
-
2224
- .numberCount {
2225
- margin: 0.375rem 0;
2226
- font-size: 12px;
2227
- font-weight: 400;
2228
- color: var(--text-primary, #111827);
2229
- display: flex;
2230
- align-items: center;
2231
- }
2232
-
2233
- .scroll-button {
2234
- position: absolute;
2235
- top: 50%;
2236
- transform: translateY(-50%);
2237
- z-index: 1000;
2238
- cursor: pointer;
2239
- opacity: 0.5;
2240
- }
2241
-
2242
- .scroll-button.left {
2243
- left: 4rem;
2244
- }
2245
-
2246
- .scroll-button.right {
2247
- right: 4rem;
2248
- }
2249
-
2250
- .selected {
2251
- background-color: var(--color-primary-light, #f0fadf);
2252
- }
2253
-
2254
- .sortFilled {
2255
- visibility: hidden;
2256
- }
2257
- .header {
2258
- display: flex;
2259
- align-items: center;
2260
- height: 100%;
2261
- }
2262
- .header:hover .sortFilled {
2263
- visibility: visible;
2264
- }
2265
- .grouped-column {
2266
- display: flex;
2267
- align-items: center;
2268
- justify-content: space-between;
2269
- width: 100%;
2270
- gap: 0.25rem;
2271
- }
2272
- .grouped-column--icon-button {
2273
- display: flex;
2274
- align-items: center;
2275
- position: relative;
2276
- top: -1.5px;
2277
- }
2278
- .grouped-column--label {
2279
- display: flex;
2280
- align-items: center;
2281
- overflow: hidden;
2282
- flex-grow: 1;
2283
- }
2284
- .grouped-column--pill {
2285
- margin-left: 0.5rem;
2286
- }
2287
- .filterCirclePoint {
2288
- width: 8px;
2289
- height: 8px;
2290
- border-radius: 50%;
2291
- background-color: var(--color-primary-main, #75b603);
2292
- display: inline-block;
2293
- vertical-align: middle;
2294
- }
2295
- .cursor {
2296
- cursor: pointer;
2297
- color: var(--text-secondary, #5d6371);
2298
- }
2299
- .data-grid__empty-text {
2300
- color: var(--text-primary, #5d6371);
2301
- }
2302
- `,
2303
- ];
2304
- __decorate([
2305
- property({ type: Array, reflect: true })
2306
- ], LitDataGridTanstack.prototype, "row", void 0);
2307
- __decorate([
2308
- property({ type: Array })
2309
- ], LitDataGridTanstack.prototype, "columns", void 0);
2310
- __decorate([
2311
- property({ type: Array })
2312
- ], LitDataGridTanstack.prototype, "allColumns", void 0);
2313
- __decorate([
2314
- property({ type: Number })
2315
- ], LitDataGridTanstack.prototype, "columnDefaultSize", void 0);
2316
- __decorate([
2317
- property({ type: Number })
2318
- ], LitDataGridTanstack.prototype, "columnDefaultMinSize", void 0);
2319
- __decorate([
2320
- property({ type: Number })
2321
- ], LitDataGridTanstack.prototype, "columnDefaultMaxSize", void 0);
2322
- __decorate([
2323
- property({ type: String })
2324
- ], LitDataGridTanstack.prototype, "columnGroupedColor", void 0);
2325
- __decorate([
2326
- property({ type: String })
2327
- ], LitDataGridTanstack.prototype, "rowAggregationColor", void 0);
2328
- __decorate([
2329
- property({ type: Boolean })
2330
- ], LitDataGridTanstack.prototype, "enableRowVirtualization", void 0);
2331
- __decorate([
2332
- property({ type: Boolean })
2333
- ], LitDataGridTanstack.prototype, "enableColumnVirtualization", void 0);
2334
- __decorate([
2335
- property({ type: Boolean })
2336
- ], LitDataGridTanstack.prototype, "enableColumnPinning", void 0);
2337
- __decorate([
2338
- property({ type: Boolean })
2339
- ], LitDataGridTanstack.prototype, "enableColumnOrdering", void 0);
2340
- __decorate([
2341
- property({ type: Boolean })
2342
- ], LitDataGridTanstack.prototype, "enableGrouping", void 0);
2343
- __decorate([
2344
- property({ type: Boolean })
2345
- ], LitDataGridTanstack.prototype, "enablePinning", void 0);
2346
- __decorate([
2347
- property({ type: Boolean })
2348
- ], LitDataGridTanstack.prototype, "exportData", void 0);
2349
- __decorate([
2350
- property({ type: Boolean })
2351
- ], LitDataGridTanstack.prototype, "actionButtonsInMenu", void 0);
2352
- __decorate([
2353
- property({ type: String })
2354
- ], LitDataGridTanstack.prototype, "id", void 0);
2355
- __decorate([
2356
- property({ type: Array })
2357
- ], LitDataGridTanstack.prototype, "initialGroups", void 0);
2358
- __decorate([
2359
- property({ type: Array })
2360
- ], LitDataGridTanstack.prototype, "initialSorting", void 0);
2361
- __decorate([
2362
- property({ type: Object })
2363
- ], LitDataGridTanstack.prototype, "initialColumnVisibility", void 0);
2364
- __decorate([
2365
- property({ type: Object })
2366
- ], LitDataGridTanstack.prototype, "initialRowExpanded", void 0);
2367
- __decorate([
2368
- property({ type: Object })
2369
- ], LitDataGridTanstack.prototype, "columnSizing", void 0);
2370
- __decorate([
2371
- property({ type: Array })
2372
- ], LitDataGridTanstack.prototype, "leftPinnedColumns", void 0);
2373
- __decorate([
2374
- property({ type: Array })
2375
- ], LitDataGridTanstack.prototype, "rightPinnedColumns", void 0);
2376
- __decorate([
2377
- property({ type: Boolean })
2378
- ], LitDataGridTanstack.prototype, "enableFiltering", void 0);
2379
- __decorate([
2380
- property({ type: Boolean })
2381
- ], LitDataGridTanstack.prototype, "enableSorting", void 0);
2382
- __decorate([
2383
- property({ type: String })
2384
- ], LitDataGridTanstack.prototype, "userLang", void 0);
2385
- __decorate([
2386
- property({ type: Array })
2387
- ], LitDataGridTanstack.prototype, "allowedLang", void 0);
2388
- __decorate([
2389
- property({ type: String })
2390
- ], LitDataGridTanstack.prototype, "dateFormat", void 0);
2391
- __decorate([
2392
- property({ type: Boolean })
2393
- ], LitDataGridTanstack.prototype, "isLoading", void 0);
2394
- __decorate([
2395
- property({ type: Boolean })
2396
- ], LitDataGridTanstack.prototype, "enableRowSelection", void 0);
2397
- __decorate([
2398
- property({ type: Array })
2399
- ], LitDataGridTanstack.prototype, "initialFiltering", void 0);
2400
- __decorate([
2401
- property({ type: Boolean })
2402
- ], LitDataGridTanstack.prototype, "server", void 0);
2403
- __decorate([
2404
- property({ type: Number })
2405
- ], LitDataGridTanstack.prototype, "scrollEndThreshold", void 0);
2406
- __decorate([
2407
- property({ type: String })
2408
- ], LitDataGridTanstack.prototype, "rowDensity", void 0);
2409
- __decorate([
2410
- property({ type: Boolean })
2411
- ], LitDataGridTanstack.prototype, "enableMultiRowSelection", void 0);
2412
- __decorate([
2413
- property({ type: Number })
2414
- ], LitDataGridTanstack.prototype, "totalNumberRows", void 0);
2415
- __decorate([
2416
- property({ type: Number })
2417
- ], LitDataGridTanstack.prototype, "minFilterCharacters", void 0);
2418
- __decorate([
2419
- property({ type: Boolean })
2420
- ], LitDataGridTanstack.prototype, "rowsSelected", void 0);
2421
- __decorate([
2422
- property({ type: Boolean })
2423
- ], LitDataGridTanstack.prototype, "enableSettings", void 0);
2424
- __decorate([
2425
- property({ type: Boolean })
2426
- ], LitDataGridTanstack.prototype, "enableSettingsAlwaysFilter", void 0);
2427
- __decorate([
2428
- property({ type: Boolean })
2429
- ], LitDataGridTanstack.prototype, "alwaysFilterActive", void 0);
2430
- __decorate([
2431
- property({ attribute: false })
2432
- ], LitDataGridTanstack.prototype, "onSettingsChanged", void 0);
2433
- __decorate([
2434
- property({ type: Function })
2435
- ], LitDataGridTanstack.prototype, "onRowClick", void 0);
2436
- __decorate([
2437
- property({ type: Function })
2438
- ], LitDataGridTanstack.prototype, "onRowsScrollEnd", void 0);
2439
- __decorate([
2440
- property({ type: Function })
2441
- ], LitDataGridTanstack.prototype, "onWindowResize", void 0);
2442
- __decorate([
2443
- property({ type: Function })
2444
- ], LitDataGridTanstack.prototype, "onRowDoubleClick", void 0);
2445
- __decorate([
2446
- property({ type: Function })
2447
- ], LitDataGridTanstack.prototype, "rowDensityChange", void 0);
2448
- __decorate([
2449
- property({ type: Function })
2450
- ], LitDataGridTanstack.prototype, "exportExcelFn", void 0);
2451
- __decorate([
2452
- property({ type: Function })
2453
- ], LitDataGridTanstack.prototype, "exportCsvFn", void 0);
2454
- __decorate([
2455
- property({ type: Function })
2456
- ], LitDataGridTanstack.prototype, "getTotalNumberFn", void 0);
2457
- __decorate([
2458
- property({ type: Function })
2459
- ], LitDataGridTanstack.prototype, "onCellKeyDown", void 0);
2460
- __decorate([
2461
- property({ type: Function })
2462
- ], LitDataGridTanstack.prototype, "getRowId", void 0);
2463
- __decorate([
2464
- property({ type: Function })
2465
- ], LitDataGridTanstack.prototype, "onColumnResize", void 0);
2466
- __decorate([
2467
- property({ type: Boolean })
2468
- ], LitDataGridTanstack.prototype, "onColumnFiltersChanged", void 0);
2469
- __decorate([
2470
- property({ type: Boolean })
2471
- ], LitDataGridTanstack.prototype, "onColumnSortChanged", void 0);
2472
- __decorate([
2473
- property({ type: Function })
2474
- ], LitDataGridTanstack.prototype, "onRowSelectionChanged", void 0);
2475
- __decorate([
2476
- property({ type: Function })
2477
- ], LitDataGridTanstack.prototype, "onColumnOrderChanged", void 0);
2478
- __decorate([
2479
- property({ type: Boolean })
2480
- ], LitDataGridTanstack.prototype, "hideFooter", void 0);
2481
- __decorate([
2482
- property({ type: Object })
2483
- ], LitDataGridTanstack.prototype, "columnVisibility", void 0);
2484
- __decorate([
2485
- property({ type: Function })
2486
- ], LitDataGridTanstack.prototype, "onColumnVisibilityChanged", void 0);
2487
- __decorate([
2488
- property({ type: Function })
2489
- ], LitDataGridTanstack.prototype, "onMouseDown", void 0);
2490
- __decorate([
2491
- property({ type: Function })
2492
- ], LitDataGridTanstack.prototype, "onRowFocusChanged", void 0);
2493
- __decorate([
2494
- property({ type: Number })
2495
- ], LitDataGridTanstack.prototype, "focusedRowIndex", void 0);
2496
- __decorate([
2497
- property({ type: Boolean })
2498
- ], LitDataGridTanstack.prototype, "autoFocus", void 0);
2499
- __decorate([
2500
- property({ type: Boolean })
2501
- ], LitDataGridTanstack.prototype, "onColumnPinningChanged", void 0);
2502
- __decorate([
2503
- property({ type: Boolean })
2504
- ], LitDataGridTanstack.prototype, "onGroupingChanged", void 0);
2505
- __decorate([
2506
- property({ type: Boolean })
2507
- ], LitDataGridTanstack.prototype, "onRowExpanded", void 0);
2508
- __decorate([
2509
- property({ type: Object })
2510
- ], LitDataGridTanstack.prototype, "alwaysFilter", void 0);
2511
- __decorate([
2512
- property({ type: Array })
2513
- ], LitDataGridTanstack.prototype, "variables", void 0);
2514
- __decorate([
2515
- property({ type: Object })
2516
- ], LitDataGridTanstack.prototype, "emptyText", void 0);
2517
- __decorate([
2518
- state()
2519
- ], LitDataGridTanstack.prototype, "isScrollable", void 0);
2520
- __decorate([
2521
- state()
2522
- ], LitDataGridTanstack.prototype, "disableScrollLeft", void 0);
2523
- __decorate([
2524
- state()
2525
- ], LitDataGridTanstack.prototype, "disableScrollRight", void 0);
2526
- __decorate([
2527
- state()
2528
- ], LitDataGridTanstack.prototype, "columnOrder", void 0);
2529
- __decorate([
2530
- state()
2531
- ], LitDataGridTanstack.prototype, "table", void 0);
2532
- __decorate([
2533
- state()
2534
- ], LitDataGridTanstack.prototype, "isOpen", void 0);
2535
- __decorate([
2536
- state()
2537
- ], LitDataGridTanstack.prototype, "filterText", void 0);
2538
- __decorate([
2539
- state()
2540
- ], LitDataGridTanstack.prototype, "isOpenModal", void 0);
2541
- __decorate([
2542
- query('tbody')
2543
- ], LitDataGridTanstack.prototype, "tableBody", void 0);
2544
- __decorate([
2545
- query('.grid')
2546
- ], LitDataGridTanstack.prototype, "_container", void 0);
2547
- if (!window.customElements.get('lit-data-grid-tanstack')) {
2548
- window.customElements.define('lit-data-grid-tanstack', LitDataGridTanstack);
2549
- }
2550
- //# sourceMappingURL=lit-data-grid-tanstack.js.map