@adminforth/text-complete 1.4.1 → 1.4.3

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/build.log CHANGED
@@ -9,5 +9,5 @@ custom/package-lock.json
9
9
  custom/package.json
10
10
  custom/tsconfig.json
11
11
 
12
- sent 18,697 bytes received 96 bytes 37,586.00 bytes/sec
13
- total size is 18,344 speedup is 0.98
12
+ sent 19,663 bytes received 96 bytes 39,518.00 bytes/sec
13
+ total size is 19,305 speedup is 0.98
@@ -11,7 +11,7 @@
11
11
  :debounceTime="meta.debounceTime"
12
12
  />
13
13
  <div class="absolute right-2 bottom-1">
14
- <Tooltip v-if="isUntouched">
14
+ <Tooltip v-if="isUntouched || (!currentValue.trim() && !isFocused)">
15
15
  <button
16
16
  @click.stop="handleFocus"
17
17
  @mousedown.prevent
@@ -25,7 +25,7 @@
25
25
  </Tooltip>
26
26
 
27
27
  <Spinner v-else-if="isLoading" class="w-6 h-6" lightFill="#000000" darkFill="#ffffff" />
28
- <Tooltip v-else>
28
+ <Tooltip v-else-if="isFocused">
29
29
  <button
30
30
  @click.stop="approveCompletion"
31
31
  @mousedown.prevent
@@ -64,11 +64,19 @@ const emit = defineEmits([
64
64
 
65
65
  const isLoading = ref<boolean>(false);
66
66
  const isUntouched = ref<boolean>(true);
67
+ const isFocused = ref<boolean>(false);
67
68
  const currentValue: Ref<string> = ref('');
68
69
  const suggestionInputRef = ref<InstanceType<typeof SuggestionInput> | null>(null);
69
70
 
70
71
  onMounted(() => {
71
72
  currentValue.value = props.record[props.column.name] || '';
73
+ if (suggestionInputRef.value) {
74
+ const editor = suggestionInputRef.value.$el.querySelector('.ql-editor');
75
+ if (editor) {
76
+ editor.addEventListener('focus', handleFocus);
77
+ editor.addEventListener('blur', handleBlur);
78
+ }
79
+ }
72
80
  });
73
81
 
74
82
  watch(() => currentValue.value, (value) => {
@@ -97,12 +105,12 @@ async function complete(textBeforeCursor: string) {
97
105
 
98
106
  const approveCompletion = async () => {
99
107
  if (suggestionInputRef.value) {
100
- console.log('✋ approveCompletion', suggestionInputRef.value);
101
108
  await suggestionInputRef.value.approveCompletion('all');
102
109
  }
103
110
  }
104
111
 
105
112
  function handleFocus() {
113
+ isFocused.value = true;
106
114
  if (suggestionInputRef.value) {
107
115
  const editor = suggestionInputRef.value.$el.querySelector('.ql-editor');
108
116
  if (editor) {
@@ -111,6 +119,10 @@ function handleFocus() {
111
119
  }
112
120
  }
113
121
 
122
+ function handleBlur() {
123
+ isFocused.value = false;
124
+ }
125
+
114
126
  </script>
115
127
 
116
128
  <style>
@@ -9,7 +9,8 @@
9
9
  "version": "1.0.0",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "vue-suggestion-input": "^1.0.9"
12
+ "@iconify-prerendered/vue-mdi": "^0.28.1737398331",
13
+ "vue-suggestion-input": "^1.0.10"
13
14
  }
14
15
  },
15
16
  "node_modules/@babel/helper-string-parser": {
@@ -58,6 +59,18 @@
58
59
  "node": ">=6.9.0"
59
60
  }
60
61
  },
62
+ "node_modules/@iconify-prerendered/vue-mdi": {
63
+ "version": "0.28.1737398331",
64
+ "resolved": "https://registry.npmjs.org/@iconify-prerendered/vue-mdi/-/vue-mdi-0.28.1737398331.tgz",
65
+ "integrity": "sha512-VzBgRTfdhrUZeuaImPGX+l+Eb94qEQSSLGKKHs6BxQXJV9jPoDGqgQkzsUbZHThC81WQ1aY2EvlhmTgGq9yKEA==",
66
+ "license": "Apache-2.0",
67
+ "funding": {
68
+ "url": "https://www.buymeacoffee.com/kozack/"
69
+ },
70
+ "peerDependencies": {
71
+ "vue": "^3.0.0"
72
+ }
73
+ },
61
74
  "node_modules/@jridgewell/sourcemap-codec": {
62
75
  "version": "1.5.0",
63
76
  "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
@@ -346,9 +359,9 @@
346
359
  }
347
360
  },
348
361
  "node_modules/vue-suggestion-input": {
349
- "version": "1.0.9",
350
- "resolved": "https://registry.npmjs.org/vue-suggestion-input/-/vue-suggestion-input-1.0.9.tgz",
351
- "integrity": "sha512-arnk/TT1KGrnD1hHoRpBM/upp22RNswdgUHvmTFnwW/Wdej5au2U5ogXRdLKgcBb/erxs2curZMjWiqbxpYo8g==",
362
+ "version": "1.0.10",
363
+ "resolved": "https://registry.npmjs.org/vue-suggestion-input/-/vue-suggestion-input-1.0.10.tgz",
364
+ "integrity": "sha512-QfVLL7MEscXYJNeSkKGu2h3p2UspTZuHLH1IN2RQcPGu4qeYh4UzYWGHtDhZMLJVSjjvPlS0nX3eMxJ/gkvbKQ==",
352
365
  "dependencies": {
353
366
  "quill": "^2.0.2",
354
367
  "vue": "^3.4.31"
@@ -10,6 +10,7 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "vue-suggestion-input": "^1.0.9"
13
+ "@iconify-prerendered/vue-mdi": "^0.28.1737398331",
14
+ "vue-suggestion-input": "^1.0.10"
14
15
  }
15
16
  }
@@ -11,7 +11,7 @@
11
11
  :debounceTime="meta.debounceTime"
12
12
  />
13
13
  <div class="absolute right-2 bottom-1">
14
- <Tooltip v-if="isUntouched">
14
+ <Tooltip v-if="isUntouched || (!currentValue.trim() && !isFocused)">
15
15
  <button
16
16
  @click.stop="handleFocus"
17
17
  @mousedown.prevent
@@ -25,7 +25,7 @@
25
25
  </Tooltip>
26
26
 
27
27
  <Spinner v-else-if="isLoading" class="w-6 h-6" lightFill="#000000" darkFill="#ffffff" />
28
- <Tooltip v-else>
28
+ <Tooltip v-else-if="isFocused">
29
29
  <button
30
30
  @click.stop="approveCompletion"
31
31
  @mousedown.prevent
@@ -64,11 +64,19 @@ const emit = defineEmits([
64
64
 
65
65
  const isLoading = ref<boolean>(false);
66
66
  const isUntouched = ref<boolean>(true);
67
+ const isFocused = ref<boolean>(false);
67
68
  const currentValue: Ref<string> = ref('');
68
69
  const suggestionInputRef = ref<InstanceType<typeof SuggestionInput> | null>(null);
69
70
 
70
71
  onMounted(() => {
71
72
  currentValue.value = props.record[props.column.name] || '';
73
+ if (suggestionInputRef.value) {
74
+ const editor = suggestionInputRef.value.$el.querySelector('.ql-editor');
75
+ if (editor) {
76
+ editor.addEventListener('focus', handleFocus);
77
+ editor.addEventListener('blur', handleBlur);
78
+ }
79
+ }
72
80
  });
73
81
 
74
82
  watch(() => currentValue.value, (value) => {
@@ -97,12 +105,12 @@ async function complete(textBeforeCursor: string) {
97
105
 
98
106
  const approveCompletion = async () => {
99
107
  if (suggestionInputRef.value) {
100
- console.log('✋ approveCompletion', suggestionInputRef.value);
101
108
  await suggestionInputRef.value.approveCompletion('all');
102
109
  }
103
110
  }
104
111
 
105
112
  function handleFocus() {
113
+ isFocused.value = true;
106
114
  if (suggestionInputRef.value) {
107
115
  const editor = suggestionInputRef.value.$el.querySelector('.ql-editor');
108
116
  if (editor) {
@@ -111,6 +119,10 @@ function handleFocus() {
111
119
  }
112
120
  }
113
121
 
122
+ function handleBlur() {
123
+ isFocused.value = false;
124
+ }
125
+
114
126
  </script>
115
127
 
116
128
  <style>
@@ -9,7 +9,8 @@
9
9
  "version": "1.0.0",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "vue-suggestion-input": "^1.0.9"
12
+ "@iconify-prerendered/vue-mdi": "^0.28.1737398331",
13
+ "vue-suggestion-input": "^1.0.10"
13
14
  }
14
15
  },
15
16
  "node_modules/@babel/helper-string-parser": {
@@ -58,6 +59,18 @@
58
59
  "node": ">=6.9.0"
59
60
  }
60
61
  },
62
+ "node_modules/@iconify-prerendered/vue-mdi": {
63
+ "version": "0.28.1737398331",
64
+ "resolved": "https://registry.npmjs.org/@iconify-prerendered/vue-mdi/-/vue-mdi-0.28.1737398331.tgz",
65
+ "integrity": "sha512-VzBgRTfdhrUZeuaImPGX+l+Eb94qEQSSLGKKHs6BxQXJV9jPoDGqgQkzsUbZHThC81WQ1aY2EvlhmTgGq9yKEA==",
66
+ "license": "Apache-2.0",
67
+ "funding": {
68
+ "url": "https://www.buymeacoffee.com/kozack/"
69
+ },
70
+ "peerDependencies": {
71
+ "vue": "^3.0.0"
72
+ }
73
+ },
61
74
  "node_modules/@jridgewell/sourcemap-codec": {
62
75
  "version": "1.5.0",
63
76
  "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
@@ -346,9 +359,9 @@
346
359
  }
347
360
  },
348
361
  "node_modules/vue-suggestion-input": {
349
- "version": "1.0.9",
350
- "resolved": "https://registry.npmjs.org/vue-suggestion-input/-/vue-suggestion-input-1.0.9.tgz",
351
- "integrity": "sha512-arnk/TT1KGrnD1hHoRpBM/upp22RNswdgUHvmTFnwW/Wdej5au2U5ogXRdLKgcBb/erxs2curZMjWiqbxpYo8g==",
362
+ "version": "1.0.10",
363
+ "resolved": "https://registry.npmjs.org/vue-suggestion-input/-/vue-suggestion-input-1.0.10.tgz",
364
+ "integrity": "sha512-QfVLL7MEscXYJNeSkKGu2h3p2UspTZuHLH1IN2RQcPGu4qeYh4UzYWGHtDhZMLJVSjjvPlS0nX3eMxJ/gkvbKQ==",
352
365
  "dependencies": {
353
366
  "quill": "^2.0.2",
354
367
  "vue": "^3.4.31"
@@ -10,6 +10,7 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "vue-suggestion-input": "^1.0.9"
13
+ "@iconify-prerendered/vue-mdi": "^0.28.1737398331",
14
+ "vue-suggestion-input": "^1.0.10"
14
15
  }
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/text-complete",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Text completion plugin for adminforth",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",