hsy-vue-dropdown
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -646,5 +646,5 @@ module.exports = | ||
const EMPTY_FN = () => {}; | ||
var EMPTY_FN = function EMPTY_FN() {}; | ||
let idx = 0; | ||
var idx = 0; | ||
@@ -654,3 +654,3 @@ exports.default = { | ||
data() { | ||
data: function data() { | ||
return { | ||
@@ -662,6 +662,9 @@ selected: [], | ||
}, | ||
props: { | ||
data: { | ||
type: Array, | ||
default: () => [] | ||
default: function _default() { | ||
return []; | ||
} | ||
}, | ||
@@ -702,4 +705,4 @@ grouped: { | ||
computed: { | ||
cls() { | ||
let c = { | ||
cls: function cls() { | ||
var c = { | ||
grouped: this.grouped, | ||
@@ -710,5 +713,9 @@ multiple: this.multiple | ||
}, | ||
selectedText() { | ||
let text = ''; | ||
let fn = selected => selected.map(e => e.label).join(', '); | ||
selectedText: function selectedText() { | ||
var text = ''; | ||
var fn = function fn(selected) { | ||
return selected.map(function (e) { | ||
return e.label; | ||
}).join(', '); | ||
}; | ||
if (this.cbCustomSelectedText !== EMPTY_FN) { | ||
@@ -725,5 +732,7 @@ text = this.cbCustomSelectedText(this.selected, fn); | ||
immediate: true, | ||
handler(val) { | ||
handler: function handler(val) { | ||
console.log(1); | ||
this.selected = this.data.filter(d => d.selected); | ||
this.selected = this.data.filter(function (d) { | ||
return d.selected; | ||
}); | ||
this.items = this.data.slice(0); | ||
@@ -734,6 +743,6 @@ } | ||
methods: { | ||
id(item) { | ||
id: function id(item) { | ||
return 'hsy-dropdown-item-' + item._idx; | ||
}, | ||
appendIdx(item) { | ||
appendIdx: function appendIdx(item) { | ||
if (item._idx === undefined) { | ||
@@ -743,9 +752,9 @@ item._idx = ++idx; | ||
}, | ||
autoShow() { | ||
autoShow: function autoShow() { | ||
this.isShow = !this.isShow; | ||
}, | ||
setupTitleIfNeeded() { | ||
setupTitleIfNeeded: function setupTitleIfNeeded() { | ||
if (!this.fixListWidth) return; | ||
}, | ||
autoHide(evt) { | ||
autoHide: function autoHide(evt) { | ||
if (!this.$el.contains(evt.target)) { | ||
@@ -755,8 +764,10 @@ this.isShow = false; | ||
}, | ||
findSelected() { | ||
findSelected: function findSelected() { | ||
if (this.multiple) { | ||
return this.data.filter(d => d.selected === true); | ||
return this.data.filter(function (d) { | ||
return d.selected === true; | ||
}); | ||
} | ||
let ret = null; | ||
this.data.every(d => { | ||
var ret = null; | ||
this.data.every(function (d) { | ||
if (d.selected) { | ||
@@ -770,6 +781,10 @@ ret = d; | ||
}, | ||
itemClicked(item) { | ||
itemClicked: function itemClicked(item) { | ||
var _this = this; | ||
if (!this.multiple) { | ||
if (this.selected.indexOf(item) === -1) { | ||
this.findSelected().forEach(d => d.selected = false); | ||
this.findSelected().forEach(function (d) { | ||
return d.selected = false; | ||
}); | ||
item.selected = true; | ||
@@ -783,8 +798,8 @@ this.selected.pop(); | ||
} | ||
this.$nextTick(() => { | ||
this.isShow = false; | ||
this.$nextTick(function () { | ||
_this.isShow = false; | ||
}); | ||
} | ||
}, | ||
checkboxChanged(item) { | ||
checkboxChanged: function checkboxChanged(item) { | ||
if (this.selected === null) { | ||
@@ -794,7 +809,9 @@ this.selected = []; | ||
let id = this.id(item); | ||
var id = this.id(item); | ||
item.selected = document.querySelector('#' + id).checked; | ||
if (!item.selected) { | ||
this.selected = this.selected.filter(d => d !== item); | ||
this.selected = this.selected.filter(function (d) { | ||
return d !== item; | ||
}); | ||
} else { | ||
@@ -812,10 +829,10 @@ this.selected.push(item); | ||
}, | ||
updated() { | ||
updated: function updated() { | ||
this.setupTitleIfNeeded(); | ||
}, | ||
mounted() { | ||
mounted: function mounted() { | ||
this.setupTitleIfNeeded(); | ||
document.addEventListener('click', this.autoHide, false); | ||
}, | ||
destroyed() { | ||
destroyed: function destroyed() { | ||
document.removeEventListener('click', this.autoHide, false); | ||
@@ -842,3 +859,3 @@ } | ||
const install = Vue => { | ||
var install = function install(Vue) { | ||
Vue.component(_Dropdown2.default.name, _Dropdown2.default); | ||
@@ -849,3 +866,3 @@ }; | ||
version: '0.0.1', | ||
install | ||
install: install | ||
}; | ||
@@ -852,0 +869,0 @@ |
{ | ||
"name": "hsy-vue-dropdown", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "vue dropdown component.", | ||
@@ -12,5 +12,2 @@ "author": "hsiaosiyuan0 <hsiaosiyuan0@outlook.com>", | ||
}, | ||
"dependencies": { | ||
"vue": "^2.1.10" | ||
}, | ||
"devDependencies": { | ||
@@ -21,2 +18,3 @@ "babel-core": "^6.21.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.18.0", | ||
"babel-preset-es2015": "^6.22.0", | ||
"babel-preset-es2017": "^6.16.0", | ||
@@ -32,2 +30,3 @@ "cross-env": "^3.1.4", | ||
"url-loader": "^0.5.7", | ||
"vue": "^2.1.10", | ||
"vue-loader": "^10.3.0", | ||
@@ -34,0 +33,0 @@ "vue-style-loader": "^2.0.0", |
Sorry, the diff of this file is not supported yet
46885
0
931
21
- Removedvue@^2.1.10
- Removed@babel/helper-string-parser@7.25.9(transitive)
- Removed@babel/helper-validator-identifier@7.25.9(transitive)
- Removed@babel/parser@7.26.2(transitive)
- Removed@babel/types@7.26.0(transitive)
- Removed@vue/compiler-sfc@2.7.16(transitive)
- Removedcsstype@3.1.3(transitive)
- Removednanoid@3.3.7(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedpostcss@8.4.49(transitive)
- Removedprettier@2.8.8(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedsource-map-js@1.2.1(transitive)
- Removedvue@2.7.16(transitive)