aloha-vue 1.2.117 → 1.2.119

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.
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "Vue.js"
15
15
  ],
16
16
  "homepage": "https://github.com/ilia-brykin/aloha/#README.md",
17
- "version": "1.2.117",
17
+ "version": "1.2.119",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -214,22 +214,24 @@ export default {
214
214
  filtersKeyById: this.filtersKeyById,
215
215
  filtersVisibleAll: this.filtersVisibleAll,
216
216
  }, {
217
- filtersHorizontal: () => h(AFiltersHorizontal, {
218
- ref: "filtersHorizontalRef",
219
- id: this.id,
220
- canSave: this.canSave,
221
- disabled: this.disabled,
222
- filtersGroup: this.filtersGroup,
223
- filtersKeyById: this.filtersKeyById,
224
- filtersSaved: this.filtersSavedLocal,
225
- filtersVisible: this.filtersVisible,
226
- onUpdateModelFilters: this.onUpdateModelFilters,
227
- unappliedModel: this.unappliedModel,
228
- updateDataKeyByIdFromFilter: this.updateDataKeyByIdFromFilter,
229
- updateFiltersSaved: this.updateFiltersSavedLocal,
230
- onStartSearch: this.startSearch,
231
- onToggleFiltersVisible: this.toggleFiltersVisible,
232
- }, this.$slots),
217
+ filtersHorizontal: () => this.view === "top" ?
218
+ h(AFiltersHorizontal, {
219
+ ref: "filtersHorizontalRef",
220
+ id: this.id,
221
+ canSave: this.canSave,
222
+ disabled: this.disabled,
223
+ filtersGroup: this.filtersGroup,
224
+ filtersKeyById: this.filtersKeyById,
225
+ filtersSaved: this.filtersSavedLocal,
226
+ filtersVisible: this.filtersVisible,
227
+ onUpdateModelFilters: this.onUpdateModelFilters,
228
+ unappliedModel: this.unappliedModel,
229
+ updateDataKeyByIdFromFilter: this.updateDataKeyByIdFromFilter,
230
+ updateFiltersSaved: this.updateFiltersSavedLocal,
231
+ onStartSearch: this.startSearch,
232
+ onToggleFiltersVisible: this.toggleFiltersVisible,
233
+ }, this.$slots) :
234
+ "",
233
235
  ...this.$slots,
234
236
  }),
235
237
  ],
@@ -232,7 +232,6 @@ export default {
232
232
  class: "a_filters_top__save_select",
233
233
  data: this.filtersSavedLocal,
234
234
  deselect: false,
235
- // disabled: !this.filtersSaved.length,
236
235
  keyId: "label",
237
236
  keyLabel: "label",
238
237
  keyGroup: "group",
@@ -279,6 +278,7 @@ export default {
279
278
  change: this.addFiltersVisible,
280
279
  data: this.filtersHidden,
281
280
  hasCaret: false,
281
+ disabled: !this.filtersHidden.length,
282
282
  isLabelFloat: false,
283
283
  keyGroup: "group",
284
284
  keyId: "id",
@@ -4,10 +4,10 @@ import {
4
4
 
5
5
  import ComponentTypesAPI from "./compositionAPI/ComponentTypesAPI";
6
6
  import ContainerAPI from "./compositionAPI/ContainerAPI";
7
- import DataAPI from "./compositionAPI/DataAPI";
8
7
  import FilterSpecificTypeAPI from "./compositionAPI/FilterSpecificTypeAPI";
9
8
  import IdAPI from "./compositionAPI/IdAPI";
10
9
  import ModelAPI from "./compositionAPI/ModelAPI";
10
+ import UpdateDataAPI from "./compositionAPI/UpdateDataAPI";
11
11
 
12
12
  export default {
13
13
  name: "AFiltersHorizontalFilterUi",
@@ -51,7 +51,7 @@ export default {
51
51
 
52
52
  const {
53
53
  emitForComponentsWithData,
54
- } = DataAPI(props);
54
+ } = UpdateDataAPI(props);
55
55
 
56
56
  const {
57
57
  idPrefix,
@@ -3,11 +3,11 @@ import {
3
3
  toRef,
4
4
  } from "vue";
5
5
 
6
- export default function DataAPI(props) {
6
+ export default function UpdateDataAPI(props) {
7
7
  const filter = toRef(props, "filter");
8
8
  const updateDataKeyByIdFromFilter = toRef(props, "updateDataKeyByIdFromFilter");
9
9
 
10
- const typesWithData = ["select", "multiselect", "radio", "checkbox", "group", "fieldset"];
10
+ const TYPES_WITH_DATA = ["select", "multiselect", "radio", "checkbox", "group", "fieldset"];
11
11
 
12
12
  const updateDataLocal = ({ dataKeyByKeyId, item }) => {
13
13
  let filterId = filter.value.id;
@@ -22,7 +22,7 @@ export default function DataAPI(props) {
22
22
 
23
23
  const emitForComponentsWithData = computed(() => {
24
24
  const EMITS = {};
25
- if (typesWithData.indexOf(filter.value.type) !== -1) {
25
+ if (TYPES_WITH_DATA.indexOf(filter.value.type) !== -1) {
26
26
  EMITS.onUpdateData = updateDataLocal;
27
27
  }
28
28
  return EMITS;
@@ -11,18 +11,38 @@ import {
11
11
  export default function FormAPI(props) {
12
12
  const filtersGroup = toRef(props, "filtersGroup");
13
13
  const filtersVisible = toRef(props, "filtersVisible");
14
+ const updateDataKeyByIdFromFilter = toRef(props, "updateDataKeyByIdFromFilter");
15
+
16
+ const LABEL_CLASS = "a_column a_column_12_touch a_column_3_fullhd a_column_3_widescreen a_column_3_desktop";
17
+ const CLASS_COLUMNS = "a_columns a_columns_count_12 a_columns_gab_x_2 a_columns_gab_y_2 a_columns_gab_y_1_touch";
18
+ const CLASS_COLUMN_DEFAULT = "a_filters__form_element a_column a_column_12_touch a_column_9_fullhd a_column_9_widescreen a_column_9_desktop";
19
+ const TYPES_WITH_DATA = ["select", "multiselect", "radio", "checkbox", "group", "fieldset"];
20
+
21
+ const updateDataLocal = ({ dataKeyByKeyId, item, filter }) => {
22
+ let filterId = filter.id;
23
+ if (item) {
24
+ filterId = item.id;
25
+ }
26
+ updateDataKeyByIdFromFilter.value({
27
+ filterId: filterId,
28
+ dataKeyByKeyId,
29
+ });
30
+ };
14
31
 
15
32
  const dataForForm = computed(() => {
16
33
  const DATA = [];
17
34
  forEach(filtersGroup.value.alwaysVisible, filter => {
18
35
  const FILTER = cloneDeep(filter);
19
- FILTER.labelClass = "a_column a_column_12_touch a_column_3_fullhd a_column_3_widescreen a_column_3_desktop";
20
- FILTER.classColumn = "a_filters__form_element a_column a_column_12_touch a_column_9_fullhd a_column_9_widescreen a_column_9_desktop";
36
+ FILTER.labelClass = LABEL_CLASS;
37
+ FILTER.classColumn = CLASS_COLUMN_DEFAULT;
38
+ if (TYPES_WITH_DATA.indexOf(filter.type) !== -1) {
39
+ FILTER.onUpdateData = ({ dataKeyByKeyId, item }) => updateDataLocal({ dataKeyByKeyId, item, filter });
40
+ }
21
41
 
22
42
  DATA.push({
23
43
  type: "group",
24
44
  id: `group_${ filter.id }`,
25
- classColumns: "a_columns a_columns_count_12 a_columns_gab_x_2 a_columns_gab_y_2 a_columns_gab_y_1_touch",
45
+ classColumns: CLASS_COLUMNS,
26
46
  children: [
27
47
  FILTER
28
48
  ],
@@ -31,15 +51,18 @@ export default function FormAPI(props) {
31
51
 
32
52
  forEach(filtersVisible.value, filter => {
33
53
  const FILTER = cloneDeep(filter);
34
- FILTER.labelClass = "a_column a_column_12_touch a_column_3_fullhd a_column_3_widescreen a_column_3_desktop";
35
- FILTER.classColumn = "a_filters__form_element a_column a_column_12_touch a_column_9_fullhd a_column_9_widescreen a_column_9_desktop a_d_flex a_align_items_center";
54
+ FILTER.labelClass = LABEL_CLASS;
55
+ FILTER.classColumn = `${ CLASS_COLUMN_DEFAULT } a_d_flex a_align_items_center`;
36
56
  FILTER.slotAppend = "groupAppend";
37
57
  FILTER.class = "a_width_100";
58
+ if (TYPES_WITH_DATA.indexOf(filter.type) !== -1) {
59
+ FILTER.onUpdateData = ({ dataKeyByKeyId, item }) => updateDataLocal({ dataKeyByKeyId, item, filter });
60
+ }
38
61
 
39
62
  DATA.push({
40
63
  type: "group",
41
64
  id: `group_${ filter.id }`,
42
- classColumns: "a_columns a_columns_count_12 a_columns_gab_x_2 a_columns_gab_y_2 a_columns_gab_y_1_touch",
65
+ classColumns: CLASS_COLUMNS,
43
66
  children: [
44
67
  FILTER
45
68
  ],
@@ -533,7 +533,7 @@ export default {
533
533
  deep: true,
534
534
  });
535
535
 
536
- addPopperContainerInBody({ className: "a_select_container " });
536
+ addPopperContainerInBody({ className: "a_select_container" });
537
537
  loadDataFromServer();
538
538
  loadDataFromServerForSearchAPI();
539
539