bfg-common 1.4.792 → 1.4.793

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