vsyswin-ui 0.2.56 → 0.2.59

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.56",
3
+ "version": "0.2.59",
4
4
  "main": "lib/vsyswin-ui.umd.min.js",
5
5
  "private": false,
6
6
  "description": "Vue2.x的应用组件库.",
package/packages/index.js CHANGED
@@ -7,13 +7,14 @@ import selectProject from './select-project' // 项目选择组件
7
7
  import selectTree from './select-tree' // 表单树选择器
8
8
  import SearchBar from './search-bar' // 搜索工具栏
9
9
  import simpleSearchBar from './simple-search-bar' // 简单搜索栏组件
10
+ import inputMore from './input-more' // 简单搜索栏组件
10
11
  import paging from './paging'
11
12
  import newSearchBar from './newSearchBar' // 高级筛选
12
13
  import table from './table' // 表格组件
13
14
  import dragSet from './drag-set'
14
15
 
15
16
  // 存储组件列表
16
- const components = [layout, searchTree, selectProject, selectTree, SearchBar, simpleSearchBar, paging, newSearchBar, table, dragSet]
17
+ const components = [layout, searchTree, selectProject, selectTree, SearchBar, simpleSearchBar, inputMore, paging, newSearchBar, table, dragSet]
17
18
 
18
19
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
19
20
  const install = function (Vue) {
@@ -38,6 +39,7 @@ export default {
38
39
  selectTree,
39
40
  SearchBar,
40
41
  simpleSearchBar,
42
+ inputMore,
41
43
  paging,
42
44
  newSearchBar,
43
45
  table,
@@ -0,0 +1,10 @@
1
+ // 导入组件
2
+ import intpuMore from './src/input-more.vue'
3
+
4
+ // 为组件提供 install 安装方法,供按需引入
5
+ intpuMore.install = function (Vue) {
6
+ Vue.component(intpuMore.name, intpuMore)
7
+ }
8
+
9
+ // 默认导出组件
10
+ export default intpuMore
@@ -0,0 +1,94 @@
1
+ <template>
2
+ <div class="sy-input-more" :class="{ 'is-active': isActive }" @mouseleave="isActive = false">
3
+ <!-- <input type="text" :title="str" :value="str" :placeholder="placeholder" :maxlength="maxlength" readonly @focus="open" /> -->
4
+ <span class="span-input" :title="str" @click="open" @mouseenter="isActive = true">
5
+ <span class="span-content" v-if="!!str">{{ str }}</span>
6
+ <span v-else class="span-content placeholder">{{ placeholder }}</span>
7
+ <i class="el-icon-circle-close" v-if="!!str && isActive" @click.stop="clearChoosed"></i>
8
+ </span>
9
+ <i class="el-icon-more more-icon" @click="open"></i>
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: 'SyInputMore',
16
+ props: {
17
+ placeholder: {
18
+ type: String,
19
+ default: '请选择'
20
+ },
21
+ str: {
22
+ type: String,
23
+ default: ''
24
+ },
25
+ maxlength: {
26
+ type: Number,
27
+ default: 0
28
+ }
29
+ },
30
+ data() {
31
+ return {
32
+ isActive: false
33
+ }
34
+ },
35
+ methods: {
36
+ clearChoosed() {
37
+ this.$emit('clear')
38
+ },
39
+ open() {
40
+ this.isActive = true
41
+ this.$emit('open')
42
+ }
43
+ }
44
+ }
45
+ </script>
46
+
47
+ <style lang="scss" scoped>
48
+ .sy-input-more {
49
+ display: flex;
50
+ align-items: center;
51
+ box-sizing: border-box;
52
+ padding-right: 4px;
53
+ height: 32px;
54
+ line-height: 30px;
55
+ border-radius: 2px;
56
+ border: 1px solid #dcdfe6;
57
+ &.is-active {
58
+ border-color: #027aff;
59
+ }
60
+ .el-input__inner {
61
+ border: none;
62
+ height: 30px;
63
+ line-height: 30px;
64
+ }
65
+ .span-input {
66
+ width: 0;
67
+ flex: 1;
68
+ padding-left: 10px;
69
+ padding-right: 18px;
70
+ position: relative;
71
+ .span-content {
72
+ display: block;
73
+ width: 100%;
74
+ height: 100%;
75
+ overflow: hidden;
76
+ white-space: nowrap;
77
+ text-overflow: ellipsis;
78
+ }
79
+ .el-icon-circle-close {
80
+ position: absolute;
81
+ right: 2px;
82
+ top: 50%;
83
+ transform: translateY(-50%);
84
+ cursor: pointer;
85
+ }
86
+ .placeholder {
87
+ color: #c0c4cc;
88
+ }
89
+ }
90
+ > .el-icon-more {
91
+ cursor: pointer;
92
+ }
93
+ }
94
+ </style>
@@ -382,7 +382,7 @@ export default {
382
382
  saveToLocalPosition: {
383
383
  type: String,
384
384
  default: 'right',
385
- validator: function (value) {
385
+ validator: function(value) {
386
386
  return ['left', 'right'].indexOf(value) !== -1
387
387
  }
388
388
  },
@@ -438,8 +438,8 @@ export default {
438
438
  createTagList() {
439
439
  const list = []
440
440
  this.currentSearchList.length &&
441
- this.currentSearchList.forEach((ele) => {
442
- ele.itemList.forEach((item) => {
441
+ this.currentSearchList.forEach(ele => {
442
+ ele.itemList.forEach(item => {
443
443
  if (item.isActive || item.type === 'slot') {
444
444
  let obj = {
445
445
  pId: ele.id,
@@ -472,10 +472,10 @@ export default {
472
472
  } else if (item.type === 'select') {
473
473
  if (!item.value) return
474
474
  if (item.multiple) {
475
- const valueOptions = item.value.map((x) => item.options.find((f) => f.value === x))
476
- 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(',')
477
477
  } else {
478
- obj.name = item.options.find((x) => x.value === item.value).label
478
+ obj.name = item.options.find(x => x.value === item.value).label
479
479
  }
480
480
  } else if (item.type === 'slot') {
481
481
  const info = item.getValue()
@@ -532,9 +532,9 @@ export default {
532
532
  this.$emit('on-search', { keyword: this.keyword, filterList })
533
533
  },
534
534
  handleTagClose(tag) {
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
+ 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)
538
538
  parentItem.itemList.forEach((item, index) => {
539
539
  if (parentItem.multiple) {
540
540
  // 多选
@@ -563,10 +563,10 @@ export default {
563
563
  },
564
564
  // 关闭所有的标签
565
565
  handleClearAllTags() {
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)
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)
570
570
  parentItem.itemList.forEach((item, index) => {
571
571
  if (parentItem.multiple) {
572
572
  // 多选
@@ -600,8 +600,8 @@ export default {
600
600
  this.keyword = ''
601
601
 
602
602
  const currentSearchList = _.cloneDeep(this.currentSearchList)
603
- currentSearchList.forEach((ele) => {
604
- ele.itemList.forEach((item) => {
603
+ currentSearchList.forEach(ele => {
604
+ ele.itemList.forEach(item => {
605
605
  item.isActive = !!item.default
606
606
  if (['month', 'year'].includes(item.type)) {
607
607
  item.value = item.default && item.defaultValue ? item.defaultValue : ''
@@ -612,8 +612,8 @@ export default {
612
612
  if (item.type === 'select') {
613
613
  if (item.default && item.defaultValue) {
614
614
  if (item.multiple) {
615
- const valueOptions = item.defaultValue.map((x) => item.options.find((f) => f.value === x))
616
- 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)
617
617
  } else {
618
618
  item.value = item.defaultValue
619
619
  }
@@ -630,8 +630,8 @@ export default {
630
630
  setDefaultTagList() {
631
631
  const list = []
632
632
  if (this.currentSearchList) {
633
- this.currentSearchList.forEach((ele) => {
634
- ele.itemList.forEach((item) => {
633
+ this.currentSearchList.forEach(ele => {
634
+ ele.itemList.forEach(item => {
635
635
  if (item.default) {
636
636
  // 如果是默认值
637
637
  const obj = {
@@ -664,10 +664,10 @@ export default {
664
664
  } else if (item.type === 'select') {
665
665
  if (!item.defaultValue) return
666
666
  if (item.multiple) {
667
- const valueOptions = item.defaultValue.map((x) => item.options.find((f) => f.value === x))
668
- 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(',')
669
669
  } else {
670
- const defaultItem = item.options.find((x) => x.value === item.defaultValue)
670
+ const defaultItem = item.options.find(x => x.value === item.defaultValue)
671
671
  obj.name = defaultItem.label
672
672
  obj.value = defaultItem
673
673
  }
@@ -739,15 +739,15 @@ export default {
739
739
  // 切换保存过滤条件的下拉框
740
740
  handleChangeCondition(value) {
741
741
  this.conditionValue = value
742
- const list = this.conditionList.filter((item) => item.value === value)
742
+ const list = this.conditionList.filter(item => item.value === value)
743
743
  if (list.length) {
744
744
  const currentSearchList = _.cloneDeep(this.currentSearchList)
745
745
  const { keyword = '', filterList = [] } = list[0]
746
746
  this.keyword = keyword
747
747
 
748
748
  // 先清空所有标签
749
- currentSearchList.forEach((ele) => {
750
- ele.itemList.forEach((item) => {
749
+ currentSearchList.forEach(ele => {
750
+ ele.itemList.forEach(item => {
751
751
  item.isActive = false
752
752
  item.type === 'daterange' && (item.value = null)
753
753
  })
@@ -755,10 +755,10 @@ export default {
755
755
 
756
756
  // 设置选中的标签
757
757
  if (filterList && filterList.length) {
758
- filterList.forEach((ele) => {
759
- currentSearchList.forEach((item) => {
758
+ filterList.forEach(ele => {
759
+ currentSearchList.forEach(item => {
760
760
  if (ele.pId === item.id) {
761
- item.itemList.forEach((v) => {
761
+ item.itemList.forEach(v => {
762
762
  if (v.type === 'slot') {
763
763
  v.setValue({ value: ele.value, name: ele.name, ...ele })
764
764
  }
@@ -795,7 +795,7 @@ export default {
795
795
  let localList = localStorage.getItem(`syswin${this.storageName}`)
796
796
  if (!['', undefined, null].includes(localList)) {
797
797
  localList = JSON.parse(localList)
798
- const idx = localList.findIndex((ele) => ele.value === item.value)
798
+ const idx = localList.findIndex(ele => ele.value === item.value)
799
799
  idx > -1 && localList.splice(idx, 1)
800
800
  localList.length > 0
801
801
  ? localStorage.setItem(`syswin${this.storageName}`, JSON.stringify(localList))
@@ -816,7 +816,7 @@ export default {
816
816
  this.conditionValue = momentValue
817
817
  } else {
818
818
  // 编辑
819
- const index = this.conditionList.findIndex((ele) => ele.value === this.currentData.value)
819
+ const index = this.conditionList.findIndex(ele => ele.value === this.currentData.value)
820
820
  const item = this.conditionList[index]
821
821
  item.label = label
822
822
  this.$set(this.conditionList, index, item)
@@ -826,6 +826,14 @@ export default {
826
826
  handleClickOutside(e) {
827
827
  // console.log(e)
828
828
  const target = e.target
829
+ // console.log(target)
830
+ const dialogList = [...document.querySelectorAll('.el-dialog__wrapper')]
831
+ for (let i = 0; i < dialogList.length; i++) {
832
+ if (dialogList[i].contains(target)) {
833
+ return false
834
+ }
835
+ }
836
+
829
837
  if (target.classList.contains('el-dialog__wrapper')) {
830
838
  // 点击弹窗遮罩时不隐藏
831
839
  return false
@@ -2,8 +2,17 @@
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" size="small" :placeholder="placeholder" @keyup.enter.native="search"
6
- v-model.trim="keyword" @input="auto && search" @clear="search" clearable>
5
+ <el-input
6
+ class="header-filter-input"
7
+ size="small"
8
+ :placeholder="placeholder"
9
+ @keyup.enter.native="search"
10
+ v-model.trim="keyword"
11
+ @input="auto && search"
12
+ @clear="search"
13
+ @blur="blur"
14
+ clearable
15
+ >
7
16
  <el-button type="primary" slot="append" icon="el-icon-search" @click="search()"></el-button>
8
17
  </el-input>
9
18
  </slot>
@@ -40,12 +49,23 @@ export default {
40
49
  default: false
41
50
  }
42
51
  },
52
+ watch: {
53
+ value(nVal) {
54
+ this.keyword = nVal
55
+ }
56
+ },
43
57
  methods: {
44
- search: debounce(200, function () {
58
+ search: debounce(200, function() {
45
59
  // 执行搜索事件
46
60
  this.$emit('input', this.keyword)
47
61
  this.$emit('search', this.keyword)
48
- })
62
+ }),
63
+ blur() {
64
+ if (!this.auto) {
65
+ this.$emit('input', this.keyword)
66
+ this.$emit('search', this.keyword)
67
+ }
68
+ }
49
69
  }
50
70
  }
51
71
  </script>