overview-components 1.1.162 → 1.1.166

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 (252) hide show
  1. package/dist/assets/generated/locales/de.js +269 -0
  2. package/dist/assets/generated/locales/de.js.map +1 -0
  3. package/dist/assets/generated/locales/en.js +269 -0
  4. package/dist/assets/generated/locales/en.js.map +1 -0
  5. package/dist/assets/generated/locales/fr.js +269 -0
  6. package/dist/assets/generated/locales/fr.js.map +1 -0
  7. package/dist/assets/generated/locales/hr.js +269 -0
  8. package/dist/assets/generated/locales/hr.js.map +1 -0
  9. package/dist/assets/generated/locales/it.js +269 -0
  10. package/dist/assets/generated/locales/it.js.map +1 -0
  11. package/dist/assets/generated/locales/pl.js +269 -0
  12. package/dist/assets/generated/locales/pl.js.map +1 -0
  13. package/dist/assets/generated/locales/ro.js +269 -0
  14. package/dist/assets/generated/locales/ro.js.map +1 -0
  15. package/dist/assets/generated/locales/sk.js +269 -0
  16. package/dist/assets/generated/locales/sk.js.map +1 -0
  17. package/dist/assets/generated/locales/sr.js +269 -0
  18. package/dist/assets/generated/locales/sr.js.map +1 -0
  19. package/dist/assets/icons/iconGlyphs.js +691 -0
  20. package/dist/assets/icons/iconGlyphs.js.map +1 -0
  21. package/dist/assets/illustration/aichatbot-illustration.js +144 -0
  22. package/dist/assets/illustration/aichatbot-illustration.js.map +1 -0
  23. package/dist/assets/illustration/delete-illustration.js +88 -0
  24. package/dist/assets/illustration/delete-illustration.js.map +1 -0
  25. package/dist/assets/illustration/no-content.js +159 -0
  26. package/dist/assets/illustration/no-content.js.map +1 -0
  27. package/dist/assets/illustration/no-preview.js +125 -0
  28. package/dist/assets/illustration/no-preview.js.map +1 -0
  29. package/dist/assets/illustration/not-found.js +98 -0
  30. package/dist/assets/illustration/not-found.js.map +1 -0
  31. package/dist/assets/illustration/settings-illustration.js +168 -0
  32. package/dist/assets/illustration/settings-illustration.js.map +1 -0
  33. package/dist/components/components-settings/attachments-tab-settings.js +318 -0
  34. package/dist/components/components-settings/attachments-tab-settings.js.map +1 -0
  35. package/dist/components/components-settings/data-grid-settings.js +553 -0
  36. package/dist/components/components-settings/data-grid-settings.js.map +1 -0
  37. package/dist/components/components-settings/section-tab-settings.js +719 -0
  38. package/dist/components/components-settings/section-tab-settings.js.map +1 -0
  39. package/dist/components/components-settings/tabs-overview-settings.js +421 -0
  40. package/dist/components/components-settings/tabs-overview-settings.js.map +1 -0
  41. package/dist/components/index.js +30 -0
  42. package/dist/components/index.js.map +1 -0
  43. package/dist/components/lit-ai-filter-assistant.js +443 -0
  44. package/dist/components/lit-ai-filter-assistant.js.map +1 -0
  45. package/dist/components/lit-attachments-tab.js +2044 -0
  46. package/dist/components/lit-attachments-tab.js.map +1 -0
  47. package/dist/components/lit-badge.js +124 -0
  48. package/dist/components/lit-badge.js.map +1 -0
  49. package/dist/components/lit-case-variables-tab.d.ts +3 -0
  50. package/dist/components/lit-case-variables-tab.d.ts.map +1 -1
  51. package/dist/components/lit-case-variables-tab.js +3781 -0
  52. package/dist/components/lit-case-variables-tab.js.map +1 -0
  53. package/dist/components/lit-chart.js +727 -0
  54. package/dist/components/lit-chart.js.map +1 -0
  55. package/dist/components/lit-data-grid-tanstack.js +2550 -0
  56. package/dist/components/lit-data-grid-tanstack.js.map +1 -0
  57. package/dist/components/lit-filter-builder.js +701 -0
  58. package/dist/components/lit-filter-builder.js.map +1 -0
  59. package/dist/components/lit-filter-modal.js +349 -0
  60. package/dist/components/lit-filter-modal.js.map +1 -0
  61. package/dist/components/lit-multiselect-item.js +707 -0
  62. package/dist/components/lit-multiselect-item.js.map +1 -0
  63. package/dist/components/lit-section-tab.js +268 -0
  64. package/dist/components/lit-section-tab.js.map +1 -0
  65. package/dist/components/lit-tabs-overview.js +356 -0
  66. package/dist/components/lit-tabs-overview.js.map +1 -0
  67. package/dist/components/modals/lit-confirm-modal.js +121 -0
  68. package/dist/components/modals/lit-confirm-modal.js.map +1 -0
  69. package/dist/components/modals/lit-delete-modal.js +131 -0
  70. package/dist/components/modals/lit-delete-modal.js.map +1 -0
  71. package/dist/components/react-wrappers/ai-filter-assistant.js +9 -0
  72. package/dist/components/react-wrappers/ai-filter-assistant.js.map +1 -0
  73. package/dist/components/react-wrappers/attachments-tab.js +9 -0
  74. package/dist/components/react-wrappers/attachments-tab.js.map +1 -0
  75. package/dist/components/react-wrappers/badge.js +9 -0
  76. package/dist/components/react-wrappers/badge.js.map +1 -0
  77. package/dist/components/react-wrappers/button.js +9 -0
  78. package/dist/components/react-wrappers/button.js.map +1 -0
  79. package/dist/components/react-wrappers/calendar.js +9 -0
  80. package/dist/components/react-wrappers/calendar.js.map +1 -0
  81. package/dist/components/react-wrappers/case-variables-tab.js +9 -0
  82. package/dist/components/react-wrappers/case-variables-tab.js.map +1 -0
  83. package/dist/components/react-wrappers/chart.js +9 -0
  84. package/dist/components/react-wrappers/chart.js.map +1 -0
  85. package/dist/components/react-wrappers/data-grid-tanstack.js +9 -0
  86. package/dist/components/react-wrappers/data-grid-tanstack.js.map +1 -0
  87. package/dist/components/react-wrappers/filter-builder.js +12 -0
  88. package/dist/components/react-wrappers/filter-builder.js.map +1 -0
  89. package/dist/components/react-wrappers/filter-modal.js +9 -0
  90. package/dist/components/react-wrappers/filter-modal.js.map +1 -0
  91. package/dist/components/react-wrappers/index.js +27 -0
  92. package/dist/components/react-wrappers/index.js.map +1 -0
  93. package/dist/components/react-wrappers/progress-bar.js +9 -0
  94. package/dist/components/react-wrappers/progress-bar.js.map +1 -0
  95. package/dist/components/react-wrappers/section-tab.js +9 -0
  96. package/dist/components/react-wrappers/section-tab.js.map +1 -0
  97. package/dist/components/react-wrappers/tabs-overview.js +9 -0
  98. package/dist/components/react-wrappers/tabs-overview.js.map +1 -0
  99. package/dist/data/translations.js +2768 -0
  100. package/dist/data/translations.js.map +1 -0
  101. package/dist/index.d.ts +0 -1
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +7 -22487
  104. package/dist/index.js.map +1 -0
  105. package/dist/schemas/index.js +18 -0
  106. package/dist/schemas/index.js.map +1 -0
  107. package/dist/schemas/lit-attachments-tab-document.schema.js +39 -0
  108. package/dist/schemas/lit-attachments-tab-document.schema.js.map +1 -0
  109. package/dist/schemas/lit-attachments-tab-settings-value.schema.js +30 -0
  110. package/dist/schemas/lit-attachments-tab-settings-value.schema.js.map +1 -0
  111. package/dist/schemas/lit-attachments-tab.schema.js +68 -0
  112. package/dist/schemas/lit-attachments-tab.schema.js.map +1 -0
  113. package/dist/schemas/lit-case-variables-tab-cell.schema.d.ts +3 -0
  114. package/dist/schemas/lit-case-variables-tab-cell.schema.d.ts.map +1 -1
  115. package/dist/schemas/lit-case-variables-tab-cell.schema.js +226 -0
  116. package/dist/schemas/lit-case-variables-tab-cell.schema.js.map +1 -0
  117. package/dist/schemas/lit-case-variables-tab-rows.schema.d.ts +3 -0
  118. package/dist/schemas/lit-case-variables-tab-rows.schema.d.ts.map +1 -1
  119. package/dist/schemas/lit-case-variables-tab-rows.schema.js +6 -0
  120. package/dist/schemas/lit-case-variables-tab-rows.schema.js.map +1 -0
  121. package/dist/schemas/lit-case-variables-tab.schema.d.ts +6 -0
  122. package/dist/schemas/lit-case-variables-tab.schema.d.ts.map +1 -1
  123. package/dist/schemas/lit-case-variables-tab.schema.js +27 -0
  124. package/dist/schemas/lit-case-variables-tab.schema.js.map +1 -0
  125. package/dist/schemas/lit-data-grid-tanstack-column-array.schema.js +6 -0
  126. package/dist/schemas/lit-data-grid-tanstack-column-array.schema.js.map +1 -0
  127. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter-array.schema.js +6 -0
  128. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter-array.schema.js.map +1 -0
  129. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter.schema.js +11 -0
  130. package/dist/schemas/lit-data-grid-tanstack-column-custom-filter.schema.js.map +1 -0
  131. package/dist/schemas/lit-data-grid-tanstack-column.schema.js +79 -0
  132. package/dist/schemas/lit-data-grid-tanstack-column.schema.js.map +1 -0
  133. package/dist/schemas/lit-data-grid-tanstack.schema.js +108 -0
  134. package/dist/schemas/lit-data-grid-tanstack.schema.js.map +1 -0
  135. package/dist/schemas/lit-filter-builder.schema.js +61 -0
  136. package/dist/schemas/lit-filter-builder.schema.js.map +1 -0
  137. package/dist/schemas/lit-section-tab-schema.js +37 -0
  138. package/dist/schemas/lit-section-tab-schema.js.map +1 -0
  139. package/dist/schemas/lit-tabs-overview-tab-array.schema.js +6 -0
  140. package/dist/schemas/lit-tabs-overview-tab-array.schema.js.map +1 -0
  141. package/dist/schemas/lit-tabs-overview-tab.schema.js +32 -0
  142. package/dist/schemas/lit-tabs-overview-tab.schema.js.map +1 -0
  143. package/dist/schemas/lit-tabs-overview.schema.js +29 -0
  144. package/dist/schemas/lit-tabs-overview.schema.js.map +1 -0
  145. package/dist/scripts/translate-locales.js +241 -0
  146. package/dist/scripts/translate-locales.js.map +1 -0
  147. package/dist/shared/filter-inputs.js +429 -0
  148. package/dist/shared/filter-inputs.js.map +1 -0
  149. package/dist/shared/index.js +40 -0
  150. package/dist/shared/index.js.map +1 -0
  151. package/dist/shared/lit-button.js +159 -0
  152. package/dist/shared/lit-button.js.map +1 -0
  153. package/dist/shared/lit-calendar.js +485 -0
  154. package/dist/shared/lit-calendar.js.map +1 -0
  155. package/dist/shared/lit-case-variables-tab-cell.d.ts +2 -0
  156. package/dist/shared/lit-case-variables-tab-cell.d.ts.map +1 -1
  157. package/dist/shared/lit-case-variables-tab-cell.js +235 -0
  158. package/dist/shared/lit-case-variables-tab-cell.js.map +1 -0
  159. package/dist/shared/lit-checkbox.js +184 -0
  160. package/dist/shared/lit-checkbox.js.map +1 -0
  161. package/dist/shared/lit-custom-popper.js +116 -0
  162. package/dist/shared/lit-custom-popper.js.map +1 -0
  163. package/dist/shared/lit-data-grid-action-buttons-popover.js +295 -0
  164. package/dist/shared/lit-data-grid-action-buttons-popover.js.map +1 -0
  165. package/dist/shared/lit-data-grid-density-popover.js +84 -0
  166. package/dist/shared/lit-data-grid-density-popover.js.map +1 -0
  167. package/dist/shared/lit-data-grid-export-popover.js +68 -0
  168. package/dist/shared/lit-data-grid-export-popover.js.map +1 -0
  169. package/dist/shared/lit-data-grid-operators-popover.js +114 -0
  170. package/dist/shared/lit-data-grid-operators-popover.js.map +1 -0
  171. package/dist/shared/lit-data-grid-row-actions.js +87 -0
  172. package/dist/shared/lit-data-grid-row-actions.js.map +1 -0
  173. package/dist/shared/lit-date-picker.js +608 -0
  174. package/dist/shared/lit-date-picker.js.map +1 -0
  175. package/dist/shared/lit-document-thumbnail.js +383 -0
  176. package/dist/shared/lit-document-thumbnail.js.map +1 -0
  177. package/dist/shared/lit-filter-input.js +115 -0
  178. package/dist/shared/lit-filter-input.js.map +1 -0
  179. package/dist/shared/lit-icon-button.js +165 -0
  180. package/dist/shared/lit-icon-button.js.map +1 -0
  181. package/dist/shared/lit-icon.js +337 -0
  182. package/dist/shared/lit-icon.js.map +1 -0
  183. package/dist/shared/lit-input.js +282 -0
  184. package/dist/shared/lit-input.js.map +1 -0
  185. package/dist/shared/lit-label.js +103 -0
  186. package/dist/shared/lit-label.js.map +1 -0
  187. package/dist/shared/lit-loader.js +68 -0
  188. package/dist/shared/lit-loader.js.map +1 -0
  189. package/dist/shared/lit-loading-bar.js +91 -0
  190. package/dist/shared/lit-loading-bar.js.map +1 -0
  191. package/dist/shared/lit-menu-item.js +98 -0
  192. package/dist/shared/lit-menu-item.js.map +1 -0
  193. package/dist/shared/lit-menu.js +29 -0
  194. package/dist/shared/lit-menu.js.map +1 -0
  195. package/dist/shared/lit-modal-body.js +24 -0
  196. package/dist/shared/lit-modal-body.js.map +1 -0
  197. package/dist/shared/lit-modal-footer.js +21 -0
  198. package/dist/shared/lit-modal-footer.js.map +1 -0
  199. package/dist/shared/lit-modal-header.js +34 -0
  200. package/dist/shared/lit-modal-header.js.map +1 -0
  201. package/dist/shared/lit-modal.js +168 -0
  202. package/dist/shared/lit-modal.js.map +1 -0
  203. package/dist/shared/lit-overflow-tooltip.js +114 -0
  204. package/dist/shared/lit-overflow-tooltip.js.map +1 -0
  205. package/dist/shared/lit-pill.js +87 -0
  206. package/dist/shared/lit-pill.js.map +1 -0
  207. package/dist/shared/lit-progress-bar.js +130 -0
  208. package/dist/shared/lit-progress-bar.js.map +1 -0
  209. package/dist/shared/lit-responsive-button.js +106 -0
  210. package/dist/shared/lit-responsive-button.js.map +1 -0
  211. package/dist/shared/lit-select-field.js +457 -0
  212. package/dist/shared/lit-select-field.js.map +1 -0
  213. package/dist/shared/lit-select.js +668 -0
  214. package/dist/shared/lit-select.js.map +1 -0
  215. package/dist/shared/lit-settings.js +76 -0
  216. package/dist/shared/lit-settings.js.map +1 -0
  217. package/dist/shared/lit-text-field.js +252 -0
  218. package/dist/shared/lit-text-field.js.map +1 -0
  219. package/dist/shared/lit-toggle.js +240 -0
  220. package/dist/shared/lit-toggle.js.map +1 -0
  221. package/dist/shared/lit-tooltip.js +165 -0
  222. package/dist/shared/lit-tooltip.js.map +1 -0
  223. package/dist/shared/simple-popper.js +285 -0
  224. package/dist/shared/simple-popper.js.map +1 -0
  225. package/dist/shared/simple-tooltip.js +249 -0
  226. package/dist/shared/simple-tooltip.js.map +1 -0
  227. package/dist/shared/styles/button-shared-styles.js +494 -0
  228. package/dist/shared/styles/button-shared-styles.js.map +1 -0
  229. package/dist/styles.js +169 -0
  230. package/dist/styles.js.map +1 -0
  231. package/dist/utils/custom-filters.js +42 -0
  232. package/dist/utils/custom-filters.js.map +1 -0
  233. package/dist/utils/date.js +21 -0
  234. package/dist/utils/date.js.map +1 -0
  235. package/dist/utils/file-type-utils.js +55 -0
  236. package/dist/utils/file-type-utils.js.map +1 -0
  237. package/dist/utils/formatNumber.js +62 -0
  238. package/dist/utils/formatNumber.js.map +1 -0
  239. package/dist/utils/getOperatorByType.js +70 -0
  240. package/dist/utils/getOperatorByType.js.map +1 -0
  241. package/dist/utils/getOverviewValue.js +175 -0
  242. package/dist/utils/getOverviewValue.js.map +1 -0
  243. package/dist/utils/localization.js +433 -0
  244. package/dist/utils/localization.js.map +1 -0
  245. package/dist/utils/pdf-thumbnail-generator.js +91 -0
  246. package/dist/utils/pdf-thumbnail-generator.js.map +1 -0
  247. package/dist/utils/utils.js +94 -0
  248. package/dist/utils/utils.js.map +1 -0
  249. package/package.json +21 -55
  250. package/README.md +0 -82
  251. package/dist/assets/illustration/index.d.ts +0 -7
  252. package/dist/assets/illustration/index.d.ts.map +0 -1
@@ -0,0 +1,701 @@
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