@sfxcode/formkit-primevue 3.2.9 → 3.2.10
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/dist/components/PrimeOutputText.d.vue.ts +1 -0
- package/dist/components/PrimeOutputText.vue +21 -5
- package/dist/components/PrimeOutputText.vue.d.ts +1 -0
- package/dist/composables/useInputEditor.js +3 -1
- package/dist/composables/useInputEditor.mjs +2 -1
- package/dist/definitions/output.js +1 -1
- package/dist/definitions/output.mjs +1 -1
- package/dist/index.d.ts +38 -1
- package/package.json +26 -26
|
@@ -13,6 +13,7 @@ export interface FormKitOutputTextProps {
|
|
|
13
13
|
html?: boolean
|
|
14
14
|
isTranslationKey?: boolean
|
|
15
15
|
convertValue?: (value: string) => string
|
|
16
|
+
maxLength?: number
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const props = defineProps({
|
|
@@ -25,20 +26,35 @@ const props = defineProps({
|
|
|
25
26
|
const textValue = computed(() => {
|
|
26
27
|
const value = props.context?._value
|
|
27
28
|
const { t } = useI18n()
|
|
29
|
+
let result = ''
|
|
28
30
|
if (value) {
|
|
29
31
|
if (props.context?.isTranslationKey) {
|
|
30
|
-
|
|
32
|
+
result = t(value)
|
|
31
33
|
}
|
|
32
34
|
else if (typeof props.context?.convertValue === 'function') {
|
|
33
|
-
|
|
35
|
+
result = props.context?.convertValue(value)
|
|
34
36
|
}
|
|
35
37
|
else {
|
|
36
|
-
|
|
38
|
+
result = value
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
|
|
42
|
+
// Apply maxLength truncation if specified
|
|
43
|
+
const maxLength = props.context?.maxLength as number | undefined
|
|
44
|
+
if (result && maxLength && !props.context?.html && result.length > maxLength) {
|
|
45
|
+
// Try to truncate at word boundary
|
|
46
|
+
let truncated = result.substring(0, maxLength)
|
|
47
|
+
const lastSpaceIndex = truncated.lastIndexOf(' ')
|
|
48
|
+
|
|
49
|
+
// Only truncate at word boundary if there's a space, and it's not too far back
|
|
50
|
+
// (at least 80% of maxLength to avoid cutting too much)
|
|
51
|
+
if (lastSpaceIndex > maxLength * 0.8) {
|
|
52
|
+
truncated = truncated.substring(0, lastSpaceIndex)
|
|
53
|
+
}
|
|
54
|
+
result = `${truncated}...`
|
|
41
55
|
}
|
|
56
|
+
|
|
57
|
+
return result
|
|
42
58
|
})
|
|
43
59
|
|
|
44
60
|
const { hasPrefix, hasPrefixIcon, hasSuffix, hasSuffixIcon } = useFormKitSection(props.context)
|
|
@@ -77,7 +77,9 @@ function useInputEditor() {
|
|
|
77
77
|
for (const key in result) {
|
|
78
78
|
const value = result[key];
|
|
79
79
|
if (value !== null && value !== void 0 && typeof value === "string") {
|
|
80
|
-
if (value.trim().length === 0)
|
|
80
|
+
if (value.trim().length === 0) {
|
|
81
|
+
result[key] = void 0;
|
|
82
|
+
}
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
return result;
|
|
@@ -73,8 +73,9 @@ export function useInputEditor() {
|
|
|
73
73
|
for (const key in result) {
|
|
74
74
|
const value = result[key];
|
|
75
75
|
if (value !== null && value !== void 0 && typeof value === "string") {
|
|
76
|
-
if (value.trim().length === 0)
|
|
76
|
+
if (value.trim().length === 0) {
|
|
77
77
|
result[key] = void 0;
|
|
78
|
+
}
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
return result;
|
|
@@ -15,7 +15,7 @@ var _PrimeOutputReference = _interopRequireDefault(require("../components/PrimeO
|
|
|
15
15
|
var _PrimeOutputText = _interopRequireDefault(require("../components/PrimeOutputText.vue"));
|
|
16
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
const primeOutputTextDefinition = exports.primeOutputTextDefinition = (0, _vue.createInput)(_PrimeOutputText.default, {
|
|
18
|
-
props: ["prefix", "suffix", "iconPrefix", "iconSuffix", "isTranslationKey", "html", "onIconPrefixClicked", "onIconSuffixClicked", "convertValue"]
|
|
18
|
+
props: ["prefix", "suffix", "iconPrefix", "iconSuffix", "isTranslationKey", "html", "onIconPrefixClicked", "onIconSuffixClicked", "convertValue", "maxLength"]
|
|
19
19
|
});
|
|
20
20
|
const primeOutputDateDefinition = exports.primeOutputDateDefinition = (0, _vue.createInput)(_PrimeOutputDate.default, {
|
|
21
21
|
props: ["prefix", "suffix", "iconPrefix", "iconSuffix", "onIconPrefixClicked", "onIconSuffixClicked"]
|
|
@@ -8,7 +8,7 @@ import PrimeOutputNumber from "../components/PrimeOutputNumber.vue";
|
|
|
8
8
|
import PrimeOutputReference from "../components/PrimeOutputReference.vue";
|
|
9
9
|
import PrimeOutputText from "../components/PrimeOutputText.vue";
|
|
10
10
|
export const primeOutputTextDefinition = createInput(PrimeOutputText, {
|
|
11
|
-
props: ["prefix", "suffix", "iconPrefix", "iconSuffix", "isTranslationKey", "html", "onIconPrefixClicked", "onIconSuffixClicked", "convertValue"]
|
|
11
|
+
props: ["prefix", "suffix", "iconPrefix", "iconSuffix", "isTranslationKey", "html", "onIconPrefixClicked", "onIconSuffixClicked", "convertValue", "maxLength"]
|
|
12
12
|
});
|
|
13
13
|
export const primeOutputDateDefinition = createInput(PrimeOutputDate, {
|
|
14
14
|
props: ["prefix", "suffix", "iconPrefix", "iconSuffix", "onIconPrefixClicked", "onIconSuffixClicked"]
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { FormKitInputs } from '@formkit/inputs';
|
|
1
|
+
import type { FormKitBaseSlots, FormKitInputs } from '@formkit/inputs';
|
|
2
|
+
import type { AutoCompleteSlots, CascadeSelectSlots, CheckboxSlots, ColorPickerSlots, DatePickerSlots, InputMaskSlots, InputNumberSlots, InputOtpSlots, InputTextSlots, KnobSlots, ListboxSlots, MultiSelectSlots, PasswordSlots, RadioButtonSlots, RatingSlots, SelectButtonSlots, SelectSlots, SliderSlots, TextareaSlots, ToggleButtonSlots, ToggleSwitchSlots, TreeSelectSlots } from 'primevue';
|
|
2
3
|
import type { CascadeSelectProps } from 'primevue/cascadeselect';
|
|
3
4
|
import type { ListboxProps } from 'primevue/listbox';
|
|
4
5
|
import type { MultiSelectProps } from 'primevue/multiselect';
|
|
@@ -9,6 +10,10 @@ import { FormKitDataEdit, FormKitDataView } from './components';
|
|
|
9
10
|
import { useFormKitRepeater, useFormKitSchema, useInputEditor, useInputEditorSchema, usePrimeInputs } from './composables';
|
|
10
11
|
import { primeInputs, primeOutputs } from './definitions';
|
|
11
12
|
export { FormKitDataEdit, FormKitDataView, primeInputs, primeOutputs, useFormKitRepeater, useFormKitSchema, useInputEditor, useInputEditorSchema, usePrimeInputs, };
|
|
13
|
+
/**
|
|
14
|
+
* Keeps all slots from 1st argument, add any slots from 2nd type which do not collide with the 1st's names.
|
|
15
|
+
*/
|
|
16
|
+
type MergeSlots<A, B> = A & Omit<B, keyof A>;
|
|
12
17
|
declare module '@formkit/inputs' {
|
|
13
18
|
interface FormKitInputProps<Props extends FormKitInputs<Props>> {
|
|
14
19
|
primeAutoComplete: {
|
|
@@ -108,4 +113,36 @@ declare module '@formkit/inputs' {
|
|
|
108
113
|
type: 'primeOutputList';
|
|
109
114
|
};
|
|
110
115
|
}
|
|
116
|
+
interface FormKitInputSlots<Props extends FormKitInputs<Props>> {
|
|
117
|
+
primeAutoComplete: MergeSlots<FormKitBaseSlots<Props>, AutoCompleteSlots>;
|
|
118
|
+
primeCascadeSelect: MergeSlots<FormKitBaseSlots<Props>, CascadeSelectSlots>;
|
|
119
|
+
primeCheckbox: MergeSlots<FormKitBaseSlots<Props>, CheckboxSlots>;
|
|
120
|
+
primeColorPicker: MergeSlots<FormKitBaseSlots<Props>, ColorPickerSlots>;
|
|
121
|
+
primeDatePicker: MergeSlots<FormKitBaseSlots<Props>, DatePickerSlots>;
|
|
122
|
+
primeInputMask: MergeSlots<FormKitBaseSlots<Props>, InputMaskSlots>;
|
|
123
|
+
primeInputNumber: MergeSlots<FormKitBaseSlots<Props>, InputNumberSlots>;
|
|
124
|
+
primeInputOtp: MergeSlots<FormKitBaseSlots<Props>, InputOtpSlots>;
|
|
125
|
+
primeInputText: MergeSlots<FormKitBaseSlots<Props>, InputTextSlots>;
|
|
126
|
+
primeKnob: MergeSlots<FormKitBaseSlots<Props>, KnobSlots>;
|
|
127
|
+
primeListbox: MergeSlots<FormKitBaseSlots<Props>, ListboxSlots>;
|
|
128
|
+
primeMultiSelect: MergeSlots<FormKitBaseSlots<Props>, MultiSelectSlots>;
|
|
129
|
+
primeOutputBoolean: FormKitBaseSlots<Props>;
|
|
130
|
+
primeOutputDate: FormKitBaseSlots<Props>;
|
|
131
|
+
primeOutputDuration: FormKitBaseSlots<Props>;
|
|
132
|
+
primeOutputLink: FormKitBaseSlots<Props>;
|
|
133
|
+
primeOutputList: FormKitBaseSlots<Props>;
|
|
134
|
+
primeOutputNumber: FormKitBaseSlots<Props>;
|
|
135
|
+
primeOutputReference: FormKitBaseSlots<Props>;
|
|
136
|
+
primeOutputText: FormKitBaseSlots<Props>;
|
|
137
|
+
primePassword: MergeSlots<FormKitBaseSlots<Props>, PasswordSlots>;
|
|
138
|
+
primeRadioButton: MergeSlots<FormKitBaseSlots<Props>, RadioButtonSlots>;
|
|
139
|
+
primeRating: MergeSlots<FormKitBaseSlots<Props>, RatingSlots>;
|
|
140
|
+
primeSelect: MergeSlots<FormKitBaseSlots<Props>, SelectSlots>;
|
|
141
|
+
primeSelectButton: MergeSlots<FormKitBaseSlots<Props>, SelectButtonSlots>;
|
|
142
|
+
primeSlider: MergeSlots<FormKitBaseSlots<Props>, SliderSlots>;
|
|
143
|
+
primeTextarea: MergeSlots<FormKitBaseSlots<Props>, TextareaSlots>;
|
|
144
|
+
primeToggleButton: MergeSlots<FormKitBaseSlots<Props>, ToggleButtonSlots>;
|
|
145
|
+
primeToggleSwitch: MergeSlots<FormKitBaseSlots<Props>, ToggleSwitchSlots>;
|
|
146
|
+
primeTreeSelect: MergeSlots<FormKitBaseSlots<Props>, TreeSelectSlots>;
|
|
147
|
+
}
|
|
111
148
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfxcode/formkit-primevue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.2.
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
4
|
+
"version": "3.2.10",
|
|
5
|
+
"packageManager": "pnpm@10.29.2+sha512.bef43fa759d91fd2da4b319a5a0d13ef7a45bb985a3d7342058470f9d2051a3ba8674e629672654686ef9443ad13a82da2beb9eeb3e0221c87b8154fff9d74b8",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Tom",
|
|
8
8
|
"email": "tom@sfxcode.com"
|
|
@@ -101,48 +101,48 @@
|
|
|
101
101
|
"vue-i18n": "^11.2.8"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@antfu/eslint-config": "^
|
|
104
|
+
"@antfu/eslint-config": "^7.3.0",
|
|
105
105
|
"@formkit/core": "^1.6.9",
|
|
106
106
|
"@formkit/drag-and-drop": "^0.5.3",
|
|
107
|
-
"@primeuix/themes": "^2.0.
|
|
108
|
-
"@types/node": "^25.
|
|
109
|
-
"@unocss/preset-icons": "66.
|
|
110
|
-
"@unocss/preset-uno": "66.
|
|
111
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
112
|
-
"@vitest/coverage-v8": "^4.0.
|
|
113
|
-
"@vitest/ui": "^4.0.
|
|
114
|
-
"@vue/compiler-sfc": "^3.5.
|
|
115
|
-
"@vue/server-renderer": "^3.5.
|
|
107
|
+
"@primeuix/themes": "^2.0.3",
|
|
108
|
+
"@types/node": "^25.2.2",
|
|
109
|
+
"@unocss/preset-icons": "66.6.0",
|
|
110
|
+
"@unocss/preset-uno": "66.6.0",
|
|
111
|
+
"@vitejs/plugin-vue": "^6.0.4",
|
|
112
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
113
|
+
"@vitest/ui": "^4.0.18",
|
|
114
|
+
"@vue/compiler-sfc": "^3.5.28",
|
|
115
|
+
"@vue/server-renderer": "^3.5.28",
|
|
116
116
|
"@vue/test-utils": "^2.4.6",
|
|
117
117
|
"@vue/tsconfig": "^0.8.1",
|
|
118
|
-
"@vueuse/core": "^14.
|
|
118
|
+
"@vueuse/core": "^14.2.0",
|
|
119
119
|
"@vueuse/head": "^2.0.0",
|
|
120
120
|
"changelogen": "^0.6.2",
|
|
121
121
|
"chart.js": "^4.5.1",
|
|
122
122
|
"consola": "^3.4.2",
|
|
123
123
|
"cookie": "^1.1.1",
|
|
124
|
-
"esbuild": "^0.27.
|
|
125
|
-
"eslint": "^
|
|
126
|
-
"happy-dom": "^20.
|
|
124
|
+
"esbuild": "^0.27.3",
|
|
125
|
+
"eslint": "^10.0.0",
|
|
126
|
+
"happy-dom": "^20.5.3",
|
|
127
127
|
"json-editor-vue": "^0.18.1",
|
|
128
128
|
"mkdist": "^2.4.1",
|
|
129
|
-
"sass": "^1.97.
|
|
129
|
+
"sass": "^1.97.3",
|
|
130
130
|
"tslib": "^2.8.1",
|
|
131
131
|
"typescript": "^5.9.3",
|
|
132
132
|
"unbuild": "^3.6.1",
|
|
133
|
-
"unocss": "66.
|
|
134
|
-
"unplugin-auto-import": "^
|
|
135
|
-
"unplugin-vue-components": "^
|
|
133
|
+
"unocss": "66.6.0",
|
|
134
|
+
"unplugin-auto-import": "^21.0.0",
|
|
135
|
+
"unplugin-vue-components": "^31.0.0",
|
|
136
136
|
"vite": "^7.3.1",
|
|
137
137
|
"vite-plugin-dts": "^4.5.4",
|
|
138
138
|
"vite-plugin-eslint": "^1.8.1",
|
|
139
|
-
"vite-plugin-pages": "^0.33.
|
|
140
|
-
"vite-ssg": "^28.
|
|
139
|
+
"vite-plugin-pages": "^0.33.3",
|
|
140
|
+
"vite-ssg": "^28.3.0",
|
|
141
141
|
"vitepress": "2.0.0-alpha.12",
|
|
142
|
-
"vitest": "^4.0.
|
|
143
|
-
"vue": "^3.5.
|
|
142
|
+
"vitest": "^4.0.18",
|
|
143
|
+
"vue": "^3.5.28",
|
|
144
144
|
"vue-demi": "^0.14.10",
|
|
145
|
-
"vue-router": "^
|
|
146
|
-
"vue-tsc": "^3.2.
|
|
145
|
+
"vue-router": "^5.0.2",
|
|
146
|
+
"vue-tsc": "^3.2.4"
|
|
147
147
|
}
|
|
148
148
|
}
|