bfg-common 1.0.74 → 1.0.75

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,216 +1,212 @@
1
- <template>
2
- <div class="accordion" :class="{ disabled: props.accordion.disabled }">
3
- <nuxt-link
4
- class="accordion-item"
5
- :to="accordionLocal.path"
6
- active-class="active"
7
- @click.prevent="onSelect(accordionLocal)"
8
- >
9
- <div
10
- :class="['heading-wrap', { group: props.accordion.hasChild }]"
11
- :style="{ paddingLeft: `${props.level * 24 || 10}px` }"
12
- >
13
- <div class="flex-align-center heading">
14
- <div
15
- v-if="props.accordion.iconClassName"
16
- :class="['icon', props.accordion.iconClassName]"
17
- ></div>
18
- <div :class="['text text-ellipsis', headingClass]">
19
- {{ props.accordion.name }}
20
- </div>
21
- </div>
22
- <button
23
- v-if="props.accordion.hasChild"
24
- :id="`${props.testId}-trigger-button`"
25
- class="btn-trigger max-width"
26
- @click="toggle"
27
- >
28
- <atoms-the-icon
29
- :class="[
30
- 'trigger-icon',
31
- {
32
- isOpen: accordionLocal.isOpen,
33
- },
34
- ]"
35
- name="angle"
36
- />
37
- </button>
38
- </div>
39
- </nuxt-link>
40
-
41
- <transition
42
- v-if="props.accordion.hasChild"
43
- name="accordion"
44
- @before-enter="end"
45
- @enter="start"
46
- @before-leave="start"
47
- @leave="end"
48
- >
49
- <div v-show="accordionLocal.isOpen" class="accordion__content">
50
- <common-accordion-recursion
51
- v-for="(item, key) in props.accordion.children"
52
- :key="item.id"
53
- :test-id="`${props.testId}-${key}`"
54
- :accordion="item"
55
- :level="props.level + 1"
56
- @change="onSelect"
57
- />
58
- </div>
59
- </transition>
60
- </div>
61
- </template>
62
-
63
- <script setup lang="ts">
64
- import type {
65
- UI_I_AccordionRecursion,
66
- UI_I_HeadingClass,
67
- } from '~/components/common/accordion/models/interfaces'
68
-
69
- const props = withDefaults(
70
- defineProps<{
71
- accordion: UI_I_AccordionRecursion
72
- testId: string
73
- level?: number
74
- }>(),
75
- { level: 0 }
76
- )
77
- const emits = defineEmits<{
78
- (event: 'change', value: UI_I_AccordionRecursion): void
79
- }>()
80
-
81
- const accordionLocal = ref<UI_I_AccordionRecursion>(props.accordion)
82
-
83
- // TODO CHANGE
84
- watch(
85
- accordionLocal,
86
- () => {
87
- if (accordionLocal.value.isOpen !== false)
88
- accordionLocal.value.isOpen = true
89
- },
90
- { immediate: true }
91
- )
92
-
93
- const toggle = (): void => {
94
- if (!props.accordion.hasChild) return
95
-
96
- accordionLocal.value.isOpen = !accordionLocal.value.isOpen
97
- }
98
-
99
- const start = (element: any): void => {
100
- element.style.height = 'auto'
101
- }
102
- const end = (el: any): void => {
103
- el.style.height = 0
104
- }
105
-
106
- const headingClass = computed<UI_I_HeadingClass>(() => {
107
- return {
108
- 'text-normal': !props.accordion.hasChild,
109
- disabled: props.accordion.disabled && !props.accordion.hasChild,
110
- }
111
- })
112
-
113
- const onSelect = (item: UI_I_AccordionRecursion): void => {
114
- emits('change', item)
115
- }
116
- </script>
117
-
118
- <style lang="scss">
119
- @import '~/assets/scss/common/mixins';
120
-
121
- %hover-effect {
122
- margin-bottom: -1px;
123
- border-bottom: 1px solid var(--row-hover-border-color);
124
- background-color: var(--row-hover-bg-color);
125
- cursor: pointer;
126
- }
127
- %active-mode {
128
- background-color: var(--row-selected-bg-color);
129
- color: var(--row-selected-text-color);
130
- }
131
- .accordion {
132
- .accordion-item {
133
- display: block;
134
- text-decoration: none;
135
- color: var(--global-font-color);
136
-
137
- &.active {
138
- background-color: #29414e;
139
- color: #fff;
140
- border-bottom: 1px solid transparent;
141
- cursor: default;
142
- %hover-effect {
143
- margin-bottom: unset;
144
- border-bottom: unset;
145
- background-color: unset;
146
- cursor: unset;
147
- }
148
- }
149
-
150
- .heading-wrap {
151
- width: 100%;
152
- @include flex($align: center, $just: space-between);
153
-
154
- &:not(.group) {
155
- display: block;
156
- padding-right: 14px;
157
- }
158
-
159
- &.group .heading {
160
- width: calc(100% - 30px);
161
- }
162
- .heading {
163
- margin-right: 10px;
164
- //overflow: hidden;
165
- .icon {
166
- margin: 1px 4px 0 0;
167
- }
168
-
169
- .text {
170
- font-weight: 600;
171
-
172
- &.text-normal {
173
- font-weight: 400;
174
-
175
- &.disabled {
176
- opacity: 0.3;
177
- cursor: not-allowed;
178
- }
179
- }
180
- }
181
- }
182
- &:hover:not(:has(> .disabled)) {
183
- @extend %hover-effect;
184
- }
185
- &:has(> .disabled) {
186
- cursor: not-allowed;
187
- }
188
- }
189
- }
190
- &__content {
191
- transition: 0.1s ease-in-out;
192
- overflow: hidden;
193
- }
194
- }
195
-
196
- .btn-trigger {
197
- flex: auto;
198
- margin-right: 10px;
199
-
200
- &.max-width {
201
- width: max-content;
202
- }
203
-
204
- //padding-right: 10px;
205
- .trigger-icon {
206
- width: 16px;
207
- height: 16px;
208
- transform: rotate(90deg);
209
- margin-left: auto;
210
- fill: var(--triger-icon-color);
211
- &.isOpen {
212
- transform: rotate(180deg);
213
- }
214
- }
215
- }
216
- </style>
1
+ <template>
2
+ <div class="accordion" :class="{ disabled: props.accordion.disabled }">
3
+ <nuxt-link
4
+ class="accordion-item"
5
+ :to="accordionLocal.path"
6
+ active-class="active"
7
+ @click.prevent="onSelect(accordionLocal)"
8
+ >
9
+ <div
10
+ :class="['heading-wrap', { group: props.accordion.hasChild }]"
11
+ :style="{ paddingLeft: `${props.level * 24 || 10}px` }"
12
+ @click="toggle"
13
+ >
14
+ <div class="flex-align-center heading">
15
+ <div
16
+ v-if="props.accordion.iconClassName"
17
+ :class="['icon', props.accordion.iconClassName]"
18
+ ></div>
19
+ <div :class="['text text-ellipsis', headingClass]">
20
+ {{ props.accordion.name }}
21
+ </div>
22
+ </div>
23
+ <button
24
+ v-if="props.accordion.hasChild"
25
+ :id="`${props.testId}-trigger-button`"
26
+ class="btn-trigger"
27
+ >
28
+ <atoms-the-icon
29
+ :class="[
30
+ 'trigger-icon',
31
+ {
32
+ isOpen: accordionLocal.isOpen,
33
+ },
34
+ ]"
35
+ name="angle"
36
+ />
37
+ </button>
38
+ </div>
39
+ </nuxt-link>
40
+
41
+ <transition
42
+ v-if="props.accordion.hasChild"
43
+ name="accordion"
44
+ @before-enter="end"
45
+ @enter="start"
46
+ @before-leave="start"
47
+ @leave="end"
48
+ >
49
+ <div v-show="accordionLocal.isOpen" class="accordion__content">
50
+ <common-accordion-recursion
51
+ v-for="(item, key) in props.accordion.children"
52
+ :key="item.id"
53
+ :test-id="`${props.testId}-${key}`"
54
+ :accordion="item"
55
+ :level="props.level + 1"
56
+ @change="onSelect"
57
+ />
58
+ </div>
59
+ </transition>
60
+ </div>
61
+ </template>
62
+
63
+ <script setup lang="ts">
64
+ import type {
65
+ UI_I_AccordionRecursion,
66
+ UI_I_HeadingClass,
67
+ } from '~/components/common/accordion/models/interfaces'
68
+
69
+ const props = withDefaults(
70
+ defineProps<{
71
+ accordion: UI_I_AccordionRecursion
72
+ testId: string
73
+ level?: number
74
+ }>(),
75
+ { level: 0 }
76
+ )
77
+ const emits = defineEmits<{
78
+ (event: 'change', value: UI_I_AccordionRecursion): void
79
+ }>()
80
+
81
+ const accordionLocal = ref<UI_I_AccordionRecursion>(props.accordion)
82
+
83
+ // TODO CHANGE
84
+ watch(
85
+ accordionLocal,
86
+ () => {
87
+ if (accordionLocal.value.isOpen !== false)
88
+ accordionLocal.value.isOpen = true
89
+ },
90
+ { immediate: true }
91
+ )
92
+
93
+ const toggle = (): void => {
94
+ if (!props.accordion.hasChild) return
95
+
96
+ accordionLocal.value.isOpen = !accordionLocal.value.isOpen
97
+ }
98
+
99
+ const start = (element: any): void => {
100
+ element.style.height = 'auto'
101
+ }
102
+ const end = (el: any): void => {
103
+ el.style.height = 0
104
+ }
105
+
106
+ const headingClass = computed<UI_I_HeadingClass>(() => {
107
+ return {
108
+ 'text-normal': !props.accordion.hasChild,
109
+ disabled: props.accordion.disabled && !props.accordion.hasChild,
110
+ }
111
+ })
112
+
113
+ const onSelect = (item: UI_I_AccordionRecursion): void => {
114
+ emits('change', item)
115
+ }
116
+ </script>
117
+
118
+ <style lang="scss">
119
+ @import '~/assets/scss/common/mixins';
120
+
121
+ %hover-effect {
122
+ margin-bottom: -1px;
123
+ border-bottom: 1px solid var(--row-hover-border-color);
124
+ background-color: var(--row-hover-bg-color);
125
+ cursor: pointer;
126
+ }
127
+ %active-mode {
128
+ background-color: var(--row-selected-bg-color);
129
+ color: var(--row-selected-text-color);
130
+ }
131
+ .accordion {
132
+ .accordion-item {
133
+ display: block;
134
+ text-decoration: none;
135
+ color: var(--global-font-color);
136
+
137
+ &.active {
138
+ background-color: #29414e;
139
+ color: #fff;
140
+ border-bottom: 1px solid transparent;
141
+ cursor: default;
142
+ %hover-effect {
143
+ margin-bottom: unset;
144
+ border-bottom: unset;
145
+ background-color: unset;
146
+ cursor: unset;
147
+ }
148
+ }
149
+
150
+ .heading-wrap {
151
+ width: 100%;
152
+ @include flex($align: center, $just: space-between);
153
+
154
+ &:not(.group) {
155
+ display: block;
156
+ padding-right: 14px;
157
+ }
158
+
159
+ &.group .heading {
160
+ width: calc(100% - 30px);
161
+ }
162
+ .heading {
163
+ margin-right: 10px;
164
+ //overflow: hidden;
165
+ .icon {
166
+ margin: 1px 4px 0 0;
167
+ }
168
+
169
+ .text {
170
+ font-weight: 600;
171
+
172
+ &.text-normal {
173
+ font-weight: 400;
174
+
175
+ &.disabled {
176
+ opacity: 0.3;
177
+ cursor: not-allowed;
178
+ }
179
+ }
180
+ }
181
+ }
182
+ &:hover:not(:has(> .disabled)) {
183
+ @extend %hover-effect;
184
+ }
185
+ &:has(> .disabled) {
186
+ cursor: not-allowed;
187
+ }
188
+ }
189
+ }
190
+ &__content {
191
+ transition: 0.1s ease-in-out;
192
+ overflow: hidden;
193
+ }
194
+ }
195
+
196
+ .btn-trigger {
197
+ flex: auto;
198
+ margin-right: 10px;
199
+
200
+ //padding-right: 10px;
201
+ .trigger-icon {
202
+ width: 16px;
203
+ height: 16px;
204
+ transform: rotate(90deg);
205
+ margin-left: auto;
206
+ fill: var(--triger-icon-color);
207
+ &.isOpen {
208
+ transform: rotate(180deg);
209
+ }
210
+ }
211
+ }
212
+ </style>
@@ -131,7 +131,7 @@ const checkNameIsValid = async (name: string): Promise<boolean> => {
131
131
  switch (status) {
132
132
  case 406: // Invalid name
133
133
  showValidationErrors([
134
- localization.value.vmNameValidationDescription,
134
+ localization.value.vmNameValidationDescription2,
135
135
  ])
136
136
  resolve(false)
137
137
  break
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.0.74",
4
+ "version": "1.0.75",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",