bfg-common 1.4.794 → 1.4.795

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.
@@ -150,7 +150,7 @@ const localization = computed<UI_I_Localization>(() => useLocal())
150
150
 
151
151
  .nav-context {
152
152
  position: absolute;
153
- z-index: 1001;
153
+ z-index: 9999999;
154
154
  height: 100%;
155
155
  display: flex;
156
156
  flex-direction: column;
@@ -136,7 +136,7 @@ const localization = computed<UI_I_Localization>(() => useLocal())
136
136
  }
137
137
  .nav-context {
138
138
  position: absolute;
139
- z-index: 1001;
139
+ z-index: 9999999;
140
140
  height: 100%;
141
141
  display: flex;
142
142
  flex-direction: column;
@@ -1,308 +1,308 @@
1
- <template>
2
- <ui-data-table
3
- test-id="task-table"
4
- :data="data"
5
- :options="options"
6
- :loading="props.loading"
7
- :total-pages="props.totalPages"
8
- :total-items="props.totalItems"
9
- :texts="texts"
10
- class="task-table"
11
- @sort="onSorting"
12
- @pagination="onPagination"
13
- @column-filter="onColumnFilter"
14
- >
15
- <template #icon="{ item }">
16
- <span class="flex-align-center">
17
- <span :class="['icon', item.data.icon]" />
18
-
19
- <span
20
- :data-id="`rtask-${item.data.testId}`"
21
- :class="item.data.isLink && 'target-link'"
22
- @click.stop="onSelectNodeOfTree(item.data)"
23
- >
24
- {{ item.text }}
25
- </span>
26
- </span>
27
- </template>
28
-
29
- <template #status="{ item }">
30
- <ui-chip :test-id="item.data.testId" :color="item.data.chipColor" rounded>
31
- <ui-icon
32
- :name="item.data.icon"
33
- width="14px"
34
- height="14px"
35
- class="chip-icon"
36
- ></ui-icon>
37
- {{ item.text }}
38
- </ui-chip>
39
-
40
- <common-pages-tasks-table-error-info
41
- v-if="item.data.error"
42
- :id="item.data.testId"
43
- :error="item.data.error"
44
- :opened-error="openedError"
45
- @toggle-error="onToggleError"
46
- />
47
- </template>
48
-
49
- <template #default-actions="{ item }">
50
- <div class="actions">
51
- <ui-button
52
- variant="text"
53
- :test-id="`data-table-task-action-${item.data.id}`"
54
- is-without-height
55
- is-without-sizes
56
- @click.stop="onToggleActions(item.data.id)"
57
- >
58
- <span
59
- :class="['action-icon', { active: actionsShowId === item.data.id }]"
60
- >
61
- <ui-icon name="vertical-dotes" width="20" height="20" />
62
- </span>
63
- </ui-button>
64
- <ui-dropdown
65
- :show="actionsShowId === item.data.id"
66
- :test-id="`data-table-task-dropdown-${item.data.id}`"
67
- :items="actions"
68
- :elem-id="`data-table-task-action-${item.data.id}`"
69
- left
70
- width="max-content"
71
- @select="onSelectAction(item.data.target, $event)"
72
- @hide="onHideActionsDropdown"
73
- >
74
- <template #row="{ item: dropMenu }">
75
- <ui-icon
76
- v-if="dropMenu.iconName === 'hide'"
77
- name="password-hide"
78
- width="16"
79
- height="16"
80
- />
81
- <span class="action-text">
82
- {{ dropMenu.text }}
83
- </span>
84
- </template>
85
- </ui-dropdown>
86
- </div>
87
- </template>
88
-
89
- <template #expand="{ item }">
90
- <common-pages-tasks-table-expand-details :data="item.data" />
91
- </template>
92
- </ui-data-table>
93
- </template>
94
-
95
- <script setup lang="ts">
96
- import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
97
- import type {
98
- UI_I_DataTable,
99
- UI_I_DataTableHeader,
100
- UI_I_DataTableBody,
101
- UI_I_Pagination,
102
- UI_I_TableTexts,
103
- } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
104
- import type { UI_T_ArbitraryObject } from '~/node_modules/bfg-uikit/models/types'
105
- import type { UI_T_Project, UI_T_ProcuratorTypeNodes } from '~/lib/models/types'
106
- import type { UI_I_Localization } from '~/lib/models/interfaces'
107
- import type { UI_I_TaskItem } from '~/lib/models/store/tasks/interfaces'
108
- import type { UI_I_TableTarget } from '~/lib/models/table/interfaces'
109
- import {
110
- options,
111
- getTargetActionsFunc,
112
- getHeaderDataFunc,
113
- getBodyDataFunc,
114
- } from '~/components/common/pages/tasks/table/lib/config/config'
115
- import { useDebounceFn } from '@vueuse/core'
116
-
117
- const props = defineProps<{
118
- project: UI_T_Project
119
- tableData: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[]
120
- totalPages: number
121
- totalItems: number
122
- loading: boolean
123
- }>()
124
- const emits = defineEmits<{
125
- (event: 'sort', value: string): void
126
- (event: 'pagination', value: UI_I_Pagination): void
127
- (event: 'col-search', value: string): void
128
- }>()
129
-
130
- const localization = computed<UI_I_Localization>(() => useLocal())
131
- const { $store }: any = useNuxtApp()
132
-
133
- const texts = computed<UI_I_TableTexts>(() => ({
134
- searchHere: localization.value.common.searchHere,
135
- rowsPerPage: localization.value.common.rowsPerPage,
136
- of: localization.value.common.of,
137
- selected: localization.value.common.selected,
138
- columns: localization.value.common.columns,
139
- previous: localization.value.common.previous,
140
- next: localization.value.common.next,
141
- noItemsFound: localization.value.common.noItemsFound,
142
- exportAll: localization.value.common.exportAll,
143
- exportSelected: localization.value.common.exportSelected,
144
- all: localization.value.common.all,
145
- }))
146
-
147
- const actionsShowId = ref<number>(-1)
148
-
149
- const data = computed<UI_I_DataTable>(() => ({
150
- id: 'tasks-table',
151
- header: taskHeadItems.value,
152
- body: taskBodyItems.value,
153
- }))
154
-
155
- const taskHeadItems = computed<UI_I_DataTableHeader[]>(() =>
156
- getHeaderDataFunc(localization.value)
157
- )
158
-
159
- const taskBodyItems = ref<UI_I_DataTableBody[]>([])
160
- watch(
161
- () => props.tableData,
162
- (newValue: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[]) => {
163
- if (!newValue?.length) {
164
- taskBodyItems.value = []
165
- return
166
- }
167
-
168
- taskBodyItems.value = getBodyDataFunc(newValue, localization.value)
169
- },
170
- { deep: true, immediate: true }
171
- )
172
-
173
- const openedError = ref<string>('')
174
-
175
- const onToggleError = (value: string): void => {
176
- if (!value || value === openedError.value) {
177
- openedError.value = ''
178
- } else {
179
- openedError.value = value
180
- }
181
- }
182
-
183
- const onSorting = (value: string): void => {
184
- emits('sort', value)
185
- }
186
- const onPagination = (value: UI_I_Pagination): void => {
187
- emits('pagination', value)
188
- }
189
- const sendFilter = useDebounceFn((searchText: string) => {
190
- emits('col-search', searchText)
191
- }, 1000)
192
- const onColumnFilter = (obj: UI_T_ArbitraryObject<string>): void => {
193
- let searchText = ''
194
-
195
- for (const [key, value] of Object.entries(obj)) {
196
- const currentFilter = searchText
197
- ? ',' + key + '.' + value
198
- : key + '.' + value
199
-
200
- searchText = searchText + (value ? currentFilter : '')
201
- }
202
- sendFilter(searchText)
203
- }
204
-
205
- const actions = computed<UI_I_Dropdown[]>(() =>
206
- getTargetActionsFunc(localization.value, props.project)
207
- )
208
- const onToggleActions = (id: number): void => {
209
- if (actionsShowId.value === id) {
210
- actionsShowId.value = -1
211
- } else {
212
- actionsShowId.value = id
213
- }
214
- }
215
- const onSelectAction = (
216
- data: UI_I_TableTarget<typeof props.project>,
217
- action: 'view-target' | 'view-zone'
218
- ): void => {
219
- switch (action) {
220
- case 'view-target':
221
- onSelectNodeOfTree(data)
222
- break
223
- case 'view-zone':
224
- onSelectNodeOfTree({ ...data, type: 'zone', nav: 'h' })
225
- break
226
- }
227
- onHideActionsDropdown()
228
- }
229
- const onHideActionsDropdown = (): void => {
230
- actionsShowId.value = -1
231
- }
232
-
233
- const onSelectNodeOfTree = (
234
- data: UI_I_TableTarget<typeof props.project>
235
- ): void => {
236
- if (!data.isLink) return
237
-
238
- const { type, id, nav } = data
239
-
240
- const node = {
241
- id,
242
- type,
243
- }
244
-
245
- const path = `/inventory/type=${type};nav=${nav};id=${id}/summary`
246
- navigateTo(path)
247
-
248
- $store.dispatch('inventory/A_SELECT_NODE', { node, type })
249
- }
250
- </script>
251
-
252
- <style>
253
- /*TODO move up*/
254
- :root {
255
- --actions-icon-color: #4d5d69;
256
- --actions-icon-hover-color: #213444;
257
- --actions-icon-icative-color: #008fd6;
258
- }
259
- :root.dark-theme {
260
- --actions-icon-color: #e9eaec;
261
- --actions-icon-hover-color: #ffffff;
262
- --actions-icon-icative-color: #2ba2de;
263
- }
264
- </style>
265
- <style scoped lang="scss">
266
- .task-table {
267
- height: inherit;
268
-
269
- .target-link {
270
- font-family: Inter, serif;
271
- font-size: 13px;
272
- color: var(--bottom-pannel-rtask-link-text);
273
- font-weight: 400;
274
- line-height: 15.73px;
275
- cursor: pointer;
276
- &:hover {
277
- color: var(--bottom-pannel-rtask-link-hover-text);
278
- }
279
- }
280
- .chip-icon {
281
- min-width: 14px;
282
- }
283
- .icon {
284
- margin-right: 4px;
285
- }
286
-
287
- .actions {
288
- width: 100%;
289
-
290
- .action-icon {
291
- width: 16px;
292
- height: 16px;
293
- color: var(--actions-icon-color);
294
-
295
- &:hover {
296
- color: var(--actions-icon-hover-color);
297
- }
298
- &.active {
299
- color: var(--actions-icon-icative-color);
300
- }
301
- }
302
-
303
- .action-text {
304
- margin-left: 8px;
305
- }
306
- }
307
- }
308
- </style>
1
+ <template>
2
+ <ui-data-table
3
+ test-id="task-table"
4
+ :data="data"
5
+ :options="options"
6
+ :loading="props.loading"
7
+ :total-pages="props.totalPages"
8
+ :total-items="props.totalItems"
9
+ :texts="texts"
10
+ class="task-table"
11
+ @sort="onSorting"
12
+ @pagination="onPagination"
13
+ @column-filter="onColumnFilter"
14
+ >
15
+ <template #icon="{ item }">
16
+ <span class="flex-align-center">
17
+ <span :class="['icon', item.data.icon]" />
18
+
19
+ <span
20
+ :data-id="`rtask-${item.data.testId}`"
21
+ :class="item.data.isLink && 'target-link'"
22
+ @click.stop="onSelectNodeOfTree(item.data)"
23
+ >
24
+ {{ item.text }}
25
+ </span>
26
+ </span>
27
+ </template>
28
+
29
+ <template #status="{ item }">
30
+ <ui-chip :test-id="item.data.testId" :color="item.data.chipColor" rounded>
31
+ <ui-icon
32
+ :name="item.data.icon"
33
+ width="14px"
34
+ height="14px"
35
+ class="chip-icon"
36
+ ></ui-icon>
37
+ {{ item.text }}
38
+ </ui-chip>
39
+
40
+ <common-pages-tasks-table-error-info
41
+ v-if="item.data.error"
42
+ :id="item.data.testId"
43
+ :error="item.data.error"
44
+ :opened-error="openedError"
45
+ @toggle-error="onToggleError"
46
+ />
47
+ </template>
48
+
49
+ <template #default-actions="{ item }">
50
+ <div class="actions">
51
+ <ui-button
52
+ variant="text"
53
+ :test-id="`data-table-task-action-${item.data.id}`"
54
+ is-without-height
55
+ is-without-sizes
56
+ @click.stop="onToggleActions(item.data.id)"
57
+ >
58
+ <span
59
+ :class="['action-icon', { active: actionsShowId === item.data.id }]"
60
+ >
61
+ <ui-icon name="vertical-dotes" width="20" height="20" />
62
+ </span>
63
+ </ui-button>
64
+ <ui-dropdown
65
+ :show="actionsShowId === item.data.id"
66
+ :test-id="`data-table-task-dropdown-${item.data.id}`"
67
+ :items="actions"
68
+ :elem-id="`data-table-task-action-${item.data.id}`"
69
+ left
70
+ width="max-content"
71
+ @select="onSelectAction(item.data.target, $event)"
72
+ @hide="onHideActionsDropdown"
73
+ >
74
+ <template #row="{ item: dropMenu }">
75
+ <ui-icon
76
+ v-if="dropMenu.iconName === 'hide'"
77
+ name="password-hide"
78
+ width="16"
79
+ height="16"
80
+ />
81
+ <span class="action-text">
82
+ {{ dropMenu.text }}
83
+ </span>
84
+ </template>
85
+ </ui-dropdown>
86
+ </div>
87
+ </template>
88
+
89
+ <template #expand="{ item }">
90
+ <common-pages-tasks-table-expand-details :data="item.data" />
91
+ </template>
92
+ </ui-data-table>
93
+ </template>
94
+
95
+ <script setup lang="ts">
96
+ import type { UI_I_Dropdown } from '~/node_modules/bfg-uikit/components/ui/dropdown/models/interfaces'
97
+ import type {
98
+ UI_I_DataTable,
99
+ UI_I_DataTableHeader,
100
+ UI_I_DataTableBody,
101
+ UI_I_Pagination,
102
+ UI_I_TableTexts,
103
+ } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
104
+ import type { UI_T_ArbitraryObject } from '~/node_modules/bfg-uikit/models/types'
105
+ import type { UI_T_Project, UI_T_ProcuratorTypeNodes } from '~/lib/models/types'
106
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
107
+ import type { UI_I_TaskItem } from '~/lib/models/store/tasks/interfaces'
108
+ import type { UI_I_TableTarget } from '~/lib/models/table/interfaces'
109
+ import {
110
+ options,
111
+ getTargetActionsFunc,
112
+ getHeaderDataFunc,
113
+ getBodyDataFunc,
114
+ } from '~/components/common/pages/tasks/table/lib/config/config'
115
+ import { useDebounceFn } from '@vueuse/core'
116
+
117
+ const props = defineProps<{
118
+ project: UI_T_Project
119
+ tableData: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[]
120
+ totalPages: number
121
+ totalItems: number
122
+ loading: boolean
123
+ }>()
124
+ const emits = defineEmits<{
125
+ (event: 'sort', value: string): void
126
+ (event: 'pagination', value: UI_I_Pagination): void
127
+ (event: 'col-search', value: string): void
128
+ }>()
129
+
130
+ const localization = computed<UI_I_Localization>(() => useLocal())
131
+ const { $store }: any = useNuxtApp()
132
+
133
+ const texts = computed<UI_I_TableTexts>(() => ({
134
+ searchHere: localization.value.common.searchHere,
135
+ rowsPerPage: localization.value.common.rowsPerPage,
136
+ of: localization.value.common.of,
137
+ selected: localization.value.common.selected,
138
+ columns: localization.value.common.columns,
139
+ previous: localization.value.common.previous,
140
+ next: localization.value.common.next,
141
+ noItemsFound: localization.value.common.noItemsFound,
142
+ exportAll: localization.value.common.exportAll,
143
+ exportSelected: localization.value.common.exportSelected,
144
+ all: localization.value.common.all,
145
+ }))
146
+
147
+ const actionsShowId = ref<number>(-1)
148
+
149
+ const data = computed<UI_I_DataTable>(() => ({
150
+ id: 'tasks-table',
151
+ header: taskHeadItems.value,
152
+ body: taskBodyItems.value,
153
+ }))
154
+
155
+ const taskHeadItems = computed<UI_I_DataTableHeader[]>(() =>
156
+ getHeaderDataFunc(localization.value)
157
+ )
158
+
159
+ const taskBodyItems = ref<UI_I_DataTableBody[]>([])
160
+ watch(
161
+ () => props.tableData,
162
+ (newValue: UI_I_TaskItem<UI_T_ProcuratorTypeNodes>[]) => {
163
+ if (!newValue?.length) {
164
+ taskBodyItems.value = []
165
+ return
166
+ }
167
+
168
+ taskBodyItems.value = getBodyDataFunc(newValue, localization.value)
169
+ },
170
+ { deep: true, immediate: true }
171
+ )
172
+
173
+ const openedError = ref<string>('')
174
+
175
+ const onToggleError = (value: string): void => {
176
+ if (!value || value === openedError.value) {
177
+ openedError.value = ''
178
+ } else {
179
+ openedError.value = value
180
+ }
181
+ }
182
+
183
+ const onSorting = (value: string): void => {
184
+ emits('sort', value)
185
+ }
186
+ const onPagination = (value: UI_I_Pagination): void => {
187
+ emits('pagination', value)
188
+ }
189
+ const sendFilter = useDebounceFn((searchText: string) => {
190
+ emits('col-search', searchText)
191
+ }, 1000)
192
+ const onColumnFilter = (obj: UI_T_ArbitraryObject<string>): void => {
193
+ let searchText = ''
194
+
195
+ for (const [key, value] of Object.entries(obj)) {
196
+ const currentFilter = searchText
197
+ ? ',' + key + '.' + value
198
+ : key + '.' + value
199
+
200
+ searchText = searchText + (value ? currentFilter : '')
201
+ }
202
+ sendFilter(searchText)
203
+ }
204
+
205
+ const actions = computed<UI_I_Dropdown[]>(() =>
206
+ getTargetActionsFunc(localization.value, props.project)
207
+ )
208
+ const onToggleActions = (id: number): void => {
209
+ if (actionsShowId.value === id) {
210
+ actionsShowId.value = -1
211
+ } else {
212
+ actionsShowId.value = id
213
+ }
214
+ }
215
+ const onSelectAction = (
216
+ data: UI_I_TableTarget<typeof props.project>,
217
+ action: 'view-target' | 'view-zone'
218
+ ): void => {
219
+ switch (action) {
220
+ case 'view-target':
221
+ onSelectNodeOfTree(data)
222
+ break
223
+ case 'view-zone':
224
+ onSelectNodeOfTree({ ...data, type: 'zone', nav: 'h' })
225
+ break
226
+ }
227
+ onHideActionsDropdown()
228
+ }
229
+ const onHideActionsDropdown = (): void => {
230
+ actionsShowId.value = -1
231
+ }
232
+
233
+ const onSelectNodeOfTree = (
234
+ data: UI_I_TableTarget<typeof props.project>
235
+ ): void => {
236
+ if (!data.isLink) return
237
+
238
+ const { type, id, nav } = data
239
+
240
+ const node = {
241
+ id,
242
+ type,
243
+ }
244
+
245
+ const path = `/inventory/type=${type};nav=${nav};id=${id}/summary`
246
+ navigateTo(path)
247
+
248
+ $store.dispatch('inventory/A_SELECT_NODE', { node, type })
249
+ }
250
+ </script>
251
+
252
+ <style>
253
+ /*TODO move up*/
254
+ :root {
255
+ --actions-icon-color: #4d5d69;
256
+ --actions-icon-hover-color: #213444;
257
+ --actions-icon-icative-color: #008fd6;
258
+ }
259
+ :root.dark-theme {
260
+ --actions-icon-color: #e9eaec;
261
+ --actions-icon-hover-color: #ffffff;
262
+ --actions-icon-icative-color: #2ba2de;
263
+ }
264
+ </style>
265
+ <style scoped lang="scss">
266
+ .task-table {
267
+ height: inherit;
268
+
269
+ .target-link {
270
+ font-family: Inter, serif;
271
+ font-size: 13px;
272
+ color: var(--bottom-pannel-rtask-link-text);
273
+ font-weight: 400;
274
+ line-height: 15.73px;
275
+ cursor: pointer;
276
+ &:hover {
277
+ color: var(--bottom-pannel-rtask-link-hover-text);
278
+ }
279
+ }
280
+ .chip-icon {
281
+ min-width: 14px;
282
+ }
283
+ .icon {
284
+ margin-right: 4px;
285
+ }
286
+
287
+ .actions {
288
+ width: 100%;
289
+
290
+ .action-icon {
291
+ width: 16px;
292
+ height: 16px;
293
+ color: var(--actions-icon-color);
294
+
295
+ &:hover {
296
+ color: var(--actions-icon-hover-color);
297
+ }
298
+ &.active {
299
+ color: var(--actions-icon-icative-color);
300
+ }
301
+ }
302
+
303
+ .action-text {
304
+ margin-left: 8px;
305
+ }
306
+ }
307
+ }
308
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.794",
4
+ "version": "1.4.795",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",