web-component-gallery 2.0.33 → 2.0.35

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.
@@ -18,6 +18,7 @@
18
18
  :getPopupContainer="tirggerNode => tirggerNode.parentNode"
19
19
  @select="handleSelect"
20
20
  @search="handleSearch"
21
+ @change="handleChange"
21
22
  @popupScroll="handleScroll"
22
23
  v-bind="attrs"
23
24
  v-on="$listeners"
@@ -179,7 +180,7 @@ export default {
179
180
 
180
181
  mounted() {
181
182
  this.pagination.size = this.pSize
182
- this.initLoad && this.fetchData()
183
+ this.initLoad && this.fetchData(false)
183
184
  document.addEventListener('click', this.handleDocumentClick)
184
185
  },
185
186
 
@@ -197,7 +198,7 @@ export default {
197
198
  this.pagination.current = 1
198
199
  this.fetchData()
199
200
  },
200
- async fetchData() {
201
+ async fetchData(isReset = true) {
201
202
  if (!this.listPageHandler) return
202
203
 
203
204
  try {
@@ -207,11 +208,10 @@ export default {
207
208
  ...this.listPageParams,
208
209
  [this.searchKey]: this.searchValue
209
210
  })
210
-
211
- this.pagination.current === 1 ?
212
- this.innerOptions = [...records] :
213
- this.innerOptions = [...this.innerOptions, ...records]
214
-
211
+
212
+ this.innerOptions = this.pagination.current === 1 && isReset
213
+ ? [...records]
214
+ : [...this.innerOptions, ...this.handleFilter(records)]
215
215
  this.pagination.total = total
216
216
  } catch (error) {
217
217
  this.pagination.current--
@@ -221,6 +221,14 @@ export default {
221
221
  }
222
222
  },
223
223
 
224
+ // 筛选掉相同数据
225
+ handleFilter(data) {
226
+ const optionsCache = new Map(
227
+ this.innerOptions.map(item => [item[this.valueKey], item])
228
+ )
229
+ return data.filter(item => !optionsCache.has(item[this.valueKey]))
230
+ },
231
+
224
232
  // 下拉滚动加载更多
225
233
  handleScroll(e) {
226
234
  const { scrollTop, scrollHeight, clientHeight } = e.target
@@ -228,6 +236,11 @@ export default {
228
236
  if (reachBottom && !this.isLoadingMore && this.hasMore) this.debouncedLoadMore()
229
237
  },
230
238
 
239
+ // 数据清空处理
240
+ handleChange(value) {
241
+ if (!value) return this.resetRequest()
242
+ },
243
+
231
244
  // 搜索事件处理
232
245
  handleSearch(value) {
233
246
  this.isInput && (this.innerValue = value)
@@ -4,37 +4,42 @@
4
4
  .AntModal {
5
5
  &__small {
6
6
  .ant-modal {
7
- .layout( 712px, 640px );
7
+ .layout(712px, 640px);
8
8
  }
9
9
  }
10
+
10
11
  &__middle {
11
12
  .ant-modal {
12
- .layout( 1104px, 848px );
13
+ .layout(1104px, 848px);
13
14
  }
14
15
  }
16
+
15
17
  &__large {
16
18
  .ant-modal {
17
- .layout( 1600px, 848px );
19
+ .layout(1600px, 848px);
18
20
  }
19
21
  }
22
+
20
23
  &__max {
21
24
  .ant-modal {
22
- top: 0;
23
- padding-bottom: 0;
24
- .layout();
25
+ top: 0;
26
+ padding-bottom: 0;
27
+ .layout();
25
28
  }
26
29
  }
30
+
27
31
  &__screen {
28
32
  .ant-modal {
29
- top: 0;
30
- padding: 0;
31
- .layout();
32
-
33
- &-body {
34
- padding: 0;
35
- }
33
+ top: 0;
34
+ padding: 0;
35
+ .layout();
36
+
37
+ &-body {
38
+ padding: 0;
39
+ }
36
40
  }
37
41
  }
42
+
38
43
  &__Title {
39
44
  .flex-layout();
40
45
 
@@ -45,8 +50,14 @@
45
50
 
46
51
  .anticon {
47
52
  cursor: pointer;
48
- &:hover { color: @primary-color; }
49
- &:first-child { margin-right: @padding-sm; }
53
+
54
+ &:hover {
55
+ color: @primary-color;
56
+ }
57
+
58
+ &:first-child {
59
+ margin-right: @padding-sm;
60
+ }
50
61
  }
51
62
  }
52
63
  }
@@ -57,8 +68,13 @@
57
68
  height: 100%;
58
69
  .flex-layout(column);
59
70
  }
71
+
60
72
  &-body {
61
73
  flex: 1;
62
74
  min-height: 0;
63
- }
75
+
76
+ &>div {
77
+ .layout()
78
+ }
79
+ }
64
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-component-gallery",
3
- "version": "2.0.33",
3
+ "version": "2.0.35",
4
4
  "description": "基础vue、antdvue、less实现的私有组件库",
5
5
  "main": "dist/index.umd.js",
6
6
  "files": [