bfg-common 1.4.375 → 1.4.377

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.
@@ -2243,7 +2243,8 @@
2243
2243
  "tagsPerObject": "Тэгі для кожнага Аб'екта",
2244
2244
  "multipleTagsSelectedAlert": "Выбар некалькіх тэгаў можа прывесці да ўжывання звязаных вылічальных палітык.",
2245
2245
  "removeAttributeDialog": "Вы ўпэўненыя, што хочаце выдаліць карыстацкі атрыбут “{attributeName}” з “{selectedItemName}”?",
2246
- "showMore": "Паказаць больш"
2246
+ "showMore": "Паказаць больш",
2247
+ "failureReason": "Прычына адмовы"
2247
2248
  },
2248
2249
  "auth": {
2249
2250
  "welcomeTo": "Сардэчна запрашаем у",
@@ -2247,7 +2247,8 @@
2247
2247
  "tagsPerObject": "Tags Per Object",
2248
2248
  "multipleTagsSelectedAlert": "Selecting multiple tags may result in the application of associated compute policies.",
2249
2249
  "removeAttributeDialog": "Are you sure you want to delete custom attribute “{attributeName}” from “{selectedItemName}”?",
2250
- "showMore": "Show More"
2250
+ "showMore": "Show More",
2251
+ "failureReason": "Failure Reason"
2251
2252
  },
2252
2253
  "auth": {
2253
2254
  "welcomeTo": "Welcome to",
@@ -2247,7 +2247,8 @@
2247
2247
  "tagsPerObject": "Պիտակներ յուրաքանչյուր օբյեկտի համար",
2248
2248
  "multipleTagsSelectedAlert": "Բազմաթիվ պիտակների ընտրությունը կարող է հանգեցնել հարակից հաշվարկային քաղաքականության կիրառմանը:",
2249
2249
  "removeAttributeDialog": "Համոզված եք, որ ցանկանում եք հեռացնել “{attributeName}” հատուկ հատկանիշը “{selectedItemName}” - ից:",
2250
- "showMore": "Ցույց տալ ավելին"
2250
+ "showMore": "Ցույց տալ ավելին",
2251
+ "failureReason": "Ձախողման պատճառ"
2251
2252
  },
2252
2253
  "auth": {
2253
2254
  "welcomeTo": "Բարի գալուստ",
@@ -2246,7 +2246,8 @@
2246
2246
  "tagsPerObject": "Бір Нысанға Тегтер",
2247
2247
  "multipleTagsSelectedAlert": "Бірнеше тегтерді таңдау байланысты есептеу саясаттарын қолдануға әкелуі мүмкін.",
2248
2248
  "removeAttributeDialog": "“{AttributeName}” теңшелетін төлсипатын “{selectedItemName}”ішінен жойғыңыз келетініне сенімдісіз бе?",
2249
- "showMore": "Көбірек көрсету"
2249
+ "showMore": "Көбірек көрсету",
2250
+ "failureReason": "Сәтсіздік себебі"
2250
2251
  },
2251
2252
  "auth": {
2252
2253
  "welcomeTo": "Қош келдіңіз",
@@ -2248,7 +2248,8 @@
2248
2248
  "tagsPerObject": "Теги для каждого Объекта",
2249
2249
  "multipleTagsSelectedAlert": "Выбор нескольких тегов может привести к применению связанных вычислительных политик.",
2250
2250
  "removeAttributeDialog": "Вы уверены, что хотите удалить пользовательский атрибут “{attributeName}” из “{selectedItemName}”?",
2251
- "showMore": "Показать больше"
2251
+ "showMore": "Показать больше",
2252
+ "failureReason": "Причина отказа"
2252
2253
  },
2253
2254
  "auth": {
2254
2255
  "welcomeTo": "Добро пожаловать в",
@@ -2245,7 +2245,8 @@
2245
2245
  "tagsPerObject": "每个对象的标签",
2246
2246
  "multipleTagsSelectedAlert": "选择多个标签可能会导致应用相关的计算策略。",
2247
2247
  "removeAttributeDialog": "您确定要从“{selectedItemName}”中删除自定义属性“{attributeName}”吗?",
2248
- "showMore": "显示更多"
2248
+ "showMore": "显示更多",
2249
+ "failureReason": "失败原因"
2249
2250
  },
2250
2251
  "auth": {
2251
2252
  "welcomeTo": "欢迎来到",
@@ -499,18 +499,18 @@
499
499
 
500
500
  <script setup lang="ts">
501
501
  import type { UI_I_HTMLSelectElement } from '~/lib/models/interfaces'
502
- import { itemsPerPage } from '~/components/atoms/table/dataGrid/lib/config/itemsPerPage'
503
- import {
502
+ import type {
504
503
  UI_I_HeadItem,
505
504
  UI_I_BodyItem,
506
505
  UI_I_ColumnKey,
507
506
  } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
508
- import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
509
- import {
507
+ import type {
510
508
  UI_T_ColumnKeys,
511
509
  UI_T_DataGridType,
512
510
  UI_T_SelectedRow,
513
511
  } from '~/components/atoms/table/dataGrid/lib/models/types'
512
+ import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
513
+ import { itemsPerPage } from '~/components/atoms/table/dataGrid/lib/config/itemsPerPage'
514
514
 
515
515
  const props = withDefaults(
516
516
  defineProps<{
@@ -1,216 +1,220 @@
1
- <template>
2
- <div class="column-switch-wrap flex-align-center relative" @click.stop>
3
- <button
4
- :id="columnSwitchId"
5
- :data-id="`${props.testId}-toggle-button`"
6
- class="column-switch-btn"
7
- @click.stop="toggle"
8
- >
9
- <atoms-the-icon
10
- name="column-switch"
11
- width="16px"
12
- height="16px"
13
- class="toggle-icon"
14
- />
15
- </button>
16
-
17
- <div v-show="open" :style="dropdownStyles" class="dropdown-menu">
18
- <div class="column-switch">
19
- <div class="switch-header">
20
- {{ localization.common.showColumns }}
21
- </div>
22
- <ul class="switch-content list-unstyled">
23
- <li
24
- v-for="(item, key) in columnKeysPresent"
25
- :key="`${item.key}_${key}`"
26
- >
27
- <div class="clr-checkbox-wrapper">
28
- <input
29
- :id="`${props.testId}-${item.id}`"
30
- v-model="item.show"
31
- :data-id="item.testId"
32
- :disabled="isLast && item.show"
33
- type="checkbox"
34
- @change="change($event, key)"
35
- />
36
- <label
37
- :for="`${props.testId}-${item.id}`"
38
- class="clr-control-label"
39
- >{{ item.text }}</label
40
- >
41
- </div>
42
- </li>
43
- </ul>
44
- <div class="switch-footer">
45
- <button
46
- :id="`${props.testId}-select-all-button`"
47
- :data-id="`${props.testId}-select-all-button`"
48
- class="btn btn-sm btn-link switch-button export-link"
49
- @click="selectAll"
50
- >
51
- {{ localization.common.selectAll }}
52
- </button>
53
- </div>
54
- </div>
55
- </div>
56
- </div>
57
- </template>
58
-
59
- <script setup lang="ts">
60
- import {
61
- UI_I_HTMLSelectElement,
62
- UI_I_Localization,
63
- } from '~/lib/models/interfaces'
64
- import type { UI_I_ColumnKey } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
65
-
66
- const props = withDefaults(
67
- defineProps<{
68
- columnKeys: UI_I_ColumnKey[]
69
- testId?: string
70
- }>(),
71
- { testId: 'ui-data-grid-column-switch' }
72
- )
73
- const emits = defineEmits<{
74
- (event: 'update:column-keys', value: UI_I_ColumnKey[]): void
75
- }>()
76
-
77
- const columnKeysPresent = computed<UI_I_ColumnKey[]>(() => {
78
- return props.columnKeys.map((item): UI_I_ColumnKey => {
79
- return { ...item, id: useUniqueId() }
80
- })
81
- })
82
-
83
- const localization = computed<UI_I_Localization>(() => useLocal())
84
-
85
- const columnSwitchId = ref<string>('')
86
-
87
- const isLast = computed<boolean>(
88
- () => props.columnKeys.filter((columnKey) => columnKey.show).length === 1
89
- )
90
-
91
- const change = (e: UI_I_HTMLSelectElement, key: number): void => {
92
- const newColumnKeys = props.columnKeys.map((columnKey, i) => {
93
- if (i !== key) {
94
- return columnKey
95
- }
96
-
97
- columnKey.show = e.target.checked
98
- return columnKey
99
- })
100
- emits('update:column-keys', newColumnKeys)
101
- }
102
- const selectAll = (): void => {
103
- const newColumnKeys = props.columnKeys.map((columnKey) => {
104
- columnKey.show = true
105
- return columnKey
106
- })
107
- emits('update:column-keys', newColumnKeys)
108
- }
109
-
110
- const windowClick = (): void => {
111
- hide()
112
- }
113
- onMounted(() => {
114
- window.addEventListener('click', windowClick)
115
- columnSwitchId.value = `column-switch-${useUniqueId()}`
116
- setDropdownStyle()
117
- })
118
- onUnmounted(() => {
119
- window.removeEventListener('click', windowClick)
120
- })
121
-
122
- const open = ref<boolean>(false)
123
- const hide = (): void => {
124
- open.value = false
125
- }
126
- const toggle = (): void => {
127
- open.value = !open.value
128
- if (!open.value) {
129
- return
130
- }
131
-
132
- setDropdownStyle()
133
- }
134
-
135
- const dropdownStyles = ref({})
136
- const setDropdownStyle = (): void => {
137
- const elem = document.getElementById(columnSwitchId.value)
138
- if (!elem) {
139
- setTimeout(() => setDropdownStyle(), 0)
140
- return
141
- }
142
- const { x, y } = elem.getBoundingClientRect()
143
-
144
- dropdownStyles.value = {
145
- top: `${y - 10}px`,
146
- left: `${x}px`,
147
- }
148
- }
149
- </script>
150
-
151
- <style scoped lang="scss">
152
- .column-switch-wrap {
153
- .column-switch-btn {
154
- cursor: pointer;
155
- padding: 0;
156
- border: 0;
157
- display: flex;
158
- background-color: transparent;
159
-
160
- .toggle-icon {
161
- fill: #575757;
162
- }
163
- &:hover {
164
- .toggle-icon {
165
- fill: #0079b8;
166
- }
167
- }
168
- }
169
-
170
- .dropdown-menu {
171
- position: fixed;
172
- z-index: 1000;
173
- visibility: unset;
174
- transform: translateY(-100%);
175
- background-color: var(--block-view-bg-color);
176
- border-color: var(--global-border-color);
177
-
178
- .column-switch {
179
- border-style: none;
180
- box-shadow: none;
181
- height: 85%;
182
- max-height: calc(15rem + 100px);
183
- padding: 18px;
184
- width: 250px;
185
- display: flex;
186
- flex-direction: column;
187
-
188
- .switch-header {
189
- font-size: 16px;
190
- color: var(--global-font-color4);
191
- padding-bottom: 12px;
192
- }
193
-
194
- .switch-content {
195
- overflow-y: auto;
196
- .clr-control-label {
197
- white-space: normal;
198
- }
199
- }
200
-
201
- .switch-footer {
202
- button {
203
- padding: 0;
204
- margin: 0;
205
- font-size: 12px;
206
- letter-spacing: 1px;
207
- color: #0079b8;
208
- text-transform: uppercase;
209
- display: flex;
210
- align-items: center;
211
- }
212
- }
213
- }
214
- }
215
- }
216
- </style>
1
+ <template>
2
+ <div class="column-switch-wrap flex-align-center relative" @click.stop>
3
+ <button
4
+ :id="columnSwitchId"
5
+ :data-id="`${props.testId}-toggle-button`"
6
+ class="column-switch-btn"
7
+ @click.stop="toggle"
8
+ >
9
+ <atoms-the-icon
10
+ name="column-switch"
11
+ width="16px"
12
+ height="16px"
13
+ class="toggle-icon"
14
+ />
15
+ </button>
16
+
17
+ <div v-show="open" :style="dropdownStyles" class="dropdown-menu">
18
+ <div class="column-switch">
19
+ <div class="switch-header">
20
+ {{ localization.common.showColumns }}
21
+ </div>
22
+ <ul class="switch-content list-unstyled">
23
+ <li
24
+ v-for="(item, key) in columnKeysPresent"
25
+ :key="`${item.key}_${key}`"
26
+ >
27
+ <div class="clr-checkbox-wrapper">
28
+ <input
29
+ :id="`${props.testId}-${item.id}`"
30
+ v-model="item.show"
31
+ :data-id="item.testId"
32
+ :disabled="isLast && item.show"
33
+ type="checkbox"
34
+ @change="change($event, key)"
35
+ />
36
+ <label
37
+ :for="`${props.testId}-${item.id}`"
38
+ class="clr-control-label"
39
+ >{{ item.text }}</label
40
+ >
41
+ </div>
42
+ </li>
43
+ </ul>
44
+ <div class="switch-footer">
45
+ <button
46
+ :id="`${props.testId}-select-all-button`"
47
+ :data-id="`${props.testId}-select-all-button`"
48
+ class="btn btn-sm btn-link switch-button export-link"
49
+ @click="selectAll"
50
+ >
51
+ {{ localization.common.selectAll }}
52
+ </button>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </template>
58
+
59
+ <script setup lang="ts">
60
+ import {
61
+ UI_I_HTMLSelectElement,
62
+ UI_I_Localization,
63
+ } from '~/lib/models/interfaces'
64
+ import type { UI_I_ColumnKey } from '~/components/atoms/table/dataGrid/lib/models/interfaces'
65
+
66
+ const props = withDefaults(
67
+ defineProps<{
68
+ columnKeys: UI_I_ColumnKey[]
69
+ testId?: string
70
+ }>(),
71
+ { testId: 'ui-data-grid-column-switch' }
72
+ )
73
+ const emits = defineEmits<{
74
+ (event: 'update:column-keys', value: UI_I_ColumnKey[]): void
75
+ }>()
76
+
77
+ const columnKeysPresent = computed<UI_I_ColumnKey[]>(() => {
78
+ return props.columnKeys.map((item): UI_I_ColumnKey => {
79
+ const testId = item.text
80
+ .toLowerCase()
81
+ .replace(/\s/g, '_')
82
+ .replace(/[^a-zA-Z_]/g, '')
83
+ return { ...item, id: useUniqueId(), testId: `show-column-${testId}` }
84
+ })
85
+ })
86
+
87
+ const localization = computed<UI_I_Localization>(() => useLocal())
88
+
89
+ const columnSwitchId = ref<string>('')
90
+
91
+ const isLast = computed<boolean>(
92
+ () => props.columnKeys.filter((columnKey) => columnKey.show).length === 1
93
+ )
94
+
95
+ const change = (e: UI_I_HTMLSelectElement, key: number): void => {
96
+ const newColumnKeys = props.columnKeys.map((columnKey, i) => {
97
+ if (i !== key) {
98
+ return columnKey
99
+ }
100
+
101
+ columnKey.show = e.target.checked
102
+ return columnKey
103
+ })
104
+ emits('update:column-keys', newColumnKeys)
105
+ }
106
+ const selectAll = (): void => {
107
+ const newColumnKeys = props.columnKeys.map((columnKey) => {
108
+ columnKey.show = true
109
+ return columnKey
110
+ })
111
+ emits('update:column-keys', newColumnKeys)
112
+ }
113
+
114
+ const windowClick = (): void => {
115
+ hide()
116
+ }
117
+ onMounted(() => {
118
+ window.addEventListener('click', windowClick)
119
+ columnSwitchId.value = `column-switch-${useUniqueId()}`
120
+ setDropdownStyle()
121
+ })
122
+ onUnmounted(() => {
123
+ window.removeEventListener('click', windowClick)
124
+ })
125
+
126
+ const open = ref<boolean>(false)
127
+ const hide = (): void => {
128
+ open.value = false
129
+ }
130
+ const toggle = (): void => {
131
+ open.value = !open.value
132
+ if (!open.value) {
133
+ return
134
+ }
135
+
136
+ setDropdownStyle()
137
+ }
138
+
139
+ const dropdownStyles = ref({})
140
+ const setDropdownStyle = (): void => {
141
+ const elem = document.getElementById(columnSwitchId.value)
142
+ if (!elem) {
143
+ setTimeout(() => setDropdownStyle(), 0)
144
+ return
145
+ }
146
+ const { x, y } = elem.getBoundingClientRect()
147
+
148
+ dropdownStyles.value = {
149
+ top: `${y - 10}px`,
150
+ left: `${x}px`,
151
+ }
152
+ }
153
+ </script>
154
+
155
+ <style scoped lang="scss">
156
+ .column-switch-wrap {
157
+ .column-switch-btn {
158
+ cursor: pointer;
159
+ padding: 0;
160
+ border: 0;
161
+ display: flex;
162
+ background-color: transparent;
163
+
164
+ .toggle-icon {
165
+ fill: #575757;
166
+ }
167
+ &:hover {
168
+ .toggle-icon {
169
+ fill: #0079b8;
170
+ }
171
+ }
172
+ }
173
+
174
+ .dropdown-menu {
175
+ position: fixed;
176
+ z-index: 1000;
177
+ visibility: unset;
178
+ transform: translateY(-100%);
179
+ background-color: var(--block-view-bg-color);
180
+ border-color: var(--global-border-color);
181
+
182
+ .column-switch {
183
+ border-style: none;
184
+ box-shadow: none;
185
+ height: 85%;
186
+ max-height: calc(15rem + 100px);
187
+ padding: 18px;
188
+ width: 250px;
189
+ display: flex;
190
+ flex-direction: column;
191
+
192
+ .switch-header {
193
+ font-size: 16px;
194
+ color: var(--global-font-color4);
195
+ padding-bottom: 12px;
196
+ }
197
+
198
+ .switch-content {
199
+ overflow-y: auto;
200
+ .clr-control-label {
201
+ white-space: normal;
202
+ }
203
+ }
204
+
205
+ .switch-footer {
206
+ button {
207
+ padding: 0;
208
+ margin: 0;
209
+ font-size: 12px;
210
+ letter-spacing: 1px;
211
+ color: #0079b8;
212
+ text-transform: uppercase;
213
+ display: flex;
214
+ align-items: center;
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.375",
4
+ "version": "1.4.377",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",