aloha-vue 1.0.151 → 1.0.153

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.
@@ -36,6 +36,7 @@ div
36
36
  :is-select-all="true"
37
37
  :is-deselect-all="true"
38
38
  slot-name="test"
39
+ :max-count-multiselect="2"
39
40
  )
40
41
  template(
41
42
  v-slot:test="{ label, labelFiltered }"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
3
  "description": "Project aloha",
4
- "version": "1.0.151",
4
+ "version": "1.0.153",
5
5
  "author": "Ilia Brykin",
6
6
  "scripts": {
7
7
  "build-icons": "node scriptsNode/iconsSvgToJs.js bootstrap3 && node scriptsNode/iconsSvgToJs.js bootstrap-1-9-1"
@@ -34,7 +34,7 @@
34
34
  --a_select_menu_link_focus_color: var(--a_color_focus);
35
35
 
36
36
  width: var(--a_dropdown_width);
37
- z-index: 1000;
37
+ z-index: 1056;
38
38
  min-width: var(--a_dropdown_min_width);
39
39
  padding: var(--a_dropdown_padding_y) var(--a_dropdown_padding_x);
40
40
  margin: 0;
@@ -114,6 +114,12 @@ export default {
114
114
  type: Boolean,
115
115
  required: false,
116
116
  },
117
+ maxCountMultiselect: {
118
+ type: Number,
119
+ required: false,
120
+ default: undefined,
121
+ validator: value => value > 0,
122
+ },
117
123
  modelValue: {
118
124
  type: [String, Number, Array],
119
125
  required: false,
@@ -6,7 +6,9 @@ import {
6
6
  import AKeysCode from "../../../const/AKeysCode";
7
7
  import AKeyId from "../../const/AKeyId";
8
8
  import {
9
- cloneDeep, isUndefined,
9
+ cloneDeep,
10
+ get,
11
+ isUndefined,
10
12
  } from "lodash-es";
11
13
 
12
14
  export default function ASelectModelChangeAPI(props, {
@@ -17,15 +19,24 @@ export default function ASelectModelChangeAPI(props, {
17
19
  dataKeyByKeyIdLocal = computed(() => ({})),
18
20
  }) {
19
21
  const isCloseByClick = toRef(props, "isCloseByClick");
22
+ const isDeselect = toRef(props, "isDeselect");
23
+ const maxCountMultiselect = toRef(props, "maxCountMultiselect");
24
+ const modelValue = toRef(props, "modelValue");
25
+
26
+ const isMaxSelected = computed(() => {
27
+ if (!isMultiselect.value || !maxCountMultiselect.value) {
28
+ return false;
29
+ }
30
+ const MODEL_LENGTH = get(modelValue.value, "length");
31
+ return MODEL_LENGTH >= maxCountMultiselect.value;
32
+ });
33
+
20
34
  const isCloseByClickLocal = computed(() => {
21
35
  if (!isUndefined(isCloseByClick.value)) {
22
36
  return isCloseByClick.value;
23
37
  }
24
38
  return !isMultiselect.value;
25
39
  });
26
- const isDeselect = toRef(props, "isDeselect");
27
-
28
- const modelValue = toRef(props, "modelValue");
29
40
 
30
41
  const onChangeModelValue = ({ currentValue, $event, isSelected }) => {
31
42
  let modelValueLocal;
@@ -35,6 +46,9 @@ export default function ASelectModelChangeAPI(props, {
35
46
  const INDEX = modelValueLocal.indexOf(currentValue);
36
47
  modelValueLocal.splice(INDEX, 1);
37
48
  } else {
49
+ if (isMaxSelected.value) {
50
+ return;
51
+ }
38
52
  modelValueLocal.push(currentValue);
39
53
  }
40
54
  } else {