comand-component-library 4.1.95 → 4.1.97
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/dist/comand-component-library.js +985 -953
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/ComponentLibrary.vue +2 -0
- package/src/assets/data/smart-search.json +6 -6
- package/src/componentSettingsDataAndControls.vue +9 -1
- package/src/components/CmdInnerLink.vue +1 -1
- package/src/components/CmdLink.vue +5 -1
- package/src/components/CmdListOfLinksItem.vue +3 -3
- package/src/components/CmdSmartSearch.vue +35 -19
- package/src/components/CmdTabs.vue +4 -4
- package/src/index.js +1 -0
- package/src/utils/string.js +1 -1
@@ -1,20 +1,20 @@
|
|
1
1
|
<template>
|
2
|
-
<div class="cmd-smart-search">
|
2
|
+
<div :class="['cmd-smart-search', {open: showListOfRecommendations}]">
|
3
3
|
<!-- begin CmdFormElement -->
|
4
4
|
<CmdFormElement
|
5
5
|
element="input"
|
6
6
|
type="search"
|
7
7
|
v-bind="cmdFormElementOptions"
|
8
8
|
v-model="searchTerm"
|
9
|
-
@
|
9
|
+
@update:modelValue="showRecommendations"
|
10
10
|
/>
|
11
11
|
<!-- end CmdFormElement -->
|
12
12
|
|
13
13
|
<!-- begin list-of-recommendations -->
|
14
|
-
<ul v-if="
|
14
|
+
<ul v-if="showListOfRecommendations" class="list-of-recommendations no-list-items">
|
15
15
|
<li v-for="(item, index) in listOfRecommendations" :key="index">
|
16
16
|
<!-- begin CmdLink -->
|
17
|
-
<CmdLink v-bind="item" @click="optionSelected" />
|
17
|
+
<CmdLink v-bind="linkItem(item)" @click="optionSelected(item)" />
|
18
18
|
<!-- end CmdLink -->
|
19
19
|
</li>
|
20
20
|
</ul>
|
@@ -27,8 +27,9 @@ export default {
|
|
27
27
|
name: "CmdSmartSearch",
|
28
28
|
data() {
|
29
29
|
return {
|
30
|
-
|
31
|
-
searchTerm: ""
|
30
|
+
showListOfRecommendations: false,
|
31
|
+
searchTerm: "",
|
32
|
+
item: {}
|
32
33
|
}
|
33
34
|
},
|
34
35
|
props: {
|
@@ -36,8 +37,8 @@ export default {
|
|
36
37
|
* set default v-model (must be named modelValue in Vue3)
|
37
38
|
*/
|
38
39
|
modelValue: {
|
39
|
-
type:
|
40
|
-
|
40
|
+
type: Object,
|
41
|
+
required: false
|
41
42
|
},
|
42
43
|
/**
|
43
44
|
* provide list for recommendations shown below search-field
|
@@ -66,22 +67,26 @@ export default {
|
|
66
67
|
},
|
67
68
|
methods: {
|
68
69
|
showRecommendations() {
|
69
|
-
this.
|
70
|
+
this.item = {} // reset item
|
71
|
+
this.$emit("update:modelValue", {itemId: "", displayValue: ""})
|
72
|
+
this.showListOfRecommendations = true
|
70
73
|
},
|
71
|
-
optionSelected(
|
72
|
-
|
73
|
-
this.
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
optionSelected(item) {
|
75
|
+
this.searchTerm = item.displayValue // set search-field to selected option
|
76
|
+
this.showListOfRecommendations = false
|
77
|
+
this.$emit("update:modelValue", {itemId: item.id, displayValue: item.displayValue})
|
78
|
+
},
|
79
|
+
linkItem(item) {
|
80
|
+
return {
|
81
|
+
...item,
|
82
|
+
text: item.displayValue
|
83
|
+
}
|
77
84
|
}
|
78
85
|
},
|
79
86
|
watch: {
|
80
87
|
searchTerm() {
|
81
|
-
if(this.searchTerm.length) {
|
82
|
-
this.
|
83
|
-
} else {
|
84
|
-
this.showListOfRecommmendations = false
|
88
|
+
if(!this.searchTerm.length) {
|
89
|
+
this.showListOfRecommendations = false
|
85
90
|
}
|
86
91
|
}
|
87
92
|
}
|
@@ -90,7 +95,17 @@ export default {
|
|
90
95
|
|
91
96
|
<style>
|
92
97
|
.cmd-smart-search {
|
98
|
+
&.open {
|
99
|
+
input {
|
100
|
+
border-bottom-left-radius: 0;
|
101
|
+
border-bottom-right-radius: 0;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
93
105
|
.list-of-recommendations {
|
106
|
+
position: absolute;
|
107
|
+
width: 100%;
|
108
|
+
z-index: 10;
|
94
109
|
display: flex;
|
95
110
|
flex-direction: column;
|
96
111
|
border: var(--default-border);
|
@@ -120,6 +135,7 @@ export default {
|
|
120
135
|
padding: var(--default-padding);
|
121
136
|
text-decoration: none;
|
122
137
|
width: 100%;
|
138
|
+
background: var(--default-background);
|
123
139
|
|
124
140
|
&:hover, &:active, &:focus {
|
125
141
|
background: var(--hyperlink-color);
|
@@ -55,7 +55,7 @@ export default {
|
|
55
55
|
name: "CmdTabs",
|
56
56
|
data() {
|
57
57
|
return {
|
58
|
-
showTab: this.
|
58
|
+
showTab: this.defaultActiveTab
|
59
59
|
}
|
60
60
|
},
|
61
61
|
emits: ["active-tab"],
|
@@ -91,7 +91,7 @@ export default {
|
|
91
91
|
/**
|
92
92
|
* set default active/shown tab
|
93
93
|
*/
|
94
|
-
|
94
|
+
defaultActiveTab: {
|
95
95
|
type: Number,
|
96
96
|
default: 0
|
97
97
|
},
|
@@ -110,8 +110,8 @@ export default {
|
|
110
110
|
}
|
111
111
|
},
|
112
112
|
watch: {
|
113
|
-
|
114
|
-
this.showTab = this.
|
113
|
+
defaultActiveTab() {
|
114
|
+
this.showTab = this.defaultActiveTab
|
115
115
|
}
|
116
116
|
}
|
117
117
|
}
|
package/src/index.js
CHANGED
@@ -40,6 +40,7 @@ export { default as CmdSiteHeader } from '@/components/CmdSiteHeader.vue'
|
|
40
40
|
export { default as CmdSiteSearch } from '@/components/CmdSiteSearch.vue'
|
41
41
|
export { default as CmdSlideButton } from '@/components/CmdSlideButton.vue'
|
42
42
|
export { default as CmdSlideshow } from '@/components/CmdSlideshow.vue'
|
43
|
+
export { default as CmdSmartSearch } from '@/components/CmdSmartSearch.vue'
|
43
44
|
export { default as CmdSocialNetworks } from '@/components/CmdSocialNetworks.vue'
|
44
45
|
export { default as CmdSwitchLanguage } from '@/components/CmdSwitchLanguage.vue'
|
45
46
|
export { default as CmdSystemMessage } from '@/components/CmdSystemMessage.vue'
|