aloha-vue 1.2.44 → 1.2.46

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.
@@ -8,6 +8,7 @@ import PageRadioKeyDisabled from "./PageRadioKeyDisabled/PageRadioKeyDisabled.vu
8
8
  import PageRadioSearch from "./PageRadioSearch/PageRadioSearch.vue";
9
9
  import PageRadioTranslateData from "./PageRadioTranslateData/PageRadioTranslateData.vue";
10
10
  import PageRadioTwoColumns from "./PageRadioTwoColumns/PageRadioTwoColumns.vue";
11
+ import PageRadioIsModelArray from "./PageRadioIsModelArray/PageRadioIsModelArray.vue";
11
12
 
12
13
  import PageTitleAPI from "./compositionAPI/PageTitleAPI";
13
14
  import PropsAPI from "./compositionAPI/PropsAPI";
@@ -28,6 +29,7 @@ export default {
28
29
  PageRadioSearch,
29
30
  PageRadioTranslateData,
30
31
  PageRadioTwoColumns,
32
+ PageRadioIsModelArray,
31
33
  },
32
34
  setup() {
33
35
  const {
@@ -22,3 +22,5 @@ aloha-page(
22
22
  page-radio-collapse
23
23
 
24
24
  page-radio-data-extra
25
+
26
+ page-radio-is-model-array
@@ -0,0 +1,91 @@
1
+ import {
2
+ ref,
3
+ } from "vue";
4
+
5
+ import AlohaExample from "../../../../global/components/AlohaExample/AlohaExample.vue";
6
+ import ARadio from "../../../../../../src/ui/ARadio/ARadio";
7
+
8
+ import HtmlAPI from "./compositionAPI/HtmlAPI";
9
+ import JsAPI from "./compositionAPI/JsAPI";
10
+
11
+ export default {
12
+ name: "PageRadioIsModelArray",
13
+ components: {
14
+ AlohaExample,
15
+ ARadio,
16
+ },
17
+ setup() {
18
+ const {
19
+ codeHtml,
20
+ } = HtmlAPI();
21
+
22
+ const {
23
+ codeJs,
24
+ } = JsAPI();
25
+
26
+ const data = [
27
+ {
28
+ label: "Aloha 0",
29
+ id: "aloha_0",
30
+ aloha: "",
31
+ alohaBR: "Köln",
32
+ },
33
+ {
34
+ label: "Aloha 1",
35
+ id: "aloha_1",
36
+ aloha: "Buba",
37
+ alohaBR: "Köln",
38
+ },
39
+ {
40
+ label: "Aloha 2",
41
+ id: "aloha_2",
42
+ aloha: "Buba",
43
+ alohaBR: "Köln",
44
+ },
45
+ {
46
+ label: "Aloha 3",
47
+ id: "aloha_3",
48
+ aloha: "Sandra",
49
+ alohaBR: "Köln",
50
+ },
51
+ {
52
+ label: "Aloha 4",
53
+ id: "aloha_4",
54
+ aloha: "Sandra",
55
+ alohaBR: "Köln",
56
+ },
57
+ {
58
+ label: "Aloha 5",
59
+ id: "aloha_5",
60
+ aloha: "Coco",
61
+ alohaBR: "Düsseldorf",
62
+ },
63
+ {
64
+ label: "Aloha 6",
65
+ id: "aloha_6",
66
+ aloha: "Coco",
67
+ alohaBR: "Düsseldorf",
68
+ },
69
+ {
70
+ label: "Aloha 7",
71
+ id: "aloha_7",
72
+ aloha: "Alex",
73
+ alohaBR: "Düsseldorf",
74
+ },
75
+ {
76
+ label: "Aloha 8",
77
+ id: "aloha_8",
78
+ aloha: "Alex",
79
+ alohaBR: "Düsseldorf",
80
+ },
81
+ ];
82
+ const model = ref(undefined);
83
+
84
+ return {
85
+ codeHtml,
86
+ codeJs,
87
+ data,
88
+ model,
89
+ };
90
+ },
91
+ };
@@ -0,0 +1,20 @@
1
+ aloha-example(
2
+ :code-html="codeHtml"
3
+ :code-js="codeJs"
4
+ header="_A_RADIO_GROUP_IS_MODEL_ARRAY_HEADER_"
5
+ description="_A_RADIO_GROUP_IS_MODEL_ARRAY_DESCRIPTION_"
6
+ props="isModelArray"
7
+ )
8
+ .a_columns.a_columns_count_12
9
+ .a_column.a_column_6.a_columns_count_12_touch
10
+ a-radio(
11
+ v-model="model"
12
+ :data="data"
13
+ key-id="id"
14
+ key-label="label"
15
+ :key-group="['alohaBR', 'aloha']"
16
+ label="Aloha group"
17
+ :is-model-array="true"
18
+ )
19
+ div model: {{ model }}
20
+
@@ -0,0 +1,2 @@
1
+ <template lang="pug" src="./PageRadioIsModelArray.pug"></template>
2
+ <script src="./PageRadioIsModelArray.js"></script>
@@ -0,0 +1,26 @@
1
+ export default function HtmlAPI() {
2
+ const codeHtml = `<a-radio
3
+ v-model="model"
4
+ :data="data"
5
+ key-id="id"
6
+ key-label="label"
7
+ :key-group="['alohaBR', 'aloha']"
8
+ label="Aloha group"
9
+ :search="true"
10
+ ></a-radio>
11
+ <div>model: {{ model }}</div>
12
+ <a-radio
13
+ v-model="model"
14
+ class="a_mt_3"
15
+ :data="data"
16
+ key-id="id"
17
+ key-label="label"
18
+ label="Aloha"
19
+ :search="true"
20
+ ></a-radio>
21
+ <div>model: {{ model }}</div>`;
22
+
23
+ return {
24
+ codeHtml,
25
+ };
26
+ }
@@ -0,0 +1,82 @@
1
+ export default function JsAPI() {
2
+ const codeJs = `import {
3
+ ref,
4
+ } from "vue";
5
+
6
+ import ARadio from "aloha-vue/src/ui/ARadio/ARadio";
7
+
8
+ export default {
9
+ name: "PageRadioSearch",
10
+ components: {
11
+ ARadio,
12
+ },
13
+ setup() {
14
+ const data = [
15
+ {
16
+ label: "Aloha 0",
17
+ id: "aloha_0",
18
+ aloha: "",
19
+ alohaBR: "Köln",
20
+ },
21
+ {
22
+ label: "Aloha 1",
23
+ id: "aloha_1",
24
+ aloha: "Buba",
25
+ alohaBR: "Köln",
26
+ },
27
+ {
28
+ label: "Aloha 2",
29
+ id: "aloha_2",
30
+ aloha: "Buba",
31
+ alohaBR: "Köln",
32
+ },
33
+ {
34
+ label: "Aloha 3",
35
+ id: "aloha_3",
36
+ aloha: "Sandra",
37
+ alohaBR: "Köln",
38
+ },
39
+ {
40
+ label: "Aloha 4",
41
+ id: "aloha_4",
42
+ aloha: "Sandra",
43
+ alohaBR: "Köln",
44
+ },
45
+ {
46
+ label: "Aloha 5",
47
+ id: "aloha_5",
48
+ aloha: "Coco",
49
+ alohaBR: "Düsseldorf",
50
+ },
51
+ {
52
+ label: "Aloha 6",
53
+ id: "aloha_6",
54
+ aloha: "Coco",
55
+ alohaBR: "Düsseldorf",
56
+ },
57
+ {
58
+ label: "Aloha 7",
59
+ id: "aloha_7",
60
+ aloha: "Alex",
61
+ alohaBR: "Düsseldorf",
62
+ },
63
+ {
64
+ label: "Aloha 8",
65
+ id: "aloha_8",
66
+ aloha: "Alex",
67
+ alohaBR: "Düsseldorf",
68
+ },
69
+ ];
70
+ const model = ref(undefined);
71
+
72
+ return {
73
+ data,
74
+ model,
75
+ };
76
+ },
77
+ };`;
78
+
79
+ return {
80
+ codeJs,
81
+ };
82
+ }
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.44",
17
+ "version": "1.2.46",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -398,6 +398,7 @@ export default {
398
398
  onChangeModelValue,
399
399
  } = ChangeAPI(props, {
400
400
  changeModel,
401
+ dataKeyByKeyIdLocal,
401
402
  });
402
403
 
403
404
  const {
@@ -68,7 +68,7 @@ export default {
68
68
  required: true,
69
69
  },
70
70
  modelValue: {
71
- type: [String, Number, Boolean],
71
+ type: [String, Number, Boolean, Array],
72
72
  required: false,
73
73
  },
74
74
  searching: {
@@ -3,12 +3,19 @@ import {
3
3
  toRef,
4
4
  } from "vue";
5
5
 
6
+ import {
7
+ isArray,
8
+ } from "lodash-es";
9
+
6
10
  export default function CheckedAPI(props, {
7
11
  valueLocal = computed(() => undefined),
8
12
  }) {
9
13
  const modelValue = toRef(props, "modelValue");
10
14
 
11
15
  const isChecked = computed(() => {
16
+ if (isArray(modelValue.value)) {
17
+ return modelValue.value.indexOf(valueLocal.value) !== -1;
18
+ }
12
19
  return modelValue.value === valueLocal.value;
13
20
  });
14
21