overview-components 1.1.160 → 1.1.162

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 (244) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +82 -0
  3. package/dist/assets/illustration/index.d.ts +7 -0
  4. package/dist/assets/illustration/index.d.ts.map +1 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +22487 -7
  8. package/package.json +55 -21
  9. package/dist/assets/generated/locales/de.js +0 -269
  10. package/dist/assets/generated/locales/de.js.map +0 -1
  11. package/dist/assets/generated/locales/en.js +0 -269
  12. package/dist/assets/generated/locales/en.js.map +0 -1
  13. package/dist/assets/generated/locales/fr.js +0 -269
  14. package/dist/assets/generated/locales/fr.js.map +0 -1
  15. package/dist/assets/generated/locales/hr.js +0 -269
  16. package/dist/assets/generated/locales/hr.js.map +0 -1
  17. package/dist/assets/generated/locales/it.js +0 -269
  18. package/dist/assets/generated/locales/it.js.map +0 -1
  19. package/dist/assets/generated/locales/pl.js +0 -269
  20. package/dist/assets/generated/locales/pl.js.map +0 -1
  21. package/dist/assets/generated/locales/ro.js +0 -269
  22. package/dist/assets/generated/locales/ro.js.map +0 -1
  23. package/dist/assets/generated/locales/sk.js +0 -269
  24. package/dist/assets/generated/locales/sk.js.map +0 -1
  25. package/dist/assets/generated/locales/sr.js +0 -269
  26. package/dist/assets/generated/locales/sr.js.map +0 -1
  27. package/dist/assets/icons/iconGlyphs.js +0 -691
  28. package/dist/assets/icons/iconGlyphs.js.map +0 -1
  29. package/dist/assets/illustration/aichatbot-illustration.js +0 -144
  30. package/dist/assets/illustration/aichatbot-illustration.js.map +0 -1
  31. package/dist/assets/illustration/delete-illustration.js +0 -88
  32. package/dist/assets/illustration/delete-illustration.js.map +0 -1
  33. package/dist/assets/illustration/no-content.js +0 -159
  34. package/dist/assets/illustration/no-content.js.map +0 -1
  35. package/dist/assets/illustration/no-preview.js +0 -125
  36. package/dist/assets/illustration/no-preview.js.map +0 -1
  37. package/dist/assets/illustration/not-found.js +0 -98
  38. package/dist/assets/illustration/not-found.js.map +0 -1
  39. package/dist/assets/illustration/settings-illustration.js +0 -168
  40. package/dist/assets/illustration/settings-illustration.js.map +0 -1
  41. package/dist/components/components-settings/attachments-tab-settings.js +0 -318
  42. package/dist/components/components-settings/attachments-tab-settings.js.map +0 -1
  43. package/dist/components/components-settings/data-grid-settings.js +0 -553
  44. package/dist/components/components-settings/data-grid-settings.js.map +0 -1
  45. package/dist/components/components-settings/section-tab-settings.js +0 -719
  46. package/dist/components/components-settings/section-tab-settings.js.map +0 -1
  47. package/dist/components/components-settings/tabs-overview-settings.js +0 -421
  48. package/dist/components/components-settings/tabs-overview-settings.js.map +0 -1
  49. package/dist/components/index.js +0 -30
  50. package/dist/components/index.js.map +0 -1
  51. package/dist/components/lit-ai-filter-assistant.js +0 -443
  52. package/dist/components/lit-ai-filter-assistant.js.map +0 -1
  53. package/dist/components/lit-attachments-tab.js +0 -2044
  54. package/dist/components/lit-attachments-tab.js.map +0 -1
  55. package/dist/components/lit-badge.js +0 -124
  56. package/dist/components/lit-badge.js.map +0 -1
  57. package/dist/components/lit-case-variables-tab.js +0 -3718
  58. package/dist/components/lit-case-variables-tab.js.map +0 -1
  59. package/dist/components/lit-chart.js +0 -727
  60. package/dist/components/lit-chart.js.map +0 -1
  61. package/dist/components/lit-data-grid-tanstack.js +0 -2550
  62. package/dist/components/lit-data-grid-tanstack.js.map +0 -1
  63. package/dist/components/lit-filter-builder.js +0 -701
  64. package/dist/components/lit-filter-builder.js.map +0 -1
  65. package/dist/components/lit-filter-modal.js +0 -349
  66. package/dist/components/lit-filter-modal.js.map +0 -1
  67. package/dist/components/lit-multiselect-item.js +0 -707
  68. package/dist/components/lit-multiselect-item.js.map +0 -1
  69. package/dist/components/lit-section-tab.js +0 -268
  70. package/dist/components/lit-section-tab.js.map +0 -1
  71. package/dist/components/lit-tabs-overview.js +0 -356
  72. package/dist/components/lit-tabs-overview.js.map +0 -1
  73. package/dist/components/modals/lit-confirm-modal.js +0 -121
  74. package/dist/components/modals/lit-confirm-modal.js.map +0 -1
  75. package/dist/components/modals/lit-delete-modal.js +0 -131
  76. package/dist/components/modals/lit-delete-modal.js.map +0 -1
  77. package/dist/components/react-wrappers/ai-filter-assistant.js +0 -9
  78. package/dist/components/react-wrappers/ai-filter-assistant.js.map +0 -1
  79. package/dist/components/react-wrappers/attachments-tab.js +0 -9
  80. package/dist/components/react-wrappers/attachments-tab.js.map +0 -1
  81. package/dist/components/react-wrappers/badge.js +0 -9
  82. package/dist/components/react-wrappers/badge.js.map +0 -1
  83. package/dist/components/react-wrappers/button.js +0 -9
  84. package/dist/components/react-wrappers/button.js.map +0 -1
  85. package/dist/components/react-wrappers/calendar.js +0 -9
  86. package/dist/components/react-wrappers/calendar.js.map +0 -1
  87. package/dist/components/react-wrappers/case-variables-tab.js +0 -9
  88. package/dist/components/react-wrappers/case-variables-tab.js.map +0 -1
  89. package/dist/components/react-wrappers/chart.js +0 -9
  90. package/dist/components/react-wrappers/chart.js.map +0 -1
  91. package/dist/components/react-wrappers/data-grid-tanstack.js +0 -9
  92. package/dist/components/react-wrappers/data-grid-tanstack.js.map +0 -1
  93. package/dist/components/react-wrappers/filter-builder.js +0 -12
  94. package/dist/components/react-wrappers/filter-builder.js.map +0 -1
  95. package/dist/components/react-wrappers/filter-modal.js +0 -9
  96. package/dist/components/react-wrappers/filter-modal.js.map +0 -1
  97. package/dist/components/react-wrappers/index.js +0 -27
  98. package/dist/components/react-wrappers/index.js.map +0 -1
  99. package/dist/components/react-wrappers/progress-bar.js +0 -9
  100. package/dist/components/react-wrappers/progress-bar.js.map +0 -1
  101. package/dist/components/react-wrappers/section-tab.js +0 -9
  102. package/dist/components/react-wrappers/section-tab.js.map +0 -1
  103. package/dist/components/react-wrappers/tabs-overview.js +0 -9
  104. package/dist/components/react-wrappers/tabs-overview.js.map +0 -1
  105. package/dist/data/translations.js +0 -2768
  106. package/dist/data/translations.js.map +0 -1
  107. package/dist/index.js.map +0 -1
  108. package/dist/schemas/index.js +0 -18
  109. package/dist/schemas/index.js.map +0 -1
  110. package/dist/schemas/lit-attachments-tab-document.schema.js +0 -39
  111. package/dist/schemas/lit-attachments-tab-document.schema.js.map +0 -1
  112. package/dist/schemas/lit-attachments-tab-settings-value.schema.js +0 -30
  113. package/dist/schemas/lit-attachments-tab-settings-value.schema.js.map +0 -1
  114. package/dist/schemas/lit-attachments-tab.schema.js +0 -68
  115. package/dist/schemas/lit-attachments-tab.schema.js.map +0 -1
  116. package/dist/schemas/lit-case-variables-tab-cell.schema.js +0 -225
  117. package/dist/schemas/lit-case-variables-tab-cell.schema.js.map +0 -1
  118. package/dist/schemas/lit-case-variables-tab-rows.schema.js +0 -6
  119. package/dist/schemas/lit-case-variables-tab-rows.schema.js.map +0 -1
  120. package/dist/schemas/lit-case-variables-tab.schema.js +0 -27
  121. package/dist/schemas/lit-case-variables-tab.schema.js.map +0 -1
  122. package/dist/schemas/lit-data-grid-tanstack-column-array.schema.js +0 -6
  123. package/dist/schemas/lit-data-grid-tanstack-column-array.schema.js.map +0 -1
  124. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter-array.schema.js +0 -6
  125. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter-array.schema.js.map +0 -1
  126. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter.schema.js +0 -11
  127. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter.schema.js.map +0 -1
  128. package/dist/schemas/lit-data-grid-tanstack-column.schema.js +0 -79
  129. package/dist/schemas/lit-data-grid-tanstack-column.schema.js.map +0 -1
  130. package/dist/schemas/lit-data-grid-tanstack.schema.js +0 -108
  131. package/dist/schemas/lit-data-grid-tanstack.schema.js.map +0 -1
  132. package/dist/schemas/lit-filter-builder.schema.js +0 -61
  133. package/dist/schemas/lit-filter-builder.schema.js.map +0 -1
  134. package/dist/schemas/lit-section-tab-schema.js +0 -37
  135. package/dist/schemas/lit-section-tab-schema.js.map +0 -1
  136. package/dist/schemas/lit-tabs-overview-tab-array.schema.js +0 -6
  137. package/dist/schemas/lit-tabs-overview-tab-array.schema.js.map +0 -1
  138. package/dist/schemas/lit-tabs-overview-tab.schema.js +0 -32
  139. package/dist/schemas/lit-tabs-overview-tab.schema.js.map +0 -1
  140. package/dist/schemas/lit-tabs-overview.schema.js +0 -29
  141. package/dist/schemas/lit-tabs-overview.schema.js.map +0 -1
  142. package/dist/scripts/translate-locales.js +0 -241
  143. package/dist/scripts/translate-locales.js.map +0 -1
  144. package/dist/shared/filter-inputs.js +0 -429
  145. package/dist/shared/filter-inputs.js.map +0 -1
  146. package/dist/shared/index.js +0 -40
  147. package/dist/shared/index.js.map +0 -1
  148. package/dist/shared/lit-button.js +0 -159
  149. package/dist/shared/lit-button.js.map +0 -1
  150. package/dist/shared/lit-calendar.js +0 -485
  151. package/dist/shared/lit-calendar.js.map +0 -1
  152. package/dist/shared/lit-case-variables-tab-cell.js +0 -226
  153. package/dist/shared/lit-case-variables-tab-cell.js.map +0 -1
  154. package/dist/shared/lit-checkbox.js +0 -184
  155. package/dist/shared/lit-checkbox.js.map +0 -1
  156. package/dist/shared/lit-custom-popper.js +0 -116
  157. package/dist/shared/lit-custom-popper.js.map +0 -1
  158. package/dist/shared/lit-data-grid-action-buttons-popover.js +0 -295
  159. package/dist/shared/lit-data-grid-action-buttons-popover.js.map +0 -1
  160. package/dist/shared/lit-data-grid-density-popover.js +0 -84
  161. package/dist/shared/lit-data-grid-density-popover.js.map +0 -1
  162. package/dist/shared/lit-data-grid-export-popover.js +0 -68
  163. package/dist/shared/lit-data-grid-export-popover.js.map +0 -1
  164. package/dist/shared/lit-data-grid-operators-popover.js +0 -114
  165. package/dist/shared/lit-data-grid-operators-popover.js.map +0 -1
  166. package/dist/shared/lit-data-grid-row-actions.js +0 -87
  167. package/dist/shared/lit-data-grid-row-actions.js.map +0 -1
  168. package/dist/shared/lit-date-picker.js +0 -608
  169. package/dist/shared/lit-date-picker.js.map +0 -1
  170. package/dist/shared/lit-document-thumbnail.js +0 -383
  171. package/dist/shared/lit-document-thumbnail.js.map +0 -1
  172. package/dist/shared/lit-filter-input.js +0 -115
  173. package/dist/shared/lit-filter-input.js.map +0 -1
  174. package/dist/shared/lit-icon-button.js +0 -165
  175. package/dist/shared/lit-icon-button.js.map +0 -1
  176. package/dist/shared/lit-icon.js +0 -337
  177. package/dist/shared/lit-icon.js.map +0 -1
  178. package/dist/shared/lit-input.js +0 -282
  179. package/dist/shared/lit-input.js.map +0 -1
  180. package/dist/shared/lit-label.js +0 -103
  181. package/dist/shared/lit-label.js.map +0 -1
  182. package/dist/shared/lit-loader.js +0 -68
  183. package/dist/shared/lit-loader.js.map +0 -1
  184. package/dist/shared/lit-loading-bar.js +0 -91
  185. package/dist/shared/lit-loading-bar.js.map +0 -1
  186. package/dist/shared/lit-menu-item.js +0 -98
  187. package/dist/shared/lit-menu-item.js.map +0 -1
  188. package/dist/shared/lit-menu.js +0 -29
  189. package/dist/shared/lit-menu.js.map +0 -1
  190. package/dist/shared/lit-modal-body.js +0 -24
  191. package/dist/shared/lit-modal-body.js.map +0 -1
  192. package/dist/shared/lit-modal-footer.js +0 -21
  193. package/dist/shared/lit-modal-footer.js.map +0 -1
  194. package/dist/shared/lit-modal-header.js +0 -34
  195. package/dist/shared/lit-modal-header.js.map +0 -1
  196. package/dist/shared/lit-modal.js +0 -168
  197. package/dist/shared/lit-modal.js.map +0 -1
  198. package/dist/shared/lit-overflow-tooltip.js +0 -114
  199. package/dist/shared/lit-overflow-tooltip.js.map +0 -1
  200. package/dist/shared/lit-pill.js +0 -87
  201. package/dist/shared/lit-pill.js.map +0 -1
  202. package/dist/shared/lit-progress-bar.js +0 -130
  203. package/dist/shared/lit-progress-bar.js.map +0 -1
  204. package/dist/shared/lit-responsive-button.js +0 -106
  205. package/dist/shared/lit-responsive-button.js.map +0 -1
  206. package/dist/shared/lit-select-field.js +0 -457
  207. package/dist/shared/lit-select-field.js.map +0 -1
  208. package/dist/shared/lit-select.js +0 -668
  209. package/dist/shared/lit-select.js.map +0 -1
  210. package/dist/shared/lit-settings.js +0 -76
  211. package/dist/shared/lit-settings.js.map +0 -1
  212. package/dist/shared/lit-text-field.js +0 -252
  213. package/dist/shared/lit-text-field.js.map +0 -1
  214. package/dist/shared/lit-toggle.js +0 -240
  215. package/dist/shared/lit-toggle.js.map +0 -1
  216. package/dist/shared/lit-tooltip.js +0 -165
  217. package/dist/shared/lit-tooltip.js.map +0 -1
  218. package/dist/shared/simple-popper.js +0 -285
  219. package/dist/shared/simple-popper.js.map +0 -1
  220. package/dist/shared/simple-tooltip.js +0 -249
  221. package/dist/shared/simple-tooltip.js.map +0 -1
  222. package/dist/shared/styles/button-shared-styles.js +0 -494
  223. package/dist/shared/styles/button-shared-styles.js.map +0 -1
  224. package/dist/styles.js +0 -169
  225. package/dist/styles.js.map +0 -1
  226. package/dist/utils/custom-filters.js +0 -42
  227. package/dist/utils/custom-filters.js.map +0 -1
  228. package/dist/utils/date.js +0 -21
  229. package/dist/utils/date.js.map +0 -1
  230. package/dist/utils/file-type-utils.js +0 -55
  231. package/dist/utils/file-type-utils.js.map +0 -1
  232. package/dist/utils/formatNumber.js +0 -62
  233. package/dist/utils/formatNumber.js.map +0 -1
  234. package/dist/utils/getOperatorByType.js +0 -70
  235. package/dist/utils/getOperatorByType.js.map +0 -1
  236. package/dist/utils/getOverviewValue.js +0 -175
  237. package/dist/utils/getOverviewValue.js.map +0 -1
  238. package/dist/utils/localization.js +0 -433
  239. package/dist/utils/localization.js.map +0 -1
  240. package/dist/utils/pdf-thumbnail-generator.js +0 -91
  241. package/dist/utils/pdf-thumbnail-generator.js.map +0 -1
  242. package/dist/utils/utils.js +0 -94
  243. package/dist/utils/utils.js.map +0 -1
  244. package/dist/vite.svg +0 -1
@@ -1,701 +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 { html, css, LitElement } from 'lit';
8
- import { property } from 'lit/decorators.js';
9
- import { classMap } from 'lit/directives/class-map.js';
10
- import { msg } from '@lit/localize';
11
- import '../shared/lit-select.js';
12
- import '../shared/lit-input.js';
13
- import '../shared/lit-responsive-button.js';
14
- import '../shared/lit-button.js';
15
- import '../shared/lit-icon-button.js';
16
- import '../shared/lit-date-picker.js';
17
- import { getOperatorsByColumnType, getDefaultOperator, isAllowedType, } from '../utils/getOperatorByType.js';
18
- import { tooltip } from '../shared/simple-tooltip.js';
19
- export class LitFilterBuilder extends LitElement {
20
- constructor() {
21
- super(...arguments);
22
- this.data = {
23
- filterGroups: [
24
- {
25
- id: 'group-1',
26
- logicOperator: 'AND',
27
- conditions: [],
28
- },
29
- ],
30
- groupLogicOperator: 'AND',
31
- };
32
- this.fields = [];
33
- this.variables = [];
34
- this.disabled = false;
35
- this.locale = 'cs';
36
- }
37
- _generateConditionId() {
38
- return 'condition-' + Date.now() + '-' + Math.random().toString(36).substring(2, 11);
39
- }
40
- _generateGroupId() {
41
- return 'group-' + Date.now() + '-' + Math.random().toString(36).substring(2, 11);
42
- }
43
- _getDefaultValueForType(type) {
44
- switch (type) {
45
- case 'string':
46
- return '';
47
- case 'number':
48
- return '';
49
- case 'date':
50
- return '';
51
- case 'select':
52
- return '';
53
- case 'multiselect':
54
- return ''; // Will be converted to array when rendering
55
- default:
56
- return '';
57
- }
58
- }
59
- _getFieldOptions() {
60
- return this.fields.map((field) => ({
61
- value: field.value,
62
- label: field.label,
63
- }));
64
- }
65
- _getOperatorOptions(fieldType) {
66
- if (!fieldType || !isAllowedType(fieldType)) {
67
- return [];
68
- }
69
- // Use utility function to get operators for the field type
70
- return getOperatorsByColumnType(fieldType);
71
- }
72
- _getConjunctionOptions() {
73
- return [
74
- { value: 'AND', label: 'AND' },
75
- { value: 'OR', label: 'OR' },
76
- ];
77
- }
78
- _getSelectedField(fieldValue) {
79
- return this.fields.find((field) => field.value === fieldValue);
80
- }
81
- _addGroup() {
82
- const newGroup = {
83
- id: this._generateGroupId(),
84
- logicOperator: 'AND',
85
- conditions: [],
86
- };
87
- this.data = {
88
- ...this.data,
89
- filterGroups: [...this.data.filterGroups, newGroup],
90
- };
91
- this._dispatchChangeEvent();
92
- this.requestUpdate();
93
- }
94
- _removeGroup(groupId) {
95
- if (this.data.filterGroups.length <= 1) {
96
- return; // Don't allow removing the last group
97
- }
98
- this.data = {
99
- ...this.data,
100
- filterGroups: this.data.filterGroups.filter((group) => group.id !== groupId),
101
- };
102
- this._dispatchChangeEvent();
103
- }
104
- _addCondition(groupId, copyFromCondition) {
105
- const newCondition = copyFromCondition
106
- ? {
107
- id: this._generateConditionId(),
108
- field: copyFromCondition.field,
109
- operator: copyFromCondition.operator,
110
- value: copyFromCondition.value,
111
- }
112
- : {
113
- id: this._generateConditionId(),
114
- field: '',
115
- operator: '',
116
- value: '',
117
- };
118
- this.data = {
119
- ...this.data,
120
- filterGroups: this.data.filterGroups.map((group) => group.id === groupId
121
- ? {
122
- ...group,
123
- conditions: [...group.conditions, newCondition],
124
- }
125
- : group),
126
- };
127
- this._dispatchChangeEvent();
128
- }
129
- _removeCondition(groupId, conditionId) {
130
- this.data = {
131
- ...this.data,
132
- filterGroups: this.data.filterGroups.map((group) => group.id === groupId
133
- ? {
134
- ...group,
135
- conditions: group.conditions.filter((c) => c.id !== conditionId),
136
- }
137
- : group),
138
- };
139
- this._dispatchChangeEvent();
140
- }
141
- _updateCondition(groupId, conditionId, updates) {
142
- this.data = {
143
- ...this.data,
144
- filterGroups: this.data.filterGroups.map((group) => group.id === groupId
145
- ? {
146
- ...group,
147
- conditions: group.conditions.map((condition) => condition.id === conditionId
148
- ? { ...condition, ...updates }
149
- : condition),
150
- }
151
- : group),
152
- };
153
- this._dispatchChangeEvent();
154
- }
155
- _updateGroupLogicOperator(groupId, logicOperator) {
156
- this.data = {
157
- ...this.data,
158
- filterGroups: this.data.filterGroups.map((group) => group.id === groupId ? { ...group, logicOperator } : group),
159
- };
160
- this._dispatchChangeEvent();
161
- }
162
- _updateGlobalLogicOperator(globalLogicOperator) {
163
- this.data = {
164
- ...this.data,
165
- groupLogicOperator: globalLogicOperator,
166
- };
167
- this._dispatchChangeEvent();
168
- }
169
- _toggleVariableMode(groupId, conditionId) {
170
- this.data = {
171
- ...this.data,
172
- filterGroups: this.data.filterGroups.map((group) => group.id === groupId
173
- ? {
174
- ...group,
175
- conditions: group.conditions.map((condition) => condition.id === conditionId
176
- ? {
177
- ...condition,
178
- isVariableMode: !condition.isVariableMode,
179
- value: condition.isVariableMode ? '' : condition.value,
180
- }
181
- : condition),
182
- }
183
- : group),
184
- };
185
- this._dispatchChangeEvent();
186
- }
187
- _handleVariableSelect(groupId, conditionId, variableValue) {
188
- const variableName = `{${variableValue}}`;
189
- this._updateCondition(groupId, conditionId, {
190
- value: variableName,
191
- isVariableMode: false,
192
- });
193
- }
194
- _handleValueChangeWithVariableDetection(groupId, conditionId, value, condition) {
195
- const newValue = value || '';
196
- const wasVariable = typeof condition.value === 'string' &&
197
- condition.value.startsWith('{') &&
198
- condition.value.endsWith('}');
199
- const isStillVariable = newValue.startsWith('{') && newValue.endsWith('}');
200
- if (wasVariable && !isStillVariable) {
201
- // Variable deleted, revert to normal mode
202
- this._updateCondition(groupId, conditionId, {
203
- value: newValue,
204
- isVariableMode: false,
205
- });
206
- }
207
- else {
208
- this._handleValueChange(groupId, conditionId, newValue);
209
- }
210
- }
211
- _handleFieldChange(groupId, conditionId, value) {
212
- const fieldValue = Array.isArray(value) ? value[0] : value;
213
- const selectedField = this._getSelectedField(fieldValue);
214
- if (selectedField && isAllowedType(selectedField.type)) {
215
- const defaultOperator = getDefaultOperator(selectedField.type);
216
- // Reset operator, value, and variable mode when field changes
217
- this._updateCondition(groupId, conditionId, {
218
- field: fieldValue,
219
- operator: defaultOperator,
220
- value: this._getDefaultValueForType(selectedField.type),
221
- isVariableMode: false,
222
- });
223
- }
224
- else {
225
- // Reset operator, value, and variable mode when field changes
226
- this._updateCondition(groupId, conditionId, {
227
- field: fieldValue,
228
- operator: '',
229
- value: '',
230
- isVariableMode: false,
231
- });
232
- }
233
- }
234
- _handleOperatorChange(groupId, conditionId, value) {
235
- const operatorValue = Array.isArray(value) ? value[0] : value;
236
- // Reset value for operators that don't need it
237
- const updates = { operator: operatorValue };
238
- if (operatorValue === 'isEmpty' || operatorValue === 'isNotEmpty') {
239
- updates.value = '';
240
- updates.isVariableMode = false;
241
- }
242
- this._updateCondition(groupId, conditionId, updates);
243
- }
244
- _handleValueChange(groupId, conditionId, value) {
245
- this._updateCondition(groupId, conditionId, { value: value || '' });
246
- }
247
- _handleLogicOperatorChange(groupId, value) {
248
- const logicOperatorValue = Array.isArray(value) ? value[0] : value;
249
- this._updateGroupLogicOperator(groupId, logicOperatorValue);
250
- }
251
- _handleGlobalLogicOperatorChange(value) {
252
- const logicOperatorValue = Array.isArray(value) ? value[0] : value;
253
- this._updateGlobalLogicOperator(logicOperatorValue);
254
- }
255
- _dispatchChangeEvent() {
256
- this.dispatchEvent(new CustomEvent('filter-change', {
257
- detail: {
258
- filterGroups: this.data.filterGroups,
259
- groupLogicOperator: this.data.groupLogicOperator,
260
- },
261
- bubbles: true,
262
- composed: true,
263
- }));
264
- }
265
- _renderValueInput(group, condition) {
266
- const selectedField = this._getSelectedField(condition.field);
267
- // Check if operator doesn't require a value
268
- if (condition.operator === 'isEmpty' || condition.operator === 'isNotEmpty') {
269
- return html `<div class="filter-condition__value"></div>`;
270
- }
271
- // State 1: Variable Selection Mode
272
- if (condition.isVariableMode) {
273
- return html `
274
- <lit-select
275
- class="filter-condition__value"
276
- .options=${this.variables}
277
- .value=${''}
278
- .placeholder=${msg('Vyberte proměnnou')}
279
- ?disabled=${this.disabled}
280
- .onChange=${(value) => {
281
- const selectedValue = Array.isArray(value) ? value[0] : value;
282
- if (selectedValue) {
283
- this._handleVariableSelect(group.id, condition.id, selectedValue);
284
- }
285
- }}
286
- ></lit-select>
287
- `;
288
- }
289
- // State 2: Variable Value Mode
290
- const isVariableValue = typeof condition.value === 'string' &&
291
- condition.value.startsWith('{') &&
292
- condition.value.endsWith('}');
293
- if (isVariableValue) {
294
- return html `
295
- <lit-input
296
- class="filter-condition__value"
297
- .value=${String(condition.value || '')}
298
- .placeholder=${msg('Zadejte hodnotu nebo proměnnou')}
299
- ?disabled=${this.disabled}
300
- .onInput=${(value) => this._handleValueChangeWithVariableDetection(group.id, condition.id, value, condition)}
301
- .onClear=${() => {
302
- // When clear button is clicked, revert to default input type
303
- this._updateCondition(group.id, condition.id, {
304
- value: '',
305
- isVariableMode: false,
306
- });
307
- }}
308
- ></lit-input>
309
- `;
310
- }
311
- // State 3: Normal Mode (existing logic)
312
- if (!selectedField) {
313
- return html `
314
- <lit-input
315
- class="filter-condition__value"
316
- .value=${String(condition.value || '')}
317
- .placeholder=${msg('Zadejte hodnotu')}
318
- ?disabled=${this.disabled}
319
- .onInput=${(value) => this._handleValueChange(group.id, condition.id, value)}
320
- ></lit-input>
321
- `;
322
- }
323
- switch (selectedField.type) {
324
- case 'select':
325
- const selectOptions = selectedField.valueOptions || [];
326
- return html `
327
- <lit-select
328
- class="filter-condition__value"
329
- .options=${selectOptions}
330
- .value=${String(condition.value)}
331
- ?disabled=${this.disabled}
332
- .onChange=${(value) => this._handleValueChange(group.id, condition.id, Array.isArray(value) ? value[0] : value)}
333
- ></lit-select>
334
- `;
335
- case 'multiselect':
336
- const multiselectOptions = selectedField.valueOptions || [];
337
- // Convert string value to array for multiselect
338
- const multiselectValue = typeof condition.value === 'string' && condition.value
339
- ? condition.value.split(',').filter((v) => v.trim())
340
- : Array.isArray(condition.value)
341
- ? condition.value
342
- : [];
343
- return html `
344
- <lit-select
345
- class="filter-condition__value"
346
- .options=${multiselectOptions}
347
- .value=${multiselectValue}
348
- .multiple=${true}
349
- ?disabled=${this.disabled}
350
- .onChange=${(value) => this._handleValueChange(group.id, condition.id, Array.isArray(value) ? value.join(',') : value)}
351
- ></lit-select>
352
- `;
353
- case 'number':
354
- return html `
355
- <lit-input
356
- class="filter-condition__value"
357
- type="number"
358
- .value=${String(condition.value || '')}
359
- .placeholder=${msg('Zadejte číslo')}
360
- ?disabled=${this.disabled}
361
- .onInput=${(value) => this._handleValueChange(group.id, condition.id, value)}
362
- ></lit-input>
363
- `;
364
- case 'date':
365
- return html `
366
- <lit-date-picker
367
- class="filter-condition__value"
368
- .value=${String(condition.value || '')}
369
- .placeholder=${msg('Vyberte datum')}
370
- ?disabled=${this.disabled}
371
- .onChange=${(value) => this._handleValueChange(group.id, condition.id, value)}
372
- ></lit-date-picker>
373
- `;
374
- case 'string':
375
- return html `
376
- <lit-input
377
- class="filter-condition__value"
378
- .value=${String(condition.value || '')}
379
- .placeholder=${msg('Zadejte hodnotu')}
380
- ?disabled=${this.disabled}
381
- .onInput=${(value) => this._handleValueChange(group.id, condition.id, value)}
382
- ></lit-input>
383
- `;
384
- default:
385
- return html `
386
- <lit-input
387
- class="filter-condition__value"
388
- .value=${String(condition.value || '')}
389
- .placeholder=${msg('Zadejte hodnotu')}
390
- ?disabled=${this.disabled}
391
- .onInput=${(value) => this._handleValueChange(group.id, condition.id, value)}
392
- ></lit-input>
393
- `;
394
- }
395
- }
396
- _renderCondition(group, condition, index) {
397
- const selectedField = this._getSelectedField(condition.field);
398
- const operatorOptions = this._getOperatorOptions(selectedField?.type);
399
- const conditionClasses = {
400
- 'filter-condition': true,
401
- 'filter-condition--empty': !condition.field,
402
- };
403
- return html `
404
- <div class=${classMap(conditionClasses)}>
405
- <!-- Field Selector -->
406
- <lit-select
407
- class="filter-condition__field"
408
- .options=${this._getFieldOptions()}
409
- .value=${condition.field}
410
- ?disabled=${this.disabled}
411
- .onChange=${(value) => this._handleFieldChange(group.id, condition.id, value)}
412
- ></lit-select>
413
-
414
- <!-- Operator Selector -->
415
- <lit-select
416
- class="filter-condition__operator"
417
- .options=${operatorOptions}
418
- .disableClearButton=${true}
419
- .value=${condition.operator}
420
- ?disabled=${this.disabled || !condition.field}
421
- .onChange=${(value) => this._handleOperatorChange(group.id, condition.id, value)}
422
- ></lit-select>
423
-
424
- <!-- Value Input -->
425
- ${this._renderValueInput(group, condition)}
426
-
427
- <!-- Actions -->
428
- <div class="filter-condition__actions">
429
- ${this.variables && this.variables.length > 0
430
- ? html `
431
- <lit-icon-button
432
- .icon=${'variable'}
433
- .size=${'small'}
434
- .variant=${'text'}
435
- .color=${'secondary'}
436
- .active=${condition.isVariableMode}
437
- ?disabled=${this.disabled}
438
- @click=${() => this._toggleVariableMode(group.id, condition.id)}
439
- ${tooltip(msg('Variables'), 'bottom')}
440
- ></lit-icon-button>
441
- `
442
- : ''}
443
-
444
- <lit-icon-button
445
- .icon=${'trash'}
446
- .size=${'small'}
447
- .variant=${'text'}
448
- .color=${'error'}
449
- ?disabled=${this.disabled}
450
- @click=${() => this._removeCondition(group.id, condition.id)}
451
- ></lit-icon-button>
452
-
453
- <lit-icon-button
454
- .icon=${'add'}
455
- .size=${'small'}
456
- .variant=${'text'}
457
- .color=${'secondary'}
458
- ?disabled=${this.disabled}
459
- @click=${() => this._addCondition(group.id, condition)}
460
- ></lit-icon-button>
461
- </div>
462
- </div>
463
-
464
- <!-- Conjunction Selector (not after last condition) -->
465
- ${index < group.conditions.length - 1
466
- ? html `
467
- <div class="filter-conjunction">
468
- <lit-select
469
- class="filter-conjunction__selector"
470
- color="info"
471
- variant="contained"
472
- .options=${this._getConjunctionOptions()}
473
- .value=${group.logicOperator}
474
- ?disabled=${this.disabled}
475
- .disableClearButton=${true}
476
- .onChange=${(value) => this._handleLogicOperatorChange(group.id, value)}
477
- ></lit-select>
478
- </div>
479
- `
480
- : ''}
481
- `;
482
- }
483
- _renderGroup(group, groupIndex) {
484
- return html `
485
- <div class="filter-group">
486
- ${this.data.filterGroups.length > 1
487
- ? html `
488
- <div class="filter-group__header">
489
- <span class="filter-group__title">${msg('Skupina')} ${groupIndex + 1}</span>
490
- <div class="filter-group__actions">
491
- <lit-icon-button
492
- .icon=${'trash'}
493
- .size=${'small'}
494
- .variant=${'text'}
495
- .color=${'error'}
496
- ?disabled=${this.disabled}
497
- @click=${() => this._removeGroup(group.id)}
498
- ></lit-icon-button>
499
- </div>
500
- </div>
501
- `
502
- : ''}
503
-
504
- ${group.conditions.length === 0
505
- ? html `
506
- <div class="filter-condition filter-condition--empty">
507
- <span>${msg('Žádné podmínky nejsou definovány')}</span>
508
- </div>
509
- `
510
- : group.conditions.map((condition, index) => this._renderCondition(group, condition, index))}
511
-
512
- <div class="add-condition-button">
513
- <lit-responsive-button
514
- .variant=${'text'}
515
- .size=${'medium'}
516
- .color=${'secondary'}
517
- .label=${msg('Přidat podmínku')}
518
- .icon=${'add'}
519
- ?disabled=${this.disabled}
520
- .onClick=${() => this._addCondition(group.id)}
521
- ></lit-responsive-button>
522
- </div>
523
- </div>
524
- `;
525
- }
526
- render() {
527
- return html `
528
- <div class="filter-builder">
529
- <div class="filter-groups-container">
530
- ${this.data.filterGroups.map((group, groupIndex) => html `
531
- ${this._renderGroup(group, groupIndex)}
532
- ${groupIndex < this.data.filterGroups.length - 1
533
- ? html `
534
- <div class="global-logic-operator">
535
- <lit-select
536
- class="global-logic-operator__selector"
537
- color="info"
538
- variant="contained"
539
- .options=${this._getConjunctionOptions()}
540
- .value=${this.data.groupLogicOperator}
541
- ?disabled=${this.disabled}
542
- .disableClearButton=${true}
543
- .onChange=${(value) => this._handleGlobalLogicOperatorChange(value)}
544
- ></lit-select>
545
- </div>
546
- `
547
- : ''}
548
- `)}
549
- </div>
550
-
551
- <lit-button
552
- .icon=${'add'}
553
- .variant=${'text'}
554
- .size=${'medium'}
555
- .color=${'secondary'}
556
- ?disabled=${this.disabled}
557
- @click=${() => {
558
- this._addGroup();
559
- }}
560
- label=${msg('Přidat skupinu')}
561
- >
562
- </lit-button>
563
- </div>
564
- `;
565
- }
566
- }
567
- LitFilterBuilder.styles = css `
568
- :host {
569
- display: block;
570
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
571
- background-color: #ffffff;
572
- border-radius: 8px;
573
- border: 1px dashed var(--color-divider, #d1d5db);
574
- padding: 0.5rem;
575
- }
576
-
577
- .filter-builder {
578
- display: flex;
579
- flex-direction: column;
580
- gap: 0.625rem;
581
- }
582
-
583
- .filter-condition {
584
- display: flex;
585
- align-items: center;
586
- gap: 0.75rem;
587
- padding: 0.5rem;
588
- background-color: var(--background-paper, #f3f4f6);
589
- border: 1px dashed var(--color-divider, #d1d5db);
590
- border-radius: 0.5rem;
591
- transition: all 0.2s;
592
- }
593
-
594
- .filter-condition:hover {
595
- border-color: #d1d5db;
596
- }
597
-
598
- .filter-condition__field {
599
- min-width: 200px;
600
- flex: 2;
601
- }
602
-
603
- .filter-condition__operator {
604
- min-width: 150px;
605
- flex: 1;
606
- }
607
-
608
- .filter-condition__value {
609
- min-width: 200px;
610
- flex: 2;
611
- }
612
-
613
- .filter-condition__actions {
614
- display: flex;
615
- gap: 0.5rem;
616
- }
617
-
618
- .filter-conjunction {
619
- display: flex;
620
- align-items: center;
621
- justify-content: start;
622
- }
623
-
624
- .filter-conjunction__selector {
625
- min-width: 80px;
626
- }
627
-
628
- .filter-condition--empty {
629
- border-style: dashed;
630
- border-color: var(--color-divider, #d1d5db);
631
- background-color: var(--background-paper, #f3f4f6);
632
- }
633
-
634
- .icon {
635
- width: 1rem;
636
- height: 1rem;
637
- }
638
-
639
- .filter-group {
640
- display: flex;
641
- flex-direction: column;
642
- gap: 0.625rem;
643
- padding: 0.5rem 0.5rem 0.5rem 1rem;
644
- background-color: var(--background-paper, #ffffff);
645
- border: 1px dashed var(--color-divider, #d1d5db);
646
- border-radius: 0.75rem;
647
- position: relative;
648
- }
649
-
650
- .filter-group__header {
651
- display: flex;
652
- justify-content: space-between;
653
- align-items: center;
654
- }
655
-
656
- .filter-group__title {
657
- font-weight: 600;
658
- color: var(--color-text-primary, #1f2937);
659
- font-size: 0.875rem;
660
- }
661
-
662
- .filter-group__actions {
663
- display: flex;
664
- gap: 0.5rem;
665
- }
666
-
667
- .filter-groups-container {
668
- display: flex;
669
- flex-direction: column;
670
- gap: 0.5rem;
671
- }
672
-
673
- .global-logic-operator {
674
- display: flex;
675
- justify-content: start;
676
- align-items: center;
677
- }
678
-
679
- .global-logic-operator__selector {
680
- min-width: 100px;
681
- }
682
- `;
683
- __decorate([
684
- property({ type: Object })
685
- ], LitFilterBuilder.prototype, "data", void 0);
686
- __decorate([
687
- property({ type: Array })
688
- ], LitFilterBuilder.prototype, "fields", void 0);
689
- __decorate([
690
- property({ type: Array })
691
- ], LitFilterBuilder.prototype, "variables", void 0);
692
- __decorate([
693
- property({ type: Boolean })
694
- ], LitFilterBuilder.prototype, "disabled", void 0);
695
- __decorate([
696
- property({ type: String })
697
- ], LitFilterBuilder.prototype, "locale", void 0);
698
- if (!window.customElements.get('lit-filter-builder')) {
699
- window.customElements.define('lit-filter-builder', LitFilterBuilder);
700
- }
701
- //# sourceMappingURL=lit-filter-builder.js.map