@iankibetsh/shframework 3.0.2 → 3.0.4
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/library.js +14 -13
- package/dist/library.mjs +14 -13
- package/package.json +1 -1
package/dist/library.js
CHANGED
|
@@ -2031,7 +2031,7 @@ const _hoisted_10$5 = {
|
|
|
2031
2031
|
|
|
2032
2032
|
var script$t = {
|
|
2033
2033
|
__name: 'ShSuggest',
|
|
2034
|
-
props: ['
|
|
2034
|
+
props: ['data','url','modelValue'],
|
|
2035
2035
|
emits: ['update:modelValue'],
|
|
2036
2036
|
setup(__props, { emit }) {
|
|
2037
2037
|
|
|
@@ -2048,13 +2048,14 @@ vue.onMounted(() => {
|
|
|
2048
2048
|
resetData();
|
|
2049
2049
|
});
|
|
2050
2050
|
function resetData(){
|
|
2051
|
-
|
|
2052
|
-
|
|
2051
|
+
const data = props.data;
|
|
2052
|
+
if(data) {
|
|
2053
|
+
suggestions.value = data;
|
|
2053
2054
|
}
|
|
2054
2055
|
}
|
|
2055
2056
|
function addSuggestion(sgn){
|
|
2056
2057
|
let selected = selectedSuggestions.value;
|
|
2057
|
-
if(selected.length > 0 && !props.
|
|
2058
|
+
if(selected.length > 0 && !props.allowMultiple){
|
|
2058
2059
|
selected = [];
|
|
2059
2060
|
}
|
|
2060
2061
|
if(!selected.includes(sgn)){
|
|
@@ -2068,7 +2069,7 @@ function updateModelValue(){
|
|
|
2068
2069
|
let selectedItems = selectedSuggestions.value;
|
|
2069
2070
|
if(selectedItems.length === 0) {
|
|
2070
2071
|
emit('update:modelValue', null);
|
|
2071
|
-
} else if (!props.
|
|
2072
|
+
} else if (!props.allowMultiple) {
|
|
2072
2073
|
emit('update:modelValue', selectedItems[0].id);
|
|
2073
2074
|
} else {
|
|
2074
2075
|
const ids = selectedItems.map(item => {
|
|
@@ -2093,18 +2094,18 @@ function filterData(e){
|
|
|
2093
2094
|
}
|
|
2094
2095
|
let filterValue = e.target.innerText;
|
|
2095
2096
|
searchText.value = filterValue;
|
|
2096
|
-
if(props.
|
|
2097
|
-
suggestions.value = props.
|
|
2097
|
+
if(props.data) {
|
|
2098
|
+
suggestions.value = props.data.filter(item=>{
|
|
2098
2099
|
if(item.name.toLowerCase().includes(filterValue.toLowerCase())){
|
|
2099
2100
|
return item
|
|
2100
2101
|
}
|
|
2101
2102
|
});
|
|
2102
|
-
} else {
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2103
|
+
} else if (props.url) {
|
|
2104
|
+
shApis.doGet(props.url, { all: 1,filter_value: filterValue }).then(res => {
|
|
2105
|
+
suggestions.value = res.data.data ?? res.data;
|
|
2106
|
+
}).catch(res => {
|
|
2107
|
+
console.log(res);
|
|
2108
|
+
});
|
|
2108
2109
|
}
|
|
2109
2110
|
}
|
|
2110
2111
|
|
package/dist/library.mjs
CHANGED
|
@@ -2019,7 +2019,7 @@ const _hoisted_10$5 = {
|
|
|
2019
2019
|
|
|
2020
2020
|
var script$t = {
|
|
2021
2021
|
__name: 'ShSuggest',
|
|
2022
|
-
props: ['
|
|
2022
|
+
props: ['data','url','modelValue'],
|
|
2023
2023
|
emits: ['update:modelValue'],
|
|
2024
2024
|
setup(__props, { emit }) {
|
|
2025
2025
|
|
|
@@ -2036,13 +2036,14 @@ onMounted(() => {
|
|
|
2036
2036
|
resetData();
|
|
2037
2037
|
});
|
|
2038
2038
|
function resetData(){
|
|
2039
|
-
|
|
2040
|
-
|
|
2039
|
+
const data = props.data;
|
|
2040
|
+
if(data) {
|
|
2041
|
+
suggestions.value = data;
|
|
2041
2042
|
}
|
|
2042
2043
|
}
|
|
2043
2044
|
function addSuggestion(sgn){
|
|
2044
2045
|
let selected = selectedSuggestions.value;
|
|
2045
|
-
if(selected.length > 0 && !props.
|
|
2046
|
+
if(selected.length > 0 && !props.allowMultiple){
|
|
2046
2047
|
selected = [];
|
|
2047
2048
|
}
|
|
2048
2049
|
if(!selected.includes(sgn)){
|
|
@@ -2056,7 +2057,7 @@ function updateModelValue(){
|
|
|
2056
2057
|
let selectedItems = selectedSuggestions.value;
|
|
2057
2058
|
if(selectedItems.length === 0) {
|
|
2058
2059
|
emit('update:modelValue', null);
|
|
2059
|
-
} else if (!props.
|
|
2060
|
+
} else if (!props.allowMultiple) {
|
|
2060
2061
|
emit('update:modelValue', selectedItems[0].id);
|
|
2061
2062
|
} else {
|
|
2062
2063
|
const ids = selectedItems.map(item => {
|
|
@@ -2081,18 +2082,18 @@ function filterData(e){
|
|
|
2081
2082
|
}
|
|
2082
2083
|
let filterValue = e.target.innerText;
|
|
2083
2084
|
searchText.value = filterValue;
|
|
2084
|
-
if(props.
|
|
2085
|
-
suggestions.value = props.
|
|
2085
|
+
if(props.data) {
|
|
2086
|
+
suggestions.value = props.data.filter(item=>{
|
|
2086
2087
|
if(item.name.toLowerCase().includes(filterValue.toLowerCase())){
|
|
2087
2088
|
return item
|
|
2088
2089
|
}
|
|
2089
2090
|
});
|
|
2090
|
-
} else {
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2091
|
+
} else if (props.url) {
|
|
2092
|
+
shApis.doGet(props.url, { all: 1,filter_value: filterValue }).then(res => {
|
|
2093
|
+
suggestions.value = res.data.data ?? res.data;
|
|
2094
|
+
}).catch(res => {
|
|
2095
|
+
console.log(res);
|
|
2096
|
+
});
|
|
2096
2097
|
}
|
|
2097
2098
|
}
|
|
2098
2099
|
|