@sfxcode/formkit-primevue 2.9.7 → 2.9.8

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.
@@ -19,6 +19,7 @@ export interface FormKitPrimeAutoCompleteProps {
19
19
  minLength?: AutoCompleteProps['minLength']
20
20
  placeholder?: AutoCompleteProps['placeholder']
21
21
  fluid?: AutoCompleteProps['fluid']
22
+ separators?: string[] | []
22
23
  }
23
24
 
24
25
  const props = defineProps({
@@ -34,6 +35,12 @@ const suggestions = ref(['', {}])
34
35
  suggestions.value = []
35
36
  const loading = ref(false)
36
37
 
38
+ /**
39
+ * Searches for suggestions based on the input query.
40
+ * If options and optionLabel are provided, it filters the options.
41
+ * Otherwise, it calls the complete function from the context to fetch suggestions.
42
+ * @param event - The AutoCompleteCompleteEvent containing the query.
43
+ */
37
44
  async function search(event: AutoCompleteCompleteEvent) {
38
45
  if (props.context?.options && props.context?.optionLabel) {
39
46
  suggestions.value = props.context.options.filter((option) => {
@@ -54,6 +61,38 @@ async function search(event: AutoCompleteCompleteEvent) {
54
61
  }
55
62
  }
56
63
  }
64
+
65
+ /**
66
+ * Handles paste event to transform a string separated by any of the provided separators into multiple items.
67
+ * @param event - The paste event from the input.
68
+ */
69
+ function handlePaste(event: ClipboardEvent) {
70
+ if (!props.context?.multiple)
71
+ return
72
+ const clipboardData = event.clipboardData
73
+ if (!clipboardData)
74
+ return
75
+ const pastedText = clipboardData.getData('text')
76
+ const separators = Array.isArray(props.context?.separators) && props.context.separators.length > 0
77
+ ? props.context.separators
78
+ : [',']
79
+ // Create a regex to split by any separator, escaping special regex characters
80
+ const regex = new RegExp(`[${separators.map(s => s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')).join('')}]`)
81
+ if (pastedText && regex.test(pastedText)) {
82
+ event.preventDefault()
83
+ const items = pastedText
84
+ .split(regex)
85
+ .map(item => item.trim())
86
+ .filter(item => item.length > 0)
87
+ if (Array.isArray(props.context._value)) {
88
+ props.context._value.push(...items)
89
+ }
90
+ else {
91
+ props.context._value = items
92
+ }
93
+ props.context?.node?.input?.(props.context?._value)
94
+ }
95
+ }
57
96
  </script>
58
97
 
59
98
  <template>
@@ -85,6 +124,7 @@ async function search(event: AutoCompleteCompleteEvent) {
85
124
  @complete="search"
86
125
  @change="handleInput"
87
126
  @blur="handleBlur"
127
+ @paste="handlePaste"
88
128
  >
89
129
  <template v-for="slotName in validSlotNames" :key="slotName" #[slotName]="slotProps">
90
130
  <component :is="context?.slots[slotName]" v-bind="{ ...context, ...slotProps }" />
@@ -30,7 +30,7 @@ var _PrimeToggleSwitch = _interopRequireDefault(require("../components/PrimeTogg
30
30
  var _PrimeTreeSelect = _interopRequireDefault(require("../components/PrimeTreeSelect.vue"));
31
31
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
32
32
  const primeAutoCompleteDefinition = exports.primeAutoCompleteDefinition = (0, _vue.createInput)(_PrimeAutoComplete.default, {
33
- props: ["pt", "ptOptions", "unstyled", "Select", "multiple", "typeahead", "optionLabel", "options", "size", "minLength", "placeholder", "fluid"]
33
+ props: ["pt", "ptOptions", "unstyled", "Select", "multiple", "typeahead", "optionLabel", "options", "size", "minLength", "placeholder", "fluid", "separators"]
34
34
  });
35
35
  const primeInputTextDefinition = exports.primeInputTextDefinition = (0, _vue.createInput)(_PrimeInputText.default, {
36
36
  props: ["pt", "ptOptions", "unstyled", "placeholder", "iconPrefix", "iconSuffix", "size", "inputType"]
@@ -23,7 +23,7 @@ import PrimeToggleButton from "../components/PrimeToggleButton.vue";
23
23
  import PrimeToggleSwitch from "../components/PrimeToggleSwitch.vue";
24
24
  import PrimeTreeSelect from "../components/PrimeTreeSelect.vue";
25
25
  export const primeAutoCompleteDefinition = createInput(PrimeAutoComplete, {
26
- props: ["pt", "ptOptions", "unstyled", "Select", "multiple", "typeahead", "optionLabel", "options", "size", "minLength", "placeholder", "fluid"]
26
+ props: ["pt", "ptOptions", "unstyled", "Select", "multiple", "typeahead", "optionLabel", "options", "size", "minLength", "placeholder", "fluid", "separators"]
27
27
  });
28
28
  export const primeInputTextDefinition = createInput(PrimeInputText, {
29
29
  props: ["pt", "ptOptions", "unstyled", "placeholder", "iconPrefix", "iconSuffix", "size", "inputType"]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sfxcode/formkit-primevue",
3
3
  "type": "module",
4
- "version": "2.9.7",
4
+ "version": "2.9.8",
5
5
  "packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39",
6
6
  "author": {
7
7
  "name": "Tom",
@@ -91,35 +91,35 @@
91
91
  "@formkit/i18n": "^1.6.9",
92
92
  "@formkit/inputs": "^1.6.9",
93
93
  "@formkit/vue": "^1.6.9",
94
- "@intlify/core": "^11.1.6",
94
+ "@intlify/core": "^11.1.9",
95
95
  "primeicons": "^7.0.0",
96
- "primevue": "^4.3.5",
97
- "vue-i18n": "^11.1.6"
96
+ "primevue": "^4.3.6",
97
+ "vue-i18n": "^11.1.9"
98
98
  },
99
99
  "devDependencies": {
100
- "@antfu/eslint-config": "^4.14.1",
100
+ "@antfu/eslint-config": "^4.16.2",
101
101
  "@formkit/core": "^1.6.9",
102
102
  "@formkit/drag-and-drop": "^0.5.3",
103
- "@primeuix/themes": "^1.1.2",
104
- "@types/node": "^24.0.3",
103
+ "@primeuix/themes": "^1.2.1",
104
+ "@types/node": "^24.0.13",
105
105
  "@types/uuid": "^10.0.0",
106
- "@unocss/preset-icons": "66.2.3",
107
- "@unocss/preset-uno": "66.2.3",
108
- "@vitejs/plugin-vue": "^5.2.4",
106
+ "@unocss/preset-icons": "66.3.3",
107
+ "@unocss/preset-uno": "66.3.3",
108
+ "@vitejs/plugin-vue": "^6.0.0",
109
109
  "@vitest/coverage-v8": "^3.2.4",
110
110
  "@vitest/ui": "^3.2.4",
111
111
  "@vue/compiler-sfc": "^3.5.17",
112
112
  "@vue/server-renderer": "^3.5.17",
113
113
  "@vue/test-utils": "^2.4.6",
114
114
  "@vue/tsconfig": "^0.7.0",
115
- "@vueuse/core": "^13.3.0",
115
+ "@vueuse/core": "^13.5.0",
116
116
  "@vueuse/head": "^2.0.0",
117
- "changelogen": "^0.6.1",
117
+ "changelogen": "^0.6.2",
118
118
  "chart.js": "^4.5.0",
119
119
  "consola": "^3.4.2",
120
120
  "cookie": "^1.0.2",
121
- "esbuild": "^0.25.5",
122
- "eslint": "^9.29.0",
121
+ "esbuild": "^0.25.6",
122
+ "eslint": "^9.31.0",
123
123
  "happy-dom": "^18.0.1",
124
124
  "json-editor-vue": "^0.18.1",
125
125
  "mkdist": "^2.3.0",
@@ -128,19 +128,19 @@
128
128
  "tslib": "^2.8.1",
129
129
  "typescript": "^5.8.3",
130
130
  "unbuild": "^3.5.0",
131
- "unocss": "66.2.3",
131
+ "unocss": "66.3.3",
132
132
  "unplugin-auto-import": "^19.3.0",
133
- "unplugin-vue-components": "^28.7.0",
134
- "vite": "^6.3.5",
133
+ "unplugin-vue-components": "^28.8.0",
134
+ "vite": "^7.0.4",
135
135
  "vite-plugin-dts": "^4.5.4",
136
136
  "vite-plugin-eslint": "^1.8.1",
137
- "vite-plugin-pages": "^0.33.0",
138
- "vite-ssg": "^27.0.1",
137
+ "vite-plugin-pages": "^0.33.1",
138
+ "vite-ssg": "^28.0.0",
139
139
  "vitepress": "^1.6.3",
140
140
  "vitest": "^3.2.4",
141
141
  "vue": "^3.5.17",
142
142
  "vue-demi": "^0.14.10",
143
143
  "vue-router": "^4.5.1",
144
- "vue-tsc": "^2.2.10"
144
+ "vue-tsc": "^3.0.1"
145
145
  }
146
146
  }