aloha-vue 2.74.0 → 2.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -21
  3. package/dist/aloha-vue.css +13594 -13594
  4. package/dist/aloha-vue.css.map +1 -1
  5. package/dist/aloha-vue.es.js +59266 -64918
  6. package/dist/aloha-vue.umd.js +338 -211
  7. package/package.json +27 -34
  8. package/scss/components/ATable.scss +2 -2
  9. package/scss/utils/button.scss +362 -362
  10. package/scss/utils/funktions.scss +162 -162
  11. package/src/AAccordion/AAccordionItem/AAccordionItem.js +235 -230
  12. package/src/ACarousel/ACarousel.js +7 -2
  13. package/src/ADropdown/ADropdown.js +4 -1
  14. package/src/AFilters/AFilterCenter/AFilterCenter.js +5 -1
  15. package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +7 -2
  16. package/src/AFilters/AFiltersHorizontal/AFiltersHorizontal.js +412 -396
  17. package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/AFiltersHorizontalFilter.js +102 -99
  18. package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSavedDeleteAPI.js +108 -108
  19. package/src/AFilters/AFiltersMain/AFiltersMain.js +114 -111
  20. package/src/AFilters/AFiltersSaveModal/compositionAPI/SaveAPI.js +65 -65
  21. package/src/ALinkCopy/ALinkCopy.js +98 -95
  22. package/src/ALinkCopy/compositionAPI/CopyAPI.js +48 -48
  23. package/src/AList/__tests__/AList.test.js +33 -33
  24. package/src/AList/compositionAPI/__tests__/TagAPI.test.js +43 -43
  25. package/src/AMenu/AMenu.js +4 -1
  26. package/src/AMenu/AMenuBreadcrumbs/AMenuBreadcrumbs.js +240 -237
  27. package/src/AMenu/AMenuPanelLink/AMenuPanelLink.js +4 -1
  28. package/src/AMenu/AMenuSearchPanelBreadcrumbs/AMenuSearchPanelBreadcrumbs.js +122 -119
  29. package/src/AModalWizard/AModalWizard.js +58 -53
  30. package/src/AModalWizard/compositionAPI/__tests__/ScrollAPI.test.js +46 -46
  31. package/src/APagination/APaginationPages/APaginationPages.js +15 -4
  32. package/src/ARate/ARate.js +254 -249
  33. package/src/ARate/ARateIcon/ADecimalIcon/ADecimalIcon.js +53 -50
  34. package/src/ARate/ARateIcon/ARateIcon.js +109 -104
  35. package/src/AResizer/AResizer.js +167 -162
  36. package/src/ATable/ATableHeaderTh/compositionAPI/SortAPI.js +172 -167
  37. package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +14 -4
  38. package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/ATableHeaderThActionItem.js +191 -184
  39. package/src/ATable/ATablePreviewDown/ATablePreviewDown.js +72 -69
  40. package/src/ATable/ATablePreviewRight/ATablePreviewRight.js +265 -258
  41. package/src/ATable/ATableSortingAdditional/ATableSortingAdditional.js +224 -219
  42. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.AttributesAPI.test.js +39 -39
  43. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ColumnsAPI.test.js +68 -68
  44. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.DropdownAPI.test.js +45 -45
  45. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.FormAPI.test.js +95 -95
  46. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ModelAPI.test.js +1 -1
  47. package/src/ATable/ATableTd/ATableTd.js +4 -1
  48. package/src/ATable/ATableTdAction/ATableTdAction.js +19 -12
  49. package/src/ATable/ATableTopPanel/ATableTopPanel.js +11 -3
  50. package/src/ATable/ATableTr/ATableTr.js +408 -405
  51. package/src/ATable/__tests__/ATable.HeaderSlot.test.js +102 -97
  52. package/src/ATable/__tests__/ATable.RowIdsAPI.test.js +66 -66
  53. package/src/ATableForm/ATableForm.js +88 -85
  54. package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +14 -4
  55. package/src/ATableForm/ATableFormCellDnd/ATableFormCellDnd.js +196 -187
  56. package/src/ATableForm/ATableFormRow/compositionAPI/EditAPI.js +104 -104
  57. package/src/ATableForm/__tests__/ATableForm.DragAndDropAPI.test.js +200 -212
  58. package/src/ATableForm/__tests__/ATableForm.ListView.test.js +134 -174
  59. package/src/ATableForm/compositionAPI/IconsAPI.js +24 -21
  60. package/src/AVerticalScroll/AVerticalScroll.js +182 -177
  61. package/src/AWizard/AWizard.js +26 -21
  62. package/src/AWizard/AWizardStep/AWizardStep.js +275 -270
  63. package/src/AWizard/compositionAPI/__tests__/ChangeStepAPI.test.js +32 -32
  64. package/src/AWizard/compositionAPI/__tests__/LocalAPI.test.js +55 -55
  65. package/src/PuxDatepicker/PuxDatepickerCalendarPanel/PuxDatepickerCalendarPanel.js +646 -648
  66. package/src/PuxDatepicker/panel/PanelDate/PanelDate.js +300 -301
  67. package/src/PuxDatepicker/panel/PanelMonth/PanelMonth.js +148 -149
  68. package/src/PuxDatepicker/panel/PanelTime/PanelTime.js +256 -257
  69. package/src/PuxDatepicker/panel/PanelYear/PanelYear.js +136 -137
  70. package/src/PuxDatepicker/utils/index.js +100 -100
  71. package/src/compositionAPI/AHttpAPI.js +593 -593
  72. package/src/compositionAPI/__tests__/AHttpAPI.test.js +42 -42
  73. package/src/filters/__tests__/filterBoolean.test.js +38 -38
  74. package/src/filters/__tests__/filterCapitalize.test.js +38 -38
  75. package/src/filters/__tests__/filterCurrency.test.js +21 -21
  76. package/src/filters/__tests__/filterDate.test.js +42 -42
  77. package/src/filters/__tests__/filterDefaultForEmpty.test.js +24 -24
  78. package/src/filters/__tests__/filterEmail.test.js +42 -42
  79. package/src/filters/__tests__/filterEscapeHtml.test.js +45 -45
  80. package/src/filters/__tests__/filterFileSize.test.js +45 -45
  81. package/src/filters/__tests__/filterFloat.test.js +74 -74
  82. package/src/filters/__tests__/filterJson.test.js +74 -74
  83. package/src/filters/__tests__/filterKeyValue.test.js +50 -50
  84. package/src/filters/__tests__/filterLimitTo.test.js +39 -39
  85. package/src/filters/__tests__/filterLink.test.js +41 -41
  86. package/src/filters/__tests__/filterList.test.js +149 -149
  87. package/src/filters/__tests__/filterLowerCase.test.js +38 -38
  88. package/src/filters/__tests__/filterMask.test.js +80 -80
  89. package/src/filters/__tests__/filterPropertyByValue.test.js +27 -27
  90. package/src/filters/__tests__/filterSearchHighlight.test.js +129 -129
  91. package/src/filters/__tests__/filterUpperCase.test.js +38 -38
  92. package/src/filters/__tests__/filterValueByCondition.test.js +3 -3
  93. package/src/filters/filterJson.js +39 -39
  94. package/src/filters/filterValueByCondition.js +2 -2
  95. package/src/plugins/AAlertPlugin.js +16 -5
  96. package/src/plugins/AMultiselectOrderedPlugin.js +88 -81
  97. package/src/plugins/ASelectPlugin.js +12 -10
  98. package/src/ui/ACheckbox/ACheckbox.js +82 -79
  99. package/src/ui/ADatepicker/compositionAPI/EventsAPI.js +297 -297
  100. package/src/ui/ADatepicker/utils/index.js +76 -76
  101. package/src/ui/ADatepickerAlt/ADatepicker.js +912 -912
  102. package/src/ui/ADatepickerAlt/utils/index.js +98 -98
  103. package/src/ui/AFieldset/__tests__/AFieldset.ClassColumn.test.js +113 -114
  104. package/src/ui/AFormElementBtnClear/AFormElementBtnClear.js +4 -1
  105. package/src/ui/AInputCurrency/AInputCurrency.js +20 -15
  106. package/src/ui/AInputCurrency/__tests__/AInputCurrency.ModelAPI.test.js +73 -73
  107. package/src/ui/AInputNumber/AInputNumber.js +17 -12
  108. package/src/ui/AJson/AJson.js +12 -3
  109. package/src/ui/AJson/compositionAPI/JsonAPI.js +116 -116
  110. package/src/ui/ALabel/__tests__/ALabel.IdAPI.test.js +42 -42
  111. package/src/ui/ALabel/__tests__/ALabel.LabelAPI.test.js +33 -33
  112. package/src/ui/ARadio/ARadio.js +80 -77
  113. package/src/ui/ASelect/ASelect.js +390 -383
  114. package/src/ui/ASelect/ASelectElement/ASelectElement.js +179 -176
  115. package/src/ui/ASelect/ASelectValueCloseable/ASelectValueCloseable.js +143 -141
  116. package/src/ui/ASelect/__tests__/SelectedFirstAPI.test.js +101 -101
  117. package/src/ui/ASelect/__tests__/SelectedVisibleAPI.test.js +98 -98
  118. package/src/ui/ASlider/compositionAPI/SliderAPI.js +23 -23
  119. package/src/ui/AValidatedJson/AValidatedJson.js +4 -1
  120. package/src/ui/AValidatedJson/AValidatedJsonItem/AValidatedJsonItem.js +308 -298
  121. package/src/ui/compositionApi/UiCollapseAPI.js +68 -63
  122. package/src/ui/compositionApi/UiInputAutofillAPI.js +41 -41
  123. package/src/ui/compositionApi/__tests__/UIDataGroupAPI.test.js +106 -106
  124. package/src/ui/compositionApi/__tests__/UIExcludeRenderAttributesAPI.test.js +39 -39
  125. package/src/ui/compositionApi/__tests__/UiDataWithKeyIdAndLabelAPI.test.js +128 -128
  126. package/src/ui/compositionApi/__tests__/UiSearchAPI.test.js +71 -71
  127. package/src/utils/EventBus.js +51 -8
  128. package/src/utils/__tests__/EventBus.test.js +138 -0
  129. package/src/utils/__tests__/utils.aOrderBy.test.js +1 -1
  130. package/src/utils/__tests__/utils.aSortBy.test.js +1 -1
  131. package/src/utils/__tests__/utils.getTotalNestedCount.test.js +56 -56
  132. package/src/utils/__tests__/utils.isArrayOfArrays.test.js +44 -44
  133. package/src/utils/__tests__/utils.isArrayOfStrings.test.js +36 -36
  134. package/src/utils/__tests__/utilsArray.aFirst.test.js +1 -1
  135. package/src/utils/__tests__/utilsArray.aLast.test.js +1 -1
  136. package/src/utils/__tests__/utilsLang.isArguments.test.js +1 -1
  137. package/src/utils/__tests__/utilsLang.isArray.test.js +1 -1
  138. package/src/utils/__tests__/utilsLang.isArrayBuffer.test.js +1 -1
  139. package/src/utils/__tests__/utilsLang.isBoolean.test.js +1 -1
  140. package/src/utils/__tests__/utilsLang.isBuffer.test.js +1 -1
  141. package/src/utils/__tests__/utilsLang.isDate.test.js +1 -1
  142. package/src/utils/__tests__/utilsLang.isElement.test.js +5 -3
  143. package/src/utils/__tests__/utilsLang.isError.test.js +1 -1
  144. package/src/utils/__tests__/utilsLang.isFinite.test.js +1 -1
  145. package/src/utils/__tests__/utilsLang.isFunction.test.js +1 -1
  146. package/src/utils/__tests__/utilsLang.isInteger.test.js +1 -1
  147. package/src/utils/__tests__/utilsLang.isMap.test.js +1 -1
  148. package/src/utils/__tests__/utilsLang.isNaN.test.js +1 -1
  149. package/src/utils/__tests__/utilsLang.isNil.test.js +1 -1
  150. package/src/utils/__tests__/utilsLang.isNull.test.js +1 -1
  151. package/src/utils/__tests__/utilsLang.isNumber.test.js +1 -1
  152. package/src/utils/__tests__/utilsLang.isObject.test.js +1 -1
  153. package/src/utils/__tests__/utilsLang.isObjectLike.test.js +5 -3
  154. package/src/utils/__tests__/utilsLang.isPlainObject.test.js +3 -2
  155. package/src/utils/__tests__/utilsLang.isPromise.test.js +5 -2
  156. package/src/utils/__tests__/utilsLang.isRegExp.test.js +1 -1
  157. package/src/utils/__tests__/utilsLang.isSet.test.js +1 -1
  158. package/src/utils/__tests__/utilsLang.isString.test.js +1 -1
  159. package/src/utils/__tests__/utilsLang.isSymbol.test.js +5 -3
  160. package/src/utils/__tests__/utilsLang.isUndefined.test.js +1 -1
  161. package/src/utils/__tests__/utilsLang.isWeakMap.test.js +1 -1
  162. package/src/utils/__tests__/utilsLang.isWeakSet.test.js +1 -1
  163. package/src/utils/__tests__/utilsMath.isEven.test.js +43 -43
  164. package/src/utils/__tests__/utilsMath.isOdd.test.js +43 -43
  165. package/src/utils/__tests__/utilsUi.isModelForFilterNotEmpty.test.js +65 -65
  166. package/src/utils/autosize.js +1 -1
@@ -1,396 +1,412 @@
1
- import {
2
- h,
3
- onBeforeUnmount,
4
- } from "vue";
5
- import {
6
- ADropdown,
7
- AElement,
8
- AForm,
9
- AIcon,
10
- ASelect,
11
- ATranslation,
12
- } from "../../index";
13
-
14
- import AFiltersSaveModal from "../AFiltersSaveModal/AFiltersSaveModal";
15
-
16
- import DropdownAPI from "./compositionAPI/DropdownAPI";
17
- import EventBusAPI from "./compositionAPI/EventBusAPI";
18
- import FiltersHiddenAPI from "./compositionAPI/FiltersHiddenAPI";
19
- import FiltersSaveAPI from "./compositionAPI/FiltersSaveAPI";
20
- import FiltersSavedDeleteAPI from "./compositionAPI/FiltersSavedDeleteAPI";
21
- import FormAPI from "./compositionAPI/FormAPI";
22
- import IdAPI from "./compositionAPI/IdAPI";
23
- import SearchAPI from "./compositionAPI/SearchAPI";
24
-
25
- import Filter from "aloha-svg/dist/js/bootstrap/Filter";
26
- import Floppy2Fill from "aloha-svg/dist/js/bootstrap/Floppy2Fill";
27
- import PlusLg from "aloha-svg/dist/js/bootstrap//PlusLg";
28
- import Search from "aloha-svg/dist/js/bootstrap3/Search";
29
- import Trash from "aloha-svg/dist/js/bootstrap/Trash";
30
- import XLg from "aloha-svg/dist/js/bootstrap/XLg";
31
-
32
- export default {
33
- name: "AFiltersHorizontal",
34
- props: {
35
- canSave: {
36
- type: Boolean,
37
- required: false,
38
- },
39
- disabled: {
40
- type: Boolean,
41
- required: false,
42
- },
43
- excludeRenderAttributes: {
44
- type: Array,
45
- required: false,
46
- default: () => [],
47
- },
48
- filtersGroup: {
49
- type: Object,
50
- required: true,
51
- default: () => ({
52
- alwaysVisible: [],
53
- filters: [],
54
- }),
55
- },
56
- filtersKeyById: {
57
- type: Object,
58
- required: true,
59
- },
60
- filtersSaved: {
61
- type: Array,
62
- required: true,
63
- },
64
- filtersVisible: {
65
- type: Array,
66
- required: true,
67
- },
68
- id: {
69
- type: String,
70
- required: true,
71
- },
72
- mainModel: {
73
- type: Object,
74
- required: false,
75
- },
76
- onUpdateModelFilters: {
77
- type: Function,
78
- required: true,
79
- },
80
- unappliedModel: {
81
- type: Object,
82
- required: true,
83
- },
84
- updateDataKeyByIdFromFilter: {
85
- type: Function,
86
- required: true,
87
- },
88
- updateFiltersSaved: {
89
- type: Function,
90
- required: true,
91
- },
92
- },
93
- emits: [
94
- "startSearch",
95
- "toggleFiltersVisible",
96
- ],
97
- setup(props, context) {
98
- const {
99
- dataForForm,
100
- } = FormAPI(props);
101
-
102
- const {
103
- closeDropdown,
104
- dropdownRef,
105
- isDropdownVisible,
106
- openDropdown,
107
- } = DropdownAPI(props);
108
-
109
- const {
110
- idFilterTop,
111
- } = IdAPI(props);
112
-
113
- const {
114
- onSearch,
115
- } = SearchAPI(props, context, {
116
- closeDropdown,
117
- });
118
-
119
- const {
120
- destroyEventBus,
121
- initEventBus,
122
- initEventName,
123
- } = EventBusAPI(props, {
124
- openDropdown,
125
- });
126
-
127
- const {
128
- addFiltersVisible,
129
- deleteFiltersVisible,
130
- filtersHidden,
131
- hasFiltersHiddenDefault,
132
- } = FiltersHiddenAPI(props, context);
133
-
134
- const {
135
- buttonSaveComponentId,
136
- changeModelFiltersSaved,
137
- closeModalSave,
138
- filtersSavedLocal,
139
- initModelFiltersSaved,
140
- isModalSaveVisible,
141
- isModelFilterSavedNew,
142
- modelFiltersSaved,
143
- openModalSave,
144
- selectorCloseIds,
145
- } = FiltersSaveAPI(props, {
146
- openDropdown,
147
- });
148
-
149
- const {
150
- buttonDeleteId,
151
- isConfirmHidden,
152
- openDeleteConfirm,
153
- textScreenreaderButtonDeleteFiltersSaved,
154
- titleButtonDeleteFiltersSaved,
155
- } = FiltersSavedDeleteAPI(props, {
156
- changeModelFiltersSaved,
157
- idFilterTop,
158
- isModelFilterSavedNew,
159
- modelFiltersSaved,
160
- });
161
-
162
- initEventName();
163
- initModelFiltersSaved();
164
- initEventBus();
165
-
166
- onBeforeUnmount(() => {
167
- destroyEventBus();
168
- });
169
-
170
- return {
171
- addFiltersVisible,
172
- buttonDeleteId,
173
- buttonSaveComponentId,
174
- changeModelFiltersSaved,
175
- closeDropdown,
176
- closeModalSave,
177
- dataForForm,
178
- deleteFiltersVisible,
179
- dropdownRef,
180
- filtersHidden,
181
- filtersSavedLocal,
182
- hasFiltersHiddenDefault,
183
- idFilterTop,
184
- initModelFiltersSaved,
185
- isConfirmHidden,
186
- isDropdownVisible,
187
- isModalSaveVisible,
188
- isModelFilterSavedNew,
189
- modelFiltersSaved,
190
- onSearch,
191
- openDeleteConfirm,
192
- openModalSave,
193
- selectorCloseIds,
194
- textScreenreaderButtonDeleteFiltersSaved,
195
- titleButtonDeleteFiltersSaved,
196
- };
197
- },
198
- render() {
199
- if (!this.isDropdownVisible) {
200
- return null;
201
- }
202
-
203
- return [
204
- h(ADropdown, {
205
- ref: "dropdownRef",
206
- buttonIconLeft: Filter,
207
- buttonText: "Filter",
208
- buttonClass: "a_btn a_btn_primary a_btn_small a_filter_horizontal__btn_dropdown",
209
- dropdownTag: "div",
210
- dropdownClass: "a_filter_horizontal__wrapper",
211
- dropdownRenderDefault: true,
212
- isCloseByClickInside: false,
213
- hasCaret: false,
214
- inBody: true,
215
- lockArrowsNavigation: false,
216
- lockTabNavigation: false,
217
- useEscape: !this.isModalSaveVisible && this.isConfirmHidden,
218
- }, {
219
- ...this.$slots,
220
- dropdown: () => {
221
- return h("div", {
222
- class: "a_filter_horizontal",
223
- }, [
224
- h("div", {
225
- class: "a_filter_horizontal__header__wrapper",
226
- }, [
227
- h("div", {
228
- class: "a_filter_horizontal__header",
229
- }, [
230
- h("div", {
231
- class: "a_filter_horizontal__header__texts",
232
- }, [
233
- h(ATranslation, {
234
- class: "a_filter_horizontal__header__texts__filter",
235
- tag: "span",
236
- text: "_A_FILTERS_HOR_FILTER_HEADER_",
237
- }),
238
- this.isModelFilterSavedNew ?
239
- h(ATranslation, {
240
- class: "a_filter_horizontal__header__texts__new",
241
- tag: "em",
242
- text: this.modelFiltersSaved,
243
- }) :
244
- h("span", {}, this.modelFiltersSaved),
245
- ]),
246
- this.canSave ?
247
- h(ASelect, {
248
- modelValue: this.modelFiltersSaved,
249
- change: this.changeModelFiltersSaved,
250
- class: "a_filters_top__save_select",
251
- data: this.filtersSavedLocal,
252
- deselectable: false,
253
- keyId: "label",
254
- keyLabel: "label",
255
- keyGroup: "group",
256
- label: "_A_FILTERS_SAVE_SELECT_",
257
- menuWidthType: "by_content",
258
- search: true,
259
- translateData: true,
260
- type: "select",
261
- }) :
262
- "",
263
- ]),
264
- ]),
265
- h("div", {
266
- class: "a_filter_horizontal__body__wrapper",
267
- }, [
268
- h("div", {
269
- class: "a_filter_horizontal__body",
270
- }, [
271
- h(AForm, {
272
- idPrefix: this.idFilterTop,
273
- class: "a_filter_horizontal__body__form",
274
- classColumnDefault: "",
275
- classColumns: "",
276
- data: this.dataForForm,
277
- excludeRenderAttributes: this.excludeRenderAttributes,
278
- modelValue: this.unappliedModel,
279
- showErrors: false,
280
- onChange: this.onUpdateModelFilters,
281
- }, {
282
- ...this.$slots,
283
- groupAppend: ({ item }) => h(AElement, {
284
- type: "button",
285
- class: "a_btn a_btn_primary a_ml_2",
286
- title: "_A_FILTERS_TOP_CLOSE_",
287
- textScreenReader: "_A_FILTERS_TOP_CLOSE_",
288
- iconLeft: XLg,
289
- stop: true,
290
- onClick: () => this.deleteFiltersVisible({ filter: item }),
291
- }),
292
- formDataAppend: () => h("div", {
293
- class: "a_filter_horizontal__add_filter__wrapper",
294
- }, [
295
- h(ASelect, {
296
- buttonClassDefault: "a_btn a_btn_primary a_filter_horizontal__add_filter",
297
- change: this.addFiltersVisible,
298
- data: this.filtersHidden,
299
- hasCaret: false,
300
- disabled: !this.filtersHidden.length,
301
- isLabelFloat: false,
302
- keyGroup: "group",
303
- keyId: "id",
304
- keyLabel: "label",
305
- label: "_A_FILTERS_ADD_FILTER_",
306
- labelClass: "a_sr_only",
307
- menuWidthType: "by_content",
308
- sortOrderGroup: "asc",
309
- placement: "bottom-start",
310
- search: true,
311
- translateData: true,
312
- type: "select",
313
- }, {
314
- fixedPlaceholder: () => [
315
- h(ATranslation, {
316
- tag: "span",
317
- ariaHidden: true,
318
- class: "a_position_absolute_all",
319
- title: "_A_FILTERS_ADD_FILTER_",
320
- }),
321
- h(AIcon, {
322
- icon: PlusLg,
323
- }),
324
- ],
325
- }),
326
- ]),
327
- formAppend: () => this.canSave ?
328
- h("div", {
329
- class: "a_filter_horizontal__save_actions",
330
- }, [
331
- h(AElement, {
332
- id: this.buttonSaveComponentId,
333
- class: "a_btn a_btn_primary",
334
- iconLeft: Floppy2Fill,
335
- type: "button",
336
- text: "_A_FILTERS_SAVE_FILTER_SAVED_BTN_TEXT_",
337
- onClick: this.openModalSave,
338
- }),
339
- h(AElement, {
340
- id: this.buttonDeleteId,
341
- ariaDisabled: this.isModelFilterSavedNew,
342
- class: "a_btn a_btn_secondary",
343
- iconLeft: Trash,
344
- text: {
345
- desktop: "_A_FILTERS_DELETE_FILTER_SAVED_BTN_TEXT_",
346
- },
347
- textAriaHidden: true,
348
- textScreenReader: this.textScreenreaderButtonDeleteFiltersSaved,
349
- title: this.titleButtonDeleteFiltersSaved,
350
- type: "button",
351
- onClick: this.openDeleteConfirm,
352
- }),
353
- ]) :
354
- "",
355
- }),
356
- ]),
357
- h("div", {
358
- class: "a_filter_horizontal__footer",
359
- }, [
360
- h("div", {
361
- class: "a_filter_horizontal__footer__actions",
362
- }, [
363
- h(AElement, {
364
- type: "button",
365
- class: "a_btn a_btn_primary a_text_nowrap a_filter_horizontal__footer__actions__btn_search",
366
- iconLeft: Search,
367
- text: "_A_FILTERS_START_SEARCH_",
368
- disabled: this.disabled,
369
- onClick: this.onSearch,
370
- }),
371
- h(AElement, {
372
- type: "button",
373
- class: "a_btn a_btn_secondary a_text_nowrap a_filter_horizontal__footer__actions__btn_close",
374
- text: "_A_FILTERS_HOR_CLOSE_DROPDOWN_",
375
- onClick: this.closeDropdown,
376
- }),
377
- ]),
378
- ]),
379
- ]),
380
- ]);
381
- },
382
- }),
383
- this.isModalSaveVisible ?
384
- h(AFiltersSaveModal, {
385
- changeModelFiltersSaved: this.changeModelFiltersSaved,
386
- filtersSaved: this.filtersSaved,
387
- isModelFilterSavedNew: this.isModelFilterSavedNew,
388
- modelFiltersSaved: this.modelFiltersSaved,
389
- selectorCloseIds: this.selectorCloseIds,
390
- updateFiltersSaved: this.updateFiltersSaved,
391
- onClose: this.closeModalSave,
392
- }) :
393
- "",
394
- ];
395
- },
396
- };
1
+ import {
2
+ h,
3
+ onBeforeUnmount,
4
+ } from "vue";
5
+ import {
6
+ ADropdown,
7
+ AElement,
8
+ AForm,
9
+ AIcon,
10
+ ASelect,
11
+ ATranslation,
12
+ } from "../../index";
13
+
14
+ import AFiltersSaveModal from "../AFiltersSaveModal/AFiltersSaveModal";
15
+
16
+ import DropdownAPI from "./compositionAPI/DropdownAPI";
17
+ import EventBusAPI from "./compositionAPI/EventBusAPI";
18
+ import FiltersHiddenAPI from "./compositionAPI/FiltersHiddenAPI";
19
+ import FiltersSaveAPI from "./compositionAPI/FiltersSaveAPI";
20
+ import FiltersSavedDeleteAPI from "./compositionAPI/FiltersSavedDeleteAPI";
21
+ import FormAPI from "./compositionAPI/FormAPI";
22
+ import IdAPI from "./compositionAPI/IdAPI";
23
+ import SearchAPI from "./compositionAPI/SearchAPI";
24
+
25
+ const Filter = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-filter" viewBox="0 0 16 16">
26
+ <path d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5"/>
27
+ </svg>`;
28
+ const Floppy2Fill = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-floppy2-fill" viewBox="0 0 16 16">
29
+ <path d="M12 2h-2v3h2z"/>
30
+ <path d="M1.5 0A1.5 1.5 0 0 0 0 1.5v13A1.5 1.5 0 0 0 1.5 16h13a1.5 1.5 0 0 0 1.5-1.5V2.914a1.5 1.5 0 0 0-.44-1.06L14.147.439A1.5 1.5 0 0 0 13.086 0zM4 6a1 1 0 0 1-1-1V1h10v4a1 1 0 0 1-1 1zM3 9h10a1 1 0 0 1 1 1v5H2v-5a1 1 0 0 1 1-1"/>
31
+ </svg>`;
32
+ const PlusLg = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-lg" viewBox="0 0 16 16">
33
+ <path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2"/>
34
+ </svg>`;
35
+ const Search = `<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 1024 1024">
36
+ <path d="M761.37 637.327l256.642 256.642q5.988 6.844 5.988 15.399t-5.988 15.399l-93.246 93.246q-6.844 5.988-15.399 5.988t-15.399-5.988l-256.642-256.642q-101.802 66.727-223.278 66.727-171.095 0-292.572-121.477t-121.477-292.572 121.477-292.572 292.572-121.477 292.572 121.477 121.477 292.572q0 121.477-66.727 223.278zM130.887 414.049q0 116.344 82.981 199.325t200.181 82.981 199.753-82.553 82.553-199.753-82.553-199.753-199.753-82.553-200.181 82.981-82.981 199.325z"></path>
37
+ </svg>
38
+ `;
39
+ const Trash = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
40
+ <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/>
41
+ <path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/>
42
+ </svg>`;
43
+ const XLg = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">
44
+ <path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/>
45
+ </svg>`;
46
+
47
+
48
+ export default {
49
+ name: "AFiltersHorizontal",
50
+ props: {
51
+ canSave: {
52
+ type: Boolean,
53
+ required: false,
54
+ },
55
+ disabled: {
56
+ type: Boolean,
57
+ required: false,
58
+ },
59
+ excludeRenderAttributes: {
60
+ type: Array,
61
+ required: false,
62
+ default: () => [],
63
+ },
64
+ filtersGroup: {
65
+ type: Object,
66
+ required: true,
67
+ default: () => ({
68
+ alwaysVisible: [],
69
+ filters: [],
70
+ }),
71
+ },
72
+ filtersKeyById: {
73
+ type: Object,
74
+ required: true,
75
+ },
76
+ filtersSaved: {
77
+ type: Array,
78
+ required: true,
79
+ },
80
+ filtersVisible: {
81
+ type: Array,
82
+ required: true,
83
+ },
84
+ id: {
85
+ type: String,
86
+ required: true,
87
+ },
88
+ mainModel: {
89
+ type: Object,
90
+ required: false,
91
+ },
92
+ onUpdateModelFilters: {
93
+ type: Function,
94
+ required: true,
95
+ },
96
+ unappliedModel: {
97
+ type: Object,
98
+ required: true,
99
+ },
100
+ updateDataKeyByIdFromFilter: {
101
+ type: Function,
102
+ required: true,
103
+ },
104
+ updateFiltersSaved: {
105
+ type: Function,
106
+ required: true,
107
+ },
108
+ },
109
+ emits: [
110
+ "startSearch",
111
+ "toggleFiltersVisible",
112
+ ],
113
+ setup(props, context) {
114
+ const {
115
+ dataForForm,
116
+ } = FormAPI(props);
117
+
118
+ const {
119
+ closeDropdown,
120
+ dropdownRef,
121
+ isDropdownVisible,
122
+ openDropdown,
123
+ } = DropdownAPI(props);
124
+
125
+ const {
126
+ idFilterTop,
127
+ } = IdAPI(props);
128
+
129
+ const {
130
+ onSearch,
131
+ } = SearchAPI(props, context, {
132
+ closeDropdown,
133
+ });
134
+
135
+ const {
136
+ destroyEventBus,
137
+ initEventBus,
138
+ initEventName,
139
+ } = EventBusAPI(props, {
140
+ openDropdown,
141
+ });
142
+
143
+ const {
144
+ addFiltersVisible,
145
+ deleteFiltersVisible,
146
+ filtersHidden,
147
+ hasFiltersHiddenDefault,
148
+ } = FiltersHiddenAPI(props, context);
149
+
150
+ const {
151
+ buttonSaveComponentId,
152
+ changeModelFiltersSaved,
153
+ closeModalSave,
154
+ filtersSavedLocal,
155
+ initModelFiltersSaved,
156
+ isModalSaveVisible,
157
+ isModelFilterSavedNew,
158
+ modelFiltersSaved,
159
+ openModalSave,
160
+ selectorCloseIds,
161
+ } = FiltersSaveAPI(props, {
162
+ openDropdown,
163
+ });
164
+
165
+ const {
166
+ buttonDeleteId,
167
+ isConfirmHidden,
168
+ openDeleteConfirm,
169
+ textScreenreaderButtonDeleteFiltersSaved,
170
+ titleButtonDeleteFiltersSaved,
171
+ } = FiltersSavedDeleteAPI(props, {
172
+ changeModelFiltersSaved,
173
+ idFilterTop,
174
+ isModelFilterSavedNew,
175
+ modelFiltersSaved,
176
+ });
177
+
178
+ initEventName();
179
+ initModelFiltersSaved();
180
+ initEventBus();
181
+
182
+ onBeforeUnmount(() => {
183
+ destroyEventBus();
184
+ });
185
+
186
+ return {
187
+ addFiltersVisible,
188
+ buttonDeleteId,
189
+ buttonSaveComponentId,
190
+ changeModelFiltersSaved,
191
+ closeDropdown,
192
+ closeModalSave,
193
+ dataForForm,
194
+ deleteFiltersVisible,
195
+ dropdownRef,
196
+ filtersHidden,
197
+ filtersSavedLocal,
198
+ hasFiltersHiddenDefault,
199
+ idFilterTop,
200
+ initModelFiltersSaved,
201
+ isConfirmHidden,
202
+ isDropdownVisible,
203
+ isModalSaveVisible,
204
+ isModelFilterSavedNew,
205
+ modelFiltersSaved,
206
+ onSearch,
207
+ openDeleteConfirm,
208
+ openModalSave,
209
+ selectorCloseIds,
210
+ textScreenreaderButtonDeleteFiltersSaved,
211
+ titleButtonDeleteFiltersSaved,
212
+ };
213
+ },
214
+ render() {
215
+ if (!this.isDropdownVisible) {
216
+ return null;
217
+ }
218
+
219
+ return [
220
+ h(ADropdown, {
221
+ ref: "dropdownRef",
222
+ buttonIconLeft: Filter,
223
+ buttonText: "Filter",
224
+ buttonClass: "a_btn a_btn_primary a_btn_small a_filter_horizontal__btn_dropdown",
225
+ dropdownTag: "div",
226
+ dropdownClass: "a_filter_horizontal__wrapper",
227
+ dropdownRenderDefault: true,
228
+ isCloseByClickInside: false,
229
+ hasCaret: false,
230
+ inBody: true,
231
+ lockArrowsNavigation: false,
232
+ lockTabNavigation: false,
233
+ useEscape: !this.isModalSaveVisible && this.isConfirmHidden,
234
+ }, {
235
+ ...this.$slots,
236
+ dropdown: () => {
237
+ return h("div", {
238
+ class: "a_filter_horizontal",
239
+ }, [
240
+ h("div", {
241
+ class: "a_filter_horizontal__header__wrapper",
242
+ }, [
243
+ h("div", {
244
+ class: "a_filter_horizontal__header",
245
+ }, [
246
+ h("div", {
247
+ class: "a_filter_horizontal__header__texts",
248
+ }, [
249
+ h(ATranslation, {
250
+ class: "a_filter_horizontal__header__texts__filter",
251
+ tag: "span",
252
+ text: "_A_FILTERS_HOR_FILTER_HEADER_",
253
+ }),
254
+ this.isModelFilterSavedNew ?
255
+ h(ATranslation, {
256
+ class: "a_filter_horizontal__header__texts__new",
257
+ tag: "em",
258
+ text: this.modelFiltersSaved,
259
+ }) :
260
+ h("span", {}, this.modelFiltersSaved),
261
+ ]),
262
+ this.canSave ?
263
+ h(ASelect, {
264
+ modelValue: this.modelFiltersSaved,
265
+ change: this.changeModelFiltersSaved,
266
+ class: "a_filters_top__save_select",
267
+ data: this.filtersSavedLocal,
268
+ deselectable: false,
269
+ keyId: "label",
270
+ keyLabel: "label",
271
+ keyGroup: "group",
272
+ label: "_A_FILTERS_SAVE_SELECT_",
273
+ menuWidthType: "by_content",
274
+ search: true,
275
+ translateData: true,
276
+ type: "select",
277
+ }) :
278
+ "",
279
+ ]),
280
+ ]),
281
+ h("div", {
282
+ class: "a_filter_horizontal__body__wrapper",
283
+ }, [
284
+ h("div", {
285
+ class: "a_filter_horizontal__body",
286
+ }, [
287
+ h(AForm, {
288
+ idPrefix: this.idFilterTop,
289
+ class: "a_filter_horizontal__body__form",
290
+ classColumnDefault: "",
291
+ classColumns: "",
292
+ data: this.dataForForm,
293
+ excludeRenderAttributes: this.excludeRenderAttributes,
294
+ modelValue: this.unappliedModel,
295
+ showErrors: false,
296
+ onChange: this.onUpdateModelFilters,
297
+ }, {
298
+ ...this.$slots,
299
+ groupAppend: ({ item }) => h(AElement, {
300
+ type: "button",
301
+ class: "a_btn a_btn_primary a_ml_2",
302
+ title: "_A_FILTERS_TOP_CLOSE_",
303
+ textScreenReader: "_A_FILTERS_TOP_CLOSE_",
304
+ iconLeft: XLg,
305
+ stop: true,
306
+ onClick: () => this.deleteFiltersVisible({ filter: item }),
307
+ }),
308
+ formDataAppend: () => h("div", {
309
+ class: "a_filter_horizontal__add_filter__wrapper",
310
+ }, [
311
+ h(ASelect, {
312
+ buttonClassDefault: "a_btn a_btn_primary a_filter_horizontal__add_filter",
313
+ change: this.addFiltersVisible,
314
+ data: this.filtersHidden,
315
+ hasCaret: false,
316
+ disabled: !this.filtersHidden.length,
317
+ isLabelFloat: false,
318
+ keyGroup: "group",
319
+ keyId: "id",
320
+ keyLabel: "label",
321
+ label: "_A_FILTERS_ADD_FILTER_",
322
+ labelClass: "a_sr_only",
323
+ menuWidthType: "by_content",
324
+ sortOrderGroup: "asc",
325
+ placement: "bottom-start",
326
+ search: true,
327
+ translateData: true,
328
+ type: "select",
329
+ }, {
330
+ fixedPlaceholder: () => [
331
+ h(ATranslation, {
332
+ tag: "span",
333
+ ariaHidden: true,
334
+ class: "a_position_absolute_all",
335
+ title: "_A_FILTERS_ADD_FILTER_",
336
+ }),
337
+ h(AIcon, {
338
+ icon: PlusLg,
339
+ }),
340
+ ],
341
+ }),
342
+ ]),
343
+ formAppend: () => this.canSave ?
344
+ h("div", {
345
+ class: "a_filter_horizontal__save_actions",
346
+ }, [
347
+ h(AElement, {
348
+ id: this.buttonSaveComponentId,
349
+ class: "a_btn a_btn_primary",
350
+ iconLeft: Floppy2Fill,
351
+ type: "button",
352
+ text: "_A_FILTERS_SAVE_FILTER_SAVED_BTN_TEXT_",
353
+ onClick: this.openModalSave,
354
+ }),
355
+ h(AElement, {
356
+ id: this.buttonDeleteId,
357
+ ariaDisabled: this.isModelFilterSavedNew,
358
+ class: "a_btn a_btn_secondary",
359
+ iconLeft: Trash,
360
+ text: {
361
+ desktop: "_A_FILTERS_DELETE_FILTER_SAVED_BTN_TEXT_",
362
+ },
363
+ textAriaHidden: true,
364
+ textScreenReader: this.textScreenreaderButtonDeleteFiltersSaved,
365
+ title: this.titleButtonDeleteFiltersSaved,
366
+ type: "button",
367
+ onClick: this.openDeleteConfirm,
368
+ }),
369
+ ]) :
370
+ "",
371
+ }),
372
+ ]),
373
+ h("div", {
374
+ class: "a_filter_horizontal__footer",
375
+ }, [
376
+ h("div", {
377
+ class: "a_filter_horizontal__footer__actions",
378
+ }, [
379
+ h(AElement, {
380
+ type: "button",
381
+ class: "a_btn a_btn_primary a_text_nowrap a_filter_horizontal__footer__actions__btn_search",
382
+ iconLeft: Search,
383
+ text: "_A_FILTERS_START_SEARCH_",
384
+ disabled: this.disabled,
385
+ onClick: this.onSearch,
386
+ }),
387
+ h(AElement, {
388
+ type: "button",
389
+ class: "a_btn a_btn_secondary a_text_nowrap a_filter_horizontal__footer__actions__btn_close",
390
+ text: "_A_FILTERS_HOR_CLOSE_DROPDOWN_",
391
+ onClick: this.closeDropdown,
392
+ }),
393
+ ]),
394
+ ]),
395
+ ]),
396
+ ]);
397
+ },
398
+ }),
399
+ this.isModalSaveVisible ?
400
+ h(AFiltersSaveModal, {
401
+ changeModelFiltersSaved: this.changeModelFiltersSaved,
402
+ filtersSaved: this.filtersSaved,
403
+ isModelFilterSavedNew: this.isModelFilterSavedNew,
404
+ modelFiltersSaved: this.modelFiltersSaved,
405
+ selectorCloseIds: this.selectorCloseIds,
406
+ updateFiltersSaved: this.updateFiltersSaved,
407
+ onClose: this.closeModalSave,
408
+ }) :
409
+ "",
410
+ ];
411
+ },
412
+ };