bfg-common 1.4.390 → 1.4.391

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.
@@ -1,4 +1,5 @@
1
1
  import type { UI_I_FeedbackForm } from '~/components/common/feedback/lib/models/interfaces'
2
+ // import type { UI_I_FeedbackCanvasOptions } from '~/components/common/layout/theHeader/feedback/new/lib/models/interfaces'
2
3
  export const feedbackDefaultFormFunc = (): UI_I_FeedbackForm => {
3
4
  return {
4
5
  description: '',
@@ -7,3 +8,10 @@ export const feedbackDefaultFormFunc = (): UI_I_FeedbackForm => {
7
8
  image: '', // base64
8
9
  }
9
10
  }
11
+
12
+ // export const feedbackCanvasDefaultOptions = (): UI_I_FeedbackCanvasOptions => {
13
+ // return {
14
+ // isAnnotateImage: false,
15
+ // hasTakeScreenshot: false,
16
+ // }
17
+ // }
@@ -4,38 +4,44 @@
4
4
  show
5
5
  width="560px"
6
6
  test-id="feedback-modal"
7
- :title="localization.common.sendFeedback"
7
+ :title="title"
8
8
  class="feedback"
9
9
  @hide="onHideModal"
10
10
  >
11
11
  <template #content>
12
12
  <ui-modal-block-standard>
13
- <common-layout-the-header-feedback-new-subtitle />
13
+ <template v-if="!options.isAnnotateImage">
14
+ <common-layout-the-header-feedback-new-subtitle />
14
15
 
15
- <common-layout-the-header-feedback-new-tabs
16
- v-model="selectedTab"
17
- class="metrics-tabs"
18
- />
19
-
20
- <div
21
- v-if="selectedTab === 'light-bulb'"
22
- class="feedback__visit-portal"
23
- >
24
- {{ localization.common.useOurExternalIdeasPortal }}
25
- </div>
26
-
27
- <template v-else>
28
- <common-layout-the-header-feedback-new-description
29
- v-model="feedbackForm.description"
30
- v-model:is-valid="isValidForm"
31
- :selected-tab="selectedTab"
16
+ <common-layout-the-header-feedback-new-tabs
17
+ v-model="selectedTab"
18
+ class="metrics-tabs"
32
19
  />
33
20
 
34
- <common-layout-the-header-feedback-new-email
35
- v-model="feedbackForm.email"
36
- />
21
+ <div
22
+ v-if="selectedTab === 'light-bulb'"
23
+ class="feedback__visit-portal"
24
+ >
25
+ {{ localization.common.useOurExternalIdeasPortal }}
26
+ </div>
27
+ </template>
37
28
 
38
- <common-layout-the-header-feedback-new-additional-details />
29
+ <template v-if="selectedTab !== 'light-bulb'">
30
+ <template v-if="!options.isAnnotateImage">
31
+ <common-layout-the-header-feedback-new-description
32
+ v-model="feedbackForm.description"
33
+ v-model:is-valid="isValidForm"
34
+ :selected-tab="selectedTab"
35
+ />
36
+
37
+ <common-layout-the-header-feedback-new-email
38
+ v-model="feedbackForm.email"
39
+ />
40
+ </template>
41
+
42
+ <common-layout-the-header-feedback-new-additional-details
43
+ v-model="options"
44
+ />
39
45
  </template>
40
46
  </ui-modal-block-standard>
41
47
  </template>
@@ -57,7 +63,7 @@
57
63
  <ui-button
58
64
  test-id="feedback-modal-submit-btn"
59
65
  size="md"
60
- :disabled="!selectedTab"
66
+ :disabled="isDisabledButton"
61
67
  min-width="96px"
62
68
  @click="onSubmit"
63
69
  >
@@ -80,6 +86,7 @@
80
86
  import type { UI_I_Localization } from '~/lib/models/interfaces'
81
87
  import type { UI_I_FeedbackForm } from '~/components/common/feedback/lib/models/interfaces'
82
88
  import type { UI_T_FeedbackTab } from '~/components/common/layout/theHeader/feedback/new/tabs/lib/models/types'
89
+ import type { UI_I_FeedbackCanvasOptions } from '~/components/common/layout/theHeader/feedback/new/lib/models/interfaces'
83
90
 
84
91
  const feedbackForm = defineModel<UI_I_FeedbackForm>({ required: true })
85
92
  const emits = defineEmits<{
@@ -89,17 +96,40 @@ const emits = defineEmits<{
89
96
 
90
97
  const localization = computed<UI_I_Localization>(() => useLocal())
91
98
 
92
- const isValidForm = ref<boolean>(true)
93
99
  const selectedTab = ref<UI_T_FeedbackTab>()
100
+ const isValidForm = ref<boolean>(true)
101
+ const options = ref<UI_I_FeedbackCanvasOptions>({
102
+ isAnnotateImage: false,
103
+ hasTakeScreenshot: false,
104
+ })
105
+
106
+ const title = computed<string>(() => {
107
+ const { common, feedback } = localization.value
108
+
109
+ return !options.value.isAnnotateImage
110
+ ? common.sendFeedback
111
+ : options.value.hasTakeScreenshot
112
+ ? feedback.annotateScreenshot
113
+ : feedback.annotateImage
114
+ })
115
+ const modalFooterButtonNames = computed<string>(() => {
116
+ const { visitIdeasPortal, send, save } = localization.value.common
117
+
118
+ return options.value.isAnnotateImage
119
+ ? save
120
+ : selectedTab.value === 'light-bulb'
121
+ ? visitIdeasPortal
122
+ : send
123
+ })
94
124
 
95
- const modalFooterButtonNames = computed(() => {
96
- return selectedTab.value === 'light-bulb'
97
- ? localization.value.common.visitIdeasPortal
98
- : localization.value.common.send
125
+ const isDisabledButton = computed<boolean>(() => {
126
+ return !options.value.isAnnotateImage && !selectedTab.value
99
127
  })
100
128
 
101
129
  const onHideModal = (): void => {
102
- emits('hide')
130
+ !options.value.isAnnotateImage
131
+ ? emits('hide')
132
+ : (options.value.isAnnotateImage = false)
103
133
  }
104
134
  const onSubmit = (): void => {
105
135
  if (selectedTab.value === 'light-bulb') {
@@ -1,16 +1,21 @@
1
1
  <template>
2
2
  <div class="additional-details">
3
- <common-layout-the-header-feedback-new-additional-details-headline />
3
+ <template v-if="!optionsModel.isAnnotateImage">
4
+ <common-layout-the-header-feedback-new-additional-details-headline />
4
5
 
5
- <ui-alert
6
- v-if="hasTakeScreenshot"
7
- test-id="additional-details-info-alert"
8
- :messages="[localization.common.screenshotQualityMayVary]"
9
- type="info"
10
- class="additional-details__alert"
11
- ></ui-alert>
6
+ <ui-alert
7
+ v-if="optionsModel.hasTakeScreenshot"
8
+ test-id="additional-details-info-alert"
9
+ :messages="[localization.common.screenshotQualityMayVary]"
10
+ type="info"
11
+ class="additional-details__alert"
12
+ ></ui-alert>
13
+ </template>
12
14
 
13
- <div v-if="!hasTakeScreenshot" class="flex gap-4 button-container">
15
+ <div
16
+ v-if="!optionsModel.hasTakeScreenshot"
17
+ class="flex gap-4 button-container"
18
+ >
14
19
  <ui-button
15
20
  test-id="feedback-take-screenshot-btn"
16
21
  size="md"
@@ -61,7 +66,10 @@
61
66
  id="feedbackImgWrap"
62
67
  ref="feedbackImgWrap"
63
68
  class="preview-container"
64
- :class="!hasTakeScreenshot && 'disabled'"
69
+ :class="{
70
+ disabled: !optionsModel.hasTakeScreenshot,
71
+ annotate: optionsModel.isAnnotateImage,
72
+ }"
65
73
  >
66
74
  <div class="preview-container__backdrop">
67
75
  <div>
@@ -71,6 +79,7 @@
71
79
  type="default"
72
80
  variant="outline"
73
81
  class=""
82
+ @click="onAnnotateImage"
74
83
  >
75
84
  <ui-icon
76
85
  name="annotate-icon"
@@ -112,14 +121,15 @@
112
121
  <script lang="ts" setup>
113
122
  import html2canvas from 'html2canvas'
114
123
  import type { UI_I_Localization } from '~/lib/models/interfaces'
124
+ import type { UI_I_FeedbackCanvasOptions } from '~/components/common/layout/theHeader/feedback/new/lib/models/interfaces'
115
125
 
116
- const localization = computed<UI_I_Localization>(() => useLocal())
117
-
126
+ const optionsModel = defineModel<UI_I_FeedbackCanvasOptions>({ required: true })
118
127
  const emits = defineEmits<{
119
128
  (event: 'screen-shot', value: any): void
120
129
  }>()
121
130
 
122
- const hasTakeScreenshot = ref<boolean>(false)
131
+ const localization = computed<UI_I_Localization>(() => useLocal())
132
+
123
133
  const isFileLoad = ref(null)
124
134
  const feedbackImgWrap = ref()
125
135
  const feedbackImg = ref()
@@ -133,9 +143,8 @@ const indexArray = ref<number>(0) // index of feedbackImg itself
133
143
  // let drawWidth = ''
134
144
 
135
145
  const onTakeScreenshot = (): void => {
136
- hasTakeScreenshot.value = true
146
+ optionsModel.value.hasTakeScreenshot = true
137
147
  const value = {
138
- hasTakeScreenshot: true,
139
148
  width: window.outerWidth + 'px',
140
149
  }
141
150
 
@@ -177,7 +186,7 @@ const onTakeScreenshot = (): void => {
177
186
  })
178
187
  }
179
188
  const onUploadFile = (): void => {
180
- hasTakeScreenshot.value = true
189
+ optionsModel.value.hasTakeScreenshot = true
181
190
  if (!isFileLoad.value) return
182
191
 
183
192
  const isFileRead = new FileReader()
@@ -204,7 +213,6 @@ const onUploadFile = (): void => {
204
213
  )
205
214
  )
206
215
  const value = {
207
- hasTakeScreenshot: true,
208
216
  width: window.outerWidth + 'px',
209
217
  }
210
218
  emits('screen-shot', value)
@@ -223,7 +231,7 @@ const onUploadFile = (): void => {
223
231
  }
224
232
 
225
233
  const onRemoveScreenshot = (): void => {
226
- hasTakeScreenshot.value = false
234
+ optionsModel.value.hasTakeScreenshot = false
227
235
  const parentMain = document.getElementById('feedbackId')
228
236
  const parentModalDialog = document.getElementById('feedback-modal-dialog-Id')
229
237
  if (!parentMain || !parentModalDialog) return
@@ -238,7 +246,6 @@ const onRemoveScreenshot = (): void => {
238
246
  feedbackImgWrap.value.style.width = 0 + 'px'
239
247
  feedbackImgWrap.value.style.height = 0 + 'px'
240
248
  const value = {
241
- hasTakeScreenshot: false,
242
249
  width: memoryParentModalDialog.value,
243
250
  }
244
251
  emits('screen-shot', value)
@@ -256,6 +263,9 @@ const clearAll = (): void => {
256
263
  context.putImageData(drawingArray[indexArray.value], 0, 0)
257
264
  }
258
265
  }
266
+ const onAnnotateImage = (): void => {
267
+ optionsModel.value.isAnnotateImage = true
268
+ }
259
269
  </script>
260
270
 
261
271
  <style lang="scss" scoped>
@@ -325,7 +335,7 @@ const clearAll = (): void => {
325
335
  }
326
336
  }
327
337
 
328
- &:hover &__backdrop {
338
+ &:hover:not(&.annotate) &__backdrop {
329
339
  display: flex;
330
340
  align-items: center;
331
341
  justify-content: center;
@@ -0,0 +1,4 @@
1
+ export interface UI_I_FeedbackCanvasOptions {
2
+ isAnnotateImage: boolean
3
+ hasTakeScreenshot: boolean
4
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.390",
4
+ "version": "1.4.391",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -35,7 +35,7 @@
35
35
  "@vueuse/components": "^10.1.2",
36
36
  "date-fns": "^2.29.3",
37
37
  "bfg-nuxt-3-graph": "1.0.15",
38
- "bfg-uikit": "1.0.192",
38
+ "bfg-uikit": "1.0.193",
39
39
  "html2canvas": "^1.4.1",
40
40
  "prettier-eslint": "^15.0.1"
41
41
  }