@dataloop-ai/components 0.18.85 → 0.18.87

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.18.85",
3
+ "version": "0.18.87",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -113,7 +113,8 @@ import {
113
113
  replaceJSDatesWithStringifiedDates,
114
114
  replaceStringifiedDatesWithJSDates,
115
115
  setAliases,
116
- revertAliases
116
+ revertAliases,
117
+ clearPartlyTypedSuggestion
117
118
  } from '../utils'
118
119
  import { v4 } from 'uuid'
119
120
  import {
@@ -260,14 +261,13 @@ export default defineComponent({
260
261
  }
261
262
 
262
263
  searchQuery.value = value
263
- input.value.innerHTML = value
264
264
 
265
- // const resetCursor = restoreCursorPosition(input.value)
265
+ if (value !== input.value.innerText) {
266
+ input.value.innerHTML = value
267
+ }
268
+
266
269
  updateEditor(input.value, editorStyle.value)
267
270
  setMenuOffset(isEligibleToChange(input.value, expanded.value))
268
- // resetCursor()
269
-
270
- setCaret(input.value)
271
271
 
272
272
  if (!expanded.value) {
273
273
  isOverflowing.value =
@@ -330,7 +330,10 @@ export default defineComponent({
330
330
  stringValue = value + ' '
331
331
  }
332
332
 
333
- setInputValue(stringValue)
333
+ setInputValue(
334
+ clearPartlyTypedSuggestion(input.value.innerText, stringValue)
335
+ )
336
+ setCaret(input.value)
334
337
  }
335
338
 
336
339
  const debouncedSetInputValue = debounce(setInputValue, 300)
@@ -52,7 +52,6 @@ export function updateEditor(
52
52
  })
53
53
 
54
54
  editor.innerHTML = renderText(textContent, colorSchema)
55
-
56
55
  restoreSelection(editor, anchorIndex, focusIndex)
57
56
  }
58
57
 
@@ -120,3 +119,24 @@ export function setCaret(target: HTMLElement) {
120
119
  sel.addRange(range)
121
120
  target.focus()
122
121
  }
122
+
123
+ export function clearPartlyTypedSuggestion(oldValue: string, newValue: string) {
124
+ const oldSuggestion = oldValue.split(' ').at(-1)
125
+ const newSuggestion = newValue.split(' ').at(-2)
126
+ if (oldSuggestion && newSuggestion?.includes(oldSuggestion)) {
127
+ newValue = removeOldSuggestion(newValue)
128
+ }
129
+ return newValue
130
+ }
131
+
132
+ function removeOldSuggestion(inputString: string) {
133
+ const words = inputString.trim().split(' ')
134
+
135
+ if (words.length >= 2) {
136
+ words.splice(-2, 1)
137
+ const resultString = words.join(' ')
138
+ return resultString + ' '
139
+ } else {
140
+ return inputString
141
+ }
142
+ }
@@ -8,9 +8,9 @@
8
8
  border-collapse: separate;
9
9
  border-spacing: 0;
10
10
 
11
- &__drag-icon > div {
11
+ &__drag-icon>div {
12
12
  transition: all ease-in 0.1s;
13
- opacity: 0;
13
+ opacity: 0;
14
14
  }
15
15
 
16
16
  //markup-table
@@ -53,6 +53,10 @@
53
53
  }
54
54
  }
55
55
 
56
+ .trigger-icon {
57
+ margin-right: 5px
58
+ }
59
+
56
60
  th:first-child,
57
61
  td:first-child {
58
62
  padding-left: 8px;
@@ -71,9 +75,10 @@
71
75
  height: 40px;
72
76
 
73
77
  &:not(.dl-tr--no-hover):hover {
74
- .dl-table__drag-icon > div {
78
+ .dl-table__drag-icon>div {
75
79
  opacity: 1;
76
80
  }
81
+
77
82
  td:not(.dl-td--no-hover) {
78
83
  background-color: var(--dl-color-fill-hover);
79
84
  }
@@ -86,6 +91,7 @@
86
91
  white-space: nowrap;
87
92
  overflow: hidden;
88
93
  padding: 10px 8px;
94
+ display: flex;
89
95
  }
90
96
 
91
97
  th {
@@ -45,6 +45,7 @@
45
45
  <template #icon="{}">
46
46
  <DlIcon
47
47
  v-if="(row.children || []).length > 0 && colIndex === 0"
48
+ style="margin-right: 5px"
48
49
  :icon="`icon-dl-${row.expanded ? 'down' : 'right'}-chevron`"
49
50
  @click="emitUpdateExpandedRow"
50
51
  />