Skip to content

Commit 09e58e2

Browse files
authored
Merge pull request #290 from PlezBlip/feature/858148-quick-reply-menu-and-carrossel-hide-options
#858148 quick reply, menu and carrossel hide options
2 parents f1ebdd6 + 2bebd70 commit 09e58e2

File tree

4 files changed

+214
-144
lines changed

4 files changed

+214
-144
lines changed

package-lock.json

Lines changed: 116 additions & 111 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/BlipSelect.vue

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@
2020
<blip-card-date :status="status" :position="position" :date="date" :failed-to-send-msg="failedToSendMsg"
2121
:is-external-message="isExternalMessage" :external-message-text="externalMessageText" />
2222
</div>
23-
<transition name="fade">
24-
<div :class="'slideshow-container ' + position" :id="id" v-touch:swipe.left="swipeLeftHandler" v-touch:swipe.right="swipeRightHandler"
25-
v-if="!hide">
23+
<div :class="'slideshow-container ' + position" :id="id" v-touch:swipe.left="swipeLeftHandler" v-touch:swipe.right="swipeRightHandler">
2624
<div class="slideshow-list">
2725
<div class="slideshow-track options">
2826
<ul class="item-list">
29-
<li v-for="(item, index) in options" v-bind:key="index" @click="select(item)" class="disable-selection"
30-
v-bind:class="{ readonly: readonly }">
27+
<li
28+
v-for="(item, index) in options"
29+
v-bind:key="index"
30+
@click="disableOptions ? null : select(item, index)"
31+
class="disable-selection"
32+
:class="`${disableOptions && index != selectedIndex ? ' unselected-option' : ''} ${disableOptions ? ' pointer-default' : ''}`">
3133
<div v-html="sanitize(item.previewText)"></div>
3234
</li>
3335
</ul>
@@ -37,8 +39,6 @@
3739
<a class="prev" v-if="showPrev" @dblclick="$event.stopPropagation()" @click="plusSlides(-1)">&#10094;</a>
3840
<a class="next" v-if="showNext" @dblclick="$event.stopPropagation()" @click="plusSlides(1)">&#10095;</a>
3941
</div>
40-
41-
</transition>
4242
</div>
4343

4444
<div v-else :class="isFailedMessage(status, position)">
@@ -52,18 +52,21 @@
5252
</bds-button-icon>
5353

5454
<div class="text-left" v-html="sanitize(computedText)"></div>
55-
<transition name="fade">
5655
<div :class="'slideshow-container ' + position" :id="id" v-touch:swipe.left="swipeLeftHandler"
57-
v-touch:swipe.right="swipeRightHandler" v-if="!hide">
56+
v-touch:swipe.right="swipeRightHandler">
5857
<div class="fixed-options">
5958
<ul class="item-list">
60-
<li v-for="(item, index) in options" v-bind:key="index" @click="select(item)" class="disable-selection">
59+
<li
60+
v-for="(item, index) in options"
61+
v-bind:key="index"
62+
@click="disableOptions ? null : select(item, index)"
63+
class="disable-selection"
64+
:class="`${disableOptions && selectedIndex != index ? ' unselected-option' : ''} ${disableOptions ? ' pointer-default' : ''}`">
6165
<div v-html="sanitize(item.previewText)"></div>
6266
</li>
6367
</ul>
6468
</div>
6569
</div>
66-
</transition>
6770
</div>
6871
</div>
6972
</div>
@@ -227,7 +230,8 @@ export default {
227230
showPayload: undefined,
228231
headerTab: undefined,
229232
selectedOption: undefined,
230-
hide: undefined,
233+
disableOptions: undefined,
234+
selectedIndex: undefined,
231235
text: undefined,
232236
options: undefined,
233237
id: undefined,
@@ -260,7 +264,7 @@ export default {
260264
},
261265
watch: {
262266
hideOptions: function () {
263-
this.hide = this.hideOptions
267+
this.disableOptions = this.hideOptions
264268
},
265269
document: function () {
266270
this.init()
@@ -275,7 +279,7 @@ export default {
275279
this.showPayload = false
276280
this.headerTab = 'plainText'
277281
this.selectedOption = { value: {} }
278-
this.hide = this.hideOptions
282+
this.disableOptions = this.hideOptions
279283
this.text = this.document.text
280284
this.options = this.document.options.map(function (x) {
281285
let value
@@ -474,11 +478,12 @@ export default {
474478
this.cancel()
475479
},
476480
select: debounce(
477-
function (item) {
481+
function (item, index) {
478482
if (this.readonly) return
479483
480484
if (!this.editable) {
481-
this.hide = true
485+
this.disableOptions = true
486+
this.selectedIndex = index
482487
}
483488
484489
if (this.onSelected) {
@@ -510,6 +515,14 @@ export default {
510515
<style lang="scss">
511516
@import '../styles/variables.scss';
512517
518+
.pointer-default {
519+
cursor: default !important;
520+
}
521+
522+
.unselected-option {
523+
opacity: 0.33;
524+
}
525+
513526
.select .bubble {
514527
padding: $bubble-padding;
515528
min-width: auto;

0 commit comments

Comments
 (0)