@aochuang/client-sdk 1.0.374 → 1.0.376-wework

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.
@@ -23,7 +23,7 @@
23
23
  ></span>
24
24
  </div>
25
25
  </div>
26
- <div class="sdk-chat-editor-suggestions__body" ref="body" @scroll="handleBodyScroll">
26
+ <div class="sdk-chat-editor-suggestions__body" ref="body">
27
27
  <template v-if="data && data.length">
28
28
  <div class="sdk-chat-editor-suggestions__list">
29
29
  <div
@@ -38,9 +38,6 @@
38
38
  <slot name="item" :data="item"></slot>
39
39
  </div>
40
40
  </div>
41
- <div class="sdk-chat-editor-suggestions__more" v-if="loadingMore">
42
- <ui-loading size="mini"></ui-loading>
43
- </div>
44
41
  </template>
45
42
  </div>
46
43
  <div class="sdk-chat-editor-suggestions__foot">
@@ -71,14 +68,6 @@ export default {
71
68
  type: Boolean,
72
69
  default: false
73
70
  },
74
- loadingMore: {
75
- type: Boolean,
76
- default: false
77
- },
78
- hasMore: {
79
- type: Boolean,
80
- default: false
81
- },
82
71
  confirmMethod: {
83
72
  type: Function
84
73
  }
@@ -119,15 +108,6 @@ export default {
119
108
  handleCloseClick () {
120
109
  this.closed = true
121
110
  },
122
- handleBodyScroll (evt) {
123
- if (!this.hasMore || this.loadingMore) {
124
- return
125
- }
126
- const target = evt.target
127
- if (target.scrollHeight - target.scrollTop - target.clientHeight <= 20) {
128
- this.$emit('load-more')
129
- }
130
- },
131
111
  handleItemMouseEnter (item) {
132
112
  this.focusId = item.id
133
113
  },
@@ -183,12 +163,6 @@ export default {
183
163
  // 向下
184
164
  if (evt.keyCode === 40) {
185
165
  evt.preventDefault()
186
- if (this.hasMore && !this.loadingMore && index >= this.data.length - 2) {
187
- this.$emit('load-more')
188
- }
189
- if (this.hasMore && index === this.data.length - 1) {
190
- return
191
- }
192
166
  const nextIndex = index + 1 > this.data.length - 1 ? 0 : index + 1
193
167
  this.focusId = this.data[nextIndex].id
194
168
  this.scrollTo(this.focusId)
@@ -206,7 +180,7 @@ export default {
206
180
  checkAutoFocus () {
207
181
  if (!this.data || !this.data.length) {
208
182
  this.focusId = null
209
- } else if (!this.focusId || !this.data.some(item => item.id === this.focusId)) {
183
+ } else {
210
184
  this.focusId = this.data[0].id
211
185
  }
212
186
  },
@@ -367,10 +341,4 @@ export default {
367
341
  .sdk-chat-editor-suggestions__item.is-focus:after {
368
342
  opacity: 1;
369
343
  }
370
- .sdk-chat-editor-suggestions__more {
371
- height: 32px;
372
- display: flex;
373
- align-items: center;
374
- justify-content: center;
375
- }
376
344
  </style>
@@ -46,12 +46,9 @@
46
46
  ref="suggestions"
47
47
  :keyword="suggestionsKeyword"
48
48
  :loading="suggestioning"
49
- :loading-more="suggestionsLoadingMore"
50
- :has-more="suggestionsHasMore"
51
49
  :data="suggestionsData"
52
50
  :confirm-method="handleSuggestionsConfirmMethod"
53
51
  @closed="handleSuggestionsClosed"
54
- @load-more="handleSuggestionsLoadMore"
55
52
  >
56
53
  <template slot="item" slot-scope="scope">
57
54
  <slot name="suggestions-item" v-bind="scope"></slot>
@@ -86,9 +83,6 @@ export default {
86
83
  fetchSuggestionsMethod: {
87
84
  type: Function
88
85
  },
89
- fetchMoreSuggestionsMethod: {
90
- type: Function
91
- },
92
86
  confirmSuggestionsMethod: {
93
87
  type: Function
94
88
  },
@@ -105,8 +99,6 @@ export default {
105
99
  sending: false,
106
100
  popoverActive: false,
107
101
  suggestioning: false,
108
- suggestionsLoadingMore: false,
109
- suggestionsHasMore: false,
110
102
  suggestionsData: [],
111
103
  suggestionsKeyword: null,
112
104
  inputValue: this.value || ''
@@ -135,8 +127,6 @@ export default {
135
127
  },
136
128
  handleSuggestionsClosed () {
137
129
  this.suggestionsData = []
138
- this.suggestionsHasMore = false
139
- this.suggestionsLoadingMore = false
140
130
  },
141
131
  handleSuggestionsConfirmMethod ({ item }) {
142
132
  const next = () => {
@@ -273,9 +263,6 @@ export default {
273
263
  const requestId = (this._suggestionsRequestId || 0) + 1
274
264
  this._suggestionsRequestId = requestId
275
265
  this.suggestioning = true
276
- this.suggestionsLoadingMore = false
277
- this.suggestionsHasMore = false
278
- this.suggestionsData = []
279
266
  this.suggestionsKeyword = keyword
280
267
  this.popoverActive = true
281
268
  clearTimeout(this._loadSuggestionsTimer)
@@ -287,60 +274,13 @@ export default {
287
274
  if (requestId !== this._suggestionsRequestId) {
288
275
  return
289
276
  }
290
- const result = this.normalizeSuggestionsResult(rs)
291
- this.suggestionsData = result.items
292
- this.suggestionsHasMore = result.hasMore
277
+ this.suggestionsData = rs || []
293
278
  }).finally(() => {
294
279
  if (requestId === this._suggestionsRequestId) {
295
280
  this.suggestioning = false
296
281
  }
297
282
  })
298
283
  },
299
- handleSuggestionsLoadMore () {
300
- if (!this.fetchMoreSuggestionsMethod || !this.suggestionsHasMore || this.suggestionsLoadingMore) {
301
- return
302
- }
303
- const requestId = this._suggestionsRequestId
304
- const keyword = this.suggestionsKeyword
305
- const nearestInfo = this.suggestionsNearsetInfo
306
- this.suggestionsLoadingMore = true
307
- return Promise.resolve(this.fetchMoreSuggestionsMethod({
308
- keyword,
309
- nearestInfo,
310
- isAtContext: !!(nearestInfo && nearestInfo.isAtContext),
311
- data: this.suggestionsData.slice()
312
- })).then(rs => {
313
- if (requestId !== this._suggestionsRequestId || keyword !== this.suggestionsKeyword) {
314
- return
315
- }
316
- const result = this.normalizeSuggestionsResult(rs)
317
- const ids = new Set(this.suggestionsData.map(item => item && item.id))
318
- this.suggestionsData = this.suggestionsData.concat(result.items.filter(item => {
319
- if (!item || ids.has(item.id)) {
320
- return false
321
- }
322
- ids.add(item.id)
323
- return true
324
- }))
325
- this.suggestionsHasMore = result.hasMore
326
- }).finally(() => {
327
- if (requestId === this._suggestionsRequestId) {
328
- this.suggestionsLoadingMore = false
329
- }
330
- })
331
- },
332
- normalizeSuggestionsResult (result) {
333
- if (Array.isArray(result)) {
334
- return {
335
- items: result,
336
- hasMore: false
337
- }
338
- }
339
- return {
340
- items: result && Array.isArray(result.items) ? result.items : [],
341
- hasMore: !!(result && result.hasMore)
342
- }
343
- },
344
284
  normalizeSuggestionsKeyword (nearestInfo, keyword) {
345
285
  const nearest = keyword === undefined
346
286
  ? (nearestInfo && nearestInfo.nearest) || ''
@@ -354,8 +294,6 @@ export default {
354
294
  this._suggestionsRequestId = (this._suggestionsRequestId || 0) + 1
355
295
  this.$refs.suggestions && this.$refs.suggestions.close()
356
296
  this.suggestioning = false
357
- this.suggestionsLoadingMore = false
358
- this.suggestionsHasMore = false
359
297
  this.popoverActive = false
360
298
  },
361
299
  hasCurrentSuggestionsContext () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.374",
3
+ "version": "1.0.376-wework",
4
4
  "description": "",
5
5
  "files": [
6
6
  "common",