@sfxcode/formkit-primevue 1.8.6 → 1.9.0
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/README.md +1 -3
- package/dist/components/PrimeAutoComplete.vue +37 -11
- package/dist/components/PrimeCalendar.vue +109 -16
- package/dist/components/PrimeCascadeSelect.vue +41 -10
- package/dist/components/PrimeCheckbox.vue +40 -14
- package/dist/components/PrimeChips.vue +35 -11
- package/dist/components/PrimeColorPicker.vue +31 -11
- package/dist/components/PrimeDropdown.vue +90 -16
- package/dist/components/PrimeEditor.vue +32 -14
- package/dist/components/PrimeInputMask.vue +69 -18
- package/dist/components/PrimeInputNumber.vue +55 -13
- package/dist/components/PrimeInputSwitch.vue +40 -14
- package/dist/components/PrimeInputText.vue +45 -20
- package/dist/components/PrimeKnob.vue +47 -13
- package/dist/components/PrimeListbox.vue +52 -12
- package/dist/components/PrimeMultiSelect.vue +96 -11
- package/dist/components/PrimePassword.vue +48 -13
- package/dist/components/PrimeRadioButton.vue +33 -15
- package/dist/components/PrimeRating.vue +40 -14
- package/dist/components/PrimeSelectButton.vue +44 -11
- package/dist/components/PrimeSlider.vue +42 -12
- package/dist/components/PrimeTextarea.vue +32 -13
- package/dist/components/PrimeToggleButton.vue +39 -11
- package/dist/components/PrimeTreeSelect.vue +50 -11
- package/dist/components/PrimeTriStateCheckbox.vue +36 -13
- package/dist/index.d.ts +55 -56
- package/dist/index.js +24 -24
- package/dist/index.mjs +343 -24
- package/dist/sass/formkit-primevue.scss +4 -0
- package/dist/style.css +1 -1
- package/package.json +12 -11
|
@@ -1,25 +1,34 @@
|
|
|
1
|
-
<script setup lang=
|
|
2
|
-
import {
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { EditorProps, EditorSelectionChangeEvent } from 'primevue/editor'
|
|
3
|
+
import { type PropType, computed } from 'vue'
|
|
4
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
export interface FormKitPrimeEditorProps {
|
|
7
|
+
placeholder?: EditorProps['placeholder']
|
|
8
|
+
formats?: EditorProps['formats']
|
|
9
|
+
modules?: EditorProps['modules']
|
|
10
|
+
pt?: EditorProps['pt']
|
|
11
|
+
ptOptions?: EditorProps['ptOptions']
|
|
12
|
+
unstyled?: EditorProps['unstyled']
|
|
13
|
+
}
|
|
5
14
|
|
|
6
15
|
const props = defineProps({
|
|
7
|
-
context:
|
|
16
|
+
context: {
|
|
17
|
+
type: Object as PropType<FormKitFrameworkContext & FormKitPrimeEditorProps>,
|
|
18
|
+
required: true,
|
|
19
|
+
},
|
|
8
20
|
})
|
|
9
21
|
|
|
10
|
-
const context = props.context
|
|
11
|
-
const attrs = computed(() => context?.attrs)
|
|
12
|
-
|
|
13
22
|
function handleInput(e: any) {
|
|
14
|
-
context?.node.input(e.htmlValue)
|
|
23
|
+
props.context?.node.input(e.htmlValue)
|
|
15
24
|
}
|
|
16
25
|
|
|
17
26
|
function handleSelection(e: EditorSelectionChangeEvent) {
|
|
18
27
|
if (e.range === null)
|
|
19
|
-
context?.handlers.blur(e.htmlValue)
|
|
28
|
+
props.context?.handlers.blur(e.htmlValue)
|
|
20
29
|
}
|
|
21
30
|
|
|
22
|
-
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${
|
|
31
|
+
const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
|
|
23
32
|
</script>
|
|
24
33
|
|
|
25
34
|
<template>
|
|
@@ -27,11 +36,20 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
|
|
|
27
36
|
<Editor
|
|
28
37
|
:id="context.id"
|
|
29
38
|
v-model="context._value"
|
|
30
|
-
v-bind="attrs"
|
|
31
|
-
:disabled="
|
|
32
|
-
:readonly="attrs._readonly ?? false"
|
|
33
|
-
:editor-style="attrs.style"
|
|
39
|
+
v-bind="context?.attrs"
|
|
40
|
+
:disabled="!!context?.disabled"
|
|
41
|
+
:readonly="context?.attrs._readonly ?? false"
|
|
42
|
+
:editor-style="context?.attrs.style"
|
|
34
43
|
:class="styleClass"
|
|
44
|
+
:tabindex="context?.attrs.tabindex"
|
|
45
|
+
:aria-label="context?.attrs.ariaLabel"
|
|
46
|
+
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
47
|
+
:placeholder="context.placeholder"
|
|
48
|
+
:formats="context.formats"
|
|
49
|
+
:modules="context.modules"
|
|
50
|
+
:pt="context.pt"
|
|
51
|
+
:pt-options="context.ptOptions"
|
|
52
|
+
:unstyled="context.unstyled ?? false"
|
|
35
53
|
@text-change="handleInput"
|
|
36
54
|
@selection-change="handleSelection"
|
|
37
55
|
/>
|
|
@@ -1,31 +1,82 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { type PropType, computed } from 'vue'
|
|
3
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
4
|
+
import type { InputMaskProps } from 'primevue/inputmask'
|
|
5
|
+
|
|
6
|
+
export interface FormKitPrimeInputMaskProps {
|
|
7
|
+
mask?: InputMaskProps['mask']
|
|
8
|
+
slotChar?: InputMaskProps['slotChar']
|
|
9
|
+
autoClear?: InputMaskProps['autoClear']
|
|
10
|
+
unmask?: InputMaskProps['unmask']
|
|
11
|
+
pt?: InputMaskProps['pt']
|
|
12
|
+
ptOptions?: InputMaskProps['ptOptions']
|
|
13
|
+
unstyled?: InputMaskProps['unstyled']
|
|
14
|
+
invalid?: InputMaskProps['invalid']
|
|
15
|
+
variant?: InputMaskProps['variant']
|
|
16
|
+
iconLeft?: string
|
|
17
|
+
iconRight?: string
|
|
18
|
+
}
|
|
3
19
|
|
|
4
20
|
const props = defineProps({
|
|
5
|
-
context:
|
|
21
|
+
context: {
|
|
22
|
+
type: Object as PropType<FormKitFrameworkContext & FormKitPrimeInputMaskProps>,
|
|
23
|
+
required: true,
|
|
24
|
+
},
|
|
6
25
|
})
|
|
7
26
|
|
|
8
|
-
|
|
9
|
-
|
|
27
|
+
function handleInput(e: FocusEvent) {
|
|
28
|
+
props.context?.node.input(props.context?._value)
|
|
29
|
+
props.context?.handlers.blur(e)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function hasLeftIcon() {
|
|
33
|
+
return props.context?.iconLeft && props.context?.iconLeft.length > 0
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function hasRightIcon() {
|
|
37
|
+
return props.context?.iconRight && props.context?.iconRight.length > 0
|
|
38
|
+
}
|
|
10
39
|
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
40
|
+
function spanClass() {
|
|
41
|
+
let result = ''
|
|
42
|
+
if (hasLeftIcon())
|
|
43
|
+
result = `${result}p-input-icon-left `
|
|
44
|
+
if (hasRightIcon())
|
|
45
|
+
result = `${result}p-input-icon-right `
|
|
46
|
+
return result
|
|
14
47
|
}
|
|
15
|
-
|
|
48
|
+
|
|
49
|
+
const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
|
|
16
50
|
</script>
|
|
17
51
|
|
|
18
52
|
<template>
|
|
19
53
|
<div class="p-formkit">
|
|
20
|
-
<
|
|
21
|
-
:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
54
|
+
<span :class="spanClass()">
|
|
55
|
+
<i v-if="hasLeftIcon()" :class="context.iconLeft" />
|
|
56
|
+
|
|
57
|
+
<InputMask
|
|
58
|
+
:id="context.id"
|
|
59
|
+
v-model="context._value"
|
|
60
|
+
v-bind="context?.attrs"
|
|
61
|
+
:disabled="!!context?.disabled"
|
|
62
|
+
:readonly="context?.attrs._readonly ?? false"
|
|
63
|
+
:class="styleClass"
|
|
64
|
+
:tabindex="context?.attrs.tabindex"
|
|
65
|
+
:aria-label="context?.attrs.ariaLabel"
|
|
66
|
+
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
67
|
+
:mask="context.mask ?? undefined"
|
|
68
|
+
:slot-char="context.slotChar ?? '_'"
|
|
69
|
+
:auto-clear="context.autoClear ?? true"
|
|
70
|
+
:unmask="context.unmask ?? false"
|
|
71
|
+
:pt="context.pt"
|
|
72
|
+
:invalid="context.invalid"
|
|
73
|
+
:variant="context.variant"
|
|
74
|
+
:pt-options="context.ptOptions"
|
|
75
|
+
:unstyled="context.unstyled ?? false"
|
|
76
|
+
@blur="handleInput"
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<i v-if="hasRightIcon" :class="context.iconRight" />
|
|
80
|
+
</span>
|
|
30
81
|
</div>
|
|
31
82
|
</template>
|
|
@@ -1,33 +1,75 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { type PropType, computed } from 'vue'
|
|
3
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
4
|
+
import type { InputNumberBlurEvent, InputNumberProps } from 'primevue/inputnumber'
|
|
5
|
+
|
|
6
|
+
export interface FormKitPrimeInputNumberProps {
|
|
7
|
+
useGrouping?: InputNumberProps['useGrouping']
|
|
8
|
+
min?: InputNumberProps['min']
|
|
9
|
+
max?: InputNumberProps['max']
|
|
10
|
+
minFractionDigits?: InputNumberProps['minFractionDigits']
|
|
11
|
+
maxFractionDigits?: InputNumberProps['maxFractionDigits']
|
|
12
|
+
locale?: InputNumberProps['locale']
|
|
13
|
+
mode?: InputNumberProps['mode']
|
|
14
|
+
currency?: InputNumberProps['currency']
|
|
15
|
+
prefix?: InputNumberProps['prefix']
|
|
16
|
+
suffix?: InputNumberProps['suffix']
|
|
17
|
+
showButtons?: InputNumberProps['showButtons']
|
|
18
|
+
buttonLayout?: InputNumberProps['buttonLayout']
|
|
19
|
+
step?: InputNumberProps['step']
|
|
20
|
+
pt?: InputNumberProps['pt']
|
|
21
|
+
ptOptions?: InputNumberProps['ptOptions']
|
|
22
|
+
unstyled?: InputNumberProps['unstyled']
|
|
23
|
+
placeholder?: InputNumberProps['placeholder']
|
|
24
|
+
}
|
|
3
25
|
|
|
4
26
|
const props = defineProps({
|
|
5
|
-
context:
|
|
27
|
+
context: {
|
|
28
|
+
type: Object as PropType<FormKitFrameworkContext & FormKitPrimeInputNumberProps>,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
6
31
|
})
|
|
7
32
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function handleBlur(e: any) {
|
|
12
|
-
context?.handlers.blur(e.value)
|
|
33
|
+
function handleBlur(e: InputNumberBlurEvent) {
|
|
34
|
+
props.context?.handlers.blur(e.originalEvent)
|
|
13
35
|
}
|
|
14
36
|
|
|
15
37
|
function handleInput(e: any) {
|
|
16
|
-
context?.node.input(e.value)
|
|
38
|
+
props.context?.node.input(e.value)
|
|
17
39
|
}
|
|
18
|
-
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${
|
|
40
|
+
const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
|
|
19
41
|
</script>
|
|
20
42
|
|
|
21
43
|
<template>
|
|
22
44
|
<div class="p-formkit">
|
|
23
45
|
<InputNumber
|
|
24
46
|
v-model="context._value"
|
|
25
|
-
v-bind="attrs"
|
|
47
|
+
v-bind="context?.attrs"
|
|
26
48
|
:input-id="context.id"
|
|
27
|
-
:disabled="
|
|
28
|
-
:readonly="attrs._readonly ?? false"
|
|
29
|
-
:input-style="attrs.style"
|
|
49
|
+
:disabled="!!context?.disabled"
|
|
50
|
+
:readonly="context?.attrs._readonly ?? false"
|
|
51
|
+
:input-style="context?.attrs.style"
|
|
30
52
|
:input-class="styleClass"
|
|
53
|
+
:tabindex="context?.attrs.tabindex"
|
|
54
|
+
:aria-label="context?.attrs.ariaLabel"
|
|
55
|
+
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
56
|
+
:placeholder="context.placeholder"
|
|
57
|
+
:use-grouping="context.useGrouping ?? true"
|
|
58
|
+
:min="context.min ?? undefined"
|
|
59
|
+
:max="context.max ?? undefined"
|
|
60
|
+
:min-fraction-digits="context.minFractionDigits ?? undefined"
|
|
61
|
+
:max-fraction-digits="context.maxFractionDigits ?? undefined"
|
|
62
|
+
:locale="context.locale ?? undefined"
|
|
63
|
+
:mode="context.mode ?? undefined"
|
|
64
|
+
:currency="context.currency ?? undefined"
|
|
65
|
+
:prefix="context.prefix ?? undefined"
|
|
66
|
+
:suffix="context.suffix ?? undefined"
|
|
67
|
+
:show-buttons="context.showButtons ?? undefined"
|
|
68
|
+
:button-layout="context.buttonLayout ?? 'stacked'"
|
|
69
|
+
:step="context.step ?? undefined"
|
|
70
|
+
:pt="context.pt"
|
|
71
|
+
:pt-options="context.ptOptions"
|
|
72
|
+
:unstyled="context.unstyled ?? false"
|
|
31
73
|
@input="handleInput"
|
|
32
74
|
@blur="handleBlur"
|
|
33
75
|
/>
|
|
@@ -1,32 +1,58 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { type PropType, computed } from 'vue'
|
|
3
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
4
|
+
import type { InputSwitchProps } from 'primevue/inputswitch'
|
|
5
|
+
|
|
6
|
+
export interface FormKitPrimeInputSwitchProps {
|
|
7
|
+
trueValue?: InputSwitchProps['trueValue']
|
|
8
|
+
falseValue?: InputSwitchProps['falseValue']
|
|
9
|
+
pt?: InputSwitchProps['pt']
|
|
10
|
+
ptOptions?: InputSwitchProps['ptOptions']
|
|
11
|
+
unstyled?: InputSwitchProps['unstyled']
|
|
12
|
+
labelLeft?: string
|
|
13
|
+
labelRight?: string
|
|
14
|
+
}
|
|
3
15
|
|
|
4
16
|
const props = defineProps({
|
|
5
|
-
context:
|
|
17
|
+
context: {
|
|
18
|
+
type: Object as PropType<FormKitFrameworkContext & FormKitPrimeInputSwitchProps>,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
6
21
|
})
|
|
7
22
|
|
|
8
|
-
const context = props.context
|
|
9
|
-
const attrs = computed(() => context?.attrs)
|
|
10
|
-
|
|
11
23
|
function handleInput(e: any) {
|
|
12
|
-
context?.node.input(props.context?._value)
|
|
24
|
+
props.context?.node.input(props.context?._value)
|
|
13
25
|
}
|
|
14
|
-
|
|
26
|
+
|
|
27
|
+
function handleBlur(e: Event) {
|
|
28
|
+
props.context?.handlers.blur(e)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
|
|
15
32
|
</script>
|
|
16
33
|
|
|
17
34
|
<template>
|
|
18
|
-
<div :class="attrs.option_class" class="p-formkit">
|
|
19
|
-
<span v-if="context.attrs.labelLeft" class="formkit-prime-left">{{ context.
|
|
35
|
+
<div :class="context?.attrs.option_class" class="p-formkit">
|
|
36
|
+
<span v-if="context.attrs.labelLeft" class="formkit-prime-left">{{ context.labelLeft }}</span>
|
|
20
37
|
<InputSwitch
|
|
21
38
|
v-model="context._value"
|
|
22
|
-
v-bind="attrs"
|
|
39
|
+
v-bind="context?.attrs"
|
|
23
40
|
:input-id="context.id"
|
|
24
|
-
:disabled="
|
|
25
|
-
:readonly="attrs._readonly ?? false"
|
|
26
|
-
:input-style="attrs.style"
|
|
41
|
+
:disabled="!!context?.disabled"
|
|
42
|
+
:readonly="context?.attrs._readonly ?? false"
|
|
43
|
+
:input-style="context?.attrs.style"
|
|
27
44
|
:input-class="styleClass"
|
|
45
|
+
:tabindex="context?.attrs.tabindex"
|
|
46
|
+
:aria-label="context?.attrs.ariaLabel"
|
|
47
|
+
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
48
|
+
:true-value="context.trueValue ?? undefined"
|
|
49
|
+
:false-value="context.falseValue ?? undefined"
|
|
50
|
+
:pt="context.pt"
|
|
51
|
+
:pt-options="context.ptOptions"
|
|
52
|
+
:unstyled="context.unstyled ?? false"
|
|
28
53
|
@change="handleInput"
|
|
54
|
+
@blur="handleBlur"
|
|
29
55
|
/>
|
|
30
|
-
<span v-if="context.attrs.labelRight" class="formkit-prime-right">{{ context.
|
|
56
|
+
<span v-if="context.attrs.labelRight" class="formkit-prime-right">{{ context.labelRight }}</span>
|
|
31
57
|
</div>
|
|
32
58
|
</template>
|
|
@@ -1,40 +1,58 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { type PropType, computed } from 'vue'
|
|
3
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
4
|
+
import type { InputTextProps } from 'primevue/inputtext'
|
|
5
|
+
|
|
6
|
+
export interface FormKitPrimeInputTextProps {
|
|
7
|
+
pt?: InputTextProps['pt']
|
|
8
|
+
ptOptions?: InputTextProps['ptOptions']
|
|
9
|
+
unstyled?: InputTextProps['unstyled']
|
|
10
|
+
placeholder?: InputTextProps['placeholder']
|
|
11
|
+
icon?: string
|
|
12
|
+
}
|
|
3
13
|
|
|
4
14
|
const props = defineProps({
|
|
5
|
-
context:
|
|
15
|
+
context: {
|
|
16
|
+
type: Object as PropType<FormKitFrameworkContext & FormKitPrimeInputTextProps>,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
6
19
|
})
|
|
7
20
|
|
|
8
|
-
const context = props.context
|
|
9
|
-
const attrs = computed(() => context?.attrs)
|
|
10
|
-
|
|
11
21
|
function hasIcon() {
|
|
12
|
-
return context?.icon && context?.icon.length > 0
|
|
22
|
+
return props.context?.attrs?.icon && props.context?.attrs?.icon.length > 0
|
|
13
23
|
}
|
|
14
24
|
|
|
15
|
-
function handleBlur(e:
|
|
16
|
-
context?.handlers.blur(e
|
|
25
|
+
function handleBlur(e: Event) {
|
|
26
|
+
props.context?.handlers.blur(e)
|
|
17
27
|
}
|
|
18
28
|
|
|
19
29
|
function handleInput(e: any) {
|
|
20
|
-
context?.node.input(e.target.value)
|
|
30
|
+
props.context?.node.input(e.target.value)
|
|
21
31
|
}
|
|
22
32
|
|
|
23
|
-
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${
|
|
33
|
+
const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
|
|
24
34
|
</script>
|
|
25
35
|
|
|
26
36
|
<template>
|
|
27
37
|
<div class="p-formkit">
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
{{ context.attrs.icon }}
|
|
39
|
+
<IconField v-if="hasIcon()" :icon-position="context?.attrs.iconPosition">
|
|
40
|
+
<InputIcon :class="context.attrs.icon" />
|
|
30
41
|
<InputText
|
|
31
42
|
:id="context.id"
|
|
32
43
|
v-model="context._value"
|
|
33
|
-
v-bind="attrs"
|
|
34
|
-
:disabled="
|
|
35
|
-
:readonly="attrs._readonly ?? false"
|
|
36
|
-
:style="attrs.style"
|
|
44
|
+
v-bind="context?.attrs"
|
|
45
|
+
:disabled="!!context?.disabled"
|
|
46
|
+
:readonly="context?.attrs._readonly ?? false"
|
|
47
|
+
:style="context?.attrs.style"
|
|
37
48
|
:class="styleClass"
|
|
49
|
+
:tabindex="context?.attrs.tabindex"
|
|
50
|
+
:aria-label="context?.attrs.ariaLabel"
|
|
51
|
+
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
52
|
+
:placeholder="context.placeholder"
|
|
53
|
+
:pt="context.pt"
|
|
54
|
+
:pt-options="context.ptOptions"
|
|
55
|
+
:unstyled="context.unstyled ?? false"
|
|
38
56
|
@input="handleInput"
|
|
39
57
|
@blur="handleBlur"
|
|
40
58
|
/>
|
|
@@ -43,11 +61,18 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
|
|
|
43
61
|
v-else
|
|
44
62
|
:id="context.id"
|
|
45
63
|
v-model="context._value"
|
|
46
|
-
v-bind="attrs"
|
|
47
|
-
:disabled="
|
|
48
|
-
:readonly="attrs._readonly ?? false"
|
|
49
|
-
:style="attrs.style"
|
|
64
|
+
v-bind="context?.attrs"
|
|
65
|
+
:disabled="!!context?.disabled"
|
|
66
|
+
:readonly="context?.attrs._readonly ?? false"
|
|
67
|
+
:style="context?.attrs.style"
|
|
50
68
|
:class="styleClass"
|
|
69
|
+
:tabindex="context?.attrs.tabindex"
|
|
70
|
+
:aria-label="context?.attrs.ariaLabel"
|
|
71
|
+
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
72
|
+
:placeholder="context.placeholder"
|
|
73
|
+
:pt="context.pt"
|
|
74
|
+
:pt-options="context.ptOptions"
|
|
75
|
+
:unstyled="context.unstyled ?? false"
|
|
51
76
|
@input="handleInput"
|
|
52
77
|
@blur="handleBlur"
|
|
53
78
|
/>
|
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { type PropType, computed } from 'vue'
|
|
3
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
4
|
+
import type { KnobProps } from 'primevue/knob'
|
|
5
|
+
|
|
6
|
+
export interface FormKitPrimeKnobProps {
|
|
7
|
+
pt?: KnobProps['pt']
|
|
8
|
+
ptOptions?: KnobProps['ptOptions']
|
|
9
|
+
unstyled?: KnobProps['unstyled']
|
|
10
|
+
min?: KnobProps['min']
|
|
11
|
+
max?: KnobProps['max']
|
|
12
|
+
step?: KnobProps['step']
|
|
13
|
+
size?: KnobProps['size']
|
|
14
|
+
strokeWidth?: KnobProps['strokeWidth']
|
|
15
|
+
showValue?: KnobProps['showValue']
|
|
16
|
+
valueColor?: KnobProps['valueColor']
|
|
17
|
+
rangeColor?: KnobProps['rangeColor']
|
|
18
|
+
textColor?: KnobProps['textColor']
|
|
19
|
+
valueTemplate?: KnobProps['valueTemplate']
|
|
20
|
+
}
|
|
3
21
|
|
|
4
22
|
const props = defineProps({
|
|
5
|
-
context:
|
|
23
|
+
context: {
|
|
24
|
+
type: Object as PropType<FormKitFrameworkContext & FormKitPrimeKnobProps>,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
6
27
|
})
|
|
7
28
|
|
|
8
|
-
const context = props.context
|
|
9
|
-
const attrs = computed(() => context?.attrs)
|
|
10
|
-
|
|
11
29
|
function handleInput(e: any) {
|
|
12
|
-
context?.node.input(e)
|
|
13
|
-
context?.handlers.blur(e)
|
|
30
|
+
props.context?.node.input(e)
|
|
31
|
+
props.context?.handlers.blur(e)
|
|
14
32
|
}
|
|
15
33
|
|
|
16
34
|
function updateValue(n: number) {
|
|
17
|
-
context?.node.input(n)
|
|
35
|
+
props.context?.node.input(n)
|
|
18
36
|
}
|
|
19
37
|
|
|
20
|
-
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${
|
|
38
|
+
const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
|
|
21
39
|
</script>
|
|
22
40
|
|
|
23
41
|
<template>
|
|
@@ -25,11 +43,27 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
|
|
|
25
43
|
<Knob
|
|
26
44
|
:id="context.id"
|
|
27
45
|
v-model="context._value"
|
|
28
|
-
v-bind="attrs"
|
|
29
|
-
:disabled="
|
|
30
|
-
:readonly="attrs._readonly ?? false"
|
|
31
|
-
:style="attrs.style"
|
|
46
|
+
v-bind="context?.attrs"
|
|
47
|
+
:disabled="!!context?.disabled"
|
|
48
|
+
:readonly="context?.attrs._readonly ?? false"
|
|
49
|
+
:style="context?.attrs.style"
|
|
32
50
|
:class="styleClass"
|
|
51
|
+
:tabindex="context?.attrs.tabindex"
|
|
52
|
+
:aria-label="context?.attrs.ariaLabel"
|
|
53
|
+
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
54
|
+
:min="context.min ?? 0"
|
|
55
|
+
:max="context.max ?? 100"
|
|
56
|
+
:step="context.step ?? undefined"
|
|
57
|
+
:size="context.size ?? 100"
|
|
58
|
+
:stroke-width="context.strokeWidth ?? 14"
|
|
59
|
+
:show-value="context.showValue ?? true"
|
|
60
|
+
:value-color="context.valueColor ?? undefined"
|
|
61
|
+
:range-color="context.rangeColor ?? undefined"
|
|
62
|
+
:text-color="context.textColor ?? undefined"
|
|
63
|
+
:value-template="context.valueTemplate ?? undefined"
|
|
64
|
+
:pt="context.pt"
|
|
65
|
+
:pt-options="context.ptOptions"
|
|
66
|
+
:unstyled="context.unstyled ?? false"
|
|
33
67
|
@change="handleInput"
|
|
34
68
|
@update:model-value="updateValue"
|
|
35
69
|
/>
|
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
<script setup lang='ts'>
|
|
2
|
-
import { computed } from 'vue'
|
|
2
|
+
import { type PropType, computed } from 'vue'
|
|
3
|
+
import type { FormKitFrameworkContext } from '@formkit/core'
|
|
4
|
+
import type { ListboxProps } from 'primevue/listbox'
|
|
5
|
+
|
|
6
|
+
export interface FormKitPrimeListboxProps {
|
|
7
|
+
pt?: ListboxProps['pt']
|
|
8
|
+
ptOptions?: ListboxProps['ptOptions']
|
|
9
|
+
unstyled?: ListboxProps['unstyled']
|
|
10
|
+
options?: ListboxProps['options']
|
|
11
|
+
optionLabel?: ListboxProps['optionLabel']
|
|
12
|
+
optionValue?: ListboxProps['optionValue']
|
|
13
|
+
multiple?: ListboxProps['multiple']
|
|
14
|
+
filter?: ListboxProps['filter']
|
|
15
|
+
filterIcon?: ListboxProps['filterIcon']
|
|
16
|
+
filterPlaceholder?: ListboxProps['filterPlaceholder']
|
|
17
|
+
filterLocale?: ListboxProps['filterLocale']
|
|
18
|
+
filterMatchMode?: ListboxProps['filterMatchMode']
|
|
19
|
+
autoOptionFocus?: ListboxProps['autoOptionFocus']
|
|
20
|
+
selectOnFocus?: ListboxProps['selectOnFocus']
|
|
21
|
+
}
|
|
3
22
|
|
|
4
23
|
const props = defineProps({
|
|
5
|
-
context:
|
|
24
|
+
context: {
|
|
25
|
+
type: Object as PropType<FormKitFrameworkContext & FormKitPrimeListboxProps>,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
6
28
|
})
|
|
7
29
|
|
|
8
|
-
const context = props.context
|
|
9
|
-
const attrs = computed(() => context?.attrs)
|
|
10
|
-
|
|
11
30
|
function handleInput(e: any) {
|
|
12
|
-
context?.node.input(props.context?._value)
|
|
31
|
+
props.context?.node.input(props.context?._value)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function handleBlur(e: Event) {
|
|
35
|
+
props.context?.handlers.blur(e)
|
|
13
36
|
}
|
|
14
37
|
|
|
15
|
-
const styleClass = computed(() => (context?.state.validationVisible && !context?.state.valid) ? `${
|
|
38
|
+
const styleClass = computed(() => (props.context?.state.validationVisible && !props.context?.state.valid) ? `${props.context?.attrs?.class} p-invalid` : props.context?.attrs?.class)
|
|
16
39
|
</script>
|
|
17
40
|
|
|
18
41
|
<template>
|
|
@@ -20,13 +43,30 @@ const styleClass = computed(() => (context?.state.validationVisible && !context?
|
|
|
20
43
|
<Listbox
|
|
21
44
|
:id="context.id"
|
|
22
45
|
v-model="context._value"
|
|
23
|
-
v-bind="attrs"
|
|
24
|
-
:disabled="
|
|
25
|
-
:readonly="attrs._readonly ?? false"
|
|
26
|
-
:list-style="attrs.style"
|
|
46
|
+
v-bind="context?.attrs"
|
|
47
|
+
:disabled="!!context?.disabled"
|
|
48
|
+
:readonly="context?.attrs._readonly ?? false"
|
|
49
|
+
:list-style="context?.attrs.style"
|
|
27
50
|
:class="styleClass"
|
|
28
|
-
:
|
|
51
|
+
:tabindex="context?.attrs.tabindex"
|
|
52
|
+
:aria-label="context?.attrs.ariaLabel"
|
|
53
|
+
:aria-labelledby="context?.attrs.ariaLabelledby"
|
|
54
|
+
:options="context?.options"
|
|
55
|
+
:option-label="context.optionLabel"
|
|
56
|
+
:option-value="context.optionValue"
|
|
57
|
+
:multiple="context.multiple ?? false"
|
|
58
|
+
:filter="context.filter ?? false"
|
|
59
|
+
:filter-icon="context.filterIcon"
|
|
60
|
+
:filter-placeholder="context.filterPlaceholder"
|
|
61
|
+
:filter-locale="context.filterLocale"
|
|
62
|
+
:filter-match-mode="context.filterMatchMode"
|
|
63
|
+
:auto-option-focus="context.autoOptionFocus ?? true"
|
|
64
|
+
:select-on-focus="context.selectOnFocus ?? false"
|
|
65
|
+
:pt="context.pt"
|
|
66
|
+
:pt-options="context.ptOptions"
|
|
67
|
+
:unstyled="context.unstyled ?? false"
|
|
29
68
|
@change="handleInput"
|
|
69
|
+
@blur="handleBlur"
|
|
30
70
|
/>
|
|
31
71
|
</div>
|
|
32
72
|
</template>
|