vue-lazy-cascader 0.1.17 → 0.2.0
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/README.md +12 -2
- package/dist/lib/vue-lazy-cascader.common.js +23 -11
- package/dist/lib/vue-lazy-cascader.common.js.map +1 -1
- package/dist/lib/vue-lazy-cascader.umd.js +23 -11
- package/dist/lib/vue-lazy-cascader.umd.js.map +1 -1
- package/dist/lib/vue-lazy-cascader.umd.min.js +1 -1
- package/dist/lib/vue-lazy-cascader.umd.min.js.map +1 -1
- package/package.json +73 -72
package/README.md
CHANGED
|
@@ -24,15 +24,25 @@ yarn add vue-lazy-cascader
|
|
|
24
24
|
pnpm install vue-lazy-cascader --save
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
## Changelog
|
|
28
|
+
[更新日志](./CHANGELOG.md)
|
|
29
|
+
|
|
27
30
|
## Usage
|
|
28
31
|
|
|
29
|
-
-
|
|
32
|
+
- es模块示例
|
|
33
|
+
- [代码](./src/components/VueLazyCascaderExample.vue)
|
|
34
|
+
|
|
35
|
+
- [demo](https://jyj1202.github.io/vue-lazy-cascader/)
|
|
30
36
|
|
|
31
37
|
```javascript
|
|
32
38
|
import VueLazyCascader from "vue-lazy-cascader";
|
|
33
39
|
```
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
|
|
42
|
+
- 直接script引入示例
|
|
43
|
+
- [代码](./public/vue-lazy-cascader.html)
|
|
44
|
+
|
|
45
|
+
- [demo](https://jyj1202.github.io/vue-lazy-cascader/vue-lazy-cascader.html)
|
|
36
46
|
|
|
37
47
|
## Tip
|
|
38
48
|
- 由于该组件并未打包element-ui相关组件,所以使用时,必须已经安装element-ui。
|
|
@@ -1606,19 +1606,19 @@ if (typeof window !== 'undefined') {
|
|
|
1606
1606
|
// Indicate to webpack that this file can be concatenated
|
|
1607
1607
|
/* harmony default export */ var setPublicPath = (null);
|
|
1608
1608
|
|
|
1609
|
-
;// CONCATENATED MODULE: ./node_modules/.pnpm/vue-loader@15.11.1_css-loader@6.11.0_vue-template-compiler@2.6.14_webpack@5.91.0/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/.pnpm/vue-loader@15.11.1_css-loader@6.11.0_vue-template-compiler@2.6.14_webpack@5.91.0/node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/cascader/src/cascader.vue?vue&type=template&id=
|
|
1609
|
+
;// CONCATENATED MODULE: ./node_modules/.pnpm/vue-loader@15.11.1_css-loader@6.11.0_vue-template-compiler@2.6.14_webpack@5.91.0/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/.pnpm/vue-loader@15.11.1_css-loader@6.11.0_vue-template-compiler@2.6.14_webpack@5.91.0/node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/cascader/src/cascader.vue?vue&type=template&id=73016d71
|
|
1610
1610
|
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:(function () { return _vm.toggleDropDownVisible(false); }),expression:"() => toggleDropDownVisible(false)"}],ref:"reference",class:[
|
|
1611
1611
|
'el-cascader',
|
|
1612
1612
|
_vm.realSize && ("el-cascader--" + _vm.realSize),
|
|
1613
1613
|
{ 'is-disabled': _vm.isDisabled }
|
|
1614
|
-
],on:{"mouseenter":function($event){_vm.inputHover = true},"mouseleave":function($event){_vm.inputHover = false},"click":function () { return _vm.toggleDropDownVisible(_vm.readonly ? undefined : true); },"keydown":_vm.handleKeyDown}},[_c('el-input',{ref:"input",class:{ 'is-focus': _vm.dropDownVisible },attrs:{"size":_vm.realSize,"placeholder":_vm.placeholder,"readonly":_vm.readonly,"disabled":_vm.isDisabled,"validate-event":false},on:{"focus":_vm.handleFocus,"blur":_vm.handleBlur,"input":_vm.handleInput},model:{value:(_vm.multiple ? _vm.presentText : _vm.inputValue),callback:function ($$v) {_vm.multiple ? _vm.presentText : _vm.inputValue=$$v},expression:"multiple ? presentText : inputValue"}},[_c('template',{slot:"suffix"},[(_vm.clearBtnVisible)?_c('i',{key:"clear",staticClass:"el-input__icon el-icon-circle-close",on:{"click":function($event){$event.stopPropagation();return _vm.handleClear.apply(null, arguments)}}}):_c('i',{key:"arrow-down",class:[
|
|
1614
|
+
],on:{"mouseenter":function($event){_vm.inputHover = true},"mouseleave":function($event){_vm.inputHover = false},"click":function () { return _vm.toggleDropDownVisible(_vm.readonly ? undefined : true); },"keydown":_vm.handleKeyDown}},[_c('el-input',{ref:"input",class:{ 'is-focus': _vm.dropDownVisible },attrs:{"size":_vm.realSize,"placeholder":_vm.presentTags.length ? '' : _vm.placeholder,"readonly":_vm.readonly,"disabled":_vm.isDisabled,"validate-event":false},on:{"focus":_vm.handleFocus,"blur":_vm.handleBlur,"input":_vm.handleInput},model:{value:(_vm.multiple ? _vm.presentText : _vm.inputValue),callback:function ($$v) {_vm.multiple ? _vm.presentText : _vm.inputValue=$$v},expression:"multiple ? presentText : inputValue"}},[_c('template',{slot:"suffix"},[(_vm.clearBtnVisible)?_c('i',{key:"clear",staticClass:"el-input__icon el-icon-circle-close",on:{"click":function($event){$event.stopPropagation();return _vm.handleClear.apply(null, arguments)}}}):_c('i',{key:"arrow-down",class:[
|
|
1615
1615
|
'el-input__icon',
|
|
1616
1616
|
'el-icon-arrow-down',
|
|
1617
1617
|
_vm.dropDownVisible && 'is-reverse'
|
|
1618
|
-
],on:{"click":function($event){$event.stopPropagation();return _vm.toggleDropDownVisible()}}})])],2),(_vm.multiple)?_c('div',{staticClass:"el-cascader__tags"},[_vm._l((_vm.presentTags),function(tag){return _c('el-tag',{key:tag.key,attrs:{"type":"info","size":_vm.tagSize,"hit":tag.hitState,"closable":tag.closable,"disable-transitions":""},on:{"close":function($event){return _vm.deleteTag(tag)}}},[_c('span',[_vm._v(_vm._s(tag.text))])])}),(_vm.filterable && !_vm.isDisabled)?_c('input',{directives:[{name:"model",rawName:"v-model.trim",value:(_vm.inputValue),expression:"inputValue",modifiers:{"trim":true}}],staticClass:"el-cascader__search-input",attrs:{"type":"text","placeholder":_vm.presentTags.length ? '' : _vm.placeholder},domProps:{"value":(_vm.inputValue)},on:{"input":[function($event){if($event.target.composing){ return; }_vm.inputValue=$event.target.value.trim()},function (e) { return _vm.handleInput(_vm.inputValue, e); }],"click":function($event){$event.stopPropagation();return _vm.toggleDropDownVisible(true)},"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"delete",[8,46],$event.key,["Backspace","Delete","Del"])){ return null; }return _vm.handleDelete.apply(null, arguments)},"blur":function($event){return _vm.$forceUpdate()}}}):_vm._e()],2):_vm._e(),_c('transition',{attrs:{"name":"el-zoom-in-top"},on:{"after-leave":_vm.handleDropdownLeave}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.dropDownVisible),expression:"dropDownVisible"}],ref:"popper",class:['el-popper', 'el-cascader__dropdown', _vm.popperClass]},[_c('cascader-panel',{directives:[{name:"show",rawName:"v-show",value:(!_vm.filtering),expression:"!filtering"}],ref:"panel",attrs:{"options":_vm.options,"props":_vm.config,"border":false,"render-label":_vm.$scopedSlots.default},on:{"expand-change":_vm.handleExpandChange,"close":function($event){return _vm.toggleDropDownVisible(false)},"menu-scroll-bottom":function (parentNode, resolve) { return _vm.$emit('menu-scroll-bottom', parentNode, resolve); }},model:{value:(_vm.checkedValue),callback:function ($$v) {_vm.checkedValue=$$v},expression:"checkedValue"}}),(_vm.filterable)?_c('el-scrollbar',{directives:[{name:"show",rawName:"v-show",value:(_vm.filtering),expression:"filtering"}],ref:"suggestionPanel",staticClass:"el-cascader__suggestion-panel",attrs:{"tag":"ul","view-class":"el-cascader__suggestion-list"},nativeOn:{"keydown":function($event){return _vm.handleSuggestionKeyDown.apply(null, arguments)}}},[(_vm.suggestions.length)?_vm._l((_vm.suggestions),function(item,index){return _c('li',{key:item.uid,class:[
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1618
|
+
],on:{"click":function($event){$event.stopPropagation();return _vm.toggleDropDownVisible()}}})])],2),(_vm.multiple)?_c('div',{staticClass:"el-cascader__tags"},[_vm._l((_vm.presentTags),function(tag){return _c('el-tag',{key:tag.key,attrs:{"type":"info","size":_vm.tagSize,"hit":tag.hitState,"closable":tag.closable,"disable-transitions":""},on:{"close":function($event){return _vm.deleteTag(tag)}}},[_c('span',[_vm._v(_vm._s(tag.text))])])}),(_vm.filterable && !_vm.isDisabled)?_c('input',{directives:[{name:"model",rawName:"v-model.trim",value:(_vm.inputValue),expression:"inputValue",modifiers:{"trim":true}}],staticClass:"el-cascader__search-input",attrs:{"type":"text","placeholder":_vm.presentTags.length ? '' : _vm.placeholder},domProps:{"value":(_vm.inputValue)},on:{"input":[function($event){if($event.target.composing){ return; }_vm.inputValue=$event.target.value.trim()},function (e) { return _vm.handleInput(_vm.inputValue, e); }],"click":function($event){$event.stopPropagation();return _vm.toggleDropDownVisible(true)},"keydown":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"delete",[8,46],$event.key,["Backspace","Delete","Del"])){ return null; }return _vm.handleDelete.apply(null, arguments)},"blur":function($event){return _vm.$forceUpdate()}}}):_vm._e()],2):_vm._e(),_c('transition',{attrs:{"name":"el-zoom-in-top"},on:{"after-leave":_vm.handleDropdownLeave}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.dropDownVisible),expression:"dropDownVisible"}],ref:"popper",class:['el-popper', 'el-cascader__dropdown', _vm.popperClass]},[_c('cascader-panel',{directives:[{name:"show",rawName:"v-show",value:(!_vm.filtering),expression:"!filtering"}],ref:"panel",attrs:{"options":_vm.options,"props":_vm.config,"border":false,"render-label":_vm.$scopedSlots.default},on:{"expand-change":_vm.handleExpandChange,"close":function($event){return _vm.toggleDropDownVisible(false)},"menu-scroll-bottom":function (parentNode, resolve) { return _vm.$emit('menu-scroll-bottom', parentNode, resolve); }},model:{value:(_vm.checkedValue),callback:function ($$v) {_vm.checkedValue=$$v},expression:"checkedValue"}}),(_vm.filterable)?_c('el-scrollbar',{directives:[{name:"show",rawName:"v-show",value:(_vm.filtering),expression:"filtering"}],ref:"suggestionPanel",staticClass:"el-cascader__suggestion-panel",attrs:{"tag":"ul","view-class":"el-cascader__suggestion-list"},nativeOn:{"keydown":function($event){return _vm.handleSuggestionKeyDown.apply(null, arguments)}}},[(_vm.suggestionLoading)?_c('span',{staticStyle:{"text-align":"center"}},[_vm._v("加载中")]):[(_vm.suggestions.length)?_vm._l((_vm.suggestions),function(item,index){return _c('li',{key:item.uid,class:[
|
|
1619
|
+
'el-cascader__suggestion-item',
|
|
1620
|
+
item.checked && 'is-checked'
|
|
1621
|
+
],attrs:{"tabindex":-1},on:{"click":function($event){return _vm.handleSuggestionClick(index)}}},[_c('span',[_vm._v(_vm._s(item.text))]),(item.checked)?_c('i',{staticClass:"el-icon-check"}):_vm._e()])}):_vm._t("empty",function(){return [_c('li',{staticClass:"el-cascader__empty-text"},[_vm._v(_vm._s(_vm.t('el.cascader.noMatch')))])]})]],2):_vm._e()],1)])],1)}
|
|
1622
1622
|
var staticRenderFns = []
|
|
1623
1623
|
|
|
1624
1624
|
|
|
@@ -5487,13 +5487,14 @@ const stopPropagation = e => e.stopPropagation();
|
|
|
5487
5487
|
const {
|
|
5488
5488
|
isLeaf,
|
|
5489
5489
|
isChecked,
|
|
5490
|
-
config
|
|
5490
|
+
config,
|
|
5491
|
+
node
|
|
5491
5492
|
} = this;
|
|
5492
5493
|
const {
|
|
5493
5494
|
checkStrictly,
|
|
5494
5495
|
multiple
|
|
5495
5496
|
} = config;
|
|
5496
|
-
if (multiple) {
|
|
5497
|
+
if (multiple && !node.data.hideMultiple) {
|
|
5497
5498
|
return this.renderCheckbox(h);
|
|
5498
5499
|
} else if (checkStrictly) {
|
|
5499
5500
|
return this.renderRadio(h);
|
|
@@ -5520,6 +5521,7 @@ const stopPropagation = e => e.stopPropagation();
|
|
|
5520
5521
|
config,
|
|
5521
5522
|
isDisabled
|
|
5522
5523
|
} = this;
|
|
5524
|
+
const disabled = node.data.selfDisabled || isDisabled;
|
|
5523
5525
|
const events = {
|
|
5524
5526
|
on: {
|
|
5525
5527
|
change: this.handleMultiCheckChange
|
|
@@ -5534,7 +5536,7 @@ const stopPropagation = e => e.stopPropagation();
|
|
|
5534
5536
|
"attrs": {
|
|
5535
5537
|
"value": node.checked,
|
|
5536
5538
|
"indeterminate": node.indeterminate,
|
|
5537
|
-
"disabled":
|
|
5539
|
+
"disabled": disabled
|
|
5538
5540
|
}
|
|
5539
5541
|
}, events]));
|
|
5540
5542
|
},
|
|
@@ -6791,6 +6793,9 @@ var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce);
|
|
|
6791
6793
|
//
|
|
6792
6794
|
//
|
|
6793
6795
|
//
|
|
6796
|
+
//
|
|
6797
|
+
//
|
|
6798
|
+
//
|
|
6794
6799
|
|
|
6795
6800
|
|
|
6796
6801
|
|
|
@@ -6919,7 +6924,8 @@ const InputSizeMap = {
|
|
|
6919
6924
|
filtering: false,
|
|
6920
6925
|
suggestions: [],
|
|
6921
6926
|
inputInitialHeight: 0,
|
|
6922
|
-
pressDeleteCount: 0
|
|
6927
|
+
pressDeleteCount: 0,
|
|
6928
|
+
suggestionLoading: false /** @author jyj */
|
|
6923
6929
|
};
|
|
6924
6930
|
},
|
|
6925
6931
|
computed: {
|
|
@@ -7053,6 +7059,8 @@ const InputSizeMap = {
|
|
|
7053
7059
|
remoteMethod
|
|
7054
7060
|
} = this.config;
|
|
7055
7061
|
if (this.remote && remoteMethod) {
|
|
7062
|
+
// this.suggestions = []
|
|
7063
|
+
this.suggestionLoading = true;
|
|
7056
7064
|
remoteMethod(inputValue, this.remoteSearchResolve(inputValue));
|
|
7057
7065
|
return;
|
|
7058
7066
|
}
|
|
@@ -7381,7 +7389,11 @@ const InputSizeMap = {
|
|
|
7381
7389
|
*/
|
|
7382
7390
|
remoteSearchResolve(inputValue) {
|
|
7383
7391
|
const resolve = data => {
|
|
7384
|
-
|
|
7392
|
+
this.suggestionLoading = false;
|
|
7393
|
+
if (isEmpty(data)) {
|
|
7394
|
+
this.getSuggestions();
|
|
7395
|
+
return;
|
|
7396
|
+
}
|
|
7385
7397
|
// 1.获取已经加载的节点value list
|
|
7386
7398
|
const loadedFlattedNodesVals = this.panel.getFlattedNodes(false).map(n => n.value);
|
|
7387
7399
|
|