vsyswin-ui 0.2.53 → 0.2.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vsyswin-ui",
3
- "version": "0.2.53",
3
+ "version": "0.2.56",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
@@ -91,6 +91,7 @@
91
91
  <template v-else-if="item.type === 'select'">
92
92
  <span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
93
93
  <el-select
94
+ size="small"
94
95
  :multiple="!!item.multiple"
95
96
  collapse-tags
96
97
  clearable
@@ -179,6 +180,7 @@
179
180
  <template v-else-if="item.type === 'select'">
180
181
  <span class="syswin-filter-item__name" v-if="item.name && !item.hideName">{{ item.name }}</span>
181
182
  <el-select
183
+ size="small"
182
184
  :multiple="!!item.multiple"
183
185
  collapse-tags
184
186
  clearable
@@ -251,6 +253,7 @@
251
253
  <template v-else-if="item.type === 'select'">
252
254
  <span class="syswin-filter-item__name" v-if="item.name">{{ item.name }}</span>
253
255
  <el-select
256
+ size="small"
254
257
  :multiple="!!item.multiple"
255
258
  collapse-tags
256
259
  clearable
@@ -379,7 +382,7 @@ export default {
379
382
  saveToLocalPosition: {
380
383
  type: String,
381
384
  default: 'right',
382
- validator: function(value) {
385
+ validator: function (value) {
383
386
  return ['left', 'right'].indexOf(value) !== -1
384
387
  }
385
388
  },
@@ -435,8 +438,8 @@ export default {
435
438
  createTagList() {
436
439
  const list = []
437
440
  this.currentSearchList.length &&
438
- this.currentSearchList.forEach(ele => {
439
- ele.itemList.forEach(item => {
441
+ this.currentSearchList.forEach((ele) => {
442
+ ele.itemList.forEach((item) => {
440
443
  if (item.isActive || item.type === 'slot') {
441
444
  let obj = {
442
445
  pId: ele.id,
@@ -469,10 +472,10 @@ export default {
469
472
  } else if (item.type === 'select') {
470
473
  if (!item.value) return
471
474
  if (item.multiple) {
472
- const valueOptions = item.value.map(x => item.options.find(f => f.value === x))
473
- obj.name = valueOptions.map(x => x.label).join(',')
475
+ const valueOptions = item.value.map((x) => item.options.find((f) => f.value === x))
476
+ obj.name = valueOptions.map((x) => x.label).join(',')
474
477
  } else {
475
- obj.name = item.options.find(x => x.value === item.value).label
478
+ obj.name = item.options.find((x) => x.value === item.value).label
476
479
  }
477
480
  } else if (item.type === 'slot') {
478
481
  const info = item.getValue()
@@ -529,9 +532,9 @@ export default {
529
532
  this.$emit('on-search', { keyword: this.keyword, filterList })
530
533
  },
531
534
  handleTagClose(tag) {
532
- const parentItem = this.currentSearchList.find(x => x.id === tag.pId)
533
- const parentIndex = this.currentSearchList.findIndex(x => x.id === tag.pId)
534
- const childIndex = parentItem.itemList.findIndex(x => x.id === tag.id)
535
+ const parentItem = this.currentSearchList.find((x) => x.id === tag.pId)
536
+ const parentIndex = this.currentSearchList.findIndex((x) => x.id === tag.pId)
537
+ const childIndex = parentItem.itemList.findIndex((x) => x.id === tag.id)
535
538
  parentItem.itemList.forEach((item, index) => {
536
539
  if (parentItem.multiple) {
537
540
  // 多选
@@ -547,6 +550,9 @@ export default {
547
550
  if (item.type === 'select') {
548
551
  item.value = item.multiple ? [] : null
549
552
  }
553
+ if (item.type === 'slot') {
554
+ item.setValue({ name: '', value: '' })
555
+ }
550
556
  }
551
557
  }
552
558
  })
@@ -557,10 +563,10 @@ export default {
557
563
  },
558
564
  // 关闭所有的标签
559
565
  handleClearAllTags() {
560
- this.tagList.forEach(tag => {
561
- const parentItem = this.currentSearchList.find(x => x.id === tag.pId)
562
- const parentIndex = this.currentSearchList.findIndex(x => x.id === tag.pId)
563
- const childIndex = parentItem.itemList.findIndex(x => x.id === tag.id)
566
+ this.tagList.forEach((tag) => {
567
+ const parentItem = this.currentSearchList.find((x) => x.id === tag.pId)
568
+ const parentIndex = this.currentSearchList.findIndex((x) => x.id === tag.pId)
569
+ const childIndex = parentItem.itemList.findIndex((x) => x.id === tag.id)
564
570
  parentItem.itemList.forEach((item, index) => {
565
571
  if (parentItem.multiple) {
566
572
  // 多选
@@ -576,6 +582,9 @@ export default {
576
582
  if (item.type === 'select') {
577
583
  item.value = item.multiple ? [] : null
578
584
  }
585
+ if (item.type === 'slot') {
586
+ item.setValue({ name: '', value: '' })
587
+ }
579
588
  }
580
589
  }
581
590
  })
@@ -591,8 +600,8 @@ export default {
591
600
  this.keyword = ''
592
601
 
593
602
  const currentSearchList = _.cloneDeep(this.currentSearchList)
594
- currentSearchList.forEach(ele => {
595
- ele.itemList.forEach(item => {
603
+ currentSearchList.forEach((ele) => {
604
+ ele.itemList.forEach((item) => {
596
605
  item.isActive = !!item.default
597
606
  if (['month', 'year'].includes(item.type)) {
598
607
  item.value = item.default && item.defaultValue ? item.defaultValue : ''
@@ -603,8 +612,8 @@ export default {
603
612
  if (item.type === 'select') {
604
613
  if (item.default && item.defaultValue) {
605
614
  if (item.multiple) {
606
- const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
607
- item.value = valueOptions.map(x => x.value)
615
+ const valueOptions = item.defaultValue.map((x) => item.options.find((f) => f.value === x))
616
+ item.value = valueOptions.map((x) => x.value)
608
617
  } else {
609
618
  item.value = item.defaultValue
610
619
  }
@@ -621,8 +630,8 @@ export default {
621
630
  setDefaultTagList() {
622
631
  const list = []
623
632
  if (this.currentSearchList) {
624
- this.currentSearchList.forEach(ele => {
625
- ele.itemList.forEach(item => {
633
+ this.currentSearchList.forEach((ele) => {
634
+ ele.itemList.forEach((item) => {
626
635
  if (item.default) {
627
636
  // 如果是默认值
628
637
  const obj = {
@@ -655,10 +664,10 @@ export default {
655
664
  } else if (item.type === 'select') {
656
665
  if (!item.defaultValue) return
657
666
  if (item.multiple) {
658
- const valueOptions = item.defaultValue.map(x => item.options.find(f => f.value === x))
659
- obj.name = valueOptions.map(x => x.label).join(',')
667
+ const valueOptions = item.defaultValue.map((x) => item.options.find((f) => f.value === x))
668
+ obj.name = valueOptions.map((x) => x.label).join(',')
660
669
  } else {
661
- const defaultItem = item.options.find(x => x.value === item.defaultValue)
670
+ const defaultItem = item.options.find((x) => x.value === item.defaultValue)
662
671
  obj.name = defaultItem.label
663
672
  obj.value = defaultItem
664
673
  }
@@ -730,15 +739,15 @@ export default {
730
739
  // 切换保存过滤条件的下拉框
731
740
  handleChangeCondition(value) {
732
741
  this.conditionValue = value
733
- const list = this.conditionList.filter(item => item.value === value)
742
+ const list = this.conditionList.filter((item) => item.value === value)
734
743
  if (list.length) {
735
744
  const currentSearchList = _.cloneDeep(this.currentSearchList)
736
745
  const { keyword = '', filterList = [] } = list[0]
737
746
  this.keyword = keyword
738
747
 
739
748
  // 先清空所有标签
740
- currentSearchList.forEach(ele => {
741
- ele.itemList.forEach(item => {
749
+ currentSearchList.forEach((ele) => {
750
+ ele.itemList.forEach((item) => {
742
751
  item.isActive = false
743
752
  item.type === 'daterange' && (item.value = null)
744
753
  })
@@ -746,10 +755,10 @@ export default {
746
755
 
747
756
  // 设置选中的标签
748
757
  if (filterList && filterList.length) {
749
- filterList.forEach(ele => {
750
- currentSearchList.forEach(item => {
758
+ filterList.forEach((ele) => {
759
+ currentSearchList.forEach((item) => {
751
760
  if (ele.pId === item.id) {
752
- item.itemList.forEach(v => {
761
+ item.itemList.forEach((v) => {
753
762
  if (v.type === 'slot') {
754
763
  v.setValue({ value: ele.value, name: ele.name, ...ele })
755
764
  }
@@ -786,7 +795,7 @@ export default {
786
795
  let localList = localStorage.getItem(`syswin${this.storageName}`)
787
796
  if (!['', undefined, null].includes(localList)) {
788
797
  localList = JSON.parse(localList)
789
- const idx = localList.findIndex(ele => ele.value === item.value)
798
+ const idx = localList.findIndex((ele) => ele.value === item.value)
790
799
  idx > -1 && localList.splice(idx, 1)
791
800
  localList.length > 0
792
801
  ? localStorage.setItem(`syswin${this.storageName}`, JSON.stringify(localList))
@@ -807,7 +816,7 @@ export default {
807
816
  this.conditionValue = momentValue
808
817
  } else {
809
818
  // 编辑
810
- const index = this.conditionList.findIndex(ele => ele.value === this.currentData.value)
819
+ const index = this.conditionList.findIndex((ele) => ele.value === this.currentData.value)
811
820
  const item = this.conditionList[index]
812
821
  item.label = label
813
822
  this.$set(this.conditionList, index, item)
@@ -2,7 +2,8 @@
2
2
  <div class="header-filter">
3
3
  <div class="header-filter-input">
4
4
  <slot name="filterInput">
5
- <el-input class="header-filter-input" :placeholder="placeholder" v-model.trim="keyword" @input="search" clearable>
5
+ <el-input class="header-filter-input" size="small" :placeholder="placeholder" @keyup.enter.native="search"
6
+ v-model.trim="keyword" @input="auto && search" @clear="search" clearable>
6
7
  <el-button type="primary" slot="append" icon="el-icon-search" @click="search()"></el-button>
7
8
  </el-input>
8
9
  </slot>
@@ -32,10 +33,15 @@ export default {
32
33
  placeholder: {
33
34
  type: String,
34
35
  default: '请输入搜索关键字'
36
+ },
37
+ // 在input框输入是否自动搜索->也即,是否会自动触发@input事件
38
+ auto: {
39
+ type: Boolean,
40
+ default: false
35
41
  }
36
42
  },
37
43
  methods: {
38
- search: debounce(200, function() {
44
+ search: debounce(200, function () {
39
45
  // 执行搜索事件
40
46
  this.$emit('input', this.keyword)
41
47
  this.$emit('search', this.keyword)