@dataloop-ai/components 0.19.45 → 0.19.47

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.19.45",
3
+ "version": "0.19.47",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -132,6 +132,7 @@
132
132
  :key="col.name"
133
133
  :props="getHeaderScope({ col })"
134
134
  :col-index="colIndex"
135
+ :pagination="computedPagination"
135
136
  >
136
137
  <span class="inner-th">
137
138
  {{ col.label }}
@@ -480,6 +481,7 @@
480
481
  :key="col.name"
481
482
  :props="getHeaderScope({ col })"
482
483
  :col-index="colIndex"
484
+ :pagination="computedPagination"
483
485
  @click="onThClick($event, col.name)"
484
486
  >
485
487
  <span class="inner-th">
@@ -1925,7 +1927,8 @@ export default defineComponent({
1925
1927
  computedVisibleCols,
1926
1928
  totalItemsCount,
1927
1929
  showRowActions,
1928
- tableRef
1930
+ tableRef,
1931
+ computedPagination
1929
1932
  }
1930
1933
  }
1931
1934
  })
@@ -5,11 +5,18 @@
5
5
  :class="thClasses"
6
6
  :data-col-index="colIndex"
7
7
  @click="onClick"
8
+ @mouseenter="iconHover = true"
9
+ @mouseleave="iconHover = false"
8
10
  >
9
11
  <dl-icon
10
12
  v-if="isSortable && align === 'right'"
11
13
  :class="iconClass"
12
- icon="icon-dl-arrow-up"
14
+ :icon="computedSortIcon"
15
+ :style="
16
+ !isCurrentlySorted && !iconHover
17
+ ? 'display: none !important;'
18
+ : ''
19
+ "
13
20
  />
14
21
  <dl-tooltip v-if="hasEllipsis">
15
22
  <slot />
@@ -33,7 +40,12 @@
33
40
  v-if="isSortable && ['left', 'center'].includes(align)"
34
41
  style="margin-top: 2px"
35
42
  :class="iconClass"
36
- icon="icon-dl-arrow-up"
43
+ :icon="computedSortIcon"
44
+ :style="
45
+ !isCurrentlySorted && !iconHover
46
+ ? 'display: none !important;'
47
+ : ''
48
+ "
37
49
  />
38
50
  </span>
39
51
  </th>
@@ -41,13 +53,7 @@
41
53
 
42
54
  <script lang="ts">
43
55
  import { isString } from 'lodash'
44
- import {
45
- defineComponent,
46
- getCurrentInstance,
47
- computed,
48
- ref,
49
- toRefs
50
- } from 'vue-demi'
56
+ import { defineComponent, getCurrentInstance, computed, ref } from 'vue-demi'
51
57
  import { useSizeObserver } from '../../../../hooks/use-size-observer'
52
58
  import { stringStyleToRecord } from '../../../../utils'
53
59
  import { DlIcon } from '../../../essential'
@@ -65,6 +71,10 @@ export default defineComponent({
65
71
  colIndex: {
66
72
  type: Number,
67
73
  default: null
74
+ },
75
+ pagination: {
76
+ type: Object,
77
+ default: () => ({})
68
78
  }
69
79
  },
70
80
  emits: ['click'],
@@ -72,6 +82,7 @@ export default defineComponent({
72
82
  setup(props, { emit, attrs }) {
73
83
  const vm = getCurrentInstance()
74
84
  const tableTh = ref(null)
85
+ const iconHover = ref(false)
75
86
 
76
87
  const { hasEllipsis } = useSizeObserver(tableTh)
77
88
 
@@ -79,6 +90,16 @@ export default defineComponent({
79
90
  emit('click', event, name)
80
91
  }
81
92
 
93
+ const isCurrentlySorted = computed(() => {
94
+ return props.props?.col?.name === props.pagination.sortBy
95
+ })
96
+
97
+ const computedSortIcon = computed<string>(() => {
98
+ return props.pagination.descending
99
+ ? 'icon-dl-arrowdown'
100
+ : 'icon-dl-arrow-up'
101
+ })
102
+
82
103
  const hasOptionalProps = computed(() => {
83
104
  return !!Object.keys(props.props ?? {})
84
105
  })
@@ -163,7 +184,10 @@ export default defineComponent({
163
184
  tableTh,
164
185
  hasEllipsis,
165
186
  onClick,
166
- column
187
+ column,
188
+ computedSortIcon,
189
+ isCurrentlySorted,
190
+ iconHover
167
191
  }
168
192
  }
169
193
  })
@@ -128,15 +128,7 @@
128
128
  }
129
129
  }
130
130
 
131
- &.sorted .dl-table__sort-icon {
132
- opacity: 0.86 !important;
133
- }
134
131
 
135
- &.sort-desc .dl-table__sort-icon {
136
- &::v-deep .dl-icon {
137
- transform: rotate(180deg) !important;
138
- }
139
- }
140
132
  }
141
133
 
142
134
  thead,
@@ -237,7 +229,7 @@
237
229
 
238
230
  &__sort-icon {
239
231
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.5, 1);
240
- opacity: 0;
232
+ opacity: 0.86;
241
233
 
242
234
  &--left,
243
235
  &--center {