@phonghq/go-chat 1.0.77 → 1.0.78

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.
@@ -9,6 +9,7 @@ import { getTimeLocal } from '../../../utils/dayjs-helper';
9
9
  const props = withDefaults(defineProps(), {});
10
10
  const emit = defineEmits();
11
11
  const scrollEventRef = ref(null);
12
+ const selectedMessageId = ref(null);
12
13
  const scrollBottom = () => {
13
14
  nextTick(() => {
14
15
  const eleIdContentChat = document.getElementById('content-chat');
@@ -57,6 +58,9 @@ const hideScrollEvent = () => {
57
58
  const fixedScroll = () => {
58
59
  scrollEventRef.value?.fixedScroll();
59
60
  };
61
+ const handleMessageClick = (data) => {
62
+ selectedMessageId.value = data?.id;
63
+ };
60
64
  const __VLS_exposed = { scrollBottom, hideScrollEvent, fixedScroll };
61
65
  defineExpose(__VLS_exposed);
62
66
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
@@ -149,6 +153,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
149
153
  const __VLS_18 = __VLS_asFunctionalComponent(ChatMessageItem, new ChatMessageItem({
150
154
  ...{ 'onCallAgain': {} },
151
155
  ...{ 'onResend': {} },
156
+ ...{ 'onMessageClick': {} },
152
157
  message: (item),
153
158
  responsive: (__VLS_ctx.responsive),
154
159
  isMyMessage: (item.sender_id == __VLS_ctx.dataProfile?.id),
@@ -159,10 +164,12 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
159
164
  isChatFinished: (__VLS_ctx.isChatFinished(index)),
160
165
  isChatStart: (__VLS_ctx.isChatStart(index)),
161
166
  isStartNewDate: (__VLS_ctx.isStartNewDate(index)),
167
+ selectedMessageId: (__VLS_ctx.selectedMessageId),
162
168
  }));
163
169
  const __VLS_19 = __VLS_18({
164
170
  ...{ 'onCallAgain': {} },
165
171
  ...{ 'onResend': {} },
172
+ ...{ 'onMessageClick': {} },
166
173
  message: (item),
167
174
  responsive: (__VLS_ctx.responsive),
168
175
  isMyMessage: (item.sender_id == __VLS_ctx.dataProfile?.id),
@@ -173,6 +180,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
173
180
  isChatFinished: (__VLS_ctx.isChatFinished(index)),
174
181
  isChatStart: (__VLS_ctx.isChatStart(index)),
175
182
  isStartNewDate: (__VLS_ctx.isStartNewDate(index)),
183
+ selectedMessageId: (__VLS_ctx.selectedMessageId),
176
184
  }, ...__VLS_functionalComponentArgsRest(__VLS_18));
177
185
  let __VLS_21;
178
186
  let __VLS_22;
@@ -180,7 +188,7 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
180
188
  { onCallAgain: (...[$event]) => {
181
189
  __VLS_ctx.emit('callBack');
182
190
  // @ts-ignore
183
- [data, message, responsive, dataProfile, shouldShowAvatar, isEndMessage, isChatFinished, isChatStart, isStartNewDate, emit,];
191
+ [data, message, responsive, dataProfile, shouldShowAvatar, isEndMessage, isChatFinished, isChatStart, isStartNewDate, selectedMessageId, emit,];
184
192
  } });
185
193
  const __VLS_24 = ({ resend: {} },
186
194
  { onResend: (...[$event]) => {
@@ -188,6 +196,12 @@ for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.message))) {
188
196
  // @ts-ignore
189
197
  [emit,];
190
198
  } });
199
+ const __VLS_25 = ({ messageClick: {} },
200
+ { onMessageClick: (...[$event]) => {
201
+ __VLS_ctx.handleMessageClick(item);
202
+ // @ts-ignore
203
+ [handleMessageClick,];
204
+ } });
191
205
  var __VLS_20;
192
206
  }
193
207
  var __VLS_16;
@@ -11,12 +11,15 @@ type Props = {
11
11
  isChatStart: boolean;
12
12
  isStartNewDate: boolean;
13
13
  data: IResUser | null;
14
+ selectedMessageId: any;
14
15
  };
15
16
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
16
17
  callAgain: () => any;
17
18
  resend: () => any;
19
+ messageClick: () => any;
18
20
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
19
21
  onCallAgain?: (() => any) | undefined;
20
22
  onResend?: (() => any) | undefined;
23
+ onMessageClick?: (() => any) | undefined;
21
24
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
25
  export default _default;
@@ -141,6 +141,11 @@ const copyToClipboard = async (text) => {
141
141
  return false;
142
142
  }
143
143
  };
144
+ const handleMessageClick = () => {
145
+ if (props.responsive == 'mobile') {
146
+ emit('messageClick');
147
+ }
148
+ };
144
149
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
145
150
  const __VLS_defaults = {};
146
151
  const __VLS_ctx = {
@@ -230,6 +235,7 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
230
235
  }
231
236
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({});
232
237
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
238
+ ...{ onClick: (__VLS_ctx.handleMessageClick) },
233
239
  ...{ class: "px-3 py-2 rounded-2xl text-left w-max relative" },
234
240
  ...{ class: ({
235
241
  'rounded-tl-[6px]': !__VLS_ctx.isChatStart && !__VLS_ctx.isMyMessage,
@@ -246,7 +252,7 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
246
252
  }) },
247
253
  });
248
254
  // @ts-ignore
249
- [message, message, message, message, message, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, responsive, responsive, isChatStart, isChatStart, isChatFinished, isChatFinished,];
255
+ [message, message, message, message, message, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, isMyMessage, responsive, responsive, handleMessageClick, isChatStart, isChatStart, isChatFinished, isChatFinished,];
250
256
  if (__VLS_ctx.popoverContent.length) {
251
257
  // @ts-ignore
252
258
  [popoverContent,];
@@ -258,7 +264,7 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
258
264
  side: "bottom",
259
265
  align: (__VLS_ctx.isMyMessage ? 'end' : 'start'),
260
266
  ...{ class: "" },
261
- triggerClass: (`absolute w-6 opacity-0 group-hover:opacity-[1] bottom-1/2 translate-y-1/2 ${__VLS_ctx.isMyMessage ? '-left-10 ' : '-right-10'}`),
267
+ triggerClass: (`absolute w-6 opacity-0 group-hover:opacity-[1] bottom-1/2 translate-y-1/2 ${__VLS_ctx.isMyMessage ? '-left-10 ' : '-right-10'} ${__VLS_ctx.selectedMessageId == __VLS_ctx.message.id ? 'opacity-[1]' : ''}`),
262
268
  contentClass: "min-w-0",
263
269
  }));
264
270
  const __VLS_5 = __VLS_4({
@@ -267,12 +273,12 @@ if (__VLS_ctx.message.state != __VLS_ctx.MessageState.Sending || __VLS_ctx.isMyM
267
273
  side: "bottom",
268
274
  align: (__VLS_ctx.isMyMessage ? 'end' : 'start'),
269
275
  ...{ class: "" },
270
- triggerClass: (`absolute w-6 opacity-0 group-hover:opacity-[1] bottom-1/2 translate-y-1/2 ${__VLS_ctx.isMyMessage ? '-left-10 ' : '-right-10'}`),
276
+ triggerClass: (`absolute w-6 opacity-0 group-hover:opacity-[1] bottom-1/2 translate-y-1/2 ${__VLS_ctx.isMyMessage ? '-left-10 ' : '-right-10'} ${__VLS_ctx.selectedMessageId == __VLS_ctx.message.id ? 'opacity-[1]' : ''}`),
271
277
  contentClass: "min-w-0",
272
278
  }, ...__VLS_functionalComponentArgsRest(__VLS_4));
273
279
  const { default: __VLS_7 } = __VLS_6.slots;
274
280
  // @ts-ignore
275
- [isMyMessage, isMyMessage, popoverOpen,];
281
+ [message, isMyMessage, isMyMessage, popoverOpen, selectedMessageId,];
276
282
  __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
277
283
  ...{ class: "w-8 h-8 rotate-90 rounded-full bg-[#f1f5f9] flex-center shadow-3xl" },
278
284
  });