bfg-common 1.1.43 → 1.1.44

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,16 +1,16 @@
1
1
  <template>
2
2
  <div class="notification-bar">
3
- <div class="alerts" :style="{ 'background-color': bgPageControl }">
3
+ <div class="alerts" :style="{ 'background-color': color }">
4
4
  <div
5
5
  v-if="props.items.length > 1"
6
- :class="['alerts-pager ng-star-inserted']"
6
+ class="alerts-pager ng-star-inserted"
7
7
  >
8
8
  <div class="alerts-pager-control page-control">
9
9
  <div class="alerts-page-down">
10
10
  <button
11
11
  :id="`${props.testId}-prev-button`"
12
12
  class="alerts-pager-button"
13
- @click="prevPage"
13
+ @click="onPrev"
14
14
  >
15
15
  <atoms-the-icon class="page-control__prev" name="angle" />
16
16
  </button>
@@ -24,7 +24,7 @@
24
24
  <button
25
25
  :id="`${props.testId}-next-button`"
26
26
  class="alerts-pager-button"
27
- @click="nextPage"
27
+ @click="onNext"
28
28
  >
29
29
  <atoms-the-icon class="page-control__next" name="angle" />
30
30
  </button>
@@ -33,7 +33,7 @@
33
33
  </div>
34
34
 
35
35
  <div class="alert-text-truncate">
36
- <div class="alert alert-app-level" :class="currentPage.status">
36
+ <div class="alert alert-app-level" :class="currentNotification.status">
37
37
  <div class="alert-items">
38
38
  <div class="alert-item">
39
39
  <div class="alert-icon-wrapper">
@@ -52,7 +52,7 @@
52
52
  :id="`${props.testId}-action-button`"
53
53
  class="btn alert-action"
54
54
  >
55
- {{ setActionText }}
55
+ {{ actionText }}
56
56
  </button>
57
57
  </div>
58
58
  </div>
@@ -61,7 +61,7 @@
61
61
  <button
62
62
  :id="`${props.testId}-remove-button`"
63
63
  class="close"
64
- @click="removeCurrentNotificationByKey(currentPage.id)"
64
+ @click="removeCurrentNotification"
65
65
  >
66
66
  <atoms-the-icon name="close" fill="#fff" />
67
67
  </button>
@@ -74,16 +74,11 @@
74
74
  <script setup lang="ts">
75
75
  import { UI_I_NotificationItem } from '~/components/atoms/notificationBar/models/interfaces'
76
76
  import {
77
- UI_E_ActionTextByStatus,
78
77
  UI_E_ColorsPageControl,
79
78
  UI_E_IconsByStatus,
80
- UI_E_MsgByStatus,
81
79
  } from '~/components/atoms/notificationBar/models/enums'
82
80
  import { UI_T_ColorsPageControlKey } from '~/components/atoms/notificationBar/models/types'
83
81
 
84
- const { $store } = useNuxtApp()
85
- const localization = computed<any>(() => useLocal())
86
-
87
82
  const props = withDefaults(
88
83
  defineProps<{
89
84
  items: UI_I_NotificationItem[]
@@ -92,23 +87,23 @@ const props = withDefaults(
92
87
  { testId: 'ui-notification-bar' }
93
88
  )
94
89
  const emits = defineEmits<{
95
- (event: 'action', value: string): void
90
+ (event: 'action'): void
91
+ (event: 'remove', value: number): void
96
92
  }>()
97
93
 
98
94
  const stepPosition = ref<number>(1)
99
95
 
100
- const removeCurrentNotificationByKey = (key: number | string): void => {
101
- stepPosition.value = Math.min(props.items.length - 1, stepPosition.value)
102
- $store.dispatch('main/A_REMOVE_NOTIFICATION_ITEM', key)
96
+ const removeCurrentNotification = (): void => {
97
+ currentNotification.value && emits('remove', currentNotification.value.id)
103
98
  }
104
- const prevPage = (): void => {
99
+ const onPrev = (): void => {
105
100
  if (stepPosition.value === 1) {
106
101
  stepPosition.value = props.items.length
107
102
  } else {
108
103
  stepPosition.value--
109
104
  }
110
105
  }
111
- const nextPage = (): void => {
106
+ const onNext = (): void => {
112
107
  if (stepPosition.value === props.items.length) {
113
108
  stepPosition.value = 1
114
109
  } else {
@@ -116,34 +111,32 @@ const nextPage = (): void => {
116
111
  }
117
112
  }
118
113
  const onAction = (): void => {
119
- emits('action', currentPage.value.action)
114
+ emits('action')
120
115
  }
121
116
 
122
- const currentPage = computed<UI_I_NotificationItem | null>(() => {
117
+ const currentNotification = computed<UI_I_NotificationItem | undefined>(() => {
123
118
  return props.items.find((_, i) => i + 1 === stepPosition.value)
124
119
  })
125
120
 
126
121
  const status = computed<UI_T_ColorsPageControlKey>(
127
- () => currentPage.value?.status || 'alert-success'
122
+ () => currentNotification.value?.status || 'alert-success'
128
123
  )
129
- const setActionText = computed<string>(
130
- () => localization.value[UI_E_ActionTextByStatus[status.value]]
124
+ const actionText = computed<string>(
125
+ () => currentNotification.value?.action || ''
131
126
  )
132
127
 
133
128
  const message = computed<string>(
134
- // () => localization.value[UI_E_MsgByStatus[status.value]]
135
- () => currentPage.value.message
129
+ () => currentNotification.value?.message || ''
136
130
  )
137
- const isShowAction = computed<string>(
138
- // () => localization.value[UI_E_MsgByStatus[status.value]]
139
- () => !!currentPage.value.action
131
+ const isShowAction = computed<boolean>(
132
+ () => !!currentNotification.value?.action
140
133
  )
141
134
 
142
135
  const iconName = computed<string>(
143
- () => UI_E_IconsByStatus[currentPage.value.status]
136
+ () => currentNotification.value ? UI_E_IconsByStatus[currentNotification.value.status] : ''
144
137
  )
145
138
 
146
- const bgPageControl = computed<string>(
139
+ const color = computed<string>(
147
140
  () => UI_E_ColorsPageControl[status.value]
148
141
  )
149
142
  </script>
@@ -5,23 +5,9 @@ export enum UI_E_IconsByStatus {
5
5
  'alert-success' = 'success-circle',
6
6
  }
7
7
 
8
- export enum UI_E_ActionTextByStatus {
9
- 'alert-info' = 'notifyInfoActionText',
10
- 'alert-warning' = 'notifyWarningActionText',
11
- 'alert-danger' = '',
12
- 'alert-success' = '',
13
- }
14
-
15
- export enum UI_E_MsgByStatus {
16
- 'alert-info' = 'notifyInfoMsg',
17
- 'alert-warning' = 'notifyWarningMsg',
18
- 'alert-danger' = '',
19
- 'alert-success' = '',
20
- }
21
-
22
8
  export enum UI_E_ColorsPageControl {
23
- 'alert-warning' = '#c47d00',
24
- 'alert-info' = '#004d8a',
25
- 'alert-danger' = '',
26
- 'alert-success' = '',
9
+ 'alert-warning' = '#c25400',
10
+ 'alert-info' = '#0079b8',
11
+ 'alert-danger' = '#c92100',
12
+ 'alert-success' = '#2f8400',
27
13
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.1.43",
4
+ "version": "1.1.44",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",