bfg-common 1.4.773 → 1.4.774

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,5 +1,5 @@
1
1
  <template>
2
- <div class="tasks">
2
+ <div class="tasks table-container-tasks-table">
3
3
  <div class="tasks__headline">
4
4
  {{ localization.mainNavigation.tasks }}
5
5
  </div>
@@ -11,6 +11,8 @@
11
11
  :loading="isLoading"
12
12
  :project="props.project"
13
13
  @pagination="onUpdatePagination"
14
+ @sort="onSortTable"
15
+ @col-search="onColSearching"
14
16
  />
15
17
  </div>
16
18
  </template>
@@ -36,7 +38,7 @@ const pagination = ref<UI_I_Pagination>({
36
38
  pageSize: 100,
37
39
  })
38
40
  const sort = ref<string | null>(null)
39
-
41
+ const filter = ref<string | null>(null)
40
42
  const pauseGlobalRefresh = (): void => {
41
43
  const tasksLastRequestType = $store.getters['tasks/getTasksLastRequestType']
42
44
  $store.dispatch('main/A_PAUSE_GLOBAL_REFRESH', tasksLastRequestType)
@@ -59,11 +61,14 @@ const onUpdatePagination = (event: UI_I_Pagination): void => {
59
61
  pagination.value = event
60
62
  getTasks()
61
63
  }
62
-
63
- // const onSortTable = (event: string): void => {
64
- // sort.value = event
65
- // getTasks()
66
- // }
64
+ const onSortTable = (event: string): void => {
65
+ sort.value = event
66
+ getTasks()
67
+ }
68
+ const onColSearching = (value: string): void => {
69
+ filter.value = value
70
+ getTasks()
71
+ }
67
72
 
68
73
  const isLoading = computed<boolean>(() =>
69
74
  $store.getters['tasks/getLoading']('tasks')
@@ -90,7 +95,7 @@ onUnmounted(() => {
90
95
  margin-bottom: 22px;
91
96
  }
92
97
  :deep(.data-table-header) {
93
- z-index: 1050 !important; // TODO надо удалить потом (clr style)
98
+ z-index: 1000 !important; // TODO надо удалить потом (clr style)
94
99
  }
95
100
  }
96
101
  </style>
@@ -7,8 +7,9 @@
7
7
  :total-pages="props.totalPages"
8
8
  :total-items="props.totalItems"
9
9
  class="task-table"
10
- @sorting="onSorting"
10
+ @sort="onSorting"
11
11
  @pagination="onPagination"
12
+ @column-filter="onColumnFilter"
12
13
  >
13
14
  <template #icon="{ item }">
14
15
  <span class="flex-align-center">
@@ -96,6 +97,7 @@ import type {
96
97
  UI_I_DataTableBody,
97
98
  UI_I_Pagination,
98
99
  } from '~/node_modules/bfg-uikit/components/ui/dataTable/models/interfaces'
100
+ import type { UI_T_ArbitraryObject } from '~/node_modules/bfg-uikit/models/types'
99
101
  import type { UI_T_Project, UI_T_ProcuratorTypeNodes } from '~/lib/models/types'
100
102
  import type { UI_I_Localization } from '~/lib/models/interfaces'
101
103
  import type { UI_I_TaskItem } from '~/lib/models/store/tasks/interfaces'
@@ -106,6 +108,9 @@ import {
106
108
  getHeaderDataFunc,
107
109
  getBodyDataFunc,
108
110
  } from '~/components/common/pages/tasks/table/lib/config/config'
111
+ import { useDebounceFn } from '@vueuse/core'
112
+
113
+
109
114
 
110
115
  const props = defineProps<{
111
116
  project: UI_T_Project
@@ -117,6 +122,7 @@ const props = defineProps<{
117
122
  const emits = defineEmits<{
118
123
  (event: 'sort', value: string): void
119
124
  (event: 'pagination', value: UI_I_Pagination): void
125
+ (event: 'col-search', value: string): void
120
126
  }>()
121
127
 
122
128
  const localization = computed<UI_I_Localization>(() => useLocal())
@@ -153,6 +159,21 @@ const onSorting = (value: string): void => {
153
159
  const onPagination = (value: UI_I_Pagination): void => {
154
160
  emits('pagination', value)
155
161
  }
162
+ const sendFilter = useDebounceFn((searchText: string) => {
163
+ emits('col-search', searchText)
164
+ }, 1000)
165
+ const onColumnFilter = (obj: UI_T_ArbitraryObject<string>): void => {
166
+ let searchText = ''
167
+
168
+ for (const [key, value] of Object.entries(obj)) {
169
+ const currentFilter = searchText
170
+ ? ',' + key + '.' + value
171
+ : key + '.' + value
172
+
173
+ searchText = searchText + (value ? currentFilter : '')
174
+ }
175
+ sendFilter(searchText)
176
+ }
156
177
 
157
178
  const actions = computed<UI_I_Dropdown[]>(() =>
158
179
  getTargetActionsFunc(localization.value, props.project)
@@ -73,7 +73,7 @@ export const getHeaderDataFunc = (
73
73
  col: 'col5',
74
74
  colName: 'queued_for',
75
75
  text: localization.common.queuedFor,
76
- isSortable: true,
76
+ isSortable: false,
77
77
  sort: 'asc',
78
78
  width: '180px',
79
79
  show: true,
@@ -83,7 +83,7 @@ export const getHeaderDataFunc = (
83
83
  col: 'col6',
84
84
  colName: 'start_time',
85
85
  text: localization.common.startTime,
86
- isSortable: true,
86
+ isSortable: false,
87
87
  sort: 'asc',
88
88
  width: '180px',
89
89
  show: true,
@@ -91,7 +91,7 @@ export const getHeaderDataFunc = (
91
91
  },
92
92
  {
93
93
  col: 'col7',
94
- colName: 'completion_time',
94
+ colName: 'completion',
95
95
  text: localization.common.completionTime,
96
96
  isSortable: true,
97
97
  sort: 'asc',
@@ -103,7 +103,7 @@ export const getHeaderDataFunc = (
103
103
  col: 'col8',
104
104
  colName: 'execution_time',
105
105
  text: localization.common.executionTime,
106
- isSortable: true,
106
+ isSortable: false,
107
107
  sort: 'asc',
108
108
  width: '180px',
109
109
  show: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.773",
4
+ "version": "1.4.774",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
@@ -30,7 +30,7 @@ export default {
30
30
  },
31
31
  payload: UI_I_DataTableQuery
32
32
  ): Promise<API_UI_I_Error | void> {
33
- const { page, pageSize, sortBy } = payload
33
+ const { page, pageSize, sortBy, filter } = payload
34
34
 
35
35
  const query: UI_I_TableQuery = {
36
36
  page_size: pageSize,
@@ -38,6 +38,7 @@ export default {
38
38
  }
39
39
 
40
40
  if (sortBy) query.sortBy = sortBy
41
+ if (filter) query.filter = filter
41
42
 
42
43
  const queryJson: string = JSON.stringify({ type: 'tasks', ...query })
43
44
  const lastQuery: string = context.state.taskQuery || ''