bfg-common 1.2.56 → 1.2.58

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,247 +1,260 @@
1
- <template>
2
- <div v-if="props.show" id="feedbackId" class="modal">
3
- <div
4
- id="feedback-modal-dialog-Id"
5
- :class="['modal-dialog', { imageDrawn: isFeedbackImageDrawn }]"
6
- :style="{
7
- width: computeWidth,
8
- height: computeHeight,
9
- }"
10
- >
11
- <div class="modal-content">
12
- <div class="modal-header">
13
- <div class="flex-align-center">
14
- <h3 class="modal-title">
15
- {{ props.title }}
16
- </h3>
17
- </div>
18
- <button v-if="!props.isHideCloseIcon" id="feedback-modal-close-icon" class="close" @click="hide">
19
- <atoms-the-icon class="close-icon" name="close" />
20
- </button>
21
- </div>
22
-
23
- <common-feedback-buttons
24
- v-model:select="selectedTab"
25
- :items="tabsItems"
26
- />
27
- <div class="modal-body">
28
- <common-feedback-message
29
- v-show="selectedTab !== 2"
30
- v-model:description="description"
31
- v-model:email="email"
32
- :selected-tab="selectedTab"
33
- @screen-shot="onScreenShot"
34
- />
35
- <common-feedback-visit-portal v-show="selectedTab === 2" />
36
- </div>
37
- <div
38
- :class="{
39
- 'modal-footer': selectedTab !== 2,
40
- 'modal-no-footer': selectedTab === 2,
41
- }"
42
- >
43
- <button id="feedback-modal-cancel-button" class="btn btn-outline" @click="hide">
44
- {{ localization.cancel }}
45
- </button>
46
- <button
47
- class="btn btn-outline"
48
- :class="props.loading && 'modal-dialog__loader'"
49
- :disabled="!description"
50
- @click="submit"
51
- >
52
- <atoms-loader-pre-loader
53
- v-if="props.loading"
54
- id="loader"
55
- class="absolute-center button__loading"
56
- :show="props.loading"
57
- />
58
- <span v-else>
59
- {{ localization.send }}
60
- </span>
61
- </button>
62
- </div>
63
- </div>
64
- </div>
65
- <div class="modal-backdrop" />
66
- </div>
67
- </template>
68
-
69
- <script setup lang="ts">
70
- import { UI_I_Localization } from '~/models/interfaces'
71
- import {
72
- UI_I_FeedbackButtonsItem,
73
- UI_I_MessageImg,
74
- } from '~/components/common/feedback/models/interfaces'
75
- import { feedbackTabs } from '~/components/common/feedback/config/feedbackTabs'
76
-
77
- const props = defineProps<{
78
- show: boolean
79
- title: string
80
- width?: string
81
- height?: string
82
- submitText?: string
83
- loading?: boolean
84
- isHideCloseIcon?: boolean
85
- }>()
86
- const emits = defineEmits<{
87
- (event: 'submit', value: any): void
88
- (event: 'hide'): void
89
- }>()
90
-
91
- const localization = computed<UI_I_Localization>(() => useLocal())
92
-
93
- const tabsItems = computed<UI_I_FeedbackButtonsItem[]>(() =>
94
- feedbackTabs(localization.value)
95
- )
96
- const hide = (): void => {
97
- emits('hide')
98
-
99
- email.value = ''
100
- description.value = ''
101
- selectedTab.value = null
102
- }
103
-
104
- const submit = (): void => {
105
- const canvas = document.getElementById('feedbackImg') as HTMLCanvasElement
106
-
107
- emits('submit', {
108
- type: selectedTab.value,
109
- description: description.value,
110
- email: email.value,
111
- image: canvas?.toDataURL() || ''
112
- })
113
- description.value = ''
114
- selectedTab.value = null
115
- }
116
- const computeWidth = computed<string | undefined>(() =>
117
- isFeedbackImageDrawn.value && selectedTab.value !== 2
118
- ? feedbackImageDrawnWidth.value
119
- : props.width
120
- )
121
- const computeHeight = computed<string>(() =>
122
- !isFeedbackImageDrawn.value && selectedTab.value !== 2
123
- ? ''
124
- : selectedTab.value !== 2
125
- ? '100%'
126
- : '420px'
127
- )
128
- const isFeedbackImageDrawn = ref<boolean>(false)
129
- const feedbackImageDrawnWidth = ref<string>('')
130
- const selectedTab = ref<number | null>(null)
131
- const description = ref<string>('')
132
- const email = ref<string>('')
133
-
134
- const onScreenShot = (value: UI_I_MessageImg): void => {
135
- isFeedbackImageDrawn.value = value.hasTakeScreenshot
136
- feedbackImageDrawnWidth.value = value.width
137
- }
138
-
139
- </script>
140
-
141
- <style scoped lang="scss">
142
- .modal {
143
- position: fixed;
144
- top: 0;
145
- bottom: 0;
146
- right: 0;
147
- left: 0;
148
- z-index: 1050;
149
- display: flex;
150
- flex-direction: column;
151
- justify-content: center;
152
- align-items: center;
153
- padding: 48px;
154
- overflow-y: auto;
155
- overflow-x: auto;
156
-
157
- .modal-dialog {
158
- .modal-content {
159
- position: relative;
160
- display: flex;
161
- flex-direction: column;
162
- background-color: var(--modal-bg-color);
163
- box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
164
- border: 1px solid rgba(0, 0, 0, 0.2);
165
- border-radius: 3px;
166
- background-clip: padding-box;
167
- padding: 24px;
168
- height: 100%;
169
- -webkit-animation-name: animateTop;
170
- -webkit-animation-duration: 0.4s;
171
- animation-name: animateTop;
172
- animation-duration: 0.4s;
173
- overflow-x: auto;
174
-
175
- .modal-header {
176
- display: flex;
177
- justify-content: space-between;
178
- align-items: flex-start;
179
-
180
- .modal-title {
181
- color: var(--main-color-mode);
182
- }
183
-
184
- .close-icon {
185
- fill: var(--close-icon);
186
- width: 24px;
187
- height: 24px;
188
- }
189
- }
190
- .modal-info {
191
- display: flex;
192
- flex-direction: row;
193
- align-items: center;
194
- margin-bottom: 20px;
195
-
196
- :deep(.icon-info-standart) {
197
- width: 20px !important;
198
- min-width: 20px !important;
199
- height: 20px;
200
- min-height: 20px;
201
- }
202
- .info-icon {
203
- height: 24px;
204
- }
205
- .info-text {
206
- margin-left: 5px;
207
- }
208
- }
209
- .modal-footer {
210
- align-items: flex-end;
211
- margin-top: auto;
212
- .btn:last-child {
213
- margin-left: 5px;
214
- }
215
- }
216
- .modal-no-footer {
217
- opacity: 0;
218
- width: 200px;
219
- height: 60px;
220
- }
221
- }
222
- &__loader {
223
- position: relative;
224
- pointer-events: none;
225
- }
226
- }
227
-
228
- .modal-backdrop {
229
- opacity: 1;
230
- background-color: rgba(0, 0, 0, 0.6);
231
- }
232
- .button {
233
- &__loading {
234
- display: flex;
235
- :deep(.spinner) {
236
- width: 25px;
237
- height: 25px;
238
- min-width: 25px;
239
- min-height: 25px;
240
- }
241
- }
242
- }
243
- }
244
- .imageDrawn {
245
- width: auto;
246
- }
247
- </style>
1
+ <template>
2
+ <div v-if="props.show" id="feedbackId" class="modal">
3
+ <div
4
+ id="feedback-modal-dialog-Id"
5
+ :class="['modal-dialog', { imageDrawn: isFeedbackImageDrawn }]"
6
+ :style="{
7
+ width: computeWidth,
8
+ height: computeHeight,
9
+ }"
10
+ >
11
+ <div class="modal-content">
12
+ <div class="modal-header">
13
+ <div class="flex-align-center">
14
+ <h3 class="modal-title">
15
+ {{ props.title }}
16
+ </h3>
17
+ </div>
18
+ <button
19
+ v-if="!props.isHideCloseIcon"
20
+ id="feedback-modal-close-icon"
21
+ class="close"
22
+ @click="hide"
23
+ >
24
+ <atoms-the-icon class="close-icon" name="close" />
25
+ </button>
26
+ </div>
27
+
28
+ <common-feedback-buttons v-model:select="type" :items="tabsItems" />
29
+ <div class="modal-body">
30
+ <common-feedback-message
31
+ v-show="type !== 2"
32
+ v-model:description="description"
33
+ v-model:email="email"
34
+ :selected-tab="type"
35
+ @screen-shot="onScreenShot"
36
+ />
37
+ <common-feedback-visit-portal v-show="type === 2" />
38
+ </div>
39
+ <div
40
+ :class="{
41
+ 'modal-footer': type !== 2,
42
+ 'modal-no-footer': type === 2,
43
+ }"
44
+ >
45
+ <button
46
+ id="feedback-modal-cancel-button"
47
+ class="btn btn-outline"
48
+ @click="hide"
49
+ >
50
+ {{ localization.cancel }}
51
+ </button>
52
+ <button
53
+ class="btn btn-outline"
54
+ :class="props.loading && 'modal-dialog__loader'"
55
+ :disabled="!description"
56
+ @click="submit"
57
+ >
58
+ <atoms-loader-pre-loader
59
+ v-if="props.loading"
60
+ id="loader"
61
+ class="absolute-center button__loading"
62
+ :show="props.loading"
63
+ />
64
+ <span v-else>
65
+ {{ localization.send }}
66
+ </span>
67
+ </button>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ <div class="modal-backdrop" />
72
+ </div>
73
+ </template>
74
+
75
+ <script setup lang="ts">
76
+ import { UI_I_Localization } from '~/models/interfaces'
77
+ import {
78
+ UI_I_FeedbackButtonsItem,
79
+ UI_I_FeedbackForm,
80
+ UI_I_MessageImg,
81
+ } from '~/components/common/feedback/models/interfaces'
82
+ import { UI_T_FeedbackType } from '~/components/common/feedback/models/types'
83
+ import { feedbackTabs } from '~/components/common/feedback/config/feedbackTabs'
84
+
85
+ const props = defineProps<{
86
+ show: boolean
87
+ title: string
88
+ width?: string
89
+ height?: string
90
+ submitText?: string
91
+ loading?: boolean
92
+ isHideCloseIcon?: boolean
93
+ }>()
94
+ const emits = defineEmits<{
95
+ (event: 'submit', value: UI_I_FeedbackForm): void
96
+ (event: 'hide'): void
97
+ }>()
98
+
99
+ const localization = computed<UI_I_Localization>(() => useLocal())
100
+
101
+ const tabsItems = computed<UI_I_FeedbackButtonsItem[]>(() =>
102
+ feedbackTabs(localization.value)
103
+ )
104
+ const reset = (): void => {
105
+ email.value = ''
106
+ description.value = ''
107
+ type.value = undefined
108
+ }
109
+ const hide = (): void => {
110
+ emits('hide')
111
+
112
+ reset()
113
+ }
114
+
115
+ const submit = (): void => {
116
+ if (type.value !== 0 && type.value !== 1) return
117
+
118
+ const canvas = document.getElementById('feedbackImg') as HTMLCanvasElement
119
+
120
+ const image = canvas?.toDataURL().match(/base64,(.+)/)?.[1] || ''
121
+ emits('submit', {
122
+ image,
123
+ type: type.value,
124
+ description: description.value,
125
+ email: email.value,
126
+ })
127
+
128
+ reset()
129
+ }
130
+ const computeWidth = computed<string | undefined>(() =>
131
+ isFeedbackImageDrawn.value && type.value !== 2
132
+ ? feedbackImageDrawnWidth.value
133
+ : props.width
134
+ )
135
+ const computeHeight = computed<string>(() =>
136
+ !isFeedbackImageDrawn.value && type.value !== 2
137
+ ? ''
138
+ : type.value !== 2
139
+ ? '100%'
140
+ : '420px'
141
+ )
142
+ const isFeedbackImageDrawn = ref<boolean>(false)
143
+ const feedbackImageDrawnWidth = ref<string>('')
144
+ const type = ref<UI_T_FeedbackType>(undefined)
145
+ const description = ref<string>('')
146
+ const email = ref<string>('')
147
+
148
+ const onScreenShot = (value: UI_I_MessageImg): void => {
149
+ isFeedbackImageDrawn.value = value.hasTakeScreenshot
150
+ feedbackImageDrawnWidth.value = value.width
151
+ }
152
+ </script>
153
+
154
+ <style scoped lang="scss">
155
+ .modal {
156
+ position: fixed;
157
+ top: 0;
158
+ bottom: 0;
159
+ right: 0;
160
+ left: 0;
161
+ z-index: 1050;
162
+ display: flex;
163
+ flex-direction: column;
164
+ justify-content: center;
165
+ align-items: center;
166
+ padding: 48px;
167
+ overflow-y: auto;
168
+ overflow-x: auto;
169
+
170
+ .modal-dialog {
171
+ .modal-content {
172
+ position: relative;
173
+ display: flex;
174
+ flex-direction: column;
175
+ background-color: var(--modal-bg-color);
176
+ box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
177
+ border: 1px solid rgba(0, 0, 0, 0.2);
178
+ border-radius: 3px;
179
+ background-clip: padding-box;
180
+ padding: 24px;
181
+ height: 100%;
182
+ -webkit-animation-name: animateTop;
183
+ -webkit-animation-duration: 0.4s;
184
+ animation-name: animateTop;
185
+ animation-duration: 0.4s;
186
+ overflow-x: auto;
187
+
188
+ .modal-header {
189
+ display: flex;
190
+ justify-content: space-between;
191
+ align-items: flex-start;
192
+
193
+ .modal-title {
194
+ color: var(--main-color-mode);
195
+ }
196
+
197
+ .close-icon {
198
+ fill: var(--close-icon);
199
+ width: 24px;
200
+ height: 24px;
201
+ }
202
+ }
203
+ .modal-info {
204
+ display: flex;
205
+ flex-direction: row;
206
+ align-items: center;
207
+ margin-bottom: 20px;
208
+
209
+ :deep(.icon-info-standart) {
210
+ width: 20px !important;
211
+ min-width: 20px !important;
212
+ height: 20px;
213
+ min-height: 20px;
214
+ }
215
+ .info-icon {
216
+ height: 24px;
217
+ }
218
+ .info-text {
219
+ margin-left: 5px;
220
+ }
221
+ }
222
+ .modal-footer {
223
+ align-items: flex-end;
224
+ margin-top: auto;
225
+ .btn:last-child {
226
+ margin-left: 5px;
227
+ }
228
+ }
229
+ .modal-no-footer {
230
+ opacity: 0;
231
+ width: 200px;
232
+ height: 60px;
233
+ }
234
+ }
235
+ &__loader {
236
+ position: relative;
237
+ pointer-events: none;
238
+ }
239
+ }
240
+
241
+ .modal-backdrop {
242
+ opacity: 1;
243
+ background-color: rgba(0, 0, 0, 0.6);
244
+ }
245
+ .button {
246
+ &__loading {
247
+ display: flex;
248
+ :deep(.spinner) {
249
+ width: 25px;
250
+ height: 25px;
251
+ min-width: 25px;
252
+ min-height: 25px;
253
+ }
254
+ }
255
+ }
256
+ }
257
+ .imageDrawn {
258
+ width: auto;
259
+ }
260
+ </style>
@@ -5,7 +5,7 @@
5
5
  <textarea
6
6
  id="feedback-message-textarea"
7
7
  v-model="descriptionLocal"
8
- :disabled="!props.selectedTab"
8
+ :disabled="props.type === null"
9
9
  class="clr-textarea ng-pristine ng-invalid ng-touched textarea"
10
10
  :placeholder="descriptionTextPlaceholder"
11
11
  ></textarea>
@@ -14,7 +14,7 @@
14
14
  <span class="text">{{ localization.emailAddress }} </span>
15
15
  <input
16
16
  id="feedback-email-input"
17
- v-model="email"
17
+ v-model="emailLocal"
18
18
  type="email"
19
19
  class="email"
20
20
  :placeholder="localization.optionalInCaseWeNeed"
@@ -136,7 +136,7 @@ import { UI_I_Localization } from '~/models/interfaces'
136
136
  import { UI_I_MessageImg } from '~/components/common/feedback/models/interfaces'
137
137
 
138
138
  const props = defineProps<{
139
- selectedTab: number | null
139
+ type: 0 | 1 | 2 | null
140
140
  description: string
141
141
  email: string
142
142
  }>()
@@ -154,7 +154,7 @@ const descriptionLocal = computed<string>({
154
154
  emits('update:description', value)
155
155
  },
156
156
  })
157
- const email = computed<string>({
157
+ const emailLocal = computed<string>({
158
158
  get() {
159
159
  return props.email
160
160
  },
@@ -166,8 +166,8 @@ const localization = computed<UI_I_Localization>(() => useLocal())
166
166
  // const drawingPanel = computed(() => drawingPanelFunc(localization.value))
167
167
 
168
168
  const descriptionTextPlaceholder = computed<string>(() => {
169
- if (props.selectedTab === 0) return localization.value.whatIsTheProblemHowCan
170
- if (props.selectedTab === 1) return localization.value.tellUsWhatYouEnjoyedSo
169
+ if (props.type === 0) return localization.value.whatIsTheProblemHowCan
170
+ if (props.type === 1) return localization.value.tellUsWhatYouEnjoyedSo
171
171
  return localization.value.selectFeedbackType
172
172
  })
173
173
  const hasTakeScreenshot = ref<boolean>(false)
@@ -8,8 +8,12 @@ export interface UI_I_MessageImg {
8
8
  width: string
9
9
  }
10
10
  export interface UI_I_DrawingItem {
11
-
12
11
  function: string
13
12
  text: string
14
-
13
+ }
14
+ export interface UI_I_FeedbackForm {
15
+ type: 0 | 1 // 0 problem, 1 complement
16
+ description: string
17
+ email: string
18
+ image: string // base64
15
19
  }
@@ -0,0 +1 @@
1
+ export type UI_T_FeedbackType = 0 | 1 | 2 | undefined // 0 problem, 1 complement, 2 idea
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.2.56",
4
+ "version": "1.2.58",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",