bfg-common 1.4.826 → 1.4.827

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,131 +1,90 @@
1
1
  <template>
2
- <atoms-modal
3
- show
4
- :test-id="`${props.testId}-modal`"
5
- :width="props.width"
6
- class="confirm-by-input"
2
+ <common-modals-confirm-by-input-new
3
+ v-if="isNewViewLocal"
4
+ :modal-texts="props.modalTexts"
5
+ :test-id="props.testId"
6
+ @hide="emits('hide')"
7
+ @confirm="emits('confirm')"
8
+ />
9
+ <common-modals-confirm-by-input-old
10
+ v-else
7
11
  :title="props.title"
8
- :second-title="props.subTitle"
12
+ :sub-title="props.subTitle"
13
+ :test-id="props.testId"
9
14
  :loading="props.loading"
10
- is-hide-close-icon
11
- @submit="onConfirm"
15
+ :width="props.width"
16
+ @hide="emits('hide')"
17
+ @confirm="emits('confirm')"
12
18
  >
13
- <template #modalBody>
14
- <div class="confirm-by-input__body">
15
- <atoms-the-icon
16
- name="exclamation-triangle"
17
- class="confirm-by-input__icon"
18
- />
19
-
20
- <div>
21
- <slot name="content"></slot>
22
-
23
- <div class="form-group">
24
- <label class="no-selection" for="confirmation">{{
25
- confirmationText
26
- }}</label>
27
- <div class="form-group__input">
28
- <input
29
- id="confirmation"
30
- v-model="confirmationForm"
31
- data-id="confirmation-input"
32
- type="text"
33
- autocomplete="off"
34
- @keyup.enter="onConfirm"
35
- />
36
- <div v-show="!isValid && confirmationForm" class="form-validate">
37
- <atoms-tooltip :test-id="`${props.testId}-tooltip`">
38
- <template #elem>
39
- <atoms-the-icon
40
- class="is-error tooltip-trigger"
41
- name="info"
42
- width="28px"
43
- height="28px"
44
- />
45
- </template>
46
- <template #content>
47
- {{ confirmDeletionInputError }}
48
- </template>
49
- </atoms-tooltip>
50
- </div>
51
- </div>
52
- </div>
53
- </div>
54
- </div>
19
+ <template #content>
20
+ <slot name="content" />
55
21
  </template>
56
- <template #modalFooter>
57
- <button
58
- id="confirm-by-input-modal-close-button"
59
- :data-id="`${props.testId}-modal-close-button`"
60
- class="btn btn-outline"
61
- @click="onHide"
62
- >
63
- {{ localization.common.no }}
64
- </button>
65
- <button
66
- id="confirm-by-input-modal-apply-button"
67
- :data-id="`${props.testId}-modal-apply-button`"
68
- class="btn btn-primary"
69
- :class="props.loading && 'modal-dialog__loader'"
70
- :disabled="!isValid || props.loading"
71
- @click="onConfirm"
72
- >
73
- <atoms-loader-pre-loader
74
- v-if="props.loading"
75
- id="loader"
76
- :show="props.loading"
77
- class="button__loading"
78
- :test-id="`${props.testId}-spinner`"
79
- />
80
- <span v-else>
81
- {{ localization.common.yes }}
82
- </span>
83
- </button>
84
- </template>
85
- </atoms-modal>
22
+ </common-modals-confirm-by-input-old>
86
23
  </template>
87
24
 
88
25
  <script setup lang="ts">
89
26
  import type { UI_I_Localization } from '~/lib/models/interfaces'
90
-
91
- const props = defineProps<{
92
- title: string
93
- subTitle: string
94
- testId: string
95
- width: string
96
- loading?: boolean
97
- }>()
27
+ import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
28
+
29
+ const props = withDefaults(
30
+ defineProps<{
31
+ isNewView?: boolean
32
+ title?: string
33
+ subTitle?: string
34
+ testId?: string
35
+ loading?: boolean
36
+ width?: string
37
+ modalTexts?: UI_I_ModalTexts
38
+ }>(),
39
+ {
40
+ isNewView: undefined,
41
+ title: '',
42
+ subTitle: '',
43
+ testId: 'common-confirmation',
44
+ loading: false,
45
+ width: '580px',
46
+ modalTexts: {
47
+ button1: 'Cancel',
48
+ button2: 'Remove',
49
+ },
50
+ }
51
+ )
98
52
  const emits = defineEmits<{
99
53
  (event: 'confirm'): void
100
54
  (event: 'hide'): void
101
55
  }>()
102
56
 
103
57
  const localization = computed<UI_I_Localization>(() => useLocal())
58
+ const { $store }: any = useNuxtApp()
59
+
60
+ const isNewViewLocal = computed<boolean>(
61
+ () => props.isNewView ?? $store.getters['main/getIsNewView']
62
+ )
104
63
 
105
64
  const confirmationForm = ref<string>('')
106
65
  const isValid = computed<boolean>(() => {
107
66
  return confirmationForm.value === props.subTitle
108
67
  })
109
68
 
110
- const confirmationText = localization.value.common.confirmDeletionInput.replace(
111
- '{title}',
112
- props.subTitle
113
- )
114
- const confirmDeletionInputError =
115
- localization.value.common.confirmDeletionInputError.replace(
116
- '{title}',
117
- props.subTitle
118
- )
119
-
120
- const onConfirm = async (): Promise<void> => {
121
- if (!isValid.value) return
122
-
123
- emits('confirm')
124
- }
125
-
126
- const onHide = (): void => {
127
- emits('hide')
128
- }
69
+ // const confirmationText = localization.value.common.confirmDeletionInput.replace(
70
+ // '{title}',
71
+ // props.subTitle
72
+ // )
73
+ // const confirmDeletionInputError =
74
+ // localization.value.common.confirmDeletionInputError.replace(
75
+ // '{title}',
76
+ // props.subTitle
77
+ // )
78
+
79
+ // const onConfirm = async (): Promise<void> => {
80
+ // if (!isValid.value) return
81
+ //
82
+ // emits('confirm')
83
+ // }
84
+
85
+ // const onHide = (): void => {
86
+ // emits('hide')
87
+ // }
129
88
  </script>
130
89
 
131
90
  <style lang="scss" scoped>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <ui-popup
3
+ :test-id="props.testId"
4
+ icon-name="info-status"
5
+ :title="props.headline"
6
+ :message="props.description"
7
+ :texts="modalTextsLocal"
8
+ @submit="onSubmit"
9
+ @hide="onHide"
10
+ ></ui-popup>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
15
+
16
+ const props = defineProps<{
17
+ testId: string
18
+ headline: string
19
+ description: string
20
+ modalTexts: UI_I_ModalTexts
21
+ }>()
22
+ const emits = defineEmits<{
23
+ (event: 'confirm'): void
24
+ (event: 'hide-modal'): void
25
+ }>()
26
+
27
+ const modalTextsLocal = computed<UI_I_ModalTexts>(() => props.modalTexts)
28
+
29
+ const onHide = (): void => {
30
+ emits('hide-modal')
31
+ }
32
+ const onSubmit = (): void => {
33
+ emits('confirm')
34
+ }
35
+ </script>
36
+
37
+ <style scoped lang="scss"></style>
@@ -0,0 +1,206 @@
1
+ <template>
2
+ <atoms-modal
3
+ show
4
+ :test-id="`${props.testId}-modal`"
5
+ :width="props.width"
6
+ class="confirm-by-input"
7
+ :title="props.title"
8
+ :second-title="props.subTitle"
9
+ :loading="props.loading"
10
+ is-hide-close-icon
11
+ @submit="onConfirm"
12
+ >
13
+ <template #modalBody>
14
+ <div class="confirm-by-input__body">
15
+ <atoms-the-icon
16
+ name="exclamation-triangle"
17
+ class="confirm-by-input__icon"
18
+ />
19
+
20
+ <div>
21
+ <slot name="content"></slot>
22
+
23
+ <div class="form-group">
24
+ <label class="no-selection" for="confirmation">{{
25
+ confirmationText
26
+ }}</label>
27
+ <div class="form-group__input">
28
+ <input
29
+ id="confirmation"
30
+ v-model="confirmationForm"
31
+ data-id="confirmation-input"
32
+ type="text"
33
+ autocomplete="off"
34
+ @keyup.enter="onConfirm"
35
+ />
36
+ <div v-show="!isValid && confirmationForm" class="form-validate">
37
+ <atoms-tooltip :test-id="`${props.testId}-tooltip`">
38
+ <template #elem>
39
+ <atoms-the-icon
40
+ class="is-error tooltip-trigger"
41
+ name="info"
42
+ width="28px"
43
+ height="28px"
44
+ />
45
+ </template>
46
+ <template #content>
47
+ {{ confirmDeletionInputError }}
48
+ </template>
49
+ </atoms-tooltip>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </template>
56
+ <template #modalFooter>
57
+ <button
58
+ id="confirm-by-input-modal-close-button"
59
+ :data-id="`${props.testId}-modal-close-button`"
60
+ class="btn btn-outline"
61
+ @click="onHide"
62
+ >
63
+ {{ localization.common.no }}
64
+ </button>
65
+ <button
66
+ id="confirm-by-input-modal-apply-button"
67
+ :data-id="`${props.testId}-modal-apply-button`"
68
+ class="btn btn-primary"
69
+ :class="props.loading && 'modal-dialog__loader'"
70
+ :disabled="!isValid || props.loading"
71
+ @click="onConfirm"
72
+ >
73
+ <atoms-loader-pre-loader
74
+ v-if="props.loading"
75
+ id="loader"
76
+ :show="props.loading"
77
+ class="button__loading"
78
+ :test-id="`${props.testId}-spinner`"
79
+ />
80
+ <span v-else>
81
+ {{ localization.common.yes }}
82
+ </span>
83
+ </button>
84
+ </template>
85
+ </atoms-modal>
86
+ </template>
87
+
88
+ <script setup lang="ts">
89
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
90
+
91
+ const props = defineProps<{
92
+ title: string
93
+ subTitle: string
94
+ testId: string
95
+ width: string
96
+ loading?: boolean
97
+ }>()
98
+ const emits = defineEmits<{
99
+ (event: 'confirm'): void
100
+ (event: 'hide'): void
101
+ }>()
102
+
103
+ const localization = computed<UI_I_Localization>(() => useLocal())
104
+
105
+ const confirmationForm = ref<string>('')
106
+ const isValid = computed<boolean>(() => {
107
+ return confirmationForm.value === props.subTitle
108
+ })
109
+
110
+ const confirmationText = localization.value.common.confirmDeletionInput.replace(
111
+ '{title}',
112
+ props.subTitle
113
+ )
114
+ const confirmDeletionInputError =
115
+ localization.value.common.confirmDeletionInputError.replace(
116
+ '{title}',
117
+ props.subTitle
118
+ )
119
+
120
+ const onConfirm = async (): Promise<void> => {
121
+ if (!isValid.value) return
122
+
123
+ emits('confirm')
124
+ }
125
+
126
+ const onHide = (): void => {
127
+ emits('hide')
128
+ }
129
+ </script>
130
+
131
+ <style lang="scss" scoped>
132
+ @import 'assets/scss/common/mixins.scss';
133
+ .confirm-by-input {
134
+ :deep(.modal-header) {
135
+ display: flex;
136
+ justify-content: space-between;
137
+ align-items: flex-start;
138
+
139
+ .modal-title {
140
+ color: var(--main-color-mode);
141
+ font-size: 24px;
142
+ max-width: 65%;
143
+ }
144
+ .secondary-title {
145
+ color: var(--modal-secondary-title);
146
+ font-size: 0.75rem;
147
+ font-weight: lighter;
148
+ user-select: none;
149
+ }
150
+ .separator {
151
+ content: '';
152
+ border-left: 1px solid #ccc;
153
+ margin: 0 18px;
154
+ height: 22px;
155
+ }
156
+
157
+ .close-icon {
158
+ fill: var(--close-icon);
159
+ width: 24px;
160
+ height: 24px;
161
+ }
162
+ }
163
+
164
+ &__body {
165
+ @include flex($align: flex-start);
166
+
167
+ .form-group {
168
+ margin-top: 20px;
169
+
170
+ label {
171
+ font-weight: bold;
172
+ font-size: 0.6rem;
173
+ user-select: none;
174
+ }
175
+
176
+ &:not(:first-child) input {
177
+ width: 100%;
178
+ }
179
+ &__input {
180
+ display: flex;
181
+ width: 100%;
182
+ min-height: 30px;
183
+ }
184
+ }
185
+ }
186
+
187
+ &__icon {
188
+ min-width: 48px;
189
+ height: 48px;
190
+ margin-right: 20px;
191
+ fill: #c27b00;
192
+ }
193
+
194
+ .button {
195
+ &__loading {
196
+ :deep(.spinner) {
197
+ width: 25px;
198
+ height: 25px;
199
+ min-width: 25px;
200
+ min-height: 25px;
201
+ margin-top: 5px;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.826",
4
+ "version": "1.4.827",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",